Results 1 to 4 of 4

Thread: GraphicsScene Background repainting

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Posts
    106
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Angry GraphicsScene Background repainting

    Hi guys,

    I want to have a grid on my graphicsScene of customized size. I have a serious problem with GraphicsScene background drawing. I have implemented the drawBackground() function in my graphicsScene class as follows:

    Qt Code:
    1. painter->drawRect(rect);
    2. if(gridSize>0)
    3. {
    4. painter->setOpacity(0.1);
    5. for(int i=0;i<rect.width();i+=gridSize)
    6. painter->drawLine(i,0,i,rect.height());
    7. for(int i=0;i<rect.height();i+=gridSize)
    8. painter->drawLine(0,i,rect.width(),i);
    9. }
    To copy to clipboard, switch view to plain text mode 

    The grid is repainted every time I move, resize, rotate any item on the scene. And this repainting leaves some extra lines drawn on the scene?? It looks very ugly. Please help me as this is urgent!!

    Regards,
    Manoj
    Last edited by jpn; 18th December 2007 at 07:32. Reason: missing [code] tags

Similar Threads

  1. background colour
    By kw in forum Qt Programming
    Replies: 6
    Last Post: 11th April 2006, 00:44
  2. Replies: 1
    Last Post: 5th April 2006, 16:44

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
  •  
Qt is a trademark of The Qt Company.