Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    canUndo

    QML and Qt Quick
    textinput
    2
    7
    1579
    Loading More Posts
    • 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.
    • Z
      Zubalama last edited by p3c0

      TextInput {
           id: inpuT
           canUndo :true
           x: 232
           y: 29
           width: 952
           height: 71
           font.pixelSize: 12
       }
      

      There's a problem with canUndo, here's an error: "Invalid property assignment: "canUndo" is a read-only property". I don't get it there's written that canUndo is bool function am I doing anything wrong?

      Edited: Use ``` (3 backticks) to use code blocks - p3c0

      p3c0 1 Reply Last reply Reply Quote 0
      • p3c0
        p3c0 Moderators @Zubalama last edited by

        @Zubalama It is readonly property. If you want to perform undo operations just do ctrl-z and for redo ctrl-shift-z (on Linux).

        157

        p3c0 1 Reply Last reply Reply Quote 1
        • p3c0
          p3c0 Moderators @p3c0 last edited by

          @p3c0 Or you can also use undo function.

          157

          1 Reply Last reply Reply Quote 1
          • Z
            Zubalama last edited by

            thanks but how do you use undo? like "inpuT.text.undo()" like this?

            p3c0 1 Reply Last reply Reply Quote 0
            • p3c0
              p3c0 Moderators @Zubalama last edited by

              @Zubalama Since it is aTextInput's function, simply inpuT.undo() will do.

              157

              1 Reply Last reply Reply Quote 0
              • Z
                Zubalama last edited by p3c0

                well I want to create undo button but it doesn't work... hows that?

                Keys.onPressed: { 
                   if(event.key===Qt.Key_Space){
                   event.accepted=true
                   inpuT.undo()
                }
                
                p3c0 1 Reply Last reply Reply Quote 0
                • p3c0
                  p3c0 Moderators @Zubalama last edited by p3c0

                  @Zubalama Why don't you just use a Button instead ?

                  Button {
                      text: "Undo"
                      onClicked: inpuT.undo()
                  }
                  

                  157

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post