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. Clear text all TextField
Forum Updated to NodeBB v4.3 + New Features

Clear text all TextField

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.2k 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.
  • N Offline
    N Offline
    neda
    wrote on last edited by neda
    #1

    Hi,
    I'd like to clear the text of "TextField" controls with a simple code, Instead of using the following code:

    textField1.text="";
    textField2.text="";
    textField3.text="";
    textField4.text="";
    ...
    ....
    ....
    textFieldn.text="";
    
    

    I've tried to use this code:

    Qt.inputMethod.reset()
    

    But it does not work.

    1 Reply Last reply
    0
    • IntruderExcluderI Offline
      IntruderExcluderI Offline
      IntruderExcluder
      wrote on last edited by
      #2

      You may have to collect them in one container, e.g.: readonly property var textFieldsList: [textField1, textField2, ...], and then iterate over them via JavaScript Array.forEach and call clear for every element.

      N 1 Reply Last reply
      1
      • IntruderExcluderI IntruderExcluder

        You may have to collect them in one container, e.g.: readonly property var textFieldsList: [textField1, textField2, ...], and then iterate over them via JavaScript Array.forEach and call clear for every element.

        N Offline
        N Offline
        neda
        wrote on last edited by
        #3

        @IntruderExcluder

        Thank you

        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