<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 10, 2017, at 11:41 PM, Florian Bruhin <<a href="mailto:me@the-compiler.org" class="">me@the-compiler.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi,<br class=""><br class="">On Mon, Apr 10, 2017 at 11:30:23PM -0700, Patrick Stinson wrote:<br class=""><blockquote type="cite" class="">I looked in the docs but no dice. Are custom pyqt classes supported<br class="">via Qt stylesheets? Hard to think how this would be possible?<br class=""></blockquote><br class="">I'm not sure if matching by class works, but I usually do this in<br class="">__init__:  self.setObjectName(self.__class__.__name__)<br class=""><br class="">And then match on the object name, like here:<br class=""><a href="https://github.com/qutebrowser/qutebrowser/blob/master/qutebrowser/mainwindow/statusbar/bar.py#L92" class="">https://github.com/qutebrowser/qutebrowser/blob/master/qutebrowser/mainwindow/statusbar/bar.py#L92</a><br class=""></div></div></blockquote><div><br class=""></div><div>Ah, a very good idea. I got custom classes to work, but had to create an intermediate subclass of QWidget to do it:</div><div><br class=""></div><div>class Stylesheeter(QWidget):<br class="">    def paintEvent(self, event):<br class="">        opt = QStyleOption()<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>opt.initFrom(self)<br class="">        painter = QPainter(self)<br class="">        self.style().drawPrimitive(QStyle.PE_Widget, opt, painter, self)</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">Or do you mean styling a class with completely custom painting via<br class="">stylesheets? That's not possible as far as I know, but it's not in Qt<br class="">either.<br class=""></div></div></blockquote><div><br class=""></div><div>no, just normal styling.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">What about dynamic properties? This one seems more straightforward to<br class="">implement.<br class=""></blockquote><br class="">See the same stylesheet - works with @pyqtProperty decorated properties,<br class="">but you'll need to re-set the stylesheet after changing it.<br class=""><br class="">Also see: <a href="http://pyqt.sourceforge.net/Docs/PyQt5/qt_properties.html" class="">http://pyqt.sourceforge.net/Docs/PyQt5/qt_properties.html</a><br class=""></div></div></blockquote><div><br class=""></div><div>Excellent, thank you.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">Florian<br class=""><br class="">-- <br class=""><a href="http://www.the-compiler.org" class="">http://www.the-compiler.org</a> | <a href="mailto:me@the-compiler.org" class="">me@the-compiler.org</a> (Mail/XMPP)<br class="">   GPG: 916E B0C8 FD55 A072 | <a href="http://the-compiler.org/pubkey.asc" class="">http://the-compiler.org/pubkey.asc</a><br class="">         I love long mails! | <a href="http://email.is-not-s.ms/" class="">http://email.is-not-s.ms/</a><br class="">_______________________________________________<br class="">PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" class="">PyQt@riverbankcomputing.com</a><br class=""><a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" class="">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></div></div></blockquote></div><br class=""></body></html>