Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. Qt on BlackBerry and QNX
  4. QML font size not working properly on the Simulator

QML font size not working properly on the Simulator

Scheduled Pinned Locked Moved Qt on BlackBerry and QNX
4 Posts 2 Posters 4.5k Views
  • 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.
  • Z Offline
    Z Offline
    Zingam
    wrote on last edited by
    #1

    When I use this in a Rectangle element to create a button. I get completely different results on the Simulator. The size of the letters is huge, while on Windows and in the designer, they have the same size. Isn't font.pointSize - platform independent way to set the size of a font? Am I doing something wrong or is it a bug?

    @ Text {
    text: qsTr("Hello Me!!!")
    verticalAlignment: Text.AlignVCenter
    anchors.horizontalCenter: parent.horizontalCenter
    anchors.verticalCenter: parent.verticalCenter
    font.pointSize: 10
    }@

    1 Reply Last reply
    0
    • D Offline
      D Offline
      daliusd
      wrote on last edited by
      #2

      What's size of your Simulator? Note that BB10 device will have higher DPI than your PC. If your simulator is sized 100% it has different DPI than actual BB10 device and it will appear that font is bigger.

      Still I'm speculating a little bit here. I personally go with pixelSize relative to DPI and screen size.

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zingam
        wrote on last edited by
        #3

        bq. font.pixelSize : int
        Sets the font size in pixels.
        Using this function makes the font device dependent. Use pointSize to set the size of the font in a device independent manner.

        font.pointSize : real
        Sets the font size in points. The point size must be greater than zero.
        bq.

        I have the simulator scaled to 45-50% depending on the size of the monitor. If I create a button and I set the font size in points so that the text fits nicely in the button rectangle, the same text on the simulator is much larger and does not fit in the same rectange.

        Is that a bug or I need to use a different approach?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          daliusd
          wrote on last edited by
          #4

          I will not reject possibility that simulator has some problems getting correct DPI while showing text when its font size is given in points. How size of your rectangle is calculated? Is it calculated in pixels or points? If in points where from have you got points?

          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