moved the qml filedialog opening code below the ios section
This commit is contained in:
parent
a76e22c021
commit
e1fa24c251
1 changed files with 12 additions and 12 deletions
|
|
@ -56,18 +56,6 @@ void SystemController::saveFile(QString fileName, const QString &data)
|
||||||
|
|
||||||
QString SystemController::getFileName()
|
QString SystemController::getFileName()
|
||||||
{
|
{
|
||||||
auto mainFileDialog = m_qmlRoot->findChild<QObject>("mainFileDialog").parent();
|
|
||||||
if (!mainFileDialog) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
QMetaObject::invokeMethod(mainFileDialog, "open", Qt::DirectConnection);
|
|
||||||
|
|
||||||
QEventLoop wait;
|
|
||||||
QObject::connect(this, &SystemController::fileDialogAccepted, &wait, &QEventLoop::quit);
|
|
||||||
wait.exec();
|
|
||||||
|
|
||||||
auto fileName = mainFileDialog->property("selectedFile").toString();
|
|
||||||
|
|
||||||
#ifdef Q_OS_IOS
|
#ifdef Q_OS_IOS
|
||||||
CFURLRef url = CFURLCreateWithFileSystemPath(
|
CFURLRef url = CFURLCreateWithFileSystemPath(
|
||||||
kCFAllocatorDefault,
|
kCFAllocatorDefault,
|
||||||
|
|
@ -81,6 +69,18 @@ QString SystemController::getFileName()
|
||||||
return fileName;
|
return fileName;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
auto mainFileDialog = m_qmlRoot->findChild<QObject>("mainFileDialog").parent();
|
||||||
|
if (!mainFileDialog) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
QMetaObject::invokeMethod(mainFileDialog, "open", Qt::DirectConnection);
|
||||||
|
|
||||||
|
QEventLoop wait;
|
||||||
|
QObject::connect(this, &SystemController::fileDialogAccepted, &wait, &QEventLoop::quit);
|
||||||
|
wait.exec();
|
||||||
|
|
||||||
|
auto fileName = mainFileDialog->property("selectedFile").toString();
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
// patch for files containing spaces etc
|
// patch for files containing spaces etc
|
||||||
const QString sep { "raw%3A%2F" };
|
const QString sep { "raw%3A%2F" };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue