QML Text Input for Maemo Fremantle

Similarly to the dialogs in the previous post I also created a TextArea and TextField for Maemo Fremantle. The following picture shows the various text inputs in the Fremantle (N900) version of MeePasswords.

import Qt 4.7

Rectangle {
    id: textArea

    height: textEdit.height + textEdit.font.pointSize

    border.width: 3
    border.color: "lightgrey"
    radius: textEdit.font.pointSize
    smooth: true

    property alias text: textEdit.text
    property int textFormat: TextEdit.PlainText

    signal textChanged(string text)

    TextEdit {
        id: textEdit

        anchors.centerIn: parent
        width: parent.width - (2 * font.pointSize)

        font.pointSize: 17
        color: "black"
        textFormat: textArea.textFormat

        onTextChanged: textArea.textChanged(text)

        onFocusChanged: {
            if(focus){
                textArea.border.color = "#569ffd"
            }else{
                textArea.border.color = "lightgray"
            }
        }
    }
}
import Qt 4.7

Rectangle {
    id: textField

    width: parent.width
    height: textInput.height * 1.8

    border.width: 3
    border.color: "lightgrey"
    radius: height/4
    smooth: true

    property alias text: textInput.text
    property int echoMode: TextInput.Normal

    signal textChanged(string text)

    TextInput {
        id: textInput

        width: parent.width - (2 * font.pointSize)
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenter: parent.horizontalCenter

        font.pointSize: 17

        color: "black"
        echoMode: textField.echoMode

        onTextChanged: textField.textChanged(text)

        onFocusChanged: {
            if(focus){
                textField.border.color = "#569ffd"
            }else{
                textField.border.color = "lightgray"
            }
        }
    }
}

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Advertisements
This entry was posted in Qt/QML, Snippets and tagged , , , , . Bookmark the permalink.

One Response to QML Text Input for Maemo Fremantle

  1. Pingback: Share QML Code among Fremantle and Harmattan « ruedigergad

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s