38 lines
1.0 KiB
QML
38 lines
1.0 KiB
QML
import QtQuick 2.0
|
|
import Sailfish.Silica 1.0
|
|
|
|
// Pulsante a tutta larghezza per un comando del bridge.
|
|
// Se `confirmText` e' valorizzato, l'azione parte solo dopo la conferma
|
|
// (RemorseItem): la usano i comandi che cambiano lo stato in modo duraturo.
|
|
Item {
|
|
id: root
|
|
|
|
width: parent ? parent.width : 0
|
|
height: btn.height
|
|
|
|
property string text: ""
|
|
property string confirmText: ""
|
|
signal triggered()
|
|
|
|
Button {
|
|
id: btn
|
|
anchors {
|
|
left: parent.left
|
|
right: parent.right
|
|
leftMargin: Theme.horizontalPageMargin
|
|
rightMargin: Theme.horizontalPageMargin
|
|
}
|
|
text: root.text
|
|
onClicked: {
|
|
if (root.confirmText.length > 0) {
|
|
remorse.execute(btn, root.confirmText, function() { root.triggered() })
|
|
} else {
|
|
root.triggered()
|
|
}
|
|
}
|
|
}
|
|
|
|
// Fuori dal Button: dentro il pulsante i figli finiscono nel contentItem.
|
|
RemorseItem { id: remorse }
|
|
}
|