I have a QLabel with a StyledPanel Raised frame.
It can be clicked by subclassing QLabel;
class InteractiveLabel(QtGui.QLabel): def __init__(self, parent): QtGui.QLabel.__init__(self, parent) def mouseReleaseEvent(self, event): self.emit(QtCore.SIGNAL('clicked()'))
However, the general consensus is that this “box” is not easily recognized as interactive. Striving for usability, I would like the “box” to show that it is accessible when the mouse hovers over it.
Obviously, the mouseover response is easily achieved by connecting mouseHoverEvent.
However, the “button indicator” should be naturally inherited, since my Qt application allows the user to change the style (from Windows XP, Windows 7, plastique, motif, cde).
This image shows the specific widget (lower right corner) and the mouseHover aesthetics that I want in two different styles.

When the mouse hovers over the "Box", I would like it to respond in the same way as the combobox in the upper, middle part.
("Answer" is aesthetically native and occurs with all Qt buttons, except for "CDE" and "motives").
Is there any way to implement this with PyQt4?
(I suppose non-native solutions will include QGradient and native style checking, but that is yucky.)
UPDATE:
lol4t0 QLabel idea over QPushButton.
Here is my python implementation with the correct signals and all the appropriate button settings. RichTextBox is a widget that you have embedded in a program.
from PyQt4 import QtCore, QtGui class RichTextButton(QtGui.QPushButton): def __init__(self, parent=None): QtGui.QPushButton.__init__(self, parent) self.UnitText = QtGui.QLabel(self) self.UnitText.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.UnitText.setAlignment(QtCore.Qt.AlignCenter) self.UnitText.setMouseTracking(False) self.setLayout(QtGui.QVBoxLayout()) self.layout().setMargin(0) self.layout().addWidget(self.UnitText)
Thanks!
Specifications:
- python 2.7.2
- Windows 7
- PyQt4