void CSMWorld::IdTableProxyModel::sourceRowsInserted(const QModelIndex &parent, int /*start*/, int end) { refreshFilter(); if (!parent.isValid()) { emit rowAdded(getRecordId(end).toUtf8().constData()); } }
ThreadListModel::ThreadListModel (const QList<Message *> &data, QObject * parent) : QAbstractListModel (parent), m_data (data) { QListIterator<Message *> it (m_data); while (it.hasNext ()) { rowAdded (it.next ()); } }
MyHorizontalLayoutWidget::MyHorizontalLayoutWidget(QWidget *parent) : QWidget(parent) { createObjects(); createLayout(); setLayout(horizontalLayout); connect(graphicsScene, SIGNAL(signalBarchart()), this, SLOT(createItemsForBarchart())); connect(graphicsScene, SIGNAL(signalLinechart()), this, SLOT(createItemsForLinechart())); connect(graphicsScene, SIGNAL(signalPiechart()), this, SLOT(createItemsForPiechart())); connect(tableWidget, SIGNAL(cellChanged(int,int)), dynamic_cast<MyTabWidget *>(parentWidget()), SLOT(insertStarAfter())); connect(tableWidget, SIGNAL(rowAdded()), dynamic_cast<MyTabWidget *>(parentWidget()), SLOT(insertStarAfter())); connect(tableWidget, SIGNAL(rowDeleted()), dynamic_cast<MyTabWidget *>(parentWidget()), SLOT(insertStarAfter())); }
void CSMWorld::InfoTableProxyModel::sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { refreshFilter(); if (mLastAddedSourceRow != -1 && topLeft.row() <= mLastAddedSourceRow && bottomRight.row() >= mLastAddedSourceRow) { // Now the topic of the last added row is set, // so we can re-sort the model to ensure the corrent position of this row int column = sortColumn(); Qt::SortOrder order = sortOrder(); sort(mInfoColumnIndex); // Restore the correct position of an added row sort(column, order); // Restore the original sort order emit rowAdded(getRecordId(mLastAddedSourceRow).toUtf8().constData()); // Make sure that we perform a re-sorting only in the first dataChanged() after a row insertion mLastAddedSourceRow = -1; } }
int TableMeta::save() { bool res = -1; QSqlQuery qry; qry.prepare( "INSERT INTO tablemeta (project_id ,name) VALUES (:project_id ,:name)" ); qry.bindValue(":project_id",project_id); qry.bindValue(":name",name); if( !qry.exec() ) { qDebug() << qry.lastError(); res = -1; } else { emit rowAdded(_id); emit dataChanged(); } return res; }
void ResultModel::onRowAdded(int row) { Q_UNUSED(row); endInsertRows(); emit rowAdded(row); }