I carefully read the documentation and looked through familiar domains such as google and stackoverflow for quite some time. Unfortunately, all this without any solutions. Therefore, I hope that someone here can be my savior.
Situation:
What I use: PyQt4, Python 2.6, Windows 7
I am trying to create a QLabel (using a CSS file that I import into my program). QLabel is in the QListWidgetItem.
So I have a structure:
QListWidget +QListWidgetItem +QLabel
Thus, according to the documentation, access to QLabel will be as follows. There is no problem.
QListWidget::item QLabel { background-color:#000 }
Problem:
However, I would like the QLabel style to be ONLY changed when I hover over the QListWidgetItem. Using the following code, the pseudo-state is simply ignored for some reason. Thus, the background color applies to QLabels, but it does not respect the pseudo-state.
QListWidget::item:hover QLabel { background-color:#000 }
This situation persists when I run my application offline.
What is not a solution:
- Setting QLabel's pseudo-state to hang will not work, because QListWidgetItem is higher than QLabel.
The main question:
Is there a way to change the properties of the QLabel style when and only when the QListWidgetItem freezes and how can this be achieved?
The goal here is to do it ONLY through css (or qss if you want), which is a separate file that is imported into the program.
Sources:
qss documentation: http://doc.qt.digia.com/4.6/stylesheet-syntax.html
source share