From 3407961b6572a4bb699c23d72a9a45399b0e0e8a Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 13 Oct 2013 14:04:26 +0300 Subject: [PATCH] Alphabetic sorting for variables. --HG-- branch : develop --- dialogs/dialogtool.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index ccb701f24..100343c3c 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -396,15 +396,23 @@ void DialogTool::ShowVariable(const QHash *var){ Q_CHECK_PTR(listWidget); disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); listWidget->clear(); - connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); + QHashIterator i(*var); + QMap map; while (i.hasNext()) { i.next(); - QListWidgetItem *item = new QListWidgetItem(i.key()); + map.insert(i.key(), i.value()); + } + + QMapIterator iMap(map); + while (iMap.hasNext()) { + iMap.next(); + QListWidgetItem *item = new QListWidgetItem(iMap.key()); item->setFont(QFont("Times", 12, QFont::Bold)); listWidget->addItem(item); } listWidget->setCurrentRow (0); + connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); } qint64 DialogTool::getIdDetail() const{