本文整理汇总了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();
}
}
示例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"));
}