def _guess_qt_api(self):  # pragma: no cover
        def _can_import(name):
            try:
                _import(name)
                return True
            except ModuleNotFoundError as e:
                self._import_errors[name] = str(e)
                return False

        # Note, not importing only the root namespace because when uninstalling from conda,
        # the namespace can still be there.
        if _can_import("PySide6.QtCore"):
            return "pyside6"
        elif _can_import("PySide2.QtCore"):
            return "pyside2"
        elif _can_import("PyQt6.QtCore"):
            return "pyqt6"
        elif _can_import("PyQt5.QtCore"):
            return "pyqt5"
        return None