File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ class SCOPY_GUI_EXPORT MenuControlButton : public QAbstractButton, public MenuCo
66
66
67
67
void setDoubleClickToOpenMenu (bool b);
68
68
void setOpenMenuChecksThis (bool b);
69
+ void enableToolTip (bool en);
69
70
70
71
QCheckBox *checkBox ();
71
72
QPushButton *button ();
@@ -83,6 +84,7 @@ public Q_SLOTS:
83
84
void applyStylesheet ();
84
85
85
86
int width;
87
+ bool m_toolTip;
86
88
QColor m_color;
87
89
QHBoxLayout *lay;
88
90
QCheckBox *m_chk;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ using namespace scopy;
29
29
30
30
MenuControlButton::MenuControlButton (QWidget *parent)
31
31
: QAbstractButton(parent)
32
+ , m_toolTip(false )
32
33
{
33
34
lay = new QHBoxLayout (this );
34
35
lay->setMargin (16 );
@@ -76,7 +77,13 @@ void MenuControlButton::setCheckBoxStyle(CheckboxStyle cs)
76
77
applyStylesheet ();
77
78
}
78
79
79
- void MenuControlButton::setName (QString s) { m_label->setText (s); }
80
+ void MenuControlButton::setName (QString s)
81
+ {
82
+ m_label->setText (s);
83
+ if (m_toolTip) {
84
+ m_label->setToolTip (s);
85
+ }
86
+ }
80
87
81
88
void MenuControlButton::setDoubleClickToOpenMenu (bool b)
82
89
{
@@ -104,6 +111,12 @@ void MenuControlButton::setOpenMenuChecksThis(bool b)
104
111
}
105
112
}
106
113
114
+ void MenuControlButton::enableToolTip (bool en)
115
+ {
116
+ m_toolTip = en;
117
+ m_label->setToolTip (en ? m_label->text () : " " );
118
+ }
119
+
107
120
void MenuControlButton::mouseDoubleClickEvent (QMouseEvent *e)
108
121
{
109
122
if (e->button () == Qt::LeftButton) {
@@ -165,6 +178,7 @@ CollapsableMenuControlButton::CollapsableMenuControlButton(QWidget *parent)
165
178
m_lay->setSpacing (0 );
166
179
setLayout (m_lay);
167
180
m_ctrl = new MenuControlButton (this );
181
+ m_ctrl->enableToolTip (true );
168
182
m_ctrl->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed);
169
183
m_ctrl->setCheckBoxStyle (MenuControlButton::CS_COLLAPSE);
170
184
m_ctrl->setCheckable (false );
You can’t perform that action at this time.
0 commit comments