Menu.qml Example File
lowenergyscanner/assets/Menu.qml
import QtQuick 2.0
Rectangle {
property real menuWidth: 100
property real menuHeight: 50
property string menuText: "Search"
signal buttonClick()
height: menuHeight
width: menuWidth
Rectangle {
id: search
width: parent.width
height: parent.height
anchors.centerIn: parent
color: "#363636"
border.width: 1
border.color: "#E3E3E3"
radius: 5
Text {
id: searchText
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.fill: parent
text: menuText
elide: Text.ElideMiddle
color: "#E3E3E3"
wrapMode: Text.WordWrap
}
MouseArea {
anchors.fill: parent
onPressed: {
search.width = search.width - 7
search.height = search.height - 5
}
onReleased: {
search.width = search.width + 7
search.height = search.height + 5
}
onClicked: {
buttonClick()
}
}
}
}