Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. IOS port of Qt on retina displays.
Forum Updated to NodeBB v4.3 + New Features

IOS port of Qt on retina displays.

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 5 Posters 5.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DaRk3R
    wrote on last edited by
    #1

    Hello everybody,

    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

    http://blog.qt.digia.com/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11/

    The same keys don't seem to work for iOS apps however. In particular If I set

    @<key>NSPrincipalClass</key>
    <string>NSApplication</string>@

    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.

    Thanks,

    Corneliu

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hardcodes.de
      wrote on last edited by
      #2

      I don't know if that will help, but the singleton instance for the application is called

      @NSApplication@

      on Mac and

      @UIApplication@

      on iOS. Perhaps simply changing it in the Info.Plist file works.

      while(!sleep){++sheep;}

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DaRk3R
        wrote on last edited by
        #3

        Hi,

        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.

        Thanks

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hardcodes.de
          wrote on last edited by
          #4

          Ok, so your plist.info file contains now

          @<key>NSPrincipalClass</key>
          <string>UIApplication</string>
          <key>NSHighResolutionCapable</key>
          <string>True</string>@

          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

          foo.png
          foo@2x.png

          while(!sleep){++sheep;}

          1 Reply Last reply
          0
          • L Offline
            L Offline
            langi667
            wrote on last edited by
            #5

            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 "foo@2x.png" 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

            1 Reply Last reply
            0
            • H Offline
              H Offline
              hardcodes.de
              wrote on last edited by
              #6

              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.

              while(!sleep){++sheep;}

              1 Reply Last reply
              0
              • H Offline
                H Offline
                hardcodes.de
                wrote on last edited by
                #7

                Or try to compile the latest Alpha version:

                http://blog.qt.digia.com/blog/2013/09/30/qt-5-2-alpha-available/

                while(!sleep){++sheep;}

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  CuteiOS
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • GianlucaG Offline
                    GianlucaG Offline
                    Gianluca
                    wrote on last edited by
                    #9

                    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 image@2x.png (high resolution).
                    The QML Image item correctly load the "image@2x.png" 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

                    1 Reply Last reply
                    0
                    • GianlucaG Offline
                      GianlucaG Offline
                      Gianluca
                      wrote on last edited by
                      #10

                      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:
                      @
                      Image {
                      source: "image.png"
                      }
                      @
                      Than the highDPI image is loaded wrongly due to QTBUG-32862, but if you put
                      @
                      Image {
                      source: "image.png"
                      width: 200px
                      height: 200px
                      }
                      @
                      Then the highDPI is loaded correctly. But note that the image@2x.png has to be 400x400 pixel for the example above to work.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved