title: pickling QWidgets and classes inheriting QWidget
body: <p>I have been trying to save the widgets in my QTabWidget to a file, that I can later load and add the saved widgets as tabs in the current window.</p>
  
  <p>My approach was trying to use pickle, however pickle.dump returns a type error.</p>
  
  <p>Is it possible to save QWidgets?</p>
  
  <p>I have defined a custom canvas class inheriting QWidget that contains the QGraphicsScene and view as follow.</p>
  
  <pre class="lang-py prettyprint-override"><code>class canvas(QWidget):
      def __init__(self, parent=None):
          super(canvas, self).__init__(parent)
  
          self.painter = QGraphicsScene(0, 0, 794, 1123)
          self.resize(794, 1123)
          self.painter.setBackgroundBrush(QBrush(Qt.white))
          self.view = QGraphicsView(self.painter)
          self.layout = QHBoxLayout(self)
          self.layout.addWidget(self.view)
          self.setLayout(self.layout)
  </code></pre>
  
  <p>which is then added to the QTabWidget.</p>
  
  <p>All I want is to save a list of objects of my canvas class to a file</p>
  
  <p>Here is a minimum reproducible example.</p>
  
  <pre class="lang-py prettyprint-override"><code>if __name__ == "__main__":
      tabs = []
      tabs.append(canvas())
      tabs.append(canvas())
      tabs.append(canvas())
      pickle.dump(tabs, open('test','w'))
  </code></pre>