aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/welcome/welcomeplugin.cpp
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@digia.com>2014-06-16 14:55:37 +0200
committerThomas Hartmann <Thomas.Hartmann@digia.com>2014-06-16 15:26:36 +0200
commit6175fb4ff2441794dba3b0cc3e06834a5fafb2d0 (patch)
tree97a29f0ccb20b835bdcc561a1ffa6bf6db19b1b8 /src/plugins/welcome/welcomeplugin.cpp
parent9cca5767032eab39dd9fdfdaecae2b2650dcb147 (diff)
WelcomePage: Add QMAKE variable for QQuickWidget support
To use QQuickWidget in the welcomepage just run qmake "USE_QUICK_WIDGET=true". I also removed the commented code for the event filter. Change-Id: Ic56527704c0664b3eff4fdf6bef17e250b72db46 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src/plugins/welcome/welcomeplugin.cpp')
-rw-r--r--src/plugins/welcome/welcomeplugin.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp
index 283ab02b76..11d3e2a411 100644
--- a/src/plugins/welcome/welcomeplugin.cpp
+++ b/src/plugins/welcome/welcomeplugin.cpp
@@ -47,7 +47,13 @@
#include <QDir>
-#include <QtQuick/QQuickView>
+#ifdef USE_QUICK_WIDGET
+ #include <QtQuickWidgets/QQuickWidget>
+ typedef QQuickWidget QuickContainer;
+#else
+ #include <QtQuick/QQuickView>
+ typedef QQuickView QuickContainer;
+#endif
#include <QtQml/QQmlContext>
#include <QtQml/QQmlEngine>
@@ -104,7 +110,7 @@ private:
void facilitateQml(QQmlEngine *engine);
QWidget *m_modeWidget;
- QQuickView *m_welcomePage;
+ QuickContainer *m_welcomePage;
QList<QObject*> m_pluginList;
int m_activePlugin;
};
@@ -124,46 +130,40 @@ WelcomeMode::WelcomeMode() :
setContextHelpId(QLatin1String("Qt Creator Manual"));
setContext(Core::Context(Core::Constants::C_WELCOME_MODE));
- m_welcomePage = new QQuickView;
-#if QT_VERSION >= 0x050300
- connect(m_welcomePage, SIGNAL(sceneGraphError(QQuickWindow::SceneGraphError,QString)),
- this, SLOT(sceneGraphError(QQuickWindow::SceneGraphError,QString)));
-#endif // Qt 5.3
- m_welcomePage->setObjectName(QLatin1String("WelcomePage"));
- m_welcomePage->setResizeMode(QQuickView::SizeRootObjectToView);
-
-// filter to forward dragEnter events
-// m_welcomePage->installEventFilter(this);
-// m_welcomePage->viewport()->installEventFilter(this);
-
m_modeWidget = new QWidget;
m_modeWidget->setObjectName(QLatin1String("WelcomePageModeWidget"));
- QVBoxLayout *layout = new QVBoxLayout;
+ QVBoxLayout *layout = new QVBoxLayout(m_modeWidget);
layout->setMargin(0);
layout->setSpacing(0);
+ m_welcomePage = new QuickContainer();
+ m_welcomePage->setResizeMode(QuickContainer::SizeRootObjectToView);
+
+ m_welcomePage->setObjectName(QLatin1String("WelcomePage"));
+
+#if QT_VERSION >= 0x050300
+ connect(m_welcomePage, SIGNAL(sceneGraphError(QQuickWindow::SceneGraphError,QString)),
+ this, SLOT(sceneGraphError(QQuickWindow::SceneGraphError,QString)));
+#endif // Qt 5.3
+
Utils::StyledBar* styledBar = new Utils::StyledBar(m_modeWidget);
styledBar->setObjectName(QLatin1String("WelcomePageStyledBar"));
layout->addWidget(styledBar);
+#ifdef USE_QUICK_WIDGET
+ m_welcomePage->setParent(m_modeWidget);
+ layout->addWidget(m_welcomePage);
+#else
QWidget *container = QWidget::createWindowContainer(m_welcomePage, m_modeWidget);
m_modeWidget->setLayout(layout);
layout->addWidget(container);
+#endif // USE_QUICK_WIDGET
connect(PluginManager::instance(), SIGNAL(objectAdded(QObject*)), SLOT(welcomePluginAdded(QObject*)));
setWidget(m_modeWidget);
}
-//bool WelcomeMode::eventFilter(QObject *, QEvent *e)
-//{
-// if (e->type() == QEvent::DragEnter) {
-// e->ignore();
-// return true;
-// }
-// return false;
-//}
-
WelcomeMode::~WelcomeMode()
{
QSettings *settings = Core::ICore::settings();