File: kidentityproxymodelwidget.cpp

package info (click to toggle)
kitemmodels 5.116.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,844 kB
  • sloc: cpp: 18,018; python: 26; sh: 13; makefile: 7
file content (63 lines) | stat: -rw-r--r-- 1,739 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
    SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
    SPDX-FileContributor: Stephen Kelly <stephen@kdab.com>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/

#include "kidentityproxymodelwidget.h"

#include <QHBoxLayout>
#include <QIdentityProxyModel>
#include <QSplitter>
#include <QTreeView>
#include <dynamictreemodel.h>
#include <kbreadcrumbselectionmodel.h>

#include "dynamictreewidget.h"

#include "modeltest.h"

KIdentityProxyModelWidget::KIdentityProxyModelWidget(QWidget *parent, Qt::WindowFlags f)
    : QWidget(parent, f)
{
    QHBoxLayout *layout = new QHBoxLayout(this);
    QSplitter *splitter = new QSplitter(this);
    layout->addWidget(splitter);

    DynamicTreeModel *rootModel = new DynamicTreeModel(this);

    DynamicTreeWidget *treeWidget = new DynamicTreeWidget(rootModel, splitter);
    treeWidget->setInitialTree(
        QLatin1String(" - 1"
                      " - 2"
                      " - - 3"
                      " - - 4"
                      " - - 5"
                      " - 6"
                      " - 7"
                      " - - 8"
                      " - - - 9"
                      " - - - 10"
                      " - - 11")
        //     " - - 12"
        //     " - 13"
        //     " - 14"
        //     " - 15"
        //     " - - 16"
        //     " - - - 17"
        //     " - - - 18"
        //     " - 19"
        //     " - 20"
        //     " - 21"
    );

    QIdentityProxyModel *proxy = new QIdentityProxyModel(this);
    proxy->setSourceModel(rootModel);

    QTreeView *view1 = new QTreeView(splitter);
    view1->setModel(proxy);
    view1->expandAll();
}

#include "moc_kidentityproxymodelwidget.cpp"