Qt World Summit: Submit your Presentation


  • Hi all,

    I'd like to draw widgets above a Qt3DWindow. The problem is that the window is always above any QWidget I add.

    I have embedded the Qt3DWindow into my GUI with QWidget::createWindowContainer(). So that is its inside a QWidget itself, and put into a QLayout. I have created a sibling QPushButton widget but this button can never be drawn above the "createWindowContainer" even when I use the raise(), lower() and even stackUnder() methods...

    I join a screenshot of the result, I have moved the 3D view to show the underlying button:

    So, the question is: is it possible to draw QWidgets above a window with an OpenGL context?
    Should I instead use Qt3D to draw the GUI inside the window?

    Thank you for any answer! :)

  • @AntiXeon said in Qwidgets:


    From Qt Doc:

    The window container has a number of known limitations:

    Stacking order:
    The embedded window will stack on top of the widget hierarchy as an opaque box. The stacking order of multiple**overlapping window container instances is undefined.

    I guess, you cant use "createWindowContainer" then... Is it necessary? Else I would put my 3D Widget into another container.

  • Thanks for your answer ! Shame on me, I missed this info from the documentation...

    I have a Qt3DWindow that has to be integrated into the general UI, as this kind of application:
    3D view in main window

    As far I know, there is only a Qt3DWindow to display a Qt3D scene? And the only way to include a view, like a Qt3DWindow is by using createWindowContainer. I do not know any other solution to perform the same using QWidgets.
    This limitation is quite annoying! :/

  • @AntiXeon

    As far as I understand it's only not possible to put something else (Button or whatever) in the same container as the Widget, because it will get covered by your 3D Widget.
    Never used 3D-Widgets before, but I think you can use another layout or container, so that other elements wont get covered

  • Yes, the 3D widget is already in a vertical layout but the feature was to put widgets over it as in modern 3D softwares like this:
    Blender 2.8 UI
    I think we'll have to change the specifications!

    QtQuick can probably do this but the whole application is using C++ widgets, and we cannot spend time to develop a new UI.

    Thank you for your help!

  • @AntiXeon

    Ok, so you want to literally draw over / inside the 3D Widget... I dont know if this is even possible. Maybe it can be done by subclassing / overriding Q3DWindow and creating a custom one for your purposes (may be a tough job, though) :)

  • I think there is a last solution that can be interesting. :)
    Instead of directly integrate the Qt3DWindow in a widget, we could use a QtQuick view with "createWindowContainer".
    The QtQuick view embeds itself the 3D view and the QtQuick widgets, that are drawn over it as in this example.

    So that, the UI based on C++ widget is kept as is. We only have to use QtQuick components for this specific stuff, without having to develop a whole UI system with Qt3D.

    The last point to check is how to interact between QtQuick and the C++ application (events, etc). I haven't done big projects with QtQuick until now, all of them were pure QtQuick though. :o

Log in to reply