File indexing completed on 2024-05-12 04:40:57
0001 /* 0002 SPDX-FileCopyrightText: 2007 David Nolden <david.nolden.kdevelop@art-master.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_PLUGIN_EXPANDINGTREE_H 0008 #define KDEVPLATFORM_PLUGIN_EXPANDINGTREE_H 0009 0010 #include <QTreeView> 0011 #include <QTextDocument> 0012 0013 //A tree that allows drawing additional information 0014 class ExpandingTree 0015 : public QTreeView 0016 { 0017 Q_OBJECT 0018 public: 0019 explicit ExpandingTree(QWidget* parent); 0020 0021 enum CustomRoles { 0022 ProjectPathRole = Qt::UserRole + 5000 0023 }; 0024 0025 void setModel(QAbstractItemModel* model) override; 0026 protected: 0027 void drawRow (QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; 0028 int sizeHintForColumn (int column) const override; 0029 0030 void drawBranches(QPainter* painter, const QRect& rect, const QModelIndex& index) const override; 0031 private: 0032 mutable QTextDocument m_drawText; 0033 }; 0034 0035 #endif // KDEVPLATFORM_PLUGIN_EXPANDINGTREE_H