signal rowsInserted in QAbstractTableModel
-
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?

-
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?

@Mihaill
As per the docs you cited, your code cannotemit rowsInserted(). This is a signal Qt emits. Your job is to implementinsertRows()and callbeginInsertRows(). 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). TheQPrivateSignalone you showed is not for you. -
@Mihaill
As per the docs you cited, your code cannotemit rowsInserted(). This is a signal Qt emits. Your job is to implementinsertRows()and callbeginInsertRows(). 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). TheQPrivateSignalone you showed is not for you. -
@Mihaill I guess: "Your job is to implement insertRows() and call beginInsertRows(). Read https://doc.qt.io/qt-5/qabstractitemmodel.html#subclassing carefully." ?
-
@Mihaill I guess: "Your job is to implement insertRows() and call beginInsertRows(). Read https://doc.qt.io/qt-5/qabstractitemmodel.html#subclassing carefully." ?
-
@jsulm I directly wrote a row to the data container, made beginInsertRows and endInsertRows, but the table is not updated.
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(); -
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();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(); -
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();This post is deleted!