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 {
|
Item {
|
||||||
id: sceneItem
|
id: sceneItem
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import QtQuick 1.1
|
import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sceneItem
|
id: sceneItem
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: info
|
id: info
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import QtQuick 1.1
|
import QtQuick 2.0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: "#666666"
|
color: "#666666"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sceneItem
|
id: sceneItem
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
import org.OpenPilot 1.0
|
import org.OpenPilot 1.0
|
||||||
|
|
||||||
OsgEarth {
|
OsgEarth {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: worldView
|
id: worldView
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sceneItem
|
id: sceneItem
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: sceneItem
|
id: sceneItem
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sceneItem
|
id: sceneItem
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sceneItem
|
id: sceneItem
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Qt 4.7
|
import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: warnings
|
id: warnings
|
||||||
|
@ -2,7 +2,7 @@ TEMPLATE = lib
|
|||||||
TARGET = PfdQml
|
TARGET = PfdQml
|
||||||
QT += svg
|
QT += svg
|
||||||
QT += opengl
|
QT += opengl
|
||||||
QT += declarative
|
QT += qml quick
|
||||||
OSG {
|
OSG {
|
||||||
DEFINES += USE_OSG
|
DEFINES += USE_OSG
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,10 @@
|
|||||||
PfdQmlGadget::PfdQmlGadget(QString classId, PfdQmlGadgetWidget *widget, QWidget *parent) :
|
PfdQmlGadget::PfdQmlGadget(QString classId, PfdQmlGadgetWidget *widget, QWidget *parent) :
|
||||||
IUAVGadget(classId, parent),
|
IUAVGadget(classId, parent),
|
||||||
m_widget(widget)
|
m_widget(widget)
|
||||||
{}
|
{
|
||||||
|
m_container = NULL;
|
||||||
|
m_parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
PfdQmlGadget::~PfdQmlGadget()
|
PfdQmlGadget::~PfdQmlGadget()
|
||||||
{
|
{
|
||||||
|
@ -35,11 +35,18 @@ public:
|
|||||||
|
|
||||||
QWidget *widget()
|
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);
|
void loadConfiguration(IUAVGadgetConfiguration *config);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QWidget *m_container;
|
||||||
|
QWidget *m_parent;
|
||||||
PfdQmlGadgetWidget *m_widget;
|
PfdQmlGadgetWidget *m_widget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ PfdQmlGadgetFactory::~PfdQmlGadgetFactory()
|
|||||||
|
|
||||||
Core::IUAVGadget *PfdQmlGadgetFactory::createGadget(QWidget *parent)
|
Core::IUAVGadget *PfdQmlGadgetFactory::createGadget(QWidget *parent)
|
||||||
{
|
{
|
||||||
PfdQmlGadgetWidget *gadgetWidget = new PfdQmlGadgetWidget(parent);
|
PfdQmlGadgetWidget *gadgetWidget = new PfdQmlGadgetWidget();
|
||||||
|
|
||||||
return new PfdQmlGadget(QString("PfdQmlGadget"), gadgetWidget, parent);
|
return new PfdQmlGadget(QString("PfdQmlGadget"), gadgetWidget, parent);
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,11 @@
|
|||||||
#include <QtCore/qdir.h>
|
#include <QtCore/qdir.h>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#include <QtDeclarative/qdeclarativeengine.h>
|
#include <QQmlEngine>
|
||||||
#include <QtDeclarative/qdeclarativecontext.h>
|
#include <QQmlContext>
|
||||||
#include <QtDeclarative/qdeclarativeengine.h>
|
|
||||||
|
|
||||||
PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
|
PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWindow *parent) :
|
||||||
QDeclarativeView(parent),
|
QQuickView(parent),
|
||||||
m_openGLEnabled(false),
|
m_openGLEnabled(false),
|
||||||
m_terrainEnabled(false),
|
m_terrainEnabled(false),
|
||||||
m_actualPositionUsed(false),
|
m_actualPositionUsed(false),
|
||||||
@ -46,8 +45,6 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
|
|||||||
m_altitudeUnit("m"),
|
m_altitudeUnit("m"),
|
||||||
m_altitudeFactor(1.0)
|
m_altitudeFactor(1.0)
|
||||||
{
|
{
|
||||||
setMinimumSize(64, 64);
|
|
||||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
||||||
setResizeMode(SizeRootObjectToView);
|
setResizeMode(SizeRootObjectToView);
|
||||||
|
|
||||||
// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||||
@ -107,7 +104,7 @@ void PfdQmlGadgetWidget::setQmlFile(QString fn)
|
|||||||
qDebug() << Q_FUNC_INFO << fn;
|
qDebug() << Q_FUNC_INFO << fn;
|
||||||
setSource(QUrl::fromLocalFile(fn));
|
setSource(QUrl::fromLocalFile(fn));
|
||||||
|
|
||||||
foreach(const QDeclarativeError &error, errors()) {
|
foreach(const QQmlError &error, errors()) {
|
||||||
qDebug() << error.description();
|
qDebug() << error.description();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,19 +162,7 @@ void PfdQmlGadgetWidget::setAltitudeFactor(double factor)
|
|||||||
|
|
||||||
void PfdQmlGadgetWidget::setOpenGLEnabled(bool arg)
|
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);
|
setTerrainEnabled(m_terrainEnabled);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch between PositionState UAVObject position
|
// Switch between PositionState UAVObject position
|
||||||
@ -197,7 +182,7 @@ void PfdQmlGadgetWidget::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
setQmlFile(m_qmlFileName);
|
setQmlFile(m_qmlFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDeclarativeView::mouseReleaseEvent(event);
|
QQuickView::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PfdQmlGadgetWidget::setLatitude(double arg)
|
void PfdQmlGadgetWidget::setLatitude(double arg)
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
#define PFDQMLGADGETWIDGET_H_
|
#define PFDQMLGADGETWIDGET_H_
|
||||||
|
|
||||||
#include "pfdqmlgadgetconfiguration.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_OBJECT Q_PROPERTY(QString earthFile READ earthFile WRITE setEarthFile NOTIFY earthFileChanged)
|
||||||
Q_PROPERTY(bool terrainEnabled READ terrainEnabled WRITE setTerrainEnabled NOTIFY terrainEnabledChanged)
|
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)
|
Q_PROPERTY(double altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PfdQmlGadgetWidget(QWidget *parent = 0);
|
PfdQmlGadgetWidget(QWindow *parent = 0);
|
||||||
~PfdQmlGadgetWidget();
|
~PfdQmlGadgetWidget();
|
||||||
void setQmlFile(QString fn);
|
void setQmlFile(QString fn);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user