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. Qt Quick Application crashing on updating the ListView using QAbstractListModel class
Forum Updated to NodeBB v4.3 + New Features

Qt Quick Application crashing on updating the ListView using QAbstractListModel class

Scheduled Pinned Locked Moved Solved QML and Qt Quick
12 Posts 3 Posters 1.4k Views 3 Watching
  • 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.
  • J Offline
    J Offline
    James A
    wrote on last edited by
    #3

    @raven-worx

    I added the full stack trace below

    1 QQmlDMCachedModelData::metaCall(QMetaObject::Call, int, void * *) 0x7fffe8114b83
    2 loadProperty(QV4::ExecutionEngine *, QObject *, QQmlPropertyData const&) [clone .constprop.350] 0x7ffff71b99ce
    3 QV4::QObjectWrapper::getQmlProperty(QV4::ExecutionEngine *, QQmlContextData *, QObject *, QV4::String *, QV4::QObjectWrapper::RevisionMode, bool *, QQmlPropertyData * *) 0x7ffff71ba7da
    4 QV4::QQmlContextWrapper::getPropertyAndBase(QV4::QQmlContextWrapper const *, QV4::PropertyKey, QV4::Value const *, bool *, QV4::Value *, QV4::Lookup *) 0x7ffff7193954
    5 QV4::QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(QV4::Lookup *, QV4::ExecutionEngine *, QV4::Value *) 0x7ffff71940ed
    6 QV4::Moth::VME::interpret(QV4::CppStackFrame *, QV4::ExecutionEngine *, const char *) 0x7ffff71d53bc
    7 QV4::Moth::VME::exec(QV4::CppStackFrame *, QV4::ExecutionEngine *) 0x7ffff71d958b
    8 QV4::Function::call(QV4::Value const *, QV4::Value const *, int, QV4::ExecutionContext const *) 0x7ffff716e1e5
    9 QQmlJavaScriptExpression::evaluate(QV4::CallData *, bool *) 0x7ffff72ef43a
    10 QQmlBinding::evaluate(bool *) 0x7ffff72f4b47
    11 QQmlNonbindingBinding::doUpdate(QQmlJavaScriptExpression::DeleteWatcher const&, QFlagsQQmlPropertyData::WriteFlag, QV4::Scope&) 0x7ffff72f9805
    12 QQmlBinding::update(QFlagsQQmlPropertyData::WriteFlag) 0x7ffff72f6363
    13 QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) 0x7ffff7306442
    14 QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt&) 0x7ffff72953e9
    15 QQmlEnginePrivate::incubate(QQmlIncubator&, QQmlContextData *) 0x7ffff7295904
    16 QQmlDelegateModelPrivate::object(QQmlListCompositor::Group, int, QQmlIncubator::IncubationMode) 0x7fffe8125252
    17 QQmlDelegateModel::object(int, QQmlIncubator::IncubationMode) 0x7fffe8125572
    18 QQuickItemViewPrivate::createItem(int, QQmlIncubator::IncubationMode) 0x7fffe865288f
    19 QQuickListViewPrivate::addVisibleItems(double, double, double, double, bool) 0x7fffe86617f8
    20 QQuickItemViewPrivate::refill(double, double) 0x7fffe8653c3a
    21 QQuickItemView::componentComplete() 0x7fffe8659088
    22 QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) 0x7ffff73067c1
    23 QQmlComponentPrivate::complete(QQmlEnginePrivate *, QQmlComponentPrivate::ConstructionState *) 0x7ffff728e5f1
    24 QQmlComponentPrivate::completeCreate() 0x7ffff7290ef7
    25 QQmlComponent::create(QQmlContext *) 0x7ffff728e0db
    26 QQmlApplicationEnginePrivate::finishLoad(QQmlComponent *) 0x7ffff72fb5cc
    27 QQmlApplicationEnginePrivate::startLoad(QUrl const&, QByteArray const&, bool) 0x7ffff72fb7e6
    28 QQmlApplicationEngine::load(QUrl const&) 0x7ffff72fba1d
    29 main main.cpp 30 0x555555557c5c

    raven-worxR 1 Reply Last reply
    0
    • J James A

      @raven-worx

      I added the full stack trace below

      1 QQmlDMCachedModelData::metaCall(QMetaObject::Call, int, void * *) 0x7fffe8114b83
      2 loadProperty(QV4::ExecutionEngine *, QObject *, QQmlPropertyData const&) [clone .constprop.350] 0x7ffff71b99ce
      3 QV4::QObjectWrapper::getQmlProperty(QV4::ExecutionEngine *, QQmlContextData *, QObject *, QV4::String *, QV4::QObjectWrapper::RevisionMode, bool *, QQmlPropertyData * *) 0x7ffff71ba7da
      4 QV4::QQmlContextWrapper::getPropertyAndBase(QV4::QQmlContextWrapper const *, QV4::PropertyKey, QV4::Value const *, bool *, QV4::Value *, QV4::Lookup *) 0x7ffff7193954
      5 QV4::QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(QV4::Lookup *, QV4::ExecutionEngine *, QV4::Value *) 0x7ffff71940ed
      6 QV4::Moth::VME::interpret(QV4::CppStackFrame *, QV4::ExecutionEngine *, const char *) 0x7ffff71d53bc
      7 QV4::Moth::VME::exec(QV4::CppStackFrame *, QV4::ExecutionEngine *) 0x7ffff71d958b
      8 QV4::Function::call(QV4::Value const *, QV4::Value const *, int, QV4::ExecutionContext const *) 0x7ffff716e1e5
      9 QQmlJavaScriptExpression::evaluate(QV4::CallData *, bool *) 0x7ffff72ef43a
      10 QQmlBinding::evaluate(bool *) 0x7ffff72f4b47
      11 QQmlNonbindingBinding::doUpdate(QQmlJavaScriptExpression::DeleteWatcher const&, QFlagsQQmlPropertyData::WriteFlag, QV4::Scope&) 0x7ffff72f9805
      12 QQmlBinding::update(QFlagsQQmlPropertyData::WriteFlag) 0x7ffff72f6363
      13 QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) 0x7ffff7306442
      14 QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt&) 0x7ffff72953e9
      15 QQmlEnginePrivate::incubate(QQmlIncubator&, QQmlContextData *) 0x7ffff7295904
      16 QQmlDelegateModelPrivate::object(QQmlListCompositor::Group, int, QQmlIncubator::IncubationMode) 0x7fffe8125252
      17 QQmlDelegateModel::object(int, QQmlIncubator::IncubationMode) 0x7fffe8125572
      18 QQuickItemViewPrivate::createItem(int, QQmlIncubator::IncubationMode) 0x7fffe865288f
      19 QQuickListViewPrivate::addVisibleItems(double, double, double, double, bool) 0x7fffe86617f8
      20 QQuickItemViewPrivate::refill(double, double) 0x7fffe8653c3a
      21 QQuickItemView::componentComplete() 0x7fffe8659088
      22 QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) 0x7ffff73067c1
      23 QQmlComponentPrivate::complete(QQmlEnginePrivate *, QQmlComponentPrivate::ConstructionState *) 0x7ffff728e5f1
      24 QQmlComponentPrivate::completeCreate() 0x7ffff7290ef7
      25 QQmlComponent::create(QQmlContext *) 0x7ffff728e0db
      26 QQmlApplicationEnginePrivate::finishLoad(QQmlComponent *) 0x7ffff72fb5cc
      27 QQmlApplicationEnginePrivate::startLoad(QUrl const&, QByteArray const&, bool) 0x7ffff72fb7e6
      28 QQmlApplicationEngine::load(QUrl const&) 0x7ffff72fba1d
      29 main main.cpp 30 0x555555557c5c

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #4

      @James-A
      i dont think that the code you've posted is causing this issue.

      The only code which doesn't make sense is the line

      anchors.verticalCenter: parent.verticalCenter

      in your delegate.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • J Offline
        J Offline
        James A
        wrote on last edited by
        #5

        @raven-worx

        I tried changing the delegate to delegate: Text { text: name }
        But the issue is persisting

        raven-worxR 1 Reply Last reply
        0
        • J James A

          @raven-worx

          I tried changing the delegate to delegate: Text { text: name }
          But the issue is persisting

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #6

          @James-A
          as i said, i don't think that the code you've posted is causing this issue, at least i don't spot an issue.
          Try a full rebuild.

          If the issue persists, try removing single items to check which Item is causing it.

          Also your ListView has no size set.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • J Offline
            J Offline
            James A
            wrote on last edited by James A
            #7

            @raven-worx

            I tried deleting the output folder and then rebuild gain , and also tried commenting out individually the code under WiFi_model, from that what I observed is when I remove the below line from the "roleNames()" functions the application is starting , but not updating the data on the ListView

            roles[name] = "name";

            92aa3d0d-e82e-4705-95c1-c6e2d23de101-image.png

            Again when I try adding it back , the application gets crashed
            So I found the line of code which is causing the problem , but not sure why it is causing the crash and what I am missing in it

            And I also set the ListView size as below

            anchors.fill: parent

            raven-worxR 1 Reply Last reply
            0
            • J James A

              @raven-worx

              I tried deleting the output folder and then rebuild gain , and also tried commenting out individually the code under WiFi_model, from that what I observed is when I remove the below line from the "roleNames()" functions the application is starting , but not updating the data on the ListView

              roles[name] = "name";

              92aa3d0d-e82e-4705-95c1-c6e2d23de101-image.png

              Again when I try adding it back , the application gets crashed
              So I found the line of code which is causing the problem , but not sure why it is causing the crash and what I am missing in it

              And I also set the ListView size as below

              anchors.fill: parent

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by raven-worx
              #8

              @James-A
              strange.
              Does it work when you rename the enum value from name to e.g. NameRole?

              QHash<int, QByteArray> WiFi_model::roleNames() const
              {
              QHash<int, QByteArray> roles;
              roles[NameRole] = QByteArrayLiteral("name");
              return roles;
              }
              

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0
              • dheerendraD Offline
                dheerendraD Offline
                dheerendra
                Qt Champions 2022
                wrote on last edited by
                #9

                Can u also try removing the columnCount implementation completely ? This is not required. Some times this is also a issue.

                Dheerendra
                @Community Service
                Certified Qt Specialist
                http://www.pthinks.com

                1 Reply Last reply
                1
                • J Offline
                  J Offline
                  James A
                  wrote on last edited by
                  #10

                  @raven-worx

                  I changed the roleNames() function implementation as suggested above.

                  @dheerendra

                  I completely removed the commented columnCount() function

                  But there is no change , still the error exist

                  1 Reply Last reply
                  0
                  • dheerendraD Offline
                    dheerendraD Offline
                    dheerendra
                    Qt Champions 2022
                    wrote on last edited by dheerendra
                    #11

                    Issue is coming from index() and parent() method. Comment them.
                    Also qml code needs correction.
                    This should work.

                    GroupBox {
                            id: groupBox
                            anchors.fill: parent
                            ListView {
                                anchors.fill: parent
                                model : wifi_model
                                delegate: Text {
                                    text: name
                                    width: 300;height: 40
                                    font.bold: true
                                }
                                onCountChanged: console.log("count changed: " + count)
                            }
                        }
                    

                    Dheerendra
                    @Community Service
                    Certified Qt Specialist
                    http://www.pthinks.com

                    1 Reply Last reply
                    2
                    • J Offline
                      J Offline
                      James A
                      wrote on last edited by
                      #12

                      @dheerendra

                      Thanks for pointing it out. Yes it was due to index() and parent() . I removed it completely
                      Now the application is running

                      45f07dd4-29fb-4dd2-b128-cb8de0e69065-image.png

                      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