summaryrefslogtreecommitdiffstats
path: root/gui/groupview
diff options
context:
space:
mode:
Diffstat (limited to 'gui/groupview')
-rw-r--r--gui/groupview/GroupView.cpp18
-rw-r--r--gui/groupview/GroupedProxyModel.cpp18
2 files changed, 34 insertions, 2 deletions
diff --git a/gui/groupview/GroupView.cpp b/gui/groupview/GroupView.cpp
index 31d242dd..502cf259 100644
--- a/gui/groupview/GroupView.cpp
+++ b/gui/groupview/GroupView.cpp
@@ -62,12 +62,28 @@ void GroupView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int e
scheduleDelayedItemsLayout();
}
+class LocaleString : public QString
+{
+public:
+ LocaleString(const char *s) : QString(s)
+ {
+ }
+ LocaleString(const QString &s) : QString(s)
+ {
+ }
+};
+
+inline bool operator<(const LocaleString &lhs, const LocaleString &rhs)
+{
+ return (QString::localeAwareCompare(lhs, rhs) < 0);
+}
+
void GroupView::updateGeometries()
{
geometryCache.clear();
int previousScroll = verticalScrollBar()->value();
- QMap<QString, VisualGroup *> cats;
+ QMap<LocaleString, VisualGroup *> cats;
for (int i = 0; i < model()->rowCount(); ++i)
{
diff --git a/gui/groupview/GroupedProxyModel.cpp b/gui/groupview/GroupedProxyModel.cpp
index d9d6ac78..30845caa 100644
--- a/gui/groupview/GroupedProxyModel.cpp
+++ b/gui/groupview/GroupedProxyModel.cpp
@@ -1,6 +1,7 @@
#include "GroupedProxyModel.h"
#include "GroupView.h"
+#include "logger/QsLog.h"
GroupedProxyModel::GroupedProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
{
@@ -16,7 +17,22 @@ bool GroupedProxyModel::lessThan(const QModelIndex &left, const QModelIndex &rig
}
else
{
- return leftCategory < rightCategory;
+ // FIXME: real group sorting happens in GroupView::updateGeometries(), see LocaleString
+ auto result = leftCategory.localeAwareCompare(rightCategory);
+ if(result < 0)
+ {
+ QLOG_DEBUG() << leftCategory << "<" << rightCategory;
+ }
+ if(result == 0)
+ {
+ QLOG_DEBUG() << leftCategory << "=" << rightCategory;
+ return subSortLessThan(left, right);
+ }
+ if(result > 0)
+ {
+ QLOG_DEBUG() << leftCategory << ">" << rightCategory;
+ }
+ return result < 0;
}
}