How to auto change QPushButton width and QMenuBar

2019-08-07 08:04发布

I set corner widget into QMenuBar that has two QPushButtons. But when I set long text by button's setText, button doesn't change it's weight, so, icon and part of text hiding. So, how to change button's width and width of corner widget when set text?

2条回答
Bombasti
2楼-- · 2019-08-07 08:47

I resolved it by setting the same corner widget into QMenuBar again after changing button text.

查看更多
女痞
3楼-- · 2019-08-07 08:50

Call menuBar()->adjustSize();after setting the text on the button.

查看更多
登录 后发表回答