示例#1
0
文件: main.cpp 项目: Shorttail/tiled
static unsigned short terrainId(const QString &name, const Tileset &tileset)
{
    for (Terrain *terrain : tileset.terrains())
        if (terrain->name() == name)
            return terrain->id();

    return 0xFF;
}
示例#2
0
文件: main.cpp 项目: Shorttail/tiled
static bool hasTerrain(const Tileset &tileset, const QString &name)
{
    for (Terrain *terrain : tileset.terrains())
        if (terrain->name() == name)
            return true;

    return false;
}
示例#3
0
QModelIndex TerrainModel::index(Terrain *terrain, int column) const
{
    Tileset *tileset = terrain->tileset();
    int row = tileset->terrains().indexOf(terrain);
    return createIndex(row, column, tileset);
}
示例#4
0
QModelIndex TilesetTerrainModel::index(Terrain *terrain) const
{
    Tileset *tileset = terrain->tileset();
    int row = tileset->terrains().indexOf(terrain);
    return index(row, 0);
}