简体   繁体   中英

Qt animation - member doesn't exist

This code:

 QStateMachine *machine = new QStateMachine;

     QState *state1 = new QState(machine->rootState());

I'm getting an error:
C:\Users..\Animated_Button\main.cpp:13: error: 'class QStateMachine' has no member named 'rootState'

Indeed, according to the documentation , QStateMachine has no method named rootState . According to this , it was removed at one point. The article states this:

QStateMachine::rootState() is gone; the state machine now is the root state.

So the code you have comes from an outdated source. You should try doing this:

 QStateMachine *machine = new QStateMachine;

 QState *state1 = new QState(machine);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM