Results 1 to 5 of 5

Thread: QWidget paintevent qustion

  1. #1
    Join Date
    Apr 2009
    Posts
    206
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default QWidget paintevent qustion

    Hello friends,

    is it possible to draw only changing rects in paintevent without loosing the rest of my unchanged paintings?


    thx in adv

    codeman

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QWidget paintevent qustion

    It depends on what exactly you are up to, but have a look at Qt::WA_OpaquePaintEvent.

  3. #3
    Join Date
    Apr 2009
    Posts
    206
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: QWidget paintevent qustion

    Ok some details. I have subclass a widget and paint say 6 rects from top to bottom. so when I hover a specific rect region I update the icon of the rect.

    And I want only paint this rect with the changed rect without loosing the other rect, where no changings are affected.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QWidget paintevent qustion

    Ok, for that you could use Qt::WA_OpaquePaintEvent. Thus the image wont change. You have to calculate yourself which areas need an update. But be aware that calculating can cost much so that painting all could be faster. Also think about caching common parts using QPixmapCache.

  5. #5
    Join Date
    Apr 2009
    Posts
    206
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: QWidget paintevent qustion

    Ok I try it thank you very much

Similar Threads

  1. Replies: 0
    Last Post: 15th April 2011, 23:38
  2. Database qustion
    By janorcutt in forum Qt Programming
    Replies: 1
    Last Post: 15th January 2011, 13:28
  3. Replies: 0
    Last Post: 29th April 2010, 05:44
  4. QWidget::paintEvent() behaviour
    By Caius Aérobus in forum Qt Programming
    Replies: 5
    Last Post: 11th April 2008, 17:55
  5. Replies: 1
    Last Post: 2nd May 2006, 21:11

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.