开发者

How to Remove a widget from a QToolBar?

开发者 https://www.devze.com 2023-03-01 07:54 出处:网络
I\'m building my App interface with Qt at the moment. But one question arises... I have a QToolbar to which I added a QToolButton with the QToolbar->addWidget method.

I'm building my App interface with Qt at the moment. But one question arises... I have a QToolbar to which I added a QToolButton with the QToolbar->addWidget method. The problem is that I want to remove this button later on.

How can I achieve that ?

There is an addWidget method but nothing like a removeWidget correspondence...

Any idea开发者_如何学Python ?

Thanks a lot in advance for your help.

Miky Mike


You have to use removeAction. Like this:

QAction* MyAction = MyToolBar -> addWidget (MyWidget) ;
...
MyToolBar -> removeAction (MyAction) ;
0

精彩评论

暂无评论...
验证码 换一张
取 消