Refactoring.
--HG-- branch : develop
This commit is contained in:
parent
9aaf90bf5b
commit
623e2ef6dd
|
@ -38,6 +38,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#include <QTableWidget>
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -296,13 +297,12 @@ void DialogIncrements::FillIncrements()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
void DialogIncrements::FillTable(const QHash<QString, qreal> *varTable, QTableWidget *table)
|
||||||
* @brief FillLengthLines fill data for table of lines lengths
|
|
||||||
*/
|
|
||||||
void DialogIncrements::FillLengthLines()
|
|
||||||
{
|
{
|
||||||
const QHash<QString, qreal> *linesTable = data->DataLengthLines();
|
SCASSERT(table != nullptr);
|
||||||
QHashIterator<QString, qreal> iHash(*linesTable);
|
SCASSERT(varTable != nullptr);
|
||||||
|
|
||||||
|
QHashIterator<QString, qreal> iHash(*varTable);
|
||||||
QMap<QString, qreal> map;
|
QMap<QString, qreal> map;
|
||||||
//Sorting QHash by name
|
//Sorting QHash by name
|
||||||
while (iHash.hasNext())
|
while (iHash.hasNext())
|
||||||
|
@ -318,20 +318,29 @@ void DialogIncrements::FillLengthLines()
|
||||||
i.next();
|
i.next();
|
||||||
qreal length = i.value();
|
qreal length = i.value();
|
||||||
currentRow++;
|
currentRow++;
|
||||||
ui->tableWidgetLines->setRowCount ( linesTable->size() );
|
table->setRowCount ( varTable->size() );
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
|
QTableWidgetItem *item = new QTableWidgetItem(i.key());
|
||||||
item->setTextAlignment(Qt::AlignLeft);
|
item->setTextAlignment(Qt::AlignLeft);
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
ui->tableWidgetLines->setItem(currentRow, 0, item);
|
table->setItem(currentRow, 0, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(length));
|
item = new QTableWidgetItem(QString().setNum(length));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetLines->setItem(currentRow, 1, item);
|
table->setItem(currentRow, 1, item);
|
||||||
}
|
}
|
||||||
ui->tableWidgetLines->resizeColumnsToContents();
|
table->resizeColumnsToContents();
|
||||||
ui->tableWidgetLines->resizeRowsToContents();
|
table->resizeRowsToContents();
|
||||||
ui->tableWidgetLines->verticalHeader()->setDefaultSectionSize(20);
|
table->verticalHeader()->setDefaultSectionSize(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief FillLengthLines fill data for table of lines lengths
|
||||||
|
*/
|
||||||
|
void DialogIncrements::FillLengthLines()
|
||||||
|
{
|
||||||
|
FillTable(data->DataLengthLines(), ui->tableWidgetLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -340,37 +349,7 @@ void DialogIncrements::FillLengthLines()
|
||||||
*/
|
*/
|
||||||
void DialogIncrements::FillLengthSplines()
|
void DialogIncrements::FillLengthSplines()
|
||||||
{
|
{
|
||||||
const QHash<QString, qreal> *splinesTable = data->DataLengthSplines();
|
FillTable(data->DataLengthSplines(), ui->tableWidgetSplines);
|
||||||
QHashIterator<QString, qreal> iHash(*splinesTable);
|
|
||||||
QMap<QString, qreal> map;
|
|
||||||
//Sorting QHash by name
|
|
||||||
while (iHash.hasNext())
|
|
||||||
{
|
|
||||||
iHash.next();
|
|
||||||
map.insert(qApp->VarToUser(iHash.key()), iHash.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
qint32 currentRow = -1;
|
|
||||||
QMapIterator<QString, qreal> i(map);
|
|
||||||
while (i.hasNext())
|
|
||||||
{
|
|
||||||
i.next();
|
|
||||||
qreal length = i.value();
|
|
||||||
currentRow++;
|
|
||||||
ui->tableWidgetSplines->setRowCount ( splinesTable->size() );
|
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(i.key());
|
|
||||||
item->setTextAlignment(Qt::AlignLeft);
|
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
|
||||||
ui->tableWidgetSplines->setItem(currentRow, 0, item);
|
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(length));
|
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
|
||||||
ui->tableWidgetSplines->setItem(currentRow, 1, item);
|
|
||||||
}
|
|
||||||
ui->tableWidgetSplines->resizeColumnsToContents();
|
|
||||||
ui->tableWidgetSplines->resizeRowsToContents();
|
|
||||||
ui->tableWidgetSplines->verticalHeader()->setDefaultSectionSize(20);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -379,37 +358,7 @@ void DialogIncrements::FillLengthSplines()
|
||||||
*/
|
*/
|
||||||
void DialogIncrements::FillLengthArcs()
|
void DialogIncrements::FillLengthArcs()
|
||||||
{
|
{
|
||||||
const QHash<QString, qreal> *arcsTable = data->DataLengthArcs();
|
FillTable(data->DataLengthArcs(), ui->tableWidgetArcs);
|
||||||
QHashIterator<QString, qreal> iHash(*arcsTable);
|
|
||||||
QMap<QString, qreal> map;
|
|
||||||
//Sorting QHash by name
|
|
||||||
while (iHash.hasNext())
|
|
||||||
{
|
|
||||||
iHash.next();
|
|
||||||
map.insert(qApp->VarToUser(iHash.key()), iHash.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
qint32 currentRow = -1;
|
|
||||||
QMapIterator<QString, qreal> i(map);
|
|
||||||
while (i.hasNext())
|
|
||||||
{
|
|
||||||
i.next();
|
|
||||||
qreal length = i.value();
|
|
||||||
currentRow++;
|
|
||||||
ui->tableWidgetArcs->setRowCount ( arcsTable->size() );
|
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(i.key());
|
|
||||||
item->setTextAlignment(Qt::AlignLeft);
|
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
|
||||||
ui->tableWidgetArcs->setItem(currentRow, 0, item);
|
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(length));
|
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
|
||||||
ui->tableWidgetArcs->setItem(currentRow, 1, item);
|
|
||||||
}
|
|
||||||
ui->tableWidgetArcs->verticalHeader()->setDefaultSectionSize(20);
|
|
||||||
ui->tableWidgetArcs->resizeColumnsToContents();
|
|
||||||
ui->tableWidgetArcs->resizeRowsToContents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
class VPattern;
|
class VPattern;
|
||||||
class VIndividualMeasurements;
|
class VIndividualMeasurements;
|
||||||
|
class QTableWidget;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -93,6 +94,7 @@ private:
|
||||||
|
|
||||||
void FillMeasurements();
|
void FillMeasurements();
|
||||||
void FillIncrements();
|
void FillIncrements();
|
||||||
|
void FillTable(const QHash<QString, qreal> *varTable, QTableWidget *table);
|
||||||
void FillLengthLines();
|
void FillLengthLines();
|
||||||
void FillLengthSplines();
|
void FillLengthSplines();
|
||||||
void FillLengthArcs();
|
void FillLengthArcs();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user