Skip to content

Commit

Permalink
Added MMMapLabel for labels on map
Browse files Browse the repository at this point in the history
  • Loading branch information
iiLubos committed Oct 19, 2023
1 parent faff6b4 commit df7996e
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/qmlV2/Style.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const shadowColor = "#66777777"

// Spacing
const commonSpacing = 20 * __dp
const commonItemHeight = 50 * __dp

function dynamicText() {
return "Dynamic text"
Expand Down
55 changes: 55 additions & 0 deletions app/qmlV2/component/MMMapLabel.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import Qt5Compat.GraphicalEffects
import "../Style.js" as Style
import "."

Item {
id: control

width: text.width
height: Style.commonItemHeight
visible: control.text.length > 0

signal clicked

required property string text
property color bgColor: Style.positive
property color textColor: Style.forest

Rectangle {
width: parent.width
height: parent.height
radius: control.height / 2
color: control.bgColor

layer.enabled: true
layer.effect: MMShadow {}

Text {
id: text

anchors.centerIn: parent
color: control.textColor
text: control.text
font: Qt.font(Style.t3)
leftPadding: Style.commonSpacing
rightPadding: Style.commonSpacing
}

MouseArea {
anchors.fill: parent
onClicked: control.clicked()
}
}
}
1 change: 1 addition & 0 deletions gallery/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
<file>qml/pages/MapPage.qml</file>
<file>../app/qmlV2/component/MMMapButton.qml</file>
<file>../app/qmlV2/component/MMShadow.qml</file>
<file>../app/qmlV2/component/MMMapLabel.qml</file>
</qresource>
</RCC>
9 changes: 9 additions & 0 deletions gallery/qml/pages/MapPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,13 @@ Page {
MMMapButton {
}
}

MMMapLabel {
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.leftMargin: 20
anchors.bottomMargin: 50

text: "20.0 m"
}
}

1 comment on commit df7996e

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 23.10.470911 just submitted!

Please sign in to comment.