Added natural registers sorting in RegistersWidget (#1591)

This commit is contained in:
rrockru 2019-05-27 10:55:09 +03:00 committed by Itay Cohen
parent 6c76c85c97
commit adf28e4362

View File

@ -4,6 +4,7 @@
#include "core/MainWindow.h" #include "core/MainWindow.h"
#include <QCollator>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
@ -45,6 +46,11 @@ void RegistersWidget::setRegisterGrid()
QJsonObject registerValues = Core()->getRegisterValues().object(); QJsonObject registerValues = Core()->getRegisterValues().object();
QJsonObject registerRefs = Core()->getRegisterJson(); QJsonObject registerRefs = Core()->getRegisterJson();
QStringList registerNames = registerValues.keys(); QStringList registerNames = registerValues.keys();
QCollator collator;
collator.setNumericMode(true);
std::sort(registerNames.begin(), registerNames.end(), collator);
registerLen = registerValues.size(); registerLen = registerValues.size();
for (const QString &key : registerNames) { for (const QString &key : registerNames) {
regValue = RAddressString(registerValues[key].toVariant().toULongLong()); regValue = RAddressString(registerValues[key].toVariant().toULongLong());