Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [CLOSED] Problem with font.pointSize in QML Child

[CLOSED] Problem with font.pointSize in QML Child

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k 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.
  • S Offline
    S Offline
    SteveG
    wrote on last edited by
    #1

    The following code works properly
    @
    . . .
    Rectangle{
    id: header
    width: parent.width
    height: .1 * parent.height
    anchors.top: parent.top

    Text{
    id: headerText
    text: "Header"
    anchors.centerIn: parent
    font.pointSize: 16
    }
    }
    . . .
    @

    but changing font.pointSize to
    @
    font.pointSize: .75 * parent.height
    @

    results in the Qt Creator 3.0.1 Application Output message

    bq. QFont::setPointSizeF: Point size <= 0 (0.000000), must be greater than 0

    although the displayed output is as expected.

    Any ideas why this occurs? Should I just ignore it or is there a way to suppress the message?

    Thanks.

    Steve

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

      Maybe in some cases the result is smaller than 0? What about this:
      @
      font.pointSize: parent.height > 0? .75 * parent.height : 1;
      @

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SteveG
        wrote on last edited by
        #3

        Tomasz,

        I restructured my code and no longer have the problem.

        Thanks.

        Steve

        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