[Development] QQuickPixmap and Quick plugins.
Alan Alpert
416365416c at gmail.com
Thu Jul 4 20:26:26 CEST 2013
On Thu, Jul 4, 2013 at 4:37 AM, Mark <markg85 at gmail.com> wrote:
> On Thu, Jul 4, 2013 at 11:55 AM, Ivan Vizir
> <define-true-false at yandex.com> wrote:
>> Hi,
>>
>> While developing QML Items for Qt Windows Extras I was faced with the task of using a URL-type properties which gave rise to some questions.
>>
>> First off all — is it ok to use QQuickPixmap, which is private API, in a plugin?
There is actually a bit of a known issue. QQuickImageProvider is the
correct way to bring custom image data to an image, but if you're
rendering a custom item which wants to use image providers you can't
currently because QQuickPixmap is private (and so you should not use
it). I'm considering making it public because it's essential for this
usecase.
>
> Don't know, can't tell.
>>
>> Second one — if the answer to first question is no, which is the correct way to handle URLs to load data (for QIcons, for example) from resources (qrc:///…), network and file system?
>
> The "right" way to expose your custom images in any way you want is by
> using [1].
> If i'm wrong i hope someone will correct me on this :) As far as i
> know, this is the recommended way to do it.
>
> [1] http://qt-project.org/doc/qt-5.1/qtquick/qquickimageprovider.html
If you instead meant that you've gotten a URL from QML and need to
load it, in a network transparent way, what we usually do is check the
scheme for file: or qrc:. If it's either of those we load it directly
with QFile, otherwise we use the
http://qt-project.org/doc/qt-5.1/qtqml/qqmlengine.html#networkAccessManager
function to get a QNetworkAccessManager which can be used to fetch
data from network sources as well as custom URLs. Except image
providers...
--
Alan Alpert
More information about the Development
mailing list