X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=qml%2Fubi%2Fcomponents%2FToolIcon.qml;fp=qml%2Fubi%2Fcomponents%2FToolIcon.qml;h=8c4b19e8f7cb83a28c4f404b921870903c5b2a32;hb=f18d8567ac9a15d8d1e4cb2fe75a713b564092cd;hp=0000000000000000000000000000000000000000;hpb=ad71e3261fb881a38f146ca8fb7425f8eda7e666;p=ubi diff --git a/qml/ubi/components/ToolIcon.qml b/qml/ubi/components/ToolIcon.qml new file mode 100644 index 0000000..8c4b19e --- /dev/null +++ b/qml/ubi/components/ToolIcon.qml @@ -0,0 +1,44 @@ +import QtQuick 1.0 + +Item { + id: root + + property string iconSource + property bool enabled: true + property bool pressed: mouseArea.pressed + + signal clicked + signal pressAndHold + + width: 56 + height: 56 + opacity: enabled ? 1 : 0.3 + + Rectangle { + anchors { fill: parent; margins: 5 } + color: "gray" + opacity: 0.5 + radius: 10 + visible: mouseArea.pressed + } + + Image { + id: icon + + width: 40 + height: 40 + anchors.centerIn: parent + source: iconSource == "" ? "" : "../" + iconSource + sourceSize.width: width + sourceSize.height: height + } + + MouseArea { + id: mouseArea + + anchors.fill: parent + enabled: root.enabled + onClicked: parent.clicked() + onPressAndHold: parent.pressAndHold() + } +}