MultiplayerDemo
import QtQuick 2.0
Rectangle {
id: button
color: "transparent"
width: buttonText.width + paddingHorizontal * 2
height: buttonText.height + paddingVertical * 2
property alias text: buttonText.text
property alias textColor: buttonText.color
property alias textSize: buttonText.font.pixelSize
property alias backgroundColor: button.color
property int paddingHorizontal: notification > 0 ? notificationRect.width/2+4:4
property int paddingVertical: 4
property int notification: 0
signal clicked
Text {
id: buttonText
font.pixelSize: 18
color: "white"
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter:notification > 0 ? undefined: parent.horizontalCenter
x: notification > 0 ?2 : 0
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: button.clicked()
onPressed: button.opacity = 0.6
onReleased: button.opacity = 1
}
Rectangle{
id: notificationRect
anchors.left: buttonText.right
anchors.leftMargin: 3
color: "red"
width: 15
height: 15
radius: 40
visible: notification > 0
anchors.verticalCenter: parent.verticalCenter
Text{
font.pixelSize: 10
font.bold: true
anchors.centerIn: parent
text: notification
color: "white"