From add722d0c53dd36c7c647cec10cf06df91905ba0 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 18 Jan 2014 00:03:24 +0200 Subject: [PATCH] Refactoring DialogIncrements. --HG-- branch : develop --- src/dialogs/dialogincrements.cpp | 59 +++----------------------------- src/dialogs/dialogincrements.h | 20 ----------- src/dialogs/dialogincrements.ui | 14 ++++---- 3 files changed, 11 insertions(+), 82 deletions(-) diff --git a/src/dialogs/dialogincrements.cpp b/src/dialogs/dialogincrements.cpp index 6fbc5dd10..f78e57f7e 100644 --- a/src/dialogs/dialogincrements.cpp +++ b/src/dialogs/dialogincrements.cpp @@ -37,11 +37,6 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget :DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0) { ui->setupUi(this); - InitialStandardTable(); - InitialIncrementTable(); - InitialLinesTable(); - InitialSplinesTable(); - InitialArcsTable(); DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement); ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate); @@ -278,24 +273,19 @@ void DialogIncrements::FullUpdateFromFile() disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged); - ui->tableWidgetStandard->clear(); - InitialStandardTable(); + ui->tableWidgetStandard->clearContents(); FillStandardTable(); ui->tableWidgetIncrement->clearContents(); - //InitialIncrementTable(); FillIncrementTable(); - ui->tableWidgetLines->clear(); - InitialLinesTable(); + ui->tableWidgetLines->clearContents(); FillLengthLines(); - ui->tableWidgetSplines->clear(); - InitialSplinesTable(); + ui->tableWidgetSplines->clearContents(); FillLengthSplines(); - ui->tableWidgetArcs->clear(); - InitialArcsTable(); + ui->tableWidgetArcs->clearContents(); FillLengthArcs(); connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, @@ -511,47 +501,6 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) } } -void DialogIncrements::InitialStandardTable() -{ - ui->tableWidgetStandard->setSortingEnabled(false); - ui->tableWidgetStandard->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Name"))); - ui->tableWidgetStandard->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Calculated value"))); - ui->tableWidgetStandard->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Base value"))); - ui->tableWidgetStandard->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size"))); - ui->tableWidgetStandard->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth"))); - ui->tableWidgetStandard->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description"))); -} - -void DialogIncrements::InitialIncrementTable() -{ - ui->tableWidgetIncrement->setSortingEnabled(false); - ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Name"))); - ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Calculated value"))); - ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Base value"))); - ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size"))); - ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth"))); - ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description"))); - ui->tableWidgetIncrement->verticalHeader()->setDefaultSectionSize(20); -} - -void DialogIncrements::InitialLinesTable() -{ - ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Line"))); - ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length"))); -} - -void DialogIncrements::InitialSplinesTable() -{ - ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Curve"))); - ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length"))); -} - -void DialogIncrements::InitialArcsTable() -{ - ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Arc"))); - ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length"))); -} - void DialogIncrements::closeEvent(QCloseEvent *event) { emit DialogClosed(QDialog::Accepted); diff --git a/src/dialogs/dialogincrements.h b/src/dialogs/dialogincrements.h index 169964849..156e0c78f 100644 --- a/src/dialogs/dialogincrements.h +++ b/src/dialogs/dialogincrements.h @@ -104,26 +104,6 @@ private: * @brief column save number of column current selected cell */ qint32 column; - /** - * @brief InitialStandardTable initial option standard table - */ - void InitialStandardTable(); - /** - * @brief InitialIncrementTable initial option increment table - */ - void InitialIncrementTable(); - /** - * @brief InitialLinesTable initial option lines table - */ - void InitialLinesTable(); - /** - * @brief InitialSplinesTable initial option splines table - */ - void InitialSplinesTable(); - /** - * @brief InitialArcsTable initial option arcs table - */ - void InitialArcsTable(); /** * @brief FillStandardTable fill data for standard table */ diff --git a/src/dialogs/dialogincrements.ui b/src/dialogs/dialogincrements.ui index cd4871012..c51648560 100644 --- a/src/dialogs/dialogincrements.ui +++ b/src/dialogs/dialogincrements.ui @@ -27,7 +27,7 @@ QTabWidget::North - 4 + 1 @@ -153,7 +153,7 @@ false - 45 + 20 false @@ -175,12 +175,12 @@ - In size + In sizes - In growth + In growths @@ -248,7 +248,7 @@ - Length of the line + Length @@ -284,7 +284,7 @@ - Length of the curve + Length @@ -320,7 +320,7 @@ - Length of arc + Length