• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ doAction函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中doAction函数的典型用法代码示例。如果您正苦于以下问题:C++ doAction函数的具体用法?C++ doAction怎么用?C++ doAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: qSort

void CustomActions::set(QList<Command> cmds)
{
    qSort(cmds);
    bool diff=cmds.length()!=commands.length();

    if (!diff) {
        for (int i=0; i<cmds.length() && !diff; ++i) {
            if (commands[i]!=cmds[i]) {
                diff=true;
            }
        }
    }
    QMenu *m=menu();
    if (diff) {
        foreach (const Command &cmd, commands) {
            m->removeAction(cmd.act);
            disconnect(cmd.act, SIGNAL(triggered()), this, SLOT(doAction()));
            cmd.act->deleteLater();
        }
        commands.clear();

        foreach (const Command &cmd, cmds) {
            Command c(cmd);
            c.act=new Action(c.name, this);
            m->addAction(c.act);
            commands.append(c);
            connect(c.act, SIGNAL(triggered()), this, SLOT(doAction()));
        }
开发者ID:Civil,项目名称:cantata,代码行数:28,代码来源:customactions.cpp


示例2: switch

void PolycodeEditor::handleEvent(Event *event) {    
    
	if(event->getDispatcher() == CoreServices::getInstance()->getCore() && enabled) {
		switch(event->getEventCode()) {

			// Only copypaste of more complex IDE entities is handled here.
			// Pure text copy/paste is handled in:
			// Modules/Contents/UI/Source/PolyUITextInput.cpp
			case Core::EVENT_SELECT_ALL:
			{
                selectAll();
            }
            break;
			case Core::EVENT_COPY:
			{
				void *data = NULL;
				String dataType = Copy(&data);
				if(data) {
					globalClipboard->setData(data, dataType, this);
				}
			}
			break;
			case Core::EVENT_PASTE:
			{
				if(globalClipboard->getData()) {
					Paste(globalClipboard->getData(), globalClipboard->getType());
				}
			}
			break;
			case Core::EVENT_UNDO:
			{
				if(editorActions.size() > 0 && currentUndoPosition >= 0) {
				doAction(editorActions[currentUndoPosition].actionName, editorActions[currentUndoPosition].beforeData);
				currentUndoPosition--;
				if(currentUndoPosition < -1) {
					currentUndoPosition = -1;
				}
				}				
			}
			break;
			case Core::EVENT_REDO:
			{
				if(editorActions.size() > 0) {			
				currentUndoPosition++;
				if(currentUndoPosition > editorActions.size()-1) {
					currentUndoPosition = editorActions.size()-1;
				} else {
					doAction(editorActions[currentUndoPosition].actionName, editorActions[currentUndoPosition].afterData);
				}
				}
			}
			break;			
		}
	}
}
开发者ID:carlosmarti,项目名称:Polycode,代码行数:55,代码来源:PolycodeEditor.cpp


示例3: if

bool Monopoly::CardDeck::drawCard(int player, int roll)
{
  int type=0;
  bool prision=false;
  int cardIndex;
  Card card;				// holds card which has been drawn
  
  if(strcmp(m_fileName,"chance.deck")==0) type =1;
  else if(strcmp(m_fileName,"community.deck")==0) type =2;

  cardIndex = takeCardFromPile();  	// draws a card and takes it from the deck
  m_theGame->notifyCardDrawn(type, cardIndex);
  

  card=m_cardDefinitions[cardIndex-1];
  putCardBack(cardIndex);			//put a card back into the deck
  if(card.actionParam==6)
  {
    m_numberCards--;
    prision=true;
  }
 doAction(card, player, roll);
  
  
  return prision;
}
开发者ID:Ps2Fino,项目名称:Monopoly,代码行数:26,代码来源:CardDeck.cpp


示例4: switch

/** Intersection with an object */
bool Wall::whenIntersect(WObject *pcur, WObject *pold)
{
  switch (pcur->type) {
  case USER_TYPE:
  case THING_TYPE:
  case BALL_TYPE:
    projectPosition(pcur, pold);
    break;
  case ICON_TYPE:
    // stick the icon on the wall
    doAction(ICON_TYPE, Icon::STICK, this, pcur, 0, 0);
    pold->copyPosAndBB(pcur->pos);
    break;
  case BULLET_TYPE:
  case DART_TYPE:
    pcur->toDelete();
    break;
  case STEP_TYPE:	// escalator
  case GUIDE_TYPE:
  case WEB_TYPE:
    return false;
  default:
    pold->copyPosAndBB(pcur->pos);
  }
  return true;
}
开发者ID:philippedax,项目名称:vreng,代码行数:27,代码来源:wall.cpp


示例5: tr

void QgsMapToolFeatureAction::canvasReleaseEvent( QMouseEvent *e )
{
  QgsMapLayer *layer = mCanvas->currentLayer();

  if ( !layer || layer->type() != QgsMapLayer::VectorLayer )
  {
    QMessageBox::warning( mCanvas,
                          tr( "No active vector layer" ),
                          tr( "To run an action, you must choose a vector layer by clicking on its name in the legend" ) );
    return;
  }

  if ( !mCanvas->layers().contains( layer ) )
  {
    // do not run actions on hidden layers
    return;
  }

  QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
  if ( vlayer->actions()->size() == 0 && QgsMapLayerActionRegistry::instance()->mapLayerActions( vlayer ).size() == 0 )
  {
    QMessageBox::warning( mCanvas,
                          tr( "No actions available" ),
                          tr( "The active vector layer has no defined actions" ) );
    return;
  }

  if ( !doAction( vlayer, e->x(), e->y() ) )
    QgisApp::instance()->statusBar()->showMessage( tr( "No features at this position found." ) );
}
开发者ID:Aladar64,项目名称:QGIS,代码行数:30,代码来源:qgsmaptoolfeatureaction.cpp


示例6: doParse

static p_action doParse( parse_stack *resource_state )
{
    p_action    what;
    bool        error_state;
    YYTOKENTYPE token;
    int         token_count = 0;

    error_state = false;

    do {
        token = yylexOS2();
        if( error_state ) {
            token_count++;
            if( token_count >= YYERRORTHRESHOLD ) {
                error_state = false;
            }
        }

        what = doAction( token, resource_state );

        if( what == P_SYNTAX ) {
            handleError( token, resource_state, error_state );
            error_state = true;
            yysyntaxerror = true;
            ErrorHasOccured = true;
            token_count = 0;
        } else if( token == Y_INTEGER && yylval.intinfo.str != NULL ) {
            RcMemFree( yylval.intinfo.str );
            yylval.intinfo.str = NULL;
        }
    } while( what != P_ACCEPT && what != P_ERROR );

    return( what );
}
开发者ID:NoSuchProcess,项目名称:open-watcom-v2,代码行数:34,代码来源:yydrivr2.c


示例7: doAction

    bool Session::contentRemove( const Content* content )
    {
      if( m_state < Pending )
        return false;

      return doAction( ContentRemove, content );
    }
开发者ID:Barrett17,项目名称:Caya,代码行数:7,代码来源:jinglesession.cpp


示例8: doAction

bool Plant::startAction()
{
    if (!isAction) {
        doAction(0.0f);
    }
    return true;
}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:7,代码来源:BackgroundLayer_Forest.cpp


示例9: doAction

// TODO: Check if clickables overlap and warn accordingly
void gsGame::switchToView() {
	for (auto& pair : directions) {
		pair.second = "";
	}
	clickAreas.clear();
	sprites.clear();
	items.clear();
	line1.setText("");
	line2.setText("");

	for (auto module : activeModules) {
		module->leave();
	}
	activeModules.clear();

	bg = g_tm->getTexture("game", "black.png");

	if (transitionStart != -1 && SDL_GetTicks() - transitionStart < transitionTime) {
		return;
	}

	if (view.find("onLeave") != view.end()) {
		for (auto action : view["onLeave"]) {
			doAction(action.get<std::string>());
		}
	}

	std::string file = "media/views/" + nextView + ".json";
	view = jsonFromFile(file);

	if (view.find("bg") != view.end()) {
		bg = g_tm->getTexture("views", view["bg"]);
	} else {
		bg = g_tm->getTexture("views", nextView + ".png");
	}

	for (auto dir : possibleDirections) {
		directions[dir] = "";
		if (view.find(dir) != view.end()) {
			directions[dir] = view[dir].get<std::string>();
		}
	}

	extractModifiers(view);

	if (view.find("triggers") != view.end()) {
		json triggers = view["triggers"];
		for (auto trigger : triggers) {
			if (checkCondition(trigger["condition"].get<std::string>())) {
				extractModifiers(trigger["modifiers"]);
				break;
			}
		}
	}

	// Make sure we don't change view again
	transitionStart = -1;
	transitionTime = -1;
	nextView = "";
}
开发者ID:bobismijnnaam,项目名称:anuclearcrossroads,代码行数:61,代码来源:gsGame.cpp


示例10: memset

void PutInfo::putIconCB()
{
  char infos[BUFSIZ];
  memset(infos, 0, sizeof(infos));
  if (url.c_str()) {
    strcat(infos, "<url=\"");
    strcat(infos, url.c_str());
    strcat(infos, "\">&");
  }
  if (file.c_str()) {
    strcat(infos, "<file=\"");
    strcat(infos, file.c_str());
    strcat(infos, "\">&");
  }
  if (ofile.c_str()) {
    strcat(infos, "<ofile=\"");
    strcat(infos, ofile.c_str());
    strcat(infos, "\">&");
  }
  if (name.c_str()) {
    strcat(infos, "<name=\"");
    strcat(infos, name.c_str());
    strcat(infos, "\">&");
  }
  if (icon.c_str()) {
    strcat(infos, "<icon=\"");
    strcat(infos, icon.c_str());
    strcat(infos, "\">&");
  }
  doAction(ICON_TYPE, Icon::CREATE, localuser, infos, 0, 0);
}
开发者ID:philippedax,项目名称:vreng,代码行数:31,代码来源:message.cpp


示例11: while

// NPP_ call translator
DWORD nsPluginThread::callNPP(npapiAction aAction, DWORD aP1, DWORD aP2, 
                              DWORD aP3, DWORD aP4, DWORD aP5, 
                              DWORD aP6, DWORD aP7)
{
  // don't enter untill thread is ready
  while (isBusy()) {
    Sleep(0);
  }

  mP1 = aP1;
  mP2 = aP2;
  mP3 = aP3;
  mP4 = aP4;
  mP5 = aP5;
  mP6 = aP6;
  mP7 = aP7;

  doAction(aAction);

  // don't return untill thread is ready
  while (isBusy()) {
    Sleep(0);
  }

  return NPERR_NO_ERROR;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:27,代码来源:plugin.cpp


示例12: main

int main(int argc, char** argv)
{
	aLog::init("c:\\file.log",aLog::MT_DEBUG);
	printf("dwd1\n");
	if(argc <=1) 
	{
		showError("", invalid_usage);
		return 1;
	}
	printf("dwd\n");
	QStringList args;
	fillArgsFromArgv(&args, argv, argc);
	QString command = parseCommand(&args);
	if(!isValidCommand(command))
	{
		showError(command, invalid_command);
		return 1;
	}
	QString argument = parseArgument(&args);
	if(!isValidArgument(argument))
	{
		showError(argument, invalid_argument);
		return 2;
	}
	QStringList options;
	parseOptions(&args, &options);
	removeInvalidOptions(&options);
	int res = doAction(command, argument, &options);
	aLog::close();
	return res;
} 
开发者ID:app,项目名称:ananas-labs,代码行数:31,代码来源:main.cpp


示例13: while

void *playFile(void *arg)
{
//	int old = MODE_PLAY;

	// graj dopóty nie ma nakazano koñca
	while ( mode != MODE_QUIT )
	{
		pthread_mutex_lock(&mutexPlay);
		if ( mode == MODE_PLAY )
		{
			// próba wej¶cia w tryb grania
			while (( mode == MODE_PLAY ) && (playOneFrame()));
			pthread_mutex_unlock(&mutexPlay);
			if ( mode == MODE_PLAY )
			{
				doAction(ACTION_NEXT, NULL);
			}
		}
		else
		{
			pthread_mutex_unlock(&mutexPlay);
		}
	}

	return NULL;
}
开发者ID:rojekabc,项目名称:okienkoc,代码行数:26,代码来源:rmp3.c


示例14: doAction

void LidWatcherd::lidChanged(bool closed)
{
    if (closed)
    {
        doAction(mSettings.value(LIDCLOSEDACTION_KEY).toInt());
    }
}
开发者ID:surlykke,项目名称:lxde-powermanagement,代码行数:7,代码来源:lidwatcherd.cpp


示例15: devicestream

int DeviceManager::executeScene(std::wstring singledevice, int groupDeviceId) {
	std::wstringstream devicestream(singledevice);

	const int deviceParameterLength = 3;
	std::wstring deviceParts[deviceParameterLength] = {L"", L"", L""};
	std::wstring devicePart = L"";
	int i = 0;
	while(std::getline(devicestream, devicePart, L':') && i < deviceParameterLength) {
		deviceParts[i] = devicePart;
		i++;
	}

	if(deviceParts[0] == L"" || deviceParts[1] == L"") {
		return TELLSTICK_ERROR_UNKNOWN;  // malformed or missing parameter
	}

	int deviceId = TelldusCore::wideToInteger(deviceParts[0]);
	if(deviceId == groupDeviceId) {
		return TELLSTICK_ERROR_UNKNOWN;  // the scene itself has been added to its devices, avoid infinite loop
	}
	int method = Device::methodId(TelldusCore::wideToString(deviceParts[1]));  // support methodparts both in the form of integers (e.g. TELLSTICK_TURNON) or text (e.g. "turnon")
	if(method == 0) {
		method = TelldusCore::wideToInteger(deviceParts[1]);
	}
	unsigned char devicedata = 0;
	if(deviceParts[2] != L"") {
		devicedata = TelldusCore::wideToInteger(deviceParts[2]);
	}

	if(deviceId > 0 && method > 0) {  // check for format error in parameter "devices"
		return doAction(deviceId, method, devicedata);
	}

	return TELLSTICK_ERROR_UNKNOWN;
}
开发者ID:4ib3r,项目名称:domoticz,代码行数:35,代码来源:DeviceManager.cpp


示例16: messageEmitted

void QgsMapToolFeatureAction::canvasReleaseEvent( QMouseEvent *e )
{
  QgsMapLayer *layer = mCanvas->currentLayer();

  if ( !layer || layer->type() != QgsMapLayer::VectorLayer )
  {
    emit messageEmitted( tr( "To run an action, you must choose an active vector layer." ), QgsMessageBar::INFO );
    return;
  }

  if ( !mCanvas->layers().contains( layer ) )
  {
    // do not run actions on hidden layers
    return;
  }

  QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
  if ( vlayer->actions()->size() == 0 && QgsMapLayerActionRegistry::instance()->mapLayerActions( vlayer ).size() == 0 )
  {
    emit messageEmitted( tr( "The active vector layer has no defined actions" ), QgsMessageBar::INFO );
    return;
  }

  if ( !doAction( vlayer, e->x(), e->y() ) )
    QgisApp::instance()->statusBar()->showMessage( tr( "No features at this position found." ) );
}
开发者ID:chhao91,项目名称:QGIS,代码行数:26,代码来源:qgsmaptoolfeatureaction.cpp


示例17: switch

	void ZombieEngine::carEvent(Car* car, int eventType) {
		switch (eventType) {
			case Car::ACTION:
				doAction(car);
				break;
		}
	}
开发者ID:mwthinker,项目名称:Zombie,代码行数:7,代码来源:zombieengine.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ doBooleanCommand函数代码示例发布时间:2022-05-30
下一篇:
C++ dns_test_begin函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap