more accurate sorting, based on a patch by zhangqiang

CCMAIL:zhangqiang@redflag-linux.com

svn path=/trunk/KDE/kdelibs/; revision=884048
This commit is contained in:
Aaron J. Seigo 2008-11-14 04:01:01 +00:00
parent 0bc65a788d
commit a65daf42b2

View File

@ -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<KConfigGroup> it(appletConfigs);
while (it.hasNext()) {