Skip to content

Instantly share code, notes, and snippets.

@Kakadu
Created February 1, 2014 21:14
Show Gist options
  • Save Kakadu/8758998 to your computer and use it in GitHub Desktop.
Save Kakadu/8758998 to your computer and use it in GitHub Desktop.
QtQuick 2.0 list of buttons with onClicked handlers
import QtQuick 2.0
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
height: 20
radius: 10
border.width: 1
property string title
color: "lightgray"
Text {
text: title
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: parent.clicked()
}
signal clicked()
}
import QtQuick 2.0
Rectangle {
width: 800
height: 600
Column {
x: 0; y:0
width: 200; height: 400
spacing: 3
PanelButton {
id: button1
title: "push1"
onClicked: console.log("button 1 clicked")
}
PanelButton {
id: button2
title: "push2"
onClicked: console.log("button 2 clicked")
}
PanelButton {
id: button3
title: "push3"
onClicked: console.log("button 3 clicked")
}
PanelButton {
id: button4
title: "push4"
onClicked: console.log("button 4 clicked")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment