4

After quite a lot of searching, I see nowhere how to change the colors of my Qt applications.

I already created a custom dark gtk theme in ~/.themes/ by modifying the default Ambiance, but now I need to also change Qt apps. And funnily, they already display in dark (sometimes too dark) so I may have changed it a long time ago (no idea how).

For example I use Scribus and Mendeleydesktop that use Qt (Qt5 and Qt4 respectively).

I tried:

  1. to create a css style sheet with background: blue; color: green; as a test, but executing:

    mendeleydesktop -stylesheet myqtstyle.css
    

    does not affect anything (just complains: Could not parse application stylesheet)

  2. qt4-config, no effect.

  3. I searched in gconf-editor and dconf-editor if there are settings for Qt, no luck.

  4. I modified the gtk-3.20, gtk-3.0 and gtk-2 files of my theme, no effect.

Does someone have a simple solution for customizing my Qt apps?

2

It is possible to set a style sheet when launching a Qt application (as you have detailed in the question):

{application_name} -stylesheet {path_to_style_sheet}

This should work, however it is possible that the developer of the application is forcing a particular style within the application code so it will not always work.

The reason you are receiving the error message Could not parse application stylesheet is because the test style sheet you have produced is not a valid Qt style sheet.

The Qt documentation provides information on creating your own style sheets and links to these are below:

Given that you have received an error message relating to parsing, I would assume that it will work if you provide the path to a valid style sheet as a command line argument.

You may find it difficult creating a style sheet if you are not familiar with the standard Qt widget class names. Further information on these can be found here.

  • 1
    Thanks a lot I will try that! Is there a way to create a single global stylesheet for all my Qt applications? Isn't there already a default one somewhere in the system? – PlasmaBinturong Apr 27 '17 at 8:52
  • 1
    I don't think there is a way to force a style sheet to be used globally. You can obviously use the command line option above for each application using the same path. I believe you can force a style (a software library) globally but I have no experience of using it. I believe for Qt4 this is the package qt4-qtconfig and for Qt5 it is qt5ct so it may be worth a search using those names. – gsxruk Apr 27 '17 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.