Registered Member
|
This is more a Qt question than KDE. I'm using the new state machine framework in Qt 4.6, and I'm having some trouble with the QMouseEventTransition class. As I understand it, this is supposed to set up a transition so that the state machine moves to a state if the specified object is sent the mouse event that you give it. I haven't been able to get this to work. I've achieved the same functionality by just reimplementing the mouse event handlers in my class and emitting a signal, then setting up state machine transitions for those signals. I want to get it working with QMouseEventTransition, though, because it results in smaller code that's more understandable. Here is the relevant code from the class's constructor:
Nothing happens when I hover over this QGraphicsWidget subclass, when I want it to scale bigger when that happens. I can uncomment my reimplementations of the hover events and replace those mouse event transitions with signal ones and it works fine. Does anyone know what the problem is? |
Administrator
|
I can't see any connections between the state machine and the QGraphicsWidget....
See http://qt.nokia.com/doc/4.6-snapshot/qs ... Transition You need to "trigger" the state machine to change by using the SIGNAL variants, as shown in the simple example here: http://qt.nokia.com/doc/4.6-snapshot/st ... e-api.html
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
I'm not sure what you mean. What sort of connection are you looking for? QGraphicsWidget has properties, which can be set when states are entered, just like a QWidget or a QGraphicsItem.
From looking through the documentation for the state machine framework, it seems to me like there are multiple ways to trigger a change, one way is using signals as you've pointed out, another way is with events. Unfortunately, none of the examples provided use these kinds of transitions, which might imply that you have to use signals. But if signals are the only way, what is the function of the QEventTransition, QKeyEventTransition and QMouseEventTransition which are listed there in the state machine framework documentation? |
Administrator
|
Hmm. Didn't see that as the example provided by Qt doesn't go into using an event based engine.
Possibly try with QWidgets ( temporarily to test it )?
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]