Commit ba6522b4 authored by Gus Grubba's avatar Gus Grubba

Fix multiple selected state for offline maps buttons.

parent bc0afbca
......@@ -20,6 +20,8 @@ Rectangle {
border.width: _showBorder ? 1: 0
border.color: qgcPal.buttonText
property var tileSet: null
property var currentSet: null
property bool checked: false
property bool complete: false
property alias text: nameLabel.text
......@@ -37,6 +39,19 @@ Rectangle {
signal clicked()
property ExclusiveGroup exclusiveGroup: null
onExclusiveGroupChanged: {
if (exclusiveGroup) {
checked = false
exclusiveGroup.bindCheckable(mapButton)
}
}
onCheckedChanged: {
if(checked) {
currentSet = tileSet
}
}
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
Row {
......@@ -85,26 +100,53 @@ Rectangle {
MouseArea {
anchors.fill: parent
hoverEnabled: true
hoverEnabled: !ScreenTools.isMobile
onMouseXChanged: {
_lastGlobalMouseX = ScreenTools.mouseX()
_lastGlobalMouseY = ScreenTools.mouseY()
if(!ScreenTools.isMobile) {
_lastGlobalMouseX = ScreenTools.mouseX()
_lastGlobalMouseY = ScreenTools.mouseY()
}
}
onMouseYChanged: {
_lastGlobalMouseX = ScreenTools.mouseX()
_lastGlobalMouseY = ScreenTools.mouseY()
}
onEntered: { _hovered = true; _forceHoverOff = false; hoverTimer.start() }
onExited: { _hovered = false; _forceHoverOff = false; hoverTimer.stop() }
onPressed: { _pressed = true; }
onReleased: { _pressed = false; }
onClicked: mapButton.clicked()
if(!ScreenTools.isMobile) {
_lastGlobalMouseX = ScreenTools.mouseX()
_lastGlobalMouseY = ScreenTools.mouseY()
}
}
onEntered: {
if(!ScreenTools.isMobile) {
_hovered = true
_forceHoverOff = false
hoverTimer.start()
}
}
onExited: {
if(!ScreenTools.isMobile) {
_hovered = false
_forceHoverOff = false
hoverTimer.stop()
}
}
onPressed: {
if(!ScreenTools.isMobile) {
_pressed = true
}
}
onReleased: {
if(!ScreenTools.isMobile) {
_pressed = false
}
}
onClicked: {
checked = true
mapButton.clicked()
}
}
Timer {
id: hoverTimer
interval: 250
repeat: true
repeat: !ScreenTools.isMobile
onTriggered: {
if (_lastGlobalMouseX !== ScreenTools.mouseX() || _lastGlobalMouseY !== ScreenTools.mouseY()) {
_forceHoverOff = true
......
......@@ -918,11 +918,14 @@ QGCView {
width: Math.min(_tileSetList.width, (ScreenTools.defaultFontPixelWidth * 50).toFixed(0))
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.horizontalCenter: parent.horizontalCenter
ExclusiveGroup { id: selectionGroup }
OfflineMapButton {
id: firstButton
text: qsTr("Add New Set")
width: _cacheList.width
height: ScreenTools.defaultFontPixelHeight * 2
height: ScreenTools.defaultFontPixelHeight * (ScreenTools.isMobile ? 3 : 2)
currentSet: _currentSelection
exclusiveGroup: selectionGroup
onClicked: {
offlineMapView._currentSelection = null
addNewSet()
......@@ -936,7 +939,10 @@ QGCView {
tiles: object.totalTileCount
complete: object.complete
width: firstButton.width
height: ScreenTools.defaultFontPixelHeight * 2
height: ScreenTools.defaultFontPixelHeight * (ScreenTools.isMobile ? 3 : 2)
exclusiveGroup: selectionGroup
currentSet: _currentSelection
tileSet: object
onClicked: {
offlineMapView._currentSelection = object
showInfo()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment