Skins in Opticks

You may have noticed I pushed a new plug-in to COAN today called Skins. It's exactly what it sounds like, skinning for Opticks! You can change colors, spacing, icons, etc. using CSS!

Ok, so it's only partially useful right now as I'll explain, but it's a start. Newer versions of Qt support widget style configuration using cascading style sheets (CSS3) and it's pretty easy to enable this, just call QApplication::setStyleSheet() with your style sheet text. The Skins plug-in is a simple skin loader which looks in SupportFiles/Skins for .css files. It adds an entry to View->Skins for each file it finds plus an entry for the default style sheet. Select the skin you want, and Opticks changes instantly. If you want to including images and other external files, you can build a Qt .rcc file. All .rcc files in the SupportFiles/Skins directory are loaded as Qt resources when the plug-in starts up.

Here's an example. Below is what Opticks usually looks like.

I'll create an .rcc file with a couple of image files.

RedTest.qrc

I run rcc -binary RedTest.qrc -o RedTest.rcc and I've got a resource file. I've attached the two image files to this blog entry.

Now I'll create the .css file.

RedTest.css

I select the new skin from the menu.

This file sets the default frame background color to red and centers an image from the resource file. It also changes the throbber to a hopping kangaroo animation. Here's what it looks like.

Remember I said it's only partly useful right now? Well, the throbber can't be changed using the Opticks trunk. There needs to be a Q_PROPERTY() added to ProgressDlg in order to change it. There are lots of custom widgets in Opticks which need properties and object names so they can be addressed in the CSS, but hey, it's a start right?

mongoose-on-a-plane.jpg
aaroo_e0.gif

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.