QIOSFileDialog: present image picker view without 'parent'

QFileDialog::show()/exec() can be called without having any parent
at all, so the check for 'winGuard' in authorization callback
would prevent image picker from being presented. In the end
we don't need this parent and using 'presentationWindow()' instead.
Check before asking for authorization that we indeed have/no
a parent window.

Fixes: QTBUG-130973
Change-Id: Ie3ba285dfff82ac3f53245a032e133bc26763883
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6026a5aa21d1c11a87ce76a18e497b9547213e27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Timur Pocheptsov 2024-11-11 14:27:44 +01:00 committed by Qt Cherry-pick Bot
parent a6a0a38343
commit 51b7476893

View File

@ -100,7 +100,7 @@ bool QIOSFileDialog::showImagePickerDialog(QWindow *parent)
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
dispatch_async(dispatch_get_main_queue(), ^{
if (status == PHAuthorizationStatusAuthorized) {
if (thisGuard && winGuard)
if (thisGuard && (winGuard || !parent))
thisGuard->showImagePickerDialog_helper(winGuard);
} else if (thisGuard) {