[PyQt] Setting image as background in QListView
Abhishek
absk82 at gmail.com
Fri Nov 19 22:01:21 GMT 2010
For some reason, my post didn't make it through for 2 days, so trying to
send it through the mailing list.
Hi,
I have been having some trouble setting the background image in a QListView
using style sheets. I tried using both jpg as well as png images as
background. This is the stylesheet entry generated by QtDesigner.
"QListView{\n"
" background-image: url(:/icons/images/wood_texture_png.png);\n"
"}")
After setting the image as background in QtDesigner, the image shows up
correctly in QtDesigner(as well as in the preview), but when I convert it to
python file (through pyuic4) and plug it into the other parts of the ode,
the background turns out to be white. If I set the background as
QLinearGradient (as below)
background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0
rgba(128, 128, 128, 255), stop:1 rgba(255, 255, 255, 255));
then the background shows up properly even in my program.
Does anyone know why this discrepancy could be there?
In Qt, I noticed that there are functions like SetPaletteBackgroundPixmap(),
which could be used, but no there. Does anyone know if there is any other
way to set the background image in QListView?
Thanks a lot!
Abhishek.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101119/cb11b3cf/attachment.html>
More information about the PyQt
mailing list