Results 1 to 8 of 8

Thread: [Qt 3.3.4] How do I repaint anything using QCanvas or QPainter?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: [Qt 3.3.4] How do I repaint anything using QCanvas or QPainter?

    Thanks for the hint, unfortunately it still doesn't work.

    WStaticContents seems to be exactly what I want to avoid while WNoAutoErase sounds like a solution. But it still looks the same:

    The original painter output:



    Window shrinked:



    Window enlarged again:



    Window repainted due to putting another window in front of it:




    Do you have any other ideas?

  2. #2
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: [Qt 3.3.4] How do I repaint anything using QCanvas or QPainter?

    Okay, just wanted to let you know I am using a very dirty workaround for now as time is slowly running out.

    As I thought it is possible to call hide() and show() on the widget to get it repainted (repaint() didn't work for me neither...). Since I can't call it from drawContents I decided to write a small event handler for the resized() signal emitted by QCanvas. Unfortunately this is only half the way: It works great but only when enlarging the widget.

    I couldn't find any better way to repaint it on being shrinked but by creating a QTimer that calls an event handler to check for decrease in the main widgets size and then calls hide() and show() on all widgets that need it.

    As I said that's veeeery dirty but at least it works.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [Qt 3.3.4] How do I repaint anything using QCanvas or QPainter?

    What do you need QCanvas for? Where are the QCanvasItems?

  4. #4
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: [Qt 3.3.4] How do I repaint anything using QCanvas or QPainter?

    As I said I cannot use QCanvasItems since I draw dynamically changing content and don't know how to clear a QCanvas from all its items.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [Qt 3.3.4] How do I repaint anything using QCanvas or QPainter?

    Quote Originally Posted by EnQ
    As I said I cannot use QCanvasItems since I draw dynamically changing content and don't know how to clear a QCanvas from all its items.
    So why do you use QCanvas and QCanvasView? Wouldn't it be easier to use plain QWidget?

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.