python - Modifying a button's appearance without destroying StyleSheet settings established in Qt Creator -


the specific application tic tac doe toy app made of grid of 9 buttons. original layout of buttons built in qt creator, large font established stylesheet property.

when winning row occurs, want main app 'light up' row of buttons, without needing aware of buttons' properties established in qt creator. want modify stylesheets rather set them, app retains buttons' original properties, in addition changing background colour green in case.

many related questions seem deal setting stylesheets, setting them different properties if widget activated, not modifying them existing settings.

this worked me:

def highlightbutton(self, button):     currentstyle = button.stylesheet()     highlightstyle = 'background-color: lightgreen;'     combinedstylesheet = 'qpushbutton {' + currentstyle + highlightstyle + '}'     button.setstylesheet(combinedstylesheet) 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -