mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-11 03:21:29 +00:00
Map: catch null divesites in map widget selection code
Just to be sure, refuse to add null divesites to the selection. Moreover, refuse to call the setSelected function on a null-divesite. I got an unfriendly Qt-Warning there: "Passing incompatible arguments to C++ functions from JavaScript is dangerous and deprecated." "This will throw a JavaScript TypeError in future releases of Qt!" Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
25b30da244
commit
b3fd824d18
2 changed files with 3 additions and 1 deletions
|
@ -69,7 +69,7 @@ Item {
|
||||||
drag.target: (mapHelper.editMode && mapHelper.model.isSelected(model.divesite)) ? mapItem : undefined
|
drag.target: (mapHelper.editMode && mapHelper.model.isSelected(model.divesite)) ? mapItem : undefined
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!mapHelper.editMode)
|
if (!mapHelper.editMode && model.divesite)
|
||||||
mapHelper.model.setSelected(model.divesite, true)
|
mapHelper.model.setSelected(model.divesite, true)
|
||||||
}
|
}
|
||||||
onDoubleClicked: map.doubleClickHandler(mapItem.coordinate)
|
onDoubleClicked: map.doubleClickHandler(mapItem.coordinate)
|
||||||
|
|
|
@ -196,6 +196,8 @@ void MapLocationModel::reload(QObject *map)
|
||||||
void MapLocationModel::setSelected(struct dive_site *ds, bool fromClick)
|
void MapLocationModel::setSelected(struct dive_site *ds, bool fromClick)
|
||||||
{
|
{
|
||||||
m_selectedDs.clear();
|
m_selectedDs.clear();
|
||||||
|
if (!ds)
|
||||||
|
return;
|
||||||
m_selectedDs.append(ds);
|
m_selectedDs.append(ds);
|
||||||
if (fromClick)
|
if (fromClick)
|
||||||
emit selectedLocationChanged(getMapLocation(ds));
|
emit selectedLocationChanged(getMapLocation(ds));
|
||||||
|
|
Loading…
Reference in a new issue