[CLOSED] Problem with font.pointSize in QML Child



  • 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


  • Moderators

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



  • Tomasz,

    I restructured my code and no longer have the problem.

    Thanks.

    Steve


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.