File indexing completed on 2024-05-05 04:40:14
0001 /* 0002 SPDX-FileCopyrightText: 2007 Hamish Rodda <rodda@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_PLUGIN_PROBLEMTREEVIEW_H 0008 #define KDEVPLATFORM_PLUGIN_PROBLEMTREEVIEW_H 0009 0010 #include <QTreeView> 0011 0012 namespace KDevelop 0013 { 0014 class TopDUContext; 0015 class IDocument; 0016 class ProblemModel; 0017 } 0018 0019 class ProblemReporterPlugin; 0020 class QSortFilterProxyModel; 0021 0022 class ProblemTreeView : public QTreeView 0023 { 0024 Q_OBJECT 0025 0026 public: 0027 ProblemTreeView(QWidget* parent, QAbstractItemModel* itemModel); 0028 ~ProblemTreeView() override; 0029 0030 KDevelop::ProblemModel* model() const; 0031 void setModel(QAbstractItemModel* model) override; 0032 0033 void contextMenuEvent(QContextMenuEvent*) override; 0034 0035 int setFilter(const QString& filterText); 0036 0037 public Q_SLOTS: 0038 void openDocumentForCurrentProblem(); 0039 0040 Q_SIGNALS: 0041 // Emitted when the model's rows change (added/removed/reset) 0042 void changed(); 0043 0044 protected: 0045 void resizeEvent(QResizeEvent* event) override; 0046 0047 private Q_SLOTS: 0048 void itemActivated(const QModelIndex& index); 0049 0050 private: 0051 void resizeColumns(); 0052 ProblemReporterPlugin* m_plugin; 0053 QSortFilterProxyModel* m_proxy; 0054 int m_averageCharWidth = -1; 0055 int m_headerWidth = -1; 0056 }; 0057 0058 #endif