当前位置: 首页>>代码示例>>C++>>正文


C++ QState::setObjectName方法代码示例

本文整理汇总了C++中QState::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QState::setObjectName方法的具体用法?C++ QState::setObjectName怎么用?C++ QState::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QState的用法示例。


在下文中一共展示了QState::setObjectName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

//! [4]
int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    QStateMachine machine;
    QState *group = new QState(QState::ParallelStates);
    group->setObjectName("group");
//! [4]

//! [5]
    Pinger *pinger = new Pinger(group);
    pinger->setObjectName("pinger");
    pinger->addTransition(new PongTransition());

    QState *ponger = new QState(group);
    ponger->setObjectName("ponger");
    ponger->addTransition(new PingTransition());
//! [5]

//! [6]
    machine.addState(group);
    machine.setInitialState(group);
    machine.start();

    return app.exec();
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:27,代码来源:main.cpp

示例2: main

//! [0]
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QPushButton button;
    QStateMachine machine;
//! [0]

//! [1]
    QState *off = new QState();
    off->assignProperty(&button, "text", "Off");
    off->setObjectName("off");

    QState *on = new QState();
    on->setObjectName("on");
    on->assignProperty(&button, "text", "On");
//! [1]

//! [2]
    off->addTransition(&button, SIGNAL(clicked()), on);
    on->addTransition(&button, SIGNAL(clicked()), off);
//! [2]

//! [3]
    machine.addState(off);
    machine.addState(on);
//! [3]

//! [4]
    machine.setInitialState(off);
    machine.start();
//! [4]

//! [5]
#if defined(Q_OS_SYMBIAN)
    button.showMaximized();
#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
    button.show();
#else
    button.resize(100, 50);
    button.show();
#endif
    return app.exec();
}
开发者ID:Kwangsub,项目名称:qt-openwebos,代码行数:44,代码来源:main.cpp

示例3: main

//! [0]
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QPushButton button;
    QStateMachine machine;
//! [0]

//! [1]
    QState *off = new QState();
    off->assignProperty(&button, "text", "Off");
    off->setObjectName("off");

    QState *on = new QState();
    on->setObjectName("on");
    on->assignProperty(&button, "text", "On");
//! [1]

//! [2]
    off->addTransition(&button, SIGNAL(clicked()), on);
    on->addTransition(&button, SIGNAL(clicked()), off);
//! [2]

//! [3]
    machine.addState(off);
    machine.addState(on);
//! [3]

//! [4]
    machine.setInitialState(off);
    machine.start();
//! [4]

//! [5]
    button.resize(100, 50);
    button.show();
    return app.exec();
}
开发者ID:elProxy,项目名称:qtbase,代码行数:38,代码来源:main.cpp

示例4: localSM

CreateTool::CreateTool(CurveStateMachine &sm):
    EditionTool{sm}
{
    this->setObjectName("CreateTool");
    localSM().setObjectName("CreateToolLocalSM");
    QState* waitState = new QState{&localSM()};
    waitState->setObjectName("WaitState");

    auto co = new CreatePointCommandObject(&sm.presenter(), sm.commandStack());
    auto state = new OngoingState(*co, &localSM());
    state->setObjectName("CreatePointFromNothingState");
    make_transition<ClickOnSegment_Transition>(waitState, state, *state);
    make_transition<ClickOnNothing_Transition>(waitState, state, *state);
    state->addTransition(state, SIGNAL(finished()), waitState);

    localSM().setInitialState(waitState);

    localSM().start();
}
开发者ID:gitter-badger,项目名称:i-score,代码行数:19,代码来源:MoveTool.cpp

示例5: setup

void ViewMachine::setup(LayoutUpdater *updater)
{
    if (not updater) {
        qCritical() << __PRETTY_FUNCTION__
                    << "No updater specified. Aborting setup.";
        return;
    }

    setChildMode(QState::ExclusiveStates);

    QState *main = 0;
    QState *symbols0 = 0;
    QState *symbols1 = 0;

    // addState makes state machine to be a parent of passed state,
    // so we don't have to care about deleting states explicitly.
    addState(main = new QState);
    addState(symbols0 = new QState);
    addState(symbols1 = new QState);
    setInitialState(main);

    main->setObjectName(main_state);
    symbols0->setObjectName(symbols0_state);
    symbols1->setObjectName(symbols1_state);

    main->addTransition(updater, SIGNAL(symKeyReleased()), symbols0);
    connect(main,    SIGNAL(entered()),
            updater, SLOT(switchToMainView()));

    symbols0->addTransition(updater, SIGNAL(symKeyReleased()), main);
    symbols0->addTransition(updater, SIGNAL(symSwitcherReleased()), symbols1);
    connect(symbols0, SIGNAL(entered()),
            updater,  SLOT(switchToPrimarySymView()));

    symbols1->addTransition(updater, SIGNAL(symKeyReleased()), main);
    symbols1->addTransition(updater, SIGNAL(symSwitcherReleased()), symbols0);
    connect(symbols1, SIGNAL(entered()),
            updater,  SLOT(switchToSecondarySymView()));

    // Defer to first main loop iteration:
    QTimer::singleShot(0, this, SLOT(start()));
}
开发者ID:YeomansIII,项目名称:plugins,代码行数:42,代码来源:viewmachine.cpp

示例6: QFrame

ExampleView::ExampleView(QWidget* parent)
   : QFrame(parent)
      {
      _score = 0;
      setAcceptDrops(true);
      setFocusPolicy(Qt::StrongFocus);
      resetMatrix();
      _fgPixmap = nullptr;
      if (preferences.getBool(PREF_UI_CANVAS_FG_USECOLOR))
            _fgColor = preferences.getColor(PREF_UI_CANVAS_FG_COLOR);
      else {
            _fgPixmap = new QPixmap(preferences.getString(PREF_UI_CANVAS_FG_WALLPAPER));
            if (_fgPixmap == 0 || _fgPixmap->isNull())
                  qDebug("no valid pixmap %s", qPrintable(preferences.getString(PREF_UI_CANVAS_FG_WALLPAPER)));
            }
      // setup drag canvas state
      sm          = new QStateMachine(this);
      QState* stateActive = new QState;

      QState* s1 = new QState(stateActive);
      s1->setObjectName("example-normal");
      s1->assignProperty(this, "cursor", QCursor(Qt::ArrowCursor));

      QState* s = new QState(stateActive);
      s->setObjectName("example-drag");
      s->assignProperty(this, "cursor", QCursor(Qt::SizeAllCursor));
      QEventTransition* cl = new QEventTransition(this, QEvent::MouseButtonRelease);
      cl->setTargetState(s1);
      s->addTransition(cl);
      s1->addTransition(new DragTransitionExampleView(this));


      sm->addState(stateActive);
      stateActive->setInitialState(s1);
      sm->setInitialState(stateActive);

      sm->start();
      }
开发者ID:IsaacWeiss,项目名称:MuseScore,代码行数:38,代码来源:exampleview.cpp

示例7: createFSMState

QState* createFSMState(const QString& stateName,QState * parent)
{
	QState *result = new QState(parent);
	result->setObjectName(stateName);
	return result;
}
开发者ID:ctbrowser,项目名称:luna-sysmgr,代码行数:6,代码来源:dimensionsglobal.cpp

示例8: createState

//helper
static QState* createState(QString name, QState *parent=0)
{
	QState *result = new QState(parent);
	result->setObjectName(name);
	return result;
}
开发者ID:brandongoeszoom,项目名称:luna-sysmgr,代码行数:7,代码来源:pixbutton2state.cpp

示例9: connect

ScenarioCreation_FromEvent::ScenarioCreation_FromEvent(
        const ScenarioStateMachine& stateMachine,
        ObjectPath &&scenarioPath,
        iscore::CommandStack& stack,
        QState* parent):
    ScenarioCreationState{stateMachine, stack, std::move(scenarioPath), parent}
{
    using namespace Scenario::Command;
    auto finalState = new QFinalState{this};
    connect(finalState, &QState::entered, [&] ()
    {
        clearCreatedIds();
    });

    QState* mainState = new QState{this};
    mainState->setObjectName("Main state");
    {
        auto pressed = new QState{mainState};
        auto released = new QState{mainState};
        auto move_nothing = new StrongQState<ScenarioElement::Nothing + Modifier::Move_tag::value>{mainState};
        auto move_state = new StrongQState<ScenarioElement::State + Modifier::Move_tag::value>{mainState};
        auto move_event = new StrongQState<ScenarioElement::Event + Modifier::Move_tag::value>{mainState};
        auto move_timenode = new StrongQState<ScenarioElement::TimeNode + Modifier::Move_tag::value>{mainState};

        pressed->setObjectName("Pressed");
        released->setObjectName("Released");
        move_nothing->setObjectName("Move on Nothing");
        move_state->setObjectName("Move on State");
        move_event->setObjectName("Move on Event");
        move_timenode->setObjectName("Move on TimeNode");

        // General setup
        mainState->setInitialState(pressed);
        released->addTransition(finalState);

        // Release
        make_transition<ReleaseOnAnything_Transition>(mainState, released);

        // Pressed -> ...
        make_transition<MoveOnNothing_Transition>(pressed, move_nothing, *this);

        /// MoveOnNothing -> ...
        // MoveOnNothing -> MoveOnNothing.
        make_transition<MoveOnNothing_Transition>(move_nothing, move_nothing, *this);

        // MoveOnNothing -> MoveOnState.
        add_transition(move_nothing, move_state,
                       [&] () { rollback(); createToState(); });

        // MoveOnNothing -> MoveOnEvent.
        add_transition(move_nothing, move_event,
                       [&] () { rollback(); createToEvent(); });

        // MoveOnNothing -> MoveOnTimeNode
        add_transition(move_nothing, move_timenode,
                       [&] () { rollback(); createToTimeNode(); });


        /// MoveOnState -> ...
        // MoveOnState -> MoveOnNothing
        add_transition(move_state, move_nothing,
                       [&] () { rollback(); createToNothing(); });

        // MoveOnState -> MoveOnState
        // We don't do anything, the constraint should not move.

        // MoveOnState -> MoveOnEvent
        add_transition(move_state, move_event,
                       [&] () { rollback(); createToEvent(); });

        // MoveOnState -> MoveOnTimeNode
        add_transition(move_state, move_timenode,
                       [&] () { rollback(); createToTimeNode(); });


        /// MoveOnEvent -> ...
        // MoveOnEvent -> MoveOnNothing
        add_transition(move_event, move_nothing,
                       [&] () { rollback(); createToNothing(); });

        // MoveOnEvent -> MoveOnState
        add_transition(move_event, move_state,
                       [&] () { rollback(); createToState(); });

        // MoveOnEvent -> MoveOnEvent
        make_transition<MoveOnEvent_Transition>(move_event, move_event, *this);

        // MoveOnEvent -> MoveOnTimeNode
        add_transition(move_event, move_timenode,
                       [&] () { rollback(); createToTimeNode(); });


        /// MoveOnTimeNode -> ...
        // MoveOnTimeNode -> MoveOnNothing
        add_transition(move_timenode, move_nothing,
                       [&] () { rollback(); createToNothing(); });

        // MoveOnTimeNode -> MoveOnState
        add_transition(move_timenode, move_state,
                       [&] () { rollback(); createToState(); });
//.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:i-score,代码行数:101,代码来源:ScenarioCreation_FromEvent.cpp


注:本文中的QState::setObjectName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。