PDA

View Full Version : QTableView background image



aguayro
24th October 2012, 01:47
I'm trying to set a background image to a QTableView using stylesheet but doesn't seem to work.
background-color is working ok, but background-image does nothing. I've tryed:



romsList->setStyleSheet( "background-image: url( :/img/desert.jpg )" );
romsList->setStyleSheet( QTableView { " background-image: url( :/img/desert.jpg )"; } );
romsList->setStyleSheet( " background-image: url( QStringWithImagePath )" );

...
Is there any restriction or am i doing something wrong?

Ashkan_s
24th October 2012, 12:33
Have you tried using absolute path of the image?

sindy
24th October 2012, 20:00
You have prefixed your image file path with a ':' which means that your application will use the associated resource file to find the image. Have you specified the your image as a resource in the .qrc file? Look here for details :
http://doc.qt.digia.com/qt/resources.html

Absolute paths will work but will hard code your image file path.