diff options
-rw-r--r-- | map-widget/qml/MapWidget.qml | 6 | ||||
-rw-r--r-- | qt-models/maplocationmodel.cpp | 3 | ||||
-rw-r--r-- | qt-models/maplocationmodel.h | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/map-widget/qml/MapWidget.qml b/map-widget/qml/MapWidget.qml index 8116163cf..a71ade59c 100644 --- a/map-widget/qml/MapWidget.qml +++ b/map-widget/qml/MapWidget.qml @@ -66,7 +66,7 @@ Item { PropertyAnimation { target: mapItemImage; property: "scale"; from: 0.7; to: 1.0; duration: 80 } } MouseArea { - drag.target: (mapHelper.editMode && mapHelper.model.isSelected(model.divesite)) ? mapItem : undefined + drag.target: (mapHelper.editMode && model.isSelected) ? mapItem : undefined anchors.fill: parent onClicked: { if (!mapHelper.editMode && model.divesite) @@ -74,7 +74,7 @@ Item { } onDoubleClicked: map.doubleClickHandler(mapItem.coordinate) onReleased: { - if (mapHelper.editMode && mapHelper.model.isSelected(model.divesite)) { + if (mapHelper.editMode && model.isSelected) { mapHelper.updateCurrentDiveSiteCoordinatesFromMap(model.divesite, mapItem.coordinate) } } @@ -94,7 +94,7 @@ Item { id: mapItemText text: model.name font.pointSize: 11.0 - color: mapHelper.model.isSelected(model.divesite) ? "white" : "lightgrey" + color: model.isSelected ? "white" : "lightgrey" } } } diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp index 57fc76179..3aad02980 100644 --- a/qt-models/maplocationmodel.cpp +++ b/qt-models/maplocationmodel.cpp @@ -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; } diff --git a/qt-models/maplocationmodel.h b/qt-models/maplocationmodel.h index ce1f999fb..05a772bcf 100644 --- a/qt-models/maplocationmodel.h +++ b/qt-models/maplocationmodel.h @@ -33,7 +33,8 @@ public: RoleCoordinate, RoleName, RolePixmap, - RoleZ + RoleZ, + RoleIsSelected }; private: |