Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
qtoolbutton icon is cropped
i create a QMenu, and a QToolButton, and set the menu to the tool button. i also set an icon to the tool button, but since it has a menu, the icon is located on both the action part of the button and also on the part from where you click and the menu is displayed. is this a QToolButton problem? cause the icon is an ordinary .png file and it's okay.
how can i solve this?
@user4592357 Can you show a screenshot of what you're talking about?
@ambershark here's what i'm talking about:
as you can see, the part of the picture falls under that menu-button
@user4592357 Hmm that is weird. Can you share some code to reproduce that issue? I'll play with it and see if I can see what is causing it for you.
it's basically this:
auto toolBar = new QToolBar(); auto menu = new QMenu(toolBar); // add actions to menu auto toolButton = new QToolButton(toolBar); toolButton->setIcon(QIcon(":/icon")); toolButton->setPopupMode(QToolButton::MenuButtonPopup); toolButton->setMenu(textCasesMenu); toolBar->addWidget(toolButton);
Worked fine for me using that code you posted.