summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/statemachine/eventtest.cpp
blob: e0f359ad37303c422a59895b3712926493cbbf96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#include <QtGui>

class MyTransition : public QAbstractTransition
{
    Q_OBJECT
public:
    MyTransition() {}

protected:
//![0]
    bool eventTest(QEvent *event)
    {
        if (event->type() == QEvent::Wrapped) {
            QEvent *wrappedEvent = static_cast<QWrappedEvent *>(event)->event();
            if (wrappedEvent->type() == QEvent::KeyPress) {
                QKeyEvent *keyEvent = static_cast<QKeyEvent *>(wrappedEvent);
                // Do your event test
            }       
        }
        return false;
    }
//![0]      

    void onTransition(QEvent *event)
    {

    }
};

int main(int argv, char **args)
{
    return 0;
}