title: How to paint over a child widget?
body: <p>So I have this <code>Ui_MainWindow</code> class generated by <code>pyuic5</code>.</p>
  
  <pre><code># -*- coding: utf-8 -*-
  
  # Form implementation generated from reading ui file 'MainWindow.ui'
  #
  # Created by: PyQt5 UI code generator 5.9
  #
  # WARNING! All changes made in this file will be lost!
  
  from PyQt5 import QtCore, QtGui, QtWidgets
  
  class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          MainWindow.setObjectName("MainWindow")
          MainWindow.resize(800, 450)
          self.centralWidget = QtWidgets.QWidget(MainWindow)
          self.centralWidget.setObjectName("centralWidget")
          self.canvas = QtWidgets.QWidget(self.centralWidget)
          self.canvas.setGeometry(QtCore.QRect(70, 30, 621, 341))
          self.canvas.setAutoFillBackground(False)
          self.canvas.setObjectName("canvas")
          self.gview = QtWidgets.QGraphicsView(self.canvas)
          self.gview.setGeometry(QtCore.QRect(80, 50, 256, 192))
          self.gview.setObjectName("gview")
          MainWindow.setCentralWidget(self.centralWidget)
          self.menuBar = QtWidgets.QMenuBar(MainWindow)
          self.menuBar.setGeometry(QtCore.QRect(0, 0, 800, 22))
          self.menuBar.setObjectName("menuBar")
          self.menuhola = QtWidgets.QMenu(self.menuBar)
          self.menuhola.setObjectName("menuhola")
          self.menust = QtWidgets.QMenu(self.menuBar)
          self.menust.setObjectName("menust")
          MainWindow.setMenuBar(self.menuBar)
          self.menuBar.addAction(self.menuhola.menuAction())
          self.menuBar.addAction(self.menust.menuAction())
  
          self.retranslateUi(MainWindow)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
      def retranslateUi(self, MainWindow):
          _translate = QtCore.QCoreApplication.translate
          MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
          self.menuhola.setTitle(_translate("MainWindow", "hola"))
          self.menust.setTitle(_translate("MainWindow", "splendid"))
  </code></pre>
  
  <p>And I want to paint on something, as long as it's not the main window. However, no matter what I try, it just doesn't work.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>import sys
  
  from PyQt5 import QtWidgets
  from PyQt5.QtGui import QPainter
  from src.qt_design.main_window import Ui_MainWindow
  
  
  class SystemApp(QtWidgets.QMainWindow):
      def __init__(self):
          super().__init__()
          self.ui = Ui_MainWindow()
          self.ui.setupUi(self)
  
      def paintEvent(self, event):
          # Nope
          painter = QPainter(self.ui.gview)
          painter.drawLine(0, 0, 50, 50)
  
          # Nope
          painter = QPainter(self.ui.canvas)
          painter.drawLine(0, 0, 50, 50)
  
  
  if __name__ == '__main__':
      app = QtWidgets.QApplication(sys.argv)
      window = SystemApp()
      window.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>I'm not sure if I should either:
  1. Paint with this parent on its children (like what I tried above)
  2. Override children's paintEvent, but it's maybe a bad idea, see <a href="https://stackoverflow.com/questions/394770/override-a-method-at-instance-level">here</a></p>
  
  <p>Any help will be appreciated!</p>