int main(int argc, char **argv) { icons << "konqueror"; icons << "okular"; icons << "plasma"; icons << "system-file-manager"; QApplication app(argc, argv); QMainWindow *mainWindow = new QMainWindow(); mainWindow->setMinimumSize(640, 480); KCategorizedView *listView = new KCategorizedView(); listView->setCategoryDrawer(new KCategoryDrawer()); listView->setViewMode(QListView::IconMode); MyModel *model = new MyModel(); model->insertRows(0, 100); for (int i = 0; i < 100; ++i) { model->setData(model->index(i, 0), QString::number(i), Qt::DisplayRole); } KCategorizedSortFilterProxyModel *proxyModel = new KCategorizedSortFilterProxyModel(); proxyModel->setCategorizedModel(true); proxyModel->setSourceModel(model); listView->setModel(proxyModel); mainWindow->setCentralWidget(listView); mainWindow->show(); return app.exec(); }
int main(int argc, char **argv) { icons << "konqueror"; icons << "okular"; icons << "plasma"; icons << "system-file-manager"; KAboutData aboutData("KCategorizedViewTest", 0, ki18n("KCategorizedViewTest"), "1.0", ki18n("KCategorizedViewTest"), KAboutData::License_LGPL_V3, ki18n("(c) 2009 Rafael Fernández López"), ki18n("KCategorizedViewTest"), "http://www.kde.org"); KCmdLineArgs::init(argc, argv, &aboutData); KApplication app; QMainWindow *mainWindow = new QMainWindow(); mainWindow->setMinimumSize(640, 480); KCategorizedView *listView = new KCategorizedView(); listView->setCategoryDrawer(new KCategoryDrawer()); listView->setViewMode(QListView::IconMode); MyModel *model = new MyModel(); model->insertRows(0, 100); for (int i = 0; i < 100; ++i) { model->setData(model->index(i, 0), QString::number(i), Qt::DisplayRole); } KCategorizedSortFilterProxyModel *proxyModel = new KCategorizedSortFilterProxyModel(); proxyModel->setCategorizedModel(true); proxyModel->setSourceModel(model); listView->setModel(proxyModel); mainWindow->setCentralWidget(listView); mainWindow->show(); return app.exec(); }