本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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()));
}
示例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();
}
示例7: createFSMState
QState* createFSMState(const QString& stateName,QState * parent)
{
QState *result = new QState(parent);
result->setObjectName(stateName);
return result;
}
示例8: createState
//helper
static QState* createState(QString name, QState *parent=0)
{
QState *result = new QState(parent);
result->setObjectName(name);
return result;
}
示例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(); });
//.........这里部分代码省略.........