本文整理汇总了C++中setCurrentState函数的典型用法代码示例。如果您正苦于以下问题:C++ setCurrentState函数的具体用法?C++ setCurrentState怎么用?C++ setCurrentState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setCurrentState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stateNode
void StatesEditorView::removeState(int nodeId)
{
try {
if (nodeId > 0 && hasModelNodeForInternalId(nodeId)) {
ModelNode stateNode(modelNodeForInternalId(nodeId));
Q_ASSERT(stateNode.metaInfo().isSubclassOf("QtQuick.State", -1, -1));
NodeListProperty parentProperty = stateNode.parentProperty().toNodeListProperty();
if (parentProperty.count() <= 1) {
setCurrentState(baseState());
} else if (parentProperty.isValid()){
int index = parentProperty.indexOf(stateNode);
if (index == 0)
setCurrentState(parentProperty.at(1));
else
setCurrentState(parentProperty.at(index - 1));
}
stateNode.destroy();
}
} catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description());
}
}
示例2: ROS_INFO
void RoboState::messageCallback(const nav_simple::mymsg::ConstPtr& msg)
{
// only accept message if movement is not in progress
if(getCurrentState()==NEUTRAL)
{
if(msg->x==0 && msg->y==0)
ROS_INFO("No reason to move a distance of 0. Message not sent.");
else{
ROS_INFO("X and Y coordinates sent were: x:%f y:%f", msg->x, msg->y);
setX(msg->x);
setY(msg->y);
ROS_INFO("xCoord is: %f. yCoord is: %f", getX(), getY());
// we don't need to face backward since initial movement is forward
if(getX() >= 0){
setCurrentState(TURN_LEFT_90);
}
// need to face backward since initial movement is backward
// (want bumper sensors to be useful)
else{
//setCurrentState(TURN_NEG_X);
setCurrentState(TURN_LEFT_90);
}
//setErr(sqrt(pow(getX(),2)+pow(getY(),2))*.1);
setErr(.1);
}
// need to determine what direction we will ultimately face
setYawGoal(90);
// determineYawGoal();
}
else
ROS_INFO("Cannot accept message. Movement still in progress.");
}
示例3: setCurrentState
void ConfigChannel::close() {
setCurrentState(DISCONNECTING);
if (configSocket != -1) {
shutdown(configSocket, SHUT_RDWR);
::close(configSocket);
configSocket = -1;
}
setCurrentState(DISCONNECTED);
Channel::close();
}
示例4: modelNodeForInternalId
void StatesEditorView::synchonizeCurrentStateFromWidget()
{
if (!model())
return;
int internalId = m_statesEditorWidget->currentStateInternalId();
if (internalId > 0 && hasModelNodeForInternalId(internalId)) {
ModelNode node = modelNodeForInternalId(internalId);
QmlModelState modelState(node);
if (modelState.isValid() && modelState != currentState())
setCurrentState(modelState);
} else {
setCurrentState(baseState());
}
}
示例5: setCurrentState
void ActionRootState::updateActionState()
{
if (valid()) {
ActionStateParser* oldParser = m_actionGroup->actionStateParser();
m_actionGroup->setActionStateParser(&m_parser);
QVariantMap state = m_actionGroup->actionState(m_actionName).toMap();
m_actionGroup->setActionStateParser(oldParser);
setCurrentState(state);
} else {
setCurrentState(QVariantMap());
}
}
示例6: switch
void Animal::DoAction(State action)
{
switch (action)
{
case Moving:
setCurrentState(Moving); break;
case Attacking:
setCurrentState(Attacking); break;
case Eating:
setCurrentState(Eating); break;
case SearchFood:
setCurrentState(SearchFood); break;
case Sleeping:
setCurrentState(Sleeping); break;
}
}
示例7: QObject
SimondConnector::SimondConnector(QObject *parent) :
QObject(parent), state(Unconnected),
socket(new QSslSocket(this)),
timeoutTimer(new QTimer(this)),
response(new QDataStream(socket)),
mic(new SoundInput(SOUND_CHANNELS, SOUND_SAMPLERATE, this)),
passThroughSound(false)
{
connect(this, SIGNAL(connectionState(ConnectionState)), this, SLOT(setCurrentState(ConnectionState)));
connect(socket, SIGNAL(readyRead()), this, SLOT(messageReceived()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(socketError()));
connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished()));
connect(socket, SIGNAL(encrypted()), this, SLOT(connectionEstablished()));
connect(socket, SIGNAL(disconnected()), this, SLOT(connectionLost()));
connect(mic, SIGNAL(error(QString)), this, SIGNAL(error(QString)));
connect(mic, SIGNAL(microphoneLevel(int,int,int)), this, SIGNAL(microphoneLevel(int,int,int)));
connect(mic, SIGNAL(listening()), this, SLOT(startRecording()));
connect(mic, SIGNAL(complete()), this, SLOT(commitRecording()));
connect(mic, SIGNAL(readyRead()), this, SLOT(soundDataAvailable()));
connect(timeoutTimer, SIGNAL(timeout()), this, SLOT(timeoutReached()));
timeoutTimer->setSingleShot(true);
timeoutTimer->setInterval(SOCKET_TIMEOUT);
}
示例8: findStateUsage
bool Keymap::removeState(const QString& name, bool force) {
QMap<QString, State*>::Iterator it = states.find(name);
if (it == states.end()) {
return false;
}
State* state = it.data();
QList<Action> acts = findStateUsage(state);
if (!acts.isEmpty()) {
if (!force) {
return false;
} else {
for(Action* a = acts.first(); a != 0; a = acts.next()) {
a->setState(0);
}
}
}
if (state == currentState) {
if (states.begin() != states.end()) {
setCurrentState(states.begin().data());
}
}
states.remove(it);
delete state;
lsmapInSync = false;
return true;
}
示例9: updateShellCommand
void CAbstractUpdateController::launchUpdate()
{
QString proc;
QStringList args;
QString DLType;
updateShellCommand(proc, args);
//if jail is present
if (mJailPrefix.length())
{
args.push_front(proc);
args.push_front(mJailPrefix);
proc = "chroot";
}
mUpdProc.start(proc,args);
if (!mUpdProc.waitForStarted())
{
reportError(tr("Can not execute update shell command"));
return;
}
DLType = dlType();
if (DLType.length())
mUpdProc.setDLType(DLType);
if (currentState() != eUPDATING)
setCurrentState(eUPDATING);
}
示例10: setCurrentState
void Widget::OnBtnPressed() {
setCurrentState(PRESSED);
EvtFunc *func = funcs[EVT_BTNRELEASED].func;
void *data = funcs[EVT_BTNRELEASED].data;
if (func)
func(this, data);
}
示例11: pix
void BaseAnimatedStackedWidget::setCurrentWidget(QWidget* widget)
{
if (!widget)
return;
#ifdef ENABLE_YATOOLBOX_ANIMATION
if (isVisible()) {
QPixmap pix(normalPage()->size());
normalPage()->render(&pix);
animationPage_->setStaticPixmap(pix);
stackedWidget_->setCurrentWidget(animationPage_);
setCurrentState(widget);
}
#endif
#ifndef ENABLE_YATOOLBOX_ANIMATION
setUpdatesEnabled(false);
#endif
setCurrentWidget_internal(widget);
#ifndef ENABLE_YATOOLBOX_ANIMATION
if (isVisible()) {
activateNormalPageLayout();
setUpdatesEnabled(true);
}
#endif
#ifdef ENABLE_YATOOLBOX_ANIMATION
if (isVisible()) {
setNewState();
animationPage_->start();
}
#endif
}
示例12: setCurrentState
void Arrow::updateEnter(float fDeltaTime)
{
m_bActive = true;
// Updates move
setCurrentState(Move);
}
示例13: QObject
FQTermUniteSessionContext::FQTermUniteSessionContext(FQTermUniteSession* session) : QObject(session), session_(session) {
stateTable_[WELCOME] = new FQTermWelcomeState(this);
stateTable_[EXITING] = new FQTermExitState(this);
stateTable_[READING] = new FQTermReadingState(this);
stateTable_[HELP] = new FQTermHelpState(this);
setCurrentState(WELCOME);
}
示例14: rootStateGroup
void StatesEditorView::addState()
{
// can happen when root node is e.g. a ListModel
if (!QmlItemNode::isValidQmlItemNode(rootModelNode()))
return;
QStringList modelStateNames = rootStateGroup().names();
QString newStateName;
int index = 1;
while (true) {
newStateName = QString("State%1").arg(index++);
if (!modelStateNames.contains(newStateName))
break;
}
try {
if ((rootStateGroup().allStates().count() < 1) && //QtQuick import might be missing
(!model()->hasImport(Import::createLibraryImport("QtQuick", "1.0"), true, true)))
model()->changeImports(QList<Import>() << Import::createLibraryImport("QtQuick", "1.0"), QList<Import>());
ModelNode newState = rootStateGroup().addState(newStateName);
setCurrentState(newState);
} catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description());
}
}
示例15: rabbit
GameScene::GameScene()
: rabbit(NULL)
, crosshairs(NULL)
, landscape(NULL)
, coin(NULL)
, timeDisplay(NULL)
, gameThread(NULL)
, timeManager(new TimeManager())
, input(GESTURE_NOTHING)
, currentState(UNDEFINED)
, stones()
, gameOver(NULL)
, menu(NULL)
, beginAnimation(NULL)
, tapHelp(NULL)
, tiltHelp(NULL)
, currentTint(DEFAULT_TINT_MENU)
, masterScale(1.)
, w(0)
, h(0)
, viewport_width(0)
, viewport_height(0)
{
setCurrentState(INTRO);
beginAnimation = new BeginAnimation(this);
}