title: PyQt5 change app theme/palette dynamically
body: <p>I can successfully create a new palette and set it to the QApplication at launch. However, once the application is running, I cannot change the colors of the palette anymore. I would like to change the colors of the buttons if the user chooses a particular theme. The current code which works at launch but not later is as follows:</p>
  
  <pre><code>palette = QtGui.QPalette()
  palette.setColor(QtGui.QPalette.Window, QtGui.QColor(3, 18, 14))
  palette.setColor(QtGui.QPalette.Base, QtGui.QColor(15, 15, 15))
  palette.setColor(QtGui.QPalette.AlternateBase, QtGui.QColor(53, 53, 53))
  palette.setColor(QtGui.QPalette.ToolTipBase, QtCore.Qt.white)
  palette.setColor(QtGui.QPalette.Text, QtCore.Qt.white)
  palette.setColor(QtGui.QPalette.Button, QtGui.QColor(53, 53, 53))
  palette.setColor(QtGui.QPalette.ButtonText, QtCore.Qt.white)
  palette.setColor(QtGui.QPalette.BrightText, QtCore.Qt.red)
  palette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(142, 45, 197).lighter())
  palette.setColor(QtGui.QPalette.HighlightedText, QtCore.Qt.black)
  app.setPalette(palette)
  </code></pre>
  
  <p>The same palette object if used in a slot doesnt change the color. Eg code in the slot:</p>
  
  <pre><code>palette.setColor(QtGui.QPalette.Button, QtGui.QColor(53, 53, 53))
  app.setPalette(palette)
  </code></pre>
  
  <p>Could someone please let me know what I am missing here?
  Thanks.</p>
  
  <p>Edit:
  I just found out that it modified only some of the areas. For eg, in the slot I have written, it changes the highlight color, but not the QTab color (which was set by setting color to Button). My current slot code: </p>
  
  <pre><code>def change_theme(self): 
      pal = QtWidgets.QApplication.palette() 
      #The next line works 
      pal.setColor(QtGui.QPalette.Highlight, QtGui.QColor(0, 0, 128)) 
      #The next line doesnt work. Expected it to change the Tab Widget color 
      #using this line. 
      pal.setColor(QtGui.QPalette.Button, QtGui.QColor(62, 80, 91)) 
      QtWidgets.QApplication.setPalette(pal)
  </code></pre>