diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index d45b69cac1af9e8164664928bee7f11672f9fb4e..583264d9654fea8ca0ebed82dc57d6b057dd8e08 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -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 diff --git a/src/ui/uas/UASQuickView.cc b/src/ui/uas/UASQuickView.cc index 63bd952abcf41217cd1c3d38403c699a3d4a42ef..aea0a83f75d51b2f27a943e320dca677ad3a19ce 100644 --- a/src/ui/uas/UASQuickView.cc +++ b/src/ui/uas/UASQuickView.cc @@ -2,6 +2,7 @@ #include #include #include "UASQuickViewItemSelect.h" +#include "UASQuickViewTextItem.h" #include 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 UASQuickViewTextItem(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 UASQuickViewTextItem(this); item->setTitle(senderlabel->text()); ui.verticalLayout->addWidget(item); uasPropertyToLabelMap[senderlabel->text()] = item; diff --git a/src/ui/uas/UASQuickViewItem.cc b/src/ui/uas/UASQuickViewItem.cc index 6c075c64dc3db60acba1b6522acf029c2bfc5833..421a14ef6bbfcd2946523ebe85d4cf06383d8eae 100644 --- a/src/ui/uas/UASQuickViewItem.cc +++ b/src/ui/uas/UASQuickViewItem.cc @@ -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("

0.00

"); - this->layout()->addWidget(valueLabel); - layout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); -} -void UASQuickViewItem::setValue(double value) -{ - valueLabel->setText("

" + QString::number(value,'f',4) + "

"); -} - -void UASQuickViewItem::setTitle(QString title) -{ - titleLabel->setText(title); } diff --git a/src/ui/uas/UASQuickViewItem.h b/src/ui/uas/UASQuickViewItem.h index d6b1b12e0d0188a657fbe6a17557810234cfb88b..a406c4a2aba344b548c678b7d82af19377384e11 100644 --- a/src/ui/uas/UASQuickViewItem.h +++ b/src/ui/uas/UASQuickViewItem.h @@ -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 diff --git a/src/ui/uas/UASQuickViewItemSelect.cpp b/src/ui/uas/UASQuickViewItemSelect.cc similarity index 100% rename from src/ui/uas/UASQuickViewItemSelect.cpp rename to src/ui/uas/UASQuickViewItemSelect.cc diff --git a/src/ui/uas/UASQuickViewTextItem.cc b/src/ui/uas/UASQuickViewTextItem.cc new file mode 100644 index 0000000000000000000000000000000000000000..a3ec42adba9415ce6f0b106e9cae02c9af220cd9 --- /dev/null +++ b/src/ui/uas/UASQuickViewTextItem.cc @@ -0,0 +1,24 @@ +#include "UASQuickViewTextItem.h" +#include +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("

0.00

"); + this->layout()->addWidget(valueLabel); + layout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); +} +void UASQuickViewTextItem::setValue(double value) +{ + valueLabel->setText("

" + QString::number(value,'f',4) + "

"); +} + +void UASQuickViewTextItem::setTitle(QString title) +{ + titleLabel->setText(title); +} diff --git a/src/ui/uas/UASQuickViewTextItem.h b/src/ui/uas/UASQuickViewTextItem.h new file mode 100644 index 0000000000000000000000000000000000000000..620420576e26428997a17c3fd4310ba597082222 --- /dev/null +++ b/src/ui/uas/UASQuickViewTextItem.h @@ -0,0 +1,17 @@ +#ifndef UASQUICKVIEWTEXTITEM_H +#define UASQUICKVIEWTEXTITEM_H + +#include "UASQuickViewItem.h" +#include +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