Results 1 to 6 of 6

Thread: QOpenGLWidget inside a QDockWidget not updated when QDockWidget::setFloating(true)

  1. #1
    Join Date
    Feb 2014
    Posts
    23
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default QOpenGLWidget inside a QDockWidget not updated when QDockWidget::setFloating(true)

    Hello Qt wizards,

    I've been pulling my hair one this one for a few months now, expecting that Qt 5.8 would solve this issue but unfortunately, it is not the case.

    So basically, rendering a QOpenGLWidget placed in a QDockWidget works beautifully when docked but as soon as it is floating, the QOpenGLWidget hangs on the last rendered frame. Strangely enough, when hovering the cursor over the children widgets (of the same dock), I get new frames rendered.

    Does anyone ever encounter this behavior and/or have any insight on how to fix this?

    Thank you,

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

    Default Re: QOpenGLWidget inside a QDockWidget not updated when QDockWidget::setFloating(true

    That could be a bug.

    Have you tried locating similar reports in the Qt bug tracker?

    Cheers,
    _

  3. #3
    Join Date
    Feb 2014
    Posts
    23
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QOpenGLWidget inside a QDockWidget not updated when QDockWidget::setFloating(true

    Hello Anda,

    Thank you for your suggestions,

    It appears that the docking/un-docking has several issues. The closest ones I could find:

    An easy way to workaround the problem is to app.setAttribute(Qt::AA_DontCreateNativeWidgetSibl ings) right after instantiating the QApplication. This should ensure the underlying QWindow hierarchy remains minimal, limiting any kind of side effects.
    https://bugreports.qt.io/browse/QTBUG-31048

    QDockWidget when floating with a central QGLWidget stops redrawing or permanently "burns" into the screen
    https://bugreports.qt.io/browse/QTBUG-36967

    It mentioned QApplication::setAttribute(Qt::AA_NativeWindows) but it doesn't help in my case.

    Which leads to this:

    QDockWidget and QToolBar set the Qt::BypassWindowManagerHint window flag
    when unplugging and clear it in the endDrag() methods. This does not have
    any effect since the attribute is not taken into account in
    QXcbWindow::setWindowFlags(). Change the method to always set the attributes,
    which should also make it possible to set/clear Qt::WindowTransparentForInput.

    So again, not very helpful here.

    Also:

    https://bugreports.qt.io/browse/QTBU...%20floating%22

    so it seems to be a known bug but nothing is very helpful for fixing it so far, at least on Windows 8.1.

    I'm still digging,
    Last edited by neosettler; 25th January 2017 at 21:43.

  4. #4
    Join Date
    Feb 2014
    Posts
    23
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QOpenGLWidget inside a QDockWidget not updated when QDockWidget::setFloating(true

    I accidently found a solution,

    It looks like adding the code snippet below anywhere in my code fixes the problem:

    Qt Code:
    1. #include <QWebEngineView>
    2.  
    3. class QT_WebView : public QWebEngineView
    4. {
    5. Q_OBJECT
    6. public:
    7. QT_WebView(QWidget *in_parent = NULL) : QWebEngineView(in_parent) {}
    8. };
    To copy to clipboard, switch view to plain text mode 

    No need to mentioned that this is as hocus pocus as it gets and the hack is quite a huge dependency to add in a project. I'm still digging and hopping to find an more elegant fix.

    It seems the bug has to do with OpenGL context sharing and I try quite a few combinations without any good outcome so far.

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,141
    Thanks
    235
    Thanked 661 Times in 651 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QOpenGLWidget inside a QDockWidget not updated when QDockWidget::setFloating(true

    Oh, man, this is complete voodoo. You don't even need an instance of the class, you just need to define it? What if you don't define the class, but just declare an instance of QWebEngineView in main() but never show() it? Or simply include the QWebEngineView header file in main()?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  6. #6
    Join Date
    Feb 2014
    Posts
    23
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QOpenGLWidget inside a QDockWidget not updated when QDockWidget::setFloating(true

    This is good voodoo stuff indeed!

    You don't even need an instance of the class, you just need to define it?
    That is correct.

    What if you don't define the class, but just declare an instance of QWebEngineView in main() but never show() it?
    Declaring an instance of QWebEngineView to the main() do work:

    QWebEngineView l_QWebEngineView;

    Or simply include the QWebEngineView header file in main()?
    Good call but nope.

Similar Threads

  1. Issue placing a QOpenGLWidget in a QDockWidget
    By sandytf in forum Qt Programming
    Replies: 1
    Last Post: 25th January 2015, 14:11
  2. QDockWidget inside QDockWidget
    By mqt in forum Qt Programming
    Replies: 3
    Last Post: 1st July 2013, 12:57
  3. Replies: 1
    Last Post: 7th December 2010, 21:46
  4. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  5. Default size of a QListWidget inside a QDockWidget
    By rakuco in forum Qt Programming
    Replies: 0
    Last Post: 25th July 2007, 08:01

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.