QLabel Examples
Three samples below show different labels in action. The first one is an example of using
maximum defaults in constructor. In such case an empty label is created, later it's set by a value
and becomes visible. The last one is a "clickable" label with tooltip (i.e. it reacts on user
clicks and raises onClick event).
// Define event handling function
function hitTest(value) {
alert(this.name + " is clicked! value = " + value);
}
// Create three labels
lab1 = new QLabel(null, "lab1");
lab2 = new QLabel(null, "lab2", "Sample Label");
lab3 = new QLabel(null, "lab3", "Sample Clickable Label", true, "This is a tooltip");
// Assign event handling function
lab3.onClick = hitTest;