How to auto change QPushButton width and QMenuBar corner widget width when change text of button?

天涯浪子 提交于 2019-12-24 07:09:57

问题


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?


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/15422439/how-to-auto-change-qpushbutton-width-and-qmenubar-corner-widget-width-when-chang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!