Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef MYT_H
- #define MYT_H
- #include <QTextEdit>
- #include <QWheelEvent>
- #include <QApplication>
- #include <QDebug>
- class myT : public QTextEdit
- {
- Q_OBJECT
- public slots:
- void v()
- {
- qDebug() << Q_FUNC_INFO;
- QWheelEvent e(QPoint(0,0),-120,0,0,Qt::Vertical);
- this->setFocus();
- qApp->sendEvent(this,&e);
- //qApp->postEvent(this,e);
- qApp->processEvents();
- }
- protected:
- bool event(QEvent *e)
- {
- QWheelEvent *ev = dynamic_cast<QWheelEvent*>(e);
- if(ev)
- qDebug() << ev->delta();
- return QTextEdit::event(e);
- }
- void wheelEvent(QWheelEvent *e)
- {
- qDebug() << "pos: " << e->pos();
- qDebug() << "delta: " << e->delta();
- qDebug() << "buttons: " << e->buttons();
- qDebug() << "modifiers: " << e->modifiers();
- qDebug() << "orient: " << e->orientation();
- QTextEdit::wheelEvent(e);
- }
- };
- #endif // MYT_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement