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
42d9a74e
Commit
42d9a74e
authored
Aug 25, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added min/max invalid display
parent
1898be3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
6 deletions
+50
-6
RCChannelWidget.cc
src/ui/designer/RCChannelWidget.cc
+39
-6
RCChannelWidget.h
src/ui/designer/RCChannelWidget.h
+11
-0
No files found.
src/ui/designer/RCChannelWidget.cc
View file @
42d9a74e
...
...
@@ -37,6 +37,8 @@ RCChannelWidget::RCChannelWidget(QWidget *parent) :
_min
(
_centerValue
),
_max
(
_centerValue
),
_trim
(
_centerValue
),
_minValid
(
false
),
_maxValid
(
false
),
_showMinMax
(
false
),
_showTrim
(
false
)
{
...
...
@@ -90,19 +92,36 @@ void RCChannelWidget::paintEvent(QPaintEvent *event)
painter
.
setBrush
(
hGradientBrush
);
if
(
_showMinMax
)
{
QString
text
;
// Draw the Min numeric value display to the left
painter
.
drawText
(
0
,
rowHeigth
,
minMaxDisplayWidth
,
fontHeight
,
Qt
::
AlignHCenter
|
Qt
::
AlignBottom
,
"Min"
);
painter
.
drawText
(
0
,
rowHeigth
*
2
,
minMaxDisplayWidth
,
fontHeight
,
Qt
::
AlignHCenter
|
Qt
::
AlignBottom
,
QString
::
number
(
_min
));
if
(
_minValid
)
{
text
=
QString
::
number
(
_min
);
}
else
{
text
=
"----"
;
}
painter
.
drawText
(
0
,
rowHeigth
*
2
,
minMaxDisplayWidth
,
fontHeight
,
Qt
::
AlignHCenter
|
Qt
::
AlignBottom
,
text
);
// Draw the Max numeric value display to the right
painter
.
drawText
(
width
()
-
minMaxDisplayWidth
,
rowHeigth
,
minMaxDisplayWidth
,
fontHeight
,
Qt
::
AlignHCenter
|
Qt
::
AlignBottom
,
"Max"
);
painter
.
drawText
(
width
()
-
minMaxDisplayWidth
,
rowHeigth
*
2
,
minMaxDisplayWidth
,
fontHeight
,
Qt
::
AlignHCenter
|
Qt
::
AlignBottom
,
QString
::
number
(
_max
));
if
(
_maxValid
)
{
text
=
QString
::
number
(
_max
);
}
else
{
text
=
QString
::
number
(
_max
);
}
painter
.
drawText
(
width
()
-
minMaxDisplayWidth
,
rowHeigth
*
2
,
minMaxDisplayWidth
,
fontHeight
,
Qt
::
AlignHCenter
|
Qt
::
AlignBottom
,
text
);
// Draw the Min/Max tick marks on the axis
int
xTick
=
rcValueAxis
.
left
()
+
(
rcValueAxis
.
width
()
*
((
float
)(
_min
-
_minRange
)
/
(
_maxRange
-
_minRange
)));
painter
.
drawLine
(
xTick
,
rcValueAxis
.
top
(),
xTick
,
rcValueAxis
.
bottom
());
xTick
=
rcValueAxis
.
left
()
+
(
rcValueAxis
.
width
()
*
((
float
)(
_max
-
_minRange
)
/
(
_maxRange
-
_minRange
)));
painter
.
drawLine
(
xTick
,
rcValueAxis
.
top
(),
xTick
,
rcValueAxis
.
bottom
());
int
xTick
;
if
(
_minValid
)
{
int
xTick
=
rcValueAxis
.
left
()
+
(
rcValueAxis
.
width
()
*
((
float
)(
_min
-
_minRange
)
/
(
_maxRange
-
_minRange
)));
painter
.
drawLine
(
xTick
,
rcValueAxis
.
top
(),
xTick
,
rcValueAxis
.
bottom
());
}
if
(
_maxValid
)
{
xTick
=
rcValueAxis
.
left
()
+
(
rcValueAxis
.
width
()
*
((
float
)(
_max
-
_minRange
)
/
(
_maxRange
-
_minRange
)));
painter
.
drawLine
(
xTick
,
rcValueAxis
.
top
(),
xTick
,
rcValueAxis
.
bottom
());
}
}
if
(
_showTrim
)
{
...
...
@@ -221,3 +240,17 @@ void RCChannelWidget::_drawValuePointer(QPainter* painter, int xTip, int yTip, i
painter
->
drawPolygon
(
trianglePoints
,
3
);
}
/// @brief Set whether the Min range value is valid or not.
void
RCChannelWidget
::
setMinValid
(
bool
valid
)
{
_minValid
=
valid
;
update
();
}
/// @brief Set whether the Max range value is valid or not.
void
RCChannelWidget
::
setMaxValid
(
bool
valid
)
{
_maxValid
=
valid
;
update
();
}
src/ui/designer/RCChannelWidget.h
View file @
42d9a74e
...
...
@@ -46,6 +46,12 @@ public:
void
setMinMax
(
int
min
,
int
max
);
/// @brief Set whether the Min range value is valid or not.
void
setMinValid
(
bool
valid
);
/// @brief Set whether the Max range value is valid or not.
void
setMaxValid
(
bool
valid
);
/// @brief Sets the Trim value for the channel
void
setTrim
(
int
value
);
...
...
@@ -56,6 +62,8 @@ public:
void
showMinMax
(
bool
show
);
bool
isMinMaxShown
()
{
return
_showMinMax
;
}
bool
isMinValid
(
void
)
{
return
_minValid
;
}
bool
isMaxValid
(
void
)
{
return
_maxValid
;
}
void
showTrim
(
bool
show
);
bool
isTrimShown
()
{
return
_showTrim
;
}
...
...
@@ -71,6 +79,9 @@ private:
int
_max
;
///< Max RC value
int
_trim
;
///< RC Value for Trim position
bool
_minValid
;
///< true: minimum value is valid
bool
_maxValid
;
///< true: maximum value is valid
bool
_showMinMax
;
///< true: show min max values on display
bool
_showTrim
;
///< true: show trim value on display
...
...
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