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
a16f9bdf
Commit
a16f9bdf
authored
Oct 12, 2013
by
John Tapsell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the UI for editing a text label
parent
d046a5f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
114 deletions
+82
-114
QGCTextLabel.cc
src/ui/designer/QGCTextLabel.cc
+6
-29
QGCTextLabel.h
src/ui/designer/QGCTextLabel.h
+1
-0
QGCTextLabel.ui
src/ui/designer/QGCTextLabel.ui
+75
-85
No files found.
src/ui/designer/QGCTextLabel.cc
View file @
a16f9bdf
...
...
@@ -19,13 +19,7 @@ QGCTextLabel::QGCTextLabel(QWidget *parent) :
// Hide all edit items
ui
->
editFinishButton
->
hide
();
ui
->
editNameLabel
->
hide
();
ui
->
editTextParam
->
hide
();
ui
->
editComponentSpinBox
->
hide
();
ui
->
editLine1
->
hide
();
ui
->
editLine2
->
hide
();
// Add commands to combo box
}
QGCTextLabel
::~
QGCTextLabel
()
...
...
@@ -37,13 +31,9 @@ void QGCTextLabel::startEditMode()
{
// Hide elements
ui
->
nameLabel
->
hide
();
ui
->
editTextParam
->
show
();
ui
->
editFinishButton
->
show
();
ui
->
editNameLabel
->
show
();
ui
->
editComponentSpinBox
->
show
();
ui
->
editLine1
->
show
();
ui
->
editLine2
->
show
();
// Attempt to undock the dock widget
QWidget
*
p
=
this
;
...
...
@@ -66,12 +56,8 @@ void QGCTextLabel::startEditMode()
void
QGCTextLabel
::
endEditMode
()
{
ui
->
editFinishButton
->
hide
();
ui
->
editTextParam
->
hide
();
ui
->
editNameLabel
->
hide
();
ui
->
editComponentSpinBox
->
hide
();
ui
->
editLine1
->
hide
();
ui
->
editLine2
->
hide
();
ui
->
nameLabel
->
show
();
// Write to settings
...
...
@@ -105,23 +91,17 @@ void QGCTextLabel::writeSettings(QSettings& settings)
}
void
QGCTextLabel
::
readSettings
(
const
QString
&
pre
,
const
QVariantMap
&
settings
)
{
ui
->
editTextParam
->
setText
(
settings
.
value
(
pre
+
"QGC_TEXT_SOURCE"
,
"UNKNOWN"
).
toString
());
//ui->editCommandComboBox->setCurrentIndex(settings.value(pre + "QGC_COMMAND_BUTTON_COMMANDID", 0).toInt());
if
(
ui
->
editTextParam
->
text
()
==
"NONE"
)
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
if
(
ui
->
editTextParam
->
text
()
==
"MAV"
)
else
{
//MAV command text
connect
(
uas
,
SIGNAL
(
textMessageReceived
(
int
,
int
,
int
,
QString
)),
this
,
SLOT
(
textMessageReceived
(
int
,
int
,
int
,
QString
)));
}
//int commandId = settings.value(pre + "QGC_COMMAND_BUTTON_COMMANDID", 0).toInt();
//ui->editNameLabel->setText(settings.value(pre + "QGC_COMMAND_BUTTON_DESCRIPTION", "ERROR LOADING BUTTON").toString());
//ui->nameLabel->setText(settings.value(pre + "QGC_COMMAND_BUTTON_DESCRIPTION", "ERROR LOADING BUTTON").toString());
}
void
QGCTextLabel
::
textMessageReceived
(
int
uasid
,
int
component
,
int
severity
,
QString
message
)
{
...
...
@@ -148,17 +128,14 @@ void QGCTextLabel::textMessageReceived(int uasid, int component, int severity, Q
void
QGCTextLabel
::
readSettings
(
const
QSettings
&
settings
)
{
//ui->editNameLabel->setText(settings.value("QGC_COMMAND_BUTTON_DESCRIPTION", "ERROR LOADING BUTTON").toString());
//ui->nameLabel->setText(settings.value("QGC_COMMAND_BUTTON_DESCRIPTION", "ERROR LOADING BUTTON").toString());
ui
->
editTextParam
->
setText
(
settings
.
value
(
"QGC_TEXT_SOURCE"
,
"UNKNOWN"
).
toString
());
ui
->
isMavCommand
->
setChecked
(
settings
.
value
(
"QGC_TEXT_SOURCE"
,
"NONE"
).
toString
()
==
"MAV"
);
ui
->
editNameLabel
->
setText
(
settings
.
value
(
"QGC_TEXT_TEXT"
,
""
).
toString
());
//ui->editCommandComboBox->setCurrentIndex(settings.value(pre + "QGC_COMMAND_BUTTON_COMMANDID", 0).toInt());
if
(
ui
->
editTextParam
->
text
()
==
"NONE"
)
if
(
!
ui
->
isMavCommand
->
isChecked
())
{
ui
->
textLabel
->
setText
(
ui
->
editNameLabel
->
text
());
ui
->
nameLabel
->
setText
(
""
);
}
else
if
(
ui
->
editTextParam
->
text
()
==
"MAV"
)
else
{
//MAV command text
ui
->
nameLabel
->
setText
(
ui
->
editNameLabel
->
text
());
...
...
src/ui/designer/QGCTextLabel.h
View file @
a16f9bdf
...
...
@@ -26,6 +26,7 @@ public slots:
void
readSettings
(
const
QSettings
&
settings
);
void
readSettings
(
const
QString
&
pre
,
const
QVariantMap
&
settings
);
void
textMessageReceived
(
int
uasid
,
int
componentId
,
int
severity
,
QString
message
);
private:
int
enabledNum
;
Ui
::
QGCTextLabel
*
ui
;
...
...
src/ui/designer/QGCTextLabel.ui
View file @
a16f9bdf
...
...
@@ -6,34 +6,36 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
1183
</width>
<height>
1
66
</height>
<width>
554
</width>
<height>
1
07
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"100,0,0"
>
<property
name=
"leftMargin"
>
<number>
6
</number>
</property>
<property
name=
"topMargin"
>
<number>
3
</number>
</property>
<property
name=
"rightMargin"
>
<number>
6
</number>
</property>
<property
name=
"bottomMargin"
>
<number>
3
</number>
</property>
<item
row=
"2"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLineEdit"
name=
"editNameLabel"
>
<property
name=
"text"
>
<string>
<
Label Description Label (in front of text)
>
</string>
</property>
</widget>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QLineEdit"
name=
"editNameLabel"
>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"placeholderText"
>
<string>
Label Description
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"isMavCommand"
>
<property
name=
"text"
>
<string>
Mav Command
</string>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"1"
column=
"0"
colspan=
"3"
>
<item>
<widget
class=
"Line"
name=
"editLine1"
>
<property
name=
"minimumSize"
>
<size>
...
...
@@ -46,68 +48,56 @@
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"nameLabel"
>
<property
name=
"minimumSize"
>
<size>
<width>
50
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Description
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</widget>
</item>
<item
row=
"2"
column=
"2"
>
<widget
class=
"QLineEdit"
name=
"editTextParam"
>
<property
name=
"text"
>
<string>
<
Text Param
>
</string>
</property>
</widget>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QLabel"
name=
"nameLabel"
>
<property
name=
"minimumSize"
>
<size>
<width>
50
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Description
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"textLabel"
>
<property
name=
"text"
>
<string>
TextLabel
</string>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"6"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"editFinishButton"
>
<property
name=
"text"
>
<string>
Done
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
>
<widget
class=
"QSpinBox"
name=
"editComponentSpinBox"
>
<property
name=
"prefix"
>
<string>
Component ID:
</string>
</property>
<property
name=
"minimum"
>
<number>
0
</number>
</property>
<property
name=
"maximum"
>
<number>
255
</number>
</property>
</widget>
</item>
<item
row=
"7"
column=
"0"
colspan=
"3"
>
<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>
<item
row=
"3"
column=
"2"
>
<widget
class=
"QLabel"
name=
"textLabel"
>
<property
name=
"text"
>
<string>
TextLabel
</string>
</property>
</widget>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"editFinishButton"
>
<property
name=
"text"
>
<string>
Done
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
...
...
@@ -120,8 +110,8 @@
<slot>
setText(QString)
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
114
</x>
<y>
2
2
</y>
<x>
280
</x>
<y>
3
2
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
114
</x>
...
...
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