File indexing completed on 2024-09-15 03:39:22
0001 /* 0002 This file is part of the proxy model test suite. 0003 0004 SPDX-FileCopyrightText: 2009 Stephen Kelly <steveire@gmail.com> 0005 0006 SPDX-License-Identifier: LGPL-2.1-or-later 0007 */ 0008 0009 #include "proxymodeltestwidget.h" 0010 0011 #include <QPushButton> 0012 #include <QSplitter> 0013 #include <QTreeView> 0014 #include <QVBoxLayout> 0015 0016 #include "dynamictreemodel.h" 0017 #include "kselectionproxymodel.h" 0018 #include "modelcommander.h" 0019 #if 0 0020 #include "kdescendantsproxymodel.h" 0021 #endif 0022 #include "modelcommanderwidget.h" 0023 0024 ProxyModelTestWidget::ProxyModelTestWidget(QWidget *parent, Qt::WindowFlags f) 0025 : QWidget(parent, f) 0026 { 0027 QVBoxLayout *layout = new QVBoxLayout(this); 0028 QSplitter *splitter = new QSplitter(this); 0029 0030 m_rootModel = new DynamicTreeModel(this); 0031 0032 (void)new ModelCommanderWidget(m_rootModel, splitter); 0033 0034 QTreeView *rootModelView = new QTreeView(splitter); 0035 rootModelView->setModel(m_rootModel); 0036 rootModelView->setSelectionMode(QTreeView::ExtendedSelection); 0037 0038 KSelectionProxyModel *selProxyModel = new KSelectionProxyModel(rootModelView->selectionModel(), this); 0039 selProxyModel->setSourceModel(m_rootModel); 0040 selProxyModel->setFilterBehavior(KSelectionProxyModel::ChildrenOfExactSelection); 0041 0042 QTreeView *selModelView = new QTreeView(splitter); 0043 selModelView->setModel(selProxyModel); 0044 0045 #if 0 0046 KDescendantsProxyModel *descProxyModel = new KDescendantsProxyModel(this); 0047 descProxyModel->setSourceModel(m_rootModel); 0048 QTreeView *descProxyModelView = new QTreeView(splitter); 0049 descProxyModelView ->setModel(descProxyModel); 0050 #endif 0051 0052 // Your Proxy Here? 0053 0054 layout->addWidget(splitter); 0055 } 0056 0057 #include "moc_proxymodeltestwidget.cpp"