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.
我将角小部件设置为具有两个 QPushButtons 的 QMenuBar。但是当我通过按钮的 setText 设置长文本时,按钮不会改变它的权重,因此,图标和部分文本隐藏。那么,如何在设置文本时更改按钮的宽度和角小部件的宽度?
menuBar()->adjustSize();设置按钮上的文字后调用。
menuBar()->adjustSize();
我通过在更改按钮文本后再次将相同的角小部件设置到 QMenuBar 来解决它。