Results 1 to 3 of 3

Thread: drawing a grid

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question drawing a grid

    how can i draw a grid of points on a widget of type QgraphicsView?

    I reimplement the PaintEvent method in my custom QgraphicsView class, but i can't see the points i draw......

    A simple line drawing i have implemented:
    Qt Code:
    1. void myview::paintEvent(QPaintEvent* event){
    2. qreal x,y,w,h;
    3. myscene->sceneRect().getRect(&x,&y,&w,&h);
    4.  
    5. QPainter painter(this);
    6. painter.setPen(Qt::black);
    7. painter.drawLine(x,y,w/2,h/2);
    8.  
    9. QGraphicsView::paintEvent(event);
    10. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by dreamer; 26th April 2008 at 19:06.

Similar Threads

  1. Snap-to grid on QGraphicsItem
    By hardgeus in forum Qt Programming
    Replies: 9
    Last Post: 28th April 2008, 16:22
  2. "Lay Out in a Grid" - how to see the grid?
    By will49 in forum Qt Tools
    Replies: 1
    Last Post: 25th July 2007, 20:09
  3. How to fill the blocks of the Grid one by one?
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 6th June 2007, 12:20
  4. Grid Problem
    By merry in forum Qt Programming
    Replies: 2
    Last Post: 6th June 2007, 10:40
  5. Drawing on QWidget - strech & resize
    By kemp in forum Qt Programming
    Replies: 5
    Last Post: 22nd January 2007, 14:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.