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
2ef52b98
Commit
2ef52b98
authored
May 30, 2013
by
Bryant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HDDisplay gauges are now themed correctly depending on what theme is currently selected.
parent
9d974d5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
HDDisplay.cc
src/ui/HDDisplay.cc
+26
-3
No files found.
src/ui/HDDisplay.cc
View file @
2ef52b98
...
...
@@ -24,6 +24,7 @@
#include "ui_HDDisplay.h"
#include "MG.h"
#include "QGC.h"
#include "MainWindow.h"
#include <QDebug>
HDDisplay
::
HDDisplay
(
QStringList
*
plotList
,
QString
title
,
QWidget
*
parent
)
:
...
...
@@ -443,7 +444,15 @@ void HDDisplay::renderOverlay()
//painter.fillRect(QRect(0, 0, width(), height()), backgroundColor);
const
float
spacing
=
0.4
f
;
// 40% of width
const
float
gaugeWidth
=
vwidth
/
(((
float
)
columns
)
+
(((
float
)
columns
+
1
)
*
spacing
+
spacing
*
0.5
f
));
const
QColor
gaugeColor
=
QColor
(
200
,
200
,
200
);
QColor
gaugeColor
;
if
(
MainWindow
::
instance
()
->
getStyle
()
==
MainWindow
::
QGC_MAINWINDOW_STYLE_LIGHT
)
{
gaugeColor
=
QColor
(
0
,
0
,
0
);
}
else
{
gaugeColor
=
QColor
(
255
,
255
,
255
);
}
//drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter);
//drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true);
//drawGauge(15.0f+gaugeWidth*1.7f, 15.0f, gaugeWidth/2.0f, 0, 10.0f, "altitude", values.value("altitude", 0.0f), gaugeColor, &painter, qMakePair(1.0f, 2.5f), qMakePair(0.0f, 0.5f), true);
...
...
@@ -575,6 +584,20 @@ void HDDisplay::drawChangeRateStrip(float xRef, float yRef, float height, float
void
HDDisplay
::
drawGauge
(
float
xRef
,
float
yRef
,
float
radius
,
float
min
,
float
max
,
QString
name
,
float
value
,
const
QColor
&
color
,
QPainter
*
painter
,
bool
symmetric
,
QPair
<
float
,
float
>
goodRange
,
QPair
<
float
,
float
>
criticalRange
,
bool
solid
)
{
// Select color scheme based on light or dark theme.
QColor
valueColor
;
QColor
backgroundColor
;
if
(
MainWindow
::
instance
()
->
getStyle
()
==
MainWindow
::
QGC_MAINWINDOW_STYLE_LIGHT
)
{
valueColor
=
QColor
(
26
,
75
,
95
);
backgroundColor
=
QColor
(
246
,
246
,
246
);
}
else
{
valueColor
=
QGC
::
colorCyan
;
backgroundColor
=
QColor
(
34
,
34
,
34
);
}
// Draw the circle
QPen
circlePen
(
Qt
::
SolidLine
);
...
...
@@ -634,7 +657,7 @@ void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float
const
float
textY
=
yRef
+
radius
/
2.0
f
;
// Draw background rectangle
QBrush
brush
(
QGC
::
colorBackground
,
Qt
::
SolidPattern
);
QBrush
brush
(
backgroundColor
,
Qt
::
SolidPattern
);
painter
->
setBrush
(
brush
);
painter
->
setPen
(
Qt
::
NoPen
);
...
...
@@ -663,7 +686,7 @@ void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float
// Draw the value
//painter->setPen(textColor);
paintText
(
label
,
QGC
::
colorCyan
,
textHeight
,
textX
,
textY
+
nameHeight
,
painter
);
paintText
(
label
,
valueColor
,
textHeight
,
textX
,
textY
+
nameHeight
,
painter
);
//paintText(label, color, ((radius - radius/3.0f)*1.1f), xRef-radius/2.5f, yRef+radius/3.0f, painter);
// Draw the needle
...
...
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