Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. signal rowsInserted in QAbstractTableModel
Qt 6.12 LTS is out! See what's new in the release blog

signal rowsInserted in QAbstractTableModel

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 2.1k 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.
  • M Offline
    M Offline
    Mihaill
    wrote on last edited by
    #1

    Hi!
    I use Qt 5.15.
    I use QAbstractTableModel and i want set table aboute added row.
    I think that me need signam rowsInserted.
    https://doc.qt.io/qt-5/qabstractitemmodel.html#rowsInserted
    In documentatin that signal have 3 arguments, but QtCreater think that need 4 arguments, last argument - QPrivateSignal.
    Whot me need doing?
    285bb0ac-34b3-4333-8947-40ba8e6cced0-image.png

    JonBJ 1 Reply Last reply
    0
    • M Mihaill

      Hi!
      I use Qt 5.15.
      I use QAbstractTableModel and i want set table aboute added row.
      I think that me need signam rowsInserted.
      https://doc.qt.io/qt-5/qabstractitemmodel.html#rowsInserted
      In documentatin that signal have 3 arguments, but QtCreater think that need 4 arguments, last argument - QPrivateSignal.
      Whot me need doing?
      285bb0ac-34b3-4333-8947-40ba8e6cced0-image.png

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Mihaill
      As per the docs you cited, your code cannot emit rowsInserted(). This is a signal Qt emits. Your job is to implement insertRows() and call beginInsertRows(). Read https://doc.qt.io/qt-5/qabstractitemmodel.html#subclassing carefully.

      If you want to connect() to it that should be as per void QAbstractItemModel::rowsInserted(const QModelIndex &parent, int first, int last). The QPrivateSignal one you showed is not for you.

      M 1 Reply Last reply
      2
      • JonBJ JonB

        @Mihaill
        As per the docs you cited, your code cannot emit rowsInserted(). This is a signal Qt emits. Your job is to implement insertRows() and call beginInsertRows(). Read https://doc.qt.io/qt-5/qabstractitemmodel.html#subclassing carefully.

        If you want to connect() to it that should be as per void QAbstractItemModel::rowsInserted(const QModelIndex &parent, int first, int last). The QPrivateSignal one you showed is not for you.

        M Offline
        M Offline
        Mihaill
        wrote on last edited by
        #3

        @JonB but how I can set TableView that in model apeared new row?

        jsulmJ 1 Reply Last reply
        0
        • M Mihaill

          @JonB but how I can set TableView that in model apeared new row?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Mihaill I guess: "Your job is to implement insertRows() and call beginInsertRows(). Read https://doc.qt.io/qt-5/qabstractitemmodel.html#subclassing carefully." ?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Mihaill I guess: "Your job is to implement insertRows() and call beginInsertRows(). Read https://doc.qt.io/qt-5/qabstractitemmodel.html#subclassing carefully." ?

            M Offline
            M Offline
            Mihaill
            wrote on last edited by
            #5

            @jsulm I directly wrote a row to the data container, made beginInsertRows and endInsertRows, but the table is not updated.

            M 1 Reply Last reply
            0
            • M Mihaill

              @jsulm I directly wrote a row to the data container, made beginInsertRows and endInsertRows, but the table is not updated.

              M Offline
              M Offline
              Mihaill
              wrote on last edited by
              #6

              I try use this, but it's not work:

                          int row = m_data.count();
                          QModelIndex index = createIndex(row, 0);
                          beginInsertRows(index, row, row);
                          addData(AlarmObject (item, isAlarm, QDateTime::currentDateTime(),
                                               m_client->getAlarmColorCategory(uuid)));
                          endInsertRows();
              
              M Christian EhrlicherC 2 Replies Last reply
              0
              • M Mihaill

                I try use this, but it's not work:

                            int row = m_data.count();
                            QModelIndex index = createIndex(row, 0);
                            beginInsertRows(index, row, row);
                            addData(AlarmObject (item, isAlarm, QDateTime::currentDateTime(),
                                                 m_client->getAlarmColorCategory(uuid)));
                            endInsertRows();
                
                M Offline
                M Offline
                Mihaill
                wrote on last edited by
                #7

                it's work

                            int row = m_data.count();
                //            if (m_data.count() == 0) {
                //                row = 0;
                //            }
                            QModelIndex index = createIndex(row, 0);
                //            beginInsertRows(index, row, row);
                            beginInsertRows(QModelIndex(), row, row);
                            addData(AlarmObject (item, isAlarm, QDateTime::currentDateTime(),
                                                 m_client->getAlarmColorCategory(uuid)));
                            endInsertRows();
                
                1 Reply Last reply
                1
                • M Mihaill

                  I try use this, but it's not work:

                              int row = m_data.count();
                              QModelIndex index = createIndex(row, 0);
                              beginInsertRows(index, row, row);
                              addData(AlarmObject (item, isAlarm, QDateTime::currentDateTime(),
                                                   m_client->getAlarmColorCategory(uuid)));
                              endInsertRows();
                  
                  Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8
                  This post is deleted!
                  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
                  • Unsolved