<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 03/11/2015 12:17 AM, Damon Lynch
wrote:<br>
</div>
<blockquote cite="mid:54FF4337.10008@gmail.com" type="cite">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
Hello all,<br>
<br>
What am I doing wrong below? If I comment out the setStyleSheet
call , and enable the palette changes, the background remains the
default white. The problem with using the setStyleSheet call is
that it affects the scrollbars inside the QListView too, which is
not what I want.<br>
<br>
class ThumbnailView(QListView):<br>
def __init__(self):<br>
super(ThumbnailView, self).__init__(uniformItemSizes=True,
spacing=16)<br>
self.setViewMode(QListView.IconMode)<br>
# this next line works<br>
self.setStyleSheet("background-color:#444444")<br>
# these next three lines do not work when the lines are
uncommented:<br>
# palette = self.palette()<br>
# palette.setColor(self.backgroundRole(),
QColor(68,68,68))<br>
# self.setPalette(palette)<br>
<br>
</blockquote>
As a follow-up to my previous email, this is a screenshot
illustrating the problem:<br>
<a class="moz-txt-link-freetext" href="http://damonlynch.net/rapid/screenshots/beta/20150311rpd-devel-bg-color-failure.png">http://damonlynch.net/rapid/screenshots/beta/20150311rpd-devel-bg-color-failure.png</a><br>
<br>
After the stylesheet change, the scrollbar looks much worse than the
default. I'm new to Qt so I don't know if it is a bug in my code
that the palette.setColor call fails, or the problem is elsewhere.
In my previous message I neglected to mention I'm developing using
python 3.4.3, PyQT 5.4 & Qt 5.4 (on Ubuntu 15.04). <br>
<br>
Incidentally if anyone is interested I'm using 0mq for high
performance inter-process messaging, and udev, udisks2, and
optionally GIO for mounting and unmounting hot-plugged devices like
cameras and partitions. Maybe others could use the code too. It's
GPL3. I'm currently porting the application from PyGTK.
<a class="moz-txt-link-freetext" href="https://code.launchpad.net/~dlynch3/rapid/zeromq_pyqt">https://code.launchpad.net/~dlynch3/rapid/zeromq_pyqt</a><br>
<br>
Best,<br>
Damon<br>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.damonlynch.net">http://www.damonlynch.net</a>
</pre>
</body>
</html>