-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addition of WarningLabel QML type, to display a warning when a datalo…
…g value is over a threshold
- Loading branch information
1 parent
14dbb3d
commit 235a282
Showing
3 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import Qt 4.7 | ||
|
||
|
||
Rectangle { | ||
id: warninglabel | ||
color:"red" | ||
property bool flash: false | ||
property string propertyMapProperty; | ||
property string conditiontype; | ||
property int conditionval; | ||
property double conditionvalue; | ||
property string message; | ||
Timer { | ||
id: flashertimer | ||
interval: 500 | ||
repeat: true | ||
running: false | ||
onTriggered: { | ||
//console.log("Wee:" + conditionvalue); | ||
if (parent.flash) | ||
{ | ||
parent.flash = false; | ||
parent.color = "orange"; | ||
} | ||
else | ||
{ | ||
parent.flash = true; | ||
parent.color = "red"; | ||
} | ||
} | ||
} | ||
onConditionvalueChanged: { | ||
//console.log("CCalue:" + conditionvalue); | ||
if (conditiontype == "over") | ||
{ | ||
//console.log("CValue:" + conditionvalue + conditionval); | ||
if (conditionvalue > conditionval) | ||
{ | ||
flashertimer.running = true; | ||
warninglabel.visible = true; | ||
} | ||
else | ||
{ | ||
flashertimer.running = false; | ||
warninglabel.visible = false; | ||
} | ||
} | ||
} | ||
Component.onCompleted: | ||
{ | ||
warninglabel.visible = false; | ||
} | ||
|
||
Text { | ||
anchors.fill:parent | ||
horizontalAlignment: Text.AlignHCenter; | ||
verticalAlignment: Text.AlignVCenter; | ||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere; | ||
font.pointSize: 14 | ||
text: message; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters