Qml windows not coming on specified x ,y coordinates
-
I am developing a qml application using Qt 5.8 to be deployed on IMX8m evk board the display compositor used is wayland.My qml looks like below
import QtQuick 2.3 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 Window { id:idParent visible: true x:0 y:0 height: 1080 width:1920 flags: Qt.FramelessWindowHint Window { id:idW1 x:0 y:0 flags: Qt.FramelessWindowHint width:960 height: 1080 color: "red" visible: true } Window { id:idW2 flags: Qt.FramelessWindowHint x:960 y:0 width:960 height: 1080 color: "yellow" visible: true } Component.onCompleted: { console.log(" width "+Screen.width+ " height "+ Screen.height +" idW1 x "+idW1.x+" idW1.y "+idW1.y+" idW1.height "+ idW1.height +" idW1.Width "+ idW1.width +" idW2 x "+idW2.x+" idW2.y "+idW2.y+" idW2.height "+ idW2.height +" idW1.Width "+ idW1.width) } }
The qml is loaded like this
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
But when I run the app in board neither of the child windows idW1,idW1 are coming in their respective coordinates each time when I restart the app the child window positions changes . The console print shows the x,y as idw1( x:0, y:0) ,idw2 ( x:960, y:0). Application works correctly when I compile and run in Linux desktop
Can any one tell me what I am doing wrong.
[@ambershark]: added code tags for readability.
-
Thank you for your reply.On IMX8m evk board it is wayland When I ran the application I am seeing like this
./QmlWindow
Using Wayland-EGLOn desktop I am using "Ubuntu" VERSION=14.04.5 LTS it shows as below
./QmlWindow
QML debugging is enabled. Only use this in a safe environment. -
@prasanth Yea I'm pretty sure this is a wayland issue.
Here is another guy that has your exact problem:
http://www.at91.com/viewtopic.php?t=26520
Try something other than wayland or dig into how wayland deals with newly created windows and see if there is a way to override or trick it. Maybe show it then once it has been shown and positioned by wayland, move it to where you really want it. Kinda hacky but wayland is not ready for real world yet imo. I still use xorg because wayland has so many issues.
-
In the light of your advice I tried few things .I came across
QObject *rootObject = engine.rootObjects().first();
QQuickWindow window = qobject_cast<QQuickWindow>(rootObject);
QVariantMap windowProperty= QGuiApplication::platformNativeInterface()->windowProperties(window->handle());will the call 'platformNativeInterface' give me the wayland properties ? .When I printed windowProperty it is empty .I am totally blank with underneath wayland , have searched for wayland client api to set positions (Is it possible ? ) but didn’t
see anything. Do you have any comments to move forward.