diff options
author | Eike Ziller <eike.ziller@qt.io> | 2016-11-15 15:58:51 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2016-11-16 06:50:53 +0000 |
commit | 3508a09010623f3be3fed78aedf30bc50b7aa2aa (patch) | |
tree | 110858ee639ef0c85c39817440d19b8b8b6f6382 /src/plugins/welcome/welcomeplugin.cpp | |
parent | 45216d5c1a1d68fb75d267a763031c7c175f869b (diff) |
Fix that files could not be dropped onto welcome screen
Needs to be implemented in Qt Quick itself nowadays.
Task-number: QTCREATORBUG-14194
Change-Id: I0456dc5d86c03672d8b6b8f9c45799851db1b059
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
Diffstat (limited to 'src/plugins/welcome/welcomeplugin.cpp')
-rw-r--r-- | src/plugins/welcome/welcomeplugin.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 884eeb30db..bb445eb636 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -52,6 +52,7 @@ #include <QDir> #include <QQmlPropertyMap> #include <QQuickImageProvider> +#include <QTimer> #include <QtQuickWidgets/QQuickWidget> #include <QtQml/QQmlContext> @@ -135,6 +136,8 @@ public: QStringList recentProjectsShortcuts() const { return m_recentProjectsShortcuts; } QStringList sessionsShortcuts() const { return m_sessionsShortcuts; } + Q_INVOKABLE bool openDroppedFiles(const QList<QUrl> &urls); + public slots: void setActivePlugin(int pos) { @@ -307,6 +310,18 @@ void WelcomeMode::initPlugins() m_welcomePage->setSource(QUrl::fromLocalFile(path)); } +bool WelcomeMode::openDroppedFiles(const QList<QUrl> &urls) +{ + const QList<QUrl> localUrls = Utils::filtered(urls, &QUrl::isLocalFile); + if (!localUrls.isEmpty()) { + QTimer::singleShot(0, [localUrls]() { + ICore::openFiles(Utils::transform(localUrls, &QUrl::toLocalFile), ICore::SwitchMode); + }); + return true; + } + return false; +} + void WelcomeMode::welcomePluginAdded(QObject *obj) { IWelcomePage *page = qobject_cast<IWelcomePage*>(obj); |