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. Difference between running on Qt 5.15 and Qt 6.0. Size of QML elements in UI. Why?
Forum Updated to NodeBB v4.3 + New Features

Difference between running on Qt 5.15 and Qt 6.0. Size of QML elements in UI. Why?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 2 Posters 870 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.
  • B Offline
    B Offline
    bogong
    wrote on 11 Apr 2021, 18:28 last edited by bogong 4 Dec 2021, 06:22
    #1

    Hello all!

    I am trying to move onto Qt 6.0 and got stacked on size of QML objects. It's different when I am running it Qt 5.15 and Qt 6.0.
    Why is that? Right side of the image Qt 5.15 left is Qt 6.0. Why it's smaller? Is there any special parameter for HiDPI? Or any kind of scaling proportion coefficient?
    Screenshot 2021-04-11 at 21.15.10.png

    What am I missing in Qt 6.0?

    Code sample published here

    All of it looks like every size a little smaller - size of QML Rectangle, QML Text.
    Why it's happening?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bogong
      wrote on 12 Apr 2021, 06:44 last edited by
      #2

      It's happening even on simple default Qt/QML application

      // System includes
      import QtQuick 2.15
      import QtQuick.Controls 2.15
      
      // Application includes
      
      // Application
      ApplicationWindow {
      
      	property string pText: qsTr("Hello world!");
      
      	id: oApplicationWindow;
      //	flags: Qt.Window | Qt.MaximizeUsingFullscreenGeometryHint;
      	width: 640;
      	height: 480;
      	visible: true;
      	title: oApplicationWindow.pText;
      	color: "white";
      
      	Text {
      
      		id: oTestText;
      		text: oApplicationWindow.pText;
      		font.pixelSize: 30;
      		anchors.verticalCenter: parent.verticalCenter;
      		anchors.horizontalCenter: parent.horizontalCenter;
      	}
      
      	Rectangle {
      
      		id: oTestRectangleLeft;
      		width: 30;
      		height: 30;
      		color: "red";
      		anchors.top: parent.top;
      		anchors.topMargin: 100;
      		anchors.left: parent.left;
      	}
      
      	Rectangle {
      
      		id: oTestRectangleRight;
      		width: 30;
      		height: 30;
      		color: "red";
      		anchors.top: parent.top;
      		anchors.topMargin: 100;
      		anchors.right: parent.right;
      	}
      }
      

      The result is:

      Screenshot 2021-04-12 at 09.39.12.png

      I understand that is somehow related to actual pixel size and HiDPI but I haven't found any info about it yet. Is there any?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bogong
        wrote on 12 Apr 2021, 06:57 last edited by bogong 4 Dec 2021, 07:05
        #3

        The simple investigation showing different value of screen properties on one device.
        In QML:

        Component.onCompleted: {
        
        	console.log("Screen.pixelDensity:",Screen.pixelDensity)
        	console.log("Screen.devicePixelRatio:",Screen.devicePixelRatio)
        }
        

        Result on Qt 6.0

        qml: Screen.pixelDensity: 8.55762414463817
        qml: Screen.devicePixelRatio: 2.25
        

        Result on Qt 5.15

        qml: Screen.pixelDensity: 6.417322834645669
        qml: Screen.devicePixelRatio: 3
        

        One code, one device, but different values of the screen properties. Why?
        Is it Qt bug?

        The same result when run it from Xcode directly on one physical device.
        Xcode and Qt 6.0:

        2021-04-12 10:01:38.950778+0300 Qt60Size[485:312485] [qml] Screen.pixelDensity: 8.557889784573582
        2021-04-12 10:01:38.950908+0300 Qt60Size[485:312485] [qml] Screen.devicePixelRatio: 1.5
        

        Xcode and Qt 5.15:

        2021-04-12 10:04:25.550715+0300 Qt60Size[493:313567] [qml] Screen.pixelDensity: 6.417322834645669
        2021-04-12 10:04:25.550828+0300 Qt60Size[493:313567] [qml] Screen.devicePixelRatio: 2
        
        1 Reply Last reply
        0
        • S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 12 Apr 2021, 07:04 last edited by
          #4

          Yes, either a bug or a bug fix in Qt 6 :-) Check the bugtracker, it should be there somewhere.

          (Z(:^

          B 1 Reply Last reply 12 Apr 2021, 07:07
          1
          • S sierdzio
            12 Apr 2021, 07:04

            Yes, either a bug or a bug fix in Qt 6 :-) Check the bugtracker, it should be there somewhere.

            B Offline
            B Offline
            bogong
            wrote on 12 Apr 2021, 07:07 last edited by bogong 4 Dec 2021, 07:13
            #5

            @sierdzio Thx. Will do it. Issue closed. Opened issue https://bugreports.qt.io/browse/QTBUG-92579

            1 Reply Last reply
            1

            1/5

            11 Apr 2021, 18:28

            • Login

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