本文整理汇总了C++中TilesetManager::addReferences方法的典型用法代码示例。如果您正苦于以下问题:C++ TilesetManager::addReferences方法的具体用法?C++ TilesetManager::addReferences怎么用?C++ TilesetManager::addReferences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TilesetManager
的用法示例。
在下文中一共展示了TilesetManager::addReferences方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mFileName
MapDocument::MapDocument(Map *map, const QString &fileName):
mFileName(fileName),
mMap(map),
mLayerModel(new LayerModel(this)),
mUndoStack(new QUndoStack(this))
{
switch (map->orientation()) {
case Map::Isometric:
mRenderer = new IsometricRenderer(map);
break;
case Map::Hexagonal:
mRenderer = new HexagonalRenderer(map);
break;
default:
mRenderer = new OrthogonalRenderer(map);
break;
}
mCurrentLayerIndex = (map->layerCount() == 0) ? -1 : 0;
mLayerModel->setMapDocument(this);
// Forward signals emitted from the layer model
connect(mLayerModel, SIGNAL(layerAdded(int)), SLOT(onLayerAdded(int)));
connect(mLayerModel, SIGNAL(layerAboutToBeRemoved(int)),
SLOT(onLayerAboutToBeRemoved(int)));
connect(mLayerModel, SIGNAL(layerRemoved(int)), SLOT(onLayerRemoved(int)));
connect(mLayerModel, SIGNAL(layerChanged(int)), SIGNAL(layerChanged(int)));
connect(mUndoStack, SIGNAL(cleanChanged(bool)), SIGNAL(modifiedChanged()));
// Register tileset references
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->addReferences(mMap->tilesets());
}
示例2: mFileName
MapDocument::MapDocument(Map *map, const QString &fileName):
mFileName(fileName),
mMap(map),
mLayerModel(new LayerModel(this)),
mCurrentObject(map),
mMapObjectModel(new MapObjectModel(this)),
mTerrainModel(new TerrainModel(this, this)),
mUndoStack(new QUndoStack(this))
{
switch (map->orientation()) {
case Map::Isometric:
mRenderer = new IsometricRenderer(map);
break;
case Map::Staggered:
mRenderer = new StaggeredRenderer(map);
break;
default:
mRenderer = new OrthogonalRenderer(map);
break;
}
mCurrentLayerIndex = (map->layerCount() == 0) ? -1 : 0;
mLayerModel->setMapDocument(this);
// Forward signals emitted from the layer model
connect(mLayerModel, SIGNAL(layerAdded(int)), SLOT(onLayerAdded(int)));
connect(mLayerModel, SIGNAL(layerAboutToBeRemoved(int)),
SLOT(onLayerAboutToBeRemoved(int)));
connect(mLayerModel, SIGNAL(layerRemoved(int)), SLOT(onLayerRemoved(int)));
connect(mLayerModel, SIGNAL(layerChanged(int)), SIGNAL(layerChanged(int)));
// Forward signals emitted from the map object model
mMapObjectModel->setMapDocument(this);
connect(mMapObjectModel, SIGNAL(objectsAdded(QList<MapObject*>)),
SIGNAL(objectsAdded(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(objectsChanged(QList<MapObject*>)),
SIGNAL(objectsChanged(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(objectsRemoved(QList<MapObject*>)),
SLOT(onObjectsRemoved(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
SLOT(onMapObjectModelRowsInserted(QModelIndex,int,int)));
connect(mMapObjectModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
SLOT(onMapObjectModelRowsInsertedOrRemoved(QModelIndex,int,int)));
connect(mMapObjectModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
SLOT(onObjectsMoved(QModelIndex,int,int,QModelIndex,int)));
connect(mTerrainModel, SIGNAL(terrainRemoved(Terrain*)),
SLOT(onTerrainRemoved(Terrain*)));
connect(mUndoStack, SIGNAL(cleanChanged(bool)), SIGNAL(modifiedChanged()));
// Register tileset references
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->addReferences(mMap->tilesets());
}
示例3: QSharedData
TileStampData::TileStampData(const TileStampData &other)
: QSharedData(other)
, name(other.name)
, fileName() // not copied
, variations(other.variations)
, quickStampIndex(-1)
{
TilesetManager *tilesetManager = TilesetManager::instance();
// deep-copy the map data
for (TileStampVariation &variation : variations) {
variation.map = new Map(*variation.map);
tilesetManager->addReferences(variation.map->tilesets());
}
}
示例4: Document
MapDocument::MapDocument(Map *map, const QString &fileName)
: Document(MapDocumentType, fileName)
, mMap(map)
, mLayerModel(new LayerModel(this))
, mHoveredMapObject(nullptr)
, mRenderer(nullptr)
, mMapObjectModel(new MapObjectModel(this))
{
mCurrentObject = map;
createRenderer();
mCurrentLayer = (map->layerCount() == 0) ? nullptr : map->layerAt(0);
mLayerModel->setMapDocument(this);
// Forward signals emitted from the layer model
connect(mLayerModel, &LayerModel::layerAdded,
this, &MapDocument::onLayerAdded);
connect(mLayerModel, &LayerModel::layerAboutToBeRemoved,
this, &MapDocument::onLayerAboutToBeRemoved);
connect(mLayerModel, &LayerModel::layerRemoved,
this, &MapDocument::onLayerRemoved);
connect(mLayerModel, &LayerModel::layerChanged,
this, &MapDocument::layerChanged);
// Forward signals emitted from the map object model
mMapObjectModel->setMapDocument(this);
connect(mMapObjectModel, SIGNAL(objectsAdded(QList<MapObject*>)),
SIGNAL(objectsAdded(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(objectsChanged(QList<MapObject*>)),
SIGNAL(objectsChanged(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(objectsTypeChanged(QList<MapObject*>)),
SIGNAL(objectsTypeChanged(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(objectsRemoved(QList<MapObject*>)),
SLOT(onObjectsRemoved(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
SLOT(onMapObjectModelRowsInserted(QModelIndex,int,int)));
connect(mMapObjectModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
SLOT(onMapObjectModelRowsInsertedOrRemoved(QModelIndex,int,int)));
connect(mMapObjectModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
SLOT(onObjectsMoved(QModelIndex,int,int,QModelIndex,int)));
// Register tileset references
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->addReferences(mMap->tilesets());
}