Paste P429

Masterwork From Distant Lands
ActivePublic

Authored by apol on Jul 9 2019, 1:44 AM.
diff --git a/src/platformtheme/kdemobileplatformfiledialoghelper.cpp b/src/platformtheme/kdemobileplatformfiledialoghelper.cpp
index 86b0837..9cee67f 100644
--- a/src/platformtheme/kdemobileplatformfiledialoghelper.cpp
+++ b/src/platformtheme/kdemobileplatformfiledialoghelper.cpp
@@ -27,6 +27,8 @@
#include <QQmlContext>
#include <QStandardPaths>
#include <QUrl>
+#include <QQuickWindow>
+#include <QCoreApplication>
// FIXME: remove
#include <QDebug>
@@ -50,21 +52,28 @@ KDEMobilePlatformFileDialogHelper::~KDEMobilePlatformFileDialogHelper() = defaul
void KDEMobilePlatformFileDialogHelper::exec()
{
qDebug() << "exec()";
+// (void) m_eventLoop.exec(QEventLoop::DialogExec);
// m_engine->load(QUrl(QStringLiteral("qrc:///filedialog.qml")));
}
bool KDEMobilePlatformFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
{
- qDebug() << "show()";
-
- // with false the QML application window works and the fallback dialog is opened
-// return false;
- // with true nothing is displayed
- return true;
+ for (auto o : m_engine->rootObjects()) {
+ QQuickWindow* window = qobject_cast<QQuickWindow*>(o);
+ window->setFlags(windowFlags);
+ window->setModality(windowModality);
+ window->setParent(parent);
+ window->setVisible(true);
+ }
+ qDebug() << "show()" << windowModality;
+
+ return !m_engine->rootObjects().isEmpty();
}
void KDEMobilePlatformFileDialogHelper::hide()
{
+ for (auto o : m_engine->rootObjects())
+ o->setProperty("visible", false);
qDebug() << "hide()";
}
diff --git a/src/platformtheme/kdemobileplatformfiledialoghelper.h b/src/platformtheme/kdemobileplatformfiledialoghelper.h
index 5e7fb9b..9e07e10 100644
--- a/src/platformtheme/kdemobileplatformfiledialoghelper.h
+++ b/src/platformtheme/kdemobileplatformfiledialoghelper.h
@@ -23,6 +23,7 @@
#define KDEMOBILEPLATFORMFILEDIALOGHELPER_H
#include <qpa/qplatformdialoghelper.h>
+#include <QEventLoop>
class QQmlApplicationEngine;
class KDEMobilePlatformFileDialogHelper : public QPlatformFileDialogHelper
@@ -51,6 +52,7 @@ public:
// bool isSupportedUrl(const QUrl& url) const override;
private:
+ QEventLoop m_eventLoop;
QQmlApplicationEngine *m_engine;
};
apol edited the content of this paste. (Show Details)Jul 9 2019, 1:44 AM
apol changed the title of this paste from untitled to Masterwork From Distant Lands.