Results 1 to 5 of 5

Thread: background painting in the Scene

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    40
    Thanked 8 Times in 4 Posts

    Default background painting in the Scene

    Hi,

    I have a question about some painter behaviour.
    I have overloaded the the drawBackground for my scene. When a user sets m_draw flag to true some text should be drawn:
    Qt Code:
    1. void GScene::drawBackground(QPainter *painter, const QRectF &rect)
    2. {
    3. ....some drawing
    4. if(m_draw)
    5. {
    6. painter->drawText(QPointF(0,0),"Text");
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

    But the "Text" is not drawn. When I invalidate the scene and (m_draw==TRUE), while debugging, I see that the code is invoked, but nothing is drawn. In the console nothing is printed, no warning, no error.

    Thanks for any help.

    P.S.

    I have also tried this, and it works...
    Qt Code:
    1. ....
    2. if(1)
    3. {
    4. if(1)
    5. {
    6. painter->drawText(QPointF(0,0),"Text2");
    7. }
    8. }
    9. .....
    To copy to clipboard, switch view to plain text mode 
    Last edited by maverick_pol; 7th January 2008 at 18:57.
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

Similar Threads

  1. Creating new scene from a part of an old one
    By maverick_pol in forum Qt Programming
    Replies: 6
    Last Post: 28th November 2007, 18:14
  2. Painting directly on the scene
    By maverick_pol in forum Qt Programming
    Replies: 3
    Last Post: 27th September 2007, 13:55
  3. Creating a scene from piece of another scene
    By maverick_pol in forum Qt Programming
    Replies: 3
    Last Post: 23rd August 2007, 17:51
  4. How to use QGraphicsView and Scene right ...
    By Mike in forum Qt Programming
    Replies: 6
    Last Post: 22nd January 2007, 08:51
  5. 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.