I have a class that displays a QMessageBox each time an action is performed. I was trying to set the button colour in the QMessageBox to a silver background.
At the moment the button is blue which is the same as the background of the QMessageBox.
My question is, how, with this piece of code: QtWidgets.qApp.setStyleSheet("QMessageBox QPushButton{background-color: Silver;}") can i change the QPushButton colour in the QMessageBox to silver.
This is a snippet of my code. I have tried to put the above snippet into the function so that when the button is clicked, the colour of the QPushButton in the message box will be silver. Is there a problem with this as it does not seem to make any change. Where should I place this styleSheet functionality in the code?
self.canonicalAddressesButton.clicked.connect(self.canonical_data_parsed_notification)
def canonical_data_parsed_notification(self):
QtWidgets.QMessageBox.information(self.mainwindow, 'Notification', 'Canonical Address Data Has Been Parsed!', QtWidgets.QMessageBox.Ok)
QtWidgets.qApp.setStyleSheet("QMessageBox QPushButton{background-color: Silver;}")