qtmobility/examples/declarative-sfw-notes/content/Button.qml
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 16:41:33 +0300
changeset 5 453da2cfceef
child 14 6fbed849b4f4
permissions -rw-r--r--
Revision: 201017 Kit: 201019

import Qt 4.7

Rectangle {
    id: container

    signal clicked
    property string image: ""
    property string text: ""

    color: activePalette.button; smooth: true
    border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8;

    gradient: Gradient {
        GradientStop {
            id: topGrad; position: 0.0
            color :if (mr.pressed) { activePalette.dark } else { activePalette.light } }
        GradientStop { position: 1.0; color: activePalette.button }
    }

    Image {
        id: imgItem;
        smooth: true
        width: 16; height: 16;
        source: container.image; anchors.centerIn: container
    }

    MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }

    Text {
        id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText
    }
}