Kill the specified window (applets inside the window are not
        deleted).

        .. note:: The method does nothing if ``windowObj`` is the only
           window left.

        |Args|

        * *windowObj* (**QtmacsWindow**): window object to delete.

        |Returns|

        * **None**

        |Raises|

        * **QtmacsArgumentError** if at least one argument has an invalid type.

def qteKillWindow(self, windowObj: QtmacsWindow=None):
        """
        Kill the specified window (applets inside the window are not
        deleted).

        .. note:: The method does nothing if ``windowObj`` is the only
           window left.

        |Args|

        * *windowObj* (**QtmacsWindow**): window object to delete.

        |Returns|

        * **None**

        |Raises|

        * **QtmacsArgumentError** if at least one argument has an invalid type.
        """
        # Use the currently active window if none was specified.
        if windowObj is None:
            windowObj = self.qteActiveWindow()
            if windowObj is None:
                msg = ('Cannot kill the currently active window because'
                       ' it does not exist')
                self.qteLogger.error(msg, stack_info=True)
                return

        # If Qtmacs shows only one window then do nothing, because
        # deleting this window is akin to quitting Qtmacs without
        # going through the proper shutdown process.
        if len(self._qteWindowList) <= 1:
            msg = 'The last available window cannot be deleted.'
            self.qteLogger.error(msg, stack_info=True)
            return

        # Remove the window from the list.
        try:
            self._qteWindowList.remove(windowObj)
        except ValueError:
            msg = 'Cannot delete window with ID <b>{}</b> because it'
            msg += ' does not exist.'.format(windowObj._qteWindowID)
            self.qteLogger.error(msg, stack_info=True)
            return

        # Shorthand
        activeWindow = self.qteActiveWindow()

        # If the window to delete is currently active then switch the
        # focus to the first window in the list (not particularly
        # smart, but will do for now).
        if windowObj is activeWindow:
            activeWindow = self._qteWindowList[0]
            self.activeWindow.activateWindow()

            # Since the window with the active applet is deleted,
            # try to find a new applet to activate instead. It is
            # ok if there is no such applet.
            self._qteActiveApplet = self.qteNextApplet(
                windowObj=self._qteWindowList[0])

        # Move the mini applet if it is currently in the doomed window.
        if self._qteMiniApplet is not None:
            if self._qteMiniApplet.qteParentWindow() is windowObj:
                # Re-parent the mini applet to the splitter in the new
                # window.
                activeWindow.qteLayoutSplitter.addWidget(self._qteMiniApplet)
                self._qteMiniApplet.show(True)

                # Give the focus to the first focusable widget (if any).
                wid = self._qteMiniApplet.qteNextWidget(numSkip=0)
                self._qteMiniApplet.qteMakeWidgetActive(wid)
                self.qteMakeAppletActive(self._qteMiniApplet)

        # Compile the list of visible applets in the doomed window
        # (use ``qteParentWindow`` to find all applets that have the
        # doomed window as parent).
        app_list = [_ for _ in self._qteAppletList
                    if _.qteParentWindow() == windowObj]

        # Hide all visible applets in the doomed window. Do not use
        # ``qteRemoveFromLayout`` for this since that method attempts
        # to replace the removed applet with another one, ie. the
        # doomed window would once again contain an applet.
        for app_obj in app_list:
            if not self.qteIsMiniApplet(app_obj):
                app_obj.hide(True)

        # Ensure the focus manager is triggered and the window deleted
        # once the event loop has regained control.
        windowObj.deleteLater()