From ba7a46c4b37d20f1d0fb5f48cdf2ec40c4ccbe03 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Jul 2015 13:20:38 +0300 Subject: [PATCH] After remove alwayse show the first row. --HG-- branch : feature --- src/app/tape/tmainwindow.cpp | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 764bc13d1..ef8372a3f 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -373,6 +373,54 @@ void TMainWindow::Remove() MeasurementsWasSaved(false); RefreshData(); + + if (ui->tableWidget->rowCount() > 0) + { + ui->tableWidget->selectRow(0); + ui->tableWidget->resizeColumnsToContents(); + ui->tableWidget->resizeRowsToContents(); + ui->tableWidget->horizontalHeader()->setStretchLastSection(true); + } + else + { + ui->groupBoxDetails->setEnabled(false); + + ui->lineEditName->blockSignals(true); + ui->lineEditName->setText(""); + ui->lineEditName->blockSignals(false); + + ui->plainTextEditDescription->blockSignals(true); + ui->plainTextEditDescription->setPlainText(""); + ui->plainTextEditDescription->blockSignals(false); + + if (mType == MeasurementsType::Standard) + { + ui->labelCalculatedValue->blockSignals(true); + ui->spinBoxBaseValue->blockSignals(true); + ui->spinBoxInSizes->blockSignals(true); + ui->spinBoxInHeights->blockSignals(true); + + ui->labelCalculatedValue->setText(""); + ui->spinBoxBaseValue->setValue(0); + ui->spinBoxInSizes->setValue(0); + ui->spinBoxInHeights->setValue(0); + + ui->labelCalculatedValue->blockSignals(false); + ui->spinBoxBaseValue->blockSignals(false); + ui->spinBoxInSizes->blockSignals(false); + ui->spinBoxInHeights->blockSignals(false); + } + else + { + ui->labelCalculatedValue->blockSignals(true); + ui->labelCalculatedValue->setText(""); + ui->labelCalculatedValue->blockSignals(false); + + ui->plainTextEditFormula->blockSignals(true); + ui->plainTextEditFormula->setPlainText(""); + ui->plainTextEditFormula->blockSignals(false); + } + } } //--------------------------------------------------------------------------------------------------------------------- @@ -522,6 +570,8 @@ void TMainWindow::ShowMData() if (ui->tableWidget->rowCount() > 0) { + ui->groupBoxDetails->setEnabled(true); + QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), 0); QSharedPointer meash = data->GetVariable(nameField->text());