Hi, there

I met some issue when I use TextInput. I tried to selectAll() when activefocus 
is true and unselectAll when activefocus is false. But it doesn't work. See 
following code. Is there a method to implement my requirement?

import Qt 4.7
Rectangle {
    id: rectangle
    width: 600
    height: 400
    MouseArea {
      anchors.fill: parent
      onClicked: {
        rectangle.forceActiveFocus();
      }
    }
    TextInput {
        anchors.centerIn: parent
        id: textinput
        text: "Hello,\n World!"
        cursorVisible: true
        selectByMouse: true
        selectedTextColor: "yellow"
        selectionColor: "royalblue"
        width: parent.width/2
        height: parent.height/2
        onActiveFocusChanged: {
          if (activeFocus == true) {
            selectAll();
          }
          else {
            select(0,0);
          }
        }
    }
}
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to