0

The following code to create a rounded TextField

TextField {
    id: usernameTextField
    placeholderText: qsTr("username")
    width: 250
    height: 40
    anchors {
        top: parent.top
        topMargin: giveDetailsLabel.anchors.topMargin + 36
        horizontalCenter: parent.horizontalCenter
        horizontalCenterOffset: 0
    }

    background: Rectangle {
        radius: 20
        border.color: "#C9C9C9"
        border.width: 1
    }
    verticalAlignment: TextField.AlignVCenter

    font.pixelSize: 16
    font.weight: Font.Normal
    font.family: "Open Sans"
    leftPadding: 10
}

The problem with the following code, the text is not in the center it's shifted up for some reason and I try many different ways like anchors the background rectangle to fit the parent and it not work, using verticalAlignment: TextField.AlignVCenter not work properly

another question is I have the same exact text field but I used echoMode: TextField.Password to make the password, the password dots are so big, I try to decrease the font but the text also decrease before it converts to dot, so how to decrease the dot only without decrease the text size so user see what they are writing in big font before the character converts, here how it looks on Android

enter image description here

and also again the text shifted up and for dots for character and never center inside the text.

using QT 6.2

user7179690
  • 1,051
  • 3
  • 17
  • 40
  • 1
    I've tested the code in Qt 6.1/Windows 10 and that works as expected i.e. the text is vertically centered. – folibis Sep 25 '21 at 10:36
  • the issue seems with QT 6.2R2 which i currently using, and with other styles like Material and Universal, Basic, can you test those styles and tell me if it gives you the same issue or not? Thank you. – user7179690 Sep 25 '21 at 11:20

0 Answers0