From a65daf42b21c1cd25f643a26ccf6c35d8d524e92 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 14 Nov 2008 04:01:01 +0000 Subject: [PATCH] more accurate sorting, based on a patch by zhangqiang CCMAIL:zhangqiang@redflag-linux.com svn path=/trunk/KDE/kdelibs/; revision=884048 --- containment.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/containment.cpp b/containment.cpp index c45c43c37..12599f106 100644 --- a/containment.cpp +++ b/containment.cpp @@ -240,10 +240,12 @@ bool appletConfigLessThan(const KConfigGroup &c1, const KConfigGroup &c2) { QPointF p1 = c1.readEntry("geometry", QRectF()).topLeft(); QPointF p2 = c2.readEntry("geometry", QRectF()).topLeft(); - if (p1.x() != p2.x()) { + + if (!qFuzzyCompare(p1.x(), p2.x())) { return p1.x() < p2.x(); } - return p1.y() < p2.y(); + + return qFuzzyCompare(p1.y(), p2.y()) || p1.y() < p2.y(); } void Containment::restore(KConfigGroup &group) @@ -340,7 +342,7 @@ void Containment::restoreContents(KConfigGroup &group) KConfigGroup appletConfig(&applets, appletGroup); appletConfigs.append(appletConfig); } - qSort(appletConfigs.begin(), appletConfigs.end(), appletConfigLessThan); + qStableSort(appletConfigs.begin(), appletConfigs.end(), appletConfigLessThan); QMutableListIterator it(appletConfigs); while (it.hasNext()) {