Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
242d6519
Unverified
Commit
242d6519
authored
Aug 23, 2019
by
Gus Grubba
Committed by
GitHub
Aug 23, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7678 from mavlink/pr-add_gps_info
custom-example: Add GPS info to the Vehicle Indicator
parents
22132435
11cb2678
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
62 deletions
+147
-62
CustomFlyView.qml
custom-example/res/CustomFlyView.qml
+123
-61
CustomQuickInterface.cc
custom-example/src/CustomQuickInterface.cc
+16
-1
CustomQuickInterface.h
custom-example/src/CustomQuickInterface.h
+8
-0
No files found.
custom-example/res/CustomFlyView.qml
View file @
242d6519
...
@@ -61,7 +61,6 @@ Item {
...
@@ -61,7 +61,6 @@ Item {
property
real
_distance
:
0.0
property
real
_distance
:
0.0
property
string
_messageTitle
:
""
property
string
_messageTitle
:
""
property
string
_messageText
:
""
property
string
_messageText
:
""
property
bool
_showAttitude
:
true
function
secondsToHHMMSS
(
timeS
)
{
function
secondsToHHMMSS
(
timeS
)
{
var
sec_num
=
parseInt
(
timeS
,
10
);
var
sec_num
=
parseInt
(
timeS
,
10
);
...
@@ -260,74 +259,77 @@ Item {
...
@@ -260,74 +259,77 @@ Item {
anchors.bottomMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.bottomMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.right
:
attitudeIndicator
.
visible
?
attitudeIndicator
.
left
:
parent
.
right
anchors.right
:
attitudeIndicator
.
visible
?
attitudeIndicator
.
left
:
parent
.
right
anchors.rightMargin
:
attitudeIndicator
.
visible
?
-
ScreenTools
.
defaultFontPixelWidth
:
ScreenTools
.
defaultFontPixelWidth
anchors.rightMargin
:
attitudeIndicator
.
visible
?
-
ScreenTools
.
defaultFontPixelWidth
:
ScreenTools
.
defaultFontPixelWidth
GridLayout
{
id
:
vehicleStatusGrid
readonly
property
bool
_showGps
:
CustomQuickInterface
.
showAttitudeWidget
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
*
1.5
GridLayout
{
id
:
vehicleStatusGrid
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
*
1.5
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
columns
:
7
columns
:
7
anchors.centerIn
:
parent
anchors.centerIn
:
parent
//-- Chronometer
QGCColoredImage
{
//-- Latitude
QGCLabel
{
height
:
_indicatorsHeight
height
:
_indicatorsHeight
width
:
height
width
:
height
source
:
"
/custom/img/chronometer.svg
"
fillMode
:
Image
.
PreserveAspectFit
sourceSize.height
:
height
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
color
:
qgcPal
.
text
color
:
qgcPal
.
text
}
text
:
"
Lat:
"
QGCLabel
{
visible
:
vehicleIndicator
.
_showGps
text
:
{
if
(
activeVehicle
)
return
secondsToHHMMSS
(
activeVehicle
.
getFact
(
"
flightTime
"
).
value
)
return
"
00:00:00
"
}
}
color
:
_indicatorsColor
QGCLabel
{
font.pointSize
:
ScreenTools
.
smallFontPointSize
id
:
firstLabel
Layout.fillWidth
:
true
text
:
activeVehicle
?
activeVehicle
.
gps
.
lat
.
value
.
toFixed
(
activeVehicle
.
gps
.
lat
.
decimalPlaces
)
:
"
-
"
Layout.minimumWidth
:
indicatorValueWidth
color
:
_indicatorsColor
horizontalAlignment
:
Text
.
AlignRight
font.pointSize
:
ScreenTools
.
smallFontPointSize
}
Layout.fillWidth
:
true
//-- Ground Speed
Layout.minimumWidth
:
indicatorValueWidth
QGCColoredImage
{
horizontalAlignment
:
Text
.
AlignLeft
visible
:
vehicleIndicator
.
_showGps
}
//-- Longitude
QGCLabel
{
height
:
_indicatorsHeight
height
:
_indicatorsHeight
width
:
height
width
:
height
source
:
"
/custom/img/horizontal_speed.svg
"
fillMode
:
Image
.
PreserveAspectFit
sourceSize.height
:
height
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
color
:
qgcPal
.
text
color
:
qgcPal
.
text
text
:
"
Lon:
"
visible
:
vehicleIndicator
.
_showGps
}
}
QGCLabel
{
QGCLabel
{
text
:
activeVehicle
?
activeVehicle
.
g
roundSpeed
.
value
.
toFixed
(
1
)
+
'
'
+
activeVehicle
.
groundSpeed
.
units
:
"
0.0
"
text
:
activeVehicle
?
activeVehicle
.
g
ps
.
lon
.
value
.
toFixed
(
activeVehicle
.
gps
.
lon
.
decimalPlaces
)
:
"
-
"
color
:
_indicatorsColor
color
:
_indicatorsColor
font.pointSize
:
ScreenTools
.
smallFontPointSize
font.pointSize
:
ScreenTools
.
smallFontPointSize
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.minimumWidth
:
indicatorValueWidth
Layout.minimumWidth
:
indicatorValueWidth
horizontalAlignment
:
Text
.
AlignRight
horizontalAlignment
:
firstLabel
.
horizontalAlignment
visible
:
vehicleIndicator
.
_showGps
}
}
//--
Vertical Speed
//--
HDOP
QGC
ColoredImage
{
QGC
Label
{
height
:
_indicatorsHeight
height
:
_indicatorsHeight
width
:
height
width
:
height
source
:
"
/custom/img/vertical_speed.svg
"
fillMode
:
Image
.
PreserveAspectFit
sourceSize.height
:
height
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
color
:
qgcPal
.
text
color
:
qgcPal
.
text
text
:
"
HDOP:
"
visible
:
vehicleIndicator
.
_showGps
}
}
QGCLabel
{
QGCLabel
{
text
:
activeVehicle
?
activeVehicle
.
climbRate
.
value
.
toFixed
(
1
)
+
'
'
+
activeVehicle
.
climbRate
.
units
:
"
0.0
"
text
:
activeVehicle
?
activeVehicle
.
gps
.
hdop
.
value
.
toFixed
(
activeVehicle
.
gps
.
hdop
.
decimalPlaces
)
:
"
-
"
color
:
_indicatorsColor
color
:
_indicatorsColor
font.pointSize
:
ScreenTools
.
smallFontPointSize
font.pointSize
:
ScreenTools
.
smallFontPointSize
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.minimumWidth
:
indicatorValueWidth
Layout.minimumWidth
:
indicatorValueWidth
horizontalAlignment
:
Text
.
AlignRight
horizontalAlignment
:
firstLabel
.
horizontalAlignment
visible
:
vehicleIndicator
.
_showGps
}
}
//-- Compass
//-- Compass
Item
{
Item
{
Layout.rowSpan
:
2
Layout.rowSpan
:
3
Layout.column
:
6
Layout.minimumWidth
:
mainIsMap
?
parent
.
height
*
1.25
:
0
Layout.minimumWidth
:
mainIsMap
?
parent
.
height
*
1.25
:
0
Layout.fillHeight
:
true
Layout.fillHeight
:
true
Layout.fillWidth
:
true
Layout.fillWidth
:
true
...
@@ -395,6 +397,66 @@ Item {
...
@@ -395,6 +397,66 @@ Item {
}
}
}
}
//-- Second Row
//-- Second Row
//-- Chronometer
QGCColoredImage
{
height
:
_indicatorsHeight
width
:
height
source
:
"
/custom/img/chronometer.svg
"
fillMode
:
Image
.
PreserveAspectFit
sourceSize.height
:
height
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
color
:
qgcPal
.
text
}
QGCLabel
{
text
:
{
if
(
activeVehicle
)
return
secondsToHHMMSS
(
activeVehicle
.
getFact
(
"
flightTime
"
).
value
)
return
"
00:00:00
"
}
color
:
_indicatorsColor
font.pointSize
:
ScreenTools
.
smallFontPointSize
Layout.fillWidth
:
true
Layout.minimumWidth
:
indicatorValueWidth
horizontalAlignment
:
firstLabel
.
horizontalAlignment
}
//-- Ground Speed
QGCColoredImage
{
height
:
_indicatorsHeight
width
:
height
source
:
"
/custom/img/horizontal_speed.svg
"
fillMode
:
Image
.
PreserveAspectFit
sourceSize.height
:
height
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
color
:
qgcPal
.
text
}
QGCLabel
{
text
:
activeVehicle
?
activeVehicle
.
groundSpeed
.
value
.
toFixed
(
1
)
+
'
'
+
activeVehicle
.
groundSpeed
.
units
:
"
0.0
"
color
:
_indicatorsColor
font.pointSize
:
ScreenTools
.
smallFontPointSize
Layout.fillWidth
:
true
Layout.minimumWidth
:
indicatorValueWidth
horizontalAlignment
:
firstLabel
.
horizontalAlignment
}
//-- Vertical Speed
QGCColoredImage
{
height
:
_indicatorsHeight
width
:
height
source
:
"
/custom/img/vertical_speed.svg
"
fillMode
:
Image
.
PreserveAspectFit
sourceSize.height
:
height
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
color
:
qgcPal
.
text
}
QGCLabel
{
text
:
activeVehicle
?
activeVehicle
.
climbRate
.
value
.
toFixed
(
1
)
+
'
'
+
activeVehicle
.
climbRate
.
units
:
"
0.0
"
color
:
_indicatorsColor
font.pointSize
:
ScreenTools
.
smallFontPointSize
Layout.fillWidth
:
true
Layout.minimumWidth
:
indicatorValueWidth
horizontalAlignment
:
firstLabel
.
horizontalAlignment
}
//-- Third Row
//-- Odometer
//-- Odometer
QGCColoredImage
{
QGCColoredImage
{
height
:
_indicatorsHeight
height
:
_indicatorsHeight
...
@@ -412,9 +474,9 @@ Item {
...
@@ -412,9 +474,9 @@ Item {
font.pointSize
:
ScreenTools
.
smallFontPointSize
font.pointSize
:
ScreenTools
.
smallFontPointSize
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.minimumWidth
:
indicatorValueWidth
Layout.minimumWidth
:
indicatorValueWidth
horizontalAlignment
:
Text
.
AlignRigh
t
horizontalAlignment
:
firstLabel
.
horizontalAlignmen
t
}
}
//-- Altitude
//-- Altitude
QGCColoredImage
{
QGCColoredImage
{
height
:
_indicatorsHeight
height
:
_indicatorsHeight
width
:
height
width
:
height
...
@@ -424,16 +486,16 @@ Item {
...
@@ -424,16 +486,16 @@ Item {
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
color
:
qgcPal
.
text
color
:
qgcPal
.
text
}
}
QGCLabel
{
QGCLabel
{
text
:
_altitude
text
:
_altitude
color
:
_indicatorsColor
color
:
_indicatorsColor
font.pointSize
:
ScreenTools
.
smallFontPointSize
font.pointSize
:
ScreenTools
.
smallFontPointSize
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.minimumWidth
:
indicatorValueWidth
Layout.minimumWidth
:
indicatorValueWidth
horizontalAlignment
:
Text
.
AlignRigh
t
horizontalAlignment
:
firstLabel
.
horizontalAlignmen
t
}
}
//-- Distance
//-- Distance
QGCColoredImage
{
QGCColoredImage
{
height
:
_indicatorsHeight
height
:
_indicatorsHeight
width
:
height
width
:
height
...
@@ -443,19 +505,19 @@ Item {
...
@@ -443,19 +505,19 @@ Item {
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignVCenter
|
Qt
.
AlignHCenter
color
:
qgcPal
.
text
color
:
qgcPal
.
text
}
}
QGCLabel
{
QGCLabel
{
text
:
_distance
?
_distanceStr
:
noGPS
text
:
_distance
?
_distanceStr
:
noGPS
color
:
_distance
?
_indicatorsColor
:
qgcPal
.
colorOrange
color
:
_distance
?
_indicatorsColor
:
qgcPal
.
colorOrange
font.pointSize
:
ScreenTools
.
smallFontPointSize
font.pointSize
:
ScreenTools
.
smallFontPointSize
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.minimumWidth
:
indicatorValueWidth
Layout.minimumWidth
:
indicatorValueWidth
horizontalAlignment
:
Text
.
AlignRigh
t
horizontalAlignment
:
firstLabel
.
horizontalAlignmen
t
}
}
}
}
MouseArea
{
MouseArea
{
anchors.fill
:
parent
anchors.fill
:
parent
onDoubleClicked
:
_showAttitude
=
!
_showAttitude
onDoubleClicked
:
CustomQuickInterface
.
showAttitudeWidget
=
!
CustomQuickInterface
.
showAttitudeWidget
}
}
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
...
@@ -464,7 +526,7 @@ Item {
...
@@ -464,7 +526,7 @@ Item {
color
:
qgcPal
.
window
color
:
qgcPal
.
window
width
:
attitudeIndicator
.
width
*
0.5
width
:
attitudeIndicator
.
width
*
0.5
height
:
vehicleIndicator
.
height
height
:
vehicleIndicator
.
height
visible
:
_showAttitude
visible
:
CustomQuickInterface
.
showAttitudeWidget
anchors.top
:
vehicleIndicator
.
top
anchors.top
:
vehicleIndicator
.
top
anchors.left
:
vehicleIndicator
.
right
anchors.left
:
vehicleIndicator
.
right
}
}
...
@@ -478,7 +540,7 @@ Item {
...
@@ -478,7 +540,7 @@ Item {
width
:
height
width
:
height
radius
:
height
*
0.5
radius
:
height
*
0.5
color
:
qgcPal
.
windowShade
color
:
qgcPal
.
windowShade
visible
:
_showAttitude
visible
:
CustomQuickInterface
.
showAttitudeWidget
CustomAttitudeWidget
{
CustomAttitudeWidget
{
size
:
parent
.
height
*
0.95
size
:
parent
.
height
*
0.95
vehicle
:
activeVehicle
vehicle
:
activeVehicle
...
...
custom-example/src/CustomQuickInterface.cc
View file @
242d6519
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
static
const
char
*
kGroupName
=
"CustomSettings"
;
static
const
char
*
kGroupName
=
"CustomSettings"
;
static
const
char
*
kShowGimbalCtl
=
"ShowGimbalCtl"
;
static
const
char
*
kShowGimbalCtl
=
"ShowGimbalCtl"
;
static
const
char
*
kShowAttitudeWidget
=
"ShowAttitudeWidget"
;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
CustomQuickInterface
::
CustomQuickInterface
(
QObject
*
parent
)
CustomQuickInterface
::
CustomQuickInterface
(
QObject
*
parent
)
...
@@ -45,7 +46,8 @@ CustomQuickInterface::init()
...
@@ -45,7 +46,8 @@ CustomQuickInterface::init()
{
{
QSettings
settings
;
QSettings
settings
;
settings
.
beginGroup
(
kGroupName
);
settings
.
beginGroup
(
kGroupName
);
_showGimbalControl
=
settings
.
value
(
kShowGimbalCtl
,
true
).
toBool
();
_showGimbalControl
=
settings
.
value
(
kShowGimbalCtl
,
false
).
toBool
();
_showAttitudeWidget
=
settings
.
value
(
kShowAttitudeWidget
,
false
).
toBool
();
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
...
@@ -60,3 +62,16 @@ CustomQuickInterface::setShowGimbalControl(bool set)
...
@@ -60,3 +62,16 @@ CustomQuickInterface::setShowGimbalControl(bool set)
emit
showGimbalControlChanged
();
emit
showGimbalControlChanged
();
}
}
}
}
//-----------------------------------------------------------------------------
void
CustomQuickInterface
::
setShowAttitudeWidget
(
bool
set
)
{
if
(
_showAttitudeWidget
!=
set
)
{
_showAttitudeWidget
=
set
;
QSettings
settings
;
settings
.
beginGroup
(
kGroupName
);
settings
.
setValue
(
kShowAttitudeWidget
,
set
);
emit
showAttitudeWidgetChanged
();
}
}
custom-example/src/CustomQuickInterface.h
View file @
242d6519
...
@@ -29,12 +29,20 @@ public:
...
@@ -29,12 +29,20 @@ public:
CustomQuickInterface
(
QObject
*
parent
=
nullptr
);
CustomQuickInterface
(
QObject
*
parent
=
nullptr
);
~
CustomQuickInterface
();
~
CustomQuickInterface
();
Q_PROPERTY
(
bool
showGimbalControl
READ
showGimbalControl
WRITE
setShowGimbalControl
NOTIFY
showGimbalControlChanged
)
Q_PROPERTY
(
bool
showGimbalControl
READ
showGimbalControl
WRITE
setShowGimbalControl
NOTIFY
showGimbalControlChanged
)
Q_PROPERTY
(
bool
showAttitudeWidget
READ
showAttitudeWidget
WRITE
setShowAttitudeWidget
NOTIFY
showAttitudeWidgetChanged
)
bool
showGimbalControl
()
{
return
_showGimbalControl
;
}
bool
showGimbalControl
()
{
return
_showGimbalControl
;
}
void
setShowGimbalControl
(
bool
set
);
void
setShowGimbalControl
(
bool
set
);
void
init
();
void
init
();
bool
showAttitudeWidget
()
{
return
_showAttitudeWidget
;
}
void
setShowAttitudeWidget
(
bool
set
);
signals:
signals:
void
showGimbalControlChanged
();
void
showGimbalControlChanged
();
void
showAttitudeWidgetChanged
();
private:
private:
bool
_showGimbalControl
=
true
;
bool
_showGimbalControl
=
true
;
bool
_showAttitudeWidget
=
false
;
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment