Convert a list of (``QtModifier``, ``QtCore.Qt.Key_*``) tuples
        into a key sequence.

        If no error is raised, then the list was accepted.

        |Args|

        * ``keyList`` (**list**): eg. (QtCore.Qt.ControlModifier,
          QtCore.Qt.Key_F).

        |Returns|

        **None**

        |Raises|

        * **QtmacsKeysequenceError** if the provided ``keysequence``
            could not be parsed.

def list2key(self, keyList):
        """
        Convert a list of (``QtModifier``, ``QtCore.Qt.Key_*``) tuples
        into a key sequence.

        If no error is raised, then the list was accepted.

        |Args|

        * ``keyList`` (**list**): eg. (QtCore.Qt.ControlModifier,
          QtCore.Qt.Key_F).

        |Returns|

        **None**

        |Raises|

        * **QtmacsKeysequenceError** if the provided ``keysequence``
            could not be parsed.
        """
        for keyCombo in keyList:
            if not (isinstance(keyCombo, list) or isinstance(keyCombo, tuple)):
                msg = ('Format of native key list is invalid.'
                       ' Must be a list/tuple of list/tuples.')
                raise QtmacsKeysequenceError(msg)
            if len(keyCombo) != 2:
                msg = 'Format of native key list is invalid.'
                msg += 'Each element must have exactly 2 entries.'
                raise QtmacsKeysequenceError(msg)

            # Construct a new QKeyEvent. Note that the general
            # modifier (ie. <ctrl> and <alt>) still need to be
            # combined with shift modifier (which is never a general
            # modifier) if the key demands it. This combination is a
            # simple "or" on the QFlags structure. Also note that the
            # "text" argument is omitted because Qt is smart enough to
            # fill it internally. Furthermore, the QKeyEvent method
            # will raise an error if the provided key sequence makes
            # no sense, but to avoid raising an exception inside an
            # exception the QtmacsKeysequenceError is not raised
            # inside the exception block.
            key_event = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, keyCombo[1],
                                        keyCombo[0])
            try:
                key_event = QtGui.QKeyEvent(QtCore.QEvent.KeyPress,
                                            keyCombo[1], keyCombo[0])
                err = False
            except TypeError:
                err = True

            if err:
                msg = ('Format of native key list is invalid. '
                       'Must be a list/tuple of list/tuples.')
                raise QtmacsKeysequenceError(msg)
            else:
                self.appendQKeyEvent(key_event)