[Interest] Mixing QWidgets and QtQuickControls 2

Harald Vistnes harald.vistnes at gmail.com
Fri Nov 11 20:38:26 CET 2022

Benjamin, thanks for useful hints. I'll start with trying to integrate the
QQuickWidget into a QDialog as it sounds straightforward.

Concerning the QuickDialog approach. You implement your own class by
subclassing QQuickView and make it behave like a dialog? Do you use
QWidget::createWindowContainer() then or just exec() on the QuickDialog


fre. 11. nov. 2022 kl. 20:01 skrev Benjamin TERRIER <b.terrier at gmail.com>:

> On Fri, 11 Nov 2022 at 14:10, Harald Vistnes <harald.vistnes at gmail.com>
> wrote:
>> So the question is, what is the best way for migrating a QWidgets based
>> dialog to a Qt Quick Controls based dialog? Should I not use QQuickWidget
>> for standalone dialogs, but instead trigger the QML in another way? Or
>> embed the QQuickWidget inside a QDialog? Or use QQmlApplicationEngine
>> directly?
> There are many ways to do that not sure which one is best, but I will
> share what I generally do:
>    1. When I want to integrate QML in a widget app, I generally use
>    QQuickWIdget.
>    2. For dialogs:
>    - either I use a QDialog and I integrate the QQuickWidget as any other
>       widget
>       - or I implement a QuickDialog which is a subclass of QQuickView
>       with some QDialog-like functions (exec(), accept(), etc.)
>       3. I never use Window or ApplicationWindow QML types, because, as
>    you have experienced, you get 2 windows: one from the QQuickView and a
>    second one from the Window QML type.
> From my experience this gives the best controls and ease of use, but of
> course there are some exceptions.
> Also, it is possible to replace QQuickWidget by a QQuickView combined with
> QWidget::createWindowContainer().
> I only use QQmlApplicationEngine and Window QML types when writing pure Qt
> Quick applications.
> Regards
> Benjamin
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20221111/1e8232c2/attachment.htm>

More information about the Interest mailing list