mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
map-widget: don't crash if the map QML failed to load
If the QML modules for QtLocation and QtPositioning are missing the QML in mapwidget.cpp will fail to load, which can lead to crashes. To solve the issue check if the QML has loaded and set a flag 'isReady' to true. If the loading has failed load another QML which is for showing a red error text in the lines of `MapWidget.qml failed to load!`. If the map QML has failed, use a macro in all relevant MapWidget members to turn them into a NOP. This approach leaves the rest of the codebase intact - e.g. no checks in classes which connect to the MapWidget class. Fixes #596 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
d1a18b36b4
commit
174b414436
3 changed files with 38 additions and 5 deletions
13
mobile-widgets/qml/MapWidgetError.qml
Normal file
13
mobile-widgets/qml/MapWidgetError.qml
Normal file
|
@ -0,0 +1,13 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
Text {
|
||||
anchors.fill: parent
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: "red"
|
||||
text: qsTr("MapWidget.qml failed to load!
|
||||
The QML modules QtPositioning and QtLocation could be missing!")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue