Hiding a QWidget on a QToolbar?
I have directly added some QWidgets to a QToolbar but simply going widget->setVisible(false) did not work. Can someone please give me an example of how to show and hide a widge开发者_高级运维t that is on a QToolbar?
Thanks!
You need to call setVisible()
on the appropriate QAction instead. For example, addWidget()
returns a QAction*:
QAction* widgetAction = toolBar->addWidget(someWidget);
widgetAction->setVisible(false);
精彩评论