summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/macx-ios-clang/features/default_post.prf8
-rw-r--r--qmake/doc/src/qmake-manual.qdoc6
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp3
3 files changed, 17 insertions, 0 deletions
diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf
index 4c8a6eaae6..93e9e10ec3 100644
--- a/mkspecs/macx-ios-clang/features/default_post.prf
+++ b/mkspecs/macx-ios-clang/features/default_post.prf
@@ -80,3 +80,11 @@ macx-xcode {
QMAKE_CXXFLAGS += $$arch_flags
QMAKE_LFLAGS += $$arch_flags
}
+
+!xcodebuild:equals(TEMPLATE, app):!isEmpty(QMAKE_INFO_PLIST) {
+ # Only link in photo library support if Info.plist contains
+ # NSPhotoLibraryUsageDescription. Otherwise it will be rejected from AppStore.
+ plist_path = $$absolute_path($$QMAKE_INFO_PLIST, $$_PRO_FILE_PWD_)
+ system("/usr/libexec/PlistBuddy -c 'Print NSPhotoLibraryUsageDescription' $$system_quote($$plist_path) &>/dev/null"): \
+ QTPLUGIN += qiosnsphotolibrarysupport
+}
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index 7386af881e..ccb79f4a9f 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -1813,6 +1813,12 @@
which qmake will replace with the actual executable name. Other variables
include @ICON@, @TYPEINFO@, @LIBRARY@, and @SHORT_VERSION@.
+ If building for iOS, and the \c{.plist} file contains the key
+ \c NSPhotoLibraryUsageDescription, qmake will include an additional plugin
+ to the build that adds photo access support (to, e.g.,
+ \l{QFileDialog::setDirectory()}{QFile/QFileDialog}). See Info.plist
+ documentation from Apple for more information regarding this key.
+
\note Most of the time, the default \c{Info.plist} is good enough.
\section1 QMAKE_LFLAGS
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 61f5f7b0d2..f8e4299397 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -896,6 +896,9 @@ void QFileDialogPrivate::_q_goToUrl(const QUrl &url)
{QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last()},
a native image picker dialog will be used for accessing the user's photo album.
The filename returned can be loaded using QFile and related APIs.
+ For this to be enabled, the Info.plist assigned to QMAKE_INFO_PLIST in the
+ project file must contain the key \c NSPhotoLibraryUsageDescription. See
+ Info.plist documentation from Apple for more information regarding this key.
This feature was added in Qt 5.5.
*/
void QFileDialog::setDirectory(const QString &directory)