QToolButton not displayed correctly on KDE

Aaron Dewes aaron.dewes at web.de
Wed Feb 17 07:16:51 GMT 2021


git clone https://gitlab.com/EndorphinBrowser/browser.git -b webengine

mkdir build && cd build

cmake ..

make -j$(nproc)


You should now see a web browser opening, where in the right corner of
the TabBar, an invisible new tab button exists. For some reason, the
close tab button, which is placed on the tab, works though.

Thank you for your help!


Am 16.02.21 um 23:38 schrieb Albert Astals Cid:

> 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?
> Cheers,
>    Albert
>> Aaron

More information about the kde-devel mailing list