Use GTK Theme On Linux?
-
I tried that, but unfortunately the application still isn't using the OS GTK theme.
@Rondog said in Use GTK Theme On Linux?:
You shouldn't need to set this if you want to match what the OS is currently using.
That's what I was hoping to achieve, but my Qt applications are ignoring the OS GTK theme. Here's a screenshot to show what my GTK theme looks like:
And here's how Qt applications I build look:
As you can see the OS GTK theme isn't being applied. The GTK theme also doesn't get applied to Qt Creator, though it does get applied to Qt applications that I download from the Mint repository.
I hoped building Qt on Mint would solve the problem, but even when using that Qt build applications still don't get the GTK theme applied.
I made the very simple Test program shown in the above screenshot to make sure it wasn't an issue with my code, but that also has the same problem.
I'm not sure why this is happening or what to do to fix it.
-
Hi,
Likely, because the plugin is built for your distribution provided Qt. If you use that one to build your application then you should have it applied as you want it.
-
Thanks for the advice, but I'm not quite following. From what you say I need a plugin to make the application use the OS GTK theme?
Could you tell me what the plugin is called or where to download it? Or is it something that comes with the Linux distribution
Sorry if I'm being stupid. I'm new to Qt and not very knowledgeable about Linux so I'm a bit confused :)
-
AFAIK, it's name of the plugin itself is qgtk3 but it's likely already installed.
One thing you can do is start your application with QT_DEBUG_PLUGINS set to 1 so you'll see what is happening with the plugins at load time.
-
This is the output of running the Test program pictured earlier with QT_DEBUG_PLUGINS:
Is there a way to force the GTK plugin to load? If not, what would be the best way to resolve the issue?
-
Can you check whether you have the plugin in your Qt installation ?
If not, then you can build it (just the plugin not the whole of Qt) to add it to your Qt version. You can get the sources from the maintenance tool.
-
I checked and libqgtk3 is missing from the .../plugins/platforms directory with the 5.7.0 offline installer.
Searching on Google I found a bug report that also says it's missing, though it has been closed as "out of scope":
https://bugreports.qt.io/browse/QTBUG-52259
I downloaded 5.7.1 offline installer, but it's missing there as well.
I tried running the maintenance tool, but there are no default repositories added with the Qt offline installer (which is another issue reported elsewhere).
I therefore downloaded the online installer, which installed 5.7.1, but once again libqgtk3 was missing, so applications still didn't use the GTK theme.
I tried running the maintance tool that was installed with the online installer and did a full update of Qt, but still libqgtk3 was not installed.
Looking at some posts online, other people report that libqgtk2 was present in 5.6 but there's nothing with 5.7:
https://github.com/probonopd/AppImages/issues/102
libqgtk2/3 also doesn't get built when you build the Qt 5.7.0 from the source code.
It's strange that they've removed such an important feature in 5.7.
I can't find libqgtk2/3 available for download separately anywhere. I'll try downloading Qt 5.6 and see if it's included with that.
-
I just tried Qt 5.6.2 and that works correctly:
I don't understand why they removed libqgtk plugin from 5.7, since it is a rather essential component.
I'm not sure what to do now, but the best option appears to be to use 5.6.2.
As a side note, the Qt Creator that comes with 5.6.2 also looks a lot nice because it uses my GTK theme, while the 5.7 Qt Creator doesn't and looks terrible.
-
If you read the complete bug report, it will be back with 5.8.
In between, like I already suggested, you can build the plugin yourself. You need to install the corresponding dependencies on your system.
-
I'll stick with Qt 5.6.2 until 5.8 is released.
Thanks a lot for all you help SGaist. I didn't have a clue what was going wrong and wouldn't have found the source of the problem with your assistance.
Thanks again.