本文整理汇总了C++中QAbstractItemModel::removeRows方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractItemModel::removeRows方法的具体用法?C++ QAbstractItemModel::removeRows怎么用?C++ QAbstractItemModel::removeRows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractItemModel
的用法示例。
在下文中一共展示了QAbstractItemModel::removeRows方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeRow
void DefectsEditor::removeRow()
{
QModelIndex index = tableView->selectionModel()->currentIndex();
QAbstractItemModel* model = tableView->model();
if (model->removeRows(index.row(), 1, index.parent())) {
//updateActions();
updateData(index, index);
}
}
示例2: mapToSource
bool Utils::ModelListModel::removeRows(int row, int count, const QModelIndex& parent)
{
Utils::ModelListModel::SubModelIndex smi = mapToSource(parent);
if (smi.first == m_metaModel && smi.second.parent().isValid())
{
QAbstractItemModel* subModel = m_subModels.value(smi.second.row());
if (subModel)
return subModel->removeRows(row, count);
}
return smi.first->removeRows(row, count, smi.second);
}
示例3: clearAllPoints_slot
void PathPlanningWidget::clearAllPoints_slot()
{
/*! Clear all the Way-Points from the RViz enviroment and the TreeView.
*/
QAbstractItemModel *model = ui_.treeView->model();
model->removeRows(0,model->rowCount());
ui_.txtPointName->setText("0");
tf::Transform t;
t.setIdentity();
insertRow(t,0);
pointRange();
Q_EMIT clearAllPoints_signal();
}
示例4: removeRow
void AboCommentsDialog::removeRow()
{
QItemSelectionModel *selection = tableView->selectionModel();
if(selection->selectedIndexes().size() == 0)
return;
int r = QMessageBox::warning(this, trUtf8("Подтверждение"),
trUtf8("Действительно удалить комментарий ?"),
QMessageBox::Yes,
QMessageBox::No | QMessageBox::Default | QMessageBox::Escape);
if (r == QMessageBox::No)
return;
int row = selection->selectedIndexes().first().row();
QAbstractItemModel *model = tableView->model();
model->removeRows(row, 1);
if(model->submit())
updateActions();
else QMessageBox::warning(this, trUtf8("Ошибка"), trUtf8("Запись не удалена!!"),
QMessageBox::Ok);
}
示例5: newRow
void AboCommentsDialog::newRow()
{
QAbstractItemModel *model = tableView->model();
int row = model->rowCount();
model->insertRow(row);
model->setData(model->index(row, AboCommentsModel::TelA), telA_);
QSqlQuery query;
query.prepare("SELECT MAX(date_) FROM tb_summary");
query.exec();
if(query.next())
model->setData(model->index(row, AboCommentsModel::Date), query.value(0).toDate());
if(!model->submit()) {
model->removeRows(row, 1);
QMessageBox::warning(this, trUtf8("Ошибка"),
trUtf8("Невозможно добавить корректировку!"),
QMessageBox::Ok);
}
else
updateActions();
}