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. Is there any signal to notify once all the items of the list are loaded?

Is there any signal to notify once all the items of the list are loaded?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
13 Posts 3 Posters 3.6k Views 2 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.
  • p3c0P Offline
    p3c0P Offline
    p3c0
    Moderators
    wrote on last edited by
    #2

    @darpita_7 I think you can check that in onCountChanged handler. If count equals to model's count then all are loaded.

    157

    1 Reply Last reply
    2
    • D Offline
      D Offline
      darpita_7
      wrote on last edited by
      #3

      I am not getting the onCountChanged signal in my qml

      1 Reply Last reply
      0
      • p3c0P Offline
        p3c0P Offline
        p3c0
        Moderators
        wrote on last edited by
        #4

        @darpita_7 Did you add it inside ListView ?

        157

        D 1 Reply Last reply
        0
        • p3c0P p3c0

          @darpita_7 Did you add it inside ListView ?

          D Offline
          D Offline
          darpita_7
          wrote on last edited by
          #5

          @p3c0
          Yes i added it inside the list view

          1 Reply Last reply
          0
          • p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #6

            @darpita_7 That is strange. Can you post an example ?

            157

            1 Reply Last reply
            0
            • V Offline
              V Offline
              Viet
              wrote on last edited by
              #7

              I don't see any model ?

              D 1 Reply Last reply
              0
              • V Viet

                I don't see any model ?

                D Offline
                D Offline
                darpita_7
                wrote on last edited by
                #8

                @Viet yes, so i am adding the button to the model, and assigning the model in cpp.
                Then i am clearing the same model.

                1 Reply Last reply
                0
                • p3c0P Offline
                  p3c0P Offline
                  p3c0
                  Moderators
                  wrote on last edited by
                  #9

                  @darpita_7 Can you post a small example ?

                  157

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    Viet
                    wrote on last edited by
                    #10

                    Were you using QAbstractListModel then?
                    If so, you also have to notify the view about the change in C++ (ex: use beginInsertRows(), endInsertRows() etc)

                    D 1 Reply Last reply
                    0
                    • V Viet

                      Were you using QAbstractListModel then?
                      If so, you also have to notify the view about the change in C++ (ex: use beginInsertRows(), endInsertRows() etc)

                      D Offline
                      D Offline
                      darpita_7
                      wrote on last edited by
                      #11

                      @Viet
                      void modifying_list()
                      {
                      QAbstractListModel _model;
                      QQuickItem* list = findChild("list");
                      if(list)
                      {
                      list->setProperty("model",QVariant::fromValue(&_model));
                      }

                      _model.beginInsertRows(x,y,z); //adding some data here, where x,y,z are the expected values
                      endInsertRows();
                      //once added trying to clear the list

                      _model.beginRemoveRows(x,y,z);// trying to remove the added items,
                      _model.endRemoveRows();
                      }

                      This is just a sample code.

                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        Viet
                        wrote on last edited by
                        #12

                        The _model will be deleted once it gets out of scope !
                        Other than that I don't see anything wrong here.

                        1 Reply Last reply
                        2
                        • p3c0P Offline
                          p3c0P Offline
                          p3c0
                          Moderators
                          wrote on last edited by
                          #13

                          @Viet Also QAbstractListModel is supposed to be subclassed and not used directly.

                          QAbstractListModel provides a standard interface for models that represent their data as a simple non-hierarchical sequence of items. It is not used directly, but must be subclassed.

                          157

                          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