[PyQt] Setting image as background in QListView

absk82 absk82 at gmail.com
Mon Nov 22 17:21:21 GMT 2010


Does anyone have any ideas about this?


absk82 wrote:
> 
> 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.
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 

-- 
View this message in context: http://old.nabble.com/Setting-image-as-background-in-QListView-tp30261881p30280717.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list