diff --git a/debugger/variable/variablesortmodel.h b/debugger/variable/variablesortmodel.h --- a/debugger/variable/variablesortmodel.h +++ b/debugger/variable/variablesortmodel.h @@ -22,6 +22,7 @@ #ifndef KDEVPLATFORM_VARIABLESORTMODEL_H #define KDEVPLATFORM_VARIABLESORTMODEL_H +#include #include class QModelIndex; @@ -38,6 +39,8 @@ protected: bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; +private: + QCollator m_collator; }; } diff --git a/debugger/variable/variablesortmodel.cpp b/debugger/variable/variablesortmodel.cpp --- a/debugger/variable/variablesortmodel.cpp +++ b/debugger/variable/variablesortmodel.cpp @@ -21,25 +21,21 @@ #include "variablesortmodel.h" -#include -#include - namespace KDevelop { VariableSortProxyModel::VariableSortProxyModel(QObject *parent) : QSortFilterProxyModel(parent) { + m_collator.setNumericMode(true); + m_collator.setCaseSensitivity(Qt::CaseInsensitive); } bool VariableSortProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const { - QCollator collator; - collator.setNumericMode(true); - collator.setCaseSensitivity(Qt::CaseInsensitive); const QString leftString = sourceModel()->data(left).toString(); const QString rightString = sourceModel()->data(right).toString(); - int result = collator.compare(leftString, rightString); + int result = m_collator.compare(leftString, rightString); return result < 0; }