Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Controls2: TextField & TextArea maximumLength
Forum Updated to NodeBB v4.3 + New Features

Controls2: TextField & TextArea maximumLength

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 1.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nx7z
    wrote on last edited by
    #1

    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

    raven-worxR 1 Reply Last reply
    0
    • N nx7z

      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

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @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?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nx7z
        wrote on last edited by
        #3

        Thanks for your answer raven!

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

        1 Reply Last reply
        0
        • jpnurmiJ Offline
          jpnurmiJ Offline
          jpnurmi
          wrote on last edited by
          #4

          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'.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved