[PATCH 1/7] Sort the paintop preset alphabetically.
Silvio Heinrich
plassy at web.de
Sat Dec 25 17:04:16 CET 2010
---
krita/ui/widgets/kis_preset_chooser.cpp | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/krita/ui/widgets/kis_preset_chooser.cpp b/krita/ui/widgets/kis_preset_chooser.cpp
index b13d65e..f84c922 100644
--- a/krita/ui/widgets/kis_preset_chooser.cpp
+++ b/krita/ui/widgets/kis_preset_chooser.cpp
@@ -30,6 +30,7 @@
#include <klineedit.h>
#include <kicon.h>
+#include <KoResource.h>
#include <KoResourceItemChooser.h>
#include <KoResourceModel.h>
#include <KoResourceServerAdapter.h>
@@ -100,6 +101,10 @@ void KisPresetDelegate::paint(QPainter * painter, const QStyleOptionViewItem & o
class KisPresetProxyAdapter : public KoResourceServerAdapter<KisPaintOpPreset>
{
+ static bool compareKoResources(const KoResource* a, const KoResource* b){
+ return a->name() < b->name();
+ }
+
public:
KisPresetProxyAdapter(KoResourceServer< KisPaintOpPreset >* resourceServer)
: KoResourceServerAdapter<KisPaintOpPreset>(resourceServer), m_showAll(false){}
@@ -108,7 +113,7 @@ public:
virtual QList< KoResource* > resources() {
if( ! resourceServer() )
return QList<KoResource*>();
-
+
QList<KisPaintOpPreset*> serverResources = resourceServer()->resources();
QList<KoResource*> resources;
@@ -117,7 +122,9 @@ public:
resources.append( resource );
}
}
- return resources;
+
+ qSort(resources.begin(), resources.end(), KisPresetProxyAdapter::compareKoResources);
+ return resources;
}
bool filterAcceptsPreset(KisPaintOpPreset* preset) const
--
1.7.1
More information about the kimageshop
mailing list