Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT Addtransition



  • Hi
    I have problem with qt addtransition it shows me this error: QState::addtransition(Qstate *s1 = signal);
    and there is my projects code
    QStateMachine machine;
    QState *s1 = new QState();
    QState *s2 = new QState();
    QState *s3 = new QState();

    QState::addTransition(QState * s1 = signal);
    
    s1->addTransition(s1, SIGNAL(clicked()), s2);
    s2->addTransition(s2, SIGNAL(clicked()), s3);
    s3->addTransition(s3, SIGNAL(clicked()), s1);
    
    machine.addState(s1);
    machine.addState(s2);
    machine.addState(s3);
    
    machine.setInitialState(s1);
    
    machine.start();
    

    Where is my faulth please help me


  • Moderators

    @BORHAN-CO. can you post the full error?

    Also, does your code really contain the line

    QState::addTransition(QState * s1 = signal);

    If so, what is that supposed to do?



  • expected primary-expression "*" token

    QState::addTransition(QAbstractTransition*transition);


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What is this line supposed to do ?


Log in to reply