mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Map: export isSelected as attribute from MapLocationModel
Recently we changed the MapLocationModel-items to store whether they are selected. Thus, we can directly export an isSelected flag instead of calling a function taking a dive-site argument. 1) This makes the QML easier to read. 2) This avoids passing pointers through QML which has caused us lots of pain. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
9322092e41
commit
1d01fff006
3 changed files with 8 additions and 4 deletions
|
@ -48,6 +48,8 @@ QVariant MapLocation::getRole(int role) const
|
|||
QString("qrc:///dive-location-marker-icon");
|
||||
case Roles::RoleZ:
|
||||
return m_selected ? 1 : 0;
|
||||
case Roles::RoleIsSelected:
|
||||
return QVariant::fromValue(m_selected);
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -105,6 +107,7 @@ QHash<int, QByteArray> MapLocationModel::roleNames() const
|
|||
roles[MapLocation::Roles::RoleName] = "name";
|
||||
roles[MapLocation::Roles::RolePixmap] = "pixmap";
|
||||
roles[MapLocation::Roles::RoleZ] = "z";
|
||||
roles[MapLocation::Roles::RoleIsSelected] = "isSelected";
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue