Results 1 to 4 of 4

Thread: how to bypass repainting a containing widget?

  1. #1
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default how to bypass repainting a containing widget?

    Should be simple enough, but suffering from old-timer's disease it appears....

    Have a widget which paints a background graphic. Widget is derived from QGroupBox but shouldn't matter.

    Other widgets are placed inside. One of these widgets happens to be another widget which gets a wavy line drawn in it based on input data. For some reason, every time a point or piece of line gets drawn in that widget the background paint for entire widget is getting called. It shouldn't be because there is nothing for it to do.

    Suggestions?

    Thanks

    Roland

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how to bypass repainting a containing widget?

    Can you check if the paintEvent on the container is only for the area of the child or for the whole container?

    My guess is that it is just for the area of the child, basically the automatic background painting for the child. In which case some flags like widget attributes Qt::WA_NoSystemBackground or Qt::WA_OpaquePaintEvent or Qt::WA_TranslucentBackground might help.

    Cheers,
    _

  3. #3
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to bypass repainting a containing widget?

    Thanks for the guess anda,

    No, it's not a child. It's a compound widget. There is a groupbox containing an image which provides the background image for the entire group area. On "top" of that are many other widgets. The particular widget causing the problem is drawing a wave line on its own background. I didn't write this code so I need to go digging in some examples because I think this one is simply wrong. Previous developer is calling update() passing the QRect() containing the new line segment. Each one of those is propagating out to case the background paint even though that piece of the background is completely hidden. One doesn't know about the other so "ignoring" the event would be a bit involved.

    Thanks again for trying. Always difficult to answer things on here without complete picture.

    Roland

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how to bypass repainting a containing widget?

    Quote Originally Posted by RolandHughes View Post
    No, it's not a child. It's a compound widget.
    Misunderstanding

    What I was asking is: if you check the paint event received by the parent/conainer (the compound widget), does its update rect information indicate that the area of that particular child is to be repainted or is repainting of the whole container being requested?

    Cheers,
    _

Similar Threads

  1. [qt5] repainting qwidget
    By zodiac in forum Qt Programming
    Replies: 11
    Last Post: 25th July 2012, 15:10
  2. Repainting a QGraphicsView
    By Luc4 in forum Qt Programming
    Replies: 8
    Last Post: 29th April 2010, 14:09
  3. QGraphicsItem not repainting
    By eijnuhs in forum Qt Programming
    Replies: 3
    Last Post: 20th September 2008, 08:54
  4. use GNU make entirely and bypass qmake?
    By kevinm in forum Qt Programming
    Replies: 1
    Last Post: 5th September 2008, 22:40
  5. Repainting widget
    By fear in forum Qt Programming
    Replies: 3
    Last Post: 26th March 2008, 08:37

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.