Tuesday, April 27, 2010

QT Widget StyleSheet image and QT Designer

QT (4.6) comes with a nice GUI designer. So now I created a nice GUI front-end for one of my applications. One of the widgets I added was a simple QWidget with the style set to have a background image loaded from a file. I added this with the GUI tools and the preview looked great, but when I compiled the application, the friggin' thing just did not show up.

After a lot of searching the Intertubes and cussing (as community troubleshooting and bug tracking for QT are abysmal) I took a closer look at what the designer fabricated there:

background-image: url(:/logo.png);

With some figuring the truth in the failure of the designer came to me: it forgot the quotes, making this an invalid css, for which it does not seem to care in the GUI preview, but breaks in the actual application (quietly I might add, not even an error message, the image just isn't there).

The correct CSS is:

background-image: url(":/logo.png");

This raises the question: does anyone test at least the basic functionality of these tools? Crap..

No comments:

Post a Comment