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
72f465db
Commit
72f465db
authored
Aug 18, 2013
by
tstellanova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup internal data structures that reference the groupItem
parent
4f1df9b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
6 deletions
+32
-6
QGCPendingParamWidget.cc
src/ui/QGCPendingParamWidget.cc
+32
-6
No files found.
src/ui/QGCPendingParamWidget.cc
View file @
72f465db
...
...
@@ -75,13 +75,39 @@ void QGCPendingParamWidget::handlePendingParamUpdate(int compId, const QString&
}
else
{
//we don't display non-pending items
QTreeWidgetItem
*
parentItem
=
paramItem
->
parent
();
QTreeWidgetItem
*
groupItem
=
paramItem
->
parent
();
if
(
NULL
!=
groupItem
)
{
tree
->
setUpdatesEnabled
(
false
);
QTreeWidgetItem
*
componentItem
=
NULL
;
if
(
1
==
groupItem
->
childCount
())
{
componentItem
=
groupItem
->
parent
();
}
//always remove the actual paramItem from its parent
groupItem
->
removeChild
(
paramItem
);
//now we may need to remove the groupItem if it has no more children
if
(
NULL
!=
componentItem
)
{
//remove the group from our internal data structures
QMap
<
QString
,
QTreeWidgetItem
*>*
compParamGroups
=
paramGroups
.
value
(
compId
);
QString
groupStr
=
paramName
.
section
(
"_"
,
0
,
0
,
QString
::
SectionSkipEmpty
);
compParamGroups
->
remove
(
groupStr
);
//remove the group item from componentItems
componentItems
->
value
(
compId
)
->
removeChild
(
groupItem
);
// remove the group item from the tree widget itself
componentItem
->
removeChild
(
groupItem
);
if
(
0
==
componentItem
->
childCount
())
{
//the component itself no longer has any pending changes: remove it
paramGroups
.
remove
(
compId
);
componentItems
->
remove
(
compId
);
QTreeWidgetItem
*
compTop
=
tree
->
takeTopLevelItem
(
tree
->
indexOfTopLevelItem
(
componentItem
));
delete
compTop
;
//we own it after take
}
}
tree
->
setUpdatesEnabled
(
true
);
tree
->
update
();
if
(
NULL
!=
parentItem
&&
1
==
parentItem
->
childCount
())
{
parentItem
->
parent
()
->
removeChild
(
parentItem
);
}
else
{
paramItem
->
parent
()
->
removeChild
(
paramItem
);
}
}
...
...
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