blob: 61d1832db4d3153b019aabbb056cc6d6ae427228 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 2.0
GridView {
id: theGrid
property alias data : theGrid.model
property alias itemWidget : theGrid.delegate
/*
Setting rows/columns fundamentally changes how children fit into the GridView.
-Normal behaviour: Children have a fixed size (cellWidth/cellHeight) and the NUMBER of them
that will fit into the GridView varies with the GridView's size.
-Modified behaviour(setting rows and/or columns triggers this mode): A fixed number of children
will fit into the GridView (determined by number of rows/columns) and their SIZE
(cellWidth/cellHeight) will vary with the GridView's size
-rows/columns determines the size of VISIBLE children and simply sets cellWidth/cellHeight at runtime.
If the number of children is different than rows * columns, it will either scroll or not
fill the GridView completely, same as normal.
-the item_Widget component must be designed for fluid layout using anchors, not fixed sizes,
for this to have any effect besides spacing
*/
property int rows
property int columns
Component.onCompleted: {
if (rows) {
theGrid.cellHeight = theGrid.height/rows
}
if (columns) {
theGrid.cellWidth = theGrid.width/columns
}
}
}
|