[Interest] Qt iOS - HowTo get access to Images stored at device
Shawn Rutledge
Shawn.Rutledge at qt.io
Fri Oct 27 11:01:45 CEST 2017
> On 26 Oct 2017, at 17:02, ekke <ekke at ekkes-corner.org> wrote:
>
> Am 26.10.17 um 16:11 schrieb Shawn Rutledge:
>>> On 26 Oct 2017, at 15:12, ekke <ekke at ekkes-corner.org>
>>> wrote:
>>>
>>> Jeffrey,
>>>
>>> thx
>>>
>>> at the moment it's ok for me to use
>>> QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last()
>>>
>>> Using Objective-C++ Photos framework would give some more comfort,
>>> but wouldn't help to access these Photos from QML
>>>
>> >From QML, the QtQuick.Dialogs FileDialog has special support for getting a native photo picker:
>>
>>
>> http://doc.qt.io/qt-5/qml-qtquick-dialogs-filedialog.html#folder-prop
> if I understood it right, to use FileDialog I must add
> QT += widgets
> also https://doc.qt.io/qt-5/qml-qt-labs-platform-filedialog.html needs widgets and QApplication instead of QGuiApplication.
That’s not necessary on iOS AFAIK. Widget-based dialogs are an option on desktop systems. The priority is: native dialog if possible (and on iOS, if you are choosing a picture, we treat the photo picker as a native dialog); if not, then use a widget dialog if possible (and if it’s not a QApplication, it’s not possible); if not, then fall back to a plain QML implementation (DefaultFileDialog.qml).
(Disclaimer: I haven’t tested that on iOS for quite some time. I hope it still works. ;-)
> want to avoid this because my mobile apps are using QtQuickControls2 only
The work of porting over to Controls 2 dialogs is not done yet.
>>> it seems that there's no way to construct an URL in QML to access files from assets-library
>>> so probably the best way is to write an ImageProvider to access these Images from QML
>>>
>> After you choose the photo, you will get a URL which works AFAIK.
> in forum I read that this URL works from C++ but not from QML
Not sure about that… I guess I need to test it again. I thought it was possible to set an Image.source property to that URL, for example, but we don’t have much file-reading support in QML otherwise.
More information about the Interest
mailing list