KItemModels

kdescendantsproxymodel_qml.cpp
1/*
2 SPDX-FileCopyrightText: 2020 Marco Martin <mart@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "kdescendantsproxymodel_qml.h"
8#include <QDebug>
9
10KDescendantsProxyModelQml::KDescendantsProxyModelQml(QObject *parent)
12{
13}
14
15KDescendantsProxyModelQml::~KDescendantsProxyModelQml()
16{
17}
18
19void KDescendantsProxyModelQml::expandChildren(int row)
20{
21 QModelIndex idx = mapToSource(index(row, 0));
23}
24
25void KDescendantsProxyModelQml::collapseChildren(int row)
26{
27 QModelIndex idx = mapToSource(index(row, 0));
29}
30
31void KDescendantsProxyModelQml::toggleChildren(int row)
32{
33 QModelIndex sourceIndex = mapToSource(index(row, 0));
34
35 if (!sourceModel()->hasChildren(sourceIndex)) {
36 return;
37 }
38
41 } else {
43 }
44}
45
46#include "moc_kdescendantsproxymodel_qml.cpp"
Proxy Model for restructuring a Tree into a list.
void collapseSourceIndex(const QModelIndex &sourceIndex)
Maps a source index as collapsed in the proxy, all its children will be hidden.
bool isSourceIndexExpanded(const QModelIndex &sourceIndex) const
void expandSourceIndex(const QModelIndex &sourceIndex)
Maps a source index as expanded in the proxy, all its children will become visible.
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:34 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.