Elements work like they've always done, this just moves the commonly used components away from the global namespace. The qmldir file still does something, although at this point it is unknown exactly how it's used and whether or not it could be changed to simplify imports across the block.
32 lines
770 B
QML
32 lines
770 B
QML
import QtQuick 2.7
|
|
import QtQuick.Controls 2.0
|
|
import "." // QTBUG-34418, singletons require explicit import to load qmldir file
|
|
|
|
Button {
|
|
property bool activationSoundEnabled: true
|
|
hoverEnabled: true
|
|
contentItem: MyText {
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
text: parent.text
|
|
color: parent.enabled ? "#ffffff" : "#909090"
|
|
}
|
|
background: Rectangle {
|
|
color: parent.down ? "#406288" : (parent.activeFocus ? "#365473" : "#2c435d")
|
|
}
|
|
|
|
onHoveredChanged: {
|
|
if (hovered) {
|
|
forceActiveFocus()
|
|
} else {
|
|
focus = false
|
|
}
|
|
}
|
|
|
|
onClicked: {
|
|
if (activationSoundEnabled) {
|
|
MyResources.playActivationSound()
|
|
}
|
|
}
|
|
}
|