Important: Please read the Qt Code of Conduct -

QQuickWidget inside QDockWidget: resize() not working

  • I use a QML with a C++ model.

    My QML is set in a QQuickWidget that I put in a QDockWidget.

    I need sometimes to resize my QDockWidget. However, when I call resize() function, nothing is happening.

    What am I doing wrong ?

    Code example:

    MainWindow::MainWindow() {    
        QQuickWidget *view = new QQuickWidget;
        QQmlContext *ctxt = view->rootContext();
        ctxt->setContextProperty("myModel", m_model);
        view->setGeometry(0, 200, 200, 400);
        m_dock->setWidget(view); //QDockWidget
        addDockWidget(Qt::LeftDockWidgetArea, m_dock);
        m_dock->resize(500,200); //This is not working
        view->resize(500,200); //Not either    

Log in to reply