You have a typo in your stylesheet: item:hover needs to be: QListView::item:hover
Or if you are setting the stylesheet on the actual widget and want a relative reference (in which case you are), you can write: ::item:hover "::item" is one of the sub-control references: http://qt-project.org/doc/qt-4.8/stylesheet-reference.html#item-sub On Sat, Sep 6, 2014 at 3:52 PM, Bay <[email protected]> wrote: > Hi Justin, > here's the code I've used. I attempted to try your > suggestion but haven't got any luck getting it to work. Really appreciate > your help. Thanks again for the time spent ! > > class PoseListView(QtGui.QListWidget): > def __init__(self, parent=None): > super(PoseListView, self).__init__(parent) > > self._parent = parent > > # Grid/View settings > self.setViewMode(QtGui.QListView.IconMode) > self.setGridSize(QtCore.QSize(40, 80)) > self.setSpacing(10) > self.setMinimumWidth(self.sizeHintForColumn(0)) > self.setMouseTracking(True) > > self.setStyleSheet("item:hover{background: qlineargradient(x1: 0, > y1: 0, x2: 0, y2: 1,\ > stop: 0 #FAFBFE, stop: 1 #DCDEF1);}" > ) > > for i in range(3): > item = PoseWidget(self) > self.addItem(item) > item.setSizeHint(QtCore.QSize(40, 60)) > > > class PoseWidget(QtGui.QListWidgetItem): > def __init__(self, id, *args, **kwargs): > super(PoseWidget, self).__init__() > self.pose = kwargs.get('pose', None) > > # Item settings > self._id = id > self.setText('') > flags = QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled | > QtCore.Qt.ItemIsDragEnabled > self.setFlags(flags) > > project_root = cmds.workspace(q=True, rootDirectory=True) > > map_dir = os.path.join(project_root, 'data', 'pose_library') > > image_path = '{0}{1}'.format(map_dir,'/test.jpg') > > pic = QtGui.QPixmap(image_path) > > self.setBackground(QtGui.QBrush(image_path)) > > >> -- > 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/d2c1ad93-893a-4408-8068-9eae3d2a1566%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/d2c1ad93-893a-4408-8068-9eae3d2a1566%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/CAPGFgA2ThL%3D0%3D3MMjBvyskP5zhSXWfD-i505QTwZhNdb76ey6w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
