Skip to content

Instantly share code, notes, and snippets.

@vinipsmaker
Created February 9, 2013 23:36
Show Gist options
  • Save vinipsmaker/4747593 to your computer and use it in GitHub Desktop.
Save vinipsmaker/4747593 to your computer and use it in GitHub Desktop.
Simple program to help me practice violin
import QtQuick 1.1
Rectangle {
width: 360; height: 360
Text {
id: pitch
anchors.centerIn: parent
width: parent.width; height: parent.height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pointSize: parent.height / 2
property variant pitchs: ["Dó", "Ré", "Mi", "Fá", "Sol", "Lá", "Si"]
}
Timer {
interval: 2000; running: true; repeat: true
property string str: ""
onTriggered: {
do {
str = pitch.pitchs[Math.ceil(Math.random() * 7)]
} while (str == pitch.text)
pitch.text = str
}
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment