Show text on QToolButton instead of icon?
I have a
QActionwith checkable, icon and text all set. And then I assigned it to the menu and a
QToolButton. It looks fine on the menu with icon and text showing side by side. However for the QToolButton, I want to set a shorter text and show it instead of the icon and text from the QAction.
pMenu->addAction(m_pActionShowMyDialog); m_ui->myDialogButton->setDefaultAction(m_pActionShowMyDialog); m_ui->myDialogButton->setText("MD");
I tried to setText on the button after setting the QAction but it still shows the icon.
You can use QToolButton::setToolButtonStyle.
Hi, how do I set it to a different text than the one from the action? The text from the action is too long for the button and I want to set it to a shorter one.
You can use the QAction::iconText property.
Thank you it works.