Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116056

signal not found when deleting QAbstractItemModel

    XMLWordPrintable

Details

    • Windows
    • 4f4a8e75a (dev), 703b48a7c (6.5), 9bd2b35bf (6.6), 47dfcef2c (tqtc/lts-6.2)

    Description

      content of Main.qml:

      import QtQuick
      import QtQuick.ControlsWindow {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")    TreeView {
              anchors.fill: parent
              model: fsModel
              selectionModel: ItemSelectionModel {}
          }
      } 
      

      content of main.cpp:

      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      #include <QQmlContext>
      #include <QFileSystemModel>int main(int argc, char *argv[]) {
          QGuiApplication app(argc, argv);
          QQmlApplicationEngine engine;
          QFileSystemModel model;
          model.setRootPath(QDir::currentPath());
          engine.rootContext()->setContextProperty("fsModel", &model);
          engine.loadFromModule("quicktest", "Main");
          return app.exec();
      }

      When program closes, the following error log shows:

      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::rowsAboutToBeRemoved(QModelIndex,int,int)
      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::columnsAboutToBeRemoved(QModelIndex,int,int)
      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::rowsAboutToBeInserted(QModelIndex,int,int)
      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::columnsAboutToBeInserted(QModelIndex,int,int)
      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)
      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)
      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::rowsMoved(QModelIndex,int,int,QModelIndex,int)
      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::columnsMoved(QModelIndex,int,int,QModelIndex,int)
      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)
      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)
      qt.core.qobject.connect: QObject::disconnect: No such signal QObject::modelReset() 

      Note the model is instantiated after engine, so is deleted before engine. During model's destruction, it is removed from the qml engine, so QItemSelectionModelPrivate::initModel is called.

      Within QItemSelectionModelPrivate::initModel, meta object show it became QObject instead of QFileSystemModel, so a lot of signals could not be found.

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              axelspoerl Axel Spoerl
              songziming Song Ziming
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes