Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QML TextField how to capitalize the text

In QML how can I have a text input box that automatically converts the inputted text to all capitals? The following doesn't work:

    TextField {
        id: myfield
        objectName: "myfield"
        ...
        font.pixelSize: 20
        font.capitalization: Font.AllUpperCase
        ....
    }
like image 325
glennr Avatar asked Oct 06 '13 20:10

glennr


1 Answers

You just made a typo in the name of the constant which should be Font.AllUppercase with a lower c. If you look at your logs you should see a warning like this:

tsttxtfield.qml:22: Unable to assign [undefined] to int

like image 186
koopajah Avatar answered Sep 22 '22 05:09

koopajah