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
31930fd3
Commit
31930fd3
authored
Aug 23, 2020
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
eb07fbba
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
224 additions
and
199 deletions
+224
-199
FactValueGrid.cc
src/QmlControls/FactValueGrid.cc
+21
-19
FactValueGrid.h
src/QmlControls/FactValueGrid.h
+2
-0
HorizontalFactValueGrid.cc
src/QmlControls/HorizontalFactValueGrid.cc
+2
-2
InstrumentValueData.cc
src/QmlControls/InstrumentValueData.cc
+34
-33
InstrumentValueData.h
src/QmlControls/InstrumentValueData.h
+2
-0
InstrumentValueEditDialog.qml
src/QmlControls/InstrumentValueEditDialog.qml
+154
-139
InstrumentValueValue.qml
src/QmlControls/InstrumentValueValue.qml
+9
-6
No files found.
src/QmlControls/FactValueGrid.cc
View file @
31930fd3
...
@@ -14,19 +14,21 @@
...
@@ -14,19 +14,21 @@
#include <QSettings>
#include <QSettings>
const
char
*
FactValueGrid
::
_rowsKey
=
"rows"
;
const
char
*
FactValueGrid
::
_columnsKey
=
"columns"
;
const
char
*
FactValueGrid
::
_fontSizeKey
=
"fontSize"
;
const
char
*
FactValueGrid
::
_rowsKey
=
"rows"
;
const
char
*
FactValueGrid
::
_versionKey
=
"version"
;
const
char
*
FactValueGrid
::
_rowCountKey
=
"rowCount"
;
const
char
*
FactValueGrid
::
_factGroupNameKey
=
"groupName"
;
const
char
*
FactValueGrid
::
_fontSizeKey
=
"fontSize"
;
const
char
*
FactValueGrid
::
_factNameKey
=
"factName"
;
const
char
*
FactValueGrid
::
_versionKey
=
"version"
;
const
char
*
FactValueGrid
::
_textKey
=
"text"
;
const
char
*
FactValueGrid
::
_factGroupNameKey
=
"factGroupName"
;
const
char
*
FactValueGrid
::
_showUnitsKey
=
"showUnits"
;
const
char
*
FactValueGrid
::
_factNameKey
=
"factName"
;
const
char
*
FactValueGrid
::
_iconKey
=
"icon"
;
const
char
*
FactValueGrid
::
_textKey
=
"text"
;
const
char
*
FactValueGrid
::
_rangeTypeKey
=
"rangeType"
;
const
char
*
FactValueGrid
::
_showUnitsKey
=
"showUnits"
;
const
char
*
FactValueGrid
::
_rangeValuesKey
=
"rangeValues"
;
const
char
*
FactValueGrid
::
_iconKey
=
"icon"
;
const
char
*
FactValueGrid
::
_rangeColorsKey
=
"rangeColors"
;
const
char
*
FactValueGrid
::
_rangeTypeKey
=
"rangeType"
;
const
char
*
FactValueGrid
::
_rangeIconsKey
=
"rangeIcons"
;
const
char
*
FactValueGrid
::
_rangeValuesKey
=
"rangeValues"
;
const
char
*
FactValueGrid
::
_rangeOpacitiesKey
=
"rangeOpacities"
;
const
char
*
FactValueGrid
::
_rangeColorsKey
=
"rangeColors"
;
const
char
*
FactValueGrid
::
_rangeIconsKey
=
"rangeIcons"
;
const
char
*
FactValueGrid
::
_rangeOpacitiesKey
=
"rangeOpacities"
;
const
char
*
FactValueGrid
::
_deprecatedGroupKey
=
"ValuesWidget"
;
const
char
*
FactValueGrid
::
_deprecatedGroupKey
=
"ValuesWidget"
;
...
@@ -272,9 +274,9 @@ void FactValueGrid::_saveSettings(void)
...
@@ -272,9 +274,9 @@ void FactValueGrid::_saveSettings(void)
settings
.
setValue
(
_versionKey
,
1
);
settings
.
setValue
(
_versionKey
,
1
);
settings
.
setValue
(
_fontSizeKey
,
_fontSize
);
settings
.
setValue
(
_fontSizeKey
,
_fontSize
);
settings
.
setValue
(
_row
sKey
,
_rowCount
);
settings
.
setValue
(
_row
CountKey
,
_rowCount
);
settings
.
beginWriteArray
(
_
row
sKey
);
settings
.
beginWriteArray
(
_
column
sKey
);
for
(
int
colIndex
=
0
;
colIndex
<
_columns
->
count
();
colIndex
++
)
{
for
(
int
colIndex
=
0
;
colIndex
<
_columns
->
count
();
colIndex
++
)
{
QmlObjectListModel
*
columns
=
_columns
->
value
<
QmlObjectListModel
*>
(
colIndex
);
QmlObjectListModel
*
columns
=
_columns
->
value
<
QmlObjectListModel
*>
(
colIndex
);
...
@@ -324,11 +326,11 @@ void FactValueGrid::_loadSettings(void)
...
@@ -324,11 +326,11 @@ void FactValueGrid::_loadSettings(void)
_fontSize
=
settings
.
value
(
_fontSizeKey
,
DefaultFontSize
).
value
<
FontSize
>
();
_fontSize
=
settings
.
value
(
_fontSizeKey
,
DefaultFontSize
).
value
<
FontSize
>
();
// Initial setup of empty items
// Initial setup of empty items
int
c
Columns
=
settings
.
value
(
_rows
Key
).
toInt
();
int
c
Rows
=
settings
.
value
(
_rowCount
Key
).
toInt
();
int
cModelLists
=
settings
.
beginReadArray
(
_
row
sKey
);
int
cModelLists
=
settings
.
beginReadArray
(
_
column
sKey
);
if
(
cModelLists
&&
c
Column
s
)
{
if
(
cModelLists
&&
c
Row
s
)
{
appendColumn
();
appendColumn
();
for
(
int
itemIndex
=
1
;
itemIndex
<
cColumns
;
item
Index
++
)
{
for
(
int
rowIndex
=
1
;
rowIndex
<
cRows
;
row
Index
++
)
{
appendRow
();
appendRow
();
}
}
for
(
int
colIndex
=
1
;
colIndex
<
cModelLists
;
colIndex
++
)
{
for
(
int
colIndex
=
1
;
colIndex
<
cModelLists
;
colIndex
++
)
{
...
...
src/QmlControls/FactValueGrid.h
View file @
31930fd3
...
@@ -104,7 +104,9 @@ private:
...
@@ -104,7 +104,9 @@ private:
static
const
QStringList
_fontSizeNames
;
static
const
QStringList
_fontSizeNames
;
static
const
char
*
_versionKey
;
static
const
char
*
_versionKey
;
static
const
char
*
_columnsKey
;
static
const
char
*
_rowsKey
;
static
const
char
*
_rowsKey
;
static
const
char
*
_rowCountKey
;
static
const
char
*
_fontSizeKey
;
static
const
char
*
_fontSizeKey
;
static
const
char
*
_factGroupNameKey
;
static
const
char
*
_factGroupNameKey
;
static
const
char
*
_factNameKey
;
static
const
char
*
_factNameKey
;
...
...
src/QmlControls/HorizontalFactValueGrid.cc
View file @
31930fd3
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
#include <QSettings>
#include <QSettings>
const
QString
HorizontalFactValueGrid
::
_toolbarUserSettingsGroup
(
"TelemetryBarUserSettingsWIP0
1
"
);
const
QString
HorizontalFactValueGrid
::
_toolbarUserSettingsGroup
(
"TelemetryBarUserSettingsWIP0
2
"
);
const
QString
HorizontalFactValueGrid
::
telemetryBarDefaultSettingsGroup
(
"TelemetryBarDefaultSettingsWIP0
1
"
);
const
QString
HorizontalFactValueGrid
::
telemetryBarDefaultSettingsGroup
(
"TelemetryBarDefaultSettingsWIP0
2
"
);
HorizontalFactValueGrid
::
HorizontalFactValueGrid
(
QQuickItem
*
parent
)
HorizontalFactValueGrid
::
HorizontalFactValueGrid
(
QQuickItem
*
parent
)
:
FactValueGrid
(
parent
)
:
FactValueGrid
(
parent
)
...
...
src/QmlControls/InstrumentValueData.cc
View file @
31930fd3
...
@@ -42,37 +42,31 @@ InstrumentValueData::InstrumentValueData(FactValueGrid* factValueGrid, QObject*
...
@@ -42,37 +42,31 @@ InstrumentValueData::InstrumentValueData(FactValueGrid* factValueGrid, QObject*
void
InstrumentValueData
::
_activeVehicleChanged
(
Vehicle
*
activeVehicle
)
void
InstrumentValueData
::
_activeVehicleChanged
(
Vehicle
*
activeVehicle
)
{
{
if
(
!
activeVehicle
)
{
if
(
_
activeVehicle
)
{
activeVehicle
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
offlineEditingVehicle
(
);
disconnect
(
_activeVehicle
,
&
Vehicle
::
factGroupNamesChanged
,
this
,
&
InstrumentValueData
::
_lookForMissingFact
);
}
}
if
(
_fact
)
{
if
(
!
activeVehicle
)
{
disconnect
(
_fact
,
&
Fact
::
rawValueChanged
,
this
,
&
InstrumentValueData
::
_updateColor
);
activeVehicle
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
offlineEditingVehicle
(
);
}
}
_activeVehicle
=
activeVehicle
;
_activeVehicle
=
activeVehicle
;
connect
(
_activeVehicle
,
&
Vehicle
::
factGroupNamesChanged
,
this
,
&
InstrumentValueData
::
_lookForMissingFact
);
emit
factGroupNamesChanged
();
emit
factGroupNamesChanged
();
if
(
_fact
)
{
if
(
!
_factGroupName
.
isEmpty
()
&&
!
_factName
.
isEmpty
())
{
_fact
=
nullptr
;
_setFactWorker
();
FactGroup
*
factGroup
=
nullptr
;
if
(
_factGroupName
==
vehicleFactGroupName
)
{
factGroup
=
_activeVehicle
;
}
else
{
factGroup
=
_activeVehicle
->
getFactGroup
(
_factGroupName
);
}
if
(
factGroup
)
{
_fact
=
factGroup
->
getFact
(
_factName
);
}
emit
factChanged
(
_fact
);
connect
(
_fact
,
&
Fact
::
rawValueChanged
,
this
,
&
InstrumentValueData
::
_updateRanges
);
}
}
}
_updateRanges
();
void
InstrumentValueData
::
_lookForMissingFact
(
void
)
{
// This is called when new fact groups show up on the vehicle. We need to see if we can fill in any
// facts which may have been missing up to now.
if
(
!
_fact
)
{
_setFactWorker
();
}
}
}
void
InstrumentValueData
::
clearFact
(
void
)
void
InstrumentValueData
::
clearFact
(
void
)
...
@@ -92,7 +86,7 @@ void InstrumentValueData::clearFact(void)
...
@@ -92,7 +86,7 @@ void InstrumentValueData::clearFact(void)
emit
showUnitsChanged
(
_showUnits
);
emit
showUnitsChanged
(
_showUnits
);
}
}
void
InstrumentValueData
::
setFact
(
const
QString
&
factGroupName
,
const
QString
&
factName
)
void
InstrumentValueData
::
_setFactWorker
(
void
)
{
{
if
(
_fact
)
{
if
(
_fact
)
{
disconnect
(
_fact
,
&
Fact
::
rawValueChanged
,
this
,
&
InstrumentValueData
::
_updateRanges
);
disconnect
(
_fact
,
&
Fact
::
rawValueChanged
,
this
,
&
InstrumentValueData
::
_updateRanges
);
...
@@ -100,19 +94,18 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f
...
@@ -100,19 +94,18 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f
}
}
FactGroup
*
factGroup
=
nullptr
;
FactGroup
*
factGroup
=
nullptr
;
if
(
factGroupName
==
vehicleFactGroupName
)
{
if
(
_
factGroupName
==
vehicleFactGroupName
)
{
factGroup
=
_activeVehicle
;
factGroup
=
_activeVehicle
;
}
else
{
}
else
{
factGroup
=
_activeVehicle
->
getFactGroup
(
factGroupName
);
factGroup
=
_activeVehicle
->
getFactGroup
(
_
factGroupName
);
}
}
_factGroupName
=
factGroupName
;
QString
nonEmptyFactName
;
QString
nonEmptyFactName
;
if
(
factGroup
)
{
if
(
factGroup
)
{
if
(
factName
.
isEmpty
())
{
if
(
_
factName
.
isEmpty
())
{
nonEmptyFactName
=
factValueNames
()[
0
];
nonEmptyFactName
=
factValueNames
()[
0
];
}
else
{
}
else
{
nonEmptyFactName
=
factName
;
nonEmptyFactName
=
_
factName
;
}
}
_fact
=
factGroup
->
getFact
(
nonEmptyFactName
);
_fact
=
factGroup
->
getFact
(
nonEmptyFactName
);
}
}
...
@@ -120,9 +113,6 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f
...
@@ -120,9 +113,6 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f
if
(
_fact
)
{
if
(
_fact
)
{
_factName
=
nonEmptyFactName
;
_factName
=
nonEmptyFactName
;
connect
(
_fact
,
&
Fact
::
rawValueChanged
,
this
,
&
InstrumentValueData
::
_updateRanges
);
connect
(
_fact
,
&
Fact
::
rawValueChanged
,
this
,
&
InstrumentValueData
::
_updateRanges
);
}
else
{
_factGroupName
.
clear
();
_factName
.
clear
();
}
}
emit
factValueNamesChanged
();
emit
factValueNamesChanged
();
...
@@ -132,6 +122,13 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f
...
@@ -132,6 +122,13 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f
_updateRanges
();
_updateRanges
();
}
}
void
InstrumentValueData
::
setFact
(
const
QString
&
factGroupName
,
const
QString
&
factName
)
{
_factGroupName
=
factGroupName
;
_factName
=
factName
;
_setFactWorker
();
}
void
InstrumentValueData
::
setText
(
const
QString
&
text
)
void
InstrumentValueData
::
setText
(
const
QString
&
text
)
{
{
...
@@ -364,6 +361,8 @@ QStringList InstrumentValueData::factGroupNames(void) const
...
@@ -364,6 +361,8 @@ QStringList InstrumentValueData::factGroupNames(void) const
QStringList
InstrumentValueData
::
factValueNames
(
void
)
const
QStringList
InstrumentValueData
::
factValueNames
(
void
)
const
{
{
QStringList
valueNames
;
FactGroup
*
factGroup
=
nullptr
;
FactGroup
*
factGroup
=
nullptr
;
if
(
_factGroupName
==
vehicleFactGroupName
)
{
if
(
_factGroupName
==
vehicleFactGroupName
)
{
factGroup
=
_activeVehicle
;
factGroup
=
_activeVehicle
;
...
@@ -371,9 +370,11 @@ QStringList InstrumentValueData::factValueNames(void) const
...
@@ -371,9 +370,11 @@ QStringList InstrumentValueData::factValueNames(void) const
factGroup
=
_activeVehicle
->
getFactGroup
(
_factGroupName
);
factGroup
=
_activeVehicle
->
getFactGroup
(
_factGroupName
);
}
}
QStringList
valueNames
=
factGroup
->
factNames
();
if
(
factGroup
)
{
for
(
QString
&
name
:
valueNames
)
{
valueNames
=
factGroup
->
factNames
();
name
[
0
]
=
name
[
0
].
toUpper
();
for
(
QString
&
name
:
valueNames
)
{
name
[
0
]
=
name
[
0
].
toUpper
();
}
}
}
return
valueNames
;
return
valueNames
;
...
...
src/QmlControls/InstrumentValueData.h
View file @
31930fd3
...
@@ -105,12 +105,14 @@ private slots:
...
@@ -105,12 +105,14 @@ private slots:
void
_resetRangeInfo
(
void
);
void
_resetRangeInfo
(
void
);
void
_updateRanges
(
void
);
void
_updateRanges
(
void
);
void
_activeVehicleChanged
(
Vehicle
*
activeVehicle
);
void
_activeVehicleChanged
(
Vehicle
*
activeVehicle
);
void
_lookForMissingFact
(
void
);
private:
private:
int
_currentRangeIndex
(
const
QVariant
&
value
);
int
_currentRangeIndex
(
const
QVariant
&
value
);
void
_updateColor
(
void
);
void
_updateColor
(
void
);
void
_updateIcon
(
void
);
void
_updateIcon
(
void
);
void
_updateOpacity
(
void
);
void
_updateOpacity
(
void
);
void
_setFactWorker
(
void
);
FactValueGrid
*
_factValueGrid
=
nullptr
;
FactValueGrid
*
_factValueGrid
=
nullptr
;
Vehicle
*
_activeVehicle
=
nullptr
;
Vehicle
*
_activeVehicle
=
nullptr
;
...
...
src/QmlControls/InstrumentValueEditDialog.qml
View file @
31930fd3
...
@@ -27,169 +27,185 @@ QGCPopupDialog {
...
@@ -27,169 +27,185 @@ QGCPopupDialog {
property
var
instrumentValueData
:
dialogProperties
.
instrumentValueData
property
var
instrumentValueData
:
dialogProperties
.
instrumentValueData
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
parent
.
enabled
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
parent
.
enabled
}
QGCPalette
{
id
:
qgcPalDisabled
;
colorGroupEnabled
:
false
}
QGCPalette
{
id
:
qgcPalDisabled
;
colorGroupEnabled
:
false
}
GridLayout
{
Loader
{
rowSpacing
:
_margins
sourceComponent
:
instrumentValueData
.
fact
?
editorComponent
:
noFactComponent
columnSpacing
:
_margins
}
columns
:
2
Component
{
QGCComboBox
{
id
:
noFactComponent
id
:
factGroupCombo
Layout.fillWidth
:
true
QGCLabel
{
model
:
instrumentValueData
.
factGroupNames
text
:
qsTr
(
"
Valuec requires a connected vehicle for setup.
"
)
sizeToContents
:
true
Component.onCompleted
:
currentIndex
=
find
(
instrumentValueData
.
factGroupName
)
onActivated
:
{
instrumentValueData
.
setFact
(
currentText
,
""
)
instrumentValueData
.
icon
=
""
instrumentValueData
.
text
=
instrumentValueData
.
fact
.
shortDescription
}
Connections
{
target
:
instrumentValueData
onFactGroupNameChanged
:
factGroupCombo
.
currentIndex
=
factGroupCombo
.
find
(
instrumentValueData
.
factGroupName
)
}
}
}
}
QGCComboBox
{
Component
{
id
:
factNamesCombo
id
:
editorComponent
Layout.fillWidth
:
true
model
:
instrumentValueData
.
factValueNames
GridLayout
{
sizeToContents
:
true
rowSpacing
:
_margins
Component.onCompleted
:
currentIndex
=
find
(
instrumentValueData
.
factName
)
columnSpacing
:
_margins
onActivated
:
{
columns
:
2
instrumentValueData
.
setFact
(
instrumentValueData
.
factGroupName
,
currentText
)
instrumentValueData
.
icon
=
""
QGCComboBox
{
instrumentValueData
.
text
=
instrumentValueData
.
fact
.
shortDescription
id
:
factGroupCombo
}
Layout.fillWidth
:
true
Connections
{
model
:
instrumentValueData
.
factGroupNames
target
:
instrumentValueData
sizeToContents
:
true
onFactNameChanged
:
factNamesCombo
.
currentIndex
=
factNamesCombo
.
find
(
instrumentValueData
.
factName
)
Component.onCompleted
:
currentIndex
=
find
(
instrumentValueData
.
factGroupName
)
onActivated
:
{
instrumentValueData
.
setFact
(
currentText
,
""
)
instrumentValueData
.
icon
=
""
instrumentValueData
.
text
=
instrumentValueData
.
fact
.
shortDescription
}
Connections
{
target
:
instrumentValueData
onFactGroupNameChanged
:
factGroupCombo
.
currentIndex
=
factGroupCombo
.
find
(
instrumentValueData
.
factGroupName
)
}
}
}
}
QGCRadioButton
{
QGCComboBox
{
id
:
iconRadio
id
:
factNamesCombo
text
:
qsTr
(
"
Icon
"
)
Layout.fillWidth
:
true
Component.onCompleted
:
checked
=
instrumentValueData
.
icon
!=
""
model
:
instrumentValueData
.
factValueNames
onClicked
:
{
sizeToContents
:
true
instrumentValueData
.
text
=
""
Component.onCompleted
:
currentIndex
=
find
(
instrumentValueData
.
factName
)
instrumentValueData
.
icon
=
instrumentValueData
.
factValueGrid
.
iconNames
[
0
]
onActivated
:
{
var
updateFunction
=
function
(
icon
){
instrumentValueData
.
icon
=
icon
}
instrumentValueData
.
setFact
(
instrumentValueData
.
factGroupName
,
currentText
)
mainWindow
.
showPopupDialogFromComponent
(
iconPickerDialog
,
{
iconNames
:
instrumentValueData
.
factValueGrid
.
iconNames
,
icon
:
instrumentValueData
.
icon
,
updateIconFunction
:
updateFunction
})
instrumentValueData
.
icon
=
""
instrumentValueData
.
text
=
instrumentValueData
.
fact
.
shortDescription
}
Connections
{
target
:
instrumentValueData
onFactNameChanged
:
factNamesCombo
.
currentIndex
=
factNamesCombo
.
find
(
instrumentValueData
.
factName
)
}
}
}
}
QGCColoredImage
{
QGCRadioButton
{
id
:
valueIcon
id
:
iconRadio
Layout.alignment
:
Qt
.
AlignHCenter
text
:
qsTr
(
"
Icon
"
)
height
:
ScreenTools
.
implicitComboBoxHeight
Component.onCompleted
:
checked
=
instrumentValueData
.
icon
!=
""
width
:
height
source
:
"
/InstrumentValueIcons/
"
+
(
instrumentValueData
.
icon
?
instrumentValueData
.
icon
:
instrumentValueData
.
factValueGrid
.
iconNames
[
0
])
sourceSize.height
:
height
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
color
:
enabled
?
qgcPal
.
text
:
qgcPalDisabled
.
text
enabled
:
iconRadio
.
checked
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
onClicked
:
{
instrumentValueData
.
text
=
""
instrumentValueData
.
icon
=
instrumentValueData
.
factValueGrid
.
iconNames
[
0
]
var
updateFunction
=
function
(
icon
){
instrumentValueData
.
icon
=
icon
}
var
updateFunction
=
function
(
icon
){
instrumentValueData
.
icon
=
icon
}
mainWindow
.
showPopupDialogFromComponent
(
iconPickerDialog
,
{
iconNames
:
instrumentValueData
.
factValueGrid
.
iconNames
,
icon
:
instrumentValueData
.
icon
,
updateIconFunction
:
updateFunction
})
mainWindow
.
showPopupDialogFromComponent
(
iconPickerDialog
,
{
iconNames
:
instrumentValueData
.
factValueGrid
.
iconNames
,
icon
:
instrumentValueData
.
icon
,
updateIconFunction
:
updateFunction
})
}
}
}
}
Rectangle
{
QGCColoredImage
{
anchors.fill
:
valueIcon
id
:
valueIcon
color
:
qgcPal
.
text
Layout.alignment
:
Qt
.
AlignHCenter
visible
:
valueIcon
.
status
===
Image
.
Error
height
:
ScreenTools
.
implicitComboBoxHeight
width
:
height
source
:
"
/InstrumentValueIcons/
"
+
(
instrumentValueData
.
icon
?
instrumentValueData
.
icon
:
instrumentValueData
.
factValueGrid
.
iconNames
[
0
])
sourceSize.height
:
height
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
color
:
enabled
?
qgcPal
.
text
:
qgcPalDisabled
.
text
enabled
:
iconRadio
.
checked
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
var
updateFunction
=
function
(
icon
){
instrumentValueData
.
icon
=
icon
}
mainWindow
.
showPopupDialogFromComponent
(
iconPickerDialog
,
{
iconNames
:
instrumentValueData
.
factValueGrid
.
iconNames
,
icon
:
instrumentValueData
.
icon
,
updateIconFunction
:
updateFunction
})
}
}
Rectangle
{
anchors.fill
:
valueIcon
color
:
qgcPal
.
text
visible
:
valueIcon
.
status
===
Image
.
Error
}
}
}
}
QGCRadioButton
{
QGCRadioButton
{
id
:
textRadio
id
:
textRadio
text
:
qsTr
(
"
Text
"
)
text
:
qsTr
(
"
Text
"
)
Component.onCompleted
:
checked
=
instrumentValueData
.
icon
==
""
Component.onCompleted
:
checked
=
instrumentValueData
.
icon
==
""
onClicked
:
{
onClicked
:
{
instrumentValueData
.
icon
=
""
instrumentValueData
.
icon
=
""
instrumentValueData
.
text
=
instrumentValueData
.
fact
?
instrumentValueData
.
fact
.
shortDescription
:
qsTr
(
"
Label
"
)
instrumentValueData
.
text
=
instrumentValueData
.
fact
?
instrumentValueData
.
fact
.
shortDescription
:
qsTr
(
"
Label
"
)
}
}
}
}
QGCTextField
{
QGCTextField
{
id
:
labelTextField
id
:
labelTextField
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.preferredWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10
Layout.preferredWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
instrumentValueData
.
text
text
:
instrumentValueData
.
text
enabled
:
textRadio
.
checked
enabled
:
textRadio
.
checked
onEditingFinished
:
instrumentValueData
.
text
=
text
onEditingFinished
:
instrumentValueData
.
text
=
text
}
}
QGCLabel
{
text
:
qsTr
(
"
Size
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Size
"
)
}
QGCComboBox
{
QGCComboBox
{
id
:
fontSizeCombo
id
:
fontSizeCombo
Layout.fillWidth
:
true
Layout.fillWidth
:
true
model
:
instrumentValueData
.
factValueGrid
.
fontSizeNames
model
:
instrumentValueData
.
factValueGrid
.
fontSizeNames
currentIndex
:
instrumentValueData
.
factValueGrid
.
fontSize
currentIndex
:
instrumentValueData
.
factValueGrid
.
fontSize
sizeToContents
:
true
sizeToContents
:
true
onActivated
:
instrumentValueData
.
factValueGrid
.
fontSize
=
index
onActivated
:
instrumentValueData
.
factValueGrid
.
fontSize
=
index
}
}
QGCCheckBox
{
QGCCheckBox
{
Layout.columnSpan
:
2
Layout.columnSpan
:
2
text
:
qsTr
(
"
Show Units
"
)
text
:
qsTr
(
"
Show Units
"
)
checked
:
instrumentValueData
.
showUnits
checked
:
instrumentValueData
.
showUnits
onClicked
:
instrumentValueData
.
showUnits
=
checked
onClicked
:
instrumentValueData
.
showUnits
=
checked
}
}
QGCLabel
{
text
:
qsTr
(
"
Range
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Range
"
)
}
QGCComboBox
{
QGCComboBox
{
id
:
rangeTypeCombo
id
:
rangeTypeCombo
Layout.fillWidth
:
true
Layout.fillWidth
:
true
model
:
instrumentValueData
.
rangeTypeNames
model
:
instrumentValueData
.
rangeTypeNames
currentIndex
:
instrumentValueData
.
rangeType
currentIndex
:
instrumentValueData
.
rangeType
sizeToContents
:
true
sizeToContents
:
true
onActivated
:
instrumentValueData
.
rangeType
=
index
onActivated
:
instrumentValueData
.
rangeType
=
index
}
}
Loader
{
Loader
{
id
:
rangeLoader
id
:
rangeLoader
Layout.columnSpan
:
2
Layout.columnSpan
:
2
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.preferredWidth
:
item
?
item
.
width
:
0
Layout.preferredWidth
:
item
?
item
.
width
:
0
Layout.preferredHeight
:
item
?
item
.
height
:
0
Layout.preferredHeight
:
item
?
item
.
height
:
0
property
var
instrumentValueData
:
root
.
instrumentValueData
property
var
instrumentValueData
:
root
.
instrumentValueData
function
updateSourceComponent
()
{
function
updateSourceComponent
()
{
switch
(
instrumentValueData
.
rangeType
)
{
switch
(
instrumentValueData
.
rangeType
)
{
case
InstrumentValueData.NoRangeInfo
:
case
InstrumentValueData.NoRangeInfo
:
sourceComponent
=
undefined
sourceComponent
=
undefined
break
break
case
InstrumentValueData.ColorRange
:
case
InstrumentValueData.ColorRange
:
sourceComponent
=
colorRangeDialog
sourceComponent
=
colorRangeDialog
break
break
case
InstrumentValueData.OpacityRange
:
case
InstrumentValueData.OpacityRange
:
sourceComponent
=
opacityRangeDialog
sourceComponent
=
opacityRangeDialog
break
break
case
InstrumentValueData.IconSelectRange
:
case
InstrumentValueData.IconSelvalueedectRange
:
sourceComponent
=
iconRangeDialog
sourceComponent
=
iconRangeDialog
break
break
}
}
}
}
Component.onCompleted
:
updateSourceComponent
()
Component.onCompleted
:
updateSourceComponent
()
Connections
{
Connections
{
target
:
instrumentValueData
target
:
instrumentValueData
onRangeTypeChanged
:
rangeLoader
.
updateSourceComponent
()
onRangeTypeChanged
:
rangeLoader
.
updateSourceComponent
()
}
}
}
}
}
}
}
...
@@ -313,7 +329,7 @@ QGCPopupDialog {
...
@@ -313,7 +329,7 @@ QGCPopupDialog {
id
:
iconRangeDialog
id
:
iconRangeDialog
Item
{
Item
{
width
:
childrenRect
.
width
width
:
childrenRect
.
width
valueed
height
:
childrenRect
.
height
height
:
childrenRect
.
height
function
updateRangeValue
(
index
,
text
)
{
function
updateRangeValue
(
index
,
text
)
{
...
@@ -545,4 +561,3 @@ QGCPopupDialog {
...
@@ -545,4 +561,3 @@ QGCPopupDialog {
}
}
}
}
}
}
src/QmlControls/InstrumentValueValue.qml
View file @
31930fd3
...
@@ -23,7 +23,6 @@ ColumnLayout {
...
@@ -23,7 +23,6 @@ ColumnLayout {
property
bool
settingsUnlocked
:
false
property
bool
settingsUnlocked
:
false
property
alias
contentWidth
:
label
.
contentWidth
property
alias
contentWidth
:
label
.
contentWidth
property
bool
_verticalOrientation
:
instrumentValueData
.
factValueGrid
.
orientation
===
FactValueGrid
.
VerticalOrientation
property
var
_rgFontSizes
:
[
ScreenTools
.
defaultFontPointSize
,
ScreenTools
.
smallFontPointSize
,
ScreenTools
.
mediumFontPointSize
,
ScreenTools
.
largeFontPointSize
]
property
var
_rgFontSizes
:
[
ScreenTools
.
defaultFontPointSize
,
ScreenTools
.
smallFontPointSize
,
ScreenTools
.
mediumFontPointSize
,
ScreenTools
.
largeFontPointSize
]
property
var
_rgFontSizeRatios
:
[
1
,
ScreenTools
.
smallFontPointRatio
,
ScreenTools
.
mediumFontPointRatio
,
ScreenTools
.
largeFontPointRatio
]
property
var
_rgFontSizeRatios
:
[
1
,
ScreenTools
.
smallFontPointRatio
,
ScreenTools
.
mediumFontPointRatio
,
ScreenTools
.
largeFontPointRatio
]
property
real
_doubleDescent
:
ScreenTools
.
defaultFontDescent
*
2
property
real
_doubleDescent
:
ScreenTools
.
defaultFontDescent
*
2
...
@@ -32,17 +31,21 @@ ColumnLayout {
...
@@ -32,17 +31,21 @@ ColumnLayout {
property
real
_tightHeight
:
_rgFontSizeTightHeights
[
instrumentValueData
.
factValueGrid
.
fontSize
]
property
real
_tightHeight
:
_rgFontSizeTightHeights
[
instrumentValueData
.
factValueGrid
.
fontSize
]
property
real
_fontSize
:
_rgFontSizes
[
instrumentValueData
.
factValueGrid
.
fontSize
]
property
real
_fontSize
:
_rgFontSizes
[
instrumentValueData
.
factValueGrid
.
fontSize
]
property
real
_horizontalLabelSpacing
:
ScreenTools
.
defaultFontPixelWidth
property
real
_horizontalLabelSpacing
:
ScreenTools
.
defaultFontPixelWidth
property
bool
_valueVisible
:
instrumentValueData
.
fact
property
real
_width
:
0
property
real
_width
:
0
property
real
_height
:
0
property
real
_height
:
0
QGCLabel
{
QGCLabel
{
id
:
label
id
:
label
Layout.alignment
:
_verticalOrientation
?
Qt
.
AlignHCenter
:
Qt
.
AlignVCenter
Layout.alignment
:
Qt
.
AlignVCenter
font.pointSize
:
_fontSize
font.pointSize
:
_fontSize
text
:
instrumentValueData
.
fact
.
enumOrValueString
+
(
instrumentValueData
.
showUnits
?
"
"
+
instrumentValueData
.
fact
.
units
:
""
)
text
:
valueText
()
visible
:
_valueVisible
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
function
valueText
()
{
if
(
instrumentValueData
.
fact
)
{
return
instrumentValueData
.
fact
.
enumOrValueString
+
(
instrumentValueData
.
showUnits
?
"
"
+
instrumentValueData
.
fact
.
units
:
""
)
}
else
{
return
qsTr
(
"
--.--
"
)
}
}
}
}
}
}
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