Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
051d56a9
Commit
051d56a9
authored
May 28, 2013
by
Michael Carpenter
Browse files
Abstraction of UASQuickViewItem, and addition of new Text item to use the abstraction
parent
c6cd2cc0
Changes
7
Hide whitespace changes
Inline
Side-by-side
qgroundcontrol.pro
View file @
051d56a9
...
...
@@ -378,7 +378,8 @@ HEADERS += src/MG.h \
src
/
ui
/
dockwidgettitlebareventfilter
.
h
\
src
/
ui
/
uas
/
UASQuickView
.
h
\
src
/
ui
/
uas
/
UASQuickViewItem
.
h
\
src
/
ui
/
uas
/
UASQuickViewItemSelect
.
h
src
/
ui
/
uas
/
UASQuickViewItemSelect
.
h
\
src
/
ui
/
uas
/
UASQuickViewTextItem
.
h
#
Google
Earth
is
only
supported
on
Mac
OS
and
Windows
with
Visual
Studio
Compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
|
win32
-
msvc2012
::
HEADERS
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
h
...
...
@@ -547,7 +548,8 @@ SOURCES += src/main.cc \
src
/
ui
/
dockwidgettitlebareventfilter
.
cpp
\
src
/
ui
/
uas
/
UASQuickViewItem
.
cc
\
src
/
ui
/
uas
/
UASQuickView
.
cc
\
src
/
ui
/
uas
/
UASQuickViewItemSelect
.
cpp
src
/
ui
/
uas
/
UASQuickViewTextItem
.
cc
\
src
/
ui
/
uas
/
UASQuickViewItemSelect
.
cc
#
Enable
Google
Earth
only
on
Mac
OS
and
Windows
with
Visual
Studio
compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
|
win32
-
msvc2012
::
SOURCES
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
cc
...
...
src/ui/uas/UASQuickView.cc
View file @
051d56a9
...
...
@@ -2,6 +2,7 @@
#include
<QMetaMethod>
#include
<QDebug>
#include
"UASQuickViewItemSelect.h"
#include
"UASQuickViewTextItem.h"
#include
<QSettings>
UASQuickView
::
UASQuickView
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
...
...
@@ -146,7 +147,7 @@ void UASQuickView::loadSettings()
void
UASQuickView
::
valueEnabled
(
QString
value
)
{
UASQuickViewItem
*
item
=
new
UASQuickViewItem
(
this
);
UASQuickViewItem
*
item
=
new
UASQuickView
Text
Item
(
this
);
item
->
setTitle
(
value
);
ui
.
verticalLayout
->
addWidget
(
item
);
uasPropertyToLabelMap
[
value
]
=
item
;
...
...
@@ -359,7 +360,7 @@ void UASQuickView::actionTriggered(bool checked)
}
if
(
checked
)
{
UASQuickViewItem
*
item
=
new
UASQuickViewItem
(
this
);
UASQuickViewItem
*
item
=
new
UASQuickView
Text
Item
(
this
);
item
->
setTitle
(
senderlabel
->
text
());
ui
.
verticalLayout
->
addWidget
(
item
);
uasPropertyToLabelMap
[
senderlabel
->
text
()]
=
item
;
...
...
src/ui/uas/UASQuickViewItem.cc
View file @
051d56a9
...
...
@@ -3,24 +3,5 @@
UASQuickViewItem
::
UASQuickViewItem
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
this
->
setLayout
(
layout
);
titleLabel
=
new
QLabel
(
this
);
titleLabel
->
setAlignment
(
Qt
::
AlignHCenter
);
this
->
layout
()
->
addWidget
(
titleLabel
);
valueLabel
=
new
QLabel
(
this
);
valueLabel
->
setAlignment
(
Qt
::
AlignHCenter
);
valueLabel
->
setText
(
"<h1>0.00</h1>"
);
this
->
layout
()
->
addWidget
(
valueLabel
);
layout
->
addSpacerItem
(
new
QSpacerItem
(
20
,
40
,
QSizePolicy
::
Minimum
,
QSizePolicy
::
Expanding
));
}
void
UASQuickViewItem
::
setValue
(
double
value
)
{
valueLabel
->
setText
(
"<h1>"
+
QString
::
number
(
value
,
'f'
,
4
)
+
"</h1>"
);
}
void
UASQuickViewItem
::
setTitle
(
QString
title
)
{
titleLabel
->
setText
(
title
);
}
src/ui/uas/UASQuickViewItem.h
View file @
051d56a9
...
...
@@ -8,15 +8,8 @@ class UASQuickViewItem : public QWidget
Q_OBJECT
public:
explicit
UASQuickViewItem
(
QWidget
*
parent
=
0
);
void
setValue
(
double
value
);
void
setTitle
(
QString
title
);
private:
QLabel
*
titleLabel
;
QLabel
*
valueLabel
;
signals:
public
slots
:
virtual
void
setValue
(
double
value
)
=
0
;
virtual
void
setTitle
(
QString
title
)
=
0
;
};
#endif // UASQUICKVIEWITEM_H
src/ui/uas/UASQuickViewItemSelect.c
pp
→
src/ui/uas/UASQuickViewItemSelect.c
c
View file @
051d56a9
File moved
src/ui/uas/UASQuickViewTextItem.cc
0 → 100644
View file @
051d56a9
#include
"UASQuickViewTextItem.h"
#include
<QVBoxLayout>
UASQuickViewTextItem
::
UASQuickViewTextItem
(
QWidget
*
parent
)
:
UASQuickViewItem
(
parent
)
{
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
this
->
setLayout
(
layout
);
titleLabel
=
new
QLabel
(
this
);
titleLabel
->
setAlignment
(
Qt
::
AlignHCenter
);
this
->
layout
()
->
addWidget
(
titleLabel
);
valueLabel
=
new
QLabel
(
this
);
valueLabel
->
setAlignment
(
Qt
::
AlignHCenter
);
valueLabel
->
setText
(
"<h1>0.00</h1>"
);
this
->
layout
()
->
addWidget
(
valueLabel
);
layout
->
addSpacerItem
(
new
QSpacerItem
(
20
,
40
,
QSizePolicy
::
Minimum
,
QSizePolicy
::
Expanding
));
}
void
UASQuickViewTextItem
::
setValue
(
double
value
)
{
valueLabel
->
setText
(
"<h1>"
+
QString
::
number
(
value
,
'f'
,
4
)
+
"</h1>"
);
}
void
UASQuickViewTextItem
::
setTitle
(
QString
title
)
{
titleLabel
->
setText
(
title
);
}
src/ui/uas/UASQuickViewTextItem.h
0 → 100644
View file @
051d56a9
#ifndef UASQUICKVIEWTEXTITEM_H
#define UASQUICKVIEWTEXTITEM_H
#include
"UASQuickViewItem.h"
#include
<QLabel>
class
UASQuickViewTextItem
:
public
UASQuickViewItem
{
public:
UASQuickViewTextItem
(
QWidget
*
parent
=
0
);
void
setValue
(
double
value
);
void
setTitle
(
QString
title
);
private:
QLabel
*
titleLabel
;
QLabel
*
valueLabel
;
};
#endif // UASQUICKVIEWTEXTITEM_H
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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