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. Problem resetting a qquickwidget

Problem resetting a qquickwidget

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 607 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.
  • A Offline
    A Offline
    Amanda1102
    wrote on last edited by
    #1

    Hi,
    I have a qml creating items dynamically with different functions, so I cannot track them. I am putting this qml inside a QQuickWidget and every time I want t reset it I was simply adding a new resource. Like this: ui->quickwidget->setSource(QUrl(QStringLiteral("main.qml"))). It was working fine, but now I have a problem that it appears to be deleting before qml could handle all signals. This is the error:
    Object 0x463b10 destroyed while one of its QML signal handlers is in progress.
    Most likely the object was deleted synchronously (use QObject::deleteLater() instead), or the application is running a nested event loop.
    This behavior is NOT supported!
    I would like to know if someone knows how to use deleteLater on qquickwidget or another way to reset my qml inside my quickwidget.
    Thank you all.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Amanda1102
      wrote on last edited by
      #2

      I solved it by using delete later. Just in case someone have the same problem, here is my solution code:

      ui->qml->rootObject()->deleteLater();

      connect(ui->qml->rootObject(), &QObject::destroyed, this, [=] {
      ui->qml->setSource(QUrl(QStringLiteral("main.qml")));

      emit apagou();
      

      });

      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