Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QML Loader: signal when Item is completed

    QML and Qt Quick
    qml loader
    1
    1
    867
    Loading More Posts
    • 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.
    • H
      Hazzl last edited by

      I am changing one page in a SwipeView depending on buttons pressed on a different page of that SwipeView

      SwipeView {
         Item { id: firstPage
            MyButton { onClicked: secondPage.setSource("PageA.qml") }
            MyButton { onClicked: secondPage.setSource("PageB.qml") } 
         }
      
          Loader { id: secondPage }
      }
      

      I need to access the objects on the secondPage from the C++ side. Therefore, I connect to the loaded signal

      QQuickItem *p_loaderPage = object->findChild<QQuickItem *>("loaderPage");
      Q_CHECK_PTR(p_loaderPage);
      connect(p_loaderPage, SIGNAL(loaded()), this, SLOT(findViews()));
      

      When I first load a page (say pageA) everything seems to be working fine. But if I load a new page on top of that (either pageB or pageA a second time), I still get the data from the old page in findViews(). It seems that the signal is triggered too early. I'd appreciate any help.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post