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
0c506525
Commit
0c506525
authored
Oct 17, 2013
by
John Tapsell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce code duplication
parent
f6ae5ed8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
37 deletions
+14
-37
QGCToolWidget.cc
src/ui/designer/QGCToolWidget.cc
+12
-37
QGCToolWidget.h
src/ui/designer/QGCToolWidget.h
+2
-0
No files found.
src/ui/designer/QGCToolWidget.cc
View file @
0c506525
...
...
@@ -51,7 +51,7 @@ QGCToolWidget::QGCToolWidget(const QString& objectName, const QString& title, QW
// Enforce storage if this not loaded from settings
// is MUST NOT BE SAVED if it was loaded from settings!
//
if (!settings) storeWidgetsToSettings();
if
(
!
settings
)
storeWidgetsToSettings
();
}
QGCToolWidget
::~
QGCToolWidget
()
...
...
@@ -530,60 +530,35 @@ QList<QGCToolWidgetItem*>* QGCToolWidget::itemList()
if
(
!
instances
)
instances
=
new
QList
<
QGCToolWidgetItem
*>
();
return
instances
;
}
void
QGCToolWidget
::
addParam
(
int
uas
,
int
component
,
QString
paramname
,
QVariant
value
)
{
isFromMetaData
=
true
;
QGCParamSlider
*
slider
=
new
QGCParamSlider
(
this
);
connect
(
slider
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
storeSettings
()));
if
(
ui
->
hintLabel
)
{
ui
->
hintLabel
->
deleteLater
();
ui
->
hintLabel
=
NULL
;
}
toolLayout
->
addWidget
(
slider
);
addToolWidget
(
slider
);
slider
->
setActiveUAS
(
mav
);
slider
->
setParameterValue
(
uas
,
component
,
0
,
-
1
,
paramname
,
value
);
}
void
QGCToolWidget
::
addParam
()
{
QGCParamSlider
*
slider
=
new
QGCParamSlider
(
this
);
connect
(
slider
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
storeSettings
()));
if
(
ui
->
hintLabel
)
{
ui
->
hintLabel
->
deleteLater
();
ui
->
hintLabel
=
NULL
;
}
toolLayout
->
addWidget
(
slider
);
slider
->
startEditMode
();
addToolWidgetAndEdit
(
new
QGCParamSlider
(
this
));
}
void
QGCToolWidget
::
addCommand
()
{
QGCCommandButton
*
button
=
new
QGCCommandButton
(
this
);
connect
(
button
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
storeSettings
()));
if
(
ui
->
hintLabel
)
{
ui
->
hintLabel
->
deleteLater
();
ui
->
hintLabel
=
NULL
;
}
toolLayout
->
addWidget
(
button
);
button
->
startEditMode
();
addToolWidgetAndEdit
(
new
QGCCommandButton
(
this
));
}
void
QGCToolWidget
::
addLabel
()
{
QGCTextLabel
*
label
=
new
QGCTextLabel
(
this
);
connect
(
label
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
storeSettings
()));
if
(
ui
->
hintLabel
)
{
ui
->
hintLabel
->
deleteLater
();
ui
->
hintLabel
=
NULL
;
}
toolLayout
->
addWidget
(
label
);
label
->
startEditMode
();
addToolWidgetAndEdit
(
new
QGCTextLabel
(
this
));
}
void
QGCToolWidget
::
addToolWidgetAndEdit
(
QGCToolWidgetItem
*
widget
)
{
addToolWidget
(
widget
);
widget
->
startEditMode
();
}
void
QGCToolWidget
::
addToolWidget
(
QGCToolWidgetItem
*
widget
)
...
...
src/ui/designer/QGCToolWidget.h
View file @
0c506525
...
...
@@ -91,6 +91,8 @@ protected:
QList
<
QGCToolWidgetItem
*
>*
itemList
();
/** @brief Add an existing tool widget */
void
addToolWidget
(
QGCToolWidgetItem
*
widget
);
/** @brief Add an existing tool widget and set it to edit mode */
void
addToolWidgetAndEdit
(
QGCToolWidgetItem
*
widget
);
void
hideEvent
(
QHideEvent
*
event
);
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