Skip to content

Instantly share code, notes, and snippets.

@benlau
Created May 10, 2015 08:38
Show Gist options
  • Save benlau/cff01d281359c2d23cf2 to your computer and use it in GitHub Desktop.
Save benlau/cff01d281359c2d23cf2 to your computer and use it in GitHub Desktop.
import QtQuick 2.0
Rectangle {
color : "white"
MouseArea {
anchors.fill:parent
onClicked: Grabber.grab(grid);
}
Grid {
id: grid
anchors.centerIn: parent
rows: 4
columns : 4
spacing : 0
Repeater {
model : ['#F44336',
'#E91E63',
'#9C27B0',
'#673AB7',
'#3F51B5',
'#2196F3',
'#03A9F4',
'#00BCD4',
'#009688',
'#4CAF50',
'#8BC34A',
'#CDDC39',
'#FFEB3B',
'#FFC107',
'#FF9800',
'#FF5722'
]
delegate: Rectangle {
width: 32
height:32
color : modelData
}
}
Connections {
target: Grabber
onGrabbed:{
Grabber.save("icon.png");
Grabber.clear();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment