~ubuntu-sdk-team/ubuntu-ui-toolkit/locDemo

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/TextField.qml

  • Committer: Tarmac
  • Author(s): Zsombor Egri
  • Date: 2014-05-07 09:02:58 UTC
  • mfrom: (1006.1.30 textinput-carets)
  • Revision ID: tarmac-20140507090258-tuj47qjqgpg1sad3
Text input caret handler visuals and functionality. Fixes: https://bugs.launchpad.net/bugs/1183257.

Approved by PS Jenkins bot, Christian Dywan.

Show diffs side-by-side

added added

removed removed

Lines of Context:
244
244
 
245
245
      Note that the root item of the delegate component must be a QQuickItem or
246
246
      QQuickItem derived item.
247
 
 
248
 
      \qmlproperty Component cursorDelegate
249
247
    */
250
 
    property alias cursorDelegate: editor.cursorDelegate
 
248
    property Component cursorDelegate: null
251
249
 
252
250
    /*!
253
251
      The position of the cursor in the TextField.
910
908
        }
911
909
    }
912
910
 
913
 
    // cursor
914
 
    Component {
915
 
        id: cursor
916
 
        TextCursor {
917
 
            //FIXME: connect to root object once we have all TextInput properties exposed
918
 
            editorItem: editor
919
 
            height: internal.lineSize
920
 
            popover: control.popover
921
 
            visible: editor.cursorVisible
922
 
 
923
 
            Component.onCompleted: inputHandler.pressAndHold.connect(openPopover)
924
 
        }
925
 
    }
926
 
 
927
911
    AbstractButton {
928
912
        id: clearButton
929
913
        objectName: "clear_button"
939
923
                    (control.activeFocus && ((editor.text != "") || editor.inputMethodComposing))
940
924
 
941
925
        Image {
942
 
            //anchors.fill: parent
943
926
            anchors.verticalCenter: parent.verticalCenter
944
927
            width: units.gu(3)
945
928
            height: width
997
980
            // FocusScope will forward focus to this component
998
981
            focus: true
999
982
            anchors.verticalCenter: parent.verticalCenter
1000
 
            // get the control's style
1001
 
            clip: true
1002
 
            cursorDelegate: cursor
 
983
            cursorDelegate: TextCursor {
 
984
                handler: inputHandler
 
985
            }
1003
986
            color: control.__styleInstance.color
1004
987
            selectedTextColor: Theme.palette.selected.foregroundText
1005
988
            selectionColor: Theme.palette.selected.foreground
1021
1004
                input: editor
1022
1005
                flickable: flicker
1023
1006
                selectionModeTimeout: control.__styleInstance.selectionModeTimeout
 
1007
                /*
 
1008
                  In x direction we use 2 times the configured spacing, as we have
 
1009
                  both the overlay and the Flickable aligned with margins. On y
 
1010
                  direction we only use the simple spacing, the Flickable moves the
 
1011
                  top downwards.
 
1012
                  */
 
1013
                frameDistance: Qt.point(2 * internal.spacing, internal.spacing)
1024
1014
            }
1025
1015
        }
1026
1016
    }