11 #ifndef smtk_extension_qtDescriptivePhraseDelegate_h
12 #define smtk_extension_qtDescriptivePhraseDelegate_h
14 #include "smtk/extension/qt/Exports.h"
15 #include "smtk/view/BadgeSet.h"
16 #include "smtk/view/Selection.h"
18 #include <QStyledItemDelegate>
25 class qtDescriptivePhraseModel;
32 Q_PROPERTY(
int titleFontSize READ titleFontSize WRITE setTitleFontSize)
33 Q_PROPERTY(
int subtitleFontSize READ subtitleFontSize WRITE setSubtitleFontSize)
34 Q_PROPERTY(
int titleFontWeight READ titleFontWeight WRITE setTitleFontWeight)
35 Q_PROPERTY(
int subtitleFontWeight READ subtitleFontWeight WRITE setSubtitleFontWeight)
36 Q_PROPERTY(
int textVerticalPad READ textVerticalPad WRITE setTextVerticalPad)
37 Q_PROPERTY(
bool drawSubtitle READ drawSubtitle WRITE setDrawSubtitle)
38 Q_PROPERTY(
bool visibilityMode READ visibilityMode WRITE setVisibilityMode)
39 Q_PROPERTY(std::shared_ptr<smtk::view::Selection> selection READ selection WRITE setSelection)
43 int titleFontSize()
const;
44 int subtitleFontSize()
const;
45 int titleFontWeight()
const;
46 int subtitleFontWeight()
const;
47 int textVerticalPad()
const;
48 bool drawSubtitle()
const;
49 bool highlightOnHover()
const;
50 bool visibilityMode()
const;
51 std::shared_ptr<smtk::view::Selection> selection()
const;
54 void setTitleFontSize(
int tfs);
55 void setSubtitleFontSize(
int sfs);
56 void setTitleFontWeight(
int tfs);
57 void setSubtitleFontWeight(
int sfs);
58 void setTextVerticalPad(
int tvp);
59 void setDrawSubtitle(
bool includeSubtitle);
60 void setVisibilityMode(
bool allEditsChangeVisibility);
61 void setHighlightOnHover(
bool highlightOnMouseover);
62 void setSelection(
const std::shared_ptr<smtk::view::Selection>& seln);
65 QSize sizeHint(
const QStyleOptionViewItem& option,
const QModelIndex& index)
const override;
67 void paint(QPainter* painter,
const QStyleOptionViewItem& option,
const QModelIndex& index)
70 QWidget* createEditor(
72 const QStyleOptionViewItem& option,
73 const QModelIndex& index)
const override;
74 void updateEditorGeometry(
76 const QStyleOptionViewItem& option,
77 const QModelIndex& index)
const override;
79 void setEditorData(QWidget* editor,
const QModelIndex& index)
const override;
80 void setModelData(QWidget* editor, QAbstractItemModel* model,
const QModelIndex& index)
95 static bool processBadgeClick(QMouseEvent* mouseClickEvent, QAbstractItemView* view);
100 const QStyleOptionViewItem& option,
101 const smtk::view::BadgeSet::BadgeList& badges,
105 bool eventFilter(QObject* editor, QEvent* event)
override;
107 int m_titleFontSize{ 14 };
108 int m_subtitleFontSize{ 10 };
109 int m_titleFontWeight{ 2 };
110 int m_subtitleFontWeight{ 1 };
111 int m_textVerticalPad{ 2 };
112 bool m_drawSubtitle{
true };
113 bool m_visibilityMode{
false };
114 bool m_highlightOnHover{
false };
115 std::weak_ptr<smtk::view::Selection> m_selection;
121 #endif // smtk_extension_qtDescriptivePhraseDelegate_h