File indexing completed on 2024-04-28 04:41:52

0001 /***************************************************************************
0002  *   Copyright (C) 2017 by Emmanuel Lepage Vallee                          *
0003  *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@kde.org>             *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 3 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
0017  **************************************************************************/
0018 #ifndef TREEVIEW_H
0019 #define TREEVIEW_H
0020 
0021 #include <KQuickItemViews/singlemodelviewbase.h>
0022 
0023 // Qt
0024 class QQuickItem;
0025 
0026 // KQuickItemViews
0027 class TreeViewPrivate;
0028 
0029 /**
0030  * Second generation of QtQuick treeview.
0031  *
0032  * The first one was designed for the chat view. It had a limited number of
0033  * requirements when it came to QtModel. However it required total control of
0034  * the layout.
0035  *
0036  * This is the opposite use case. The layout is classic, but the model support
0037  * has to be complete. Performance and lazy loading is also more important.
0038  *
0039  * It require less work to write a new treeview than refector the first one to
0040  * support the additional requirements. In the long run, the first generation
0041  * could be folded into this widget (if it ever makes sense, otherwise they will
0042  * keep diverging).
0043  */
0044 class Q_DECL_EXPORT TreeView : public SingleModelViewBase
0045 {
0046     Q_OBJECT
0047 
0048     friend class TreeViewItem;
0049 public:
0050     explicit TreeView(QQuickItem* parent = nullptr);
0051     virtual ~TreeView();
0052 
0053 private:
0054     TreeViewPrivate* d_ptr;
0055     Q_DECLARE_PRIVATE(TreeView)
0056 };
0057 
0058 #endif