docs: def togglePopup(self):
          """
          Toggles whether or not the popup is visible.
          """
          if not self._popupWidget.isVisible():
              self.showPopup()
          elif self._popupWidget.currentMode() != self._popupWidget.Mode.Dialog:
              self._popupWidget.close()