Changeset View
Changeset View
Standalone View
Standalone View
plugins/projectmanagerview/projectmodelitemdelegate.h
Show All 15 Lines | 1 | /* This file is part of KDevelop | |||
---|---|---|---|---|---|
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #ifndef KDEVPLATFORM_PLUGIN_PROJECTMODELITEMDELEGATE_H | 20 | #ifndef KDEVPLATFORM_PLUGIN_PROJECTMODELITEMDELEGATE_H | ||
21 | #define KDEVPLATFORM_PLUGIN_PROJECTMODELITEMDELEGATE_H | 21 | #define KDEVPLATFORM_PLUGIN_PROJECTMODELITEMDELEGATE_H | ||
22 | 22 | | |||
23 | #include <QItemDelegate> | 23 | #include <QItemDelegate> | ||
24 | #include <QPointer> | ||||
25 | | ||||
26 | namespace KDevelop | ||||
27 | { | ||||
28 | class NavigationToolTip; | ||||
29 | } | ||||
24 | 30 | | |||
25 | class ProjectModelItemDelegate : public QItemDelegate | 31 | class ProjectModelItemDelegate : public QItemDelegate | ||
26 | { | 32 | { | ||
27 | Q_OBJECT | 33 | Q_OBJECT | ||
28 | public: | 34 | public: | ||
29 | explicit ProjectModelItemDelegate(QObject* parent = nullptr); | 35 | explicit ProjectModelItemDelegate(QObject* parent = nullptr); | ||
30 | 36 | | |||
31 | void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; | 37 | void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; | ||
32 | void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, | 38 | void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, | ||
33 | const QRect &rect, const QString &text) const override; | 39 | const QRect &rect, const QString &text) const override; | ||
40 | bool helpEvent(QHelpEvent* event, QAbstractItemView* view, const QStyleOptionViewItem& option, | ||||
41 | const QModelIndex& index) override; | ||||
34 | 42 | | |||
35 | private: | 43 | private: | ||
36 | void drawBranchName(QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect, | 44 | void drawBranchName(QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect, | ||
37 | const QString& branchName) const; | 45 | const QString& branchName) const; | ||
38 | void drawStyledBackground(QPainter* painter, const QStyleOptionViewItem& option) const; | 46 | void drawStyledBackground(QPainter* painter, const QStyleOptionViewItem& option) const; | ||
47 | | ||||
48 | private: | ||||
49 | QPointer<KDevelop::NavigationToolTip> m_tooltip; | ||||
50 | QPersistentModelIndex m_tooltippedIndex; | ||||
39 | }; | 51 | }; | ||
40 | 52 | | |||
41 | #endif // KDEVPLATFORM_PLUGIN_PROJECTMODELITEMDELEGATE_H | 53 | #endif // KDEVPLATFORM_PLUGIN_PROJECTMODELITEMDELEGATE_H |