Wow, lots of very useful information here. Thanks!
Maybe this could be integrated into the wiki, or linked to it?
Feel free to copy paste it there - I wasn't sure if it would be appropriate or not, since in the end it's all a bit obscure and hacky and doesn't particularly feel like an intended use case, which is why amidst my notes I am lamenting the lack of a more formal optional interface when using the qt widget set. (It would also be nice to have a built-in cross platform mechanism for loading fonts from memory). - Since the Qt calling interface might change as soon as the Qt version changes, and because it's code only specific to people using the Qt widget set, it's not particularly 'general' information applicable to all lazarus use.
So far I'm using only external qss files, but since they can be embedded into the code, do you know if you can change the stylesheet on the fly? I have an idea for some effects, but for that I think I would have to switch between stylesheets.
Yep, you can use the same code i used to load the stylesheet to change it on the fly.
The workflow is:
* Cast the LCL control to it's Qt equivalent (beware, not all /have/ a Qt equivalent)
* Once you have your control as TQtWidget (or the appropriate child class thereof, in my example I cast to a TQtMainWindow, but TQtWidget will work too) you can now call the .StyleSheet property and change it on the fly.
In my example I'm setting it on the main window, because you can automatically style all children from there in a single stylesheet, but you don't /have/ to do it that way either. Each control can also have it's own distinctly separate stylesheet.
Ah, and would you by any chance have a solution for my problem on my topic below? I'm looking for an alternative to a stylized speedbutton (some kind of a stylized toggle button with support for icons)
Right, the speedbutton control draws itself, rather than being rendered by Qt, so styling won't work here.
But you can get creative, I guess. Maybe you could just style a checkbox to make it look like a button with a background image

Alternatively, use a regular button, give it a background image, and set it to 'checkable' using QAbstractButton_setCheckable
https://doc.qt.io/qt-6/qabstractbutton.html#checkable-prop (I'm not sure if the pascal bindings exist by default, haven't checked, but if not, you can create them yourself like i did in the font loading example for QByteArray_Create/QByteArray_Destroy)