本文整理汇总了C++中ObjectGroup::highestObjectId方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectGroup::highestObjectId方法的具体用法?C++ ObjectGroup::highestObjectId怎么用?C++ ObjectGroup::highestObjectId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectGroup
的用法示例。
在下文中一共展示了ObjectGroup::highestObjectId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTile
void TileCollisionDock::setTile(Tile *tile)
{
if (mTile == tile)
return;
mTile = tile;
mMapScene->disableSelectedTool();
MapDocument *previousDocument = mDummyMapDocument;
mMapView->setEnabled(tile);
if (tile) {
Map::Orientation orientation = Map::Orthogonal;
QSize tileSize = tile->size();
if (tile->tileset()->orientation() == Tileset::Isometric) {
orientation = Map::Isometric;
tileSize = tile->tileset()->gridSize();
}
Map *map = new Map(orientation, 1, 1, tileSize.width(), tileSize.height());
map->addTileset(tile->sharedTileset());
TileLayer *tileLayer = new TileLayer(QString(), 0, 0, 1, 1);
tileLayer->setCell(0, 0, Cell(tile));
map->addLayer(tileLayer);
ObjectGroup *objectGroup;
if (tile->objectGroup())
objectGroup = tile->objectGroup()->clone();
else
objectGroup = new ObjectGroup;
objectGroup->setDrawOrder(ObjectGroup::IndexOrder);
map->setNextObjectId(objectGroup->highestObjectId() + 1);
map->addLayer(objectGroup);
mDummyMapDocument = new MapDocument(map);
mDummyMapDocument->setCurrentLayer(objectGroup);
mMapScene->setMapDocument(mDummyMapDocument);
mToolManager->setMapDocument(mDummyMapDocument);
mMapScene->enableSelectedTool();
connect(mDummyMapDocument->undoStack(), &QUndoStack::indexChanged,
this, &TileCollisionDock::applyChanges);
connect(mDummyMapDocument, &MapDocument::selectedObjectsChanged,
this, &TileCollisionDock::selectedObjectsChanged);
} else {
mDummyMapDocument = nullptr;
mMapScene->setMapDocument(nullptr);
mToolManager->setMapDocument(nullptr);
}
emit dummyMapDocumentChanged(mDummyMapDocument);
setHasSelectedObjects(false);
if (previousDocument) {
// Explicitly disconnect early from this signal, since it can get fired
// from the QUndoStack destructor.
disconnect(previousDocument->undoStack(), &QUndoStack::indexChanged,
this, &TileCollisionDock::applyChanges);
delete previousDocument;
}
}