Robotex
Robotex

Reputation: 1026

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

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?

Upvotes: 1

Views: 657

Answers (2)

Alexander Tyapkov
Alexander Tyapkov

Reputation: 5067

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

Upvotes: 2

Robotex
Robotex

Reputation: 1026

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

Upvotes: 0

Related Questions