How QWindow introduced in Qt5 is better than QWidget



  • What advantage we would get in using QWindow, besides in QGuiApplication and QApplication which one is better for GUI. They say QGuiApplication is lightweighted, does that mean less functionality?



  • QCoreApplication <-- QGuiApplication <-- QApplication

    They belong to following 3 modules: QtCore QtGui QtWidets

    QtWidgets is just an addon of Qt5, while QtCore and QtGui belong to Qt Essential.

    QWindow is lower level api, which is the backend of QWidget and QQuick's visual items.



  • Isn't a QWindow sort of replacement for QWidgets, meaning that now instead of using QWidgets for subwindows we can use QWindow



  • bq. We also introduced a new QGuiApplication class that is more lightweight than QApplication and a QWindow class for handling top level windows on the screen



  • No, QWindow is lower than QWidget. If you want to use QWindow directly, more work needed to to(neary all drawing related things), which is not easy.

    However, if you really want to using QWindow/QGuiApplication instead of QWidget/QApplication, you can give a try.

    In the QWindow::exposeEvent(), you can use QBackingStore which is used by QWidget, or you can use SceneGraph which is used by QQuick.

    [quote author="adnan" date="1334009592"]Isn't a QWindow sort of replacement for QWidgets, meaning that now instead of using QWidgets for subwindows we can use QWindow[/quote]



  • QWindow represents a top-level system window rather than a parentless QWidget. QWindow is used in conjunction with QtQuick2 or with QOpenGLContext to provide OpenGL viewports (rather than QGLWidget). QWindow is backed by QPlatformWindow which gets instantiated by the QPA plugin when the application calls QWindow::create().

    If you are using QWidget-based UI's then just use parentless QWidget's as windows just as in Qt4.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.