File indexing completed on 2024-05-12 04:37:37
0001 /* 0002 SPDX-FileCopyrightText: 2008 Vladimir Prus <ghost@cs.msu.su> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_TREEVIEW_H 0008 #define KDEVPLATFORM_TREEVIEW_H 0009 0010 #include <QTreeView> 0011 0012 #include <debugger/debuggerexport.h> 0013 0014 namespace KDevelop 0015 { 0016 class TreeModel; 0017 0018 class KDEVPLATFORMDEBUGGER_EXPORT AsyncTreeView : public QTreeView 0019 { 0020 Q_OBJECT 0021 public: 0022 explicit AsyncTreeView(TreeModel& treeModel, QWidget* parent = nullptr); 0023 0024 QSize sizeHint() const override; 0025 void resizeColumns(); 0026 void setAutoResizeColumns(bool on); 0027 0028 // Well, I really, really, need this. 0029 using QTreeView::indexRowSizeHint; 0030 0031 protected: 0032 TreeModel& treeModel(); 0033 0034 private Q_SLOTS: 0035 void slotExpanded(const QModelIndex &index); 0036 void slotCollapsed(const QModelIndex &index); 0037 void slotClicked(const QModelIndex &index); 0038 void slotExpandedDataReady(); 0039 0040 private: 0041 virtual QModelIndex mapViewIndexToTreeModelIndex(const QModelIndex& viewIndex) const; 0042 void resizeColumnsAutomatically(); 0043 0044 TreeModel& m_treeModel; 0045 bool m_autoResizeColumns; 0046 }; 0047 0048 } 0049 0050 0051 0052 #endif