What you are describing is captured below:
#include <QApplication>
#include <QTextEdit>
#include <QDebug>
{
Q_OBJECT
public:
protected:
// do local stuff
qDebug() << "Doing local stuff";
// then do the base stuff
}
};
int main(int argc, char **argv) {
MyTextEdit edit; // defaults to editable
edit.show();
return app.exec();
}
#include "main.moc"
#include <QApplication>
#include <QTextEdit>
#include <QDebug>
class MyTextEdit: public QTextEdit
{
Q_OBJECT
public:
MyTextEdit(QWidget *p = 0): QTextEdit(p) { }
protected:
void keyPressEvent(QKeyEvent *event) {
// do local stuff
qDebug() << "Doing local stuff";
// then do the base stuff
QTextEdit::keyPressEvent(event);
}
};
int main(int argc, char **argv) {
QApplication app(argc, argv);
MyTextEdit edit; // defaults to editable
edit.show();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
and this works. So, is this what you are doing?
Bookmarks