Reload QQuickView into the same window container



  • I want to write plugins to my program as qml displaying inside dock widget

    I load plugin this way:

      if (!qview) 
        qview = new QQuickView();
      qview->engine()->clearComponentCache();
      qview->setSource(QUrl(path));
      QQuickItem *item_main = qview->rootObject();
      QWindow* main_page = item_main->window();  
      auto container = QWidget::createWindowContainer( main_page, ui->dockWidgetContents );
      container->show();
    

    It works ok, but reloading plugin is quite slow. I think it is because createWindowContainer creates native window each time.
    Can I speed up loading by forcing QQuickView use the same window container after reload?


  • Moderators

    @Rem-Kolomna I'm not sure about what is the problem exactly. But did you try QQuickWidget instead ? It is a new class added since Qt 5.3 and it loads QML too.



  • Thank you, QQuickWidget is a solution for my problem


Log in to reply
 

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