Please nominate your Qt Champions for 2021!

How do I know what -style arguments are recognised?

  • Hi,

    Qt application in general will allow you to specify the global GUI style by passing its name via "-style". This works rather well if you know what exactly the style name is, but what if you don't? I mean, say I want to check how the program looks with the built-in Gtk style, but can't quite remember its "official" name. (Is it just "Gtk"? Or perhaps "GTK"? Or "Gtk+" maybe?) How do I find out? Trial and error is of course an option, but this is made a lot harder by the fact that no error message is displayed if the given style does not actually exist; Qt will just silently ignore the parameter and go ahead with a default. And it can be hard to tell whether that's just what happended, or an alternative style was actually loaded...

    Does anyone know more about this?

  • QStyleFactory::keys() give you a string list with all possible values

  • Ah, I didn't notice that when I looked through the docs. Thanks.

    It seems to me that there also ought to be some kind of tool or option to a tool that would call this routine and display the result, though. Do you know if something like that exist? It wouldn't be hard to write, obviously, but you'd think that someone had already done it.

  • I don't get about what tool (or option) are you referring :-)

  • I'm referring to some way of printing the keys from the command line. I think it's strange if this isn't provided by some utility that's included with Qt, but maybe that's just me.

Log in to reply