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


C++ QMap::first方法代码示例

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


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

示例1: showHelpForKeyword

void HelpBrowser::showHelpForKeyword(const QString &id)
{
	if (mEngine->engine())
	{
		QMap<QString, QUrl> links = mEngine->engine()->linksForIdentifier(id);
		if (links.count())
		{
			setSource(links.first());
		}
	}
}
开发者ID:c0ns0le,项目名称:CustusX,代码行数:11,代码来源:cxHelpBrowser.cpp

示例2: foreach

Resultat Agent1::chooseResult() const
{
    QMap<QPair<const Experience, const Resultat>, Interaction> temp = m_motivation.systeme();

    Resultat ret;
    int motiv = 0;
    if(!temp.isEmpty())
    {
        motiv = temp.first().motivation();
        ret = temp.first().resultat();
    }

    foreach(const Interaction& it, temp)
    {
        if(it.motivation() > motiv)
        {
            ret = it.resultat();
            motiv = it.motivation();
        }
    }

    return ret;
}
开发者ID:Chewnonobelix,项目名称:IA-devellopemental,代码行数:23,代码来源:agent.cpp

示例3: showSearchResult

// 显示在线音乐搜索结果
void NetWorkWidget::showSearchResult(QMap<QString, QStringList> musicList)
{
    musicUrls = musicList.first();
    QString musicName = musicList.firstKey();

    while(tableWidget->rowCount())
    {
        tableWidget->removeRow(tableWidget->rowCount()-1);
    }

    for (int i=0; i<musicUrls.count(); ++i)
    {
        tableWidget->insertRow(tableWidget->rowCount());
        tableWidget->setItem(tableWidget->rowCount()-1, 0, new QTableWidgetItem(musicName));
        tableWidget->setItem(tableWidget->rowCount()-1, 1, new QTableWidgetItem("试听"));
        tableWidget->setItem(tableWidget->rowCount()-1, 2, new QTableWidgetItem("下载"));
    }
}
开发者ID:caoyanjie,项目名称:Sprite,代码行数:19,代码来源:networkwidget.cpp

示例4: engine

// --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------

TEST_CASE("org.custusx.help: HelpEngine loads a page", "[unit][plugins][org.custusx.help]")
{
	cx::DataLocations::setTestMode();

	cx::HelpEnginePtr engine(new cx::HelpEngine);
	REQUIRE(engine->engine());

	QString id = "user_doc_overview";
	QMap<QString, QUrl> links = engine->engine()->linksForIdentifier(id);
	REQUIRE(links.size()==1);

	CHECK(QString(links.first().toString()).contains(id));
}


TEST_CASE("org.custusx.help: HelpWidget displays initial help text", "[unit][plugins][org.custusx.help]")
{
	cxtest::TestHelpFixture fixture;
	fixture.setupHelpBrowserInsideMainWindow();

	CHECK(fixture.browser->source().toString().contains("user_doc_overview"));
	// this can be a tricky test for overriding applications: they must have this string in the main page in order to
	// succeed.
	CHECK(fixture.browser->toPlainText().contains("CustusX"));
	CHECK(fixture.browser->toPlainText().contains("User Documentation"));

//	fixture.printBrowserContents();
开发者ID:SINTEFMedtek,项目名称:CustusX,代码行数:31,代码来源:cxtestHelpPlugin.cpp

示例5: file

void ConfigTreeObject_Math::slotMathAlarm_Level4OutTypeChanged()
{
    QVariant value = ConfigTreeObject::getConfigObject(MATH_DELEGATE_ALARM_LVL4_OUTTYPE)->getData();

    QFile file(XML_MATH_ALARM_LVL4_OUTTYPE);
    if(!file.open(QFile::ReadOnly | QFile::Text)){
        qWarning()<< "Can't open the file:MathAlarm_Lvl4Output!";
    }else{
        XmlConfigParser::parseValueChangeXml(file, value);
        file.close();
    }

    quint32 valueNo = value.toUInt();
    if(0 == valueNo) {

    } else if (1 == valueNo) {
        QMap<QString, quint32> curChanDO = CfgChannel::instance()->getExistChannelDO();
        if(!curChanDO.isEmpty()) {
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_ALARM_LVL4_OUTNO)->changeData(curChanDO.first(), false);
        }
    } else if (2 == valueNo) {
        ConfigTreeObject::getConfigObject(MATH_DELEGATE_ALARM_LVL4_OUTNO)->changeData(1, false);
    }
}
开发者ID:urielyan,项目名称:F270,代码行数:24,代码来源:configtreeobject_Math.cpp

示例6: qDebug

void Level::rubeB2DLevel(b2dJson& mBox2dJson)
{
    if(mJsonFilePath.isEmpty()){
        qDebug() << " mJsonFilePath is empty ";
    }

    if(!Util::fileExists(mJsonFilePath)){
        qDebug() << " Level: "  << mJsonFilePath << " does not exists. ";
        return;
    }
    std::string worldJson = Util::readFileAsStdString(mJsonFilePath);

    std::string errorstring;
    b2World* w = mBox2dJson.readFromString(worldJson,errorstring,mWorld.get());

    if(w){
        //custom properties to be read
        int useWorldGravity = mBox2dJson.getCustomInt(w,"use_world_gravity",0);
        float grav_x ;
        float grav_y ;
        if(useWorldGravity){
            grav_x = mBox2dJson.getCustomFloat(w,"world_gravity_x",0);
            grav_y = mBox2dJson.getCustomFloat(w,"world_gravity_y",0);
             w->SetGravity(b2Vec2(grav_x,grav_y));
        }

        qDebug() << " Reading jsonfile Complete!  \n\t ";


        //check if there is a camera body
        //used for camera bounds. (Square body)
        b2Body* cam_body = mBox2dJson.getBodyByName("camera");
        if(cam_body){
            b2Fixture* cam_fixture = cam_body->GetFixtureList();
            if(cam_fixture){
                QRectF bbox = Box2dUtil::toQRectF(cam_fixture->GetAABB(0));
                this->setCameraBoundary(bbox);
                cam_body->SetActive(false);
#ifdef D_PARSE
                qDebug() << "Bounding box "<< bbox;
#endif
            }
#ifdef D_PARSE
            qDebug() << "camera found!";
#endif
        }

        //TODO: this is sooooo lazy,
        for(QVariant v:mLevelActorMapping){
            QMap<QString,QVariant> tmp = v.toMap();
            qDebug() << " Mapped LevelActorrr  " << tmp;

            mLevelActorMap.insert(tmp.firstKey(),tmp.first().toString());
        }


        Engine* engine = Engine::getInstance();
        QQmlEngine* qmlEngine = engine->getQmlEngine();

        // Check if bodies are referenced in the Actor Mapping Category
        Body* b = nullptr;
        std::string actorTypeString;
        b2Body* body = mWorld->GetBodyList();
        while(body){
            actorTypeString = mBox2dJson.getCustomString(body,"actorType");
            if(actorTypeString.empty() || actorTypeString == "none"){
                b = Body::BodyFromb2Body(body);
                if(b) b->setParent(this);
            }else{
                actorFromMapping(body,actorTypeString,qmlEngine);
            }
            body = body->GetNext();
        }

        // Use Nodes for parsing the specific type of node
        //QList<LevelNode*> nodes = findChildren<LevelNode*>();
        for(LevelNode* node: findChildren<LevelNode*>())  {
            switch(node->type())  {
                case LevelNode::BODY_REFERENCE:{
                    actorReferenceBody(node);
                }break;
                case LevelNode::ACTOR_COMPONENT_W_BODY:{
                    actorComponentWithBody(node,qmlEngine);
                }break;
                default:{
                    qDebug() << " unknown LevelNode type = " << node->type();
                }
            }
        }

       //check for images associated with the body.
       int imageCount = 0;
       body = nullptr;
       b = nullptr;
       QString image_path;
       Actor* actor = nullptr;
       ImageRenderer* img_renderer = nullptr;
       std::vector<b2dJsonImage*> world_images;
       imageCount = mBox2dJson.getAllImages(world_images);

//.........这里部分代码省略.........
开发者ID:adderly,项目名称:VoltAir,代码行数:101,代码来源:Level.cpp


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