title: QML textInput how to handle selection and escape
body: <p>I am building a QML application and I have a <code>TextInput</code> component as follows:</p>
  
  <pre><code>TextInput {
                  id: editableTextInput
                  text: styleData.value
                  horizontalAlignment: Text.AlignLeft
                  verticalAlignment: Text.AlignVCenter
                  selectionColor: 'darkgray'
                  selectedTextColor: 'white'
                  font.pixelSize: 14
                  font.family: "AvantGarde-Medium"
  
                  onEditingFinished: {
                      // TO DO: Handle new text
                  }
  
                  MouseArea {
                      anchors.fill: parent
                      onClicked: {
                          editableTextInput.selectAll()
                      }
                  }
              }
  </code></pre>
  
  <p>At the moment, the way it stands is when the user clicks on the text, it selects the whole text and then I can start typing and the whole text will be replaced but I want the user to give a bit more finer control. For one, initially the user selects the full text and then if they click again, it should basically put the cursor at the current position. Also, the escape key should basically restore the old text and cancel the whole operation. </p>
  
  <p>These are standard ways for text input. I was wondering if I have to program all of this explicitly or is there a way to get this behaviour with the <code>TextInput</code> control.</p>