title: Make a modal QDialog minimize when QMainWindow minimized (using PyQt 5)
body: <p>Example code I am using:</p>
  
  <pre><code>import sys
  from PyQt5 import QtCore
  from PyQt5 import QtWidgets
  
  class MainWindow(QtWidgets.QMainWindow):
  
      def __init__(self, parent=None):
          super(MainWindow, self).__init__(parent)
  
          self.open_about = False
          self.openAction = QtWidgets.QAction('About', self)
          self.openAction.triggered.connect(self.aboutDialog)
          menuBar = self.menuBar()
          fileMenu = menuBar.addMenu('&amp;File')
          fileMenu.addAction(self.openAction)
          self.calendar = QtWidgets.QCalendarWidget(self)
          self.setCentralWidget(self.calendar)
  
      def about_state_upd(self, value):
          self.open_about = value
  
      def aboutDialog(self):
          self._about = AboutDialog(self)
          self._about.exec_()
  
      def hideEvent(self, hideEvent):
          if self.open_about == True:
              self._about.setVisible(False)
  
      def showEvent(self, showEvent):
          if self.open_about == True:
              if self._about.isHidden() == True:
                  self._about.setModal(True)
                  self._about.setVisible(True)
  
  class AboutDialog(QtWidgets.QDialog):
  
      def __init__(self, parent):
          super(AboutDialog, self).__init__(parent)
  
          self.setMinimumSize(400, 350)
          self.parent().about_state_upd(True)
  
      def closeEvent(self, closeEvent):
          self.parent().about_state_upd(False)
  
  if __name__ == '__main__':
      app = QtWidgets.QApplication(sys.argv)
      app_window = MainWindow()
      app_window.showMaximized()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>This code basically works, but seems very complicated.  Is there a simpler / cleaner way to make it so that when the modal QDialog is open, if the QMainWindow is minimized, the QDialog also gets minimized too (and reverse when QMainWindow is restored)?</p>
  
  <p>Code is running on KDE Neon (Kubuntu-based distro).</p>