Reputation: 1171
I would like to add checkbox or button into the toolbox's title and if it's checked then some action should be done (SINGAL - SLOT?). Is this possible or there is some other widget which provides that ability?
Upvotes: 2
Views: 2466
Reputation: 40512
No, QToolBox doesn't support adding widgets to titles. A title can only contain a text.
However QToolBox is easy to implement. Just add QVBoxLayout, put titlebars and widgets in it. Then use titlebar's onclick events to call setVisible()
on widgets to hide or show it. You may need to create separate form for titlebar, put your buttons inside it and reimplement QWidget::mousePressEvent
to catch clicks. Then promote the main form's titlebar widgets to this class.
Upvotes: 4
Reputation: 370
create a QAction, make it checkable setCheckable(true)
and connect to the toggled signal. it's not a checkbox but a button with the same behaviour. than add this action to the toolbox.
Upvotes: -1