File indexing completed on 2024-04-21 03:56:13

0001 /*
0002     SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0003     SPDX-FileContributor: Stephen Kelly <stephen@kdab.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "kidentityproxymodelwidget.h"
0009 
0010 #include <QHBoxLayout>
0011 #include <QIdentityProxyModel>
0012 #include <QSplitter>
0013 #include <QTreeView>
0014 #include <dynamictreemodel.h>
0015 #include <kbreadcrumbselectionmodel.h>
0016 
0017 #include "dynamictreewidget.h"
0018 
0019 #include "modeltest.h"
0020 
0021 KIdentityProxyModelWidget::KIdentityProxyModelWidget(QWidget *parent, Qt::WindowFlags f)
0022     : QWidget(parent, f)
0023 {
0024     QHBoxLayout *layout = new QHBoxLayout(this);
0025     QSplitter *splitter = new QSplitter(this);
0026     layout->addWidget(splitter);
0027 
0028     DynamicTreeModel *rootModel = new DynamicTreeModel(this);
0029 
0030     DynamicTreeWidget *treeWidget = new DynamicTreeWidget(rootModel, splitter);
0031     treeWidget->setInitialTree(
0032         QLatin1String(" - 1"
0033                       " - 2"
0034                       " - - 3"
0035                       " - - 4"
0036                       " - - 5"
0037                       " - 6"
0038                       " - 7"
0039                       " - - 8"
0040                       " - - - 9"
0041                       " - - - 10"
0042                       " - - 11")
0043         //     " - - 12"
0044         //     " - 13"
0045         //     " - 14"
0046         //     " - 15"
0047         //     " - - 16"
0048         //     " - - - 17"
0049         //     " - - - 18"
0050         //     " - 19"
0051         //     " - 20"
0052         //     " - 21"
0053     );
0054 
0055     QIdentityProxyModel *proxy = new QIdentityProxyModel(this);
0056     proxy->setSourceModel(rootModel);
0057 
0058     QTreeView *view1 = new QTreeView(splitter);
0059     view1->setModel(proxy);
0060     view1->expandAll();
0061 }
0062 
0063 #include "moc_kidentityproxymodelwidget.cpp"