1
0
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:
Alessio Morale 2013-11-14 00:48:00 +01:00
parent 710f73d219
commit bac4f96d1c
20 changed files with 37 additions and 42 deletions

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
Item {
id: sceneItem

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
import "."
Item {

View File

@ -1,4 +1,4 @@
import QtQuick 1.1
import QtQuick 2.0
Item {
id: sceneItem

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
Item {
id: info

View File

@ -1,4 +1,4 @@
import QtQuick 1.1
import QtQuick 2.0
Rectangle {
color: "#666666"

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
Item {
id: sceneItem

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
import org.OpenPilot 1.0
OsgEarth {

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
Item {
id: worldView

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
import "."
Item {

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
Item {
id: sceneItem

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
Image {
id: sceneItem

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
Item {
id: sceneItem

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
Item {
id: sceneItem

View File

@ -1,4 +1,4 @@
import Qt 4.7
import QtQuick 2.0
Item {
id: warnings

View File

@ -2,7 +2,7 @@ TEMPLATE = lib
TARGET = PfdQml
QT += svg
QT += opengl
QT += declarative
QT += qml quick
OSG {
DEFINES += USE_OSG
}

View File

@ -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()
{

View File

@ -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;
};

View File

@ -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);
}

View File

@ -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,19 +162,7 @@ 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
@ -197,7 +182,7 @@ void PfdQmlGadgetWidget::mouseReleaseEvent(QMouseEvent *event)
setQmlFile(m_qmlFileName);
}
QDeclarativeView::mouseReleaseEvent(event);
QQuickView::mouseReleaseEvent(event);
}
void PfdQmlGadgetWidget::setLatitude(double arg)

View File

@ -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);