mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-31 16:52:10 +01:00
LP-29 WelcomeMode must use QQuickWidget instead of QQuickWindow in order to avoid conflicts with new PFDQml
This commit is contained in:
parent
ad83ecca41
commit
b335725aa3
@ -1,14 +1,18 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = Welcome
|
||||
QT += network qml quick
|
||||
|
||||
QT += network qml quick quickwidgets
|
||||
|
||||
include(../../plugin.pri)
|
||||
include(welcome_dependencies.pri)
|
||||
|
||||
HEADERS += welcomeplugin.h \
|
||||
HEADERS += \
|
||||
welcomeplugin.h \
|
||||
welcomemode.h \
|
||||
welcome_global.h
|
||||
SOURCES += welcomeplugin.cpp \
|
||||
|
||||
SOURCES += \
|
||||
welcomeplugin.cpp \
|
||||
welcomemode.cpp \
|
||||
|
||||
RESOURCES += welcome.qrc
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <utils/styledbar.h>
|
||||
#include <utils/welcomemodetreewidget.h>
|
||||
#include <utils/iwelcomepage.h>
|
||||
#include <utils/quickwidgetproxy.h>
|
||||
|
||||
#include <QDesktopServices>
|
||||
|
||||
@ -49,7 +50,7 @@
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include <QtQuick>
|
||||
#include <QQuickView>
|
||||
#include <QQuickWidget>
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
|
||||
@ -59,27 +60,11 @@ using namespace ExtensionSystem;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Welcome {
|
||||
struct WelcomeModePrivate {
|
||||
WelcomeModePrivate();
|
||||
|
||||
QQuickView *quickView;
|
||||
};
|
||||
|
||||
WelcomeModePrivate::WelcomeModePrivate()
|
||||
{}
|
||||
|
||||
// --- WelcomeMode
|
||||
WelcomeMode::WelcomeMode() :
|
||||
m_d(new WelcomeModePrivate),
|
||||
m_quickWidgetProxy(NULL),
|
||||
m_priority(Core::Constants::P_MODE_WELCOME),
|
||||
m_newVersionText("")
|
||||
{
|
||||
m_d->quickView = new QQuickView;
|
||||
m_d->quickView->setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
m_d->quickView->engine()->rootContext()->setContextProperty("welcomePlugin", this);
|
||||
m_d->quickView->setSource(QUrl("qrc:/welcome/qml/main.qml"));
|
||||
m_container = NULL;
|
||||
|
||||
QNetworkAccessManager *networkAccessManager = new QNetworkAccessManager;
|
||||
|
||||
// Only attempt to request our version info if the network is accessible
|
||||
@ -97,10 +82,7 @@ WelcomeMode::WelcomeMode() :
|
||||
}
|
||||
|
||||
WelcomeMode::~WelcomeMode()
|
||||
{
|
||||
delete m_d->quickView;
|
||||
delete m_d;
|
||||
}
|
||||
{}
|
||||
|
||||
QString WelcomeMode::name() const
|
||||
{
|
||||
@ -119,12 +101,13 @@ int WelcomeMode::priority() const
|
||||
|
||||
QWidget *WelcomeMode::widget()
|
||||
{
|
||||
if (!m_container) {
|
||||
m_container = QWidget::createWindowContainer(m_d->quickView);
|
||||
m_container->setMinimumSize(64, 64);
|
||||
m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
if (!m_quickWidgetProxy) {
|
||||
m_quickWidgetProxy = new QuickWidgetProxy();
|
||||
// qWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
m_quickWidgetProxy->engine()->rootContext()->setContextProperty("welcomePlugin", this);
|
||||
m_quickWidgetProxy->setSource(QUrl("qrc:/welcome/qml/main.qml"));
|
||||
}
|
||||
return m_container;
|
||||
return m_quickWidgetProxy->widget();
|
||||
}
|
||||
|
||||
const char *WelcomeMode::uniqueModeName() const
|
||||
|
@ -34,16 +34,14 @@
|
||||
|
||||
#include <coreplugin/imode.h>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QuickWidgetProxy;
|
||||
class QWidget;
|
||||
class QUrl;
|
||||
class QNetworkReply;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Welcome {
|
||||
struct WelcomeModePrivate;
|
||||
|
||||
class WELCOME_EXPORT WelcomeMode : public Core::IMode {
|
||||
Q_OBJECT Q_PROPERTY(QString versionString READ versionString CONSTANT)
|
||||
Q_PROPERTY(QString newVersionText READ newVersionText NOTIFY newVersionTextChanged)
|
||||
@ -86,8 +84,7 @@ public slots:
|
||||
void triggerAction(const QString &actionId);
|
||||
|
||||
private:
|
||||
QWidget *m_container;
|
||||
WelcomeModePrivate *m_d;
|
||||
QuickWidgetProxy *m_quickWidgetProxy;
|
||||
int m_priority;
|
||||
QString m_newVersionText;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user