3

How can I set a specific theme for a specific QT application? Globally I used a dark theme but for some applications I want to use the default theme of Ubuntu 16.04 (Ambiance). This is for a specific QT application.

I tried these commands inside my spreadsheet.desktop

Exec=env GTK2_RC_FILES=/usr/share/themes/Ambiance/gtk-2.0/gtkrc /usr/bin/et

or

Exec=env GTK2_RC_FILES=$HOME/.themes/Ambiance/gtk-2.0/gtkrc /usr/bin/et

or

Exec=env GTK_THEME=Ambiance:Default /usr/bin/et

But none worked.

Zanna
  • 69,223
  • 56
  • 216
  • 327
Project RK
  • 71
  • 1
  • 3
  • 1
    __To the reviewers__, The linked question is about a GTK application where this asks for a QT app. Two are different – Anwar Apr 13 '17 at 11:07

1 Answers1

4

Yes, you can do so using QT_STYLE_OVERRIDE environment variable.

The syntax is like this

QT_STYLE_OVERRIDE=Breeze konsole

Here you're using Breeze theme for konsole application. GTK theme names should also work. I've tested this under KDE with adwaita (gtk theme) and Breeze (KDE theme) names. My original environment theme was set to Oxygen.

Note that, though it will override the styles of the controls, the Window decoration (which draws the titlebar and close,minimize buttons) won't change.

Anwar
  • 75,875
  • 31
  • 191
  • 309
  • This did not work for me on KDE Plasma (5.10.2) – jat255 Jun 28 '17 at 14:00
  • @jat255 Because the answer wasn't for Plasma 5.10.2. No needed to downvote an answer that wasn't asking solution for your specific plasma version! And you know what? This actually works in 5.10.1 – Anwar Jun 28 '17 at 16:20