C++ (Qt)void TreeModelBrowser::updateModelInsertRow(QModelIndex index){ if(index.isValid()) { int row = index.row(); row++; beginInsertRows(index,row,row); CommonElement *ce = reinterpret_cast<CommonElement*>(index.internalPointer()); ce->appendChild(); endInsertRows(); qDebug()<<"TreeModelBrowser::updateModelInsertRow"; }} void TreeModelBrowser::updateModelRemoveRow(QModelIndex index){ if(index.isValid()) { int row = index.row(); QModelIndex parentIndex = index.parent(); beginRemoveRows(parentIndex,row,row); CommonElement *ce = reinterpret_cast<CommonElement*>(index.internalPointer()); delete ce; endRemoveRows(); }}
beginInsertRows(index,row,row);
endInsertRows();
void QAbstractItemModel::beginInsertRows ( const QModelIndex & parent, int first, int last ) [protected]Begins a row insertion operation.When reimplementing insertRows() in a subclass, you must call this function before inserting data into the model's underlying data store.The parent index corresponds to the parent into which the new rows are inserted; first and last are the row numbers that the new rows will have after they have been inserted.void QAbstractItemModel::endInsertRows () [protected]Ends a row insertion operation.When reimplementing insertRows() in a subclass, you must call this function after inserting data into the model's underlying data store.
C++ (Qt)void TreeModelBrowser::updateModelInsertRow( const QModelIndex & index ){ if(index.isValid()) { CommonElement *ce = dynamic_cast<CommonElement*>(index.internalPointer()); if (ce) ce->appendChild(); else Q_ASSERT(0); }}
C++ (Qt)void QAbstractItemModel::beginInsertRows ( const QModelIndex & parent, int first, int last ) [protected]
C++ (Qt)QModelIndex parentIndex = index.parent();
C++ (Qt)void TreeModelBrowser::updateModelInsertRow(QModelIndex index){ if(index.isValid()) { CommonElement *ce = reinterpret_cast<CommonElement*>(index.internalPointer()); QModelIndex parentIndex = index.parent(); int row = index.row(); row++; beginInsertRows(parentIndex,row,row); ce->appendChild(); endInsertRows(); qDebug()<<"TreeModelBrowser::updateModelInsertRow"; }}
CommonElement *ce = reinterpret_cast<CommonElement*>(index.internalPointer());
index