Results 1 to 5 of 5

Thread: Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)

  1. #1
    Join Date
    May 2013
    Posts
    45
    Thanks
    6
    Thanked 6 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)

    Hello,

    I am using QGraphicsView with the viewport as QGLWidget.
    QGraphicsView and a QTreeView are added to a QSplitter.
    Sliding the QSplitter results in flickering on the QGraphicsView.

    Adding QGLWidget without QGraphicsView to the QSplitter works as expected.

    The following code demonstrates Flickering with QGraphicsView, and no flickering without QGraphicsView when sliding the QSplitter.

    Qt Code:
    1. #include <QtGui>
    2. #include <QGLWidget>
    3. #include <QtWidgets>
    4.  
    5. int main(int argc, char **argv)
    6. {
    7. QApplication app(argc, argv);
    8.  
    9. // Flickering occurs when sliding a QSplitter with QGraphicsView (viewport QGLWidget).
    10. view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
    11. view->setScene(new QGraphicsScene);
    12. QSplitter *graphicsViewSplitter = new QSplitter();
    13. graphicsViewSplitter->addWidget(new QTreeView());
    14. graphicsViewSplitter->addWidget(view);
    15. graphicsViewSplitter->show();
    16.  
    17. // This works ok with a normal QGLWidget added to a QSplitter.
    18. QSplitter *openGlSplitter = new QSplitter();
    19. openGlSplitter->addWidget(new QTreeView());
    20. openGlSplitter->addWidget(new QGLWidget());
    21. openGlSplitter->show();
    22.  
    23. return app.exec();
    24. }
    To copy to clipboard, switch view to plain text mode 

    Is there a fix for this?

    Thanks

  2. #2
    Join Date
    May 2013
    Posts
    45
    Thanks
    6
    Thanked 6 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)

    Should I report as a bug?

  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: Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)

    Your two cases are different, and I doubt the splitter has anything to do with it. Do the same app, except use a single QGraphicsView or QGLWidget as the central widget of a QMainWindow and no splitter. Resize the window and see if you still get flicker.

    If so, then it will come down to the differences between what you are displaying. In the first case, you have a graphics view with a scene and a QGLWidget created with a specific QGLFormat as viewport. In the second case, you have only a default constructed QGLWidget. The default QGLFormat format may not be the same as the one you specified int he first case.

    It is very, very rare for something so obvious to be a Qt bug. It is almost always a programmer bug instead.

  4. #4
    Join Date
    May 2013
    Posts
    45
    Thanks
    6
    Thanked 6 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)

    Quote Originally Posted by d_stranz View Post
    Your two cases are different, and I doubt the splitter has anything to do with it. Do the same app, except use a single QGraphicsView or QGLWidget as the central widget of a QMainWindow and no splitter. Resize the window and see if you still get flicker.

    If so, then it will come down to the differences between what you are displaying. In the first case, you have a graphics view with a scene and a QGLWidget created with a specific QGLFormat as viewport. In the second case, you have only a default constructed QGLWidget. The default QGLFormat format may not be the same as the one you specified int he first case.

    It is very, very rare for something so obvious to be a Qt bug. It is almost always a programmer bug instead.
    Hello d_stranz,

    QGraphicsView with QGLWidget viewport in normal window is fine.
    QGraphicsView with QGLWidget viewport added to QSplitter has weird behavior when sliding the QSplitter (and resizing the window).
    QGLWidget added to QSplitter is fine.
    QGraphicsView (without QGLWidget viewport) added to QSplitter is fine.

    Qt Code:
    1. view->setViewport(new QGLWidget());
    2. view->setScene(new QGraphicsScene());
    3. QSplitter *graphicsViewSplitter = new QSplitter();
    4. graphicsViewSplitter ->addWidget(new QTreeView());
    5. graphicsViewSplitter->addWidget(view);
    6. graphicsViewSplitter->show();
    To copy to clipboard, switch view to plain text mode 

    Thanks


    Added after 26 minutes:


    It was a bug that has been fixed in 5.4
    https://bugreports.qt.io/browse/QTBUG-38327
    Last edited by scarecr0w132; 3rd February 2015 at 11:09.

  5. The following user says thank you to scarecr0w132 for this useful post:

    d_stranz (3rd February 2015)

  6. #5
    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: Flicker when sliding QSplitter with QGraphicsView(viewport QGLWidget)

    It was a bug that has been fixed in 5.4
    Hah! Well, I will go and eat my humble pie now.

Similar Threads

  1. Replies: 3
    Last Post: 12th October 2012, 11:44
  2. Replies: 5
    Last Post: 9th January 2012, 22:22
  3. Replies: 0
    Last Post: 8th April 2010, 17:06
  4. Replies: 0
    Last Post: 29th September 2009, 03:28
  5. Replies: 0
    Last Post: 17th August 2008, 18:31

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.