Geometry wrong on iOS device
-
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:
-
@_eph This one works for me:
main.cpp:
#include <QGuiApplication> #include <QQuickView> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQuickView *view = new QQuickView(QUrl(QStringLiteral("qrc:/main.qml"))); view->showFullScreen(); return app.exec(); }
main.qml:
import QtQuick 2.0 Rectangle { anchors.fill: parent color: "red" Rectangle { width: 100 height: 100 color: "yellow" anchors.centerIn: parent } }
Qt 5.12.1.
-
@_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
I would suggest using a properWindow
as the root item instead of a rectangle or something like that
https://doc.qt.io/qt-5/qml-qtquick-window-window.htmland do not set a width or height for the root item. it should scale automatically - except for "safe zones"
-
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 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
-
@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
-
Cooool!!, you are always welcome @_eph , can you mark [SOLVED] to the thread title.