Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Reload QQuickView into the same window container

Reload QQuickView into the same window container

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rem-Kolomna
    wrote on last edited by Rem-Kolomna
    #1

    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?

    p3c0P 1 Reply Last reply
    0
    • R Rem-Kolomna

      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?

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @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.

      157

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rem-Kolomna
        wrote on last edited by
        #3

        Thank you, QQuickWidget is a solution for my problem

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved