title: FigureCanvas not interpreted as QtWidget after using PyInstaller
body: <p>I have a slight modified version of this example from matplotlib: <a href="https://matplotlib.org/gallery/user_interfaces/embedding_in_qt_sgskip.html" rel="noreferrer">https://matplotlib.org/gallery/user_interfaces/embedding_in_qt_sgskip.html</a></p>
  
  <p>The only thing changed is the imports since I am using PySide2, so the imports looks like this:</p>
  
  <pre><code>from PySide2 import QtCore, QtWidgets
  from matplotlib.backends.backend_qt5agg import (FigureCanvasQTAgg as FigureCanvas, NavigationToolbar2QT as NavigationToolbar)
  from matplotlib.figure import Figure
  </code></pre>
  
  <p>This works fine when running the code in pycharm, or running the scrips by itself, however after an .exe is created with PyInstaller I get the following error:</p>
  
  <pre><code>TypeError: 'PySide2.QtWidgets.QBoxLayout.addWidget' called with wrong argument types:                                     
    PySide2.QtWidgets.QBoxLayout.addWidget(FigureCanvasQTAgg)                                                            
  Supported signatures:                                                                                                     
    PySide2.QtWidgets.QBoxLayout.addWidget(PySide2.QtWidgets.QWidget, int=0, 
    PySide2.QtCore.Qt.Alignment=Default(Qt.Alignment))                                                                                                                     
    PySide2.QtWidgets.QBoxLayout.addWidget(PySide2.QtWidgets.QWidget)
  </code></pre>
  
  <p>It seems as the FigureCanvasQtAgg is no longer recognized as a QWidget, so it can't be added to the layout.</p>
  
  <p>I've tried adding these lines to suggest pyside as suggested <a href="https://stackoverflow.com/questions/6723527/getting-pyside-to-work-with-matplotlib/8292957">here</a>:</p>
  
  <pre><code>os.environ["QT_API"] = "PySide2"
  matplotlib.use('Qt5Agg')
  matplotlib.rcParams['backend.qt5']='PySide2'
  </code></pre>
  
  <p>However that does not change the error message of the exe. In pycharm it still runs fine.</p>
  
  <p><strong>EDIT: It seems this is some problem with PySide2+PyInstaller</strong>, after replacing this line:</p>
  
  <pre><code>from PySide2 import QtCore, QtWidgets
  </code></pre>
  
  <p>with this line:</p>
  
  <pre><code>from PyQt5 import QtCore, QtWidgets
  </code></pre>
  
  <p>It works even after using PyInstaller.</p>
  
  <p>But I want to use PySide2 instead of PyQt5, anyone know a way to solve this?</p>