QToolButton not displayed correctly on KDE

Aaron Dewes aaron.dewes at web.de
Mon Feb 15 18:36:32 GMT 2021


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?


Aaron

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20210215/6ba0509d/attachment.htm>


More information about the kde-devel mailing list