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
0
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);
}
    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
0
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
0
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();

}