File indexing completed on 2024-07-14 03:53:08

0001 
0002 #include <QApplication>
0003 #include <QStringList>
0004 
0005 #include <kcolorcollection.h>
0006 
0007 #include <stdio.h>
0008 #include <stdlib.h>
0009 
0010 int main(int argc, char **argv)
0011 {
0012     QApplication::setApplicationName(QStringLiteral("KColorCollectionTest"));
0013     QApplication app(argc, argv);
0014 
0015     QStringList collections = KColorCollection::installedCollections();
0016     for (QStringList::ConstIterator it = collections.constBegin(); it != collections.constEnd(); ++it) {
0017         printf("Palette = %s\n", (*it).toLatin1().constData());
0018 
0019         KColorCollection myColorCollection = KColorCollection(*it);
0020 
0021         printf("Palette Name = \"%s\"\n", myColorCollection.name().toLatin1().constData());
0022         printf("Description:\n\"%s\"\n", myColorCollection.description().toLatin1().constData());
0023         printf("Nr of Colors = %d\n", myColorCollection.count());
0024         for (int i = 0; i < myColorCollection.count(); i++) {
0025             int r;
0026             int g;
0027             int b;
0028             myColorCollection.color(i).getRgb(&r, &g, &b);
0029             printf("#%d Name = \"%s\" #%02x%02x%02x\n", i, myColorCollection.name(i).toLatin1().constData(), r, g, b);
0030         }
0031     }
0032     return EXIT_SUCCESS;
0033 }