示例#1
0
MapObjectItem *AbstractObjectTool::topMostObjectItemAt(QPointF pos) const
{
    const QList<QGraphicsItem *> &items = mMapScene->items(pos);

    for (QGraphicsItem *item : items) {
        MapObjectItem *objectItem = qgraphicsitem_cast<MapObjectItem*>(item);
        if (objectItem && objectItem->mapObject()->objectGroup()->isUnlocked())
            return objectItem;
    }
    return nullptr;
}
示例#2
0
QList<MapObjectItem*> AbstractObjectTool::objectItemsAt(QPointF pos) const
{
    const QList<QGraphicsItem *> &items = mMapScene->items(pos);

    QList<MapObjectItem*> objectList;
    for (auto item : items) {
        MapObjectItem *objectItem = qgraphicsitem_cast<MapObjectItem*>(item);
        if (objectItem && objectItem->mapObject()->objectGroup()->isUnlocked())
            objectList.append(objectItem);
    }
    return objectList;
}