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


C++ setCurrentState函数代码示例

本文整理汇总了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());
    }
}
开发者ID:edwardZhang,项目名称:qt-creator,代码行数:25,代码来源:stateseditorview.cpp

示例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.");
}
开发者ID:aytung,项目名称:GCC_Odomfeedback_Calibration_S16,代码行数:34,代码来源:nav.cpp

示例3: setCurrentState

void ConfigChannel::close() {
	setCurrentState(DISCONNECTING);
	if (configSocket != -1) {
		shutdown(configSocket, SHUT_RDWR);
		::close(configSocket);
		configSocket = -1;
	}
	setCurrentState(DISCONNECTED);
	Channel::close();
}
开发者ID:ankit5311,项目名称:mavwork,代码行数:10,代码来源:ConfigChannel.cpp

示例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());
    }
}
开发者ID:edwardZhang,项目名称:qt-creator,代码行数:15,代码来源:stateseditorview.cpp

示例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());
    }
}
开发者ID:jonjahren,项目名称:unity8,代码行数:15,代码来源:actionrootstate.cpp

示例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;
	}
}
开发者ID:igmehandzhiev,项目名称:GOD,代码行数:16,代码来源:Animal.cpp

示例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);
}
开发者ID:KDE,项目名称:simon-tools,代码行数:26,代码来源:simondconnector.cpp

示例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;
}
开发者ID:opieproject,项目名称:opie,代码行数:33,代码来源:zkb.cpp

示例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);
}
开发者ID:DJHartley,项目名称:pcbsd,代码行数:30,代码来源:updatecontroller.cpp

示例10: setCurrentState

void Widget::OnBtnPressed() {
	setCurrentState(PRESSED);
	EvtFunc *func = funcs[EVT_BTNRELEASED].func;
	void *data = funcs[EVT_BTNRELEASED].data;
	if (func)
		func(this, data);
}
开发者ID:cactusmutant,项目名称:Square,代码行数:7,代码来源:widget.cpp

示例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
}
开发者ID:AlekSi,项目名称:Jabbin,代码行数:33,代码来源:baseanimatedstackedwidget.cpp

示例12: setCurrentState

void Arrow::updateEnter(float fDeltaTime)
{
    m_bActive = true;
    
    // Updates move
    setCurrentState(Move);
}
开发者ID:vinhsteven,项目名称:Hero,代码行数:7,代码来源:Arrow.cpp

示例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);
}
开发者ID:ashang,项目名称:fqterm,代码行数:7,代码来源:session.cpp

示例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());
    }
}
开发者ID:edwardZhang,项目名称:qt-creator,代码行数:26,代码来源:stateseditorview.cpp

示例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);
}
开发者ID:mardy,项目名称:trg2,代码行数:26,代码来源:gamescene.cpp


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