IOS port of Qt on retina displays.
does anybody know how to enable retina resolution on iOS devices (i.e. instead of rendering at normal resolution and upscaling, render at the actual resolution of the screen)? I see in the following article that all that needs to be done for a Qt app on Mac is to add a few keys in the Info.plist file
The same keys don't seem to work for iOS apps however. In particular If I set
the app crashes at runtime saying this:
@2013-09-23 18:50:45.796 griphoscrowd[11171:907] *** Assertion failure in int UIApplicationMain(int, char **, NSString *, NSString *)(), /SourceCache/UIKit/UIKit-2380.17/UIApplication.m:2076
2013-09-23 18:50:45.801 griphoscrowd[11171:907] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to instantiate the UIApplication subclass instance. No class named NSApplication is loaded.'
*** First throw call stack:
(0x317f22a3 0x3969d97f 0x317f215d 0x320c7b13 0x3364e08d 0xa3f73 0x27ca0)
libc++abi.dylib: terminate called throwing an exception@
So I'm thinking those keys are not correct and hope there are some other I should use.
Can anybody enlighten me as to what they should be? I looked everywhere and I could not find anyhting.
I don't know if that will help, but the singleton instance for the application is called
on Mac and
on iOS. Perhaps simply changing it in the Info.Plist file works.
I did try using UIApplication and that solves the crashing problem. It still does not solve the resolution problem though.
Any other ideas are much appreciated.
Ok, so your plist.info file contains now
What kind of content is not in high resolution? QML drawn stuff or images, e.g. PNG files? I'm just asking because Image files must follow the naming convention like in
Hm, I guess there is no support for high/low resolution images, interfaces ... as far as I know. i'm not sure but I heard rumours that the QtCreator3.0 will have some support of this. Workaround for this would be creating your own QML image Provider and deliver the images on your own. On iOS you can simply call [UImage imageNamend:@"foo.png"] and it will return "email@example.com" There is a function in the QtMacExtras which is able to create a QImage/QPixmap out of UIImage/CGImage instances. On Android, there's the custom asset url registered which uses the native android asset manager. So it will work as long as you have the referring images in the assets folder.
But yes it is quite far from being easy to hande
Maybe it is a good idea to ask further details from one of the mailing lists? The chance to be seen by the actual developer that could answer the remaining questions is better than here.
Or try to compile the latest Alpha version:
Qt 5.1/5.2 support HighDPI (aka. Retina) rendering. As far as your app is concerned, the screen resolution is the same as normal DPI, but text (and icons if you supply the @2x artwork) is rendered as HighDPI. If you want to use the full resolution of the display instead, it's not possible with the Digia iOS plugin, but can be achieved with the Qt4iOS iOS plugin. Refer to the documentation of that plugin for more information.
I've just tried to load an highDPI image on iOS … and does not work.
I follow the "@2x" convention, so I added:
image.png (low-resolution) and firstname.lastname@example.org (high resolution).
The QML Image item correctly load the "email@example.com" but it is not displayed as an highDPI image, but just as a image 4 times bigger occupying more screen that should.
I also tried to added the above mentioned keys above, but they seems to be ignored.
Any ideas ??
I'm using Qt 5.2.1 beta 1
Ok, I found a way to solve the problem.
At least, on my setup the problem was due to the QTBUG-32862
In order to bypass the bug, simply explicit setup the width and height of the Image and the image will be rendered on HighDPI.
Also, there is no need to add any of the keys mentioned above on iOS platform. Just use the default Info.plist is enough.
So, again, if you have in your QML:
Than the highDPI image is loaded wrongly due to QTBUG-32862, but if you put
Then the highDPI is loaded correctly. But note that the firstname.lastname@example.org has to be 400x400 pixel for the example above to work.