import Qt 4.7 BorderImage { id: button property alias textInButton: buttonText.text signal clicked opacity: 1 function setText(string) { textInButton = qsTr(string); } border { left: 10; top: 10; right: 10; bottom: 10 } MouseArea { id: mouseArea anchors.centerIn: parent; width: parent.width; height: parent.height; onClicked: { button.clicked(); } } Text { z:1 id: buttonText anchors.centerIn: parent; font.pixelSize: parent.height * .5 style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true } Image { id: image1 width: (35*parent.height)/107 +1 height: parent.height anchors.left: parent.left source: "qrc:/button/buttonLeft.png" fillMode:Image.Stretch } Image { id: image3 smooth: true width: parent.width - ((70*parent.height)/107) +1; height: parent.height anchors.horizontalCenter: parent.horizontalCenter source: "qrc:/button/buttonCenter.png" fillMode:Image.Stretch } Image { id: image2 smooth: true width: (35*parent.height)/107 +1 height: parent.height anchors.right: parent.right source: "qrc:/button/buttonR.png" fillMode:Image.Stretch } states: [ State { name: "pressed"; when: (mouseArea.pressed == true && button.enabled == true); 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: "disabled"; when: (button.enabled == false); PropertyChanges { target: image1; source: "qrc:/button/buttonLeftDisabled.png" } PropertyChanges { target: image3; source: "qrc:/button/buttonCenterDisabled.png" } PropertyChanges { target: image2; source: "qrc:/button/buttonRightDisabled.png" } } ] }