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
a250190a
Commit
a250190a
authored
Aug 01, 2013
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'config_fixes' of
https://github.com/tstellanova/qgroundcontrol
into config
parents
9244a091
174962a1
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1255 additions
and
1369 deletions
+1255
-1369
GeneralBlockPanelKernel.h
libs/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h
+3
-2
qgroundcontrol.pri
qgroundcontrol.pri
+0
-6
qgroundcontrol.pro
qgroundcontrol.pro
+1
-11
PrimaryFlightDisplay.cc
src/ui/PrimaryFlightDisplay.cc
+3
-0
QGCConfigView.cc
src/ui/QGCConfigView.cc
+27
-21
QGCPX4VehicleConfig.cc
src/ui/QGCPX4VehicleConfig.cc
+298
-429
QGCPX4VehicleConfig.h
src/ui/QGCPX4VehicleConfig.h
+5
-4
QGCPX4VehicleConfig.ui
src/ui/QGCPX4VehicleConfig.ui
+807
-844
QGCRadioChannelDisplay.cpp
src/ui/designer/QGCRadioChannelDisplay.cpp
+107
-52
QGCRadioChannelDisplay.h
src/ui/designer/QGCRadioChannelDisplay.h
+4
-0
No files found.
libs/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h
View file @
a250190a
...
...
@@ -88,7 +88,7 @@ void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, std::ptrd
// at the register level. For vectorization purpose, these small vertical panels are unpacked,
// e.g., each coefficient is replicated to fit a packet. This small vertical panel has to
// stay in L1 cache.
std
::
ptrdiff_t
l1
,
l2
;
std
::
ptrdiff_t
l1
,
l2
,
initial_n
;
typedef
gebp_traits
<
LhsScalar
,
RhsScalar
>
Traits
;
enum
{
...
...
@@ -98,11 +98,12 @@ void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, std::ptrd
mr_mask
=
(
0xffffffff
/
mr
)
*
mr
};
initial_n
=
n
;
manage_caching_sizes
(
GetAction
,
&
l1
,
&
l2
);
k
=
std
::
min
<
std
::
ptrdiff_t
>
(
k
,
l1
/
kdiv
);
std
::
ptrdiff_t
_m
=
k
>
0
?
l2
/
(
4
*
sizeof
(
LhsScalar
)
*
k
)
:
0
;
if
(
_m
<
m
)
m
=
_m
&
mr_mask
;
n
=
n
;
n
=
initial_n
;
//workaround for compiler warning: despite headerdoc, this parameter remains unchanged
}
template
<
typename
LhsScalar
,
typename
RhsScalar
>
...
...
qgroundcontrol.pri
View file @
a250190a
...
...
@@ -73,12 +73,6 @@ macx|macx-g++42|macx-g++|macx-llvm: {
QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qml/components/
QMAKE_POST_LINK += && cp -rf $$BASEDIR/qml/components/*.qml $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qml/components
QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qml/resources
QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qml/resources/qgroundcontrol
QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qml/resources/qgroundcontrol/toolbar
QMAKE_POST_LINK += && cp -rf $$BASEDIR/qml/resources/qgroundcontrol/toolbar/*.png $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qml/resources/qgroundcontrol/toolbar
# Fix library paths inside executable
QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol
QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol
...
...
qgroundcontrol.pro
View file @
a250190a
...
...
@@ -811,17 +811,7 @@ OTHER_FILES += \
OTHER_FILES
+=
\
qml
/
ApmToolBar
.
qml
\
qml
/
components
/
Button
.
qml
\
qml
/
components
/
TextButton
.
qml
\
qml
/
resources
/
qgroundcontrol
/
toolbar
/
connect
.
png
\
qml
/
resources
/
qgroundcontrol
/
toolbar
/
flightplanner
.
png
\
qml
/
resources
/
qgroundcontrol
/
toolbar
/
helpwizard
.
png
\
qml
/
resources
/
qgroundcontrol
/
toolbar
/
softwareconfig
.
png
\
qml
/
resources
/
qgroundcontrol
/
toolbar
/
terminal
.
png
\
qml
/
resources
/
qgroundcontrol
/
toolbar
/
simulation
.
png
\
qml
/
resources
/
qgroundcontrol
/
toolbar
/
hardwareconfig
.
png
\
qml
/
resources
/
qgroundcontrol
/
toolbar
/
flightdata
.
png
\
qml
/
resources
/
qgroundcontrol
/
toolbar
/
disconnect
.
png
\
qml
/
resources
/
qgroundcontrol
/
toolbar
/
donate
.
png
\
qml
/
components
/
TextButton
.
qml
#
qmlcomponents
.
path
+=
$$
{
DESTDIR
}
$$
{
TARGET
}
/
components
...
...
src/ui/PrimaryFlightDisplay.cc
View file @
a250190a
...
...
@@ -293,6 +293,9 @@ void PrimaryFlightDisplay::forgetUAS(UASInterface* uas)
*/
void
PrimaryFlightDisplay
::
setActiveUAS
(
UASInterface
*
uas
)
{
if
(
uas
==
this
->
uas
)
return
;
//no need to rewire
// Disconnect the previous one (if any)
forgetUAS
(
this
->
uas
);
...
...
src/ui/QGCConfigView.cc
View file @
a250190a
...
...
@@ -14,12 +14,9 @@ QGCConfigView::QGCConfigView(QWidget *parent) :
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
activeUASChanged
(
UASInterface
*
)));
if
(
ui
->
waitingLabel
)
{
ui
->
gridLayout
->
removeWidget
(
ui
->
waitingLabel
);
delete
ui
->
waitingLabel
;
ui
->
waitingLabel
=
NULL
;
}
ui
->
gridLayout
->
addWidget
(
new
QGCPX4VehicleConfig
());
//don't show a configuration widget if no vehicle is connected
//show a placeholder informational widget instead
}
QGCConfigView
::~
QGCConfigView
()
...
...
@@ -32,26 +29,35 @@ void QGCConfigView::activeUASChanged(UASInterface* uas)
if
(
currUAS
==
uas
)
return
;
if
(
ui
->
waitingLabel
)
{
ui
->
gridLayout
->
removeWidget
(
ui
->
waitingLabel
);
delete
ui
->
waitingLabel
;
ui
->
waitingLabel
=
NULL
;
}
if
(
currUAS
&&
currUAS
->
getAutopilotType
()
!=
uas
->
getAutopilotType
())
{
foreach
(
QObject
*
obj
,
ui
->
gridLayout
->
children
())
{
QWidget
*
w
=
dynamic_cast
<
QWidget
*>
(
obj
);
if
(
w
)
{
//remove all child widgets since they could contain stale data
//for example, when we switch from one PX4 UAS to another UAS
foreach
(
QObject
*
obj
,
ui
->
gridLayout
->
children
())
{
QWidget
*
w
=
dynamic_cast
<
QWidget
*>
(
obj
);
if
(
w
)
{
if
(
obj
!=
ui
->
waitingLabel
)
{
ui
->
gridLayout
->
removeWidget
(
w
);
delete
obj
;
}
}
}
switch
(
uas
->
getAutopilotType
())
{
case
MAV_AUTOPILOT_PX4
:
ui
->
gridLayout
->
addWidget
(
new
QGCPX4VehicleConfig
());
default:
ui
->
gridLayout
->
addWidget
(
new
QGCVehicleConfig
());
if
(
NULL
!=
uas
)
{
ui
->
gridLayout
->
removeWidget
(
ui
->
waitingLabel
);
ui
->
waitingLabel
->
setVisible
(
false
);
switch
(
uas
->
getAutopilotType
())
{
case
MAV_AUTOPILOT_PX4
:
ui
->
gridLayout
->
addWidget
(
new
QGCPX4VehicleConfig
());
break
;
default:
ui
->
gridLayout
->
addWidget
(
new
QGCVehicleConfig
());
break
;
}
}
else
{
//restore waiting label if we no longer have a connection
ui
->
gridLayout
->
addWidget
(
ui
->
waitingLabel
);
ui
->
waitingLabel
->
setVisible
(
true
);
}
}
src/ui/QGCPX4VehicleConfig.cc
View file @
a250190a
This diff is collapsed.
Click to expand it.
src/ui/QGCPX4VehicleConfig.h
View file @
a250190a
...
...
@@ -56,8 +56,9 @@ public slots:
void
setRCModeIndex
(
int
newRcMode
);
/** Render the data updated */
void
updateView
();
void
updateRcWidgetValues
();
void
handleRcParameterChange
(
QString
parameterName
,
QVariant
value
);
void
updateMinMax
();
/** Set the RC channel */
void
setRollChan
(
int
channel
)
{
...
...
@@ -176,10 +177,10 @@ protected:
float
rcThrottle
;
///< PPM input channel used as throttle control input
float
rcMode
;
///< PPM input channel used as mode switch control input
float
rcAux1
;
///< PPM input channel used as aux 1 input
float
rcAux2
;
///< PPM input channel used as aux
1
input
float
rcAux3
;
///< PPM input channel used as aux
1
input
float
rcAux2
;
///< PPM input channel used as aux
2
input
float
rcAux3
;
///< PPM input channel used as aux
3
input
bool
rcCalChanged
;
///< Set if the calibration changes (and needs to be written)
bool
changed
;
///< Set if any of the input data changed
bool
dataModelChanged
;
///< Set if any of the input data changed
QTimer
updateTimer
;
///< Controls update intervals
enum
RC_MODE
rc_mode
;
///< Mode of the remote control, according to usual convention
QList
<
QGCToolWidget
*>
toolWidgets
;
///< Configurable widgets
...
...
src/ui/QGCPX4VehicleConfig.ui
View file @
a250190a
This diff is collapsed.
Click to expand it.
src/ui/designer/QGCRadioChannelDisplay.cpp
View file @
a250190a
#include "QGCRadioChannelDisplay.h"
#include <QPainter>
#define DIMMEST_COLOR QColor::fromRgb(0,100,0)
#define MIDBRIGHT_COLOR QColor::fromRgb(0,180,0)
#define BRIGHTEST_COLOR QColor::fromRgb(64,255,0)
QGCRadioChannelDisplay
::
QGCRadioChannelDisplay
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
m_showMinMax
=
false
;
...
...
@@ -8,6 +13,12 @@ QGCRadioChannelDisplay::QGCRadioChannelDisplay(QWidget *parent) : QWidget(parent
m_value
=
1500
;
m_orientation
=
Qt
::
Vertical
;
m_name
=
"Yaw"
;
m_fillBrush
=
QBrush
(
Qt
::
green
,
Qt
::
SolidPattern
);
}
void
QGCRadioChannelDisplay
::
setName
(
QString
name
)
{
...
...
@@ -20,87 +31,118 @@ void QGCRadioChannelDisplay::setOrientation(Qt::Orientation orient)
m_orientation
=
orient
;
update
();
}
void
QGCRadioChannelDisplay
::
paintEvent
(
QPaintEvent
*
event
)
{
//Values range from 0-3000.
//1500 is the middle, static servo value.
QPainter
painter
(
this
);
int
currval
=
m_value
;
if
(
currval
>
m_max
)
{
currval
=
m_max
;
int
fontHeight
=
painter
.
fontMetrics
().
height
();
int
twiceFontHeight
=
fontHeight
*
2
;
painter
.
setBrush
(
Qt
::
Dense4Pattern
);
painter
.
setPen
(
QColor
::
fromRgb
(
128
,
128
,
64
));
int
curVal
=
m_value
;
if
(
curVal
>
m_max
)
{
curVal
=
m_max
;
}
if
(
currval
<
m_min
)
{
currval
=
m_min
;
if
(
curVal
<
m_min
)
{
curVal
=
m_min
;
}
if
(
m_orientation
==
Qt
::
Vertical
)
{
painter
.
drawRect
(
0
,
0
,
width
()
-
1
,(
height
()
-
1
)
-
(
painter
.
fontMetrics
().
height
()
*
2
));
painter
.
setBrush
(
Qt
::
SolidPattern
);
QLinearGradient
gradientBrush
(
0
,
0
,
this
->
width
(),
this
->
height
());
gradientBrush
.
setColorAt
(
1.0
,
DIMMEST_COLOR
);
gradientBrush
.
setColorAt
(
0.5
,
MIDBRIGHT_COLOR
);
gradientBrush
.
setColorAt
(
0.0
,
BRIGHTEST_COLOR
);
//draw border
painter
.
drawRect
(
0
,
0
,
width
()
-
1
,(
height
()
-
1
)
-
twiceFontHeight
);
painter
.
setPen
(
QColor
::
fromRgb
(
50
,
255
,
50
));
//m_value - m_min / m_max - m_min
painter
.
setBrush
(
Qt
::
SolidPattern
);
if
(
!
m_showMinMax
)
{
int
newval
=
(
height
()
-
2
-
(
painter
.
fontMetrics
().
height
()
*
2
))
*
((
float
)(
currval
-
m_min
)
/
((
m_max
-
m_min
)
+
1
));
int
newvaly
=
(
height
()
-
2
-
(
painter
.
fontMetrics
().
height
()
*
2
))
-
newval
;
painter
.
drawRect
(
1
,
newvaly
,
width
()
-
3
,((
height
()
-
2
)
-
newvaly
-
(
painter
.
fontMetrics
().
height
()
*
2
)));
}
else
{
int
newval
=
(
height
()
-
2
-
(
painter
.
fontMetrics
().
height
()
*
2
))
*
((
float
)(
currval
/
3001.0
));
int
newvaly
=
(
height
()
-
2
-
(
painter
.
fontMetrics
().
height
()
*
2
))
-
newval
;
painter
.
drawRect
(
1
,
newvaly
,
width
()
-
3
,((
height
()
-
2
)
-
newvaly
-
(
painter
.
fontMetrics
().
height
()
*
2
)));
//draw the text value of the widget, and its label
QString
valStr
=
QString
::
number
(
m_value
);
painter
.
setPen
(
QColor
::
fromRgb
(
255
,
255
,
255
));
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
m_name
)
/
2.0
),((
height
()
-
3
)
-
(
fontHeight
*
1
)),
m_name
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
valStr
)
/
2.0
),((
height
()
-
3
)
-
(
fontHeight
*
0
)),
valStr
);
painter
.
setPen
(
QColor
::
fromRgb
(
128
,
128
,
64
));
painter
.
setBrush
(
gradientBrush
);
if
(
!
m_showMinMax
)
{
//draw just the value
int
newval
=
(
height
()
-
2
-
twiceFontHeight
)
*
((
float
)(
curVal
-
m_min
)
/
((
m_max
-
m_min
)
+
1
));
int
yVal
=
(
height
()
-
2
-
twiceFontHeight
)
-
newval
;
painter
.
drawRect
(
1
,
yVal
,
width
()
-
3
,((
height
()
-
2
)
-
yVal
-
twiceFontHeight
));
}
else
{
//draw the value
int
newval
=
(
height
()
-
2
-
twiceFontHeight
)
*
((
float
)(
curVal
/
3001.0
));
int
yVal
=
(
height
()
-
2
-
twiceFontHeight
)
-
newval
;
painter
.
drawRect
(
1
,
yVal
,
width
()
-
3
,((
height
()
-
2
)
-
yVal
-
twiceFontHeight
));
QString
valstr
=
QString
::
number
(
m_value
);
painter
.
setPen
(
QColor
::
fromRgb
(
255
,
255
,
255
));
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
m_name
)
/
2.0
),((
height
()
-
3
)
-
(
painter
.
fontMetrics
().
height
()
*
1
)),
m_name
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
valstr
)
/
2.0
),((
height
()
-
3
)
-
(
painter
.
fontMetrics
().
height
()
*
0
)),
valstr
);
if
(
m_showMinMax
)
{
painter
.
setBrush
(
Qt
::
NoBrush
);
//draw min max indicator bars
painter
.
setPen
(
QColor
::
fromRgb
(
255
,
0
,
0
));
int
maxyval
=
(
height
()
-
3
-
(
painter
.
fontMetrics
().
height
()
*
2
))
-
(((
height
()
-
3
-
(
painter
.
fontMetrics
().
height
()
*
2
))
*
((
float
)
m_max
/
3000.0
)));
int
minyval
=
(
height
()
-
3
-
(
painter
.
fontMetrics
().
height
()
*
2
))
-
(((
height
()
-
3
-
(
painter
.
fontMetrics
().
height
()
*
2
))
*
((
float
)
m_min
/
3000.0
)));
painter
.
drawRect
(
2
,
maxyval
,
width
()
-
3
,
minyval
-
maxyval
);
painter
.
setBrush
(
Qt
::
NoBrush
);
int
yMax
=
(
height
()
-
3
-
twiceFontHeight
)
-
(((
height
()
-
3
-
twiceFontHeight
)
*
((
float
)
m_max
/
3000.0
)));
int
yMin
=
(
height
()
-
3
-
twiceFontHeight
)
-
(((
height
()
-
3
-
twiceFontHeight
)
*
((
float
)
m_min
/
3000.0
)));
painter
.
drawRect
(
2
,
yMax
,
width
()
-
3
,
yMin
-
yMax
);
//draw min and max labels
QString
minstr
=
QString
::
number
(
m_min
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
"min"
)
/
2.0
),
minyval
,
"min"
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
minstr
)
/
2.0
),
minyval
+
painter
.
fontMetrics
().
height
()
,
minstr
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
"min"
)
/
2.0
),
yMin
,
"min"
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
minstr
)
/
2.0
),
yMin
+
fontHeight
,
minstr
);
QString
maxstr
=
QString
::
number
(
m_max
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
"max"
)
/
2.0
),
maxyval
,
"max"
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
maxstr
)
/
2.0
),
maxyval
+
painter
.
fontMetrics
().
height
()
,
maxstr
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
"max"
)
/
2.0
),
yMax
,
"max"
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
maxstr
)
/
2.0
),
yMax
+
fontHeight
,
maxstr
);
//painter.drawRect(width() * ,2,((width()-1) * ((float)m_max / 3000.0)) - (width() * ((float)m_min / 3000.0)),(height()-5) - (painter.fontMetrics().height() * 2));
}
}
else
else
//horizontal orientation
{
painter
.
drawRect
(
0
,
0
,
width
()
-
1
,(
height
()
-
1
)
-
(
painter
.
fontMetrics
().
height
()
*
2
));
painter
.
setBrush
(
Qt
::
SolidPattern
);
QLinearGradient
hGradientBrush
(
0
,
0
,
this
->
width
(),
this
->
height
());
hGradientBrush
.
setColorAt
(
0.0
,
DIMMEST_COLOR
);
hGradientBrush
.
setColorAt
(
0.5
,
MIDBRIGHT_COLOR
);
hGradientBrush
.
setColorAt
(
1.0
,
BRIGHTEST_COLOR
);
//draw the value
painter
.
drawRect
(
0
,
0
,
width
()
-
1
,(
height
()
-
1
)
-
twiceFontHeight
);
painter
.
setPen
(
QColor
::
fromRgb
(
50
,
255
,
50
));
if
(
!
m_showMinMax
)
{
painter
.
drawRect
(
1
,
1
,(
width
()
-
3
)
*
((
float
)(
currval
-
m_min
)
/
(
m_max
-
m_min
)),(
height
()
-
3
)
-
(
painter
.
fontMetrics
().
height
()
*
2
));
}
else
{
painter
.
drawRect
(
1
,
1
,(
width
()
-
3
)
*
((
float
)
currval
/
3000.0
),(
height
()
-
3
)
-
(
painter
.
fontMetrics
().
height
()
*
2
));
}
painter
.
setBrush
(
hGradientBrush
);
//draw the value string
painter
.
setPen
(
QColor
::
fromRgb
(
255
,
255
,
255
));
QString
valstr
=
QString
::
number
(
m_value
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
m_name
)
/
2.0
),((
height
()
-
3
)
-
(
painter
.
fontMetrics
().
height
()
*
1
)),
m_name
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
valstr
)
/
2.0
),((
height
()
-
3
)
-
(
painter
.
fontMetrics
().
height
()
*
0
)),
valstr
);
if
(
m_showMinMax
)
{
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
m_name
)
/
2.0
),((
height
()
-
3
)
-
(
fontHeight
*
1
)),
m_name
);
painter
.
drawText
((
width
()
/
2.0
)
-
(
painter
.
fontMetrics
().
width
(
valstr
)
/
2.0
),((
height
()
-
3
)
-
(
fontHeight
*
0
)),
valstr
);
painter
.
setPen
(
QColor
::
fromRgb
(
0
,
128
,
0
));
painter
.
setBrush
(
hGradientBrush
);
if
(
!
m_showMinMax
)
{
//draw just the value
painter
.
drawRect
(
1
,
1
,(
width
()
-
3
)
*
((
float
)(
curVal
-
m_min
)
/
(
m_max
-
m_min
)),(
height
()
-
3
)
-
twiceFontHeight
);
}
else
{
//draw the value
painter
.
drawRect
(
1
,
1
,(
width
()
-
3
)
*
((
float
)
curVal
/
3000.0
),(
height
()
-
3
)
-
twiceFontHeight
);
//draw the min and max bars
painter
.
setBrush
(
Qt
::
NoBrush
);
painter
.
setPen
(
QColor
::
fromRgb
(
255
,
0
,
0
));
painter
.
drawRect
(
width
()
*
((
float
)
m_min
/
3000.0
),
2
,((
width
()
-
1
)
*
((
float
)
m_max
/
3000.0
))
-
(
width
()
*
((
float
)
m_min
/
3000.0
)),(
height
()
-
5
)
-
(
painter
.
fontMetrics
().
height
()
*
2
)
);
painter
.
drawRect
(
width
()
*
((
float
)
m_min
/
3000.0
),
2
,((
width
()
-
1
)
*
((
float
)
m_max
/
3000.0
))
-
(
width
()
*
((
float
)
m_min
/
3000.0
)),(
height
()
-
5
)
-
twiceFontHeight
);
//draw the min and max strings
QString
minstr
=
QString
::
number
(
m_min
);
painter
.
drawText
((
width
()
*
((
float
)
m_min
/
3000.0
))
-
(
painter
.
fontMetrics
().
width
(
"min"
)
/
2.0
),((
height
()
-
3
)
-
(
painter
.
fontMetrics
().
height
()
*
1
)),
"min"
);
painter
.
drawText
((
width
()
*
((
float
)
m_min
/
3000.0
))
-
(
painter
.
fontMetrics
().
width
(
minstr
)
/
2.0
),((
height
()
-
3
)
-
(
painter
.
fontMetrics
().
height
()
*
0
)),
minstr
);
...
...
@@ -141,6 +183,19 @@ void QGCRadioChannelDisplay::hideMinMax()
update
();
}
void
QGCRadioChannelDisplay
::
setValueAndRange
(
int
val
,
int
min
,
int
max
)
{
setValue
(
val
);
setMinMax
(
min
,
max
);
}
void
QGCRadioChannelDisplay
::
setMinMax
(
int
min
,
int
max
)
{
setMin
(
min
);
setMax
(
max
);
}
void
QGCRadioChannelDisplay
::
setMin
(
int
value
)
{
m_min
=
value
;
...
...
src/ui/designer/QGCRadioChannelDisplay.h
View file @
a250190a
...
...
@@ -12,6 +12,8 @@ public:
void
setValue
(
int
value
);
void
showMinMax
();
void
hideMinMax
();
void
setValueAndRange
(
int
val
,
int
min
,
int
max
);
void
setMinMax
(
int
min
,
int
max
);
void
setMin
(
int
value
);
void
setMax
(
int
value
);
void
setName
(
QString
name
);
...
...
@@ -27,6 +29,8 @@ private:
int
m_max
;
bool
m_showMinMax
;
QString
m_name
;
QBrush
m_fillBrush
;
signals:
public
slots
:
...
...
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