Hi ekke, I have tried. Image item will just ignore the devicePixelRatio set in QImage.
Similar report: [QTBUG-38127] devicePixelRatio not supported by QQmlImageProvider - Qt Bug Tracker <https://bugreports.qt.io/browse/QTBUG-38127> On 11 April 2016 at 20:47, ekke <e...@ekkes-corner.org> wrote: > perhaps devicePixelRatio is 3.0 - this would have the effect to get 170.666 > http://doc.qt.io/qt-5/qimage.html#setDevicePixelRatio > > ekke > Am 11.04.16 um 14:36 schrieb Federico Buti: > > Hi Ben, > > I've solved the issue by multiplying width/height to > qApp->devicePixelRatio(). That should be 3 on iPhone 6 and should provide > the correct result. > I'm not sure if that's a bug or it is intended behaviour and I actually > didn't investigate the issue a lot since I was just testing stuff. > > Hope someone else can confirm it's a bug or expected. > > Cheers, > F. > > On 11 April 2016 at 14:28, Ben Lau <xben...@gmail.com> wrote: > >> >> >> On 11 April 2016 at 20:19, ekke < <e...@ekkes-corner.org> >> e...@ekkes-corner.org> wrote: >> >>> Am 11.04.16 um 14:07 schrieb Ben Lau: >>> >>> >>> On 11 April 2016 at 19:59, ekke < <e...@ekkes-corner.org> >>> e...@ekkes-corner.org> wrote: >>> >>>> Am 11.04.16 um 12:38 schrieb Ben Lau: >>>> >>>> Hi, >>>> >>>> I am writing an image provider that read all the images to memory at >>>> startup. And I found that the behaviour is different from 5.5.1 to 5.6 in >>>> iOS. Seems that it is undocumented. I wonder is it an expected behaviour or >>>> a bug? >>>> >>>> That is the example project: >>>> <https://github.com/benlau/quickcross/tree/master/tests/imageprovider> >>>> https://github.com/benlau/quickcross/tree/master/tests/imageprovider >>>> >>>> That is the code of my image provider: >>>> >>>> QImage QCImageProvider::requestImage(const QString &id, QSize *size, < >>>> /span>c >>>> onst QSize &requestedSize) >>>> >>>> { >>>> >>>> Q_UNUSED(requestedSize); >>>> >>>> QCImageLoader* loader = QCImageLoader::instance(); >>>> >>>> QImage result; >>>> >>>> if (loader->contains(id)) { >>>> >>>> result = loader->image(id); >>>> >>>> *size = result.size(); >>>> >>>> } >>>> >>>> return result; >>>> >>>> } >>>> >>>> Code to display image: >>>> >>>> Image { >>>> >>>> id: image >>>> >>>> source: "image://arts/Lenna.png" // An 512x512 image >>>> >>>> } >>>> >>>> In Qt 5.5.1 with iPhone6, the property of image will be set to: >>>> >>>> width: 512 >>>> >>>> height: 512 >>>> >>>> sourceSize: Qt.size(512,512) >>>> >>>> However, in Qt 5.6 with iPhone6, it becomes: >>>> >>>> width: 170.66666 >>>> >>>> height: 170.66666 >>>> >>>> sourceSize: Qt.size(512,512) >>>> >>>> The display size of image is different. >>>> >>>> >>>> now from Qt 5.6 HighDPI is supported for all platforms. >>>> iPhone has scaling factor 3 >>>> >>>> 170.66666 * 3 = 512 >>>> >>>> >>>> ekke >>>> >>>> >>> But Qt 5.5 on iOS also support HighDPI. Their result are different. >>> >>> >>> have you tried to explicitely set >>> >>> QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); >>> >>> >>> ekke >>> >> >> I have tried to set / not-set this line. It don't make any different. >> >> >> _______________________________________________ >> Development mailing list >> Development@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/development >> >> > > > _______________________________________________ > Development mailing list > Development@qt-project.org > http://lists.qt-project.org/mailman/listinfo/development > >
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development