mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
OP-1109: port plugins/pfdqml
This commit is contained in:
parent
710f73d219
commit
bac4f96d1c
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: sceneItem
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
import "."
|
||||
|
||||
Item {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import QtQuick 1.1
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: sceneItem
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: info
|
||||
|
@ -1,4 +1,4 @@
|
||||
import QtQuick 1.1
|
||||
import QtQuick 2.0
|
||||
|
||||
Rectangle {
|
||||
color: "#666666"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: sceneItem
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
import org.OpenPilot 1.0
|
||||
|
||||
OsgEarth {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: worldView
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
import "."
|
||||
|
||||
Item {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: sceneItem
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
|
||||
Image {
|
||||
id: sceneItem
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: sceneItem
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: sceneItem
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Qt 4.7
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: warnings
|
||||
|
@ -2,7 +2,7 @@ TEMPLATE = lib
|
||||
TARGET = PfdQml
|
||||
QT += svg
|
||||
QT += opengl
|
||||
QT += declarative
|
||||
QT += qml quick
|
||||
OSG {
|
||||
DEFINES += USE_OSG
|
||||
}
|
||||
|
@ -21,7 +21,10 @@
|
||||
PfdQmlGadget::PfdQmlGadget(QString classId, PfdQmlGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{}
|
||||
{
|
||||
m_container = NULL;
|
||||
m_parent = parent;
|
||||
}
|
||||
|
||||
PfdQmlGadget::~PfdQmlGadget()
|
||||
{
|
||||
|
@ -35,11 +35,18 @@ public:
|
||||
|
||||
QWidget *widget()
|
||||
{
|
||||
return m_widget;
|
||||
if(!m_container){
|
||||
m_container = QWidget::createWindowContainer(m_widget, m_parent);
|
||||
m_container->setMinimumSize(64, 64);
|
||||
m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
}
|
||||
return m_container;
|
||||
}
|
||||
void loadConfiguration(IUAVGadgetConfiguration *config);
|
||||
|
||||
private:
|
||||
QWidget *m_container;
|
||||
QWidget *m_parent;
|
||||
PfdQmlGadgetWidget *m_widget;
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,7 @@ PfdQmlGadgetFactory::~PfdQmlGadgetFactory()
|
||||
|
||||
Core::IUAVGadget *PfdQmlGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
PfdQmlGadgetWidget *gadgetWidget = new PfdQmlGadgetWidget(parent);
|
||||
PfdQmlGadgetWidget *gadgetWidget = new PfdQmlGadgetWidget();
|
||||
|
||||
return new PfdQmlGadget(QString("PfdQmlGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
@ -29,12 +29,11 @@
|
||||
#include <QtCore/qdir.h>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include <QtDeclarative/qdeclarativeengine.h>
|
||||
#include <QtDeclarative/qdeclarativecontext.h>
|
||||
#include <QtDeclarative/qdeclarativeengine.h>
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
|
||||
PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
|
||||
QDeclarativeView(parent),
|
||||
PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWindow *parent) :
|
||||
QQuickView(parent),
|
||||
m_openGLEnabled(false),
|
||||
m_terrainEnabled(false),
|
||||
m_actualPositionUsed(false),
|
||||
@ -46,8 +45,6 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
|
||||
m_altitudeUnit("m"),
|
||||
m_altitudeFactor(1.0)
|
||||
{
|
||||
setMinimumSize(64, 64);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
setResizeMode(SizeRootObjectToView);
|
||||
|
||||
// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||
@ -107,7 +104,7 @@ void PfdQmlGadgetWidget::setQmlFile(QString fn)
|
||||
qDebug() << Q_FUNC_INFO << fn;
|
||||
setSource(QUrl::fromLocalFile(fn));
|
||||
|
||||
foreach(const QDeclarativeError &error, errors()) {
|
||||
foreach(const QQmlError &error, errors()) {
|
||||
qDebug() << error.description();
|
||||
}
|
||||
}
|
||||
@ -165,20 +162,8 @@ void PfdQmlGadgetWidget::setAltitudeFactor(double factor)
|
||||
|
||||
void PfdQmlGadgetWidget::setOpenGLEnabled(bool arg)
|
||||
{
|
||||
if (m_openGLEnabled != arg) {
|
||||
m_openGLEnabled = arg;
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "Set OPENGL" << m_openGLEnabled;
|
||||
if (m_openGLEnabled) {
|
||||
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||
} else {
|
||||
setViewport(new QWidget);
|
||||
}
|
||||
|
||||
// update terrainEnabled status with opengl status chaged
|
||||
setTerrainEnabled(m_terrainEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
// Switch between PositionState UAVObject position
|
||||
// and pre-defined latitude/longitude/altitude properties
|
||||
@ -197,7 +182,7 @@ void PfdQmlGadgetWidget::mouseReleaseEvent(QMouseEvent *event)
|
||||
setQmlFile(m_qmlFileName);
|
||||
}
|
||||
|
||||
QDeclarativeView::mouseReleaseEvent(event);
|
||||
QQuickView::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::setLatitude(double arg)
|
||||
|
@ -18,9 +18,9 @@
|
||||
#define PFDQMLGADGETWIDGET_H_
|
||||
|
||||
#include "pfdqmlgadgetconfiguration.h"
|
||||
#include <QtDeclarative/qdeclarativeview.h>
|
||||
#include <QQuickView>
|
||||
|
||||
class PfdQmlGadgetWidget : public QDeclarativeView {
|
||||
class PfdQmlGadgetWidget : public QQuickView {
|
||||
Q_OBJECT Q_PROPERTY(QString earthFile READ earthFile WRITE setEarthFile NOTIFY earthFileChanged)
|
||||
Q_PROPERTY(bool terrainEnabled READ terrainEnabled WRITE setTerrainEnabled NOTIFY terrainEnabledChanged)
|
||||
|
||||
@ -37,7 +37,7 @@ class PfdQmlGadgetWidget : public QDeclarativeView {
|
||||
Q_PROPERTY(double altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged)
|
||||
|
||||
public:
|
||||
PfdQmlGadgetWidget(QWidget *parent = 0);
|
||||
PfdQmlGadgetWidget(QWindow *parent = 0);
|
||||
~PfdQmlGadgetWidget();
|
||||
void setQmlFile(QString fn);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user