title: PyQt5 custom widget .setStyleSheet doesnt change the style
body: <p>I have a custom widget called GraphCanvas which inherits from QWidget, it is functional but when I try to use it in a window object and set a background color to it, it does not work. The main issue is I'm making a frameless transparent window, and when I do this the actual GraphCanvas becomes transparent as well and I can't find out why.</p>
  <p>Minimal reproducible example:</p>
  <pre><code>from PyQt5.QtWidgets import QWidget, QApplication
  from PyQt5.QtCore import Qt
  from Custom_Widgets.CanvasWidget.GraphCanvas import GraphCanvas
  import sys
  
  class Window(QWidget):
      def __init__(self):
          QWidget.__init__(self)
  
          self.setGeometry(100, 100, 500, 500)
  
          flags = Qt.WindowFlags(Qt.FramelessWindowHint)  
          self.setAttribute(Qt.WA_TranslucentBackground)
          self.setWindowFlags(flags)
  
          self.canvas = GraphCanvas(self)
          self.canvas.setGeometry(0, 0, 500, 500)
          self.canvas.setStyleSheet('background-color: grey;')
  
  app = QApplication(sys.argv)
  window = Window()
  window.show()
  sys.exit(app.exec_())
  </code></pre>
  <pre><code>class GraphCanvas(QWidget):
      def __init__(self, parent):
          super().__init__(parent)
  </code></pre>
  <p>In the <code>Window</code> <code>__init__</code> if I change <code>GraphCanvas(self)</code> to <code>QWidget(self)</code> it works correctly, otherwise the GraphCanvas for some reason inherits the transparent background and nothing shows up.</p>