From eb03e8165e6aabb9b5cb2adde38eb5f6f8339eff Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 15 Oct 2013 14:01:36 +0300 Subject: [PATCH] Sorting by name for length of lines, curves and arcs. New aligment for name of length of curves. --HG-- branch : develop --- dialogs/dialogincrements.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index 421909f04..b12414859 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -162,8 +162,16 @@ void DialogIncrements::FillIncrementTable(){ void DialogIncrements::FillLengthLines(){ const QHash *linesTable = data->DataLengthLines(); + QHashIterator iHash(*linesTable); + QMap map; + //Sorting QHash by name + while (iHash.hasNext()) { + iHash.next(); + map.insert(iHash.key(), iHash.value()); + } + qint32 currentRow = -1; - QHashIterator i(*linesTable); + QMapIterator i(map); while (i.hasNext()) { i.next(); qreal length = i.value(); @@ -186,8 +194,16 @@ void DialogIncrements::FillLengthLines(){ void DialogIncrements::FillLengthSplines(){ const QHash *splinesTable = data->DataLengthSplines(); + QHashIterator iHash(*splinesTable); + QMap map; + //Sorting QHash by name + while (iHash.hasNext()) { + iHash.next(); + map.insert(iHash.key(), iHash.value()); + } + qint32 currentRow = -1; - QHashIterator i(*splinesTable); + QMapIterator i(map); while (i.hasNext()) { i.next(); qreal length = i.value(); @@ -195,7 +211,7 @@ void DialogIncrements::FillLengthSplines(){ ui->tableWidgetSplines->setRowCount ( splinesTable->size() ); QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); - item->setTextAlignment(Qt::AlignHCenter); + item->setTextAlignment(Qt::AlignLeft); item->setFont(QFont("Times", 12, QFont::Bold)); ui->tableWidgetSplines->setItem(currentRow, 0, item); @@ -210,8 +226,16 @@ void DialogIncrements::FillLengthSplines(){ void DialogIncrements::FillLengthArcs(){ const QHash *arcsTable = data->DataLengthArcs(); + QHashIterator iHash(*arcsTable); + QMap map; + //Sorting QHash by name + while (iHash.hasNext()) { + iHash.next(); + map.insert(iHash.key(), iHash.value()); + } + qint32 currentRow = -1; - QHashIterator i(*arcsTable); + QMapIterator i(map); while (i.hasNext()) { i.next(); qreal length = i.value();