Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我现在正在用 Qt 构建我的 App 界面。但是出现了一个问题......我有一个 QToolbar,我使用 QToolbar->addWidget 方法向其中添加了一个 QToolButton。问题是我想稍后删除这个按钮。
我怎样才能做到这一点?
有一个 addWidget 方法,但没有什么比 removeWidget 对应...
任何的想法 ?
非常感谢您的帮助。
迈克迈克
你必须使用removeAction. 像这样:
removeAction
QAction* MyAction = MyToolBar -> addWidget (MyWidget) ; ... MyToolBar -> removeAction (MyAction) ;