slot function in QML

This commit is contained in:
Faye Li 2017-01-03 11:15:28 -08:00
parent 656ddfe287
commit 7e1b06efdc

View file

@ -5,11 +5,16 @@ Item {
id: tablet id: tablet
objectName: "tablet" objectName: "tablet"
property double miclevel: 0.8 property double micLevel: 0.8
width: parent.width width: parent.width
height: parent.height height: parent.height
// called by C++ code to keep mic level display bar UI updated
function setMicLevel(newMicLevel) {
tablet.micLevel = newMicLevel;
}
// used to look up a button by its uuid // used to look up a button by its uuid
function findButtonIndex(uuid) { function findButtonIndex(uuid) {
if (!uuid) { if (!uuid) {
@ -101,7 +106,7 @@ Item {
} }
Rectangle { Rectangle {
id: audioBarMask id: audioBarMask
width: parent.width * tablet.miclevel width: parent.width * tablet.micLevel
color: "#333333" color: "#333333"
radius: 5 radius: 5
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -205,7 +210,7 @@ Item {
PropertyChanges { PropertyChanges {
target: tablet target: tablet
miclevel: 0 micLevel: 0
} }
} }
] ]