Projects

On Supermarket Cuts and Dynamic CSS in Qt Apps

Coding | Projects | Qt 0 No Comments

I always prefer to buy whole or large cuts of fish over the pre-made steaks and filets at the grocers.  Living on the Gulf Coast makes this easy, I can always head down to the piers at Galveston, and find something nice at the fish markets.  (Or, just take the kayak out and come home with very fresh redfish, flounder, or trout from the marshes.) The reason is simple: I pay bulk prices and then can choose how I want to prepare the meat.  The grocer only occasionally has the cuts I want – imagine the look on the barely trained fishmongers face when you ask her what she did with all of the saltwater quail?  I mean, I know those redfish filets came from somewhere…

In the same vein, it’s important to give your power users choice.  Like the grocer who doesn’t impress me when they charge $25/lb for a yellowfin steak that’s half sinew, your design decisions may be perfect for most users, but give someone who uses your app every day the shivers. Once you make a decision to use cascading style sheets in your Qt application, why not let your users have some control over them?  Sure, most won’t touch the CSS themes, but some may – and a contributing user is the best kind you can have. Imagine that you could have a color-blind theme with no additional effort, or someone could contribute day/night themes.

We take a bit of load-time hit to use dynamic CSS themes stored on-disk, but to be fair – on most modern systems it’s not going to be noticeable to the user. When I built Graffik, I chose to make themes organized into a folder inside of the application folder, and make them user-editable. The user can also change the theme while the app is running, and choose which theme looks best for them.  I’ve broken out the QtDynamicThemer class which enables this separately, to make it easier to find and use, but it’s pretty straight-forward:

Read More