X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmdictionary%2Fqml%2FIconButton.qml;h=37825a75fe29d63709dd3d05a85024a40526bdcf;hb=b4b3cec1e6eb007baf2b8ea83bd21df90643675d;hp=7fc32eacfedc8ab84203a4ccfe7c523d047fe10c;hpb=324ea22239273504192afe5aea525224d1ce343f;p=mdictionary diff --git a/src/mdictionary/qml/IconButton.qml b/src/mdictionary/qml/IconButton.qml index 7fc32ea..37825a7 100644 --- a/src/mdictionary/qml/IconButton.qml +++ b/src/mdictionary/qml/IconButton.qml @@ -4,8 +4,12 @@ Rectangle { id: rectangle property alias pathToIcon: image.source; + property int iconWidth:rectangle.width-8; + property int iconHeight:rectangle.height-8; signal clicked; + function press() { mouseArea.pressed } + radius: 50 MouseArea { @@ -21,41 +25,45 @@ Rectangle { Image { id: image z:4; + smooth: true anchors.centerIn: parent - width: rectangle.width; - height: rectangle.height; + width: iconWidth; + height: iconHeight; } Image { id: image1 - z: 1 smooth: true - width: (35*parent.height)/107 +1 + width: (image1.sourceSize.width*parent.height)/image1.sourceSize.height +1 //(35*parent.height)/107 +1 height: parent.height anchors.left: parent.left source: "qrc:/button/buttonLeft.png" + fillMode:Image.Stretch } Image { id: image3 - z: 1 smooth: true - width: parent.width - (70*parent.height)/107 +1 height: parent.height - anchors.horizontalCenter: parent.horizontalCenter + anchors.right: image2.left + anchors.rightMargin: -1 + anchors.left: image1.right + anchors.leftMargin: -1 source: "qrc:/button/buttonCenter.png" + fillMode:Image.Stretch + //fillMode: Image.TileHorizontally } Image { id: image2 - z: 1 smooth: true - width: (35*parent.height)/107 +1 + width: (image1.sourceSize.width*parent.height)/image1.sourceSize.height +1//(35*parent.height)/107 +1 height: parent.height anchors.right: parent.right source: "qrc:/button/buttonR.png" + fillMode:Image.Stretch } @@ -73,6 +81,14 @@ Rectangle { PropertyChanges { target: image1; source: "qrc:/button/buttonLeftPushed.png" } PropertyChanges { target: image3; source: "qrc:/button/buttonCenterPushed.png" } PropertyChanges { target: image2; source: "qrc:/button/buttonRightPushed.png" } + }, + State { + name: "focused"; + when: (rectangle.enabled && !mouseArea.pressed && rectangle.focus) + + PropertyChanges { target: image1; source: "qrc:/button/buttonLeftFocus.png" } + PropertyChanges { target: image3; source: "qrc:/button/buttonCenterFocus.png" } + PropertyChanges { target: image2; source: "qrc:/button/buttonRFocus.png" } } ] }