Skip to content

Commit

Permalink
C++ formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
iiLubos committed Jan 22, 2024
1 parent 3e00047 commit 034c618
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 13 deletions.
94 changes: 94 additions & 0 deletions app/qml/map/MMMapScaleBar.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/***************************************************************************
* *
* 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 Qt5Compat.GraphicalEffects
import lc 1.0
import "."

Item {
id: root

property alias sourceItem: effect.sourceItem
property string text: scaleBarKit.distance + " " + scaleBarKit.units
property real barWidth: scaleBarKit.width

width: root.barWidth + 48 * __dp

ScaleBarKit {
id: scaleBarKit
}

Rectangle {
anchors.fill: fastBlur
color: __style.forestColor
opacity: 0.8
radius: fastBlur.height / 2
}

FastBlur {
id: fastBlur

width: parent.width
height: 45 * __dp

radius: 32
opacity: 0.8

source: ShaderEffectSource {
id: effect

sourceRect: Qt.rect(root.x, root.y, fastBlur.width, fastBlur.height)
}

Column {
width: root.barWidth
anchors.centerIn: parent

Rectangle {
width: parent.width
height: 2 * __dp
color: __style.forestColor

Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.topMargin: (width - height) / 2
width: parent.height
height: 6 * __dp
color: parent.color
radius: width / 2
}

Rectangle {
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: (width - height) / 2
width: parent.height
height: 6 * __dp
color: parent.color
radius: width / 2
}
}

Text {
id: text

height: 26 * __dp
anchors.horizontalCenter: parent.horizontalCenter

text: root.text
color: __style.forestColor
font: __style.t3
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}
26 changes: 13 additions & 13 deletions gallery/scalebarkit.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@

class ScaleBarKit : public QObject
{
Q_OBJECT
Q_OBJECT

Q_PROPERTY( QString units READ units NOTIFY scaleBarChanged )
Q_PROPERTY( int distance READ distance NOTIFY scaleBarChanged )
Q_PROPERTY( int width READ width NOTIFY scaleBarChanged )
Q_PROPERTY( QString units READ units NOTIFY scaleBarChanged )
Q_PROPERTY( int distance READ distance NOTIFY scaleBarChanged )
Q_PROPERTY( int width READ width NOTIFY scaleBarChanged )

public:
explicit ScaleBarKit( QObject *parent = nullptr ) {};
explicit ScaleBarKit( QObject *parent = nullptr ) {};

int width() const {return mWidth;}
int distance() const {return mDistance;}
QString units() const {return mUnits;}
int width() const {return mWidth;}
int distance() const {return mDistance;}
QString units() const {return mUnits;}

signals:
void scaleBarChanged();
void scaleBarChanged();

private:
int mPreferredWidth = 300; // pixels
int mWidth = 80; // pixels
int mDistance = 100; // in meters or kilometers, rounded
QString mUnits = "m"; // e.g. km or m
int mPreferredWidth = 300; // pixels
int mWidth = 80; // pixels
int mDistance = 100; // in meters or kilometers, rounded
QString mUnits = "m"; // e.g. km or m

};

Expand Down

1 comment on commit 034c618

@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 24.01.509111 just submitted!

Please sign in to comment.