This file is indexed.

/usr/share/qt5/doc/qtquick/qml-qtquick-gridview.html is in qtdeclarative5-doc-html 5.5.1-2ubuntu6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickgridview.cpp -->
  <title>GridView QML Type | Qt Quick 5.5</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
    <div class="main">
    <div class="main-rounded">
        <div class="navigationbar">
        <ul>
<li>Qt 5.5</li>
<li><a href="qtquick-index.html">Qt Quick</a></li>
<li><a href="qtquick-qmlmodule.html">QML Types</a></li>
<li>GridView QML Type</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
    </ul>
    </div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#properties">Attached Properties</a></li>
<li class="level1"><a href="#signals">Attached Signals</a></li>
<li class="level1"><a href="#methods">Methods</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#example-usage">Example Usage</a></li>
<li class="level2"><a href="#gridview-layouts">GridView Layouts</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">GridView QML Type</h1>
<span class="subtitle"></span>
<!-- $$$GridView-brief -->
<p>For specifying a grid view of items provided by a model <a href="#details">More...</a></p>
<!-- @@@GridView -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick 2.5</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-flickable.html">Flickable</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-gridview-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#add-prop">add</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#addDisplaced-prop">addDisplaced</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#cacheBuffer-prop">cacheBuffer</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#cellHeight-prop">cellHeight</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#cellWidth-prop">cellWidth</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#count-prop">count</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#currentIndex-prop">currentIndex</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#currentItem-prop">currentItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#delegate-prop">delegate</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#displaced-prop">displaced</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#displayMarginBeginning-prop">displayMarginBeginning</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#displayMarginEnd-prop">displayMarginEnd</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#effectiveLayoutDirection-prop">effectiveLayoutDirection</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#flow-prop">flow</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#footer-prop">footer</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#footerItem-prop">footerItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#header-prop">header</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#headerItem-prop">headerItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#highlight-prop">highlight</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#highlightItem-prop">highlightItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#highlightMoveDuration-prop">highlightMoveDuration</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#highlightRangeMode-prop">highlightRangeMode</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#keyNavigationWraps-prop">keyNavigationWraps</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#layoutDirection-prop">layoutDirection</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#model-prop">model</a></b></b> : model</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#move-prop">move</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#moveDisplaced-prop">moveDisplaced</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#populate-prop">populate</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#preferredHighlightBegin-prop">preferredHighlightBegin</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#preferredHighlightEnd-prop">preferredHighlightEnd</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#remove-prop">remove</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#removeDisplaced-prop">removeDisplaced</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#snapMode-prop">snapMode</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#verticalLayoutDirection-prop">verticalLayoutDirection</a></b></b> : enumeration</li>
</ul>
<a name="attached-properties"></a>
<h2 id="attached-properties">Attached Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#delayRemove-attached-prop">delayRemove</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#isCurrentItem-attached-prop">isCurrentItem</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#view-attached-prop">view</a></b></b> : GridView</li>
</ul>
<a name="attached-signals"></a>
<h2 id="attached-signals">Attached Signals</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#add-signal">add</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#remove-signal">remove</a></b></b>()</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#forceLayout-method">forceLayout</a></b></b>()</li>
<li class="fn">int <b><b><a href="qml-qtquick-gridview.html#indexAt-method">indexAt</a></b></b>(int <i> x</i>, int <i> y</i>)</li>
<li class="fn">Item <b><b><a href="qml-qtquick-gridview.html#itemAt-method">itemAt</a></b></b>(int <i> x</i>, int <i> y</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#moveCurrentIndexDown-method">moveCurrentIndexDown</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#moveCurrentIndexLeft-method">moveCurrentIndexLeft</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#moveCurrentIndexRight-method">moveCurrentIndexRight</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#moveCurrentIndexUp-method">moveCurrentIndexUp</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#positionViewAtBeginning-method">positionViewAtBeginning</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#positionViewAtEnd-method">positionViewAtEnd</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-gridview.html#positionViewAtIndex-method">positionViewAtIndex</a></b></b>(int <i> index</i>, PositionMode <i> mode</i>)</li>
</ul>
<!-- $$$GridView-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
</p>
<p>A <a href="qml-qtquick-gridview.html">GridView</a> displays data from models created from built-in QML types like <a href="qtquick-modelviewsdata-modelview.html#listmodel">ListModel</a> and <a href="qtquick-modelviewsdata-modelview.html#xmllistmodel">XmlListModel</a>, or custom model classes defined in C++ that inherit from QAbstractListModel.</p>
<p>A <a href="qml-qtquick-gridview.html">GridView</a> has a <a href="qml-qtquick-gridview.html#model-prop">model</a>, which defines the data to be displayed, and a <a href="qml-qtquick-gridview.html#delegate-prop">delegate</a>, which defines how the data should be displayed. Items in a <a href="qml-qtquick-gridview.html">GridView</a> are laid out horizontally or vertically. Grid views are inherently flickable as <a href="qml-qtquick-gridview.html">GridView</a> inherits from <a href="qtquick-touchinteraction-example.html#flickable">Flickable</a>.</p>
<a name="example-usage"></a>
<h2 id="example-usage">Example Usage</h2>
<p>The following example shows the definition of a simple list model defined in a file called <code>ContactModel.qml</code>:</p>
<pre class="qml">import QtQuick 2.0

<span class="type">ListModel</span> {

    <span class="type">ListElement</span> {
        <span class="name">name</span>: <span class="string">&quot;Jim Williams&quot;</span>
        <span class="name">portrait</span>: <span class="string">&quot;pics/portrait.png&quot;</span>
    }
    <span class="type">ListElement</span> {
        <span class="name">name</span>: <span class="string">&quot;John Brown&quot;</span>
        <span class="name">portrait</span>: <span class="string">&quot;pics/portrait.png&quot;</span>
    }
    <span class="type">ListElement</span> {
        <span class="name">name</span>: <span class="string">&quot;Bill Smyth&quot;</span>
        <span class="name">portrait</span>: <span class="string">&quot;pics/portrait.png&quot;</span>
    }
    <span class="type">ListElement</span> {
        <span class="name">name</span>: <span class="string">&quot;Sam Wise&quot;</span>
        <span class="name">portrait</span>: <span class="string">&quot;pics/portrait.png&quot;</span>
    }
}</pre>
<div class="float-right"><p><img src="images/gridview-simple.png" alt="" /></p>
</div><p>This model can be referenced as <code>ContactModel</code> in other QML files. See QML Modules for more information about creating reusable components like this.</p>
<p>Another component can display this model data in a <a href="qml-qtquick-gridview.html">GridView</a>, as in the following example, which creates a <code>ContactModel</code> component for its model, and a <a href="qtquick-positioning-layouts.html#column">Column</a> (containing <a href="qtquick-imageelements-example.html#image">Image</a> and <a href="qml-qtquick-text.html">Text</a> items) for its delegate.</p>
<br style="clear: both" /><pre class="qml">import QtQuick 2.0

<span class="type"><a href="qml-qtquick-gridview.html">GridView</a></span> {
    <span class="name">width</span>: <span class="number">300</span>; <span class="name">height</span>: <span class="number">200</span>

    <span class="name">model</span>: <span class="name">ContactModel</span> {}
    <span class="name">delegate</span>: <span class="name">Column</span> {
        <span class="type"><a href="qml-qtquick-image.html">Image</a></span> { <span class="name">source</span>: <span class="name">portrait</span>; <span class="name">anchors</span>.horizontalCenter: <span class="name">parent</span>.<span class="name">horizontalCenter</span> }
        <span class="type"><a href="qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="name">name</span>; <span class="name">anchors</span>.horizontalCenter: <span class="name">parent</span>.<span class="name">horizontalCenter</span> }
    }
}</pre>
<div class="float-right"><p><img src="images/gridview-highlight.png" alt="" /></p>
</div><p>The view will create a new delegate for each item in the model. Note that the delegate is able to access the model's <code>name</code> and <code>portrait</code> data directly.</p>
<p>An improved grid view is shown below. The delegate is visually improved and is moved into a separate <code>contactDelegate</code> component.</p>
<br style="clear: both" /><pre class="qml"><span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
    <span class="name">width</span>: <span class="number">300</span>; <span class="name">height</span>: <span class="number">200</span>

    <span class="type">Component</span> {
        <span class="name">id</span>: <span class="name">contactDelegate</span>
        <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
            <span class="name">width</span>: <span class="name">grid</span>.<span class="name">cellWidth</span>; <span class="name">height</span>: <span class="name">grid</span>.<span class="name">cellHeight</span>
            <span class="type"><a href="qml-qtquick-column.html">Column</a></span> {
                <span class="name">anchors</span>.fill: <span class="name">parent</span>
                <span class="type"><a href="qml-qtquick-image.html">Image</a></span> { <span class="name">source</span>: <span class="name">portrait</span>; <span class="name">anchors</span>.horizontalCenter: <span class="name">parent</span>.<span class="name">horizontalCenter</span> }
                <span class="type"><a href="qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="name">name</span>; <span class="name">anchors</span>.horizontalCenter: <span class="name">parent</span>.<span class="name">horizontalCenter</span> }
            }
        }
    }

    <span class="type"><a href="qml-qtquick-gridview.html">GridView</a></span> {
        <span class="name">id</span>: <span class="name">grid</span>
        <span class="name">anchors</span>.fill: <span class="name">parent</span>
        <span class="name">cellWidth</span>: <span class="number">80</span>; <span class="name">cellHeight</span>: <span class="number">80</span>

        <span class="name">model</span>: <span class="name">ContactModel</span> {}
        <span class="name">delegate</span>: <span class="name">contactDelegate</span>
        <span class="name">highlight</span>: <span class="name">Rectangle</span> { <span class="name">color</span>: <span class="string">&quot;lightsteelblue&quot;</span>; <span class="name">radius</span>: <span class="number">5</span> }
        <span class="name">focus</span>: <span class="number">true</span>
    }
}</pre>
<p>The currently selected item is highlighted with a blue <a href="qml-qtquick-rectangle.html">Rectangle</a> using the <a href="qtquick-views-example.html#highlight">highlight</a> property, and <code>focus</code> is set to <code>true</code> to enable keyboard navigation for the grid view. The grid view itself is a focus scope (see <a href="qtquick-input-focus.html">Keyboard Focus in Qt Quick</a> for more details).</p>
<p>Delegates are instantiated as needed and may be destroyed at any time. State should <i>never</i> be stored in a delegate.</p>
<p><a href="qml-qtquick-gridview.html">GridView</a> attaches a number of properties to the root item of the delegate, for example <code>GridView.isCurrentItem</code>. In the following example, the root delegate item can access this attached property directly as <code>GridView.isCurrentItem</code>, while the child <code>contactInfo</code> object must refer to this property as <code>wrapper.GridView.isCurrentItem</code>.</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-gridview.html">GridView</a></span> {
    <span class="name">width</span>: <span class="number">300</span>; <span class="name">height</span>: <span class="number">200</span>
    <span class="name">cellWidth</span>: <span class="number">80</span>; <span class="name">cellHeight</span>: <span class="number">80</span>

    <span class="type">Component</span> {
        <span class="name">id</span>: <span class="name">contactsDelegate</span>
        <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
            <span class="name">id</span>: <span class="name">wrapper</span>
            <span class="name">width</span>: <span class="number">80</span>
            <span class="name">height</span>: <span class="number">80</span>
            <span class="name">color</span>: <span class="name">GridView</span>.<span class="name">isCurrentItem</span> ? <span class="string">&quot;black&quot;</span> : <span class="string">&quot;red&quot;</span>
            <span class="type"><a href="qml-qtquick-text.html">Text</a></span> {
                <span class="name">id</span>: <span class="name">contactInfo</span>
                <span class="name">text</span>: <span class="name">name</span> <span class="operator">+</span> <span class="string">&quot;: &quot;</span> <span class="operator">+</span> <span class="name">number</span>
                <span class="name">color</span>: <span class="name">wrapper</span>.<span class="name">GridView</span>.<span class="name">isCurrentItem</span> ? <span class="string">&quot;red&quot;</span> : <span class="string">&quot;black&quot;</span>
            }
        }
    }

    <span class="name">model</span>: <span class="name">ContactModel</span> {}
    <span class="name">delegate</span>: <span class="name">contactsDelegate</span>
    <span class="name">focus</span>: <span class="number">true</span>
}</pre>
<p><b>Note: </b>Views do not set the <a href="qml-qtquick-item.html#clip-prop">clip</a> property automatically. If the view is not clipped by another item or the screen, it will be necessary to set this property to true in order to clip the items that are partially or fully outside the view.</p><a name="gridview-layouts"></a>
<h2 id="gridview-layouts">GridView Layouts</h2>
<p>The layout of the items in a <a href="qml-qtquick-gridview.html">GridView</a> can be controlled by these properties:</p>
<ul>
<li><a href="qtquick-positioning-layouts.html#flow">flow</a> - controls whether items flow from left to right (as a series of rows) or from top to bottom (as a series of columns). This value can be either <a href="qml-qtquick-gridview.html">GridView</a>.FlowLeftToRight or <a href="qml-qtquick-gridview.html">GridView</a>.FlowTopToBottom.</li>
<li><a href="qml-qtquick-gridview.html#layoutDirection-prop">layoutDirection</a> - controls the horizontal layout direction: that is, whether items are laid out from the left side of the view to the right, or vice-versa. This value can be either Qt.LeftToRight or Qt.RightToLeft.</li>
<li><a href="qml-qtquick-gridview.html#verticalLayoutDirection-prop">verticalLayoutDirection</a> - controls the vertical layout direction: that is, whether items are laid out from the top of the view down towards the bottom of the view, or vice-versa. This value can be either <a href="qml-qtquick-gridview.html">GridView</a>.TopToBottom or <a href="qml-qtquick-gridview.html">GridView</a>.BottomToTop.</li>
</ul>
<p>By default, a <a href="qml-qtquick-gridview.html">GridView</a> flows from left to right, and items are laid out from left to right horizontally, and from top to bottom vertically.</p>
<p>These properties can be combined to produce a variety of layouts, as shown in the table below. The GridViews in the first row all have a <a href="qtquick-positioning-layouts.html#flow">flow</a> value of <a href="qml-qtquick-gridview.html">GridView</a>.FlowLeftToRight, but use different combinations of horizontal and vertical layout directions (specified by <a href="qml-qtquick-gridview.html#layoutDirection-prop">layoutDirection</a> and <a href="qml-qtquick-gridview.html#verticalLayoutDirection-prop">verticalLayoutDirection</a> respectively). Similarly, the GridViews in the second row below all have a <a href="qtquick-positioning-layouts.html#flow">flow</a> value of <a href="qml-qtquick-gridview.html">GridView</a>.FlowTopToBottom, but use different combinations of horizontal and vertical layout directions to lay out their items in different ways.</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th  colspan="4" rowspan=" 1"><b>GridViews</b> with <a href="qml-qtquick-gridview.html">GridView</a>.FlowLeftToRight flow</th></tr></thead>
<tr valign="top" class="odd"><td ><b>(H)</b> Left to right <b>(V)</b> Top to bottom<p class="centerAlign"><img src="images/gridview-layout-lefttoright-ltr-ttb.png" alt="" /></p></td><td ><b>(H)</b> Right to left <b>(V)</b> Top to bottom<p class="centerAlign"><img src="images/gridview-layout-lefttoright-rtl-ttb.png" alt="" /></p></td><td ><b>(H)</b> Left to right <b>(V)</b> Bottom to top<p class="centerAlign"><img src="images/gridview-layout-lefttoright-ltr-btt.png" alt="" /></p></td><td ><b>(H)</b> Right to left <b>(V)</b> Bottom to top<p class="centerAlign"><img src="images/gridview-layout-lefttoright-rtl-btt.png" alt="" /></p></td></tr>
<thead><tr class="qt-style"><th  colspan="4" rowspan=" 1"><b>GridViews</b> with <a href="qml-qtquick-gridview.html">GridView</a>.FlowTopToBottom flow</th></tr></thead>
<tr valign="top" class="even"><td ><b>(H)</b> Left to right <b>(V)</b> Top to bottom<p class="centerAlign"><img src="images/gridview-layout-toptobottom-ltr-ttb.png" alt="" /></p></td><td ><b>(H)</b> Right to left <b>(V)</b> Top to bottom<p class="centerAlign"><img src="images/gridview-layout-toptobottom-rtl-ttb.png" alt="" /></p></td><td ><b>(H)</b> Left to right <b>(V)</b> Bottom to top<p class="centerAlign"><img src="images/gridview-layout-toptobottom-ltr-btt.png" alt="" /></p></td><td ><b>(H)</b> Right to left <b>(V)</b> Bottom to top<p class="centerAlign"><img src="images/gridview-layout-toptobottom-rtl-btt.png" alt="" /></p></td></tr>
</table></div>
<p><b>See also </b><a href="qtquick-modelviewsdata-modelview.html#qml-data-models">QML Data Models</a>, <a href="qml-qtquick-listview.html">ListView</a>, <a href="qml-qtquick-pathview.html">PathView</a>, and <a href="qtquick-views-example.html">Qt Quick Examples - Views</a>.</p>
<!-- @@@GridView -->
<h2>Property Documentation</h2>
<!-- $$$add -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="add-prop"><td class="tblQmlPropNode"><p><a name="add-prop"></a><span class="name">add</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the transition to apply to items that are added to the view.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">GridView {
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    add: Transition {
        NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; from: <span class="number">100</span>; duration: <span class="number">1000</span> }
    }
}</pre>
<p>Whenever an item is added to the above view, the item will be animated from the position (100,100) to its final x,y position within the view, over one second. The transition only applies to the new items that are added to the view; it does not apply to the items below that are displaced by the addition of the new items. To animate the displaced items, set the <a href="qml-qtquick-gridview.html#displaced-prop">displaced</a> or <a href="qml-qtquick-gridview.html#addDisplaced-prop">addDisplaced</a> properties.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>Note: </b>This transition is not applied to the items that are created when the view is initially populated, or when the view's <a href="qml-qtquick-gridview.html#model-prop">model</a> changes. (In those cases, the <a href="qml-qtquick-gridview.html#populate-prop">populate</a> transition is applied instead.) Additionally, this transition should <i>not</i> animate the height of the new item; doing so will cause any items beneath the new item to be laid out at the wrong position. Instead, the height can be animated within the onAdd handler in the delegate.</p><p><b>See also </b><a href="qml-qtquick-gridview.html#addDisplaced-prop">addDisplaced</a>, <a href="qml-qtquick-gridview.html#populate-prop">populate</a>, and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@add -->
<br/>
<!-- $$$addDisplaced -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="addDisplaced-prop"><td class="tblQmlPropNode"><p><a name="addDisplaced-prop"></a><span class="name">addDisplaced</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the transition to apply to items within the view that are displaced by the addition of other items to the view.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">GridView {
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    addDisplaced: Transition {
        NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
    }
}</pre>
<p>Whenever an item is added to the above view, all items beneath the new item are displaced, causing them to move down (or sideways, if horizontally orientated) within the view. As this displacement occurs, the items' movement to their new x,y positions within the view will be animated by a <a href="qml-qtquick-numberanimation.html">NumberAnimation</a> over one second, as specified. This transition is not applied to the new item that has been added to the view; to animate the added items, set the <a href="qml-qtquick-gridview.html#add-prop">add</a> property.</p>
<p>If an item is displaced by multiple types of operations at the same time, it is not defined as to whether the addDisplaced, <a href="qml-qtquick-gridview.html#moveDisplaced-prop">moveDisplaced</a> or <a href="qml-qtquick-gridview.html#removeDisplaced-prop">removeDisplaced</a> transition will be applied. Additionally, if it is not necessary to specify different transitions depending on whether an item is displaced by an add, move or remove operation, consider setting the <a href="qml-qtquick-gridview.html#displaced-prop">displaced</a> property instead.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>Note: </b>This transition is not applied to the items that are created when the view is initially populated, or when the view's <a href="qml-qtquick-gridview.html#model-prop">model</a> changes. In those cases, the <a href="qml-qtquick-gridview.html#populate-prop">populate</a> transition is applied instead.</p><p><b>See also </b><a href="qml-qtquick-gridview.html#displaced-prop">displaced</a>, <a href="qml-qtquick-gridview.html#add-prop">add</a>, <a href="qml-qtquick-gridview.html#populate-prop">populate</a>, and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@addDisplaced -->
<br/>
<!-- $$$cacheBuffer -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="cacheBuffer-prop"><td class="tblQmlPropNode"><p><a name="cacheBuffer-prop"></a><span class="name">cacheBuffer</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property determines whether delegates are retained outside the visible area of the view.</p>
<p>If this value is greater than zero, the view may keep as many delegates instantiated as will fit within the buffer specified. For example, if in a vertical view the delegate is 20 pixels high, there are 3 columns and <code>cacheBuffer</code> is set to 40, then up to 6 delegates above and 6 delegates below the visible area may be created/retained. The buffered delegates are created asynchronously, allowing creation to occur across multiple frames and reducing the likelihood of skipping frames. In order to improve painting performance delegates outside the visible area are not painted.</p>
<p>The default value of this property is platform dependent, but will usually be a value greater than zero. Negative values are ignored.</p>
<p>Note that cacheBuffer is not a pixel buffer - it only maintains additional instantiated delegates.</p>
<p>Setting this value can make scrolling the list smoother at the expense of additional memory usage. It is not a substitute for creating efficient delegates; the fewer objects and bindings in a delegate, the faster a view may be scrolled.</p>
<p>The cacheBuffer operates outside of any display margins specified by <a href="qml-qtquick-gridview.html#displayMarginBeginning-prop">displayMarginBeginning</a> or <a href="qml-qtquick-gridview.html#displayMarginEnd-prop">displayMarginEnd</a>.</p>
</div></div><!-- @@@cacheBuffer -->
<br/>
<!-- $$$cellHeight -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="cellHeight-prop"><td class="tblQmlPropNode"><p><a name="cellHeight-prop"></a><span class="name">cellHeight</span> : <span class="type">real</span></p></td></tr></table></div></div><div class="qmldoc"><p>These properties holds the width and height of each cell in the grid.</p>
<p>The default cell size is 100x100.</p>
</div></div><!-- @@@cellHeight -->
<br/>
<!-- $$$cellWidth -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="cellWidth-prop"><td class="tblQmlPropNode"><p><a name="cellWidth-prop"></a><span class="name">cellWidth</span> : <span class="type">real</span></p></td></tr></table></div></div><div class="qmldoc"><p>These properties holds the width and height of each cell in the grid.</p>
<p>The default cell size is 100x100.</p>
</div></div><!-- @@@cellWidth -->
<br/>
<!-- $$$count -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="count-prop"><td class="tblQmlPropNode"><p><a name="count-prop"></a><span class="name">count</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the number of items in the view.</p>
</div></div><!-- @@@count -->
<br/>
<!-- $$$currentIndex -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="currentIndex-prop"><td class="tblQmlPropNode"><p><a name="currentIndex-prop"></a><span class="name">currentIndex</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>The <code>currentIndex</code> property holds the index of the current item, and <code>currentItem</code> holds the current item. Setting the currentIndex to -1 will clear the highlight and set <a href="qml-qtquick-gridview.html#currentItem-prop">currentItem</a> to null.</p>
<p>If <a href="qml-qtquick-gridview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> is <code>true</code>, setting either of these properties will smoothly scroll the <a href="qml-qtquick-gridview.html">GridView</a> so that the current item becomes visible.</p>
<p>Note that the position of the current item may only be approximate until it becomes visible in the view.</p>
</div></div><!-- @@@currentIndex -->
<br/>
<!-- $$$currentItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="currentItem-prop"><td class="tblQmlPropNode"><p><a name="currentItem-prop"></a><span class="name">currentItem</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>The <code>currentIndex</code> property holds the index of the current item, and <code>currentItem</code> holds the current item. Setting the <a href="qml-qtquick-gridview.html#currentIndex-prop">currentIndex</a> to -1 will clear the highlight and set currentItem to null.</p>
<p>If <a href="qml-qtquick-gridview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> is <code>true</code>, setting either of these properties will smoothly scroll the <a href="qml-qtquick-gridview.html">GridView</a> so that the current item becomes visible.</p>
<p>Note that the position of the current item may only be approximate until it becomes visible in the view.</p>
</div></div><!-- @@@currentItem -->
<br/>
<!-- $$$delegate -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="delegate-prop"><td class="tblQmlPropNode"><p><a name="delegate-prop"></a><span class="name">delegate</span> : <span class="type">Component</span></p></td></tr></table></div></div><div class="qmldoc"><p>The delegate provides a template defining each item instantiated by the view. The index is exposed as an accessible <code>index</code> property. Properties of the model are also available depending upon the type of <a href="qtquick-modelviewsdata-modelview.html#qml-data-models">Data Model</a>.</p>
<p>The number of objects and bindings in the delegate has a direct effect on the flicking performance of the view. If at all possible, place functionality that is not needed for the normal display of the delegate in a <a href="qml-qtquick-loader.html">Loader</a> which can load additional components when needed.</p>
<p>The item size of the <a href="qml-qtquick-gridview.html">GridView</a> is determined by <a href="qml-qtquick-gridview.html#cellHeight-prop">cellHeight</a> and <a href="qml-qtquick-gridview.html#cellWidth-prop">cellWidth</a>. It will not resize the items based on the size of the root item in the delegate.</p>
<p>The default <a href="qquickitem.html#z-prop">stacking order</a> of delegate instances is <code>1</code>.</p>
<p><b>Note: </b>Delegates are instantiated as needed and may be destroyed at any time. State should <i>never</i> be stored in a delegate.</p></div></div><!-- @@@delegate -->
<br/>
<!-- $$$displaced -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="displaced-prop"><td class="tblQmlPropNode"><p><a name="displaced-prop"></a><span class="name">displaced</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the generic transition to apply to items that have been displaced by any model operation that affects the view.</p>
<p>This is a convenience for specifying a generic transition for items that are displaced by add, move or remove operations, without having to specify the individual <a href="qml-qtquick-gridview.html#addDisplaced-prop">addDisplaced</a>, <a href="qml-qtquick-gridview.html#moveDisplaced-prop">moveDisplaced</a> and <a href="qml-qtquick-gridview.html#removeDisplaced-prop">removeDisplaced</a> properties. For example, here is a view that specifies a displaced transition:</p>
<pre class="cpp">GridView {
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    displaced: Transition {
        NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
    }
}</pre>
<p>When any item is added, moved or removed within the above view, the items below it are displaced, causing them to move down (or sideways, if horizontally orientated) within the view. As this displacement occurs, the items' movement to their new x,y positions within the view will be animated by a <a href="qml-qtquick-numberanimation.html">NumberAnimation</a> over one second, as specified.</p>
<p>If a view specifies this generic displaced transition as well as a specific <a href="qml-qtquick-gridview.html#addDisplaced-prop">addDisplaced</a>, <a href="qml-qtquick-gridview.html#moveDisplaced-prop">moveDisplaced</a> or <a href="qml-qtquick-gridview.html#removeDisplaced-prop">removeDisplaced</a> transition, the more specific transition will be used instead of the generic displaced transition when the relevant operation occurs, providing that the more specific transition has not been disabled (by setting <a href="qml-qtquick-transition.html#enabled-prop">enabled</a> to false). If it has indeed been disabled, the generic displaced transition is applied instead.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#addDisplaced-prop">addDisplaced</a>, <a href="qml-qtquick-gridview.html#moveDisplaced-prop">moveDisplaced</a>, <a href="qml-qtquick-gridview.html#removeDisplaced-prop">removeDisplaced</a>, and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@displaced -->
<br/>
<!-- $$$displayMarginBeginning -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="displayMarginBeginning-prop"><td class="tblQmlPropNode"><p><a name="displayMarginBeginning-prop"></a><span class="name">displayMarginBeginning</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property allows delegates to be displayed outside of the view geometry.</p>
<p>If this value is non-zero, the view will create extra delegates before the start of the view, or after the end. The view will create as many delegates as it can fit into the pixel size specified.</p>
<p>For example, if in a vertical view the delegate is 20 pixels high, there are 3 columns, and <code>displayMarginBeginning</code> and <code>displayMarginEnd</code> are both set to 40, then 6 delegates above and 6 delegates below will be created and shown.</p>
<p>The default value is 0.</p>
<p>This property is meant for allowing certain UI configurations, and not as a performance optimization. If you wish to create delegates outside of the view geometry for performance reasons, you probably want to use the <a href="qml-qtquick-gridview.html#cacheBuffer-prop">cacheBuffer</a> property instead.</p>
<p>This QML property was introduced in  QtQuick 2.3.</p>
</div></div><!-- @@@displayMarginBeginning -->
<br/>
<!-- $$$displayMarginEnd -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="displayMarginEnd-prop"><td class="tblQmlPropNode"><p><a name="displayMarginEnd-prop"></a><span class="name">displayMarginEnd</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property allows delegates to be displayed outside of the view geometry.</p>
<p>If this value is non-zero, the view will create extra delegates before the start of the view, or after the end. The view will create as many delegates as it can fit into the pixel size specified.</p>
<p>For example, if in a vertical view the delegate is 20 pixels high, there are 3 columns, and <code>displayMarginBeginning</code> and <code>displayMarginEnd</code> are both set to 40, then 6 delegates above and 6 delegates below will be created and shown.</p>
<p>The default value is 0.</p>
<p>This property is meant for allowing certain UI configurations, and not as a performance optimization. If you wish to create delegates outside of the view geometry for performance reasons, you probably want to use the <a href="qml-qtquick-gridview.html#cacheBuffer-prop">cacheBuffer</a> property instead.</p>
<p>This QML property was introduced in  QtQuick 2.3.</p>
</div></div><!-- @@@displayMarginEnd -->
<br/>
<!-- $$$effectiveLayoutDirection -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="effectiveLayoutDirection-prop"><td class="tblQmlPropNode"><p><a name="effectiveLayoutDirection-prop"></a><span class="name">effectiveLayoutDirection</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the effective layout direction of the grid.</p>
<p>When using the attached property <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring::enabled</a> for locale layouts, the visual layout direction of the grid will be mirrored. However, the property <a href="qml-qtquick-gridview.html#layoutDirection-prop">layoutDirection</a> will remain unchanged.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#layoutDirection-prop">GridView::layoutDirection</a> and <a href="qml-qtquick-layoutmirroring.html">LayoutMirroring</a>.</p>
</div></div><!-- @@@effectiveLayoutDirection -->
<br/>
<!-- $$$flow -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="flow-prop"><td class="tblQmlPropNode"><p><a name="flow-prop"></a><span class="name">flow</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the flow of the grid.</p>
<p>Possible values:</p>
<ul>
<li><a href="qml-qtquick-gridview.html">GridView</a>.FlowLeftToRight (default) - Items are laid out from left to right, and the view scrolls vertically</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.FlowTopToBottom - Items are laid out from top to bottom, and the view scrolls horizontally</li>
</ul>
</div></div><!-- @@@flow -->
<br/>
<!-- $$$footer -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="footer-prop"><td class="tblQmlPropNode"><p><a name="footer-prop"></a><span class="name">footer</span> : <span class="type">Component</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the component to use as the footer.</p>
<p>An instance of the footer component is created for each view. The footer is positioned at the end of the view, after any items. The default <a href="qquickitem.html#z-prop">stacking order</a> of the footer is <code>1</code>.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#header-prop">header</a> and <a href="qml-qtquick-gridview.html#footerItem-prop">footerItem</a>.</p>
</div></div><!-- @@@footer -->
<br/>
<!-- $$$footerItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="footerItem-prop"><td class="tblQmlPropNode"><p><a name="footerItem-prop"></a><span class="name">footerItem</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This holds the footer item created from the <a href="qml-qtquick-gridview.html#footer-prop">footer</a> component.</p>
<p>An instance of the footer component is created for each view. The footer is positioned at the end of the view, after any items. The default <a href="qquickitem.html#z-prop">stacking order</a> of the footer is <code>1</code>.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#footer-prop">footer</a> and <a href="qml-qtquick-gridview.html#headerItem-prop">headerItem</a>.</p>
</div></div><!-- @@@footerItem -->
<br/>
<!-- $$$header -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="header-prop"><td class="tblQmlPropNode"><p><a name="header-prop"></a><span class="name">header</span> : <span class="type">Component</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the component to use as the header.</p>
<p>An instance of the header component is created for each view. The header is positioned at the beginning of the view, before any items. The default <a href="qquickitem.html#z-prop">stacking order</a> of the header is <code>1</code>.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#footer-prop">footer</a> and <a href="qml-qtquick-gridview.html#headerItem-prop">headerItem</a>.</p>
</div></div><!-- @@@header -->
<br/>
<!-- $$$headerItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="headerItem-prop"><td class="tblQmlPropNode"><p><a name="headerItem-prop"></a><span class="name">headerItem</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This holds the header item created from the <a href="qml-qtquick-gridview.html#header-prop">header</a> component.</p>
<p>An instance of the header component is created for each view. The header is positioned at the beginning of the view, before any items. The default <a href="qquickitem.html#z-prop">stacking order</a> of the header is <code>1</code>.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#header-prop">header</a> and <a href="qml-qtquick-gridview.html#footerItem-prop">footerItem</a>.</p>
</div></div><!-- @@@headerItem -->
<br/>
<!-- $$$highlight -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="highlight-prop"><td class="tblQmlPropNode"><p><a name="highlight-prop"></a><span class="name">highlight</span> : <span class="type">Component</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the component to use as the highlight.</p>
<p>An instance of the highlight component is created for each view. The geometry of the resulting component instance will be managed by the view so as to stay with the current item, unless the <a href="qml-qtquick-gridview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> property is false. The default <a href="qquickitem.html#z-prop">stacking order</a> of the highlight item is <code>0</code>.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#highlightItem-prop">highlightItem</a> and <a href="qml-qtquick-gridview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a>.</p>
</div></div><!-- @@@highlight -->
<br/>
<!-- $$$highlightFollowsCurrentItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="highlightFollowsCurrentItem-prop"><td class="tblQmlPropNode"><p><a name="highlightFollowsCurrentItem-prop"></a><span class="name">highlightFollowsCurrentItem</span> : <span class="type">bool</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property sets whether the highlight is managed by the view.</p>
<p>If this property is true (the default value), the highlight is moved smoothly to follow the current item. Otherwise, the highlight is not moved by the view, and any movement must be implemented by the highlight.</p>
<p>Here is a highlight with its motion defined by a <a href="qml-qtquick-springanimation.html">SpringAnimation</a> item:</p>
<pre class="qml"><span class="type">Component</span> {
    <span class="name">id</span>: <span class="name">highlight</span>
    <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
        <span class="name">width</span>: <span class="name">view</span>.<span class="name">cellWidth</span>; <span class="name">height</span>: <span class="name">view</span>.<span class="name">cellHeight</span>
        <span class="name">color</span>: <span class="string">&quot;lightsteelblue&quot;</span>; <span class="name">radius</span>: <span class="number">5</span>
        <span class="name">x</span>: <span class="name">view</span>.<span class="name">currentItem</span>.<span class="name">x</span>
        <span class="name">y</span>: <span class="name">view</span>.<span class="name">currentItem</span>.<span class="name">y</span>
        Behavior on <span class="name">x</span> { <span class="type"><a href="qml-qtquick-springanimation.html">SpringAnimation</a></span> { <span class="name">spring</span>: <span class="number">3</span>; <span class="name">damping</span>: <span class="number">0.2</span> } }
        Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-springanimation.html">SpringAnimation</a></span> { <span class="name">spring</span>: <span class="number">3</span>; <span class="name">damping</span>: <span class="number">0.2</span> } }
    }
}

<span class="type"><a href="qml-qtquick-gridview.html">GridView</a></span> {
    <span class="name">id</span>: <span class="name">view</span>
    <span class="name">width</span>: <span class="number">300</span>; <span class="name">height</span>: <span class="number">200</span>
    <span class="name">cellWidth</span>: <span class="number">80</span>; <span class="name">cellHeight</span>: <span class="number">80</span>

    <span class="name">model</span>: <span class="name">ContactModel</span> {}
    <span class="name">delegate</span>: <span class="name">Column</span> {
        <span class="type"><a href="qml-qtquick-image.html">Image</a></span> { <span class="name">source</span>: <span class="name">portrait</span>; <span class="name">anchors</span>.horizontalCenter: <span class="name">parent</span>.<span class="name">horizontalCenter</span> }
        <span class="type"><a href="qml-qtquick-text.html">Text</a></span> { <span class="name">text</span>: <span class="name">name</span>; <span class="name">anchors</span>.horizontalCenter: <span class="name">parent</span>.<span class="name">horizontalCenter</span> }
    }

    <span class="name">highlight</span>: <span class="name">highlight</span>
    <span class="name">highlightFollowsCurrentItem</span>: <span class="number">false</span>
    <span class="name">focus</span>: <span class="number">true</span>
}</pre>
</div></div><!-- @@@highlightFollowsCurrentItem -->
<br/>
<!-- $$$highlightItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="highlightItem-prop"><td class="tblQmlPropNode"><p><a name="highlightItem-prop"></a><span class="name">highlightItem</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This holds the highlight item created from the <a href="qtquick-views-example.html#highlight">highlight</a> component.</p>
<p>The highlightItem is managed by the view unless <a href="qml-qtquick-gridview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> is set to false. The default <a href="qquickitem.html#z-prop">stacking order</a> of the highlight item is <code>0</code>.</p>
<p><b>See also </b><a href="qtquick-views-example.html#highlight">highlight</a> and <a href="qml-qtquick-gridview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a>.</p>
</div></div><!-- @@@highlightItem -->
<br/>
<!-- $$$highlightMoveDuration -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="highlightMoveDuration-prop"><td class="tblQmlPropNode"><p><a name="highlightMoveDuration-prop"></a><span class="name">highlightMoveDuration</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the move animation duration of the highlight delegate.</p>
<p><a href="qml-qtquick-gridview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> must be true for this property to have effect.</p>
<p>The default value for the duration is 150ms.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a>.</p>
</div></div><!-- @@@highlightMoveDuration -->
<br/>
<!-- $$$highlightRangeMode -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="highlightRangeMode-prop"><td class="tblQmlPropNode"><p><a name="highlightRangeMode-prop"></a><span class="name">highlightRangeMode</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>These properties define the preferred range of the highlight (for the current item) within the view. The <code>preferredHighlightBegin</code> value must be less than the <code>preferredHighlightEnd</code> value.</p>
<p>These properties affect the position of the current item when the view is scrolled. For example, if the currently selected item should stay in the middle of the view when it is scrolled, set the <code>preferredHighlightBegin</code> and <code>preferredHighlightEnd</code> values to the top and bottom coordinates of where the middle item would be. If the <code>currentItem</code> is changed programmatically, the view will automatically scroll so that the current item is in the middle of the view. Furthermore, the behavior of the current item index will occur whether or not a highlight exists.</p>
<p>Valid values for <code>highlightRangeMode</code> are:</p>
<ul>
<li><a href="qml-qtquick-gridview.html">GridView</a>.ApplyRange - the view attempts to maintain the highlight within the range. However, the highlight can move outside of the range at the ends of the view or due to mouse interaction.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.StrictlyEnforceRange - the highlight never moves outside of the range. The current item changes if a keyboard or mouse action would cause the highlight to move outside of the range.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.NoHighlightRange - this is the default value.</li>
</ul>
</div></div><!-- @@@highlightRangeMode -->
<br/>
<!-- $$$keyNavigationWraps -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="keyNavigationWraps-prop"><td class="tblQmlPropNode"><p><a name="keyNavigationWraps-prop"></a><span class="name">keyNavigationWraps</span> : <span class="type">bool</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds whether the grid wraps key navigation</p>
<p>If this is true, key navigation that would move the current item selection past one end of the view instead wraps around and moves the selection to the other end of the view.</p>
<p>By default, key navigation is not wrapped.</p>
</div></div><!-- @@@keyNavigationWraps -->
<br/>
<!-- $$$layoutDirection -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="layoutDirection-prop"><td class="tblQmlPropNode"><p><a name="layoutDirection-prop"></a><span class="name">layoutDirection</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the layout direction of the grid.</p>
<p>Possible values:</p>
<ul>
<li>Qt.LeftToRight (default) - Items will be laid out starting in the top, left corner. The flow is dependent on the <a href="qml-qtquick-gridview.html#flow-prop">GridView::flow</a> property.</li>
<li>Qt.RightToLeft - Items will be laid out starting in the top, right corner. The flow is dependent on the <a href="qml-qtquick-gridview.html#flow-prop">GridView::flow</a> property.</li>
</ul>
<p><b>Note</b>: If <a href="qml-qtquick-gridview.html#flow-prop">GridView::flow</a> is set to <a href="qml-qtquick-gridview.html">GridView</a>.FlowLeftToRight, this is not to be confused if GridView::layoutDirection is set to Qt.RightToLeft. The <a href="qml-qtquick-gridview.html">GridView</a>.FlowLeftToRight flow value simply indicates that the flow is horizontal.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#effectiveLayoutDirection-prop">GridView::effectiveLayoutDirection</a> and <a href="qml-qtquick-gridview.html#verticalLayoutDirection-prop">GridView::verticalLayoutDirection</a>.</p>
</div></div><!-- @@@layoutDirection -->
<br/>
<!-- $$$model -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="model-prop"><td class="tblQmlPropNode"><p><a name="model-prop"></a><span class="name">model</span> : <span class="type"><a href="qml-qtquick-gridview.html#model-prop">model</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the model providing data for the grid.</p>
<p>The model provides the set of data that is used to create the items in the view. Models can be created directly in QML using <a href="qtquick-modelviewsdata-modelview.html#listmodel">ListModel</a>, <a href="qtquick-modelviewsdata-modelview.html#xmllistmodel">XmlListModel</a> or <a href="qtquick-modelviewsdata-modelview.html#visualitemmodel">VisualItemModel</a>, or provided by C++ model classes. If a C++ model class is used, it must be a subclass of <a href="qtquick-modelviewsdata-cppmodels.html#qabstractitemmodel">QAbstractItemModel</a> or a simple list.</p>
<p><b>See also </b><a href="qtquick-modelviewsdata-modelview.html#qml-data-models">Data Models</a>.</p>
</div></div><!-- @@@model -->
<br/>
<!-- $$$move -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="move-prop"><td class="tblQmlPropNode"><p><a name="move-prop"></a><span class="name">move</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the transition to apply to items in the view that are being moved due to a move operation in the view's <a href="qml-qtquick-gridview.html#model-prop">model</a>.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">GridView {
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    move: Transition {
        NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
    }
}</pre>
<p>Whenever the <a href="qml-qtquick-gridview.html#model-prop">model</a> performs a move operation to move a particular set of indexes, the respective items in the view will be animated to their new positions in the view over one second. The transition only applies to the items that are the subject of the move operation in the model; it does not apply to items below them that are displaced by the move operation. To animate the displaced items, set the <a href="qml-qtquick-gridview.html#displaced-prop">displaced</a> or <a href="qml-qtquick-gridview.html#moveDisplaced-prop">moveDisplaced</a> properties.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#moveDisplaced-prop">moveDisplaced</a> and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@move -->
<br/>
<!-- $$$moveDisplaced -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="moveDisplaced-prop"><td class="tblQmlPropNode"><p><a name="moveDisplaced-prop"></a><span class="name">moveDisplaced</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the transition to apply to items that are displaced by a move operation in the view's <a href="qml-qtquick-gridview.html#model-prop">model</a>.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">GridView {
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    moveDisplaced: Transition {
        NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
    }
}</pre>
<p>Whenever the <a href="qml-qtquick-gridview.html#model-prop">model</a> performs a move operation to move a particular set of indexes, the items between the source and destination indexes of the move operation are displaced, causing them to move upwards or downwards (or sideways, if horizontally orientated) within the view. As this displacement occurs, the items' movement to their new x,y positions within the view will be animated by a <a href="qml-qtquick-numberanimation.html">NumberAnimation</a> over one second, as specified. This transition is not applied to the items that are the actual subjects of the move operation; to animate the moved items, set the <a href="qml-qtquick-gridview.html#move-prop">move</a> property.</p>
<p>If an item is displaced by multiple types of operations at the same time, it is not defined as to whether the <a href="qml-qtquick-gridview.html#addDisplaced-prop">addDisplaced</a>, moveDisplaced or <a href="qml-qtquick-gridview.html#removeDisplaced-prop">removeDisplaced</a> transition will be applied. Additionally, if it is not necessary to specify different transitions depending on whether an item is displaced by an add, move or remove operation, consider setting the <a href="qml-qtquick-gridview.html#displaced-prop">displaced</a> property instead.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#displaced-prop">displaced</a>, <a href="qml-qtquick-gridview.html#move-prop">move</a>, and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@moveDisplaced -->
<br/>
<!-- $$$populate -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="populate-prop"><td class="tblQmlPropNode"><p><a name="populate-prop"></a><span class="name">populate</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the transition to apply to the items that are initially created for a view.</p>
<p>It is applied to all items that are created when:</p>
<ul>
<li>The view is first created</li>
<li>The view's <a href="qml-qtquick-gridview.html#model-prop">model</a> changes</li>
<li>The view's <a href="qml-qtquick-gridview.html#model-prop">model</a> is reset, if the model is a <a href="qtquick-modelviewsdata-cppmodels.html#qabstractitemmodel">QAbstractItemModel</a> subclass</li>
</ul>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">GridView {
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    populate: Transition {
        NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
    }
}</pre>
<p>When the view is initialized, the view will create all the necessary items for the view, then animate them to their correct positions within the view over one second.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#add-prop">add</a> and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@populate -->
<br/>
<!-- $$$preferredHighlightBegin -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="preferredHighlightBegin-prop"><td class="tblQmlPropNode"><p><a name="preferredHighlightBegin-prop"></a><span class="name">preferredHighlightBegin</span> : <span class="type">real</span></p></td></tr></table></div></div><div class="qmldoc"><p>These properties define the preferred range of the highlight (for the current item) within the view. The <code>preferredHighlightBegin</code> value must be less than the <code>preferredHighlightEnd</code> value.</p>
<p>These properties affect the position of the current item when the view is scrolled. For example, if the currently selected item should stay in the middle of the view when it is scrolled, set the <code>preferredHighlightBegin</code> and <code>preferredHighlightEnd</code> values to the top and bottom coordinates of where the middle item would be. If the <code>currentItem</code> is changed programmatically, the view will automatically scroll so that the current item is in the middle of the view. Furthermore, the behavior of the current item index will occur whether or not a highlight exists.</p>
<p>Valid values for <code>highlightRangeMode</code> are:</p>
<ul>
<li><a href="qml-qtquick-gridview.html">GridView</a>.ApplyRange - the view attempts to maintain the highlight within the range. However, the highlight can move outside of the range at the ends of the view or due to mouse interaction.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.StrictlyEnforceRange - the highlight never moves outside of the range. The current item changes if a keyboard or mouse action would cause the highlight to move outside of the range.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.NoHighlightRange - this is the default value.</li>
</ul>
</div></div><!-- @@@preferredHighlightBegin -->
<br/>
<!-- $$$preferredHighlightEnd -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="preferredHighlightEnd-prop"><td class="tblQmlPropNode"><p><a name="preferredHighlightEnd-prop"></a><span class="name">preferredHighlightEnd</span> : <span class="type">real</span></p></td></tr></table></div></div><div class="qmldoc"><p>These properties define the preferred range of the highlight (for the current item) within the view. The <code>preferredHighlightBegin</code> value must be less than the <code>preferredHighlightEnd</code> value.</p>
<p>These properties affect the position of the current item when the view is scrolled. For example, if the currently selected item should stay in the middle of the view when it is scrolled, set the <code>preferredHighlightBegin</code> and <code>preferredHighlightEnd</code> values to the top and bottom coordinates of where the middle item would be. If the <code>currentItem</code> is changed programmatically, the view will automatically scroll so that the current item is in the middle of the view. Furthermore, the behavior of the current item index will occur whether or not a highlight exists.</p>
<p>Valid values for <code>highlightRangeMode</code> are:</p>
<ul>
<li><a href="qml-qtquick-gridview.html">GridView</a>.ApplyRange - the view attempts to maintain the highlight within the range. However, the highlight can move outside of the range at the ends of the view or due to mouse interaction.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.StrictlyEnforceRange - the highlight never moves outside of the range. The current item changes if a keyboard or mouse action would cause the highlight to move outside of the range.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.NoHighlightRange - this is the default value.</li>
</ul>
</div></div><!-- @@@preferredHighlightEnd -->
<br/>
<!-- $$$remove -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="remove-prop"><td class="tblQmlPropNode"><p><a name="remove-prop"></a><span class="name">remove</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the transition to apply to items that are removed from the view.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">GridView {
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    remove: Transition {
        ParallelAnimation {
            NumberAnimation { property: <span class="string">&quot;opacity&quot;</span>; to: <span class="number">0</span>; duration: <span class="number">1000</span> }
            NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; to: <span class="number">100</span>; duration: <span class="number">1000</span> }
        }
    }
}</pre>
<p>Whenever an item is removed from the above view, the item will be animated to the position (100,100) over one second, and in parallel will also change its opacity to 0. The transition only applies to the items that are removed from the view; it does not apply to the items below them that are displaced by the removal of the items. To animate the displaced items, set the <a href="qml-qtquick-gridview.html#displaced-prop">displaced</a> or <a href="qml-qtquick-gridview.html#removeDisplaced-prop">removeDisplaced</a> properties.</p>
<p>Note that by the time the transition is applied, the item has already been removed from the model; any references to the model data for the removed index will not be valid.</p>
<p>Additionally, if the <a href="qml-qtquick-gridview.html#delayRemove-attached-prop">delayRemove</a> attached property has been set for a delegate item, the remove transition will not be applied until <a href="qml-qtquick-gridview.html#delayRemove-attached-prop">delayRemove</a> becomes false again.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#removeDisplaced-prop">removeDisplaced</a> and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@remove -->
<br/>
<!-- $$$removeDisplaced -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="removeDisplaced-prop"><td class="tblQmlPropNode"><p><a name="removeDisplaced-prop"></a><span class="name">removeDisplaced</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the transition to apply to items in the view that are displaced by the removal of other items in the view.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">GridView {
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    removeDisplaced: Transition {
        NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
    }
}</pre>
<p>Whenever an item is removed from the above view, all items beneath it are displaced, causing them to move upwards (or sideways, if horizontally orientated) within the view. As this displacement occurs, the items' movement to their new x,y positions within the view will be animated by a <a href="qml-qtquick-numberanimation.html">NumberAnimation</a> over one second, as specified. This transition is not applied to the item that has actually been removed from the view; to animate the removed items, set the <a href="qml-qtquick-gridview.html#remove-prop">remove</a> property.</p>
<p>If an item is displaced by multiple types of operations at the same time, it is not defined as to whether the <a href="qml-qtquick-gridview.html#addDisplaced-prop">addDisplaced</a>, <a href="qml-qtquick-gridview.html#moveDisplaced-prop">moveDisplaced</a> or removeDisplaced transition will be applied. Additionally, if it is not necessary to specify different transitions depending on whether an item is displaced by an add, move or remove operation, consider setting the <a href="qml-qtquick-gridview.html#displaced-prop">displaced</a> property instead.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-gridview.html#displaced-prop">displaced</a>, <a href="qml-qtquick-gridview.html#remove-prop">remove</a>, and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@removeDisplaced -->
<br/>
<!-- $$$snapMode -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="snapMode-prop"><td class="tblQmlPropNode"><p><a name="snapMode-prop"></a><span class="name">snapMode</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property determines how the view scrolling will settle following a drag or flick. The possible values are:</p>
<ul>
<li><a href="qml-qtquick-gridview.html">GridView</a>.NoSnap (default) - the view stops anywhere within the visible area.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.SnapToRow - the view settles with a row (or column for <code>GridView.FlowTopToBottom</code> flow) aligned with the start of the view.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.SnapOneRow - the view will settle no more than one row (or column for <code>GridView.FlowTopToBottom</code> flow) away from the first visible row at the time the mouse button is released. This mode is particularly useful for moving one page at a time.</li>
</ul>
</div></div><!-- @@@snapMode -->
<br/>
<!-- $$$verticalLayoutDirection -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="verticalLayoutDirection-prop"><td class="tblQmlPropNode"><p><a name="verticalLayoutDirection-prop"></a><span class="name">verticalLayoutDirection</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property holds the vertical layout direction of the grid.</p>
<p>Possible values:</p>
<ul>
<li><a href="qml-qtquick-gridview.html">GridView</a>.TopToBottom (default) - Items are laid out from the top of the view down to the bottom of the view.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.BottomToTop - Items are laid out from the bottom of the view up to the top of the view.</li>
</ul>
<p><b>See also </b><a href="qml-qtquick-gridview.html#layoutDirection-prop">GridView::layoutDirection</a>.</p>
</div></div><!-- @@@verticalLayoutDirection -->
<br/>
<h2>Attached Property Documentation</h2>
<!-- $$$delayRemove -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="delayRemove-attached-prop"><td class="tblQmlPropNode"><p><a name="delayRemove-attached-prop"></a><span class="name">GridView.delayRemove</span> : <span class="type">bool</span></p></td></tr></table></div></div><div class="qmldoc"><p>This attached property holds whether the delegate may be destroyed. It is attached to each instance of the delegate. The default value is false.</p>
<p>It is sometimes necessary to delay the destruction of an item until an animation completes. The example delegate below ensures that the animation completes before the item is removed from the list.</p>
<pre class="qml"><span class="type">Component</span> {
    <span class="name">id</span>: <span class="name">delegate</span>
    <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
        <span class="name">GridView</span>.onRemove: <span class="name">SequentialAnimation</span> {
            <span class="type"><a href="qml-qtquick-propertyaction.html">PropertyAction</a></span> { <span class="name">target</span>: <span class="name">wrapper</span>; <span class="name">property</span>: <span class="string">&quot;GridView.delayRemove&quot;</span>; <span class="name">value</span>: <span class="number">true</span> }
            <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">wrapper</span>; <span class="name">property</span>: <span class="string">&quot;scale&quot;</span>; <span class="name">to</span>: <span class="number">0</span>; <span class="name">duration</span>: <span class="number">250</span>; <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">InOutQuad</span> }
            <span class="type"><a href="qml-qtquick-propertyaction.html">PropertyAction</a></span> { <span class="name">target</span>: <span class="name">wrapper</span>; <span class="name">property</span>: <span class="string">&quot;GridView.delayRemove&quot;</span>; <span class="name">value</span>: <span class="number">false</span> }
        }
    }
}</pre>
<p>If a <a href="qml-qtquick-gridview.html#remove-prop">remove</a> transition has been specified, it will not be applied until delayRemove is returned to <code>false</code>.</p>
</div></div><!-- @@@delayRemove -->
<br/>
<!-- $$$isCurrentItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="isCurrentItem-attached-prop"><td class="tblQmlPropNode"><p><a name="isCurrentItem-attached-prop"></a><span class="name">GridView.isCurrentItem</span> : <span class="type">bool</span></p></td></tr></table></div></div><div class="qmldoc"><p>This attached property is true if this delegate is the current item; otherwise false.</p>
<p>It is attached to each instance of the delegate.</p>
</div></div><!-- @@@isCurrentItem -->
<br/>
<!-- $$$view -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="view-attached-prop"><td class="tblQmlPropNode"><p><a name="view-attached-prop"></a><span class="name">GridView.view</span> : <span class="type"><a href="qml-qtquick-gridview.html">GridView</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>This attached property holds the view that manages this delegate instance.</p>
<p>It is attached to each instance of the delegate and also to the header, the footer and the highlight delegates.</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-gridview.html">GridView</a></span> {
    <span class="name">width</span>: <span class="number">300</span>; <span class="name">height</span>: <span class="number">200</span>
    <span class="name">cellWidth</span>: <span class="number">80</span>; <span class="name">cellHeight</span>: <span class="number">80</span>

    <span class="type">Component</span> {
        <span class="name">id</span>: <span class="name">contactsDelegate</span>
        <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
            <span class="name">id</span>: <span class="name">wrapper</span>
            <span class="name">width</span>: <span class="number">80</span>
            <span class="name">height</span>: <span class="number">80</span>
            <span class="name">color</span>: <span class="name">GridView</span>.<span class="name">isCurrentItem</span> ? <span class="string">&quot;black&quot;</span> : <span class="string">&quot;red&quot;</span>
            <span class="type"><a href="qml-qtquick-text.html">Text</a></span> {
                <span class="name">id</span>: <span class="name">contactInfo</span>
                <span class="name">text</span>: <span class="name">name</span> <span class="operator">+</span> <span class="string">&quot;: &quot;</span> <span class="operator">+</span> <span class="name">number</span>
                <span class="name">color</span>: <span class="name">wrapper</span>.<span class="name">GridView</span>.<span class="name">isCurrentItem</span> ? <span class="string">&quot;red&quot;</span> : <span class="string">&quot;black&quot;</span>
            }
        }
    }

    <span class="name">model</span>: <span class="name">ContactModel</span> {}
    <span class="name">delegate</span>: <span class="name">contactsDelegate</span>
    <span class="name">focus</span>: <span class="number">true</span>
}</pre>
</div></div><!-- @@@view -->
<br/>
<h2>Attached Signal Documentation</h2>
<!-- $$$add -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="add-signal"><td class="tblQmlFuncNode"><p><a name="add-signal"></a><span class="name">add</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>This attached signal is emitted immediately after an item is added to the view.</p>
<p>The corresponding handler is <code>onAdd</code>.</p>
</div></div><!-- @@@add -->
<br/>
<!-- $$$remove -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="remove-signal"><td class="tblQmlFuncNode"><p><a name="remove-signal"></a><span class="name">remove</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>This attached signal is emitted immediately before an item is removed from the view.</p>
<p>If a <a href="qml-qtquick-gridview.html#remove-prop">remove</a> transition has been specified, it is applied after this signal is handled, providing that <a href="qml-qtquick-gridview.html#delayRemove-attached-prop">delayRemove</a> is false.</p>
<p>The corresponding handler is <code>onRemove</code>.</p>
</div></div><!-- @@@remove -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$forceLayout -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="forceLayout-method"><td class="tblQmlFuncNode"><p><a name="forceLayout-method"></a><span class="name">forceLayout</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>Responding to changes in the model is usually batched to happen only once per frame. This means that inside script blocks it is possible for the underlying model to have changed, but the <a href="qml-qtquick-gridview.html">GridView</a> has not caught up yet.</p>
<p>This method forces the <a href="qml-qtquick-gridview.html">GridView</a> to immediately respond to any outstanding changes in the model.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
<p>This QML method was introduced in  Qt 5.1.</p>
</div></div><!-- @@@forceLayout -->
<br/>
<!-- $$$indexAt -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="indexAt-method"><td class="tblQmlFuncNode"><p><a name="indexAt-method"></a><span class="type">int</span> <span class="name">indexAt</span>(<span class="type">int</span><i> x</i>, <span class="type">int</span><i> y</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Returns the index of the visible item containing the point <i>x</i>, <i>y</i> in content coordinates. If there is no item at the point specified, or the item is not visible -1 is returned.</p>
<p>If the item is outside the visible area, -1 is returned, regardless of whether an item will exist at that point when scrolled into view.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
</div></div><!-- @@@indexAt -->
<br/>
<!-- $$$itemAt -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="itemAt-method"><td class="tblQmlFuncNode"><p><a name="itemAt-method"></a><span class="type"><a href="qml-qtquick-item.html">Item</a></span> <span class="name">itemAt</span>(<span class="type">int</span><i> x</i>, <span class="type">int</span><i> y</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Returns the visible item containing the point <i>x</i>, <i>y</i> in content coordinates. If there is no item at the point specified, or the item is not visible null is returned.</p>
<p>If the item is outside the visible area, null is returned, regardless of whether an item will exist at that point when scrolled into view.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
</div></div><!-- @@@itemAt -->
<br/>
<!-- $$$moveCurrentIndexDown -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="moveCurrentIndexDown-method"><td class="tblQmlFuncNode"><p><a name="moveCurrentIndexDown-method"></a><span class="name">moveCurrentIndexDown</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>Move the <a href="qml-qtquick-gridview.html#currentIndex-prop">currentIndex</a> down one item in the view. The current index will wrap if <a href="qml-qtquick-gridview.html#keyNavigationWraps-prop">keyNavigationWraps</a> is true and it is currently at the end. This method has no effect if the <a href="qml-qtquick-gridview.html#count-prop">count</a> is zero.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
</div></div><!-- @@@moveCurrentIndexDown -->
<br/>
<!-- $$$moveCurrentIndexLeft -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="moveCurrentIndexLeft-method"><td class="tblQmlFuncNode"><p><a name="moveCurrentIndexLeft-method"></a><span class="name">moveCurrentIndexLeft</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>Move the <a href="qml-qtquick-gridview.html#currentIndex-prop">currentIndex</a> left one item in the view. The current index will wrap if <a href="qml-qtquick-gridview.html#keyNavigationWraps-prop">keyNavigationWraps</a> is true and it is currently at the end. This method has no effect if the <a href="qml-qtquick-gridview.html#count-prop">count</a> is zero.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
</div></div><!-- @@@moveCurrentIndexLeft -->
<br/>
<!-- $$$moveCurrentIndexRight -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="moveCurrentIndexRight-method"><td class="tblQmlFuncNode"><p><a name="moveCurrentIndexRight-method"></a><span class="name">moveCurrentIndexRight</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>Move the <a href="qml-qtquick-gridview.html#currentIndex-prop">currentIndex</a> right one item in the view. The current index will wrap if <a href="qml-qtquick-gridview.html#keyNavigationWraps-prop">keyNavigationWraps</a> is true and it is currently at the end. This method has no effect if the <a href="qml-qtquick-gridview.html#count-prop">count</a> is zero.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
</div></div><!-- @@@moveCurrentIndexRight -->
<br/>
<!-- $$$moveCurrentIndexUp -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="moveCurrentIndexUp-method"><td class="tblQmlFuncNode"><p><a name="moveCurrentIndexUp-method"></a><span class="name">moveCurrentIndexUp</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>Move the <a href="qml-qtquick-gridview.html#currentIndex-prop">currentIndex</a> up one item in the view. The current index will wrap if <a href="qml-qtquick-gridview.html#keyNavigationWraps-prop">keyNavigationWraps</a> is true and it is currently at the end. This method has no effect if the <a href="qml-qtquick-gridview.html#count-prop">count</a> is zero.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
</div></div><!-- @@@moveCurrentIndexUp -->
<br/>
<!-- $$$positionViewAtBeginning -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="positionViewAtBeginning-method"><td class="tblQmlFuncNode"><p><a name="positionViewAtBeginning-method"></a><span class="name">positionViewAtBeginning</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>Positions the view at the beginning or end, taking into account any header or footer.</p>
<p>It is not recommended to use <a href="qml-qtquick-flickable.html#contentX-prop">contentX</a> or <a href="qml-qtquick-flickable.html#contentY-prop">contentY</a> to position the view at a particular index. This is unreliable since removing items from the start of the list does not cause all other items to be repositioned, and because the actual start of the view can vary based on the size of the delegates.</p>
<p><b>Note</b>: methods should only be called after the Component has completed. To position the view at startup, this method should be called by Component.onCompleted. For example, to position the view at the end on startup:</p>
<pre class="cpp">Component<span class="operator">.</span>onCompleted: <a href="qml-qtquick-gridview.html#positionViewAtEnd-method">positionViewAtEnd</a>()</pre>
</div></div><!-- @@@positionViewAtBeginning -->
<br/>
<!-- $$$positionViewAtEnd -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="positionViewAtEnd-method"><td class="tblQmlFuncNode"><p><a name="positionViewAtEnd-method"></a><span class="name">positionViewAtEnd</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>Positions the view at the beginning or end, taking into account any header or footer.</p>
<p>It is not recommended to use <a href="qml-qtquick-flickable.html#contentX-prop">contentX</a> or <a href="qml-qtquick-flickable.html#contentY-prop">contentY</a> to position the view at a particular index. This is unreliable since removing items from the start of the list does not cause all other items to be repositioned, and because the actual start of the view can vary based on the size of the delegates.</p>
<p><b>Note</b>: methods should only be called after the Component has completed. To position the view at startup, this method should be called by Component.onCompleted. For example, to position the view at the end on startup:</p>
<pre class="cpp">Component<span class="operator">.</span>onCompleted: positionViewAtEnd()</pre>
</div></div><!-- @@@positionViewAtEnd -->
<br/>
<!-- $$$positionViewAtIndex -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="positionViewAtIndex-method"><td class="tblQmlFuncNode"><p><a name="positionViewAtIndex-method"></a><span class="name">positionViewAtIndex</span>(<span class="type">int</span><i> index</i>, <span class="type">PositionMode</span><i> mode</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Positions the view such that the <i>index</i> is at the position specified by <i>mode</i>:</p>
<ul>
<li><a href="qml-qtquick-gridview.html">GridView</a>.Beginning - position item at the top (or left for <code>GridView.FlowTopToBottom</code> flow) of the view.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.Center - position item in the center of the view.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.End - position item at bottom (or right for horizontal orientation) of the view.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.Visible - if any part of the item is visible then take no action, otherwise bring the item into view.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.Contain - ensure the entire item is visible. If the item is larger than the view the item is positioned at the top (or left for <code>GridView.FlowTopToBottom</code> flow) of the view.</li>
<li><a href="qml-qtquick-gridview.html">GridView</a>.SnapPosition - position the item at <a href="qml-qtquick-gridview.html#preferredHighlightBegin-prop">preferredHighlightBegin</a>. This mode is only valid if <a href="qml-qtquick-gridview.html#highlightRangeMode-prop">highlightRangeMode</a> is StrictlyEnforceRange or snapping is enabled via <a href="qml-qtquick-gridview.html#snapMode-prop">snapMode</a>.</li>
</ul>
<p>If positioning the view at the index would cause empty space to be displayed at the beginning or end of the view, the view will be positioned at the boundary.</p>
<p>It is not recommended to use <a href="qml-qtquick-flickable.html#contentX-prop">contentX</a> or <a href="qml-qtquick-flickable.html#contentY-prop">contentY</a> to position the view at a particular index. This is unreliable since removing items from the start of the view does not cause all other items to be repositioned. The correct way to bring an item into view is with <code>positionViewAtIndex</code>.</p>
<p><b>Note</b>: methods should only be called after the Component has completed. To position the view at startup, this method should be called by Component.onCompleted. For example, to position the view at the end:</p>
<pre class="cpp">Component<span class="operator">.</span>onCompleted: positionViewAtIndex(count <span class="operator">-</span> <span class="number">1</span><span class="operator">,</span> GridView<span class="operator">.</span>Beginning)</pre>
</div></div><!-- @@@positionViewAtIndex -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>