I used the answer provided here to give users a signal regarding the quality of their input for a QLineEdit
. The trouble is that my QToolTip
has incorporated this same style which is not ideal.
Here is the validator
def handleValidationChange(self, state):
if state == QtGui.QValidator.Invalid:
colour = 'white'
elif state == QtGui.QValidator.Intermediate:
colour = 'yellow'
elif state == QtGui.QValidator.Acceptable:
colour = 'lightgreen'
self.nameLineEdit.setStyleSheet('background-color: %s' % colour)
QtCore.QTimer.singleShot(5000, lambda: self.nameLineEdit.setStyleSheet(''))
Within the app.setStyleSheet
I try to make it so the tool tip gets a different style, but it ends up matching the validation style, if I hover over the line-edit while an entry is made.
app.setStyleSheet('''\
QToolTip {background-color: lightblue !important;}
'''
)
Does anyone know how separate out the line-edit style with the validation from the QToolTip
style? In this screen capture, the line-edit, and tool-tip background colors match.