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. Resolution Inconsistency
Qt 6.11 is out! See what's new in the release blog

Resolution Inconsistency

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 2 Posters 923 Views 2 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.
  • CKurduC Offline
    CKurduC Offline
    CKurdu
    wrote on last edited by CKurdu
    #1

    Hi everybody,
    I have an embedded system that has Debian based linaro and LXQt desktop manager has resolution 1024x768. I have created a qml based program that has 1024x768 resolution. But it shows itself bigger.
    0_1552290151612_resolution.jpeg

    and my app
    0_1552290173189_program.jpeg

    My main.qml

    Window {
        id: root
        visible:true
        width: 1024
        height: 768
        title: qsTr("autovip") + mytrans.emptyString
        modality: Qt.ApplicationModal
        flags: Qt.Window | Qt.FramelessWindowHint
        color: "black"
        Intro{
            x:0
            y:0
            z:1334
            width:1024
            height:768
            opacity: 1
        }
    
        Image {
            x:0
            y:0
            source: "qrc:/design/general/background.svg"
            width:parent.width
            height:parent.height
            Body{
                id: bodyPart
                x:0
                y:0
            }
            BottomMenu
            {
                id: iBottomMenu
                x:0
                y:690
            }
        }
        CommandInfo{
            id:info
            z:332
            width:1024
            height:768
        }
        Item{
           id:start
           width:1024
           height:768
           opacity: 0.7
           Rectangle{
               x:0
               y:0
               width:1024
               height:768
               color:"black"
               z:333
               MouseArea{
                  anchors.fill: parent
               }
           }
        }
           Rectangle{
               id:startBtn
               anchors.centerIn: start;
               radius: 50
               width: 200
               height:200
               color:"white"
               z:334
               opacity: 1
               property int systemstate: serial_mng.systemstate
               onSystemstateChanged: {
                   switch(systemstate)
                   {
                   case -1:
                   case 0:
                            start.visible=true;
                            startBtn.visible=true;
                       break;
                   case 1:
                            start.visible=false;
                            startBtn.visible=false;
                       break;
                   }
               }
               Image{
                   anchors.centerIn: parent
                   source:"qrc:/design/general/on-button.svg"
                   sourceSize.width: 150
                   sourceSize.height: 150
                  z:334
                   MouseArea{
                       anchors.fill: parent
                       onClicked: {
                           GSystem.systemOnOff();
                       }
                   }
               }
               MouseArea{
                   anchors.fill: parent
               }
    
           }
       MouseArea {
        anchors.fill: parent
        enabled: false
        //cursorShape: Qt.BlankCursor
      }
        Component.onCompleted: {
            GSystem.phistory = ["Home"];
            GSystem.state = "Home"
            GSystem.setInfo(info);
            console.log(SM.value("main/lang"));
            console.log("Serial Con : "+serial_mng.isConnected());
    
        }
    }
    
    

    What is the problem?

    You reap what you sow it

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Don't use hardcoded dimensions and positioning if you can. It's a can of worms. Better use anchors or layouts, then your UI will always adjust itself to available screen size.

      Regarding the code - not sure what I'm seeing. So your window is wider than you want it to be, right? Or it is not positioned in top-left corner?

      (Z(:^

      CKurduC 1 Reply Last reply
      3
      • sierdzioS sierdzio

        Don't use hardcoded dimensions and positioning if you can. It's a can of worms. Better use anchors or layouts, then your UI will always adjust itself to available screen size.

        Regarding the code - not sure what I'm seeing. So your window is wider than you want it to be, right? Or it is not positioned in top-left corner?

        CKurduC Offline
        CKurduC Offline
        CKurdu
        wrote on last edited by CKurdu
        #3

        @sierdzio said in Resolution Inconsistency:

        So your window is wider than you want it to be, right?

        Yes, it is wider than I want. I have also tested it with a qwidget applicaiton given preferred size 1024x767 and it worked as expected.

        Also this program is working well without lxqt desktop manager in another embedded hardware.

        You reap what you sow it

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Hm, perhaps some DPI scaling issue, then. Check the options in HiDPI support page, maybe something will help.

          (Z(:^

          CKurduC 1 Reply Last reply
          1
          • sierdzioS sierdzio

            Hm, perhaps some DPI scaling issue, then. Check the options in HiDPI support page, maybe something will help.

            CKurduC Offline
            CKurduC Offline
            CKurdu
            wrote on last edited by
            #5

            @sierdzio
            I had this line below and I removed it and now program works as expected.

                QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
            

            Thanks sierdzio

            You reap what you sow it

            1 Reply Last reply
            1

            • Login

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