That would be because there is only one background. First you set it to
your image, and then you have it use a different background during a hover
state. It doesn't have a separate layer just for overlays on the
background. To achieve something like that, you might have to use a
Q{Styled}ItemDelegate and produce this result in a custom paint event.http://qt-project.org/doc/qt-4.8/qitemdelegate.html#paint Instead of the stylesheet (remove that), you would probably conditionally check the state <http://qt-project.org/doc/qt-4.8/qstyleoption.html#state-var> of the style option <http://qt-project.org/doc/qt-4.8/qstyleoptionviewitem.html> that is passed in to you. Here is an example of it: class PoseListView(QtGui.QListWidget): def __init__(self, parent=None): super(PoseListView, self).__init__(parent) ... self.setItemDelegate(Highlighter(self)) class Highlighter(QtGui.QItemDelegate): def paint(self, painter, opts, index): super(Highlighter, self).paint(painter, opts, index) if opts.state & QtGui.QStyle.State_MouseOver: grad = QtGui.QLinearGradient(opts.rect.topLeft(), opts.rect.topRight()) grad.setColorAt(0, QtGui.QColor(0,0,255,60)) grad.setColorAt(1, QtGui.QColor(0,0,255,20)) painter.fillRect(opts.rect, QtGui.QBrush(grad)) The delegate will end up painting a semi-transparent color over the top of everything else. You can get more detailed with this if you want, like repainting the text over the top again, or painting just borders, or whatever you want. On Sun, Sep 7, 2014 at 2:41 AM, Bay <[email protected]> wrote: > Ahhh so that was my mistake. I was wondering if I made any typos from the > C++ docs. Thank you once again for your time! > > Another quick question though, right now if I want my stylesheet to be > more of a overlay(semi transparent) or an outline, how would I go about > achieving that? I tried using > > self.setAttribute(QtCore.Qt.WA_TranslucentBackground) > self.setStyleSheet("::item:hover{ground: transparent;}" > > All it does is overwrite the entire image and make it transparent > > it's the same with: > self.setAttribute(QtCore.Qt.WA_TranslucentBackground) > self.setStyleSheet("::item:hover{padding: 2px 25px 2px 20px;\ > border: 1px solid transparent; /* reserve space for selection border > *;}" > ) > > > Thanks again! > > Gann Boon Bay > >> >>> >> -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/940059fd-756b-471f-aa3c-3a0e6a8220fa%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/940059fd-756b-471f-aa3c-3a0e6a8220fa%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3vA0XUcQKkQpxb52VkydzHpJV--rXJEkTd1HnxJh-xvg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
