BASIC stylesheets support in STU 0.2.12+ #86
trufanov-nok
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Since 0.2.12 a basic support of stylesheets and styles was added to STU. I would even say, experimental support. And that's why:
STU UI is made with Qt - a crossplatform toolkit. Its ability to display crossplatform UI is based on the fact that Qt doesn't call OS API to create UI but draw all controls itself. And Qt uses styles, palettes and stylesheets to mimic the UI of the target OS. But Qt application is also able to change current style and stylesheet at runtime. That means that technically you can force Qt application running on Windows to looks like it supposed to look on Linux or Mac. Qt styles are binary plugins and responsible for general appearance of all controls. Palettes are just a color scheme for controls usually copied from current OS settings. And stylesheets allow to fine-tune the controls appearance (may apply to a class or individual controls). They are basically a text file similar to css used on web.
I found out that some users like "dark" themes in software related to the graphics. Some people may say it's better for eyes, some says it makes UI less destructing from the image displayed. ST Advanced has a dark theme based on stylesheets which are embedded to its binary as a resource and can't be edited by user.
In ST Universal I decided to add such UI customization too. Since ver. 0.2.12 user may select a style and/or stylesheet from
Tools/Settings/General
panel. The setting automatically lists styles which app can access and stylesheets files found. Stylesheets are just a qss files stored in a filesystem (stylesheets/
subfolder in executable directory on Win and Mac,usr/share/scantailor-universal/stylesheets/
on Linux machine).(In fact any Qt application can be launched with custom style or stylesheet by passing a key
-style <known_style>
(whereknown_style
is a name of Qt style pluging visible to the app. Usually: Windows and Fusion are always available) and-stylesheet <path_to_qss_file>
(.qss is a common extension for Qt stylesheets).)The first two options of stylesheets selector are always Default and None. These are actually don't apply stylesheets but apply default or empty Palettes. Palettes and stylesheets can't be used together at the same moment.
There are 3 stylesheets (one is "dark") that I found on github with some minor adjustments. That means they are not fine-tuned to STU's GUI as well as in STA. I've just chosen a few themes that looks more or less fine with no or very little changes. And that's why qss files in STU is stored openly and not embedded as a resource. I have no time to tweak these stylesheets. Consider them as examples. Users are encouraged to adjust existing stylesheets as they feel better or make a new ones and contribute them back to the project.
Another idea I have is to hardcode Fusion style of UI as default for all systems (Win, Mac, *Nix). It would be a bit easier to develop the UI under Linux and know that the App will look almost like that on other systems without any surprises. So users are encouraged to try Fusion theme and provide a feedback about it. I mean, would you leave it as a default.
Beta Was this translation helpful? Give feedback.
All reactions