Refactoring DialogIncrements.

--HG--
branch : develop
This commit is contained in:
dismine 2014-01-18 00:03:24 +02:00
parent 44b33ab1cb
commit add722d0c5
3 changed files with 11 additions and 82 deletions

View File

@ -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) :DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0)
{ {
ui->setupUi(this); ui->setupUi(this);
InitialStandardTable();
InitialIncrementTable();
InitialLinesTable();
InitialSplinesTable();
InitialArcsTable();
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement); DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);
ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);
@ -278,24 +273,19 @@ void DialogIncrements::FullUpdateFromFile()
disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged); &DialogIncrements::cellChanged);
ui->tableWidgetStandard->clear(); ui->tableWidgetStandard->clearContents();
InitialStandardTable();
FillStandardTable(); FillStandardTable();
ui->tableWidgetIncrement->clearContents(); ui->tableWidgetIncrement->clearContents();
//InitialIncrementTable();
FillIncrementTable(); FillIncrementTable();
ui->tableWidgetLines->clear(); ui->tableWidgetLines->clearContents();
InitialLinesTable();
FillLengthLines(); FillLengthLines();
ui->tableWidgetSplines->clear(); ui->tableWidgetSplines->clearContents();
InitialSplinesTable();
FillLengthSplines(); FillLengthSplines();
ui->tableWidgetArcs->clear(); ui->tableWidgetArcs->clearContents();
InitialArcsTable();
FillLengthArcs(); FillLengthArcs();
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, 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) void DialogIncrements::closeEvent(QCloseEvent *event)
{ {
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);

View File

@ -104,26 +104,6 @@ private:
* @brief column save number of column current selected cell * @brief column save number of column current selected cell
*/ */
qint32 column; 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 * @brief FillStandardTable fill data for standard table
*/ */

View File

@ -27,7 +27,7 @@
<enum>QTabWidget::North</enum> <enum>QTabWidget::North</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>4</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tabStandard"> <widget class="QWidget" name="tabStandard">
<attribute name="title"> <attribute name="title">
@ -153,7 +153,7 @@
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<attribute name="verticalHeaderDefaultSectionSize"> <attribute name="verticalHeaderDefaultSectionSize">
<number>45</number> <number>20</number>
</attribute> </attribute>
<attribute name="verticalHeaderStretchLastSection"> <attribute name="verticalHeaderStretchLastSection">
<bool>false</bool> <bool>false</bool>
@ -175,12 +175,12 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>In size</string> <string>In sizes</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>In growth</string> <string>In growths</string>
</property> </property>
</column> </column>
<column> <column>
@ -248,7 +248,7 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Length of the line</string> <string>Length</string>
</property> </property>
</column> </column>
</widget> </widget>
@ -284,7 +284,7 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Length of the curve</string> <string>Length</string>
</property> </property>
</column> </column>
</widget> </widget>
@ -320,7 +320,7 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Length of arc</string> <string>Length</string>
</property> </property>
</column> </column>
</widget> </widget>