[Qt-interest] Set Background From Image File

Szalata, Zenon M. zms at slac.stanford.edu
Thu Aug 25 02:31:34 CEST 2011


I have followed an example in:

http://www.developer.nokia.com/Community/Wiki/Load,_Resize_image_and_set_background_image_in_Qt_application/widget
and I got my test program to work with either main window or a scroll area in the main window.  I could not get it to work with either QFrame or QWidget.  I have created a main window and the a child widget (either QScrollArea, QFrame, or QWidget) in QT designer.  Then I have coded my mainwindow.cpp as in the example.
I thought that this procedure should have worked with the frame widget, but it did not.  Why?

Next I wanted to do this in the style sheet file.   So I created myStyle.qss  where I have a number of rules including this one:
QScrollArea{
    background-image: url(:/nlctaSketch.png);
}

All other rules work but the one for the scroll area does not.  Am I doing it wrong?
I have commented out the code in my mainwindow.cpp file for setting the background.

Thanks for any hints,
Zen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110824/aa852d21/attachment.html 


More information about the Qt-interest-old mailing list