summaryrefslogtreecommitdiffstats
path: root/src/widgets/compat
diff options
context:
space:
mode:
authorChris Von Bargen <christopher.vonbargen@schrodinger.com>2023-12-18 10:28:34 -0500
committerAxel Spoerl <axel.spoerl@qt.io>2023-12-28 17:16:12 +0100
commit7c5cf8cae054954975a3e262f7fe3cd9897d67f4 (patch)
treeec95979625f3472012bd1c2b8ebaa853fcd9f5a3 /src/widgets/compat
parent7372b3ab6748b68f1c5fba1f61df8083ce719bc5 (diff)
Add parent arg to QFileDialog::getOpenFileContent and saveFileContent
This change updates getOpenFileContent to provide a parent when the non-WASM fallback to a QFileDialog is created, which avoids issues where this call is made inside another application. Specifically, if a QDialog is created lacking a parent to the main window, it will prevent interaction with that dialog. This patch addresses that problem with window modality. This change also updates saveFileContent to provide a parent for the fallback mechanism, so that both static APIs that interact with WASM/non-WASM dialogs have comparable behavior. The new parent argument is updated in the documentation. Documentation is clarified in terms of usage outside Qt for WebAssembly. [ChangeLog][QtWidgets][QFileDialog] Adds an overload to the static methods getOpenFileContent and saveFileContent with a new parent argument which always no-ops in the WASM environment. Fixes: QTBUG-118396 Pick-to: 6.7 6.6 6.5 Change-Id: Ic59aee386631172d4a29b42fe11e5af318474a1d Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Diffstat (limited to 'src/widgets/compat')
-rw-r--r--src/widgets/compat/removed_api.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/widgets/compat/removed_api.cpp b/src/widgets/compat/removed_api.cpp
index 691cc2cc7f..5fcbdba47b 100644
--- a/src/widgets/compat/removed_api.cpp
+++ b/src/widgets/compat/removed_api.cpp
@@ -78,7 +78,26 @@ QAction *QMenuBar::addAction(const QString &text, const QObject *receiver, const
}
#endif
+#endif // QT_WIDGETS_REMOVED_SINCE(6, 3)
+
+#if QT_WIDGETS_REMOVED_SINCE(6, 7)
+
+
+#if QT_CONFIG(filedialog)
+#include "qfiledialog.h"
+
+void QFileDialog::getOpenFileContent(const QString &nameFilter, const std::function<void(const QString &, const QByteArray &)> &fileOpenCompleted)
+{
+ QFileDialog::getOpenFileContent(nameFilter, fileOpenCompleted, nullptr);
+}
+
+void QFileDialog::saveFileContent(const QByteArray &fileContent, const QString &fileNameHint)
+{
+ saveFileContent(fileContent, fileNameHint, nullptr);
+}
+#endif
+
// #include <qotherheader.h>
// // implement removed functions from qotherheader.h
-#endif // QT_WIDGETS_REMOVED_SINCE(6, 3)
+#endif // QT_WIDGETS_REMOVED_SINCE(6, 7)