[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdeui/tests
From: Rafael Fernández López <ereslibre () kde ! org>
Date: 2009-08-07 10:15:09
Message-ID: 1249640109.853563.5174.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1008371 by ereslibre:
Prettier test
M +12 -6 kcategorizedviewtest.cpp
--- trunk/KDE/kdelibs/kdeui/tests/kcategorizedviewtest.cpp #1008370:1008371
@@ -24,11 +24,14 @@
#include <kapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
+#include <kiconloader.h>
#include <kcategorizedview.h>
#include <kcategorydrawer.h>
#include <kcategorizedsortfilterproxymodel.h>
+QStringList icons;
+
class MyModel
: public QStringListModel
{
@@ -37,15 +40,13 @@
{
switch (role) {
case KCategorizedSortFilterProxyModel::CategoryDisplayRole: {
- const QString num = index.data(Qt::DisplayRole).toString();
- return QString::number(num.toInt() / 10);
+ return QString::number(index.row() / 10);
}
- break;
case KCategorizedSortFilterProxyModel::CategorySortRole: {
- const QString num = index.data(Qt::DisplayRole).toString();
- return num.toInt() / 10;
+ return index.row() / 10;
}
- break;
+ case Qt::DecorationRole:
+ return DesktopIcon(icons[index.row() % 4], KIconLoader::Desktop);
default:
break;
}
@@ -55,6 +56,11 @@
int main(int argc, char **argv)
{
+ icons << "konqueror";
+ icons << "okular";
+ icons << "plasma";
+ icons << "system-file-manager";
+
KAboutData aboutData("KCategorizedViewTest",
0,
ki18n("KCategorizedViewTest"),
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic