문제

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
        ....
    }
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top