Give keyboard focus to ``widgetObj``.

        If ``widgetObj`` is **None** then the internal focus state
        is reset, but the focus manger will automatically
        activate the first available widget again.

        |Args|

        * ``widgetObj`` (**QWidget**): the widget to focus on.

        |Returns|

        * **None**

        |Raises|

        * **QtmacsOtherError** if ``widgetObj`` was not added with
            ``qteAddWidget``.

def qteMakeWidgetActive(self, widgetObj: QtGui.QWidget):
        """
        Give keyboard focus to ``widgetObj``.

        If ``widgetObj`` is **None** then the internal focus state
        is reset, but the focus manger will automatically
        activate the first available widget again.

        |Args|

        * ``widgetObj`` (**QWidget**): the widget to focus on.

        |Returns|

        * **None**

        |Raises|

        * **QtmacsOtherError** if ``widgetObj`` was not added with
            ``qteAddWidget``.
        """
        # Void the active widget information.
        if widgetObj is None:
            self._qteActiveWidget = None
            return

        # Ensure that this applet is an ancestor of ``widgetObj``
        # inside the Qt hierarchy.
        if qteGetAppletFromWidget(widgetObj) is not self:
            msg = 'The specified widget is not inside the current applet.'
            raise QtmacsOtherError(msg)

        # If widgetObj is not registered with Qtmacs then simply declare
        # it active and return.
        if not hasattr(widgetObj, '_qteAdmin'):
            self._qteActiveWidget = widgetObj
            return

        # Do nothing if widgetObj refers to an applet.
        if widgetObj._qteAdmin.isQtmacsApplet:
            self._qteActiveWidget = None
            return

        # Housekeeping: remove non-existing widgets from the admin structure.
        self.qteAutoremoveDeletedWidgets()

        # Verify the widget is registered for this applet.
        if widgetObj not in self._qteAdmin.widgetList:
            msg = 'Widget is not registered for this applet.'
            self.qteLogger.error(msg, stack_info=True)
            self._qteActiveWidget = None
            return

        # The focus manager in QtmacsMain will hand the focus to
        # whatever the _qteActiveWidget variable of the active applet
        # points to.
        self.qteSetWidgetFocusOrder((self._qteActiveWidget, widgetObj))
        self._qteActiveWidget = widgetObj