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. Can't use TextInput.onTextEdited!
Qt 6.11 is out! See what's new in the release blog

Can't use TextInput.onTextEdited!

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.6k Views
  • 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.
  • W Offline
    W Offline
    wost
    wrote on last edited by
    #1

    I'm trying to use the signal onTextEdited in my TextInput, but Qt keeps telling me that ' "TextInput.onTextEdited" is not available in QtQuick 2.7 ' for some reason. But according to the docs, it was introduced in 2.7! What is going on? I'm also running Qt 5.9, so that shouldn't be a problem either.

    What I'm trying to do, is replacing the text everytime you write. For an example, I want to format the string "122" to a string "12/2" automatically, but it won't work for some reason. :/

    		function formatDateString(text) {
    			var newString = text.match(/.{1,2}/g);
    			return newString.length > 1 ? newString.join("/") : newString[0];
    		}
    

    The function I'm trying to use.

    TextInput {
       onTextChanged: { text = showSearchArea.formatDateString(text) }
    }
    

    What I tried doing, but obviously it didn't work.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      @Marek said in Getting text from TextFiled before "OK" on keyboard is clicked:

      need to import QtQuick 2.9 not 2.7

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      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