title: PyQt5 update MainWindow after paintEvent
body: <p>I am pretty new to QT.
  I am trying to paint some rectangles after button click.
  paintEvent method seems to working but after button click nothing happens
  I think I need to update mainWindow somehow.
  Code:</p>
  
  <pre><code>from PyQt5 import QtCore, QtGui, uic, QtWidgets
  from PyQt5.QtWidgets import QMainWindow, QApplication
  from PyQt5.QtGui import QPainter, QColor, QBrush
  
  qtCreatorFile = "gui.ui" # Enter file here.
  
  #This is where you add the file you created earlier. It is loaded using the inbuilt function
  Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
  
  class MyApp(QtWidgets.QMainWindow):
  
      pridat_slide = False
  
      def __init__(self):
          super(MyApp, self).__init__()
          self.ui = Ui_MainWindow()
          self.ui.setupUi(self)
          self.ui.pridaj_slide.clicked.connect(self.pridaj_slide)
  
  
      def pridaj_slide(self):
          self.pridat_slide = True
  
      def paintEvent(self, e):
          qp = QPainter()
          qp.begin(self)
          self.drawRectangles(qp)
          qp.end()
  
      def drawRectangles(self, qp):
          if self.pridat_slide:
              print ("test");
  
              qp.setBrush(QColor(200, 0, 0))
              qp.drawRect(10, 15, 90, 60)
  
              qp.setBrush(QColor(255, 80, 0, 160))
              qp.drawRect(130, 15, 90, 60)
  
              qp.setBrush(QColor(25, 0, 90, 200))
              qp.drawRect(250, 15, 90, 60)
              self.update()
              self.pridat_slide = False
  
  if __name__ == "__main__":
      try:
          app = QtWidgets.QApplication(sys.argv)
          window = MyApp()
          window.show()
          sys.exit(app.exec_())
  </code></pre>
  
  <p>screen:<a href="https://i.stack.imgur.com/feUTJ.png" rel="nofollow noreferrer">"test" is printed</a></p>
  
  <p>Thanks for any suggestions &amp; improvements.</p>
  
  <p><strong>SOLVED</strong></p>
  
  <p>Problem was in background-color of MainWindow. I deleted <code>background-color: rgb(145,145,145);</code> and rectangles are up.</p>