This file is indexed.

/usr/share/qt5/doc/qtquickcontrols2/qtquickcontrols2-customize.html is in qtquickcontrols2-5-doc-html 5.9.5-0ubuntu2.

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
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qtquickcontrols2-customize.qdoc -->
  <title>Customizing Qt Quick Controls 2 | Qt Quick Controls 2 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtquickcontrols2-index.html">Qt Quick Controls 2</a></td><td >Customizing Qt Quick Controls 2</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.5 Reference Documentation</td>
        </tr></table>
      </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="#customizing-a-control">Customizing a Control</a></li>
<li class="level1"><a href="#creating-a-custom-style">Creating a Custom Style</a></li>
<li class="level2"><a href="#definition-of-a-style">Definition of a Style</a></li>
<li class="level2"><a href="#style-specific-c-extensions">Style-specific C++ Extensions</a></li>
<li class="level1"><a href="#customization-reference">Customization Reference</a></li>
<li class="level2"><a href="#customizing-applicationwindow">Customizing ApplicationWindow</a></li>
<li class="level2"><a href="#customizing-busyindicator">Customizing BusyIndicator</a></li>
<li class="level2"><a href="#customizing-button">Customizing Button</a></li>
<li class="level2"><a href="#customizing-checkbox">Customizing CheckBox</a></li>
<li class="level2"><a href="#customizing-checkdelegate">Customizing CheckDelegate</a></li>
<li class="level2"><a href="#customizing-combobox">Customizing ComboBox</a></li>
<li class="level2"><a href="#customizing-delaybutton">Customizing DelayButton</a></li>
<li class="level2"><a href="#customizing-dial">Customizing Dial</a></li>
<li class="level2"><a href="#customizing-drawer">Customizing Drawer</a></li>
<li class="level2"><a href="#customizing-frame">Customizing Frame</a></li>
<li class="level2"><a href="#customizing-groupbox">Customizing GroupBox</a></li>
<li class="level2"><a href="#customizing-itemdelegate">Customizing ItemDelegate</a></li>
<li class="level2"><a href="#customizing-label">Customizing Label</a></li>
<li class="level2"><a href="#customizing-menu">Customizing Menu</a></li>
<li class="level2"><a href="#customizing-menuitem">Customizing MenuItem</a></li>
<li class="level2"><a href="#customizing-menuseparator">Customizing MenuSeparator</a></li>
<li class="level2"><a href="#customizing-pageindicator">Customizing PageIndicator</a></li>
<li class="level2"><a href="#customizing-pane">Customizing Pane</a></li>
<li class="level2"><a href="#customizing-popup">Customizing Popup</a></li>
<li class="level2"><a href="#customizing-progressbar">Customizing ProgressBar</a></li>
<li class="level2"><a href="#customizing-radiobutton">Customizing RadioButton</a></li>
<li class="level2"><a href="#customizing-radiodelegate">Customizing RadioDelegate</a></li>
<li class="level2"><a href="#customizing-rangeslider">Customizing RangeSlider</a></li>
<li class="level2"><a href="#customizing-roundbutton">Customizing RoundButton</a></li>
<li class="level2"><a href="#customizing-scrollbar">Customizing ScrollBar</a></li>
<li class="level2"><a href="#customizing-scrollindicator">Customizing ScrollIndicator</a></li>
<li class="level2"><a href="#customizing-scrollview">Customizing ScrollView</a></li>
<li class="level2"><a href="#customizing-slider">Customizing Slider</a></li>
<li class="level2"><a href="#customizing-spinbox">Customizing SpinBox</a></li>
<li class="level2"><a href="#customizing-stackview">Customizing StackView</a></li>
<li class="level2"><a href="#customizing-swipedelegate">Customizing SwipeDelegate</a></li>
<li class="level2"><a href="#customizing-swipeview">Customizing SwipeView</a></li>
<li class="level2"><a href="#customizing-switch">Customizing Switch</a></li>
<li class="level2"><a href="#customizing-switchdelegate">Customizing SwitchDelegate</a></li>
<li class="level2"><a href="#customizing-tabbar">Customizing TabBar</a></li>
<li class="level2"><a href="#customizing-tabbutton">Customizing TabButton</a></li>
<li class="level2"><a href="#customizing-textarea">Customizing TextArea</a></li>
<li class="level2"><a href="#customizing-textfield">Customizing TextField</a></li>
<li class="level2"><a href="#customizing-toolbar">Customizing ToolBar</a></li>
<li class="level2"><a href="#customizing-toolbutton">Customizing ToolButton</a></li>
<li class="level2"><a href="#customizing-toolseparator">Customizing ToolSeparator</a></li>
<li class="level2"><a href="#customizing-tooltip">Customizing ToolTip</a></li>
<li class="level2"><a href="#customizing-tumbler">Customizing Tumbler</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Customizing Qt Quick Controls 2</h1>
<span class="subtitle"></span>
<!-- $$$qtquickcontrols2-customize.html-description -->
<div class="descr"> <a name="details"></a>
<p>Qt Quick Controls 2 consist of a hierarchy (tree) of items. In order to provide a custom look and feel, the default QML implementation of each item can be replaced with a custom one.</p>
<a name="customizing-a-control"></a>
<h2 id="customizing-a-control">Customizing a Control</h2>
<p>Sometimes you'll want to create a &quot;one-off&quot; look for a specific part of your UI, and use a complete style everywhere else. Perhaps you're happy with the style you're using, but there's a certain button that has some special significance.</p>
<p>The first way to create this button is to simply define it in-place, wherever it is needed. For example, perhaps you're not satisfied with the default style's Button having square corners. To make them rounded, you can override the <a href="qml-qtquick-controls2-control.html#background-prop">background</a> item and set the radius property of Rectangle:</p>
<pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-applicationwindow.html">ApplicationWindow</a></span> {
      <span class="name">width</span>: <span class="number">400</span>
      <span class="name">height</span>: <span class="number">400</span>
      <span class="name">visible</span>: <span class="number">true</span>

      <span class="type"><a href="qml-qtquick-controls2-button.html">Button</a></span> {
          <span class="name">id</span>: <span class="name">button</span>
          <span class="name">text</span>: <span class="string">&quot;A Special Button&quot;</span>
          <span class="name">background</span>: <span class="name">Rectangle</span> {
              <span class="name">implicitWidth</span>: <span class="number">100</span>
              <span class="name">implicitHeight</span>: <span class="number">40</span>
              <span class="name">color</span>: <span class="name">button</span>.<span class="name">down</span> ? <span class="string">&quot;#d6d6d6&quot;</span> : <span class="string">&quot;#f6f6f6&quot;</span>
              <span class="name">border</span>.color: <span class="string">&quot;#26282a&quot;</span>
              <span class="name">border</span>.width: <span class="number">1</span>
              <span class="name">radius</span>: <span class="number">4</span>
          }
      }
  }

</pre>
<p>The second way to create the button is good if you plan to use your rounded button in several places. It involves moving the code into its own QML file within your project.</p>
<p>For this approach, we'll copy the background code from the default style's <code>Button.qml</code>. This file can be found in the following path in your Qt installation:</p>
<p><code>$QTDIR/qml/QtQuick/Controls.2/Button.qml</code></p>
<p>After doing that, we'll simply add the following line:</p>
<pre class="cpp">

  radius: <span class="number">4</span>

</pre>
<p>To avoid confusion with the controls in the module itself, we'll call the file <code>MyButton.qml</code>. To use the control in your application, refer to it by its filename:</p>
<pre class="qml">

  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-applicationwindow.html">ApplicationWindow</a></span> {
      <span class="type">MyButton</span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;A Special Button&quot;</span>)
      }
  }

</pre>
<p>The third way to create the button is a bit more structured, both in terms of where the file sits in the file system and how it is used in QML. First, copy an existing file as you did above, but this time, put it into a subfolder in your project named (for example) <code>controls</code>. To use the control, first import the folder into a namespace:</p>
<pre class="qml">

  import QtQuick.Controls 2.1
  import &quot;controls&quot; as MyControls

  <span class="type"><a href="qml-qtquick-controls2-applicationwindow.html">ApplicationWindow</a></span> {
      <span class="type">MyControls</span>.Button {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;A Special Button&quot;</span>)
      }
  }

</pre>
<p>As you now have the <code>MyControls</code> namespace, you can name the controls after their actual counterparts in the Qt Quick Controls 2 module. You can repeat this process for any control that you wish to add.</p>
<p>An added benefit of these three methods is that it's not necessary to implement the template from scratch.</p>
<a name="creating-a-custom-style"></a>
<h2 id="creating-a-custom-style">Creating a Custom Style</h2>
<p>There are several ways to go about creating your own styles. Below, we'll explain the various approaches.</p>
<a name="definition-of-a-style"></a>
<h3 >Definition of a Style</h3>
<p>In Qt Quick Controls 2, a style is essentially an interchangeable set of QML files within a single directory. There are three requirements for a style to be <a href="qtquickcontrols2-styles.html#using-styles-in-qt-quick-controls-2">usable</a>:</p>
<ul>
<li>At least one QML file whose name matches a control (for example, <code>Button.qml</code>) must exist.</li>
<li>Each QML file must contain the relevant type from the <a href="qtquicktemplates2-index.html">QtQuick.Templates</a> import as the root item. For example, Button.qml must contain a Button template as its root item.<p>If we instead used the corresponding type from the <a href="qtquickcontrols2-index.html">QtQuick.Controls</a> import as we did in the previous section, it would not work: the control we were defining would try to derive from itself.</p>
</li>
<li>The files must be in a directory in the filesystem or in the <a href="../qtcore/resources.html">resource system</a>.<p>For example, these are all valid paths to a style:</p>
<ul>
<li><code>./myapp -style /home/absolute/path/to/my/style</code></li>
<li><code>./myapp -style :/mystyle</code></li>
<li><code>./myapp -style relative/path/to/my/style</code></li>
<li><code>./myapp -style MyStyle</code></li>
</ul>
<p>The third and fourth paths will be looked up within the QML engine's import path list. This is the same as what happens when you pass <code>Material</code> as the style, for example.</p>
</li>
</ul>
<p>By default, the styling system uses the Default style as a fallback for controls that aren't implemented. To customize or extend any other built-in style, it is possible to specify a different fallback style using <a href="qquickstyle.html">QQuickStyle</a>.</p>
<p>What this means is that you can implement as many controls as you like for your custom style, and place them almost anywhere. It also allows users to create their own styles for your application.</p>
<a name="style-specific-c-extensions"></a>
<h3 >Style-specific C++ Extensions</h3>
<p>Sometimes you may need to use C++ to extend your custom style. There are two ways to expose such types to QML:</p>
<ul>
<li>If the style that uses the type is the only style used by an application, it's enough to register it with the QML engine via <a href="../qtqml/qqmlengine.html#qmlRegisterType">qmlRegisterType</a>():<pre class="cpp">

  qmlRegisterType<span class="operator">&lt;</span>ACoolCppItem<span class="operator">&gt;</span>(<span class="string">&quot;MyApp&quot;</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="string">&quot;ACoolItem&quot;</span>);

</pre>
<p>See <a href="qtquickcontrols2-gettingstarted.html#using-c-data-from-qml">Using C++ Data From QML</a> for more information about this.</p>
</li>
<li>If the style that uses the type is one of many styles used by an application, it may be better to only register it when necessary. This is the point at which it would make sense to implement your own <a href="../qtqml/qtqml-modules-cppplugins.html">QML plugin</a>.<p>Using a plugin as part of your style is not that much different from using a set of QML files. The only difference is that the plugin and its <code>qmldir</code> file must be present in the same directory as the QML files.</p>
</li>
</ul>
<a name="attached-properties"></a>
<h4 >Attached properties</h4>
<p>It is common for a style to have certain properties or attributes that apply to all controls. <a href="../qtqml/qtqml-syntax-objectattributes.html#attached-properties-and-attached-signal-handlers">Attached properties</a> are a great way of extending an item in QML without having to modify any existing C++ belonging to that item. For example, both the <a href="qtquickcontrols2-material.html">Material</a> and <a href="qtquickcontrols2-universal.html">Universal</a> styles have an attached theme property that controls whether an item and its children will be rendered in a light or dark theme.</p>
<p>As an example, let's add an attached property that controls elevation. Our style will illustrate the elevation with a drop shadow; the higher the elevation, the larger the shadow.</p>
<p>The first step is to create a new Qt Quick Controls 2 application in Qt Creator. After that, we add a C++ type that stores the elevation. Since the type will be used for every control supported by our style, and because we may wish to add other attached properties later on, we'll call it MyStyle. Here is <code>MyStyle.h</code>:</p>
<pre class="cpp">

  <span class="preprocessor">#ifndef MYSTYLE_H</span>
  <span class="preprocessor">#define MYSTYLE_H</span>

  <span class="preprocessor">#include &lt;QObject&gt;</span>
  <span class="preprocessor">#include &lt;QtQml&gt;</span>

  <span class="keyword">class</span> MyStyle : <span class="keyword">public</span> <span class="type"><a href="../qtcore/qobject.html">QObject</a></span>
  {
      Q_OBJECT
      Q_PROPERTY(<span class="type">int</span> elevation READ elevation WRITE setElevation NOTIFY elevationChanged)

  <span class="keyword">public</span>:
      <span class="keyword">explicit</span> MyStyle(<span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>parent <span class="operator">=</span> nullptr);

      <span class="keyword">static</span> MyStyle <span class="operator">*</span>qmlAttachedProperties(<span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>object);

      <span class="type">int</span> elevation() <span class="keyword">const</span>;
      <span class="type">void</span> setElevation(<span class="type">int</span> elevation);

  <span class="keyword">signals</span>:
      <span class="type">void</span> elevationChanged();

  <span class="keyword">private</span>:
      <span class="type">int</span> m_elevation;
  };

  QML_DECLARE_TYPEINFO(MyStyle<span class="operator">,</span> QML_HAS_ATTACHED_PROPERTIES)

  <span class="preprocessor">#endif // MYSTYLE_H</span>

</pre>
<p><code>MyStyle.cpp</code>:</p>
<pre class="cpp">

  <span class="preprocessor">#include &quot;mystyle.h&quot;</span>

  MyStyle<span class="operator">::</span>MyStyle(<span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>parent) :
      <span class="type"><a href="../qtcore/qobject.html">QObject</a></span>(parent)<span class="operator">,</span>
      m_elevation(<span class="number">0</span>)
  {
  }

  MyStyle <span class="operator">*</span>MyStyle<span class="operator">::</span>qmlAttachedProperties(<span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>object)
  {
      <span class="keyword">return</span> <span class="keyword">new</span> MyStyle(object);
  }

  <span class="type">int</span> MyStyle<span class="operator">::</span>elevation() <span class="keyword">const</span>
  {
      <span class="keyword">return</span> m_elevation;
  }

  <span class="type">void</span> MyStyle<span class="operator">::</span>setElevation(<span class="type">int</span> elevation)
  {
      <span class="keyword">if</span> (elevation <span class="operator">=</span><span class="operator">=</span> m_elevation)
          <span class="keyword">return</span>;

      m_elevation <span class="operator">=</span> elevation;
      <span class="keyword">emit</span> elevationChanged();
  }

</pre>
<p>The <code>MyStyle</code> type is special in the sense that it shouldn't be instantiated, but rather used for its attached properties. For that reason, we register it in the following manner in <code>main.cpp</code>:</p>
<pre class="cpp">

  <span class="preprocessor">#include &lt;QGuiApplication&gt;</span>
  <span class="preprocessor">#include &lt;QQmlApplicationEngine&gt;</span>

  <span class="preprocessor">#include &quot;mystyle.h&quot;</span>

  <span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
  {
      <span class="type"><a href="../qtcore/qcoreapplication.html">QCoreApplication</a></span><span class="operator">::</span>setAttribute(<span class="type"><a href="../qtcore/qt.html">Qt</a></span><span class="operator">::</span>AA_EnableHighDpiScaling);
      <span class="type"><a href="../qtgui/qguiapplication.html">QGuiApplication</a></span> app(argc<span class="operator">,</span> argv);

      qmlRegisterUncreatableType<span class="operator">&lt;</span>MyStyle<span class="operator">&gt;</span>(<span class="string">&quot;MyStyle&quot;</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="string">&quot;MyStyle&quot;</span><span class="operator">,</span> <span class="string">&quot;MyStyle is an attached property&quot;</span>);

      <span class="type"><a href="../qtqml/qqmlapplicationengine.html">QQmlApplicationEngine</a></span> engine;
      engine<span class="operator">.</span>load(<span class="type"><a href="../qtcore/qurl.html">QUrl</a></span>(QLatin1String(<span class="string">&quot;qrc:/main.qml&quot;</span>)));

      <span class="keyword">return</span> app<span class="operator">.</span>exec();
  }

</pre>
<p>We then copy <code>Button.qml</code> from the Default style in <code>$QTDIR/qml/QtQuick/Controls.2/</code> into a new <code>myproject</code> folder in our project directory. Add the newly copied <code>Button.qml</code> to <code>qml.qrc</code>, which is the resource file that contains our QML files.</p>
<p>Next, we add a drop shadow to the <a href="qml-qtquick-controls2-control.html#background-prop">background</a> delegate of the Button:</p>
<pre class="cpp">

  <span class="comment">// ...</span>
  import <span class="type">QtGraphicalEffects</span> <span class="number">1.0</span>
  import MyStyle <span class="number">1.0</span>
  <span class="comment">// ...</span>

  background: Rectangle {
      <span class="comment">// ...</span>

      layer<span class="operator">.</span>enabled: control<span class="operator">.</span>enabled <span class="operator">&amp;</span><span class="operator">&amp;</span> control<span class="operator">.</span>MyStyle<span class="operator">.</span>elevation <span class="operator">&gt;</span> <span class="number">0</span>
      layer<span class="operator">.</span>effect: DropShadow {
          verticalOffset: <span class="number">1</span>
          color: control<span class="operator">.</span>visualFocus <span class="operator">?</span> <span class="string">&quot;#330066ff&quot;</span> : <span class="string">&quot;#aaaaaa&quot;</span>
          samples: control<span class="operator">.</span>MyStyle<span class="operator">.</span>elevation
          spread: <span class="number">0.5</span>
      }
  }

</pre>
<p>Note that we:</p>
<ul>
<li>Don't bother using the drop shadow when the elevation is <code>0</code></li>
<li>Change the shadow's color depending on whether or not the button has focus</li>
<li>Make the size of the shadow depend on the elevation</li>
</ul>
<p>To try out the attached property, we create a <a href="../qtquick/qtquick-positioning-layouts.html#row">Row</a> with two Buttons in <code>main.qml</code>:</p>
<pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  import MyStyle 1.0

  <span class="type"><a href="qml-qtquick-controls2-applicationwindow.html">ApplicationWindow</a></span> {
      <span class="name">id</span>: <span class="name">window</span>
      <span class="name">width</span>: <span class="number">400</span>
      <span class="name">height</span>: <span class="number">400</span>
      <span class="name">visible</span>: <span class="number">true</span>

      <span class="type"><a href="../qtquick/qml-qtquick-row.html">Row</a></span> {
          <span class="name">spacing</span>: <span class="number">20</span>
          <span class="name">anchors</span>.centerIn: <span class="name">parent</span>

          <span class="type"><a href="qml-qtquick-controls2-button.html">Button</a></span> {
              <span class="name">text</span>: <span class="string">&quot;Button 1&quot;</span>
          }
          <span class="type"><a href="qml-qtquick-controls2-button.html">Button</a></span> {
              <span class="name">text</span>: <span class="string">&quot;Button 2&quot;</span>
              <span class="name">MyStyle</span>.elevation: <span class="number">10</span>
          }
      }
  }

</pre>
<p>One button has no elevation, and the other has an elevation of <code>10</code>.</p>
<p>With that in place, we can run our example. To tell the application to use our new style, we pass <code>-style :/mystyle</code> as an application argument, but there are <a href="qtquickcontrols2-styles.html#using-styles-in-qt-quick-controls-2">many ways</a> to specify the style to use.</p>
<p>The end result:</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-customize-buttons.png" alt="" /></p><p>Note that the <code>import MyStyle 1.0</code> statement is only necessary because we are using the attached property belonging to <code>MyStyle</code>. Both buttons will use our custom style, even if we were to remove the import.</p>
<a name="customization-reference"></a>
<h2 id="customization-reference">Customization Reference</h2>
<p>The following snippets present examples where the default style's controls have been customized using the same approach as the <a href="qtquickcontrols2-customize.html#customizing-a-control">Customizing a Control</a> section. The code can be used as a starting point to implement a custom look and feel.</p>
<a name="customizing-applicationwindow"></a>
<h3 >Customizing ApplicationWindow</h3>
<p><a href="qml-qtquick-controls2-applicationwindow.html">ApplicationWindow</a> consists of one visual item: <a href="qml-qtquick-controls2-applicationwindow.html#background-prop">background</a>. It is also possible to customize the <a href="qml-qtquick-controls2-applicationwindow.html#overlay-attached-prop">modal</a> and <a href="qml-qtquick-controls2-applicationwindow.html#overlay-attached-prop">modeless</a> items.</p>
<pre class="cpp">

  import <span class="type"><a href="../qtqml/qtquick-qmlmodule.html">QtQuick</a></span> <span class="number">2.7</span>
  import <span class="type"><a href="../qtqml/qtquick-qmlmodule.html">QtQuick</a></span><span class="operator">.</span>Controls <span class="number">2.0</span>

  ApplicationWindow {
      visible: <span class="keyword">true</span>

      background: Rectangle {
          gradient: Gradient {
              GradientStop { position: <span class="number">0</span>; color: <span class="string">&quot;#ffffff&quot;</span> }
              GradientStop { position: <span class="number">1</span>; color: <span class="string">&quot;#c1bbf9&quot;</span> }
          }
      }

      overlay<span class="operator">.</span>modal: Rectangle {
          color: <span class="string">&quot;#8f28282a&quot;</span>
      }

      overlay<span class="operator">.</span>modeless: Rectangle {
          color: <span class="string">&quot;#2f28282a&quot;</span>
      }
  }

</pre>
<a name="customizing-busyindicator"></a>
<h3 >Customizing BusyIndicator</h3>
<p><a href="qml-qtquick-controls2-busyindicator.html">BusyIndicator</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-busyindicator-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-busyindicator.html">BusyIndicator</a></span> {
      <span class="name">id</span>: <span class="name">control</span>

      <span class="name">contentItem</span>: <span class="name">Item</span> {
          <span class="name">implicitWidth</span>: <span class="number">64</span>
          <span class="name">implicitHeight</span>: <span class="number">64</span>

          <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
              <span class="name">id</span>: <span class="name">item</span>
              <span class="name">x</span>: <span class="name">parent</span>.<span class="name">width</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="number">32</span>
              <span class="name">y</span>: <span class="name">parent</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="number">32</span>
              <span class="name">width</span>: <span class="number">64</span>
              <span class="name">height</span>: <span class="number">64</span>
              <span class="name">opacity</span>: <span class="name">control</span>.<span class="name">running</span> ? <span class="number">1</span> : <span class="number">0</span>

              Behavior on <span class="name">opacity</span> {
                  <span class="type"><a href="../qtquick/qml-qtquick-opacityanimator.html">OpacityAnimator</a></span> {
                      <span class="name">duration</span>: <span class="number">250</span>
                  }
              }

              <span class="type"><a href="../qtquick/qml-qtquick-rotationanimator.html">RotationAnimator</a></span> {
                  <span class="name">target</span>: <span class="name">item</span>
                  <span class="name">running</span>: <span class="name">control</span>.<span class="name">visible</span> <span class="operator">&amp;&amp;</span> <span class="name">control</span>.<span class="name">running</span>
                  <span class="name">from</span>: <span class="number">0</span>
                  <span class="name">to</span>: <span class="number">360</span>
                  <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span>
                  <span class="name">duration</span>: <span class="number">1250</span>
              }

              <span class="type"><a href="../qtquick/qml-qtquick-repeater.html">Repeater</a></span> {
                  <span class="name">id</span>: <span class="name">repeater</span>
                  <span class="name">model</span>: <span class="number">6</span>

                  <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
                      <span class="name">x</span>: <span class="name">item</span>.<span class="name">width</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
                      <span class="name">y</span>: <span class="name">item</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
                      <span class="name">implicitWidth</span>: <span class="number">10</span>
                      <span class="name">implicitHeight</span>: <span class="number">10</span>
                      <span class="name">radius</span>: <span class="number">5</span>
                      <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
                      <span class="name">transform</span>: [
                          <span class="type"><a href="../qtquick/qml-qtquick-translate.html">Translate</a></span> {
                              <span class="name">y</span>: -<span class="name">Math</span>.<span class="name">min</span>(<span class="name">item</span>.<span class="name">width</span>, <span class="name">item</span>.<span class="name">height</span>) <span class="operator">*</span> <span class="number">0.5</span> <span class="operator">+</span> <span class="number">5</span>
                          },
                          <span class="type"><a href="../qtquick/qml-qtquick-rotation.html">Rotation</a></span> {
                              <span class="name">angle</span>: <span class="name">index</span> <span class="operator">/</span> <span class="name">repeater</span>.<span class="name">count</span> <span class="operator">*</span> <span class="number">360</span>
                              <span class="name">origin</span>.x: <span class="number">5</span>
                              <span class="name">origin</span>.y: <span class="number">5</span>
                          }
                      ]
                  }
              }
          }
      }
  }

</pre>
<a name="customizing-button"></a>
<h3 >Customizing Button</h3>
<p>Button consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-button-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-button.html">Button</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Button&quot;</span>)

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1.0</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">horizontalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignHCenter</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">100</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1</span> : <span class="number">0.3</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">border</span>.width: <span class="number">1</span>
          <span class="name">radius</span>: <span class="number">2</span>
      }
  }

</pre>
<a name="customizing-checkbox"></a>
<h3 >Customizing CheckBox</h3>
<p><a href="qml-qtquick-controls2-checkbox.html">CheckBox</a> consists of three visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a> and <a href="qml-qtquick-controls2-abstractbutton.html#indicator-prop">indicator</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-checkbox-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-checkbox.html">CheckBox</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;CheckBox&quot;</span>)
      <span class="name">checked</span>: <span class="number">true</span>

      <span class="name">indicator</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">26</span>
          <span class="name">implicitHeight</span>: <span class="number">26</span>
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">leftPadding</span>
          <span class="name">y</span>: <span class="name">parent</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">radius</span>: <span class="number">3</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">width</span>: <span class="number">14</span>
              <span class="name">height</span>: <span class="number">14</span>
              <span class="name">x</span>: <span class="number">6</span>
              <span class="name">y</span>: <span class="number">6</span>
              <span class="name">radius</span>: <span class="number">2</span>
              <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">visible</span>: <span class="name">control</span>.<span class="name">checked</span>
          }
      }

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1.0</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          <span class="name">leftPadding</span>: <span class="name">control</span>.<span class="name">indicator</span>.<span class="name">width</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">spacing</span>
      }
  }

</pre>
<a name="customizing-checkdelegate"></a>
<h3 >Customizing CheckDelegate</h3>
<p><a href="qml-qtquick-controls2-checkdelegate.html">CheckDelegate</a> consists of three visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a> and <a href="qml-qtquick-controls2-abstractbutton.html#indicator-prop">indicator</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-checkdelegate-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-checkdelegate.html">CheckDelegate</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;CheckDelegate&quot;</span>)
      <span class="name">checked</span>: <span class="number">true</span>

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">rightPadding</span>: <span class="name">control</span>.<span class="name">indicator</span>.<span class="name">width</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">spacing</span>
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1.0</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
      }

      <span class="name">indicator</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">26</span>
          <span class="name">implicitHeight</span>: <span class="number">26</span>
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">width</span> <span class="operator">-</span> <span class="name">control</span>.<span class="name">rightPadding</span>
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">topPadding</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">availableHeight</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">radius</span>: <span class="number">3</span>
          <span class="name">color</span>: <span class="string">&quot;transparent&quot;</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">width</span>: <span class="number">14</span>
              <span class="name">height</span>: <span class="number">14</span>
              <span class="name">x</span>: <span class="number">6</span>
              <span class="name">y</span>: <span class="number">6</span>
              <span class="name">radius</span>: <span class="number">2</span>
              <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">visible</span>: <span class="name">control</span>.<span class="name">checked</span>
          }
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">100</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">visible</span>: <span class="name">control</span>.<span class="name">down</span> <span class="operator">||</span> <span class="name">control</span>.<span class="name">highlighted</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#bdbebf&quot;</span> : <span class="string">&quot;#eeeeee&quot;</span>
      }
  }

</pre>
<a name="customizing-combobox"></a>
<h3 >Customizing ComboBox</h3>
<p><a href="qml-qtquick-controls2-combobox.html">ComboBox</a> consists of <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>, <a href="qml-qtquick-controls2-combobox.html#popup-prop">popup</a>, <a href="qml-qtquick-controls2-combobox.html#indicator-prop">indicator</a>, and <a href="qml-qtquick-controls2-combobox.html#delegate-prop">delegate</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-combobox-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-combobox.html">ComboBox</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">model</span>: [<span class="string">&quot;First&quot;</span>, <span class="string">&quot;Second&quot;</span>, <span class="string">&quot;Third&quot;</span>]

      <span class="name">delegate</span>: <span class="name">ItemDelegate</span> {
          <span class="name">width</span>: <span class="name">control</span>.<span class="name">width</span>
          <span class="name">contentItem</span>: <span class="name">Text</span> {
              <span class="name">text</span>: <span class="name">modelData</span>
              <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
              <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
              <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          }
          <span class="name">highlighted</span>: <span class="name">control</span>.<span class="name">highlightedIndex</span> <span class="operator">===</span> <span class="name">index</span>
      }

      <span class="name">indicator</span>: <span class="name">Canvas</span> {
          <span class="name">id</span>: <span class="name">canvas</span>
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">width</span> <span class="operator">-</span> <span class="name">control</span>.<span class="name">rightPadding</span>
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">topPadding</span> <span class="operator">+</span> (<span class="name">control</span>.<span class="name">availableHeight</span> <span class="operator">-</span> <span class="name">height</span>) <span class="operator">/</span> <span class="number">2</span>
          <span class="name">width</span>: <span class="number">12</span>
          <span class="name">height</span>: <span class="number">8</span>
          <span class="name">contextType</span>: <span class="string">&quot;2d&quot;</span>

          <span class="type"><a href="../qtqml/qml-qtqml-connections.html">Connections</a></span> {
              <span class="name">target</span>: <span class="name">control</span>
              <span class="name">onPressedChanged</span>: <span class="name">canvas</span>.<span class="name">requestPaint</span>()
          }

          <span class="name">onPaint</span>: {
              <span class="name">context</span>.<span class="name">reset</span>();
              <span class="name">context</span>.<span class="name">moveTo</span>(<span class="number">0</span>, <span class="number">0</span>);
              <span class="name">context</span>.<span class="name">lineTo</span>(<span class="name">width</span>, <span class="number">0</span>);
              <span class="name">context</span>.<span class="name">lineTo</span>(<span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>, <span class="name">height</span>);
              <span class="name">context</span>.<span class="name">closePath</span>();
              <span class="name">context</span>.<span class="name">fillStyle</span> <span class="operator">=</span> <span class="name">control</span>.<span class="name">pressed</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>;
              <span class="name">context</span>.<span class="name">fill</span>();
          }
      }

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">leftPadding</span>: <span class="number">0</span>
          <span class="name">rightPadding</span>: <span class="name">control</span>.<span class="name">indicator</span>.<span class="name">width</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">spacing</span>

          <span class="name">text</span>: <span class="name">control</span>.<span class="name">displayText</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">pressed</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">120</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">pressed</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">border</span>.width: <span class="name">control</span>.<span class="name">visualFocus</span> ? <span class="number">2</span> : <span class="number">1</span>
          <span class="name">radius</span>: <span class="number">2</span>
      }

      <span class="name">popup</span>: <span class="name">Popup</span> {
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">height</span> <span class="operator">-</span> <span class="number">1</span>
          <span class="name">width</span>: <span class="name">control</span>.<span class="name">width</span>
          <span class="name">implicitHeight</span>: <span class="name">contentItem</span>.<span class="name">implicitHeight</span>
          <span class="name">padding</span>: <span class="number">1</span>

          <span class="name">contentItem</span>: <span class="name">ListView</span> {
              <span class="name">clip</span>: <span class="number">true</span>
              <span class="name">implicitHeight</span>: <span class="name">contentHeight</span>
              <span class="name">model</span>: <span class="name">control</span>.<span class="name">popup</span>.<span class="name">visible</span> ? <span class="name">control</span>.<span class="name">delegateModel</span> : <span class="number">null</span>
              <span class="name">currentIndex</span>: <span class="name">control</span>.<span class="name">highlightedIndex</span>

              <span class="name">ScrollIndicator</span>.vertical: <span class="name">ScrollIndicator</span> { }
          }

          <span class="name">background</span>: <span class="name">Rectangle</span> {
              <span class="name">border</span>.color: <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">radius</span>: <span class="number">2</span>
          }
      }
  }

</pre>
<a name="customizing-delaybutton"></a>
<h3 >Customizing DelayButton</h3>
<p><a href="qml-qtquick-controls2-delaybutton.html">DelayButton</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-delaybutton-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.2

  <span class="type"><a href="qml-qtquick-controls2-delaybutton.html">DelayButton</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">checked</span>: <span class="number">true</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Delay\nButton&quot;</span>)

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1.0</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="string">&quot;white&quot;</span>
          <span class="name">horizontalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignHCenter</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">100</span>
          <span class="name">implicitHeight</span>: <span class="number">100</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">radius</span>: <span class="name">size</span> <span class="operator">/</span> <span class="number">2</span>

          readonly property <span class="type">real</span> <span class="name">size</span>: <span class="name">Math</span>.<span class="name">min</span>(<span class="name">control</span>.<span class="name">width</span>, <span class="name">control</span>.<span class="name">height</span>)
          <span class="name">width</span>: <span class="name">size</span>
          <span class="name">height</span>: <span class="name">size</span>
          <span class="name">anchors</span>.centerIn: <span class="name">parent</span>

          <span class="type"><a href="../qtquick/qml-qtquick-canvas.html">Canvas</a></span> {
              <span class="name">id</span>: <span class="name">canvas</span>
              <span class="name">anchors</span>.fill: <span class="name">parent</span>

              <span class="type"><a href="../qtqml/qml-qtqml-connections.html">Connections</a></span> {
                  <span class="name">target</span>: <span class="name">control</span>
                  <span class="name">onProgressChanged</span>: <span class="name">canvas</span>.<span class="name">requestPaint</span>()
              }

              <span class="name">onPaint</span>: {
                  var <span class="name">ctx</span> = <span class="name">getContext</span>(<span class="string">&quot;2d&quot;</span>)
                  <span class="name">ctx</span>.<span class="name">clearRect</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="name">width</span>, <span class="name">height</span>)
                  <span class="name">ctx</span>.<span class="name">strokeStyle</span> <span class="operator">=</span> <span class="string">&quot;white&quot;</span>
                  <span class="name">ctx</span>.<span class="name">lineWidth</span> <span class="operator">=</span> <span class="name">parent</span>.<span class="name">size</span> <span class="operator">/</span> <span class="number">20</span>
                  <span class="name">ctx</span>.<span class="name">beginPath</span>()
                  var <span class="name">startAngle</span> = <span class="name">Math</span>.<span class="name">PI</span> <span class="operator">/</span> <span class="number">5</span> <span class="operator">*</span> <span class="number">3</span>
                  var <span class="name">endAngle</span> = <span class="name">startAngle</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">progress</span> <span class="operator">*</span> <span class="name">Math</span>.<span class="name">PI</span> <span class="operator">/</span> <span class="number">5</span> <span class="operator">*</span> <span class="number">9</span>
                  <span class="name">ctx</span>.<span class="name">arc</span>(<span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>, <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>, <span class="name">width</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">ctx</span>.<span class="name">lineWidth</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="number">2</span>, <span class="name">startAngle</span>, <span class="name">endAngle</span>)
                  <span class="name">ctx</span>.<span class="name">stroke</span>()
              }
          }
      }
  }

</pre>
<a name="customizing-dial"></a>
<h3 >Customizing Dial</h3>
<p>Dial consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-dial.html#handle-prop">handle</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-dial-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-dial.html">Dial</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">width</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">width</span>: <span class="name">Math</span>.<span class="name">max</span>(<span class="number">64</span>, <span class="name">Math</span>.<span class="name">min</span>(<span class="name">control</span>.<span class="name">width</span>, <span class="name">control</span>.<span class="name">height</span>))
          <span class="name">height</span>: <span class="name">width</span>
          <span class="name">color</span>: <span class="string">&quot;transparent&quot;</span>
          <span class="name">radius</span>: <span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">pressed</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">opacity</span>: <span class="name">control</span>.<span class="name">enabled</span> ? <span class="number">1</span> : <span class="number">0.3</span>
      }

      <span class="name">handle</span>: <span class="name">Rectangle</span> {
          <span class="name">id</span>: <span class="name">handleItem</span>
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">background</span>.<span class="name">x</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">background</span>.<span class="name">width</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">background</span>.<span class="name">y</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">background</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">width</span>: <span class="number">16</span>
          <span class="name">height</span>: <span class="number">16</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">pressed</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">radius</span>: <span class="number">8</span>
          <span class="name">antialiasing</span>: <span class="number">true</span>
          <span class="name">opacity</span>: <span class="name">control</span>.<span class="name">enabled</span> ? <span class="number">1</span> : <span class="number">0.3</span>
          <span class="name">transform</span>: [
              <span class="type"><a href="../qtquick/qml-qtquick-translate.html">Translate</a></span> {
                  <span class="name">y</span>: -<span class="name">Math</span>.<span class="name">min</span>(<span class="name">control</span>.<span class="name">background</span>.<span class="name">width</span>, <span class="name">control</span>.<span class="name">background</span>.<span class="name">height</span>) <span class="operator">*</span> <span class="number">0.4</span> <span class="operator">+</span> <span class="name">handleItem</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
              },
              <span class="type"><a href="../qtquick/qml-qtquick-rotation.html">Rotation</a></span> {
                  <span class="name">angle</span>: <span class="name">control</span>.<span class="name">angle</span>
                  <span class="name">origin</span>.x: <span class="name">handleItem</span>.<span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
                  <span class="name">origin</span>.y: <span class="name">handleItem</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
              }
          ]
      }
  }

</pre>
<a name="customizing-drawer"></a>
<h3 >Customizing Drawer</h3>
<p>Drawer can have a visual <a href="qml-qtquick-controls2-control.html#background-prop">background</a> item.</p>
<pre class="cpp">

  background: Rectangle {
      Rectangle {
          x: parent<span class="operator">.</span>width <span class="operator">-</span> <span class="number">1</span>
          width: <span class="number">1</span>
          height: parent<span class="operator">.</span>height
          color: <span class="string">&quot;#21be2b&quot;</span>
      }
  }

</pre>
<a name="customizing-frame"></a>
<h3 >Customizing Frame</h3>
<p>Frame consists of one visual item: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-frame-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-frame.html">Frame</a></span> {
      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">color</span>: <span class="string">&quot;transparent&quot;</span>
          <span class="name">border</span>.color: <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">radius</span>: <span class="number">2</span>
      }

      <span class="type"><a href="qml-qtquick-controls2-label.html">Label</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Content goes here!&quot;</span>)
      }
  }

</pre>
<a name="customizing-groupbox"></a>
<h3 >Customizing GroupBox</h3>
<p><a href="qml-qtquick-controls2-groupbox.html">GroupBox</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-groupbox.html#label-prop">label</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-groupbox-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-groupbox.html">GroupBox</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">title</span>: <span class="name">qsTr</span>(<span class="string">&quot;GroupBox&quot;</span>)

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">topPadding</span> <span class="operator">-</span> <span class="name">control</span>.<span class="name">padding</span>
          <span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
          <span class="name">height</span>: <span class="name">parent</span>.<span class="name">height</span> <span class="operator">-</span> <span class="name">control</span>.<span class="name">topPadding</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">padding</span>
          <span class="name">color</span>: <span class="string">&quot;transparent&quot;</span>
          <span class="name">border</span>.color: <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">radius</span>: <span class="number">2</span>
      }

      <span class="name">label</span>: <span class="name">Label</span> {
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">leftPadding</span>
          <span class="name">width</span>: <span class="name">control</span>.<span class="name">availableWidth</span>
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">title</span>
          <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
      }

      <span class="type"><a href="qml-qtquick-controls2-label.html">Label</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Content goes here!&quot;</span>)
      }
  }

</pre>
<a name="customizing-itemdelegate"></a>
<h3 >Customizing ItemDelegate</h3>
<p><a href="qml-qtquick-controls2-itemdelegate.html">ItemDelegate</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-itemdelegate-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-itemdelegate.html">ItemDelegate</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;ItemDelegate&quot;</span>)

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">rightPadding</span>: <span class="name">control</span>.<span class="name">spacing</span>
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">enabled</span> ? (<span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>) : <span class="string">&quot;#bdbebf&quot;</span>
          <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">100</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#dddedf&quot;</span> : <span class="string">&quot;#eeeeee&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
              <span class="name">height</span>: <span class="number">1</span>
              <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">anchors</span>.bottom: <span class="name">parent</span>.<span class="name">bottom</span>
          }
      }
  }

</pre>
<a name="customizing-label"></a>
<h3 >Customizing Label</h3>
<p>Label can have a visual <a href="qml-qtquick-controls2-label.html#background-prop">background</a> item.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-label-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-label.html">Label</a></span> {
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Label&quot;</span>)
      <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
  }

</pre>
<a name="customizing-menu"></a>
<h3 >Customizing Menu</h3>
<p>Menu consists of a <a href="qml-qtquick-controls2-popup.html#contentItem-prop">contentItem</a>.</p>
<pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-menu.html">Menu</a></span> {
      <span class="name">id</span>: <span class="name">menu</span>
      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">200</span>
          <span class="name">implicitHeight</span>: <span class="number">200</span>
          <span class="name">color</span>: <span class="string">&quot;#ffffff&quot;</span>
          <span class="name">border</span>.color: <span class="string">&quot;#353637&quot;</span>
      }

      <span class="type"><a href="qml-qtquick-controls2-menuitem.html">MenuItem</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;New...&quot;</span>)
      }
      <span class="type"><a href="qml-qtquick-controls2-menuitem.html">MenuItem</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Open...&quot;</span>)
      }
      <span class="type"><a href="qml-qtquick-controls2-menuitem.html">MenuItem</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Save&quot;</span>)
      }
  }

</pre>
<a name="customizing-menuitem"></a>
<h3 >Customizing MenuItem</h3>
<p><a href="qml-qtquick-controls2-menuitem.html">MenuItem</a> can be customized in the same manner as <a href="qtquickcontrols2-customize.html#customizing-button">Button</a>.</p>
<a name="customizing-menuseparator"></a>
<h3 >Customizing MenuSeparator</h3>
<p><a href="qml-qtquick-controls2-menuseparator.html">MenuSeparator</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-menuseparator-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-menu.html">Menu</a></span> {
      <span class="name">id</span>: <span class="name">menu</span>
      <span class="type"><a href="qml-qtquick-controls2-menuitem.html">MenuItem</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;New...&quot;</span>)
      }
      <span class="type"><a href="qml-qtquick-controls2-menuitem.html">MenuItem</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Open...&quot;</span>)
      }
      <span class="type"><a href="qml-qtquick-controls2-menuitem.html">MenuItem</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Save&quot;</span>)
      }

      <span class="type"><a href="qml-qtquick-controls2-menuseparator.html">MenuSeparator</a></span> {
          <span class="name">padding</span>: <span class="number">0</span>
          <span class="name">topPadding</span>: <span class="number">12</span>
          <span class="name">bottomPadding</span>: <span class="number">12</span>
          <span class="name">contentItem</span>: <span class="name">Rectangle</span> {
              <span class="name">implicitWidth</span>: <span class="number">200</span>
              <span class="name">implicitHeight</span>: <span class="number">1</span>
              <span class="name">color</span>: <span class="string">&quot;#1E000000&quot;</span>
          }
      }

      <span class="type"><a href="qml-qtquick-controls2-menuitem.html">MenuItem</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Exit&quot;</span>)
      }
  }

</pre>
<a name="customizing-pageindicator"></a>
<h3 >Customizing PageIndicator</h3>
<p><a href="qml-qtquick-controls2-pageindicator.html">PageIndicator</a> consists of a <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>, and <a href="qml-qtquick-controls2-pageindicator.html#delegate-prop">delegate</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-pageindicator-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-pageindicator.html">PageIndicator</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">count</span>: <span class="number">5</span>
      <span class="name">currentIndex</span>: <span class="number">2</span>

      <span class="name">delegate</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">8</span>
          <span class="name">implicitHeight</span>: <span class="number">8</span>

          <span class="name">radius</span>: <span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>

          <span class="name">opacity</span>: <span class="name">index</span> <span class="operator">===</span> <span class="name">control</span>.<span class="name">currentIndex</span> ? <span class="number">0.95</span> : <span class="name">pressed</span> ? <span class="number">0.7</span> : <span class="number">0.45</span>

          Behavior on <span class="name">opacity</span> {
              <span class="type"><a href="../qtquick/qml-qtquick-opacityanimator.html">OpacityAnimator</a></span> {
                  <span class="name">duration</span>: <span class="number">100</span>
              }
          }
      }
  }

</pre>
<a name="customizing-pane"></a>
<h3 >Customizing Pane</h3>
<p>Pane consists of a <a href="qml-qtquick-controls2-control.html#background-prop">background</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-pane-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-pane.html">Pane</a></span> {
      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">color</span>: <span class="string">&quot;#eeeeee&quot;</span>
      }

      <span class="type"><a href="qml-qtquick-controls2-label.html">Label</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Content goes here!&quot;</span>)
      }
  }

</pre>
<a name="customizing-popup"></a>
<h3 >Customizing Popup</h3>
<p>Popup consists of a <a href="qml-qtquick-controls2-popup.html#background-prop">background</a> and <a href="qml-qtquick-controls2-popup.html#contentItem-prop">content item</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-popup-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.0

  <span class="type"><a href="qml-qtquick-controls2-popup.html">Popup</a></span> {
      <span class="name">id</span>: <span class="name">popup</span>
      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">200</span>
          <span class="name">implicitHeight</span>: <span class="number">200</span>
          <span class="name">border</span>.color: <span class="string">&quot;#444&quot;</span>
      }
      <span class="name">contentItem</span>: <span class="name">Column</span> {}
  }

</pre>
<a name="customizing-progressbar"></a>
<h3 >Customizing ProgressBar</h3>
<p><a href="qml-qtquick-controls2-progressbar.html">ProgressBar</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-progressbar-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-progressbar.html">ProgressBar</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">value</span>: <span class="number">0.5</span>
      <span class="name">padding</span>: <span class="number">2</span>

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">200</span>
          <span class="name">implicitHeight</span>: <span class="number">6</span>
          <span class="name">color</span>: <span class="string">&quot;#e6e6e6&quot;</span>
          <span class="name">radius</span>: <span class="number">3</span>
      }

      <span class="name">contentItem</span>: <span class="name">Item</span> {
          <span class="name">implicitWidth</span>: <span class="number">200</span>
          <span class="name">implicitHeight</span>: <span class="number">4</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">width</span>: <span class="name">control</span>.<span class="name">visualPosition</span> <span class="operator">*</span> <span class="name">parent</span>.<span class="name">width</span>
              <span class="name">height</span>: <span class="name">parent</span>.<span class="name">height</span>
              <span class="name">radius</span>: <span class="number">2</span>
              <span class="name">color</span>: <span class="string">&quot;#17a81a&quot;</span>
          }
      }
  }

</pre>
<a name="customizing-radiobutton"></a>
<h3 >Customizing RadioButton</h3>
<p><a href="qml-qtquick-controls2-radiobutton.html">RadioButton</a> consists of three visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a> and <a href="qml-qtquick-controls2-abstractbutton.html#indicator-prop">indicator</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-radiobutton-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-radiobutton.html">RadioButton</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;RadioButton&quot;</span>)
      <span class="name">checked</span>: <span class="number">true</span>

      <span class="name">indicator</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">26</span>
          <span class="name">implicitHeight</span>: <span class="number">26</span>
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">leftPadding</span>
          <span class="name">y</span>: <span class="name">parent</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">radius</span>: <span class="number">13</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">width</span>: <span class="number">14</span>
              <span class="name">height</span>: <span class="number">14</span>
              <span class="name">x</span>: <span class="number">6</span>
              <span class="name">y</span>: <span class="number">6</span>
              <span class="name">radius</span>: <span class="number">7</span>
              <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">visible</span>: <span class="name">control</span>.<span class="name">checked</span>
          }
      }

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1.0</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          <span class="name">leftPadding</span>: <span class="name">control</span>.<span class="name">indicator</span>.<span class="name">width</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">spacing</span>
      }
  }

</pre>
<a name="customizing-radiodelegate"></a>
<h3 >Customizing RadioDelegate</h3>
<p><a href="qml-qtquick-controls2-radiodelegate.html">RadioDelegate</a> consists of three visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a> and <a href="qml-qtquick-controls2-abstractbutton.html#indicator-prop">indicator</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-radiodelegate-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-radiodelegate.html">RadioDelegate</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;RadioDelegate&quot;</span>)
      <span class="name">checked</span>: <span class="number">true</span>

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">rightPadding</span>: <span class="name">control</span>.<span class="name">indicator</span>.<span class="name">width</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">spacing</span>
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1.0</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
      }

      <span class="name">indicator</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">26</span>
          <span class="name">implicitHeight</span>: <span class="number">26</span>
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">width</span> <span class="operator">-</span> <span class="name">control</span>.<span class="name">rightPadding</span>
          <span class="name">y</span>: <span class="name">parent</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">radius</span>: <span class="number">13</span>
          <span class="name">color</span>: <span class="string">&quot;transparent&quot;</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">width</span>: <span class="number">14</span>
              <span class="name">height</span>: <span class="number">14</span>
              <span class="name">x</span>: <span class="number">6</span>
              <span class="name">y</span>: <span class="number">6</span>
              <span class="name">radius</span>: <span class="number">7</span>
              <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">visible</span>: <span class="name">control</span>.<span class="name">checked</span>
          }
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">100</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">visible</span>: <span class="name">control</span>.<span class="name">down</span> <span class="operator">||</span> <span class="name">control</span>.<span class="name">highlighted</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#bdbebf&quot;</span> : <span class="string">&quot;#eeeeee&quot;</span>
      }
  }

</pre>
<a name="customizing-rangeslider"></a>
<h3 >Customizing RangeSlider</h3>
<p><a href="qml-qtquick-controls2-rangeslider.html">RangeSlider</a> consists of three visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-rangeslider.html#first-prop">first.handle</a> and <a href="qml-qtquick-controls2-rangeslider.html#second.handle-prop">second.handle</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-rangeslider-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-rangeslider.html">RangeSlider</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">first</span>.value: <span class="number">0.25</span>
      <span class="name">second</span>.value: <span class="number">0.75</span>

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">leftPadding</span>
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">topPadding</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">availableHeight</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">implicitWidth</span>: <span class="number">200</span>
          <span class="name">implicitHeight</span>: <span class="number">4</span>
          <span class="name">width</span>: <span class="name">control</span>.<span class="name">availableWidth</span>
          <span class="name">height</span>: <span class="name">implicitHeight</span>
          <span class="name">radius</span>: <span class="number">2</span>
          <span class="name">color</span>: <span class="string">&quot;#bdbebf&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">x</span>: <span class="name">control</span>.<span class="name">first</span>.<span class="name">visualPosition</span> <span class="operator">*</span> <span class="name">parent</span>.<span class="name">width</span>
              <span class="name">width</span>: <span class="name">control</span>.<span class="name">second</span>.<span class="name">visualPosition</span> <span class="operator">*</span> <span class="name">parent</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">x</span>
              <span class="name">height</span>: <span class="name">parent</span>.<span class="name">height</span>
              <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">radius</span>: <span class="number">2</span>
          }
      }

      <span class="name">first</span>.handle: <span class="name">Rectangle</span> {
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">leftPadding</span> <span class="operator">+</span> <span class="name">first</span>.<span class="name">visualPosition</span> <span class="operator">*</span> (<span class="name">control</span>.<span class="name">availableWidth</span> <span class="operator">-</span> <span class="name">width</span>)
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">topPadding</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">availableHeight</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">implicitWidth</span>: <span class="number">26</span>
          <span class="name">implicitHeight</span>: <span class="number">26</span>
          <span class="name">radius</span>: <span class="number">13</span>
          <span class="name">color</span>: <span class="name">first</span>.<span class="name">pressed</span> ? <span class="string">&quot;#f0f0f0&quot;</span> : <span class="string">&quot;#f6f6f6&quot;</span>
          <span class="name">border</span>.color: <span class="string">&quot;#bdbebf&quot;</span>
      }

      <span class="name">second</span>.handle: <span class="name">Rectangle</span> {
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">leftPadding</span> <span class="operator">+</span> <span class="name">second</span>.<span class="name">visualPosition</span> <span class="operator">*</span> (<span class="name">control</span>.<span class="name">availableWidth</span> <span class="operator">-</span> <span class="name">width</span>)
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">topPadding</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">availableHeight</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">implicitWidth</span>: <span class="number">26</span>
          <span class="name">implicitHeight</span>: <span class="number">26</span>
          <span class="name">radius</span>: <span class="number">13</span>
          <span class="name">color</span>: <span class="name">second</span>.<span class="name">pressed</span> ? <span class="string">&quot;#f0f0f0&quot;</span> : <span class="string">&quot;#f6f6f6&quot;</span>
          <span class="name">border</span>.color: <span class="string">&quot;#bdbebf&quot;</span>
      }
  }

</pre>
<a name="customizing-roundbutton"></a>
<h3 >Customizing RoundButton</h3>
<p><a href="qml-qtquick-controls2-roundbutton.html">RoundButton</a> can be customized in the same manner as <a href="qtquickcontrols2-customize.html#customizing-button">Button</a>.</p>
<a name="customizing-scrollbar"></a>
<h3 >Customizing ScrollBar</h3>
<p><a href="qml-qtquick-controls2-scrollbar.html">ScrollBar</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-scrollbar-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-scrollbar.html">ScrollBar</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">size</span>: <span class="number">0.3</span>
      <span class="name">position</span>: <span class="number">0.2</span>
      <span class="name">active</span>: <span class="number">true</span>
      <span class="name">orientation</span>: <span class="name">Qt</span>.<span class="name">Vertical</span>

      <span class="name">contentItem</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">6</span>
          <span class="name">implicitHeight</span>: <span class="number">100</span>
          <span class="name">radius</span>: <span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">pressed</span> ? <span class="string">&quot;#81e889&quot;</span> : <span class="string">&quot;#c2f4c6&quot;</span>
      }
  }

</pre>
<a name="customizing-scrollindicator"></a>
<h3 >Customizing ScrollIndicator</h3>
<p><a href="qml-qtquick-controls2-scrollindicator.html">ScrollIndicator</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-scrollindicator-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-scrollindicator.html">ScrollIndicator</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">size</span>: <span class="number">0.3</span>
      <span class="name">position</span>: <span class="number">0.2</span>
      <span class="name">active</span>: <span class="number">true</span>
      <span class="name">orientation</span>: <span class="name">Qt</span>.<span class="name">Vertical</span>

      <span class="name">contentItem</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">2</span>
          <span class="name">implicitHeight</span>: <span class="number">100</span>
          <span class="name">color</span>: <span class="string">&quot;#c2f4c6&quot;</span>
      }
  }

</pre>
<a name="customizing-scrollview"></a>
<h3 >Customizing ScrollView</h3>
<p><a href="qml-qtquick-controls2-scrollview.html">ScrollView</a> consists of a <a href="qml-qtquick-controls2-control.html#background-prop">background</a> item, and horizontal and vertical scroll bars.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-scrollview-custom.png" alt="" /></p><pre class="qml">

  <span class="type"><a href="qml-qtquick-controls2-scrollview.html">ScrollView</a></span> {
      <span class="name">id</span>: <span class="name">control</span>

      <span class="name">width</span>: <span class="number">200</span>
      <span class="name">height</span>: <span class="number">200</span>
      <span class="name">focus</span>: <span class="number">true</span>

      <span class="type"><a href="qml-qtquick-controls2-label.html">Label</a></span> {
          <span class="name">text</span>: <span class="string">&quot;ABC&quot;</span>
          <span class="name">font</span>.pixelSize: <span class="number">224</span>
      }

      <span class="name">ScrollBar</span>.vertical: <span class="name">ScrollBar</span> {
          <span class="name">parent</span>: <span class="name">control</span>
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">mirrored</span> ? <span class="number">0</span> : <span class="name">control</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">width</span>
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">topPadding</span>
          <span class="name">height</span>: <span class="name">control</span>.<span class="name">availableHeight</span>
          <span class="name">active</span>: <span class="name">control</span>.<span class="name">ScrollBar</span>.<span class="name">horizontal</span>.<span class="name">active</span>
      }

      <span class="name">ScrollBar</span>.horizontal: <span class="name">ScrollBar</span> {
          <span class="name">parent</span>: <span class="name">control</span>
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">leftPadding</span>
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">height</span> <span class="operator">-</span> <span class="name">height</span>
          <span class="name">width</span>: <span class="name">control</span>.<span class="name">availableWidth</span>
          <span class="name">active</span>: <span class="name">control</span>.<span class="name">ScrollBar</span>.<span class="name">vertical</span>.<span class="name">active</span>
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">activeFocus</span> ? <span class="string">&quot;#21be2b&quot;</span> : <span class="string">&quot;#bdbebf&quot;</span>
      }
  }

</pre>
<a name="customizing-slider"></a>
<h3 >Customizing Slider</h3>
<p>Slider consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, and <a href="qml-qtquick-controls2-slider.html#handle-prop">handle</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-slider-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-slider.html">Slider</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">value</span>: <span class="number">0.5</span>

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">leftPadding</span>
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">topPadding</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">availableHeight</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">implicitWidth</span>: <span class="number">200</span>
          <span class="name">implicitHeight</span>: <span class="number">4</span>
          <span class="name">width</span>: <span class="name">control</span>.<span class="name">availableWidth</span>
          <span class="name">height</span>: <span class="name">implicitHeight</span>
          <span class="name">radius</span>: <span class="number">2</span>
          <span class="name">color</span>: <span class="string">&quot;#bdbebf&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">width</span>: <span class="name">control</span>.<span class="name">visualPosition</span> <span class="operator">*</span> <span class="name">parent</span>.<span class="name">width</span>
              <span class="name">height</span>: <span class="name">parent</span>.<span class="name">height</span>
              <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">radius</span>: <span class="number">2</span>
          }
      }

      <span class="name">handle</span>: <span class="name">Rectangle</span> {
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">leftPadding</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">visualPosition</span> <span class="operator">*</span> (<span class="name">control</span>.<span class="name">availableWidth</span> <span class="operator">-</span> <span class="name">width</span>)
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">topPadding</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">availableHeight</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">implicitWidth</span>: <span class="number">26</span>
          <span class="name">implicitHeight</span>: <span class="number">26</span>
          <span class="name">radius</span>: <span class="number">13</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">pressed</span> ? <span class="string">&quot;#f0f0f0&quot;</span> : <span class="string">&quot;#f6f6f6&quot;</span>
          <span class="name">border</span>.color: <span class="string">&quot;#bdbebf&quot;</span>
      }
  }

</pre>
<a name="customizing-spinbox"></a>
<h3 >Customizing SpinBox</h3>
<p><a href="qml-qtquick-controls2-spinbox.html">SpinBox</a> consists of four visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a>, <a href="qml-qtquick-controls2-spinbox.html#up.indicator-prop">up indicator</a>, and <a href="qml-qtquick-controls2-spinbox.html#down.indicator-prop">down indicator</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-spinbox-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-spinbox.html">SpinBox</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">value</span>: <span class="number">50</span>
      <span class="name">editable</span>: <span class="number">true</span>

      <span class="name">contentItem</span>: <span class="name">TextInput</span> {
          <span class="name">z</span>: <span class="number">2</span>
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">textFromValue</span>(<span class="name">control</span>.<span class="name">value</span>, <span class="name">control</span>.<span class="name">locale</span>)

          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">selectionColor</span>: <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">selectedTextColor</span>: <span class="string">&quot;#ffffff&quot;</span>
          <span class="name">horizontalAlignment</span>: <span class="name">Qt</span>.<span class="name">AlignHCenter</span>
          <span class="name">verticalAlignment</span>: <span class="name">Qt</span>.<span class="name">AlignVCenter</span>

          <span class="name">readOnly</span>: !<span class="name">control</span>.<span class="name">editable</span>
          <span class="name">validator</span>: <span class="name">control</span>.<span class="name">validator</span>
          <span class="name">inputMethodHints</span>: <span class="name">Qt</span>.<span class="name">ImhFormattedNumbersOnly</span>
      }

      <span class="name">up</span>.indicator: <span class="name">Rectangle</span> {
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">mirrored</span> ? <span class="number">0</span> : <span class="name">parent</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">width</span>
          <span class="name">height</span>: <span class="name">parent</span>.<span class="name">height</span>
          <span class="name">implicitWidth</span>: <span class="number">40</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">up</span>.<span class="name">pressed</span> ? <span class="string">&quot;#e4e4e4&quot;</span> : <span class="string">&quot;#f6f6f6&quot;</span>
          <span class="name">border</span>.color: <span class="name">enabled</span> ? <span class="string">&quot;#21be2b&quot;</span> : <span class="string">&quot;#bdbebf&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> {
              <span class="name">text</span>: <span class="string">&quot;+&quot;</span>
              <span class="name">font</span>.pixelSize: <span class="name">control</span>.<span class="name">font</span>.<span class="name">pixelSize</span> <span class="operator">*</span> <span class="number">2</span>
              <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">anchors</span>.fill: <span class="name">parent</span>
              <span class="name">fontSizeMode</span>: <span class="name">Text</span>.<span class="name">Fit</span>
              <span class="name">horizontalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignHCenter</span>
              <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          }
      }

      <span class="name">down</span>.indicator: <span class="name">Rectangle</span> {
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">mirrored</span> ? <span class="name">parent</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">width</span> : <span class="number">0</span>
          <span class="name">height</span>: <span class="name">parent</span>.<span class="name">height</span>
          <span class="name">implicitWidth</span>: <span class="number">40</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span>.<span class="name">pressed</span> ? <span class="string">&quot;#e4e4e4&quot;</span> : <span class="string">&quot;#f6f6f6&quot;</span>
          <span class="name">border</span>.color: <span class="name">enabled</span> ? <span class="string">&quot;#21be2b&quot;</span> : <span class="string">&quot;#bdbebf&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-text.html">Text</a></span> {
              <span class="name">text</span>: <span class="string">&quot;-&quot;</span>
              <span class="name">font</span>.pixelSize: <span class="name">control</span>.<span class="name">font</span>.<span class="name">pixelSize</span> <span class="operator">*</span> <span class="number">2</span>
              <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
              <span class="name">anchors</span>.fill: <span class="name">parent</span>
              <span class="name">fontSizeMode</span>: <span class="name">Text</span>.<span class="name">Fit</span>
              <span class="name">horizontalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignHCenter</span>
              <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          }
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">140</span>
          <span class="name">border</span>.color: <span class="string">&quot;#bdbebf&quot;</span>
      }
  }

</pre>
<a name="customizing-stackview"></a>
<h3 >Customizing StackView</h3>
<p><a href="qtquickcontrols2-chattutorial-example.html#stackview">StackView</a> can have a visual <a href="qml-qtquick-controls2-control.html#background-prop">background</a> item, and it allows customizing the transitions that are used for push, pop, and replace operations.</p>
<pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-stackview.html">StackView</a></span> {
      <span class="name">id</span>: <span class="name">control</span>

      <span class="name">popEnter</span>: <span class="name">Transition</span> {
          <span class="type"><a href="../qtquick/qml-qtquick-xanimator.html">XAnimator</a></span> {
              <span class="name">from</span>: (<span class="name">control</span>.<span class="name">mirrored</span> ? -<span class="number">1</span> : <span class="number">1</span>) <span class="operator">*</span> -<span class="name">control</span>.<span class="name">width</span>
              <span class="name">to</span>: <span class="number">0</span>
              <span class="name">duration</span>: <span class="number">400</span>
              <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutCubic</span>
          }
      }

      <span class="name">popExit</span>: <span class="name">Transition</span> {
          <span class="type"><a href="../qtquick/qml-qtquick-xanimator.html">XAnimator</a></span> {
              <span class="name">from</span>: <span class="number">0</span>
              <span class="name">to</span>: (<span class="name">control</span>.<span class="name">mirrored</span> ? -<span class="number">1</span> : <span class="number">1</span>) <span class="operator">*</span> <span class="name">control</span>.<span class="name">width</span>
              <span class="name">duration</span>: <span class="number">400</span>
              <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutCubic</span>
          }
      }
  }

</pre>
<a name="customizing-swipedelegate"></a>
<h3 >Customizing SwipeDelegate</h3>
<p><a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> consists of six visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>, <a href="qml-qtquick-controls2-abstractbutton.html#indicator-prop">indicator</a>, <code>swipe.left</code>, <code>swipe.right</code>, and <code>swipe.behind</code>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-swipedelegate-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;SwipeDelegate&quot;</span>)

      <span class="type"><a href="../qtqml/qml-qtqml-component.html">Component</a></span> {
          <span class="name">id</span>: <span class="name">component</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">color</span>: <span class="name">SwipeDelegate</span>.<span class="name">pressed</span> ? <span class="string">&quot;#333&quot;</span> : <span class="string">&quot;#444&quot;</span>
              <span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
              <span class="name">height</span>: <span class="name">parent</span>.<span class="name">height</span>
              <span class="name">clip</span>: <span class="number">true</span>

              <span class="type"><a href="qml-qtquick-controls2-label.html">Label</a></span> {
                  <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Press me!&quot;</span>)
                  <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
                  <span class="name">anchors</span>.centerIn: <span class="name">parent</span>
              }
          }
      }

      <span class="name">swipe</span>.left: <span class="name">component</span>
      <span class="name">swipe</span>.right: <span class="name">component</span>

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">enabled</span> ? (<span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>) : <span class="string">&quot;#bdbebf&quot;</span>
          <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>

          Behavior on <span class="name">x</span> {
              <span class="name">enabled</span>: !<span class="name">control</span>.<span class="name">down</span>
              <span class="type"><a href="../qtquick/qml-qtquick-numberanimation.html">NumberAnimation</a></span> {
                  <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">InOutCubic</span>
                  <span class="name">duration</span>: <span class="number">400</span>
              }
          }
      }
  }

</pre>
<a name="customizing-swipeview"></a>
<h3 >Customizing SwipeView</h3>
<p><a href="qml-qtquick-controls2-swipeview.html">SwipeView</a> can have a visual <a href="qml-qtquick-controls2-control.html#background-prop">background</a> item. The navigation is implemented by the <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>.</p>
<pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-swipeview.html">SwipeView</a></span> {
      <span class="name">id</span>: <span class="name">control</span>

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">color</span>: <span class="string">&quot;#eeeeee&quot;</span>
      }
  }

</pre>
<a name="customizing-switch"></a>
<h3 >Customizing Switch</h3>
<p>Switch consists of three visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a> and <a href="qml-qtquick-controls2-abstractbutton.html#indicator-prop">indicator</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-switch-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-switch.html">Switch</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Switch&quot;</span>)

      <span class="name">indicator</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">48</span>
          <span class="name">implicitHeight</span>: <span class="number">26</span>
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">leftPadding</span>
          <span class="name">y</span>: <span class="name">parent</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">radius</span>: <span class="number">13</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">checked</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#ffffff&quot;</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">checked</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#cccccc&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">x</span>: <span class="name">control</span>.<span class="name">checked</span> ? <span class="name">parent</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">width</span> : <span class="number">0</span>
              <span class="name">width</span>: <span class="number">26</span>
              <span class="name">height</span>: <span class="number">26</span>
              <span class="name">radius</span>: <span class="number">13</span>
              <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#cccccc&quot;</span> : <span class="string">&quot;#ffffff&quot;</span>
              <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">checked</span> ? (<span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>) : <span class="string">&quot;#999999&quot;</span>
          }
      }

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1.0</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          <span class="name">leftPadding</span>: <span class="name">control</span>.<span class="name">indicator</span>.<span class="name">width</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">spacing</span>
      }
  }

</pre>
<a name="customizing-switchdelegate"></a>
<h3 >Customizing SwitchDelegate</h3>
<p><a href="qml-qtquick-controls2-switchdelegate.html">SwitchDelegate</a> consists of three visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a> and <a href="qml-qtquick-controls2-abstractbutton.html#indicator-prop">indicator</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-switchdelegate-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-switchdelegate.html">SwitchDelegate</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;SwitchDelegate&quot;</span>)
      <span class="name">checked</span>: <span class="number">true</span>

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">rightPadding</span>: <span class="name">control</span>.<span class="name">indicator</span>.<span class="name">width</span> <span class="operator">+</span> <span class="name">control</span>.<span class="name">spacing</span>
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1.0</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
      }

      <span class="name">indicator</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">48</span>
          <span class="name">implicitHeight</span>: <span class="number">26</span>
          <span class="name">x</span>: <span class="name">control</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">width</span> <span class="operator">-</span> <span class="name">control</span>.<span class="name">rightPadding</span>
          <span class="name">y</span>: <span class="name">parent</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">radius</span>: <span class="number">13</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">checked</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;transparent&quot;</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">checked</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#cccccc&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">x</span>: <span class="name">control</span>.<span class="name">checked</span> ? <span class="name">parent</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">width</span> : <span class="number">0</span>
              <span class="name">width</span>: <span class="number">26</span>
              <span class="name">height</span>: <span class="number">26</span>
              <span class="name">radius</span>: <span class="number">13</span>
              <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#cccccc&quot;</span> : <span class="string">&quot;#ffffff&quot;</span>
              <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">checked</span> ? (<span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>) : <span class="string">&quot;#999999&quot;</span>
          }
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">100</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">visible</span>: <span class="name">control</span>.<span class="name">down</span> <span class="operator">||</span> <span class="name">control</span>.<span class="name">highlighted</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#bdbebf&quot;</span> : <span class="string">&quot;#eeeeee&quot;</span>
      }
  }

</pre>
<a name="customizing-tabbar"></a>
<h3 >Customizing TabBar</h3>
<p><a href="qtquickcontrols2-navigation.html#tabbar">TabBar</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, and <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-tabbar-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-tabbar.html">TabBar</a></span> {
      <span class="name">id</span>: <span class="name">control</span>

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">color</span>: <span class="string">&quot;#eeeeee&quot;</span>
      }

      <span class="type"><a href="qml-qtquick-controls2-tabbutton.html">TabButton</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Home&quot;</span>)
      }
      <span class="type"><a href="qml-qtquick-controls2-tabbutton.html">TabButton</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Discover&quot;</span>)
      }
      <span class="type"><a href="qml-qtquick-controls2-tabbutton.html">TabButton</a></span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Activity&quot;</span>)
      }
  }

</pre>
<a name="customizing-tabbutton"></a>
<h3 >Customizing TabButton</h3>
<p><a href="qml-qtquick-controls2-tabbutton.html">TabButton</a> can be customized in the same manner as <a href="qtquickcontrols2-customize.html#customizing-button">Button</a>.</p>
<a name="customizing-textarea"></a>
<h3 >Customizing TextArea</h3>
<p><a href="qml-qtquick-controls2-textarea.html">TextArea</a> consists of a <a href="qml-qtquick-controls2-textarea.html#background-prop">background</a> item.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-textarea-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-textarea.html">TextArea</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">placeholderText</span>: <span class="name">qsTr</span>(<span class="string">&quot;Enter description&quot;</span>)

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">200</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">enabled</span> ? <span class="string">&quot;#21be2b&quot;</span> : <span class="string">&quot;transparent&quot;</span>
      }
  }

</pre>
<a name="customizing-textfield"></a>
<h3 >Customizing TextField</h3>
<p><a href="qml-qtquick-controls2-textfield.html">TextField</a> consists of a <a href="qml-qtquick-controls2-textfield.html#background-prop">background</a> item.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-textfield-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-textfield.html">TextField</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">placeholderText</span>: <span class="name">qsTr</span>(<span class="string">&quot;Enter description&quot;</span>)

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">200</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">enabled</span> ? <span class="string">&quot;transparent&quot;</span> : <span class="string">&quot;#353637&quot;</span>
          <span class="name">border</span>.color: <span class="name">control</span>.<span class="name">enabled</span> ? <span class="string">&quot;#21be2b&quot;</span> : <span class="string">&quot;transparent&quot;</span>
      }
  }

</pre>
<a name="customizing-toolbar"></a>
<h3 >Customizing ToolBar</h3>
<p><a href="qml-qtquick-controls2-toolbar.html">ToolBar</a> consists of one visual item: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-toolbar-custom.png" alt="" /></p><pre class="qml">

  <span class="type"><a href="qml-qtquick-controls2-toolbar.html">ToolBar</a></span> {
      <span class="name">id</span>: <span class="name">control</span>

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">color</span>: <span class="string">&quot;#eeeeee&quot;</span>

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
              <span class="name">height</span>: <span class="number">1</span>
              <span class="name">anchors</span>.bottom: <span class="name">parent</span>.<span class="name">bottom</span>
              <span class="name">color</span>: <span class="string">&quot;transparent&quot;</span>
              <span class="name">border</span>.color: <span class="string">&quot;#21be2b&quot;</span>
          }
      }

      <span class="type"><a href="../qtquick/qml-qtquick-layouts-rowlayout.html">RowLayout</a></span> {
          <span class="name">anchors</span>.fill: <span class="name">parent</span>
          <span class="type"><a href="qml-qtquick-controls2-toolbutton.html">ToolButton</a></span> {
              <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Undo&quot;</span>)
          }
          <span class="type"><a href="qml-qtquick-controls2-toolbutton.html">ToolButton</a></span> {
              <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Redo&quot;</span>)
          }
      }
  }

</pre>
<a name="customizing-toolbutton"></a>
<h3 >Customizing ToolButton</h3>
<p><a href="qml-qtquick-controls2-toolbutton.html">ToolButton</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-toolbutton-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-toolbutton.html">ToolButton</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;ToolButton&quot;</span>)
      <span class="name">width</span>: <span class="number">120</span>

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1.0</span> : <span class="number">0.3</span>
          <span class="name">color</span>: <span class="name">control</span>.<span class="name">down</span> ? <span class="string">&quot;#17a81a&quot;</span> : <span class="string">&quot;#21be2b&quot;</span>
          <span class="name">horizontalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignHCenter</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          <span class="name">elide</span>: <span class="name">Text</span>.<span class="name">ElideRight</span>
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">implicitWidth</span>: <span class="number">40</span>
          <span class="name">implicitHeight</span>: <span class="number">40</span>
          <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">darker</span>(<span class="string">&quot;#33333333&quot;</span>, <span class="name">control</span>.<span class="name">enabled</span> <span class="operator">&amp;&amp;</span> (<span class="name">control</span>.<span class="name">checked</span> <span class="operator">||</span> <span class="name">control</span>.<span class="name">highlighted</span>) ? <span class="number">1.5</span> : <span class="number">1.0</span>)
          <span class="name">opacity</span>: <span class="name">enabled</span> ? <span class="number">1</span> : <span class="number">0.3</span>
          <span class="name">visible</span>: <span class="name">control</span>.<span class="name">down</span> <span class="operator">||</span> (<span class="name">control</span>.<span class="name">enabled</span> <span class="operator">&amp;&amp;</span> (<span class="name">control</span>.<span class="name">checked</span> <span class="operator">||</span> <span class="name">control</span>.<span class="name">highlighted</span>))
      }
  }

</pre>
<a name="customizing-toolseparator"></a>
<h3 >Customizing ToolSeparator</h3>
<p><a href="qml-qtquick-controls2-toolseparator.html">ToolSeparator</a> consists of two visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a> and <a href="qml-qtquick-controls2-control.html#contentItem-prop">content item</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-toolseparator-custom.png" alt="" /></p><pre class="qml">

  <span class="type"><a href="qml-qtquick-controls2-toolbar.html">ToolBar</a></span> {
      <span class="type"><a href="../qtquick/qml-qtquick-layouts-rowlayout.html">RowLayout</a></span> {
          <span class="name">anchors</span>.fill: <span class="name">parent</span>

          <span class="type"><a href="qml-qtquick-controls2-toolbutton.html">ToolButton</a></span> {
              <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Action 1&quot;</span>)
          }
          <span class="type"><a href="qml-qtquick-controls2-toolbutton.html">ToolButton</a></span> {
              <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Action 2&quot;</span>)
          }

          <span class="type"><a href="qml-qtquick-controls2-toolseparator.html">ToolSeparator</a></span> {
              <span class="name">padding</span>: <span class="name">vertical</span> ? <span class="number">10</span> : <span class="number">2</span>
              <span class="name">topPadding</span>: <span class="name">vertical</span> ? <span class="number">2</span> : <span class="number">10</span>
              <span class="name">bottomPadding</span>: <span class="name">vertical</span> ? <span class="number">2</span> : <span class="number">10</span>

              <span class="name">contentItem</span>: <span class="name">Rectangle</span> {
                  <span class="name">implicitWidth</span>: <span class="name">parent</span>.<span class="name">vertical</span> ? <span class="number">1</span> : <span class="number">24</span>
                  <span class="name">implicitHeight</span>: <span class="name">parent</span>.<span class="name">vertical</span> ? <span class="number">24</span> : <span class="number">1</span>
                  <span class="name">color</span>: <span class="string">&quot;#c3c3c3&quot;</span>
              }
          }

          <span class="type"><a href="qml-qtquick-controls2-toolbutton.html">ToolButton</a></span> {
              <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Action 3&quot;</span>)
          }
          <span class="type"><a href="qml-qtquick-controls2-toolbutton.html">ToolButton</a></span> {
              <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Action 4&quot;</span>)
          }

          <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
              <span class="name">Layout</span>.fillWidth: <span class="number">true</span>
          }
      }
  }

</pre>
<a name="customizing-tooltip"></a>
<h3 >Customizing ToolTip</h3>
<p><a href="qml-qtquick-controls2-tooltip.html">ToolTip</a> consists of two visual items: <a href="qml-qtquick-controls2-popup.html#background-prop">background</a> and <a href="qml-qtquick-controls2-popup.html#contentItem-prop">content item</a>.</p>
<pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-tooltip.html">ToolTip</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;A descriptive tool tip of what the button does&quot;</span>)

      <span class="name">contentItem</span>: <span class="name">Text</span> {
          <span class="name">text</span>: <span class="name">control</span>.<span class="name">text</span>
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
      }

      <span class="name">background</span>: <span class="name">Rectangle</span> {
          <span class="name">border</span>.color: <span class="string">&quot;#21be2b&quot;</span>
      }
  }

</pre>
<a name="customizing-tumbler"></a>
<h3 >Customizing Tumbler</h3>
<p>Tumbler consists of three visual items: <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a>, and <a href="qml-qtquick-controls2-tumbler.html#delegate-prop">delegate</a>.</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-tumbler-custom.png" alt="" /></p><pre class="qml">

  import QtQuick 2.6
  import QtQuick.Controls 2.1

  <span class="type"><a href="qml-qtquick-controls2-tumbler.html">Tumbler</a></span> {
      <span class="name">id</span>: <span class="name">control</span>
      <span class="name">model</span>: <span class="number">15</span>

      <span class="name">background</span>: <span class="name">Item</span> {
          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">opacity</span>: <span class="name">control</span>.<span class="name">enabled</span> ? <span class="number">0.2</span> : <span class="number">0.1</span>
              <span class="name">border</span>.color: <span class="string">&quot;#000000&quot;</span>
              <span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
              <span class="name">height</span>: <span class="number">1</span>
              <span class="name">anchors</span>.top: <span class="name">parent</span>.<span class="name">top</span>
          }

          <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
              <span class="name">opacity</span>: <span class="name">control</span>.<span class="name">enabled</span> ? <span class="number">0.2</span> : <span class="number">0.1</span>
              <span class="name">border</span>.color: <span class="string">&quot;#000000&quot;</span>
              <span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
              <span class="name">height</span>: <span class="number">1</span>
              <span class="name">anchors</span>.bottom: <span class="name">parent</span>.<span class="name">bottom</span>
          }
      }

      <span class="name">delegate</span>: <span class="name">Text</span> {
          <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Item %1&quot;</span>).<span class="name">arg</span>(<span class="name">modelData</span> <span class="operator">+</span> <span class="number">1</span>)
          <span class="name">font</span>: <span class="name">control</span>.<span class="name">font</span>
          <span class="name">horizontalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignHCenter</span>
          <span class="name">verticalAlignment</span>: <span class="name">Text</span>.<span class="name">AlignVCenter</span>
          <span class="name">opacity</span>: <span class="number">1.0</span> <span class="operator">-</span> <span class="name">Math</span>.<span class="name">abs</span>(<span class="name">Tumbler</span>.<span class="name">displacement</span>) <span class="operator">/</span> (<span class="name">control</span>.<span class="name">visibleItemCount</span> <span class="operator">/</span> <span class="number">2</span>)
      }

      <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">anchors</span>.horizontalCenter: <span class="name">control</span>.<span class="name">horizontalCenter</span>
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">height</span> <span class="operator">*</span> <span class="number">0.4</span>
          <span class="name">width</span>: <span class="number">40</span>
          <span class="name">height</span>: <span class="number">1</span>
          <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
      }

      <span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> {
          <span class="name">anchors</span>.horizontalCenter: <span class="name">control</span>.<span class="name">horizontalCenter</span>
          <span class="name">y</span>: <span class="name">control</span>.<span class="name">height</span> <span class="operator">*</span> <span class="number">0.6</span>
          <span class="name">width</span>: <span class="number">40</span>
          <span class="name">height</span>: <span class="number">1</span>
          <span class="name">color</span>: <span class="string">&quot;#21be2b&quot;</span>
      }
  }

</pre>
<p>If you want to define your own contentItem, use either a <a href="../qtquick/qml-qtquick-listview.html">ListView</a> or <a href="../qtquick/qml-qtquick-pathview.html">PathView</a> as the root item. For a wrapping Tumbler, use <a href="../qtquick/qml-qtquick-pathview.html">PathView</a>:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-controls2-tumbler.html">Tumbler</a></span> {
      <span class="name">id</span>: <span class="name">tumbler</span>

      <span class="name">contentItem</span>: <span class="name">PathView</span> {
          <span class="name">id</span>: <span class="name">pathView</span>
          <span class="name">model</span>: <span class="name">tumbler</span>.<span class="name">model</span>
          <span class="name">delegate</span>: <span class="name">tumbler</span>.<span class="name">delegate</span>
          <span class="name">clip</span>: <span class="number">true</span>
          <span class="name">pathItemCount</span>: <span class="name">tumbler</span>.<span class="name">visibleItemCount</span> <span class="operator">+</span> <span class="number">1</span>
          <span class="name">preferredHighlightBegin</span>: <span class="number">0.5</span>
          <span class="name">preferredHighlightEnd</span>: <span class="number">0.5</span>
          <span class="name">dragMargin</span>: <span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>

          <span class="name">path</span>: <span class="name">Path</span> {
              <span class="name">startX</span>: <span class="name">pathView</span>.<span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
              <span class="name">startY</span>: -<span class="name">pathView</span>.<span class="name">delegateHeight</span> <span class="operator">/</span> <span class="number">2</span>
              <span class="type"><a href="../qtquick/qml-qtquick-pathline.html">PathLine</a></span> {
                  <span class="name">x</span>: <span class="name">pathView</span>.<span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
                  <span class="name">y</span>: <span class="name">pathView</span>.<span class="name">pathItemCount</span> <span class="operator">*</span> <span class="name">pathView</span>.<span class="name">delegateHeight</span> <span class="operator">-</span> <span class="name">pathView</span>.<span class="name">delegateHeight</span> <span class="operator">/</span> <span class="number">2</span>
              }
          }

          property <span class="type">real</span> <span class="name">delegateHeight</span>: <span class="name">tumbler</span>.<span class="name">availableHeight</span> <span class="operator">/</span> <span class="name">tumbler</span>.<span class="name">visibleItemCount</span>
      }
  }

</pre>
<p>For a non-wrapping Tumbler, use <a href="../qtquick/qml-qtquick-listview.html">ListView</a>:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-controls2-tumbler.html">Tumbler</a></span> {
      <span class="name">id</span>: <span class="name">tumbler</span>

      <span class="name">contentItem</span>: <span class="name">ListView</span> {
          <span class="name">model</span>: <span class="name">tumbler</span>.<span class="name">model</span>
          <span class="name">delegate</span>: <span class="name">tumbler</span>.<span class="name">delegate</span>

          <span class="name">snapMode</span>: <span class="name">ListView</span>.<span class="name">SnapToItem</span>
          <span class="name">highlightRangeMode</span>: <span class="name">ListView</span>.<span class="name">StrictlyEnforceRange</span>
          <span class="name">preferredHighlightBegin</span>: <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">-</span> (<span class="name">height</span> <span class="operator">/</span> <span class="name">tumbler</span>.<span class="name">visibleItemCount</span> <span class="operator">/</span> <span class="number">2</span>)
          <span class="name">preferredHighlightEnd</span>: <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span> <span class="operator">+</span> (<span class="name">height</span> <span class="operator">/</span> <span class="name">tumbler</span>.<span class="name">visibleItemCount</span> <span class="operator">/</span> <span class="number">2</span>)
          <span class="name">clip</span>: <span class="number">true</span>
      }
  }

</pre>
</div>
<!-- @@@qtquickcontrols2-customize.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 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>