Controls2: TextField & TextArea maximumLength



  • Hello Everyone!

    is there a way to limit the maximum Length of an input String for TextField&Area in the new Controls 2? TextInput has a very usefull maximumLength property why the new Controls 2 not?

    Is there a nice workaround that behaves like maximumLength for the new Controls?

    Thanks!
    nex


  • Moderators

    @nx7z said in Controls2: TextField & TextArea maximumLength:

    Is there a nice workaround that behaves like maximumLength for the new Controls?

    you could listen to the text property change signal and simply slice the text to your maximum length?



  • Thanks for your answer raven!

    That would've been my first approach as well... but there isn't a more elegant way?



  • QQC2 TextField inherits Qt Quick TextInput, and QQC2 TextArea inherits Qt Quick TextEdit. So anything that is available in TextInput is available in TextField, and the same goes for TextEdit and TextArea. Only the single-line editor has support for 'maximumLength'.


Log in to reply
 

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