Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qml windows not coming on specified x ,y coordinates
Forum Updated to NodeBB v4.3 + New Features

Qml windows not coming on specified x ,y coordinates

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 1.8k 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.
  • P Offline
    P Offline
    prasanth
    wrote on last edited by ambershark
    #1

    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.

    A 1 Reply Last reply
    0
    • P prasanth

      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.

      A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      @prasanth Are you running wayland on your linux desktop? Also what window manager are you using on linux desktop and on the board? This kind of feels like it's the window manager that is moving the window and not QML.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0
      • P Offline
        P Offline
        prasanth
        wrote on last edited by
        #3

        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-EGL

        On 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.

        A 1 Reply Last reply
        0
        • P prasanth

          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-EGL

          On 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.

          A Offline
          A Offline
          ambershark
          wrote on last edited by
          #4

          @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.

          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

          1 Reply Last reply
          0
          • P Offline
            P Offline
            prasanth
            wrote on last edited by prasanth
            #5

            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.

            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