Merge improvements made in QtQuick2.0 version of the components.

This commit is contained in:
Abdurrahman AVCI 2013-02-05 09:36:34 +00:00
parent 5f19fc7aad
commit 4b3c839983
2 changed files with 31 additions and 11 deletions

View File

@ -24,20 +24,19 @@
import QtQuick 1.1
Item {
FocusScope {
id: container
width: 80; height: 30
property color color: "white"
property color borderColor: "#ababab"
property color focusColor: "#266294"
property color hoverColor: "#5692c4"
property alias font: textInput.font
property alias textColor: textInput.color
property variant items: [ "" ]
property int index: 0
onFocusChanged: textInput.focus = focus
function prevItem() {
if (index > 0)
index--
@ -50,11 +49,24 @@ Item {
Rectangle {
id: main
property bool hover: false
anchors.fill: parent
color: container.color
border.color: textInput.focus ? container.focusColor : container.borderColor
border.color: hover ? container.hoverColor : (container.activeFocus ? container.focusColor : container.borderColor)
border.width: 1
Behavior on border.color { ColorAnimation { duration: 200 } }
MouseArea {
hoverEnabled: true
anchors.fill: parent
onEntered: parent.hover = true
onExited: parent.hover = false
}
}
TextInput {
@ -64,7 +76,9 @@ Item {
anchors.leftMargin: 8
anchors.verticalCenter: parent.verticalCenter
clip: true
color: "black"
focus: true
readOnly: true
text: container.items[container.index]

View File

@ -24,35 +24,38 @@
import QtQuick 1.1
Item {
FocusScope {
id: container
width: 80; height: 30
property color color: "white"
property color borderColor: "#ababab"
property color focusColor: "#266294"
property color hoverColor: "#990b678c"
property color hoverColor: "#5692c4"
property alias font: textInput.font
property alias textColor: textInput.color
property alias echoMode: textInput.echoMode
property alias text: textInput.text
onFocusChanged: textInput.focus = focus
Rectangle {
id: border
property bool hover: false
anchors.fill: parent
color: container.color
border.color: textInput.focus ? container.focusColor : container.borderColor
border.color: hover ? container.hoverColor : (container.activeFocus ? container.focusColor : container.borderColor)
border.width: 1
Behavior on border.color { ColorAnimation { duration: 200 } }
MouseArea {
hoverEnabled: true
anchors.fill: parent
onEntered: parent.border.color = container.hoverColor
onExited: parent.border.color = textInput.focus ? container.focusColor : container.borderColor
onEntered: parent.hover = true
onExited: parent.hover = false
}
}
@ -63,6 +66,9 @@ Item {
color: "black"
clip: true
focus: true
passwordCharacter: "\u25cf"
}
}