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. canUndo
Forum Update on Monday, May 27th 2025

canUndo

Scheduled Pinned Locked Moved QML and Qt Quick
textinput
7 Posts 2 Posters 2.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.
  • Z Offline
    Z Offline
    Zubalama
    wrote on last edited by p3c0
    #1
    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

    p3c0P 1 Reply Last reply
    0
    • Z Zubalama
      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

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @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

      p3c0P 1 Reply Last reply
      1
      • p3c0P p3c0

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

        p3c0P Offline
        p3c0P Offline
        p3c0
        Moderators
        wrote on last edited by
        #3

        @p3c0 Or you can also use undo function.

        157

        1 Reply Last reply
        1
        • Z Offline
          Z Offline
          Zubalama
          wrote on last edited by
          #4

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

          p3c0P 1 Reply Last reply
          0
          • Z Zubalama

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

            p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #5

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

            157

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              Zubalama
              wrote on last edited by p3c0
              #6

              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()
              }
              
              p3c0P 1 Reply Last reply
              0
              • Z Zubalama

                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()
                }
                
                p3c0P Offline
                p3c0P Offline
                p3c0
                Moderators
                wrote on last edited by p3c0
                #7

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

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

                157

                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