Show text on QToolButton instead of icon?
Solved
General and Desktop
-
I have a
QAction
with checkable, icon and text all set. And then I assigned it to the menu and aQToolButton
. 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.
-
Hi,
You can use QToolButton::setToolButtonStyle.
-
You can use the QAction::iconText property.