QToolButton not displayed correctly on KDE

Albert Astals Cid aacid at kde.org
Tue Feb 16 22:38:08 GMT 2021

El dilluns, 15 de febrer de 2021, a les 19:36:32 CET, Aaron Dewes va escriure:
> Hello!
> I'm having some issues with a QT application I'm developing right now,
> but only on KDE, the same code works perfectly on GNOME.
> I'm using the following code snippet:
> // In my header file
> QAction *m_newTabAction;
> QToolButton *addTabButton;
> // The actual code
>   m_newTabAction = newQAction(this);
> m_newTabAction->setShortcuts(QKeySequence::AddTab);
> connect(m_newTabAction, SIGNAL(triggered()), this, SLOT(newTab()));
> m_newTabAction->setIcon(QIcon(QLatin1String(":graphics/addtab.png")));
> m_newTabAction->setIconVisibleInMenu(false);
> addTabButton =new QToolButton(this);
> addTabButton->setDefaultAction(m_newTabAction);
> addTabButton->setAutoRaise(true);
> addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
> Compiling and running this code (The button is positioned later) result
> in the button being displayed and working, except the image not being
> displayed. The image is displayed on GNOME though. This also has nothing
> to do with dark mode, as the image contains black and white parts, and I
> tested this using Breeze Light and Dark. I already tried setting the
> icon and/or icon size directly on the button, which also didn't help. My
> code is a fork of Arora, and the same issue shows up there too, and the
> new tab button isn't displayed.
> Am I using some outdated methods that KDE doesn't support or is there
> anything I can do to get this code working properly?

Can we get something compilable to try to reproduce the problem / figure out what's wrong?


> Aaron

More information about the kde-devel mailing list