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
9143c8c5
Commit
9143c8c5
authored
Oct 13, 2013
by
John Tapsell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the UI for editing the Text Label
parent
42d68e1d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
46 deletions
+93
-46
QGCTextLabel.cc
src/ui/designer/QGCTextLabel.cc
+41
-30
QGCTextLabel.h
src/ui/designer/QGCTextLabel.h
+3
-0
QGCTextLabel.ui
src/ui/designer/QGCTextLabel.ui
+47
-15
QGCToolWidget.cc
src/ui/designer/QGCToolWidget.cc
+2
-1
No files found.
src/ui/designer/QGCTextLabel.cc
View file @
9143c8c5
...
...
@@ -7,7 +7,7 @@
#include "UASManager.h"
QGCTextLabel
::
QGCTextLabel
(
QWidget
*
parent
)
:
QGCToolWidgetItem
(
"
Command Button
"
,
parent
),
QGCToolWidgetItem
(
"
Text Label
"
,
parent
),
ui
(
new
Ui
::
QGCTextLabel
)
{
uas
=
0
;
...
...
@@ -15,11 +15,15 @@ QGCTextLabel::QGCTextLabel(QWidget *parent) :
ui
->
setupUi
(
this
);
connect
(
ui
->
editFinishButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
endEditMode
()));
connect
(
ui
->
isMavCommand
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
update_isMavCommand
()));
// Hide all edit items
ui
->
editFinishButton
->
hide
();
ui
->
editNameLabel
->
hide
();
ui
->
editLine1
->
hide
();
ui
->
editLine2
->
hide
();
ui
->
isMavCommand
->
hide
();
ui
->
textLabel
->
setText
(
QString
());
}
QGCTextLabel
::~
QGCTextLabel
()
...
...
@@ -30,10 +34,11 @@ QGCTextLabel::~QGCTextLabel()
void
QGCTextLabel
::
startEditMode
()
{
// Hide elements
ui
->
nameLabel
->
hide
();
ui
->
editFinishButton
->
show
();
ui
->
editNameLabel
->
show
();
ui
->
editLine1
->
show
();
ui
->
editLine2
->
show
();
ui
->
isMavCommand
->
show
();
// Attempt to undock the dock widget
QWidget
*
p
=
this
;
...
...
@@ -55,10 +60,12 @@ void QGCTextLabel::startEditMode()
void
QGCTextLabel
::
endEditMode
()
{
update_isMavCommand
();
ui
->
editFinishButton
->
hide
();
ui
->
editNameLabel
->
hide
();
ui
->
editLine1
->
hide
();
ui
->
nameLabel
->
show
();
ui
->
editLine2
->
hide
();
ui
->
isMavCommand
->
hide
();
// Write to settings
emit
editingFinished
();
...
...
@@ -83,25 +90,17 @@ void QGCTextLabel::endEditMode()
void
QGCTextLabel
::
writeSettings
(
QSettings
&
settings
)
{
qDebug
()
<<
"COMMAND BUTTON WRITING SETTINGS"
;
settings
.
setValue
(
"
TYPE"
,
"COMMANDBUTTON"
);
settings
.
setValue
(
"QGC_
COMMAND_BUTTON_DESCRIPTION"
,
ui
->
nameLabel
->
text
()
);
settings
.
setValue
(
"TYPE"
,
"TEXT"
)
;
settings
.
setValue
(
"
QGC_TEXT_TEXT"
,
ui
->
editNameLabel
->
text
()
);
settings
.
setValue
(
"QGC_
TEXT_SOURCE"
,
ui
->
isMavCommand
->
isChecked
()
?
"MAV"
:
"NONE"
);
settings
.
sync
();
}
void
QGCTextLabel
::
readSettings
(
const
QString
&
pre
,
const
QVariantMap
&
settings
)
{
ui
->
editNameLabel
->
setText
(
settings
.
value
(
pre
+
"QGC_TEXT_TEXT"
,
""
).
toString
());
ui
->
isMavCommand
->
setChecked
(
settings
.
value
(
pre
+
"QGC_TEXT_SOURCE"
,
"NONE"
).
toString
()
==
"MAV"
);
if
(
!
ui
->
isMavCommand
->
isChecked
())
{
ui
->
editNameLabel
->
setText
(
settings
.
value
(
pre
+
"QGC_TEXT_TEXT"
,
""
).
toString
());
ui
->
nameLabel
->
setText
(
ui
->
editNameLabel
->
text
());
}
else
{
//MAV command text
connect
(
uas
,
SIGNAL
(
textMessageReceived
(
int
,
int
,
int
,
QString
)),
this
,
SLOT
(
textMessageReceived
(
int
,
int
,
int
,
QString
)));
}
update_isMavCommand
();
}
void
QGCTextLabel
::
textMessageReceived
(
int
uasid
,
int
component
,
int
severity
,
QString
message
)
{
...
...
@@ -128,28 +127,40 @@ void QGCTextLabel::textMessageReceived(int uasid, int component, int severity, Q
void
QGCTextLabel
::
readSettings
(
const
QSettings
&
settings
)
{
ui
->
editNameLabel
->
setText
(
settings
.
value
(
"QGC_TEXT_TEXT"
,
""
).
toString
());
//Place this before setting isMavCommand
ui
->
isMavCommand
->
setChecked
(
settings
.
value
(
"QGC_TEXT_SOURCE"
,
"NONE"
).
toString
()
==
"MAV"
);
ui
->
editNameLabel
->
setText
(
settings
.
value
(
"QGC_TEXT_TEXT"
,
""
).
toString
());
if
(
!
ui
->
isMavCommand
->
isChecked
())
{
ui
->
textLabel
->
setText
(
ui
->
editNameLabel
->
text
());
ui
->
nameLabel
->
setText
(
""
);
}
else
{
//MAV command text
ui
->
nameLabel
->
setText
(
ui
->
editNameLabel
->
text
());
ui
->
textLabel
->
setText
(
""
);
connect
(
uas
,
SIGNAL
(
textMessageReceived
(
int
,
int
,
int
,
QString
)),
this
,
SLOT
(
textMessageReceived
(
int
,
int
,
int
,
QString
)));
}
update_isMavCommand
();
}
void
QGCTextLabel
::
enableText
(
int
num
)
{
enabledNum
=
num
;
}
void
QGCTextLabel
::
setActiveUAS
(
UASInterface
*
uas
)
{
if
(
this
->
uas
)
this
->
uas
->
disconnect
(
this
);
this
->
uas
=
uas
;
update_isMavCommand
();
//Might need to update the signal connections
}
void
QGCTextLabel
::
update_isMavCommand
()
{
ui
->
textLabel
->
setText
(
""
);
if
(
!
ui
->
isMavCommand
->
isChecked
())
{
ui
->
nameLabel
->
setText
(
ui
->
editNameLabel
->
text
());
if
(
this
->
uas
)
disconnect
(
uas
,
SIGNAL
(
textMessageReceived
(
int
,
int
,
int
,
QString
)),
this
,
SLOT
(
textMessageReceived
(
int
,
int
,
int
,
QString
)));
if
(
ui
->
nameLabel
->
text
().
isEmpty
())
ui
->
nameLabel
->
setText
(
tr
(
"Text Label"
));
//Show something, so that we don't end up with just an empty label
}
else
{
//MAV command text
ui
->
nameLabel
->
setText
(
ui
->
editNameLabel
->
text
());
if
(
this
->
uas
)
connect
(
uas
,
SIGNAL
(
textMessageReceived
(
int
,
int
,
int
,
QString
)),
this
,
SLOT
(
textMessageReceived
(
int
,
int
,
int
,
QString
)));
}
}
src/ui/designer/QGCTextLabel.h
View file @
9143c8c5
...
...
@@ -27,6 +27,9 @@ public slots:
void
readSettings
(
const
QString
&
pre
,
const
QVariantMap
&
settings
);
void
textMessageReceived
(
int
uasid
,
int
componentId
,
int
severity
,
QString
message
);
private
slots
:
void
update_isMavCommand
();
private:
int
enabledNum
;
Ui
::
QGCTextLabel
*
ui
;
...
...
src/ui/designer/QGCTextLabel.ui
View file @
9143c8c5
...
...
@@ -14,6 +14,19 @@
<string>
Form
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"Line"
name=
"editLine1"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
...
...
@@ -28,6 +41,9 @@
</item>
<item>
<widget
class=
"QCheckBox"
name=
"isMavCommand"
>
<property
name=
"toolTip"
>
<string>
This is only for advanced use, and allows a label to display the results of a Command Button.
</string>
</property>
<property
name=
"text"
>
<string>
Mav Command
</string>
</property>
...
...
@@ -35,19 +51,6 @@
</item>
</layout>
</item>
<item>
<widget
class=
"Line"
name=
"editLine1"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
...
...
@@ -59,7 +62,7 @@
</size>
</property>
<property
name=
"text"
>
<string>
Description
</string>
<string>
Text Label
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
...
...
@@ -69,7 +72,7 @@
<item>
<widget
class=
"QLabel"
name=
"textLabel"
>
<property
name=
"text"
>
<string>
TextLabel
</string>
<string>
mav result
</string>
</property>
</widget>
</item>
...
...
@@ -99,6 +102,19 @@
</item>
</layout>
</item>
<item>
<widget
class=
"Line"
name=
"editLine2"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
...
...
@@ -119,5 +135,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>
editNameLabel
</sender>
<signal>
returnPressed()
</signal>
<receiver>
editFinishButton
</receiver>
<slot>
animateClick()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
136
</x>
<y>
20
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
498
</x>
<y>
86
</y>
</hint>
</hints>
</connection>
</connections>
</ui>
src/ui/designer/QGCToolWidget.cc
View file @
9143c8c5
...
...
@@ -296,7 +296,7 @@ void QGCToolWidget::loadSettings(QVariantMap& settings)
else
if
(
type
==
"COMBO"
)
{
item
=
new
QGCComboBox
(
this
);
//qDebug() << "CREATED
PARAM
COMBOBOX";
//qDebug() << "CREATED COMBOBOX";
}
if
(
item
)
{
...
...
@@ -482,6 +482,7 @@ void QGCToolWidget::contextMenuEvent (QContextMenuEvent* event)
QMenu
menu
(
this
);
menu
.
addAction
(
addParamAction
);
menu
.
addAction
(
addCommandAction
);
menu
.
addAction
(
addLabelAction
);
menu
.
addSeparator
();
menu
.
addAction
(
setTitleAction
);
menu
.
addAction
(
exportAction
);
...
...
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