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
918bdf6b
Commit
918bdf6b
authored
Aug 12, 2013
by
tstellanova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more strict locking of currently updating parameter
parent
e02f9ec0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
22 deletions
+31
-22
QGCParamWidget.cc
src/ui/QGCParamWidget.cc
+31
-22
No files found.
src/ui/QGCParamWidget.cc
View file @
918bdf6b
...
...
@@ -249,7 +249,9 @@ void QGCParamWidget::handleParameterListUpToDate()
QMap
<
QString
,
QVariant
>*
paramPairs
=
onboardParams
->
value
(
compId
);
QMap
<
QString
,
QVariant
>::
iterator
j
;
for
(
j
=
paramPairs
->
begin
();
j
!=
paramPairs
->
end
();
j
++
)
{
updatingParamNameLock
=
j
.
key
();
updateParameterDisplay
(
compId
,
j
.
key
(),
j
.
value
());
updatingParamNameLock
.
clear
();
}
}
...
...
@@ -315,7 +317,7 @@ QTreeWidgetItem* QGCParamWidget::updateParameterDisplay(int compId, QString para
// qDebug() << "QGCParamWidget::updateParameterDisplay" << parameterName;
// Reference to item in tree
QTreeWidgetItem
*
param
eter
Item
=
NULL
;
QTreeWidgetItem
*
paramItem
=
NULL
;
// Add component item if necessary
if
(
!
componentItems
->
contains
(
compId
))
{
...
...
@@ -326,24 +328,24 @@ QTreeWidgetItem* QGCParamWidget::updateParameterDisplay(int compId, QString para
//default parent item for this parameter widget item will be the top level component item
QTreeWidgetItem
*
parentItem
=
getParentWidgetItemForParam
(
compId
,
parameterName
);
if
(
parentItem
)
{
param
eter
Item
=
findChildWidgetItemForParam
(
parentItem
,
parameterName
);
if
(
!
param
eter
Item
)
{
paramItem
=
findChildWidgetItemForParam
(
parentItem
,
parameterName
);
if
(
!
paramItem
)
{
// Insert parameter into map
QStringList
plist
;
plist
.
append
(
parameterName
);
// CREATE PARAMETER ITEM
param
eter
Item
=
new
QTreeWidgetItem
(
plist
);
paramItem
=
new
QTreeWidgetItem
(
plist
);
// CONFIGURE PARAMETER ITEM
if
(
value
.
type
()
==
QVariant
::
Char
)
{
param
eter
Item
->
setData
(
1
,
Qt
::
DisplayRole
,
value
.
toUInt
());
paramItem
->
setData
(
1
,
Qt
::
DisplayRole
,
value
.
toUInt
());
}
else
{
param
eter
Item
->
setData
(
1
,
Qt
::
DisplayRole
,
value
);
paramItem
->
setData
(
1
,
Qt
::
DisplayRole
,
value
);
}
param
eterItem
->
setFlags
(
parameter
Item
->
flags
()
|
Qt
::
ItemIsEditable
);
param
Item
->
setFlags
(
param
Item
->
flags
()
|
Qt
::
ItemIsEditable
);
//TODO insert alphabetically
parentItem
->
addChild
(
param
eter
Item
);
parentItem
->
addChild
(
paramItem
);
//only add the tooltip when the parameter item is first added
QString
paramDesc
=
paramDataModel
->
getParamDescription
(
parameterName
);
...
...
@@ -357,30 +359,35 @@ QTreeWidgetItem* QGCParamWidget::updateParameterDisplay(int compId, QString para
else
{
tooltipFormat
=
paramDesc
;
}
param
eter
Item
->
setToolTip
(
0
,
tooltipFormat
);
param
eter
Item
->
setToolTip
(
1
,
tooltipFormat
);
paramItem
->
setToolTip
(
0
,
tooltipFormat
);
paramItem
->
setToolTip
(
1
,
tooltipFormat
);
}
}
//update the parameterItem's data
if
(
value
.
type
()
==
QVariant
::
Char
)
{
param
eter
Item
->
setData
(
1
,
Qt
::
DisplayRole
,
value
.
toUInt
());
paramItem
->
setData
(
1
,
Qt
::
DisplayRole
,
value
.
toUInt
());
}
else
{
param
eter
Item
->
setData
(
1
,
Qt
::
DisplayRole
,
value
);
paramItem
->
setData
(
1
,
Qt
::
DisplayRole
,
value
);
}
}
if
(
param
eter
Item
)
{
if
(
paramItem
)
{
// Reset background color
param
eter
Item
->
setBackground
(
0
,
Qt
::
NoBrush
);
param
eter
Item
->
setBackground
(
1
,
Qt
::
NoBrush
);
paramItem
->
setBackground
(
0
,
Qt
::
NoBrush
);
paramItem
->
setBackground
(
1
,
Qt
::
NoBrush
);
parameterItem
->
setTextColor
(
0
,
QGC
::
colorDarkWhite
);
parameterItem
->
setTextColor
(
1
,
QGC
::
colorDarkWhite
);
paramItem
->
setTextColor
(
0
,
QGC
::
colorDarkWhite
);
paramItem
->
setTextColor
(
1
,
QGC
::
colorDarkWhite
);
if
(
paramItem
==
tree
->
currentItem
())
{
//need to unset current item to clear highlighting (green by default)
tree
->
setCurrentItem
(
NULL
);
//clear the selected line
}
}
return
param
eter
Item
;
return
paramItem
;
}
...
...
@@ -418,10 +425,6 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* paramItem, int column
// Set parameter on changed list to be transmitted to MAV
statusLabel
->
setText
(
tr
(
"Pending: %1:%2: %3"
).
arg
(
componentId
).
arg
(
key
).
arg
(
value
.
toFloat
(),
5
,
'f'
,
1
,
QChar
(
' '
)));
if
(
paramItem
==
tree
->
currentItem
())
{
//need to unset current item to clear highlighting (green by default)
tree
->
setCurrentItem
(
NULL
);
//clear the selected line
}
paramItem
->
setBackground
(
0
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
paramItem
->
setBackground
(
1
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
}
...
...
@@ -433,6 +436,12 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* paramItem, int column
paramItem
->
setBackground
(
1
,
Qt
::
NoBrush
);
}
if
(
paramItem
==
tree
->
currentItem
())
{
//need to unset current item to clear highlighting (green by default)
tree
->
setCurrentItem
(
NULL
);
//clear the selected line
}
updatingParamNameLock
.
clear
();
}
}
...
...
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