Qt World Summit: Submit your Presentation

Custom full-screen QDialog with QQuickWidget inside, the latter won't scale properly (Android)

  • Description: The aim is to show a custom dialog-box (no borders, no default buttons, content is to be provided by QML), transparency is desired and the dialog box with the embedded QML should show full-screen. The content of the QML rendered within the dialog-box should scale properly to full-screen.

    Implementation (constructor) of a custom Dialog:

    CIdentityBox::CIdentityBox(QWidget *parent): QDialog(parent)
           QQuickWidget* content = new QQuickWidget();
            content->rootContext()->setContextProperty(QStringLiteral("applicationData"), this);

    The QML file:

    Item {
        //objectName: "topographySeries"
        height: 750
    //other stuff

    I show the dialog with a call to dialog->showFullScreen();

    Current State: Now, the dialog shows, the space occupied by the QDialog is full-screen indeed (if I turn off WA_TranslucentBackground the entire screen is white), BUT the inner(?) QQuickWidget is not scaled at all. Even though SizeRootObjectToView is set.

    Ideas? In QML if I change the default(?) height/width or set anchors.fill = parent, the QQuickWidget is not rendered at all. Ideas?

    Any hacky way to accomplish this? Does not need to be clean one, I've spent too much time on this already.

    Question is: how to make the inner QQuickWidget occupy the entire space of QDialog. Other approaches are welcome.

Log in to reply