import QtQuick 2.0 Item { id: urlInput property bool urlvisible: true property double urlwidth: 200 property double posX: 0 property double posY: 0 property color focuscolor: "green" property color urlcolor: "black" property color urlBackColor: "silver" property string url: "" property double urlFontSize: 14 property bool isValid: false property int urlRadius: 0 property int urlFocus: 0 signal keyReturnPressed signal keyUpPressed signal keyDownPressed Component.onCompleted: { } onUrlFocusChanged: { } Rectangle { x: posX y: posY visible: urlInput.urlvisible width: textInput1.width height: textInput1.height radius: urlRadius color: urlBackColor } TextInput { id: textInput1 x: posX y: posY text: url width: urlwidth font.pixelSize: urlFontSize visible: urlInput.urlvisible focus: (urlInput.urlFocus == 1)?true:false maximumLength: 128 color: urlcolor inputMethodHints: Qt.ImhUrlCharactersOnly Keys.onReleased: { } Keys.onPressed: { if((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return)) { url = text; keyReturnPressed(); } } onFocusChanged: { color = (focus) ? focuscolor : urlcolor; if(focus) ipFocus = 1; } } }