Created
December 17, 2014 10:21
-
-
Save vannell/985226928d6646fc9914 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import QtQuick 2.3 | |
FocusScope { | |
id: scope | |
property alias text: label.text | |
signal clicked() | |
//FocusScope needs to bind to visual properties of the children | |
property alias color: rectangle.color | |
x: rectangle.x | |
y: rectangle.y | |
width: rectangle.width | |
height: rectangle.height | |
Rectangle { | |
id: rectangle | |
color: "lightsteelblue" | |
width: 175 | |
height: 25 | |
radius: 10 | |
antialiasing: true | |
border.color: "blue" | |
TextInput { | |
id: label | |
anchors.centerIn: parent | |
focus: true | |
} | |
} | |
MouseArea { | |
anchors.fill: parent | |
onClicked: { scope.focus = true; parent.clicked() } | |
} | |
} |
This file contains hidden or 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
import QtQuick 2.3 | |
import QtQuick.Controls 1.2 | |
Rectangle { | |
id: window | |
width: 400 | |
height: 150 | |
ListModel { | |
id: model | |
ListElement {x: 42; y: 84} | |
ListElement {x: 126; y: 168} | |
} | |
TableView { | |
id: table | |
anchors.fill: parent | |
model: model | |
focus: true | |
itemDelegate: MyClickableWidget { | |
color: "lightgreen" | |
text: styleData.value | |
onClicked: { | |
console.log("handle click on row " + styleData.row); | |
table.currentRow = styleData.row; | |
} | |
} | |
rowDelegate: Rectangle { | |
height: 50 | |
} | |
TableViewColumn { | |
role: "x" | |
width: 180 | |
} | |
TableViewColumn { | |
role: "y" | |
width: 180 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment