Results 1 to 17 of 17

Thread: QScrollView and repaint

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QScrollView and repaint

    No, they don't.

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QScrollView and repaint

    Shouldn't the lines be drawn as I move the window ? I mean, shouldn't the drawContents be called and the drawing should be updated?

    Now, since we know that drawContents is not called, is there a way be which I can detect this and call repaint()

    Thanks a lot for your time.
    Thanks a lot

  3. #3
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QScrollView and repaint

    Any ideas on this one ?

    Thanks.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QScrollView and repaint

    A simple way around this is to add a child widget to the scrollview and do all the drawing in the paint event of the widget.

    Qt Code:
    1. class MyWidget : public QWidget{
    2. public:
    3. MyWidget(QWidget *parent = 0) : QWidget(parent){}
    4. protected:
    5. void paintEvent(QPaintEvent *pe){
    6. //...
    7. }
    8. };
    9. //...
    10. wid = new MyWidget(viewport());
    11. wid.resize(600, 400);
    12. //...
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. repaint help pls
    By munna in forum Qt Programming
    Replies: 3
    Last Post: 21st June 2006, 10:52

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.