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


C++ QObject::getString方法代码示例

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


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

示例1: init

/*!
  Sets internal pointers to frequently used QML items, thus reducing the overhead
  of repeated searching for them at runtime.
  */
void CcfQmlBaseScenario::init()
{
    if (mScenarioFile != "") {
        QStringList unitSideList;
        QObject *unitsLoader = child("unitsLoader");
        QObject *unitItem = unitsLoader->property("unitsItem").value<QObject *>();
        QObject *map = child("map");

        if (unitItem->objectName() != "Campaign") {
            // This is a single scenario
            map->set("source", unitItem->getString("mapFile"));
            QObjectList tempList = unitItem->children();

            for (int i = 0; i < tempList.count(); ++i) {
                CcfQmlBaseUnit *unit = ccfUnit(tempList.at(i));
                if ((unit != 0) && (unit->property("unitIndex").isValid())) {
                    unit->setUnitIndex(i);
                    connect(this, &CcfQmlBaseScenario::togglePause,
                            unit, &CcfQmlBaseUnit::togglePause);
                    connect(unit, &CcfQmlBaseUnit::actionFinished,
                            this, &CcfQmlBaseScenario::actionFinished);
                    connect(unit, &CcfQmlBaseUnit::movementStateChange,
                            this, &CcfQmlBaseScenario::handleUnitMovement);
                    unitSideList.append(unit->getUnitSide());
                    mUnits.append(unit);
                }
            }

            mMapItem = map->property("mapItem").value<CcfQmlBaseMap *>();

            if(mMapItem != 0)
                mMapItem->setUnits(mUnits);
            else
                mlogger->error("MapItem object was not properly initialised",
                               "Robin Hood is a jerk");
        } else {
            // This is a campaign
            // TODO: add some clever code here ;)
        }

        mScenarioState->setAvailableSides(unitSideList);

        mAimLine = item("aimLine");
        mGameArea = item("gameArea");
        mZoomArea = item("zoomArea");
        mContextMenu = item("contextMenu");
        mEffectsTimer = child("effectsTimer");
        mRotationTimer = child("rotationTimer");
        mFollowingTimer = child("followingTimer");
        mMouseAreaMain = child("mouseAreaMain");

        mRoster = findChild<CcfQmlBaseRosterMenu *>("roster");
        mRoster->populateUnits(mUnits);

        connect(mContextMenu, SIGNAL(menuEntryClicked(QString)), this, SLOT(scheduleContextAction(QString)));
        connect(mRotationTimer, SIGNAL(triggered()), this, SLOT(updateAimLine()));
        connect(mEffectsTimer, SIGNAL(triggered()), this, SLOT(updateEffects()));
        connect(mFollowingTimer, SIGNAL(triggered()), this, SLOT(updateFollowingUnit()));
        connect(child("sceneUpdateTimer"), SIGNAL(triggered()), this, SLOT(updateUnitVisibility()));
        connect(child("rubberBandTimer"), SIGNAL(triggered()), this, SLOT(updateRubberBand()));

        hideNonPlayerUnits();
        setSideMarks();
    }
}
开发者ID:sierdzio,项目名称:closecombatfree,代码行数:69,代码来源:ccfqmlbasescenario.cpp

示例2: saveGame

/*!
  Schedules a game save.
  */
void CcfQmlBaseScenario::saveGame()
{
    QObject *unitsLoader = child("unitsLoader");
    QObject *unitItem = unitsLoader->property("unitsItem").value<QObject *>();
    mmain->gameManager()->saveGame(mUnits, unitItem->getString("mapFile"));
}
开发者ID:sierdzio,项目名称:closecombatfree,代码行数:9,代码来源:ccfqmlbasescenario.cpp


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