def qteSetLexer(self, lexer):
        if (lexer is not None) and (not issubclass(lexer, Qsci.QsciLexer)):
            QtmacsOtherError('lexer must be a class object and derived from'
                             ' <b>QsciLexer</b>')
            return
        self.qteLastLexer = lexer
        if lexer is None:
            self.setLexer(None)
        else:
            self.setLexer(lexer())
        self.setMonospace()