Browse Source

The APMToolbar was moved over to thenew QtQuick2 API.

Some functionality was lost, will need to be fixed in a later commit.
QGC4.4
Bryant Mairs 11 years ago
parent
commit
f3b414edf4
  1. 5
      src/ui/MainWindow.cc
  2. 25
      src/ui/apmtoolbar.cpp
  3. 4
      src/ui/apmtoolbar.h

5
src/ui/MainWindow.cc

@ -38,7 +38,7 @@ This file is part of the QGROUNDCONTROL project @@ -38,7 +38,7 @@ This file is part of the QGROUNDCONTROL project
#include <QGCHilLink.h>
#include <QGCHilConfiguration.h>
#include <QGCHilFlightGearConfiguration.h>
#include <QDeclarativeView>
#include <QQuickView>
#include "QGC.h"
#include "MAVLinkSimulationLink.h"
#include "SerialLink.h"
@ -272,7 +272,8 @@ void MainWindow::init() @@ -272,7 +272,8 @@ void MainWindow::init()
apmToolBar->setTerminalViewAction(ui.actionTerminalView);
QDockWidget *widget = new QDockWidget(tr("APM Tool Bar"),this);
widget->setWidget(apmToolBar);
QWidget *toolbarWidget = QWidget::createWindowContainer(apmToolBar, this);
widget->setWidget(toolbarWidget);
widget->setMinimumHeight(72);
widget->setMaximumHeight(72);
widget->setMinimumWidth(1024);

25
src/ui/apmtoolbar.cpp

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
#include <QDebug>
#include <QDeclarativeContext>
#include <QQmlContext>
#include <QGraphicsObject>
#include "LinkManager.h"
#include "MainWindow.h"
@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
#include "apmtoolbar.h"
APMToolBar::APMToolBar(QWidget *parent):
QDeclarativeView(parent), m_uas(0)
QQuickView(), m_uas(0)
{
// Configure our QML object
@ -20,7 +20,7 @@ APMToolBar::APMToolBar(QWidget *parent): @@ -20,7 +20,7 @@ APMToolBar::APMToolBar(QWidget *parent):
#else
setSource(QUrl::fromLocalFile("qml/ApmToolBar.qml"));
#endif
setResizeMode(QDeclarativeView::SizeRootObjectToView);
setResizeMode(QQuickView::SizeRootObjectToView);
this->rootContext()->setContextProperty("globalObj", this);
connect(LinkManager::instance(),SIGNAL(newLink(LinkInterface*)),
this, SLOT(updateLinkDisplay(LinkInterface*)));
@ -55,7 +55,8 @@ void APMToolBar::activeUasSet(UASInterface *uas) @@ -55,7 +55,8 @@ void APMToolBar::activeUasSet(UASInterface *uas)
}
void APMToolBar::armingChanged(bool armed)
{
this->rootObject()->setProperty("armed",armed);
// FIXME: This doesn't work in Qt5, figure out what it should be
//this->rootObject()->setProperty("armed",armed);
}
void APMToolBar::armingChanged(int sysId, QString armingState)
@ -161,8 +162,9 @@ void APMToolBar::connectMAV() @@ -161,8 +162,9 @@ void APMToolBar::connectMAV()
void APMToolBar::setConnection(bool connection)
{
// Change the image to represent the state
QObject *object = rootObject();
object->setProperty("connected", connection);
// FIXME: Doesn't work the same in Qt5, fix this
//QObject *object = rootObject();
//object->setProperty("connected", connection);
}
APMToolBar::~APMToolBar()
@ -198,14 +200,17 @@ void APMToolBar::showConnectionDialog() @@ -198,14 +200,17 @@ void APMToolBar::showConnectionDialog()
void APMToolBar::updateLinkDisplay(LinkInterface* newLink)
{
qDebug() << "APMToolBar: updateLinkDisplay";
QObject *object = rootObject();
// FIXME: Doesn't work the same in Qt5, fix this.
//QObject *object = rootObject();
if (newLink && object){
if (newLink && rootObject()){
qint64 baudrate = newLink->getConnectionSpeed();
object->setProperty("baudrateLabel", QString::number(baudrate));
// FIXME: Doesn't work in Qt5
//object->setProperty("baudrateLabel", QString::number(baudrate));
QString linkName = newLink->getName();
object->setProperty("linkNameLabel", linkName);
// FIXME: Doesn't work in Qt5
//object->setProperty("linkNameLabel", linkName);
connect(newLink, SIGNAL(connected(bool)),
this, SLOT(setConnection(bool)));

4
src/ui/apmtoolbar.h

@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
#define APMTOOLBAR_H
#include <QAction>
#include <QDeclarativeView>
#include <QQuickView>
#include "UASInterface.h"
class LinkInterface;
class APMToolBar : public QDeclarativeView
class APMToolBar : public QQuickView
{
Q_OBJECT
public:

Loading…
Cancel
Save