You can install an event filter on the text edit and make it emit such signal. See QObject::installEventFilter() and QObject::eventFilter(). Other solution is to subclass QTextEdit and reimplement QWidget::keyPressEvent().
P.S. Please, don't ask two unrelated questions in a single thread.
Bookmarks