Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qiosimagepickercontroller.mm
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#import <UIKit/UIKit.h>
6
8
9@implementation QIOSImagePickerController {
10 QIOSFileDialog *m_fileDialog;
11}
12
13- (instancetype)initWithQIOSFileDialog:(QIOSFileDialog *)fileDialog
14{
15 self = [super init];
16 if (self) {
17 m_fileDialog = fileDialog;
18 self.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
19 self.delegate = self;
20 }
21 return self;
22}
23
24- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
25{
26 Q_UNUSED(picker);
27 NSURL *url = info[UIImagePickerControllerReferenceURL];
28 QUrl fileUrl = QUrl::fromLocalFile(QString::fromNSString(url.description));
29 m_fileDialog->selectedFilesChanged(QList<QUrl>() << fileUrl);
30 emit m_fileDialog->accept();
31}
32
33- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
34{
35 Q_UNUSED(picker);
36 emit m_fileDialog->reject();
37}
38
39@end