Save stylesheet

I have got a QLabel (name) and corresponding QLineEdit.

I would like to check the value of the input field and set the color of he label to red in case a wrong value was inserted. Before doing that, I want to keep the current stylesheet of the label to be able to reset the label to its original value.

def checkData():

 if self.title.text() == "":
			*self*.titleLabel.setStyleSheet(*"color: red"*) # keep the current value?

			*self*.title.setFocus()

			return False

		else:

			*self*.titleLabel.setStyleSheet(*"color: blue"*) # set the original value

			return True

Your on the right track. You need to add a stylesheet to the application level (applies globally) which has 2 classes defined. One for normal look and the other for error. In code you test for the error condition and set stylesheet of the label accordingly using setProperty() specifying the class.