[Qt-interest] Set Background From Image File

Atlant Schmidt aschmidt at dekaresearch.com
Thu Aug 25 14:11:01 CEST 2011


Zen:

  While you're at it, if performance matters to you, it's fairly important
  that the images you use for backgrounds match the "native size" of
  the image area within the controls. Otherwise, Qt may spend a lot
  of effort scaling the image to match the sizes.

  You may also want to read how "9 slicing" works for expanding/
  shrinking images while preserving the shapes of their corners/
  edges.

                                              Atlant

From: qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com [mailto:qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com] On Behalf Of Szalata, Zenon M.
Sent: Wednesday, August 24, 2011 20:32
To: qt-interest at trolltech.com
Subject: [Qt-interest] Set Background From Image File

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



Click here<https://www.mailcontrol.com/sr/TbqIV5bQLZXTndxI!oX7UsdpzMR7Bo2Kdpg6MkeR8S6pGHVbsYIDsmFaUy5aRvCeyWw5eQkxLTXgMdFy9yJ30A==> to report this email as spam.

________________________________
This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110825/d423d96c/attachment.html 


More information about the Qt-interest-old mailing list