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. Geometry wrong on iOS device
QtWS25 Last Chance

Geometry wrong on iOS device

Scheduled Pinned Locked Moved Solved Mobile and Embedded
22 Posts 4 Posters 3.9k Views
  • 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.
  • _eph_ _eph

    Yeah, there must be something qmake does which makes the difference...

    K Offline
    K Offline
    KoneTaH
    wrote on last edited by
    #11

    @_eph Here is an example of Qt cmake QML project for iOS with QQuickView:

    https://github.com/forexample/qt-ios-examples/tree/master/qml-custom-property-types

    In main.cpp it imports some plugin called "QIOSIntegrationPlugin". May be you should import it too?

    _eph_ 1 Reply Last reply
    0
    • K KoneTaH

      @_eph Here is an example of Qt cmake QML project for iOS with QQuickView:

      https://github.com/forexample/qt-ios-examples/tree/master/qml-custom-property-types

      In main.cpp it imports some plugin called "QIOSIntegrationPlugin". May be you should import it too?

      _eph_ Offline
      _eph_ Offline
      _eph
      wrote on last edited by
      #12

      @KoneTaH Tried but no difference :(

      K 1 Reply Last reply
      0
      • _eph_ _eph

        @KoneTaH Tried but no difference :(

        K Offline
        K Offline
        KoneTaH
        wrote on last edited by KoneTaH
        #13

        @_eph Please note that main() in iOS case is called qtmn(). It's not the real main() and it will be called from this plugin after some initial setup (as I think).

        _eph_ 1 Reply Last reply
        0
        • K KoneTaH

          @_eph Please note that main() in iOS case is called qtmn(). It's not the real main() and it will be called from this plugin after some initial setup (as I think).

          _eph_ Offline
          _eph_ Offline
          _eph
          wrote on last edited by
          #14

          @KoneTaH Yeah, that doesn't work (it's looking for undefined _main).

          Btw. I needed to force load the ios plugin and use _qt_main_wrapper for the app to work at all.

          1 Reply Last reply
          0
          • _eph_ _eph

            Yes, so if I just create simple qml - using your example:

            #import <QQuickView>
            #include <QtPlugin>
            Q_IMPORT_PLUGIN(QtQuick2Plugin)
            #endif
            
            int main(int argc, char *argv[])
            {
                QGuiApplication app(argc, argv);
                
                QQuickView *view = new QQuickView;
                view->setSource(QUrl::fromLocalFile("/tmp/simple.qml"));
                view->showFullScreen();
                
                return app.exec();
            }
            

            and the QML:

            import QtQuick 2.0
            
            Rectangle {
                id: page
                width: 300; height: 200
                color: "yellow"
            
                Text {
                    id: helloText
                    text: "Hello world!"
                    y: 30
                    anchors.horizontalCenter: page.horizontalCenter
                    font.pointSize: 24; font.bold: true
                }
            }
            

            This is the result:
            0_1552871529629_Simulator Screen Shot - iPhone XR - 2019-03-18 at 13.06.58.png

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #15

            @_eph
            I would suggest using a proper Windowas the root item instead of a rectangle or something like that
            https://doc.qt.io/qt-5/qml-qtquick-window-window.html

            and do not set a width or height for the root item. it should scale automatically - except for "safe zones"


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            _eph_ 1 Reply Last reply
            0
            • Shrinidhi UpadhyayaS Offline
              Shrinidhi UpadhyayaS Offline
              Shrinidhi Upadhyaya
              wrote on last edited by
              #16

              Hi @_eph , you need to have proper splash screen, otherwise your app comes like this, so every Iphone has a different size for the splash screen, so you need to prepare a splash screen with respect to the device you are deploying on and after that you need to include it in a file called info.plist, same is the case with app icons also.

              For more info you can have a look into this: -[https://doc.qt.io/qt-5/ios-platform-notes.html]

              For info on the sizes you can have a look at this:- [https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/launch-screen/]

              I guess once you have proper splash screen,the app will cover the complete Iphone screen.

              Shrinidhi Upadhyaya.
              Upvote the answer(s) that helped you to solve the issue.

              _eph_ 2 Replies Last reply
              0
              • J.HilkJ J.Hilk

                @_eph
                I would suggest using a proper Windowas the root item instead of a rectangle or something like that
                https://doc.qt.io/qt-5/qml-qtquick-window-window.html

                and do not set a width or height for the root item. it should scale automatically - except for "safe zones"

                _eph_ Offline
                _eph_ Offline
                _eph
                wrote on last edited by
                #17

                @J.Hilk Makes no difference the QML is always contained in the same window/rectangle you see on the first screenshot.

                1 Reply Last reply
                0
                • Shrinidhi UpadhyayaS Shrinidhi Upadhyaya

                  Hi @_eph , you need to have proper splash screen, otherwise your app comes like this, so every Iphone has a different size for the splash screen, so you need to prepare a splash screen with respect to the device you are deploying on and after that you need to include it in a file called info.plist, same is the case with app icons also.

                  For more info you can have a look into this: -[https://doc.qt.io/qt-5/ios-platform-notes.html]

                  For info on the sizes you can have a look at this:- [https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/launch-screen/]

                  I guess once you have proper splash screen,the app will cover the complete Iphone screen.

                  _eph_ Offline
                  _eph_ Offline
                  _eph
                  wrote on last edited by
                  #18

                  @Shrinidhi-Upadhyaya Hm, I don't really see connection between the launch image (splascreen) and the actual app since you don't need that kind of thing when you use Qt Creator and qmake but I will try it anyway. Thanks

                  K 1 Reply Last reply
                  0
                  • _eph_ _eph

                    @Shrinidhi-Upadhyaya Hm, I don't really see connection between the launch image (splascreen) and the actual app since you don't need that kind of thing when you use Qt Creator and qmake but I will try it anyway. Thanks

                    K Offline
                    K Offline
                    KoneTaH
                    wrote on last edited by
                    #19

                    @_eph Do you have some minimal CMake project with this issue somewhere in public? Usually I don't use CMake, but I can take a look (as well as others, I think).

                    _eph_ 1 Reply Last reply
                    0
                    • Shrinidhi UpadhyayaS Shrinidhi Upadhyaya

                      Hi @_eph , you need to have proper splash screen, otherwise your app comes like this, so every Iphone has a different size for the splash screen, so you need to prepare a splash screen with respect to the device you are deploying on and after that you need to include it in a file called info.plist, same is the case with app icons also.

                      For more info you can have a look into this: -[https://doc.qt.io/qt-5/ios-platform-notes.html]

                      For info on the sizes you can have a look at this:- [https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/launch-screen/]

                      I guess once you have proper splash screen,the app will cover the complete Iphone screen.

                      _eph_ Offline
                      _eph_ Offline
                      _eph
                      wrote on last edited by
                      #20

                      @Shrinidhi-Upadhyaya OMG, you are the man! It really helped, I can't believe it lol. Adding a dummy launch storyboard made it go fullscreen... Unbelievable

                      1 Reply Last reply
                      0
                      • K KoneTaH

                        @_eph Do you have some minimal CMake project with this issue somewhere in public? Usually I don't use CMake, but I can take a look (as well as others, I think).

                        _eph_ Offline
                        _eph_ Offline
                        _eph
                        wrote on last edited by
                        #21

                        @KoneTaH I don't unfortunately - it's a very complex project with lots of subprojects and libraries. I could probably share the toolchain file but looks like I might have figured it out thanks to @Shrinidhi-Upadhyaya

                        1 Reply Last reply
                        0
                        • Shrinidhi UpadhyayaS Offline
                          Shrinidhi UpadhyayaS Offline
                          Shrinidhi Upadhyaya
                          wrote on last edited by
                          #22

                          Cooool!!, you are always welcome @_eph , can you mark [SOLVED] to the thread title.

                          Shrinidhi Upadhyaya.
                          Upvote the answer(s) that helped you to solve the issue.

                          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