Results 1 to 3 of 3

Thread: QGraphicsItem::paint() triggered only once

  1. #1
    Join Date
    Feb 2016
    Posts
    8
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default QGraphicsItem::paint() triggered only once

    Hi, i have class inherit frome QGraphicsItem, and problem is that paint function triggered only once, after this one call, i cant repaint this item even if i try use update funktion, or prepareGeometryChange. Item can be repainted only when i resize program window. I use qDebug so i'm sure that function is not triggered, and in first time, and when i resized window paint work correctly.
    Any suggestion?

  2. #2
    Join Date
    Feb 2016
    Posts
    8
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QGraphicsItem::paint() triggered only once

    Hi guys,
    i find cause of my problem. I used eventfilter in QObject which "control" QGraphicsItem objects, and i dont put in end of eventfilter function this: return QObject::eventFilter(obj, event); so i think that all of events were "taken" by me, and cant work correctly.
    Next time i put to thread my code, maybe then somebody see error like in this case.
    Thread can be close. Thx

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QGraphicsItem::paint() triggered only once

    Is the item visible? (QGraphicsItem::isVisible() returns true). Is paint() called when you change the visibility (setVisible( false ), followed by setVisible( true ))? Do you call update() on the scene or on the item itself?

    Edit - our posts crossed. You are right - if your event filter eats all the events, then of course nothing can happen.

Similar Threads

  1. QGraphicsItem paint problem
    By mvbhavsar in forum Newbie
    Replies: 5
    Last Post: 10th February 2015, 08:06
  2. Replies: 0
    Last Post: 22nd July 2014, 21:36
  3. Help on QGraphicsItem::paint please
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 18th July 2011, 08:11
  4. QGraphicsItem paint not triggered
    By roband915 in forum Qt Programming
    Replies: 9
    Last Post: 31st March 2011, 10:06
  5. Replies: 3
    Last Post: 28th September 2010, 10:48

Tags for this Thread

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.