summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp8
-rw-r--r--src/widgets/dialogs/qdialog.cpp14
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp28
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp6
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp30
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp32
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp24
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp8
-rw-r--r--src/widgets/dialogs/qwizard.cpp208
-rw-r--r--src/widgets/doc/images/assistant-toolbar.pngbin0 -> 6532 bytes
-rw-r--r--src/widgets/doc/images/buttonbox-gnomelayout-horizontal.pngbin0 -> 4188 bytes
-rw-r--r--src/widgets/doc/images/buttonbox-gnomelayout-vertical.pngbin0 -> 5027 bytes
-rw-r--r--src/widgets/doc/images/buttonbox-kdelayout-horizontal.pngbin0 -> 2862 bytes
-rw-r--r--src/widgets/doc/images/buttonbox-kdelayout-vertical.pngbin0 -> 3298 bytes
-rw-r--r--src/widgets/doc/images/buttonbox-mac-modeless-horizontal.pngbin0 -> 4123 bytes
-rw-r--r--src/widgets/doc/images/buttonbox-mac-modeless-vertical.pngbin0 -> 5177 bytes
-rw-r--r--src/widgets/doc/images/buttonbox-maclayout-horizontal.pngbin0 -> 5409 bytes
-rw-r--r--src/widgets/doc/images/buttonbox-maclayout-vertical.pngbin0 -> 7340 bytes
-rw-r--r--src/widgets/doc/images/buttonbox-winlayout-horizontal.pngbin0 -> 2780 bytes
-rw-r--r--src/widgets/doc/images/buttonbox-winlayout-vertical.pngbin0 -> 3184 bytes
-rw-r--r--src/widgets/doc/images/cde-calendarwidget.pngbin0 -> 10187 bytes
-rw-r--r--src/widgets/doc/images/cde-checkbox.pngbin0 -> 1331 bytes
-rw-r--r--src/widgets/doc/images/cde-combobox.pngbin0 -> 1269 bytes
-rw-r--r--src/widgets/doc/images/cde-dateedit.pngbin0 -> 1183 bytes
-rw-r--r--src/widgets/doc/images/cde-datetimeedit.pngbin0 -> 1701 bytes
-rw-r--r--src/widgets/doc/images/cde-dial.pngbin0 -> 4481 bytes
-rw-r--r--src/widgets/doc/images/cde-doublespinbox.pngbin0 -> 1007 bytes
-rw-r--r--src/widgets/doc/images/cde-fontcombobox.pngbin0 -> 1603 bytes
-rw-r--r--src/widgets/doc/images/cde-frame.pngbin0 -> 2976 bytes
-rw-r--r--src/widgets/doc/images/cde-groupbox.pngbin0 -> 2592 bytes
-rw-r--r--src/widgets/doc/images/cde-horizontalscrollbar.pngbin0 -> 569 bytes
-rw-r--r--src/widgets/doc/images/cde-label.pngbin0 -> 1043 bytes
-rw-r--r--src/widgets/doc/images/cde-lcdnumber.pngbin0 -> 538 bytes
-rw-r--r--src/widgets/doc/images/cde-lineedit.pngbin0 -> 1355 bytes
-rw-r--r--src/widgets/doc/images/cde-listview.pngbin0 -> 5166 bytes
-rw-r--r--src/widgets/doc/images/cde-progressbar.pngbin0 -> 934 bytes
-rw-r--r--src/widgets/doc/images/cde-pushbutton.pngbin0 -> 1099 bytes
-rw-r--r--src/widgets/doc/images/cde-radiobutton.pngbin0 -> 1562 bytes
-rw-r--r--src/widgets/doc/images/cde-slider.pngbin0 -> 526 bytes
-rw-r--r--src/widgets/doc/images/cde-spinbox.pngbin0 -> 863 bytes
-rw-r--r--src/widgets/doc/images/cde-tableview.pngbin0 -> 2467 bytes
-rw-r--r--src/widgets/doc/images/cde-tabwidget.pngbin0 -> 2483 bytes
-rw-r--r--src/widgets/doc/images/cde-textedit.pngbin0 -> 7374 bytes
-rw-r--r--src/widgets/doc/images/cde-timeedit.pngbin0 -> 1248 bytes
-rw-r--r--src/widgets/doc/images/cde-toolbox.pngbin0 -> 1813 bytes
-rw-r--r--src/widgets/doc/images/cde-toolbutton.pngbin0 -> 1169 bytes
-rw-r--r--src/widgets/doc/images/cde-treeview.pngbin0 -> 6703 bytes
-rw-r--r--src/widgets/doc/images/checkboxes-exclusive.pngbin0 -> 5079 bytes
-rw-r--r--src/widgets/doc/images/checkboxes-non-exclusive.pngbin0 -> 5614 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-calendarwidget.pngbin0 -> 9748 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-checkbox.pngbin0 -> 1416 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-combobox.pngbin0 -> 2348 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-dateedit.pngbin0 -> 1369 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-datetimeedit.pngbin0 -> 1892 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-dial.pngbin0 -> 4297 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-doublespinbox.pngbin0 -> 1141 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-fontcombobox.pngbin0 -> 1835 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-frame.pngbin0 -> 2989 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-groupbox.pngbin0 -> 2630 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-horizontalscrollbar.pngbin0 -> 837 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-label.pngbin0 -> 1043 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-lcdnumber.pngbin0 -> 538 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-lineedit.pngbin0 -> 1406 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-listview.pngbin0 -> 5559 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-progressbar.pngbin0 -> 1292 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-pushbutton-menu.pngbin0 -> 3177 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-pushbutton.pngbin0 -> 1332 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-radiobutton.pngbin0 -> 1782 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-slider.pngbin0 -> 671 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-spinbox.pngbin0 -> 983 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-tableview.pngbin0 -> 2465 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-tabwidget.pngbin0 -> 5007 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-textedit.pngbin0 -> 7560 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-timeedit.pngbin0 -> 1388 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-toolbox.pngbin0 -> 1445 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-toolbutton.pngbin0 -> 1469 bytes
-rw-r--r--src/widgets/doc/images/cleanlooks-treeview.pngbin0 -> 6981 bytes
-rw-r--r--src/widgets/doc/images/designer-stylesheet-options.pngbin0 -> 18914 bytes
-rw-r--r--src/widgets/doc/images/designer-stylesheet-usage.pngbin0 -> 8128 bytes
-rw-r--r--src/widgets/doc/images/designer-validator-highlighter.pngbin0 -> 27153 bytes
-rw-r--r--src/widgets/doc/images/filedialogurls.pngbin0 -> 29132 bytes
-rw-r--r--src/widgets/doc/images/frames.pngbin0 -> 25735 bytes
-rw-r--r--src/widgets/doc/images/graphicsview-ellipseitem-pie.pngbin0 -> 6683 bytes
-rw-r--r--src/widgets/doc/images/graphicsview-ellipseitem.pngbin0 -> 5801 bytes
-rw-r--r--src/widgets/doc/images/graphicsview-items.pngbin0 -> 62593 bytes
-rw-r--r--src/widgets/doc/images/graphicsview-pathitem.pngbin0 -> 5710 bytes
-rw-r--r--src/widgets/doc/images/graphicsview-pixmapitem.pngbin0 -> 10764 bytes
-rw-r--r--src/widgets/doc/images/graphicsview-polygonitem.pngbin0 -> 5829 bytes
-rw-r--r--src/widgets/doc/images/graphicsview-rectitem.pngbin0 -> 3305 bytes
-rw-r--r--src/widgets/doc/images/graphicsview-zorder.pngbin0 -> 6724 bytes
-rw-r--r--src/widgets/doc/images/gridlayout.pngbin0 -> 1445 bytes
-rw-r--r--src/widgets/doc/images/gtk-calendarwidget.pngbin0 -> 16761 bytes
-rw-r--r--src/widgets/doc/images/gtk-checkbox.pngbin0 -> 2323 bytes
-rw-r--r--src/widgets/doc/images/gtk-combobox.pngbin0 -> 2730 bytes
-rw-r--r--src/widgets/doc/images/gtk-dateedit.pngbin0 -> 2163 bytes
-rw-r--r--src/widgets/doc/images/gtk-datetimeedit.pngbin0 -> 2923 bytes
-rw-r--r--src/widgets/doc/images/gtk-dial.pngbin0 -> 7221 bytes
-rw-r--r--src/widgets/doc/images/gtk-doublespinbox.pngbin0 -> 2325 bytes
-rw-r--r--src/widgets/doc/images/gtk-fontcombobox.pngbin0 -> 3022 bytes
-rw-r--r--src/widgets/doc/images/gtk-frame.pngbin0 -> 2340 bytes
-rw-r--r--src/widgets/doc/images/gtk-groupbox.pngbin0 -> 6650 bytes
-rw-r--r--src/widgets/doc/images/gtk-horizontalscrollbar.pngbin0 -> 1701 bytes
-rw-r--r--src/widgets/doc/images/gtk-label.pngbin0 -> 1582 bytes
-rw-r--r--src/widgets/doc/images/gtk-lcdnumber.pngbin0 -> 1193 bytes
-rw-r--r--src/widgets/doc/images/gtk-lineedit.pngbin0 -> 2528 bytes
-rw-r--r--src/widgets/doc/images/gtk-listview.pngbin0 -> 8493 bytes
-rw-r--r--src/widgets/doc/images/gtk-progressbar.pngbin0 -> 2228 bytes
-rw-r--r--src/widgets/doc/images/gtk-pushbutton.pngbin0 -> 2153 bytes
-rw-r--r--src/widgets/doc/images/gtk-radiobutton.pngbin0 -> 3142 bytes
-rw-r--r--src/widgets/doc/images/gtk-slider.pngbin0 -> 1359 bytes
-rw-r--r--src/widgets/doc/images/gtk-spinbox.pngbin0 -> 2078 bytes
-rw-r--r--src/widgets/doc/images/gtk-tableview.pngbin0 -> 8364 bytes
-rw-r--r--src/widgets/doc/images/gtk-tabwidget.pngbin0 -> 8179 bytes
-rw-r--r--src/widgets/doc/images/gtk-textedit.pngbin0 -> 12641 bytes
-rw-r--r--src/widgets/doc/images/gtk-timeedit.pngbin0 -> 2621 bytes
-rw-r--r--src/widgets/doc/images/gtk-toolbox.pngbin0 -> 4240 bytes
-rw-r--r--src/widgets/doc/images/gtk-toolbutton.pngbin0 -> 2260 bytes
-rw-r--r--src/widgets/doc/images/gtk-treeview.pngbin0 -> 9722 bytes
-rw-r--r--src/widgets/doc/images/javastyle/branchindicatorimage.pngbin0 -> 18867 bytes
-rw-r--r--src/widgets/doc/images/javastyle/button.pngbin0 -> 5475 bytes
-rw-r--r--src/widgets/doc/images/javastyle/checkbox.pngbin0 -> 3634 bytes
-rw-r--r--src/widgets/doc/images/javastyle/checkboxexample.pngbin0 -> 911 bytes
-rw-r--r--src/widgets/doc/images/javastyle/combobox.pngbin0 -> 3537 bytes
-rw-r--r--src/widgets/doc/images/javastyle/comboboximage.pngbin0 -> 6527 bytes
-rw-r--r--src/widgets/doc/images/javastyle/conceptualpushbuttontree.pngbin0 -> 3590 bytes
-rw-r--r--src/widgets/doc/images/javastyle/dockwidget.pngbin0 -> 7181 bytes
-rw-r--r--src/widgets/doc/images/javastyle/dockwidgetimage.pngbin0 -> 21774 bytes
-rw-r--r--src/widgets/doc/images/javastyle/groupbox.pngbin0 -> 2010 bytes
-rw-r--r--src/widgets/doc/images/javastyle/groupboximage.pngbin0 -> 7067 bytes
-rw-r--r--src/widgets/doc/images/javastyle/header.pngbin0 -> 4399 bytes
-rw-r--r--src/widgets/doc/images/javastyle/headerimage.pngbin0 -> 6474 bytes
-rw-r--r--src/widgets/doc/images/javastyle/menu.pngbin0 -> 6508 bytes
-rw-r--r--src/widgets/doc/images/javastyle/menubar.pngbin0 -> 4315 bytes
-rw-r--r--src/widgets/doc/images/javastyle/menubarimage.pngbin0 -> 4487 bytes
-rw-r--r--src/widgets/doc/images/javastyle/menuimage.pngbin0 -> 5584 bytes
-rw-r--r--src/widgets/doc/images/javastyle/progressbar.pngbin0 -> 4493 bytes
-rw-r--r--src/widgets/doc/images/javastyle/progressbarimage.pngbin0 -> 6921 bytes
-rw-r--r--src/widgets/doc/images/javastyle/pushbutton.pngbin0 -> 6820 bytes
-rw-r--r--src/widgets/doc/images/javastyle/rubberband.pngbin0 -> 765 bytes
-rw-r--r--src/widgets/doc/images/javastyle/rubberbandimage.pngbin0 -> 6452 bytes
-rw-r--r--src/widgets/doc/images/javastyle/scrollbar.pngbin0 -> 7199 bytes
-rw-r--r--src/widgets/doc/images/javastyle/scrollbarimage.pngbin0 -> 6196 bytes
-rw-r--r--src/widgets/doc/images/javastyle/sizegrip.pngbin0 -> 708 bytes
-rw-r--r--src/widgets/doc/images/javastyle/sizegripimage.pngbin0 -> 1793 bytes
-rw-r--r--src/widgets/doc/images/javastyle/slider.pngbin0 -> 2844 bytes
-rw-r--r--src/widgets/doc/images/javastyle/sliderimage.pngbin0 -> 3442 bytes
-rw-r--r--src/widgets/doc/images/javastyle/spinbox.pngbin0 -> 2864 bytes
-rw-r--r--src/widgets/doc/images/javastyle/spinboximage.pngbin0 -> 4544 bytes
-rw-r--r--src/widgets/doc/images/javastyle/tab.pngbin0 -> 12176 bytes
-rw-r--r--src/widgets/doc/images/javastyle/tabwidget.pngbin0 -> 4725 bytes
-rw-r--r--src/widgets/doc/images/javastyle/titlebar.pngbin0 -> 2609 bytes
-rw-r--r--src/widgets/doc/images/javastyle/titlebarimage.pngbin0 -> 6882 bytes
-rw-r--r--src/widgets/doc/images/javastyle/toolbar.pngbin0 -> 6303 bytes
-rw-r--r--src/widgets/doc/images/javastyle/toolbarimage.pngbin0 -> 8245 bytes
-rw-r--r--src/widgets/doc/images/javastyle/toolbox.pngbin0 -> 3211 bytes
-rw-r--r--src/widgets/doc/images/javastyle/toolboximage.pngbin0 -> 5580 bytes
-rw-r--r--src/widgets/doc/images/javastyle/toolbutton.pngbin0 -> 4487 bytes
-rw-r--r--src/widgets/doc/images/javastyle/toolbuttonimage.pngbin0 -> 5124 bytes
-rw-r--r--src/widgets/doc/images/javastyle/windowstabimage.pngbin0 -> 6898 bytes
-rw-r--r--src/widgets/doc/images/licensewizard-flow.pngbin0 -> 15306 bytes
-rw-r--r--src/widgets/doc/images/macintosh-calendarwidget.pngbin0 -> 13560 bytes
-rw-r--r--src/widgets/doc/images/macintosh-checkbox.pngbin0 -> 2473 bytes
-rw-r--r--src/widgets/doc/images/macintosh-combobox.pngbin0 -> 3273 bytes
-rw-r--r--src/widgets/doc/images/macintosh-dateedit.pngbin0 -> 1703 bytes
-rw-r--r--src/widgets/doc/images/macintosh-datetimeedit.pngbin0 -> 2633 bytes
-rw-r--r--src/widgets/doc/images/macintosh-dial.pngbin0 -> 2563 bytes
-rw-r--r--src/widgets/doc/images/macintosh-doublespinbox.pngbin0 -> 2306 bytes
-rw-r--r--src/widgets/doc/images/macintosh-fontcombobox.pngbin0 -> 2967 bytes
-rw-r--r--src/widgets/doc/images/macintosh-frame.pngbin0 -> 6187 bytes
-rw-r--r--src/widgets/doc/images/macintosh-groupbox.pngbin0 -> 6469 bytes
-rw-r--r--src/widgets/doc/images/macintosh-horizontalscrollbar.pngbin0 -> 2242 bytes
-rw-r--r--src/widgets/doc/images/macintosh-label.pngbin0 -> 1450 bytes
-rw-r--r--src/widgets/doc/images/macintosh-lcdnumber.pngbin0 -> 492 bytes
-rw-r--r--src/widgets/doc/images/macintosh-lineedit.pngbin0 -> 1854 bytes
-rw-r--r--src/widgets/doc/images/macintosh-listview.pngbin0 -> 9987 bytes
-rw-r--r--src/widgets/doc/images/macintosh-menu.pngbin0 -> 6891 bytes
-rw-r--r--src/widgets/doc/images/macintosh-progressbar.pngbin0 -> 1127 bytes
-rw-r--r--src/widgets/doc/images/macintosh-pushbutton.pngbin0 -> 2966 bytes
-rw-r--r--src/widgets/doc/images/macintosh-radiobutton.pngbin0 -> 2914 bytes
-rw-r--r--src/widgets/doc/images/macintosh-slider.pngbin0 -> 1694 bytes
-rw-r--r--src/widgets/doc/images/macintosh-spinbox.pngbin0 -> 1964 bytes
-rw-r--r--src/widgets/doc/images/macintosh-tableview.pngbin0 -> 10024 bytes
-rw-r--r--src/widgets/doc/images/macintosh-tabwidget.pngbin0 -> 9562 bytes
-rw-r--r--src/widgets/doc/images/macintosh-textedit.pngbin0 -> 7845 bytes
-rw-r--r--src/widgets/doc/images/macintosh-timeedit.pngbin0 -> 2244 bytes
-rw-r--r--src/widgets/doc/images/macintosh-toolbox.pngbin0 -> 2576 bytes
-rw-r--r--src/widgets/doc/images/macintosh-toolbutton.pngbin0 -> 2003 bytes
-rw-r--r--src/widgets/doc/images/macintosh-treeview.pngbin0 -> 11728 bytes
-rw-r--r--src/widgets/doc/images/mainwindow-docks.pngbin0 -> 37240 bytes
-rw-r--r--src/widgets/doc/images/mainwindowlayout.pngbin0 -> 6782 bytes
-rw-r--r--src/widgets/doc/images/mdi-cascade.pngbin0 -> 14590 bytes
-rw-r--r--src/widgets/doc/images/mdi-tile.pngbin0 -> 31624 bytes
-rw-r--r--src/widgets/doc/images/motif-calendarwidget.pngbin0 -> 9989 bytes
-rw-r--r--src/widgets/doc/images/motif-checkbox.pngbin0 -> 1284 bytes
-rw-r--r--src/widgets/doc/images/motif-combobox.pngbin0 -> 1276 bytes
-rw-r--r--src/widgets/doc/images/motif-dateedit.pngbin0 -> 1214 bytes
-rw-r--r--src/widgets/doc/images/motif-datetimeedit.pngbin0 -> 1730 bytes
-rw-r--r--src/widgets/doc/images/motif-dial.pngbin0 -> 2017 bytes
-rw-r--r--src/widgets/doc/images/motif-doublespinbox.pngbin0 -> 1019 bytes
-rw-r--r--src/widgets/doc/images/motif-fontcombobox.pngbin0 -> 1633 bytes
-rw-r--r--src/widgets/doc/images/motif-frame.pngbin0 -> 5631 bytes
-rw-r--r--src/widgets/doc/images/motif-groupbox.pngbin0 -> 2514 bytes
-rw-r--r--src/widgets/doc/images/motif-horizontalscrollbar.pngbin0 -> 628 bytes
-rw-r--r--src/widgets/doc/images/motif-label.pngbin0 -> 699 bytes
-rw-r--r--src/widgets/doc/images/motif-lcdnumber.pngbin0 -> 538 bytes
-rw-r--r--src/widgets/doc/images/motif-lineedit.pngbin0 -> 1360 bytes
-rw-r--r--src/widgets/doc/images/motif-listview.pngbin0 -> 5189 bytes
-rw-r--r--src/widgets/doc/images/motif-menubar.pngbin0 -> 1350 bytes
-rw-r--r--src/widgets/doc/images/motif-progressbar.pngbin0 -> 927 bytes
-rw-r--r--src/widgets/doc/images/motif-pushbutton.pngbin0 -> 1045 bytes
-rw-r--r--src/widgets/doc/images/motif-radiobutton.pngbin0 -> 1545 bytes
-rw-r--r--src/widgets/doc/images/motif-slider.pngbin0 -> 543 bytes
-rw-r--r--src/widgets/doc/images/motif-spinbox.pngbin0 -> 875 bytes
-rw-r--r--src/widgets/doc/images/motif-tableview.pngbin0 -> 3102 bytes
-rw-r--r--src/widgets/doc/images/motif-tabwidget.pngbin0 -> 2490 bytes
-rw-r--r--src/widgets/doc/images/motif-textedit.pngbin0 -> 7378 bytes
-rw-r--r--src/widgets/doc/images/motif-timeedit.pngbin0 -> 1280 bytes
-rw-r--r--src/widgets/doc/images/motif-toolbox.pngbin0 -> 1667 bytes
-rw-r--r--src/widgets/doc/images/motif-toolbutton.pngbin0 -> 1152 bytes
-rw-r--r--src/widgets/doc/images/motif-treeview.pngbin0 -> 6386 bytes
-rw-r--r--src/widgets/doc/images/msgbox1.pngbin0 -> 4529 bytes
-rw-r--r--src/widgets/doc/images/msgbox2.pngbin0 -> 9175 bytes
-rw-r--r--src/widgets/doc/images/msgbox3.pngbin0 -> 9589 bytes
-rw-r--r--src/widgets/doc/images/msgbox4.pngbin0 -> 17520 bytes
-rw-r--r--src/widgets/doc/images/pangesture.pngbin0 -> 7153 bytes
-rw-r--r--src/widgets/doc/images/parent-child-widgets.pngbin0 -> 47824 bytes
-rw-r--r--src/widgets/doc/images/pinchgesture.pngbin0 -> 10094 bytes
-rw-r--r--src/widgets/doc/images/plastique-calendarwidget.pngbin0 -> 9629 bytes
-rw-r--r--src/widgets/doc/images/plastique-checkbox.pngbin0 -> 1069 bytes
-rw-r--r--src/widgets/doc/images/plastique-colordialog.pngbin0 -> 22595 bytes
-rw-r--r--src/widgets/doc/images/plastique-combobox.pngbin0 -> 1714 bytes
-rw-r--r--src/widgets/doc/images/plastique-dateedit.pngbin0 -> 1271 bytes
-rw-r--r--src/widgets/doc/images/plastique-datetimeedit.pngbin0 -> 1771 bytes
-rw-r--r--src/widgets/doc/images/plastique-dial.pngbin0 -> 2995 bytes
-rw-r--r--src/widgets/doc/images/plastique-doublespinbox.pngbin0 -> 1102 bytes
-rw-r--r--src/widgets/doc/images/plastique-fontcombobox.pngbin0 -> 1904 bytes
-rw-r--r--src/widgets/doc/images/plastique-fontdialog.pngbin0 -> 23835 bytes
-rw-r--r--src/widgets/doc/images/plastique-frame.pngbin0 -> 5616 bytes
-rw-r--r--src/widgets/doc/images/plastique-groupbox.pngbin0 -> 2704 bytes
-rw-r--r--src/widgets/doc/images/plastique-horizontalscrollbar.pngbin0 -> 868 bytes
-rw-r--r--src/widgets/doc/images/plastique-label.pngbin0 -> 696 bytes
-rw-r--r--src/widgets/doc/images/plastique-lcdnumber.pngbin0 -> 470 bytes
-rw-r--r--src/widgets/doc/images/plastique-lineedit.pngbin0 -> 1015 bytes
-rw-r--r--src/widgets/doc/images/plastique-listview.pngbin0 -> 4895 bytes
-rw-r--r--src/widgets/doc/images/plastique-menu.pngbin0 -> 3867 bytes
-rw-r--r--src/widgets/doc/images/plastique-menubar.pngbin0 -> 1030 bytes
-rw-r--r--src/widgets/doc/images/plastique-progressbar.pngbin0 -> 1044 bytes
-rw-r--r--src/widgets/doc/images/plastique-progressdialog.pngbin0 -> 6311 bytes
-rw-r--r--src/widgets/doc/images/plastique-pushbutton-menu.pngbin0 -> 3354 bytes
-rw-r--r--src/widgets/doc/images/plastique-pushbutton.pngbin0 -> 1409 bytes
-rw-r--r--src/widgets/doc/images/plastique-radiobutton.pngbin0 -> 1667 bytes
-rw-r--r--src/widgets/doc/images/plastique-sizegrip.pngbin0 -> 8168 bytes
-rw-r--r--src/widgets/doc/images/plastique-slider.pngbin0 -> 632 bytes
-rw-r--r--src/widgets/doc/images/plastique-spinbox.pngbin0 -> 968 bytes
-rw-r--r--src/widgets/doc/images/plastique-statusbar.pngbin0 -> 878 bytes
-rw-r--r--src/widgets/doc/images/plastique-tabbar-truncated.pngbin0 -> 2986 bytes
-rw-r--r--src/widgets/doc/images/plastique-tabbar.pngbin0 -> 2721 bytes
-rw-r--r--src/widgets/doc/images/plastique-tableview.pngbin0 -> 6052 bytes
-rw-r--r--src/widgets/doc/images/plastique-tabwidget.pngbin0 -> 4705 bytes
-rw-r--r--src/widgets/doc/images/plastique-textedit.pngbin0 -> 5141 bytes
-rw-r--r--src/widgets/doc/images/plastique-timeedit.pngbin0 -> 1336 bytes
-rw-r--r--src/widgets/doc/images/plastique-toolbox.pngbin0 -> 1858 bytes
-rw-r--r--src/widgets/doc/images/plastique-toolbutton.pngbin0 -> 1254 bytes
-rw-r--r--src/widgets/doc/images/plastique-treeview.pngbin0 -> 8453 bytes
-rw-r--r--src/widgets/doc/images/progressBar-stylesheet.pngbin0 -> 455 bytes
-rw-r--r--src/widgets/doc/images/progressBar2-stylesheet.pngbin0 -> 494 bytes
-rw-r--r--src/widgets/doc/images/propagation-custom.pngbin0 -> 163413 bytes
-rw-r--r--src/widgets/doc/images/propagation-standard.pngbin0 -> 83382 bytes
-rw-r--r--src/widgets/doc/images/qcalendarwidget-grid.pngbin0 -> 9601 bytes
-rw-r--r--src/widgets/doc/images/qcalendarwidget-maximum.pngbin0 -> 9709 bytes
-rw-r--r--src/widgets/doc/images/qcalendarwidget-minimum.pngbin0 -> 9770 bytes
-rw-r--r--src/widgets/doc/images/qcolumnview.pngbin0 -> 3075 bytes
-rw-r--r--src/widgets/doc/images/qdesktopwidget.pngbin0 -> 42328 bytes
-rw-r--r--src/widgets/doc/images/qformlayout-kde.pngbin0 -> 1703 bytes
-rw-r--r--src/widgets/doc/images/qformlayout-mac.pngbin0 -> 1706 bytes
-rw-r--r--src/widgets/doc/images/qformlayout-qpe.pngbin0 -> 1764 bytes
-rw-r--r--src/widgets/doc/images/qformlayout-win.pngbin0 -> 1743 bytes
-rw-r--r--src/widgets/doc/images/qformlayout-with-6-children.pngbin0 -> 3264 bytes
-rw-r--r--src/widgets/doc/images/qgraphicsproxywidget-embed.pngbin0 -> 2199 bytes
-rw-r--r--src/widgets/doc/images/qgridlayout-with-5-children.pngbin0 -> 3201 bytes
-rw-r--r--src/widgets/doc/images/qhboxlayout-with-5-children.pngbin0 -> 2652 bytes
-rw-r--r--src/widgets/doc/images/qmdisubwindowlayout.pngbin0 -> 3153 bytes
-rw-r--r--src/widgets/doc/images/qscrollarea-noscrollbars.pngbin0 -> 54671 bytes
-rw-r--r--src/widgets/doc/images/qscrollarea-onescrollbar.pngbin0 -> 77476 bytes
-rw-r--r--src/widgets/doc/images/qscrollarea-twoscrollbars.pngbin0 -> 78046 bytes
-rw-r--r--src/widgets/doc/images/qscrollbar-picture.pngbin0 -> 6568 bytes
-rw-r--r--src/widgets/doc/images/qscrollbar-values.pngbin0 -> 15902 bytes
-rw-r--r--src/widgets/doc/images/qspinbox-plusminus.pngbin0 -> 375 bytes
-rw-r--r--src/widgets/doc/images/qspinbox-updown.pngbin0 -> 402 bytes
-rw-r--r--src/widgets/doc/images/qstyle-comboboxes.pngbin0 -> 19437 bytes
-rw-r--r--src/widgets/doc/images/qstyleoptiontoolbar-position.pngbin0 -> 13707 bytes
-rw-r--r--src/widgets/doc/images/qtableview-resized.pngbin0 -> 42232 bytes
-rw-r--r--src/widgets/doc/images/qtwizard-aero1.pngbin0 -> 11749 bytes
-rw-r--r--src/widgets/doc/images/qtwizard-aero2.pngbin0 -> 16560 bytes
-rw-r--r--src/widgets/doc/images/qtwizard-classic1.pngbin0 -> 39640 bytes
-rw-r--r--src/widgets/doc/images/qtwizard-classic2.pngbin0 -> 8616 bytes
-rw-r--r--src/widgets/doc/images/qtwizard-mac1.pngbin0 -> 25478 bytes
-rw-r--r--src/widgets/doc/images/qtwizard-mac2.pngbin0 -> 29591 bytes
-rw-r--r--src/widgets/doc/images/qtwizard-macpage.pngbin0 -> 23095 bytes
-rw-r--r--src/widgets/doc/images/qtwizard-modern1.pngbin0 -> 45093 bytes
-rw-r--r--src/widgets/doc/images/qtwizard-modern2.pngbin0 -> 15081 bytes
-rw-r--r--src/widgets/doc/images/qtwizard-nonmacpage.pngbin0 -> 26557 bytes
-rw-r--r--src/widgets/doc/images/qundoview.pngbin0 -> 5993 bytes
-rw-r--r--src/widgets/doc/images/qvboxlayout-with-5-children.pngbin0 -> 2974 bytes
-rw-r--r--src/widgets/doc/images/simpleanchorlayout-example.pngbin0 -> 13463 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-border-image-normal.pngbin0 -> 5769 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-border-image-stretched.pngbin0 -> 12170 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-border-image-wrong.pngbin0 -> 12887 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-boxmodel.pngbin0 -> 18144 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-branch-closed.pngbin0 -> 334 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-branch-end.pngbin0 -> 182 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-branch-more.pngbin0 -> 136 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-branch-open.pngbin0 -> 346 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-coffee-cleanlooks.pngbin0 -> 14820 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-coffee-xp.pngbin0 -> 14200 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-pagefold-mac.pngbin0 -> 20618 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-pagefold.pngbin0 -> 15989 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-redbutton1.pngbin0 -> 378 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-redbutton2.pngbin0 -> 410 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-redbutton3.pngbin0 -> 664 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-scrollbar1.pngbin0 -> 150 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-scrollbar2.pngbin0 -> 169 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-treeview.pngbin0 -> 2412 bytes
-rw-r--r--src/widgets/doc/images/stylesheet-vline.pngbin0 -> 124 bytes
-rw-r--r--src/widgets/doc/images/swipegesture.pngbin0 -> 6864 bytes
-rw-r--r--src/widgets/doc/images/system-tray.pngbin0 -> 6326 bytes
-rw-r--r--src/widgets/doc/images/tabWidget-stylesheet1.pngbin0 -> 1321 bytes
-rw-r--r--src/widgets/doc/images/tabWidget-stylesheet2.pngbin0 -> 1434 bytes
-rw-r--r--src/widgets/doc/images/tabWidget-stylesheet3.pngbin0 -> 1206 bytes
-rw-r--r--src/widgets/doc/images/tableWidget-stylesheet.pngbin0 -> 3478 bytes
-rw-r--r--src/widgets/doc/images/widgetdelegate.pngbin0 -> 7449 bytes
-rw-r--r--src/widgets/doc/images/windows-calendarwidget.pngbin0 -> 5055 bytes
-rw-r--r--src/widgets/doc/images/windows-checkbox.pngbin0 -> 929 bytes
-rw-r--r--src/widgets/doc/images/windows-combobox.pngbin0 -> 1002 bytes
-rw-r--r--src/widgets/doc/images/windows-dateedit.pngbin0 -> 817 bytes
-rw-r--r--src/widgets/doc/images/windows-datetimeedit.pngbin0 -> 1026 bytes
-rw-r--r--src/widgets/doc/images/windows-dial.pngbin0 -> 4598 bytes
-rw-r--r--src/widgets/doc/images/windows-doublespinbox.pngbin0 -> 762 bytes
-rw-r--r--src/widgets/doc/images/windows-fontcombobox.pngbin0 -> 1022 bytes
-rw-r--r--src/widgets/doc/images/windows-frame.pngbin0 -> 1837 bytes
-rw-r--r--src/widgets/doc/images/windows-groupbox.pngbin0 -> 1617 bytes
-rw-r--r--src/widgets/doc/images/windows-horizontalscrollbar.pngbin0 -> 566 bytes
-rw-r--r--src/widgets/doc/images/windows-label.pngbin0 -> 696 bytes
-rw-r--r--src/widgets/doc/images/windows-lcdnumber.pngbin0 -> 491 bytes
-rw-r--r--src/widgets/doc/images/windows-lineedit.pngbin0 -> 884 bytes
-rw-r--r--src/widgets/doc/images/windows-listview.pngbin0 -> 2781 bytes
-rw-r--r--src/widgets/doc/images/windows-progressbar.pngbin0 -> 674 bytes
-rw-r--r--src/widgets/doc/images/windows-pushbutton.pngbin0 -> 722 bytes
-rw-r--r--src/widgets/doc/images/windows-radiobutton.pngbin0 -> 1005 bytes
-rw-r--r--src/widgets/doc/images/windows-slider.pngbin0 -> 485 bytes
-rw-r--r--src/widgets/doc/images/windows-spinbox.pngbin0 -> 667 bytes
-rw-r--r--src/widgets/doc/images/windows-tableview.pngbin0 -> 1738 bytes
-rw-r--r--src/widgets/doc/images/windows-tabwidget.pngbin0 -> 1707 bytes
-rw-r--r--src/widgets/doc/images/windows-textedit.pngbin0 -> 3192 bytes
-rw-r--r--src/widgets/doc/images/windows-timeedit.pngbin0 -> 873 bytes
-rw-r--r--src/widgets/doc/images/windows-toolbox.pngbin0 -> 925 bytes
-rw-r--r--src/widgets/doc/images/windows-toolbutton.pngbin0 -> 771 bytes
-rw-r--r--src/widgets/doc/images/windows-treeview.pngbin0 -> 2723 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-calendarwidget.pngbin0 -> 5144 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-checkbox.pngbin0 -> 1115 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-combobox.pngbin0 -> 1457 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-dateedit.pngbin0 -> 855 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-datetimeedit.pngbin0 -> 1034 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-dial.pngbin0 -> 2431 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-doublespinbox.pngbin0 -> 852 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-fontcombobox.pngbin0 -> 919 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-frame.pngbin0 -> 1800 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-groupbox.pngbin0 -> 1991 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-horizontalscrollbar.pngbin0 -> 1049 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-label.pngbin0 -> 599 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-lcdnumber.pngbin0 -> 491 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-lineedit.pngbin0 -> 873 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-listview.pngbin0 -> 6872 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-progressbar.pngbin0 -> 1437 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-pushbutton.pngbin0 -> 1085 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-radiobutton.pngbin0 -> 1266 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-slider.pngbin0 -> 624 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-spinbox.pngbin0 -> 767 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-tableview.pngbin0 -> 3941 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-tabwidget.pngbin0 -> 3286 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-textedit.pngbin0 -> 3122 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-timeedit.pngbin0 -> 764 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-toolbox.pngbin0 -> 891 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-toolbutton.pngbin0 -> 981 bytes
-rw-r--r--src/widgets/doc/images/windowsvista-treeview.pngbin0 -> 5760 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-calendarwidget.pngbin0 -> 5009 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-checkbox.pngbin0 -> 1006 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-combobox.pngbin0 -> 1450 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-dateedit.pngbin0 -> 1107 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-datetimeedit.pngbin0 -> 1321 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-dial.pngbin0 -> 4598 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-doublespinbox.pngbin0 -> 1065 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-fontcombobox.pngbin0 -> 1408 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-frame.pngbin0 -> 1837 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-groupbox.pngbin0 -> 2016 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-horizontalscrollbar.pngbin0 -> 1498 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-label.pngbin0 -> 696 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-lcdnumber.pngbin0 -> 493 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-lineedit.pngbin0 -> 861 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-listview.pngbin0 -> 5391 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-menu.pngbin0 -> 1442 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-progressbar.pngbin0 -> 1007 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-pushbutton.pngbin0 -> 1462 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-radiobutton.pngbin0 -> 1270 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-slider.pngbin0 -> 732 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-spinbox.pngbin0 -> 974 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-tableview.pngbin0 -> 3204 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-tabwidget.pngbin0 -> 5220 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-textedit.pngbin0 -> 3159 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-timeedit.pngbin0 -> 1172 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-toolbox.pngbin0 -> 925 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-toolbutton.pngbin0 -> 1549 bytes
-rw-r--r--src/widgets/doc/images/windowsxp-treeview.pngbin0 -> 5795 bytes
-rw-r--r--src/widgets/doc/qtwidgets.qdocconf92
-rw-r--r--src/widgets/doc/snippets/code/doc_src_layout.cpp166
-rw-r--r--src/widgets/doc/snippets/code/doc_src_qt4-styles.cpp82
-rw-r--r--src/widgets/doc/snippets/code/doc_src_qtwidgets.cpp43
-rw-r--r--src/widgets/doc/snippets/code/doc_src_qtwidgets.pro43
-rw-r--r--src/widgets/doc/snippets/code/doc_src_styles.cpp134
-rw-r--r--src/widgets/doc/snippets/code/doc_src_stylesheet.cpp140
-rw-r--r--src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc1866
-rw-r--r--src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp131
-rw-r--r--src/widgets/doc/snippets/code/src_gui_dialogs_qfontdialog.cpp85
-rw-r--r--src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp148
-rw-r--r--src/widgets/doc/snippets/code/src_gui_dialogs_qwizard.cpp80
-rw-r--r--src/widgets/doc/snippets/code/src_gui_effects_qgraphicseffect.cpp83
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsgridlayout.cpp53
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp278
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicslinearlayout.cpp53
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp87
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp122
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicssceneevent.cpp45
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsview.cpp132
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp66
-rw-r--r--src/widgets/doc/snippets/code/src_gui_image_qicon.cpp71
-rw-r--r--src/widgets/doc/snippets/code/src_gui_image_qpixmapfilter.cpp62
-rw-r--r--src/widgets/doc/snippets/code/src_gui_itemviews_qabstractitemview.cpp58
-rw-r--r--src/widgets/doc/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp63
-rw-r--r--src/widgets/doc/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp63
-rw-r--r--src/widgets/doc/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp82
-rw-r--r--src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp45
-rw-r--r--src/widgets/doc/snippets/code/src_gui_itemviews_qtreewidget.cpp48
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qaction.cpp49
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp183
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qformlayout.cpp76
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qlayout.cpp67
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp53
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qshortcut.cpp55
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qwidget.cpp137
-rw-r--r--src/widgets/doc/snippets/code/src_gui_painting_qdrawutil.cpp98
-rw-r--r--src/widgets/doc/snippets/code/src_gui_qproxystyle.cpp85
-rw-r--r--src/widgets/doc/snippets/code/src_gui_styles_qstyle.cpp48
-rw-r--r--src/widgets/doc/snippets/code/src_gui_styles_qstyleoption.cpp54
-rw-r--r--src/widgets/doc/snippets/code/src_gui_util_qcompleter.cpp63
-rw-r--r--src/widgets/doc/snippets/code/src_gui_util_qundostack.cpp109
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qabstractbutton.cpp60
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qabstractspinbox.cpp48
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qcalendarwidget.cpp79
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qcheckbox.cpp43
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qdatetimeedit.cpp79
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qdockwidget.cpp48
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qframe.cpp48
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qgroupbox.cpp43
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qlabel.cpp64
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qlineedit.cpp50
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qmainwindow.cpp59
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qmenu.cpp77
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qmenubar.cpp48
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qplaintextedit.cpp55
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qpushbutton.cpp43
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qradiobutton.cpp43
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qrubberband.cpp62
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qscrollarea.cpp49
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qspinbox.cpp80
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qsplashscreen.cpp55
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qsplitter.cpp47
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qstatusbar.cpp43
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qtextbrowser.cpp44
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qtextedit.cpp60
-rw-r--r--src/widgets/doc/snippets/customstyle/customstyle.cpp92
-rw-r--r--src/widgets/doc/snippets/customstyle/customstyle.h60
-rw-r--r--src/widgets/doc/snippets/customstyle/customstyle.pro2
-rw-r--r--src/widgets/doc/snippets/customstyle/main.cpp54
-rw-r--r--src/widgets/doc/snippets/customviewstyle.cpp69
-rw-r--r--src/widgets/doc/snippets/dialogs/dialogs.cpp268
-rw-r--r--src/widgets/doc/snippets/filedialogurls.cpp61
-rw-r--r--src/widgets/doc/snippets/graphicssceneadditemsnippet.cpp80
-rw-r--r--src/widgets/doc/snippets/javastyle.cpp2745
-rw-r--r--src/widgets/doc/snippets/layouts/layouts.cpp165
-rw-r--r--src/widgets/doc/snippets/mainwindowsnippet.cpp92
-rw-r--r--src/widgets/doc/snippets/mdiareasnippets.cpp97
-rw-r--r--src/widgets/doc/snippets/myscrollarea.cpp128
-rw-r--r--src/widgets/doc/snippets/qlistwidget-using/mainwindow.cpp158
-rw-r--r--src/widgets/doc/snippets/qmacnativewidget/main.mm84
-rw-r--r--src/widgets/doc/snippets/qsplashscreen/main.cpp63
-rw-r--r--src/widgets/doc/snippets/qstackedlayout/main.cpp89
-rw-r--r--src/widgets/doc/snippets/qstackedwidget/main.cpp87
-rw-r--r--src/widgets/doc/snippets/qstyleoption/main.cpp139
-rw-r--r--src/widgets/doc/snippets/qstyleplugin/main.cpp97
-rw-r--r--src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp115
-rw-r--r--src/widgets/doc/snippets/qtablewidget-using/mainwindow.cpp150
-rw-r--r--src/widgets/doc/snippets/qtreewidget-using/mainwindow.cpp230
-rw-r--r--src/widgets/doc/snippets/qtreewidgetitemiterator-using/mainwindow.cpp197
-rw-r--r--src/widgets/doc/snippets/shareddirmodel/main.cpp81
-rw-r--r--src/widgets/doc/snippets/splitter/splitter.cpp84
-rw-r--r--src/widgets/doc/snippets/splitterhandle/splitter.cpp78
-rw-r--r--src/widgets/doc/snippets/splitterhandle/splitter.h73
-rw-r--r--src/widgets/doc/snippets/styles/styles.cpp91
-rw-r--r--src/widgets/doc/snippets/stylesheet/common-mistakes.cpp52
-rw-r--r--src/widgets/doc/snippets/textdocument-imagedrop/textedit.cpp71
-rw-r--r--src/widgets/doc/snippets/timeline/main.cpp72
-rw-r--r--src/widgets/doc/snippets/whatsthis/whatsthis.cpp64
-rw-r--r--src/widgets/doc/snippets/widget-mask/main.cpp54
-rw-r--r--src/widgets/doc/snippets/widgetdelegate.cpp66
-rw-r--r--src/widgets/doc/src/qtwidgets.qdoc45
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/focus.qdoc186
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery-cde.qdoc133
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc138
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery-gtk.qdoc141
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery-macintosh.qdoc138
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery-motif.qdoc138
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery-plastique.qdoc138
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery-windows.qdoc138
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc138
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc138
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/gallery.qdoc84
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/layout.qdoc396
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/styles.qdoc2102
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc3963
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/widgets.qdoc162
-rw-r--r--src/widgets/effects/qgraphicseffect.cpp6
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp6
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.cpp12
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp48
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp6
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp14
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp16
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp6
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp6
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.cpp6
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp20
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp8
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp12
-rw-r--r--src/widgets/itemviews/qstandarditemmodel.cpp10
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp18
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp14
-rw-r--r--src/widgets/itemviews/qtreeview.cpp4
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp6
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.cpp2
-rw-r--r--src/widgets/kernel/qaction.cpp10
-rw-r--r--src/widgets/kernel/qactiongroup.cpp6
-rw-r--r--src/widgets/kernel/qapplication.cpp36
-rw-r--r--src/widgets/kernel/qboxlayout.cpp24
-rw-r--r--src/widgets/kernel/qformlayout.cpp6
-rw-r--r--src/widgets/kernel/qicon.cpp10
-rw-r--r--src/widgets/kernel/qlayout.cpp4
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp2
-rw-r--r--src/widgets/kernel/qshortcut.cpp10
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp8
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp30
-rw-r--r--src/widgets/styles/qdrawutil.cpp20
-rw-r--r--src/widgets/styles/qproxystyle.cpp2
-rw-r--r--src/widgets/styles/qstyle.cpp30
-rw-r--r--src/widgets/styles/qstyleoption.cpp8
-rw-r--r--src/widgets/styles/qstylepainter.cpp8
-rw-r--r--src/widgets/styles/qstyleplugin.cpp6
-rw-r--r--src/widgets/util/qcompleter.cpp6
-rw-r--r--src/widgets/util/qundostack.cpp12
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp6
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp4
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp4
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp12
-rw-r--r--src/widgets/widgets/qcheckbox.cpp2
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp14
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp8
-rw-r--r--src/widgets/widgets/qdockwidget.cpp2
-rw-r--r--src/widgets/widgets/qframe.cpp2
-rw-r--r--src/widgets/widgets/qgroupbox.cpp4
-rw-r--r--src/widgets/widgets/qlabel.cpp6
-rw-r--r--src/widgets/widgets/qlineedit.cpp2
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.mm2
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.mm4
-rw-r--r--src/widgets/widgets/qmainwindow.cpp12
-rw-r--r--src/widgets/widgets/qmdiarea.cpp4
-rw-r--r--src/widgets/widgets/qmenu.cpp14
-rw-r--r--src/widgets/widgets/qmenubar.cpp12
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp8
-rw-r--r--src/widgets/widgets/qpushbutton.cpp2
-rw-r--r--src/widgets/widgets/qradiobutton.cpp2
-rw-r--r--src/widgets/widgets/qrubberband.cpp2
-rw-r--r--src/widgets/widgets/qscrollarea.cpp2
-rw-r--r--src/widgets/widgets/qspinbox.cpp20
-rw-r--r--src/widgets/widgets/qsplashscreen.cpp6
-rw-r--r--src/widgets/widgets/qsplitter.cpp14
-rw-r--r--src/widgets/widgets/qstackedwidget.cpp8
-rw-r--r--src/widgets/widgets/qstatusbar.cpp6
-rw-r--r--src/widgets/widgets/qtextbrowser.cpp2
-rw-r--r--src/widgets/widgets/qtextedit.cpp14
604 files changed, 21626 insertions, 513 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index d7a8f5dc21..f034590ccb 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -1717,7 +1717,7 @@ QColor QColorDialog::currentColor() const
}
/*!
- Returns the color that the user selected by clicking the \gui{OK}
+ Returns the color that the user selected by clicking the \uicontrol{OK}
or equivalent button.
\note This color is not always the same as the color held by the
@@ -1795,7 +1795,7 @@ QColorDialog::ColorDialogOptions QColorDialog::options() const
of a color dialog.
\value ShowAlphaChannel Allow the user to select the alpha component of a color.
- \value NoButtons Don't display \gui{OK} and \gui{Cancel} buttons. (Useful for "live dialogs".)
+ \value NoButtons Don't display \uicontrol{OK} and \uicontrol{Cancel} buttons. (Useful for "live dialogs".)
\value DontUseNativeDialog Use Qt's standard color dialog on the Mac instead of Apple's
native color panel.
@@ -1819,7 +1819,7 @@ bool QColorDialogPrivate::sharedColorPanelAvailable = true;
/*!
\fn void QColorDialog::colorSelected(const QColor &color);
- This signal is emitted just after the user has clicked \gui{OK} to
+ This signal is emitted just after the user has clicked \uicontrol{OK} to
select a color to use. The chosen color is specified by \a color.
\sa color, currentColorChanged()
@@ -1933,7 +1933,7 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr
initially set to \a initial. The dialog is a child of \a parent.
If \a ok is non-null, \e *\a ok is set to true if the user clicked
- \gui{OK}, and to false if the user clicked Cancel.
+ \uicontrol{OK}, and to false if the user clicked Cancel.
If the user clicks Cancel, the \a initial value is returned.
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 718d64bd27..9410a9b62b 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -181,8 +181,8 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
exec() function. When the user closes the dialog, exec() will
provide a useful \link #return return value\endlink. Typically,
to get the dialog to close and return the appropriate value, we
- connect a default button, e.g. \gui OK, to the accept() slot and a
- \gui Cancel button to the reject() slot.
+ connect a default button, e.g. \uicontrol OK, to the accept() slot and a
+ \uicontrol Cancel button to the reject() slot.
Alternatively you can call the done() slot with \c Accepted or
\c Rejected.
@@ -239,7 +239,7 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
partial dialog that shows the most commonly used options, and a
full dialog that shows all the options. Typically an extensible
dialog will initially appear as a partial dialog, but with a
- \gui More toggle button. If the user presses the \gui More button down,
+ \uicontrol More toggle button. If the user presses the \uicontrol More button down,
the dialog is expanded. The \l{Extension Example} shows how to achieve
extensible dialogs using Qt.
@@ -247,8 +247,8 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
\section1 Return Value (Modal Dialogs)
Modal dialogs are often used in situations where a return value is
- required, e.g. to indicate whether the user pressed \gui OK or
- \gui Cancel. A dialog can be closed by calling the accept() or the
+ required, e.g. to indicate whether the user pressed \uicontrol OK or
+ \uicontrol Cancel. A dialog can be closed by calling the accept() or the
reject() slots, and exec() will return \c Accepted or \c Rejected
as appropriate. The exec() call returns the result of the dialog.
The result is also available from result() if the dialog has not
@@ -265,11 +265,11 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
A modal dialog:
- \snippet doc/src/snippets/dialogs/dialogs.cpp 1
+ \snippet dialogs/dialogs.cpp 1
A modeless dialog:
- \snippet doc/src/snippets/dialogs/dialogs.cpp 0
+ \snippet dialogs/dialogs.cpp 0
\sa QDialogButtonBox, QTabWidget, QWidget, QProgressDialog,
{fowler}{GUI Design Handbook: Dialogs, Standard}, {Extension Example},
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 3908daec9c..43bb164366 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -108,7 +108,7 @@ Q_WIDGETS_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_h
functions. On Windows, Mac OS X, KDE and GNOME, these static functions will
call the native file dialog when possible.
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 0
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 0
In the above example, a modal QFileDialog is created using a static
function. The dialog initially displays the contents of the "/home/jana"
@@ -119,13 +119,13 @@ Q_WIDGETS_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_h
If you want to use multiple filters, separate each one with
\e two semicolons. For example:
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 1
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 1
You can create your own QFileDialog without using the static
functions. By calling setFileMode(), you can specify what the user must
select in the dialog:
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 2
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 2
In the above example, the mode of the file dialog is set to
AnyFile, meaning that the user can select any file, or even specify a
@@ -138,7 +138,7 @@ Q_WIDGETS_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_h
this indicates what types of objects the user is expected to select.
Use setNameFilter() to set the dialog's file filter. For example:
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 3
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 3
In the above example, the filter is set to \c{"Images (*.png *.xpm *.jpg)"},
this means that only files with the extension \c png, \c xpm,
@@ -154,12 +154,12 @@ Q_WIDGETS_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_h
information alongside each name, such as the file size and modification
date. Set the mode with setViewMode():
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 4
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 4
The last important function you will need to use when creating your
own file dialog is selectedFiles().
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 5
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 5
In the above example, a modal file dialog is created and shown. If
the user clicked OK, the file they selected is put in \c fileName.
@@ -377,7 +377,7 @@ QFileDialog::~QFileDialog()
For instance:
- \snippet doc/src/snippets/filedialogurls.cpp 0
+ \snippet filedialogurls.cpp 0
The file dialog will then look like this:
@@ -1100,7 +1100,7 @@ QStringList qt_make_filter_list(const QString &filter)
text contained in the parentheses is used as the filter. This means
that these calls are all equivalent:
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 6
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 6
\sa setNameFilters()
*/
@@ -1156,7 +1156,7 @@ QStringList qt_strip_filters(const QStringList &filters)
Sets the \a filters used in the file dialog.
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 7
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 7
*/
void QFileDialog::setNameFilters(const QStringList &filters)
{
@@ -1707,7 +1707,7 @@ extern QString qt_win_get_existing_directory(const QFileDialogArgs &args);
This is a convenience static function that returns an existing file
selected by the user. If the user presses Cancel, it returns a null string.
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 8
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 8
The function creates a modal file dialog with the given \a parent widget.
If \a parent is not 0, the dialog will be shown centered over the parent
@@ -1789,7 +1789,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
This is a convenience static function that will return one or more existing
files selected by the user.
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 9
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 9
This function creates a modal file dialog with the given \a parent widget.
If \a parent is not 0, the dialog will be shown centered over the parent
@@ -1826,7 +1826,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
\note If you want to iterate over the list of files, you should iterate
over a copy. For example:
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 10
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 10
\warning Do not delete \a parent during the execution of the dialog. If you
want to do this, you should create the dialog yourself using one of the
@@ -1878,7 +1878,7 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
\a parent is not 0, the dialog will be shown centered over the parent
widget.
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 11
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 11
The file dialog's working directory will be set to \a dir. If \a dir
includes a file name, the file will be selected. Only files that match the
@@ -1962,7 +1962,7 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
This is a convenience static function that will return an existing
directory selected by the user.
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 12
+ \snippet code/src_gui_dialogs_qfiledialog.cpp 12
This function creates a modal file dialog with the given \a parent widget.
If \a parent is not 0, the dialog will be shown centered over the parent
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 40cc100c53..06733a8932 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -95,16 +95,16 @@ QT_BEGIN_NAMESPACE
A directory model that displays the contents of a default directory
is usually constructed with a parent object:
- \snippet doc/src/snippets/shareddirmodel/main.cpp 2
+ \snippet shareddirmodel/main.cpp 2
A tree view can be used to display the contents of the model
- \snippet doc/src/snippets/shareddirmodel/main.cpp 4
+ \snippet shareddirmodel/main.cpp 4
and the contents of a particular directory can be displayed by
setting the tree view's root index:
- \snippet doc/src/snippets/shareddirmodel/main.cpp 7
+ \snippet shareddirmodel/main.cpp 7
The view's root index can be used to control how much of a
hierarchical model is displayed. QDirModel provides a convenience
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index b267f67422..23fac31822 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -122,10 +122,10 @@ static const Qt::WindowFlags DefaultWindowFlags =
Examples:
- \snippet doc/src/snippets/code/src_gui_dialogs_qfontdialog.cpp 0
+ \snippet code/src_gui_dialogs_qfontdialog.cpp 0
The dialog can also be used to set a widget's font directly:
- \snippet doc/src/snippets/code/src_gui_dialogs_qfontdialog.cpp 1
+ \snippet code/src_gui_dialogs_qfontdialog.cpp 1
If the user clicks OK the font they chose will be used for myWidget,
and if they click Cancel the original font is used.
@@ -345,20 +345,20 @@ QFontDialog::~QFontDialog()
/*!
Executes a modal font dialog and returns a font.
- If the user clicks \gui OK, the selected font is returned. If the user
- clicks \gui Cancel, the \a initial font is returned.
+ If the user clicks \uicontrol OK, the selected font is returned. If the user
+ clicks \uicontrol Cancel, the \a initial font is returned.
The dialog is constructed with the given \a parent and the options specified
in \a options. \a title is shown as the window title of the dialog and \a
initial is the initially selected font. If the \a ok parameter is not-null,
- the value it refers to is set to true if the user clicks \gui OK, and set to
- false if the user clicks \gui Cancel.
+ the value it refers to is set to true if the user clicks \uicontrol OK, and set to
+ false if the user clicks \uicontrol Cancel.
Examples:
- \snippet doc/src/snippets/code/src_gui_dialogs_qfontdialog.cpp 2
+ \snippet code/src_gui_dialogs_qfontdialog.cpp 2
The dialog can also be used to set a widget's font directly:
- \snippet doc/src/snippets/code/src_gui_dialogs_qfontdialog.cpp 3
+ \snippet code/src_gui_dialogs_qfontdialog.cpp 3
In this example, if the user clicks OK the font they chose will be
used, and if they click Cancel the original font is used.
@@ -377,16 +377,16 @@ QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget *parent, cons
Executes a modal font dialog and returns a font.
- If the user clicks \gui OK, the selected font is returned. If the user
- clicks \gui Cancel, the Qt default font is returned.
+ If the user clicks \uicontrol OK, the selected font is returned. If the user
+ clicks \uicontrol Cancel, the Qt default font is returned.
The dialog is constructed with the given \a parent.
If the \a ok parameter is not-null, the value it refers to is set
- to true if the user clicks \gui OK, and false if the user clicks
- \gui Cancel.
+ to true if the user clicks \uicontrol OK, and false if the user clicks
+ \uicontrol Cancel.
Example:
- \snippet doc/src/snippets/code/src_gui_dialogs_qfontdialog.cpp 4
+ \snippet code/src_gui_dialogs_qfontdialog.cpp 4
\warning Do not delete \a parent during the execution of the dialog.
If you want to do this, you should create the dialog
@@ -829,7 +829,7 @@ QFont QFontDialog::currentFont() const
}
/*!
- Returns the font that the user selected by clicking the \gui{OK}
+ Returns the font that the user selected by clicking the \uicontrol{OK}
or equivalent button.
\note This font is not always the same as the font held by the
@@ -849,7 +849,7 @@ QFont QFontDialog::selectedFont() const
This enum specifies various options that affect the look and feel
of a font dialog.
- \value NoButtons Don't display \gui{OK} and \gui{Cancel} buttons. (Useful for "live dialogs".)
+ \value NoButtons Don't display \uicontrol{OK} and \uicontrol{Cancel} buttons. (Useful for "live dialogs".)
\value DontUseNativeDialog Use Qt's standard font dialog on the Mac instead of Apple's
native font panel. (Currently, the native dialog is never used,
but this is likely to change in future Qt releases.)
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index 737d6bb467..13be3fcbe4 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -442,9 +442,9 @@ void QInputDialogPrivate::_q_currentRowChanged(const QModelIndex &newIndex,
getDouble(), and getItem(). All the functions can be used in a similar way,
for example:
- \snippet examples/dialogs/standarddialogs/dialog.cpp 3
+ \snippet dialogs/standarddialogs/dialog.cpp 3
- The \c ok variable is set to true if the user clicks \gui OK; otherwise it
+ The \c ok variable is set to true if the user clicks \uicontrol OK; otherwise it
is set to false.
\img inputdialogs.png Input Dialogs
@@ -576,7 +576,7 @@ QString QInputDialog::labelText() const
This enum specifies various options that affect the look and feel
of an input dialog.
- \value NoButtons Don't display \gui{OK} and \gui{Cancel} buttons. (Useful for "live dialogs".)
+ \value NoButtons Don't display \uicontrol{OK} and \uicontrol{Cancel} buttons. (Useful for "live dialogs".)
\value UseListViewForComboBoxItems Use a QListView rather than a non-editable QComboBox for
displaying the items set with setComboBoxItems().
@@ -1133,7 +1133,7 @@ void QInputDialog::done(int result)
edit widget if an input method is active.
If \a ok is nonnull \e *\a ok will be set to true if the user pressed
- \gui OK and to false if the user pressed \gui Cancel. The dialog's parent
+ \uicontrol OK and to false if the user pressed \uicontrol Cancel. The dialog's parent
is \a parent. The dialog will be modal and uses the specified widget
\a flags.
@@ -1142,7 +1142,7 @@ void QInputDialog::done(int result)
Use this static function like this:
- \snippet examples/dialogs/standarddialogs/dialog.cpp 3
+ \snippet dialogs/standarddialogs/dialog.cpp 3
\warning Do not delete \a parent during the execution of the dialog. If you
want to do this, you should create the dialog yourself using one of the
@@ -1185,8 +1185,8 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri
\a step is the amount by which the values change as the user presses the
arrow buttons to increment or decrement the value.
- If \a ok is nonnull *\a ok will be set to true if the user pressed \gui OK
- and to false if the user pressed \gui Cancel. The dialog's parent is
+ If \a ok is nonnull *\a ok will be set to true if the user pressed \uicontrol OK
+ and to false if the user pressed \uicontrol Cancel. The dialog's parent is
\a parent. The dialog will be modal and uses the widget \a flags.
On success, this function returns the integer which has been entered by the
@@ -1194,7 +1194,7 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri
Use this static function like this:
- \snippet examples/dialogs/standarddialogs/dialog.cpp 0
+ \snippet dialogs/standarddialogs/dialog.cpp 0
\warning Do not delete \a parent during the execution of the dialog. If you
want to do this, you should create the dialog yourself using one of the
@@ -1234,8 +1234,8 @@ int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &l
\a min and \a max are the minimum and maximum values the user may choose.
\a decimals is the maximum number of decimal places the number may have.
- If \a ok is nonnull, *\a ok will be set to true if the user pressed \gui OK
- and to false if the user pressed \gui Cancel. The dialog's parent is
+ If \a ok is nonnull, *\a ok will be set to true if the user pressed \uicontrol OK
+ and to false if the user pressed \uicontrol Cancel. The dialog's parent is
\a parent. The dialog will be modal and uses the widget \a flags.
This function returns the floating point number which has been entered by
@@ -1243,7 +1243,7 @@ int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &l
Use this static function like this:
- \snippet examples/dialogs/standarddialogs/dialog.cpp 1
+ \snippet dialogs/standarddialogs/dialog.cpp 1
\warning Do not delete \a parent during the execution of the dialog. If you
want to do this, you should create the dialog yourself using one of the
@@ -1289,7 +1289,7 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr
user may only select one of the existing items.
If \a ok is nonnull \e *\a ok will be set to true if the user pressed
- \gui OK and to false if the user pressed \gui Cancel. The dialog's parent
+ \uicontrol OK and to false if the user pressed \uicontrol Cancel. The dialog's parent
is \a parent. The dialog will be modal and uses the widget \a flags.
This function returns the text of the current item, or if \a editable is
@@ -1297,7 +1297,7 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr
Use this static function like this:
- \snippet examples/dialogs/standarddialogs/dialog.cpp 2
+ \snippet dialogs/standarddialogs/dialog.cpp 2
\warning Do not delete \a parent during the execution of the dialog. If you
want to do this, you should create the dialog yourself using one of the
@@ -1379,7 +1379,7 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri
\fn void QInputDialog::doubleValueSelected(double value)
This signal is emitted whenever the user selects a double value by
- accepting the dialog; for example, by clicking the \gui{OK} button.
+ accepting the dialog; for example, by clicking the \uicontrol{OK} button.
The selected value is specified by \a value.
This signal is only relevant when the input dialog is used in
@@ -1400,7 +1400,7 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri
\fn void QInputDialog::intValueSelected(int value)
This signal is emitted whenever the user selects a integer value by
- accepting the dialog; for example, by clicking the \gui{OK} button.
+ accepting the dialog; for example, by clicking the \uicontrol{OK} button.
The selected value is specified by \a value.
This signal is only relevant when the input dialog is used in
@@ -1421,7 +1421,7 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri
\fn void QInputDialog::textValueSelected(const QString &text)
This signal is emitted whenever the user selects a text string by
- accepting the dialog; for example, by clicking the \gui{OK} button.
+ accepting the dialog; for example, by clicking the \uicontrol{OK} button.
The selected string is specified by \a text.
This signal is only relevant when the input dialog is used in
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 92915b1bb1..5c1a2a4a64 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -498,9 +498,9 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
the message. The simplest configuration is to set only the
\l{QMessageBox::text} {message text} property.
- \snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 5
+ \snippet code/src_gui_dialogs_qmessagebox.cpp 5
- The user must click the \gui{OK} button to dismiss the message
+ The user must click the \uicontrol{OK} button to dismiss the message
box. The rest of the GUI is blocked until the message box is
dismissed.
@@ -514,13 +514,13 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
responses. The buttons are specified by combining values from
StandardButtons using the bitwise OR operator. The display order
for the buttons is platform-dependent. For example, on Windows,
- \gui{Save} is displayed to the left of \gui{Cancel}, whereas on
+ \uicontrol{Save} is displayed to the left of \uicontrol{Cancel}, whereas on
Mac OS, the order is reversed.
Mark one of your standard buttons to be your
\l{QMessageBox::defaultButton()} {default button}.
- \snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 6
+ \snippet code/src_gui_dialogs_qmessagebox.cpp 6
This is the approach recommended in the
\l{http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-BABCAJID}
@@ -534,16 +534,16 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
The exec() slot returns the StandardButtons value of the button
that was clicked.
- \snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 7
+ \snippet code/src_gui_dialogs_qmessagebox.cpp 7
To give the user more information to help him answer the question,
set the \l{QMessageBox::detailedText} {detailed text} property. If
the \l{QMessageBox::detailedText} {detailed text} property is set,
- the \gui{Show Details...} button will be shown.
+ the \uicontrol{Show Details...} button will be shown.
\image msgbox3.png
- Clicking the \gui{Show Details...} button displays the detailed text.
+ Clicking the \uicontrol{Show Details...} button displays the detailed text.
\image msgbox4.png
@@ -632,7 +632,7 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
Static functions are available for creating information(),
question(), warning(), and critical() message boxes.
- \snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 0
+ \snippet code/src_gui_dialogs_qmessagebox.cpp 0
The \l{dialogs/standarddialogs}{Standard Dialogs} example shows
how to use QMessageBox and the other built-in Qt dialogs.
@@ -647,7 +647,7 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
platform). You can test the value of clickedButton() after calling
exec(). For example,
- \snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 2
+ \snippet code/src_gui_dialogs_qmessagebox.cpp 2
\section1 Default and Escape Keys
@@ -1028,7 +1028,7 @@ void QMessageBoxPrivate::detectEscapeButton()
Example:
- \snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 3
+ \snippet code/src_gui_dialogs_qmessagebox.cpp 3
\sa standardButton(), button()
*/
@@ -1707,7 +1707,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te
and centered over \a parent (if \a parent is not 0). The message
includes the version number of Qt being used by the application.
- This is useful for inclusion in the \gui Help menu of an application,
+ This is useful for inclusion in the \uicontrol Help menu of an application,
as shown in the \l{mainwindows/menus}{Menus} example.
QApplication provides this functionality as a slot.
@@ -1964,7 +1964,7 @@ void QMessageBoxPrivate::retranslateStrings()
to make it the cancel or close button (clicked when \key Esc is
pressed).
- \snippet doc/src/snippets/dialogs/dialogs.cpp 2
+ \snippet dialogs/dialogs.cpp 2
The message box is an \l{Qt::ApplicationModal} {application modal}
dialog box.
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index 350fb57e20..97e628e96b 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -244,7 +244,7 @@ void QProgressDialogPrivate::_q_disconnectOnClose()
to use for the programmer. Do the operation in a loop, call \l setValue() at
intervals, and check for cancellation with wasCanceled(). For example:
- \snippet doc/src/snippets/dialogs/dialogs.cpp 3
+ \snippet dialogs/dialogs.cpp 3
A modeless progress dialog is suitable for operations that take
place in the background, where the user is able to interact with the
@@ -257,11 +257,11 @@ void QProgressDialogPrivate::_q_disconnectOnClose()
canceled() signal to a slot that stops the operation, and call \l
setValue() at intervals. For example:
- \snippet doc/src/snippets/dialogs/dialogs.cpp 4
+ \snippet dialogs/dialogs.cpp 4
\codeline
- \snippet doc/src/snippets/dialogs/dialogs.cpp 5
+ \snippet dialogs/dialogs.cpp 5
\codeline
- \snippet doc/src/snippets/dialogs/dialogs.cpp 6
+ \snippet dialogs/dialogs.cpp 6
In both modes the progress dialog may be customized by
replacing the child widgets with custom widgets by using setLabel(),
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index ac19ec8d22..36327741c8 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -1809,17 +1809,17 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
\l{dialogs/classwizard}{Class Wizard} and \l{dialogs/licensewizard}{License
Wizard}.
- \snippet examples/dialogs/trivialwizard/trivialwizard.cpp 1
- \snippet examples/dialogs/trivialwizard/trivialwizard.cpp 3
+ \snippet dialogs/trivialwizard/trivialwizard.cpp 1
+ \snippet dialogs/trivialwizard/trivialwizard.cpp 3
\dots
- \snippet examples/dialogs/trivialwizard/trivialwizard.cpp 4
+ \snippet dialogs/trivialwizard/trivialwizard.cpp 4
\codeline
- \snippet examples/dialogs/trivialwizard/trivialwizard.cpp 5
- \snippet examples/dialogs/trivialwizard/trivialwizard.cpp 7
+ \snippet dialogs/trivialwizard/trivialwizard.cpp 5
+ \snippet dialogs/trivialwizard/trivialwizard.cpp 7
\dots
- \snippet examples/dialogs/trivialwizard/trivialwizard.cpp 8
+ \snippet dialogs/trivialwizard/trivialwizard.cpp 8
\codeline
- \snippet examples/dialogs/trivialwizard/trivialwizard.cpp 10
+ \snippet dialogs/trivialwizard/trivialwizard.cpp 10
\section1 Wizard Look and Feel
@@ -1856,19 +1856,19 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
In addition to the wizard style, there are several options that
control the look and feel of the wizard. These can be set using
setOption() or setOptions(). For example, HaveHelpButton makes
- QWizard show a \gui Help button along with the other wizard
+ QWizard show a \uicontrol Help button along with the other wizard
buttons.
You can even change the order of the wizard buttons to any
arbitrary order using setButtonLayout(), and you can add up to
- three custom buttons (e.g., a \gui Print button) to the button
+ three custom buttons (e.g., a \uicontrol Print button) to the button
row. This is achieved by calling setButton() or setButtonText()
with CustomButton1, CustomButton2, or CustomButton3 to set up the
button, and by enabling the HaveCustomButton1, HaveCustomButton2,
or HaveCustomButton3 options. Whenever the user clicks a custom
button, customButtonClicked() is emitted. For example:
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 29
+ \snippet dialogs/licensewizard/licensewizard.cpp 29
\section1 Elements of a Wizard Page
@@ -1936,12 +1936,12 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
To register a field, call QWizardPage::registerField() field.
For example:
- \snippet examples/dialogs/classwizard/classwizard.cpp 8
+ \snippet dialogs/classwizard/classwizard.cpp 8
\dots
- \snippet examples/dialogs/classwizard/classwizard.cpp 10
- \snippet examples/dialogs/classwizard/classwizard.cpp 11
+ \snippet dialogs/classwizard/classwizard.cpp 10
+ \snippet dialogs/classwizard/classwizard.cpp 11
\dots
- \snippet examples/dialogs/classwizard/classwizard.cpp 13
+ \snippet dialogs/classwizard/classwizard.cpp 13
The above code registers three fields, \c className, \c
baseClass, and \c qobjectMacro, which are associated with three
@@ -1952,7 +1952,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
The fields of any page are accessible from any other page. For
example:
- \snippet examples/dialogs/classwizard/classwizard.cpp 17
+ \snippet dialogs/classwizard/classwizard.cpp 17
Here, we call QWizardPage::field() to access the contents of the
\c className field (which was defined in the \c ClassInfoPage)
@@ -1971,7 +1971,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
If an asterisk (\c *) is appended to the name when the property
is registered, the field is a \e{mandatory field}. When a page has
- mandatory fields, the \gui Next and/or \gui Finish buttons are
+ mandatory fields, the \uicontrol Next and/or \uicontrol Finish buttons are
enabled only when all mandatory fields are filled.
To consider a field "filled", QWizard simply checks that the
@@ -1987,7 +1987,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
QWizardPage::completeChanged() signal whenever the page becomes
complete or incomplete.
- The enabled/disabled state of the \gui Next and/or \gui Finish
+ The enabled/disabled state of the \uicontrol Next and/or \uicontrol Finish
buttons is one way to perform validation on the user input.
Another way is to reimplement validateCurrentPage() (or
QWizardPage::validatePage()) to perform some last-minute
@@ -2005,9 +2005,9 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
them using addPage(). By default, the pages are shown in the
order in which they were added. For example:
- \snippet examples/dialogs/classwizard/classwizard.cpp 0
+ \snippet dialogs/classwizard/classwizard.cpp 0
\dots
- \snippet examples/dialogs/classwizard/classwizard.cpp 2
+ \snippet dialogs/classwizard/classwizard.cpp 2
When a page is about to be shown, QWizard calls initializePage()
(which in turn calls QWizardPage::initializePage()) to fill the
@@ -2016,11 +2016,11 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
based on other pages' fields (see the \l{initialize page}{example
above}).
- If the user presses \gui Back, cleanupPage() is called (which in
+ If the user presses \uicontrol Back, cleanupPage() is called (which in
turn calls QWizardPage::cleanupPage()). The default
implementation resets the page's fields to their original values
(the values they had before initializePage() was called). If you
- want the \gui Back button to be non-destructive and keep the
+ want the \uicontrol Back button to be non-destructive and keep the
values entered by the user, simply enable the IndependentPages
option.
@@ -2037,37 +2037,37 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
In complex wizards, pages are identified by IDs. These IDs are
typically defined using an enum. For example:
- \snippet examples/dialogs/licensewizard/licensewizard.h 0
+ \snippet dialogs/licensewizard/licensewizard.h 0
\dots
- \snippet examples/dialogs/licensewizard/licensewizard.h 2
+ \snippet dialogs/licensewizard/licensewizard.h 2
\dots
- \snippet examples/dialogs/licensewizard/licensewizard.h 3
+ \snippet dialogs/licensewizard/licensewizard.h 3
The pages are inserted using setPage(), which takes an ID and an
instance of QWizardPage (or of a subclass):
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 1
+ \snippet dialogs/licensewizard/licensewizard.cpp 1
\dots
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 8
+ \snippet dialogs/licensewizard/licensewizard.cpp 8
By default, the pages are shown in increasing ID order. To
provide a dynamic order that depends on the options chosen by the
user, we must reimplement QWizardPage::nextId(). For example:
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 18
+ \snippet dialogs/licensewizard/licensewizard.cpp 18
\codeline
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 23
+ \snippet dialogs/licensewizard/licensewizard.cpp 23
\codeline
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 24
+ \snippet dialogs/licensewizard/licensewizard.cpp 24
\codeline
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 25
+ \snippet dialogs/licensewizard/licensewizard.cpp 25
\codeline
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 26
+ \snippet dialogs/licensewizard/licensewizard.cpp 26
It would also be possible to put all the logic in one place, in a
QWizard::nextId() reimplementation. For example:
- \snippet doc/src/snippets/code/src_gui_dialogs_qwizard.cpp 0
+ \snippet code/src_gui_dialogs_qwizard.cpp 0
To start at another page than the page with the lowest ID, call
setStartId().
@@ -2075,7 +2075,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
To test whether a page has been visited or not, call
hasVisitedPage(). For example:
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 27
+ \snippet dialogs/licensewizard/licensewizard.cpp 27
\sa QWizardPage, {Class Wizard Example}, {License Wizard Example}
*/
@@ -2085,12 +2085,12 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
This enum specifies the buttons in a wizard.
- \value BackButton The \gui Back button (\gui {Go Back} on Mac OS X)
- \value NextButton The \gui Next button (\gui Continue on Mac OS X)
- \value CommitButton The \gui Commit button
- \value FinishButton The \gui Finish button (\gui Done on Mac OS X)
- \value CancelButton The \gui Cancel button (see also NoCancelButton)
- \value HelpButton The \gui Help button (see also HaveHelpButton)
+ \value BackButton The \uicontrol Back button (\uicontrol {Go Back} on Mac OS X)
+ \value NextButton The \uicontrol Next button (\uicontrol Continue on Mac OS X)
+ \value CommitButton The \uicontrol Commit button
+ \value FinishButton The \uicontrol Finish button (\uicontrol Done on Mac OS X)
+ \value CancelButton The \uicontrol Cancel button (see also NoCancelButton)
+ \value HelpButton The \uicontrol Help button (see also HaveHelpButton)
\value CustomButton1 The first user-defined button (see also HaveCustomButton1)
\value CustomButton2 The second user-defined button (see also HaveCustomButton2)
\value CustomButton3 The third user-defined button (see also HaveCustomButton3)
@@ -2148,18 +2148,18 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
\value IgnoreSubTitles Don't show any subtitles, even if they are set.
\value ExtendedWatermarkPixmap Extend any WatermarkPixmap all the
way down to the window's edge.
- \value NoDefaultButton Don't make the \gui Next or \gui Finish button the
+ \value NoDefaultButton Don't make the \uicontrol Next or \uicontrol Finish button the
dialog's \l{QPushButton::setDefault()}{default button}.
- \value NoBackButtonOnStartPage Don't show the \gui Back button on the start page.
- \value NoBackButtonOnLastPage Don't show the \gui Back button on the last page.
- \value DisabledBackButtonOnLastPage Disable the \gui Back button on the last page.
- \value HaveNextButtonOnLastPage Show the (disabled) \gui Next button on the last page.
- \value HaveFinishButtonOnEarlyPages Show the (disabled) \gui Finish button on non-final pages.
- \value NoCancelButton Don't show the \gui Cancel button.
- \value CancelButtonOnLeft Put the \gui Cancel button on the left of \gui Back (rather than on
- the right of \gui Finish or \gui Next).
- \value HaveHelpButton Show the \gui Help button.
- \value HelpButtonOnRight Put the \gui Help button on the far right of the button layout
+ \value NoBackButtonOnStartPage Don't show the \uicontrol Back button on the start page.
+ \value NoBackButtonOnLastPage Don't show the \uicontrol Back button on the last page.
+ \value DisabledBackButtonOnLastPage Disable the \uicontrol Back button on the last page.
+ \value HaveNextButtonOnLastPage Show the (disabled) \uicontrol Next button on the last page.
+ \value HaveFinishButtonOnEarlyPages Show the (disabled) \uicontrol Finish button on non-final pages.
+ \value NoCancelButton Don't show the \uicontrol Cancel button.
+ \value CancelButtonOnLeft Put the \uicontrol Cancel button on the left of \uicontrol Back (rather than on
+ the right of \uicontrol Finish or \uicontrol Next).
+ \value HaveHelpButton Show the \uicontrol Help button.
+ \value HelpButtonOnRight Put the \uicontrol Help button on the far right of the button layout
(rather than on the far left).
\value HaveCustomButton1 Show the first user-defined button (CustomButton1).
\value HaveCustomButton2 Show the second user-defined button (CustomButton2).
@@ -2363,7 +2363,7 @@ QWizardPage *QWizard::page(int theid) const
Returns true if the page history contains page \a id; otherwise,
returns false.
- Pressing \gui Back marks the current page as "unvisited" again.
+ Pressing \uicontrol Back marks the current page as "unvisited" again.
\sa visitedPages()
*/
@@ -2377,7 +2377,7 @@ bool QWizard::hasVisitedPage(int theid) const
Returns the list of IDs of visited pages, in the order in which the pages
were visited.
- Pressing \gui Back marks the current page as "unvisited" again.
+ Pressing \uicontrol Back marks the current page as "unvisited" again.
\sa hasVisitedPage()
*/
@@ -2635,10 +2635,10 @@ QWizard::WizardOptions QWizard::options() const
Sets the text on button \a which to be \a text.
By default, the text on buttons depends on the wizardStyle. For
- example, on Mac OS X, the \gui Next button is called \gui
+ example, on Mac OS X, the \uicontrol Next button is called \uicontrol
Continue.
- To add extra buttons to the wizard (e.g., a \gui Print button),
+ To add extra buttons to the wizard (e.g., a \uicontrol Print button),
one way is to call setButtonText() with CustomButton1,
CustomButton2, or CustomButton3 to set their text, and make the
buttons visible using the HaveCustomButton1, HaveCustomButton2,
@@ -2667,7 +2667,7 @@ void QWizard::setButtonText(WizardButton which, const QString &text)
If a text has ben set using setButtonText(), this text is returned.
By default, the text on buttons depends on the wizardStyle. For
- example, on Mac OS X, the \gui Next button is called \gui
+ example, on Mac OS X, the \uicontrol Next button is called \uicontrol
Continue.
\sa button(), setButton(), setButtonText(), QWizardPage::buttonText(),
@@ -2704,7 +2704,7 @@ QString QWizard::buttonText(WizardButton which) const
Example:
- \snippet doc/src/snippets/code/src_gui_dialogs_qwizard.cpp 1
+ \snippet code/src_gui_dialogs_qwizard.cpp 1
\sa setButton(), setButtonText(), setOptions()
*/
@@ -2738,7 +2738,7 @@ void QWizard::setButtonLayout(const QList<WizardButton> &layout)
/*!
Sets the button corresponding to role \a which to \a button.
- To add extra buttons to the wizard (e.g., a \gui Print button),
+ To add extra buttons to the wizard (e.g., a \uicontrol Print button),
one way is to call setButton() with CustomButton1 to
CustomButton3, and make the buttons visible using the
HaveCustomButton1 to HaveCustomButton3 options.
@@ -3029,27 +3029,27 @@ QSize QWizard::sizeHint() const
/*!
\fn void QWizard::helpRequested()
- This signal is emitted when the user clicks the \gui Help button.
+ This signal is emitted when the user clicks the \uicontrol Help button.
- By default, no \gui Help button is shown. Call
+ By default, no \uicontrol Help button is shown. Call
setOption(HaveHelpButton, true) to have one.
Example:
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 0
+ \snippet dialogs/licensewizard/licensewizard.cpp 0
\dots
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 5
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 7
+ \snippet dialogs/licensewizard/licensewizard.cpp 5
+ \snippet dialogs/licensewizard/licensewizard.cpp 7
\dots
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 8
+ \snippet dialogs/licensewizard/licensewizard.cpp 8
\codeline
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 10
+ \snippet dialogs/licensewizard/licensewizard.cpp 10
\dots
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 12
+ \snippet dialogs/licensewizard/licensewizard.cpp 12
\codeline
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 14
+ \snippet dialogs/licensewizard/licensewizard.cpp 14
\codeline
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 15
+ \snippet dialogs/licensewizard/licensewizard.cpp 15
\sa customButtonClicked()
*/
@@ -3070,7 +3070,7 @@ QSize QWizard::sizeHint() const
/*!
Goes back to the previous page.
- This is equivalent to pressing the \gui Back button.
+ This is equivalent to pressing the \uicontrol Back button.
\sa next(), accept(), reject(), restart()
*/
@@ -3086,7 +3086,7 @@ void QWizard::back()
/*!
Advances to the next page.
- This is equivalent to pressing the \gui Next or \gui Commit button.
+ This is equivalent to pressing the \uicontrol Next or \uicontrol Commit button.
\sa nextId(), back(), accept(), reject(), restart()
*/
@@ -3253,7 +3253,7 @@ void QWizard::done(int result)
This virtual function is called by QWizard to prepare page \a id
just before it is shown either as a result of QWizard::restart()
- being called, or as a result of the user clicking \gui Next. (However, if the \l
+ being called, or as a result of the user clicking \uicontrol Next. (However, if the \l
QWizard::IndependentPages option is set, this function is only
called the first time the page is shown.)
@@ -3277,7 +3277,7 @@ void QWizard::initializePage(int theid)
\fn void QWizard::cleanupPage(int id)
This virtual function is called by QWizard to clean up page \a id just before the
- user leaves it by clicking \gui Back (unless the \l QWizard::IndependentPages option is set).
+ user leaves it by clicking \uicontrol Back (unless the \l QWizard::IndependentPages option is set).
The default implementation calls QWizardPage::cleanupPage() on
page(\a id).
@@ -3293,15 +3293,15 @@ void QWizard::cleanupPage(int theid)
/*!
This virtual function is called by QWizard when the user clicks
- \gui Next or \gui Finish to perform some last-minute validation.
+ \uicontrol Next or \uicontrol Finish to perform some last-minute validation.
If it returns true, the next page is shown (or the wizard
finishes); otherwise, the current page stays up.
The default implementation calls QWizardPage::validatePage() on
the currentPage().
- When possible, it is usually better style to disable the \gui
- Next or \gui Finish button (by specifying \l{mandatory fields} or
+ When possible, it is usually better style to disable the \uicontrol
+ Next or \uicontrol Finish button (by specifying \l{mandatory fields} or
by reimplementing QWizardPage::isComplete()) than to reimplement
validateCurrentPage().
@@ -3318,7 +3318,7 @@ bool QWizard::validateCurrentPage()
/*!
This virtual function is called by QWizard to find out which page
- to show when the user clicks the \gui Next button.
+ to show when the user clicks the \uicontrol Next button.
The return value is the ID of the next page, or -1 if no page follows.
@@ -3362,29 +3362,29 @@ int QWizard::nextId() const
\list
\li initializePage() is called to initialize the page's contents
- when the user clicks the wizard's \gui Next button. If you
+ when the user clicks the wizard's \uicontrol Next button. If you
want to derive the page's default from what the user entered
on previous pages, this is the function to reimplement.
\li cleanupPage() is called to reset the page's contents when the
- user clicks the wizard's \gui Back button.
- \li validatePage() validates the page when the user clicks \gui
- Next or \gui Finish. It is often used to show an error message
+ user clicks the wizard's \uicontrol Back button.
+ \li validatePage() validates the page when the user clicks \uicontrol
+ Next or \uicontrol Finish. It is often used to show an error message
if the user has entered incomplete or invalid information.
\li nextId() returns the ID of the next page. It is useful when
\l{creating non-linear wizards}, which allow different
traversal paths based on the information provided by the user.
- \li isComplete() is called to determine whether the \gui Next
- and/or \gui Finish button should be enabled or disabled. If
+ \li isComplete() is called to determine whether the \uicontrol Next
+ and/or \uicontrol Finish button should be enabled or disabled. If
you reimplement isComplete(), also make sure that
completeChanged() is emitted whenever the complete state
changes.
\endlist
- Normally, the \gui Next button and the \gui Finish button of a
- wizard are mutually exclusive. If isFinalPage() returns true, \gui
- Finish is available; otherwise, \gui Next is available. By
+ Normally, the \uicontrol Next button and the \uicontrol Finish button of a
+ wizard are mutually exclusive. If isFinalPage() returns true, \uicontrol
+ Finish is available; otherwise, \uicontrol Next is available. By
default, isFinalPage() is true only when nextId() returns -1. If
- you want to show \gui Next and \gui Final simultaneously for a
+ you want to show \uicontrol Next and \uicontrol Final simultaneously for a
page (letting the user perform an "early finish"), call
setFinalPage(true) on that page. For wizards that support early
finishes, you might also want to set the
@@ -3532,7 +3532,7 @@ QPixmap QWizardPage::pixmap(QWizard::WizardPixmap which) const
/*!
This virtual function is called by QWizard::initializePage() to
prepare the page just before it is shown either as a result of QWizard::restart()
- being called, or as a result of the user clicking \gui Next.
+ being called, or as a result of the user clicking \uicontrol Next.
(However, if the \l QWizard::IndependentPages option is set, this function is only
called the first time the page is shown.)
@@ -3540,7 +3540,7 @@ QPixmap QWizardPage::pixmap(QWizard::WizardPixmap which) const
fields are properly initialized based on fields from previous
pages. For example:
- \snippet examples/dialogs/classwizard/classwizard.cpp 17
+ \snippet dialogs/classwizard/classwizard.cpp 17
The default implementation does nothing.
@@ -3552,7 +3552,7 @@ void QWizardPage::initializePage()
/*!
This virtual function is called by QWizard::cleanupPage() when
- the user leaves the page by clicking \gui Back (unless the \l QWizard::IndependentPages
+ the user leaves the page by clicking \uicontrol Back (unless the \l QWizard::IndependentPages
option is set).
The default implementation resets the page's fields to their
@@ -3576,14 +3576,14 @@ void QWizardPage::cleanupPage()
/*!
This virtual function is called by QWizard::validateCurrentPage()
- when the user clicks \gui Next or \gui Finish to perform some
+ when the user clicks \uicontrol Next or \uicontrol Finish to perform some
last-minute validation. If it returns true, the next page is shown
(or the wizard finishes); otherwise, the current page stays up.
The default implementation returns true.
- When possible, it is usually better style to disable the \gui
- Next or \gui Finish button (by specifying \l{mandatory fields} or
+ When possible, it is usually better style to disable the \uicontrol
+ Next or \uicontrol Finish button (by specifying \l{mandatory fields} or
reimplementing isComplete()) than to reimplement validatePage().
\sa QWizard::validateCurrentPage(), isComplete()
@@ -3595,7 +3595,7 @@ bool QWizardPage::validatePage()
/*!
This virtual function is called by QWizard to determine whether
- the \gui Next or \gui Finish button should be enabled or
+ the \uicontrol Next or \uicontrol Finish button should be enabled or
disabled.
The default implementation returns true if all \l{mandatory
@@ -3645,7 +3645,7 @@ bool QWizardPage::isComplete() const
/*!
Explicitly sets this page to be final if \a finalPage is true.
- After calling setFinalPage(true), isFinalPage() returns true and the \gui
+ After calling setFinalPage(true), isFinalPage() returns true and the \uicontrol
Finish button is visible (and enabled if isComplete() returns
true).
@@ -3664,7 +3664,7 @@ void QWizardPage::setFinalPage(bool finalPage)
}
/*!
- This function is called by QWizard to determine whether the \gui
+ This function is called by QWizard to determine whether the \uicontrol
Finish button should be shown for this page or not.
By default, it returns true if there is no next page
@@ -3695,12 +3695,12 @@ bool QWizardPage::isFinalPage() const
sets it to be a normal page.
A commit page is a page that represents an action which cannot be undone
- by clicking \gui Back or \gui Cancel.
+ by clicking \uicontrol Back or \uicontrol Cancel.
- A \gui Commit button replaces the \gui Next button on a commit page. Clicking this
- button simply calls QWizard::next() just like clicking \gui Next does.
+ A \uicontrol Commit button replaces the \uicontrol Next button on a commit page. Clicking this
+ button simply calls QWizard::next() just like clicking \uicontrol Next does.
- A page entered directly from a commit page has its \gui Back button disabled.
+ A page entered directly from a commit page has its \uicontrol Back button disabled.
\sa isCommitPage()
*/
@@ -3748,7 +3748,7 @@ void QWizardPage::setButtonText(QWizard::WizardButton which, const QString &text
this text is returned.
By default, the text on buttons depends on the QWizard::wizardStyle.
- For example, on Mac OS X, the \gui Next button is called \gui
+ For example, on Mac OS X, the \uicontrol Next button is called \uicontrol
Continue.
\sa setButtonText(), QWizard::buttonText(), QWizard::setButtonText()
@@ -3768,7 +3768,7 @@ QString QWizardPage::buttonText(QWizard::WizardButton which) const
/*!
This virtual function is called by QWizard::nextId() to find
- out which page to show when the user clicks the \gui Next button.
+ out which page to show when the user clicks the \uicontrol Next button.
The return value is the ID of the next page, or -1 if no page follows.
@@ -3778,7 +3778,7 @@ QString QWizardPage::buttonText(QWizard::WizardButton which) const
By reimplementing this function, you can specify a dynamic page
order. For example:
- \snippet examples/dialogs/licensewizard/licensewizard.cpp 18
+ \snippet dialogs/licensewizard/licensewizard.cpp 18
\sa QWizard::nextId()
*/
@@ -3845,7 +3845,7 @@ void QWizardPage::setField(const QString &name, const QVariant &value)
Example:
- \snippet examples/dialogs/classwizard/classwizard.cpp 17
+ \snippet dialogs/classwizard/classwizard.cpp 17
\sa QWizard::field(), setField(), registerField()
*/
@@ -3868,8 +3868,8 @@ QVariant QWizardPage::field(const QString &name) const
explicitly about each other.
If \a name ends with an asterisk (\c *), the field is a mandatory
- field. When a page has mandatory fields, the \gui Next and/or
- \gui Finish buttons are enabled only when all mandatory fields
+ field. When a page has mandatory fields, the \uicontrol Next and/or
+ \uicontrol Finish buttons are enabled only when all mandatory fields
are filled. This requires a \a changedSignal to be specified, to
tell QWizard to recheck the value stored by the mandatory field.
diff --git a/src/widgets/doc/images/assistant-toolbar.png b/src/widgets/doc/images/assistant-toolbar.png
new file mode 100644
index 0000000000..1b41825c64
--- /dev/null
+++ b/src/widgets/doc/images/assistant-toolbar.png
Binary files differ
diff --git a/src/widgets/doc/images/buttonbox-gnomelayout-horizontal.png b/src/widgets/doc/images/buttonbox-gnomelayout-horizontal.png
new file mode 100644
index 0000000000..b2f74bb6c6
--- /dev/null
+++ b/src/widgets/doc/images/buttonbox-gnomelayout-horizontal.png
Binary files differ
diff --git a/src/widgets/doc/images/buttonbox-gnomelayout-vertical.png b/src/widgets/doc/images/buttonbox-gnomelayout-vertical.png
new file mode 100644
index 0000000000..e7843dc22d
--- /dev/null
+++ b/src/widgets/doc/images/buttonbox-gnomelayout-vertical.png
Binary files differ
diff --git a/src/widgets/doc/images/buttonbox-kdelayout-horizontal.png b/src/widgets/doc/images/buttonbox-kdelayout-horizontal.png
new file mode 100644
index 0000000000..5da11f4d7a
--- /dev/null
+++ b/src/widgets/doc/images/buttonbox-kdelayout-horizontal.png
Binary files differ
diff --git a/src/widgets/doc/images/buttonbox-kdelayout-vertical.png b/src/widgets/doc/images/buttonbox-kdelayout-vertical.png
new file mode 100644
index 0000000000..6f5dfc6b65
--- /dev/null
+++ b/src/widgets/doc/images/buttonbox-kdelayout-vertical.png
Binary files differ
diff --git a/src/widgets/doc/images/buttonbox-mac-modeless-horizontal.png b/src/widgets/doc/images/buttonbox-mac-modeless-horizontal.png
new file mode 100644
index 0000000000..2e853d34fb
--- /dev/null
+++ b/src/widgets/doc/images/buttonbox-mac-modeless-horizontal.png
Binary files differ
diff --git a/src/widgets/doc/images/buttonbox-mac-modeless-vertical.png b/src/widgets/doc/images/buttonbox-mac-modeless-vertical.png
new file mode 100644
index 0000000000..f59bd8ddaf
--- /dev/null
+++ b/src/widgets/doc/images/buttonbox-mac-modeless-vertical.png
Binary files differ
diff --git a/src/widgets/doc/images/buttonbox-maclayout-horizontal.png b/src/widgets/doc/images/buttonbox-maclayout-horizontal.png
new file mode 100644
index 0000000000..89ae84dea0
--- /dev/null
+++ b/src/widgets/doc/images/buttonbox-maclayout-horizontal.png
Binary files differ
diff --git a/src/widgets/doc/images/buttonbox-maclayout-vertical.png b/src/widgets/doc/images/buttonbox-maclayout-vertical.png
new file mode 100644
index 0000000000..728760029f
--- /dev/null
+++ b/src/widgets/doc/images/buttonbox-maclayout-vertical.png
Binary files differ
diff --git a/src/widgets/doc/images/buttonbox-winlayout-horizontal.png b/src/widgets/doc/images/buttonbox-winlayout-horizontal.png
new file mode 100644
index 0000000000..dd4ce1c313
--- /dev/null
+++ b/src/widgets/doc/images/buttonbox-winlayout-horizontal.png
Binary files differ
diff --git a/src/widgets/doc/images/buttonbox-winlayout-vertical.png b/src/widgets/doc/images/buttonbox-winlayout-vertical.png
new file mode 100644
index 0000000000..539de1aa1a
--- /dev/null
+++ b/src/widgets/doc/images/buttonbox-winlayout-vertical.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-calendarwidget.png b/src/widgets/doc/images/cde-calendarwidget.png
new file mode 100644
index 0000000000..9615eaeab8
--- /dev/null
+++ b/src/widgets/doc/images/cde-calendarwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-checkbox.png b/src/widgets/doc/images/cde-checkbox.png
new file mode 100644
index 0000000000..b2528dc5de
--- /dev/null
+++ b/src/widgets/doc/images/cde-checkbox.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-combobox.png b/src/widgets/doc/images/cde-combobox.png
new file mode 100644
index 0000000000..74586433eb
--- /dev/null
+++ b/src/widgets/doc/images/cde-combobox.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-dateedit.png b/src/widgets/doc/images/cde-dateedit.png
new file mode 100644
index 0000000000..ebb24d59cf
--- /dev/null
+++ b/src/widgets/doc/images/cde-dateedit.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-datetimeedit.png b/src/widgets/doc/images/cde-datetimeedit.png
new file mode 100644
index 0000000000..9ac659a3f3
--- /dev/null
+++ b/src/widgets/doc/images/cde-datetimeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-dial.png b/src/widgets/doc/images/cde-dial.png
new file mode 100644
index 0000000000..956d19cb6c
--- /dev/null
+++ b/src/widgets/doc/images/cde-dial.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-doublespinbox.png b/src/widgets/doc/images/cde-doublespinbox.png
new file mode 100644
index 0000000000..30a9af66fa
--- /dev/null
+++ b/src/widgets/doc/images/cde-doublespinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-fontcombobox.png b/src/widgets/doc/images/cde-fontcombobox.png
new file mode 100644
index 0000000000..043ca1d20f
--- /dev/null
+++ b/src/widgets/doc/images/cde-fontcombobox.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-frame.png b/src/widgets/doc/images/cde-frame.png
new file mode 100644
index 0000000000..221576e849
--- /dev/null
+++ b/src/widgets/doc/images/cde-frame.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-groupbox.png b/src/widgets/doc/images/cde-groupbox.png
new file mode 100644
index 0000000000..8bad69be4e
--- /dev/null
+++ b/src/widgets/doc/images/cde-groupbox.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-horizontalscrollbar.png b/src/widgets/doc/images/cde-horizontalscrollbar.png
new file mode 100644
index 0000000000..6e7cde8da1
--- /dev/null
+++ b/src/widgets/doc/images/cde-horizontalscrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-label.png b/src/widgets/doc/images/cde-label.png
new file mode 100644
index 0000000000..4e906eaa00
--- /dev/null
+++ b/src/widgets/doc/images/cde-label.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-lcdnumber.png b/src/widgets/doc/images/cde-lcdnumber.png
new file mode 100644
index 0000000000..97324c1a6c
--- /dev/null
+++ b/src/widgets/doc/images/cde-lcdnumber.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-lineedit.png b/src/widgets/doc/images/cde-lineedit.png
new file mode 100644
index 0000000000..6c1527ba19
--- /dev/null
+++ b/src/widgets/doc/images/cde-lineedit.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-listview.png b/src/widgets/doc/images/cde-listview.png
new file mode 100644
index 0000000000..2e58140880
--- /dev/null
+++ b/src/widgets/doc/images/cde-listview.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-progressbar.png b/src/widgets/doc/images/cde-progressbar.png
new file mode 100644
index 0000000000..41715deb48
--- /dev/null
+++ b/src/widgets/doc/images/cde-progressbar.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-pushbutton.png b/src/widgets/doc/images/cde-pushbutton.png
new file mode 100644
index 0000000000..2d9bdd25a4
--- /dev/null
+++ b/src/widgets/doc/images/cde-pushbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-radiobutton.png b/src/widgets/doc/images/cde-radiobutton.png
new file mode 100644
index 0000000000..e053665f5a
--- /dev/null
+++ b/src/widgets/doc/images/cde-radiobutton.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-slider.png b/src/widgets/doc/images/cde-slider.png
new file mode 100644
index 0000000000..bd84371898
--- /dev/null
+++ b/src/widgets/doc/images/cde-slider.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-spinbox.png b/src/widgets/doc/images/cde-spinbox.png
new file mode 100644
index 0000000000..5f53c8e902
--- /dev/null
+++ b/src/widgets/doc/images/cde-spinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-tableview.png b/src/widgets/doc/images/cde-tableview.png
new file mode 100644
index 0000000000..7a99217560
--- /dev/null
+++ b/src/widgets/doc/images/cde-tableview.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-tabwidget.png b/src/widgets/doc/images/cde-tabwidget.png
new file mode 100644
index 0000000000..8cf5473fc2
--- /dev/null
+++ b/src/widgets/doc/images/cde-tabwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-textedit.png b/src/widgets/doc/images/cde-textedit.png
new file mode 100644
index 0000000000..c65b8da8f4
--- /dev/null
+++ b/src/widgets/doc/images/cde-textedit.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-timeedit.png b/src/widgets/doc/images/cde-timeedit.png
new file mode 100644
index 0000000000..6a5a4b953f
--- /dev/null
+++ b/src/widgets/doc/images/cde-timeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-toolbox.png b/src/widgets/doc/images/cde-toolbox.png
new file mode 100644
index 0000000000..c0dd4e9400
--- /dev/null
+++ b/src/widgets/doc/images/cde-toolbox.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-toolbutton.png b/src/widgets/doc/images/cde-toolbutton.png
new file mode 100644
index 0000000000..baff25c25b
--- /dev/null
+++ b/src/widgets/doc/images/cde-toolbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/cde-treeview.png b/src/widgets/doc/images/cde-treeview.png
new file mode 100644
index 0000000000..df3184b31b
--- /dev/null
+++ b/src/widgets/doc/images/cde-treeview.png
Binary files differ
diff --git a/src/widgets/doc/images/checkboxes-exclusive.png b/src/widgets/doc/images/checkboxes-exclusive.png
new file mode 100644
index 0000000000..0ada3a046a
--- /dev/null
+++ b/src/widgets/doc/images/checkboxes-exclusive.png
Binary files differ
diff --git a/src/widgets/doc/images/checkboxes-non-exclusive.png b/src/widgets/doc/images/checkboxes-non-exclusive.png
new file mode 100644
index 0000000000..4211aaedfb
--- /dev/null
+++ b/src/widgets/doc/images/checkboxes-non-exclusive.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-calendarwidget.png b/src/widgets/doc/images/cleanlooks-calendarwidget.png
new file mode 100644
index 0000000000..99c57b61ee
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-calendarwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-checkbox.png b/src/widgets/doc/images/cleanlooks-checkbox.png
new file mode 100644
index 0000000000..aaf2daae4e
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-checkbox.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-combobox.png b/src/widgets/doc/images/cleanlooks-combobox.png
new file mode 100644
index 0000000000..5fff4c87f6
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-combobox.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-dateedit.png b/src/widgets/doc/images/cleanlooks-dateedit.png
new file mode 100644
index 0000000000..384136a162
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-dateedit.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-datetimeedit.png b/src/widgets/doc/images/cleanlooks-datetimeedit.png
new file mode 100644
index 0000000000..7a62cebfb4
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-datetimeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-dial.png b/src/widgets/doc/images/cleanlooks-dial.png
new file mode 100644
index 0000000000..259a0888b6
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-dial.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-doublespinbox.png b/src/widgets/doc/images/cleanlooks-doublespinbox.png
new file mode 100644
index 0000000000..93b11f919a
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-doublespinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-fontcombobox.png b/src/widgets/doc/images/cleanlooks-fontcombobox.png
new file mode 100644
index 0000000000..47a5907f56
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-fontcombobox.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-frame.png b/src/widgets/doc/images/cleanlooks-frame.png
new file mode 100644
index 0000000000..2427b08d8f
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-frame.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-groupbox.png b/src/widgets/doc/images/cleanlooks-groupbox.png
new file mode 100644
index 0000000000..89c6eb2f39
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-groupbox.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-horizontalscrollbar.png b/src/widgets/doc/images/cleanlooks-horizontalscrollbar.png
new file mode 100644
index 0000000000..ca1c806c91
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-horizontalscrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-label.png b/src/widgets/doc/images/cleanlooks-label.png
new file mode 100644
index 0000000000..199758fd69
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-label.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-lcdnumber.png b/src/widgets/doc/images/cleanlooks-lcdnumber.png
new file mode 100644
index 0000000000..c6e34127cf
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-lcdnumber.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-lineedit.png b/src/widgets/doc/images/cleanlooks-lineedit.png
new file mode 100644
index 0000000000..3e9f1a4be3
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-lineedit.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-listview.png b/src/widgets/doc/images/cleanlooks-listview.png
new file mode 100644
index 0000000000..95f836c66b
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-listview.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-progressbar.png b/src/widgets/doc/images/cleanlooks-progressbar.png
new file mode 100644
index 0000000000..53fc6c1faa
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-progressbar.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-pushbutton-menu.png b/src/widgets/doc/images/cleanlooks-pushbutton-menu.png
new file mode 100644
index 0000000000..0d5cb59ec0
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-pushbutton-menu.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-pushbutton.png b/src/widgets/doc/images/cleanlooks-pushbutton.png
new file mode 100644
index 0000000000..7b3b3357c1
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-pushbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-radiobutton.png b/src/widgets/doc/images/cleanlooks-radiobutton.png
new file mode 100644
index 0000000000..4e077688c2
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-radiobutton.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-slider.png b/src/widgets/doc/images/cleanlooks-slider.png
new file mode 100644
index 0000000000..8dfaa01092
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-slider.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-spinbox.png b/src/widgets/doc/images/cleanlooks-spinbox.png
new file mode 100644
index 0000000000..ad5b5a01b6
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-spinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-tableview.png b/src/widgets/doc/images/cleanlooks-tableview.png
new file mode 100644
index 0000000000..d89fecc5ad
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-tableview.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-tabwidget.png b/src/widgets/doc/images/cleanlooks-tabwidget.png
new file mode 100644
index 0000000000..bcff2967aa
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-tabwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-textedit.png b/src/widgets/doc/images/cleanlooks-textedit.png
new file mode 100644
index 0000000000..0c825a1e04
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-textedit.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-timeedit.png b/src/widgets/doc/images/cleanlooks-timeedit.png
new file mode 100644
index 0000000000..00420a2f18
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-timeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-toolbox.png b/src/widgets/doc/images/cleanlooks-toolbox.png
new file mode 100644
index 0000000000..63366e5422
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-toolbox.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-toolbutton.png b/src/widgets/doc/images/cleanlooks-toolbutton.png
new file mode 100644
index 0000000000..bcf86ea26f
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-toolbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/cleanlooks-treeview.png b/src/widgets/doc/images/cleanlooks-treeview.png
new file mode 100644
index 0000000000..5bc4a06a3c
--- /dev/null
+++ b/src/widgets/doc/images/cleanlooks-treeview.png
Binary files differ
diff --git a/src/widgets/doc/images/designer-stylesheet-options.png b/src/widgets/doc/images/designer-stylesheet-options.png
new file mode 100644
index 0000000000..a6893e770b
--- /dev/null
+++ b/src/widgets/doc/images/designer-stylesheet-options.png
Binary files differ
diff --git a/src/widgets/doc/images/designer-stylesheet-usage.png b/src/widgets/doc/images/designer-stylesheet-usage.png
new file mode 100644
index 0000000000..f6875900de
--- /dev/null
+++ b/src/widgets/doc/images/designer-stylesheet-usage.png
Binary files differ
diff --git a/src/widgets/doc/images/designer-validator-highlighter.png b/src/widgets/doc/images/designer-validator-highlighter.png
new file mode 100644
index 0000000000..a6661d5c95
--- /dev/null
+++ b/src/widgets/doc/images/designer-validator-highlighter.png
Binary files differ
diff --git a/src/widgets/doc/images/filedialogurls.png b/src/widgets/doc/images/filedialogurls.png
new file mode 100644
index 0000000000..7d22ef33ae
--- /dev/null
+++ b/src/widgets/doc/images/filedialogurls.png
Binary files differ
diff --git a/src/widgets/doc/images/frames.png b/src/widgets/doc/images/frames.png
new file mode 100644
index 0000000000..13c08508a2
--- /dev/null
+++ b/src/widgets/doc/images/frames.png
Binary files differ
diff --git a/src/widgets/doc/images/graphicsview-ellipseitem-pie.png b/src/widgets/doc/images/graphicsview-ellipseitem-pie.png
new file mode 100644
index 0000000000..136175abc2
--- /dev/null
+++ b/src/widgets/doc/images/graphicsview-ellipseitem-pie.png
Binary files differ
diff --git a/src/widgets/doc/images/graphicsview-ellipseitem.png b/src/widgets/doc/images/graphicsview-ellipseitem.png
new file mode 100644
index 0000000000..7c7a8e58d0
--- /dev/null
+++ b/src/widgets/doc/images/graphicsview-ellipseitem.png
Binary files differ
diff --git a/src/widgets/doc/images/graphicsview-items.png b/src/widgets/doc/images/graphicsview-items.png
new file mode 100644
index 0000000000..73be2ddaee
--- /dev/null
+++ b/src/widgets/doc/images/graphicsview-items.png
Binary files differ
diff --git a/src/widgets/doc/images/graphicsview-pathitem.png b/src/widgets/doc/images/graphicsview-pathitem.png
new file mode 100644
index 0000000000..c1ddd5620a
--- /dev/null
+++ b/src/widgets/doc/images/graphicsview-pathitem.png
Binary files differ
diff --git a/src/widgets/doc/images/graphicsview-pixmapitem.png b/src/widgets/doc/images/graphicsview-pixmapitem.png
new file mode 100644
index 0000000000..d14fac55e0
--- /dev/null
+++ b/src/widgets/doc/images/graphicsview-pixmapitem.png
Binary files differ
diff --git a/src/widgets/doc/images/graphicsview-polygonitem.png b/src/widgets/doc/images/graphicsview-polygonitem.png
new file mode 100644
index 0000000000..3cd2232574
--- /dev/null
+++ b/src/widgets/doc/images/graphicsview-polygonitem.png
Binary files differ
diff --git a/src/widgets/doc/images/graphicsview-rectitem.png b/src/widgets/doc/images/graphicsview-rectitem.png
new file mode 100644
index 0000000000..a5917e55dd
--- /dev/null
+++ b/src/widgets/doc/images/graphicsview-rectitem.png
Binary files differ
diff --git a/src/widgets/doc/images/graphicsview-zorder.png b/src/widgets/doc/images/graphicsview-zorder.png
new file mode 100644
index 0000000000..a1cc3d0168
--- /dev/null
+++ b/src/widgets/doc/images/graphicsview-zorder.png
Binary files differ
diff --git a/src/widgets/doc/images/gridlayout.png b/src/widgets/doc/images/gridlayout.png
new file mode 100644
index 0000000000..ae76c0487b
--- /dev/null
+++ b/src/widgets/doc/images/gridlayout.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-calendarwidget.png b/src/widgets/doc/images/gtk-calendarwidget.png
new file mode 100644
index 0000000000..568cd1a5da
--- /dev/null
+++ b/src/widgets/doc/images/gtk-calendarwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-checkbox.png b/src/widgets/doc/images/gtk-checkbox.png
new file mode 100644
index 0000000000..1fd5fc77bf
--- /dev/null
+++ b/src/widgets/doc/images/gtk-checkbox.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-combobox.png b/src/widgets/doc/images/gtk-combobox.png
new file mode 100644
index 0000000000..3b4544df13
--- /dev/null
+++ b/src/widgets/doc/images/gtk-combobox.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-dateedit.png b/src/widgets/doc/images/gtk-dateedit.png
new file mode 100644
index 0000000000..25229f0b3b
--- /dev/null
+++ b/src/widgets/doc/images/gtk-dateedit.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-datetimeedit.png b/src/widgets/doc/images/gtk-datetimeedit.png
new file mode 100644
index 0000000000..0c934a4d0d
--- /dev/null
+++ b/src/widgets/doc/images/gtk-datetimeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-dial.png b/src/widgets/doc/images/gtk-dial.png
new file mode 100644
index 0000000000..18e14b3650
--- /dev/null
+++ b/src/widgets/doc/images/gtk-dial.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-doublespinbox.png b/src/widgets/doc/images/gtk-doublespinbox.png
new file mode 100644
index 0000000000..3a69043c0b
--- /dev/null
+++ b/src/widgets/doc/images/gtk-doublespinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-fontcombobox.png b/src/widgets/doc/images/gtk-fontcombobox.png
new file mode 100644
index 0000000000..4cb1bc1343
--- /dev/null
+++ b/src/widgets/doc/images/gtk-fontcombobox.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-frame.png b/src/widgets/doc/images/gtk-frame.png
new file mode 100644
index 0000000000..c1bf52f6a6
--- /dev/null
+++ b/src/widgets/doc/images/gtk-frame.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-groupbox.png b/src/widgets/doc/images/gtk-groupbox.png
new file mode 100644
index 0000000000..6d217c89f9
--- /dev/null
+++ b/src/widgets/doc/images/gtk-groupbox.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-horizontalscrollbar.png b/src/widgets/doc/images/gtk-horizontalscrollbar.png
new file mode 100644
index 0000000000..2887730c13
--- /dev/null
+++ b/src/widgets/doc/images/gtk-horizontalscrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-label.png b/src/widgets/doc/images/gtk-label.png
new file mode 100644
index 0000000000..006d0133d8
--- /dev/null
+++ b/src/widgets/doc/images/gtk-label.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-lcdnumber.png b/src/widgets/doc/images/gtk-lcdnumber.png
new file mode 100644
index 0000000000..142d298ffc
--- /dev/null
+++ b/src/widgets/doc/images/gtk-lcdnumber.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-lineedit.png b/src/widgets/doc/images/gtk-lineedit.png
new file mode 100644
index 0000000000..8fb513c39f
--- /dev/null
+++ b/src/widgets/doc/images/gtk-lineedit.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-listview.png b/src/widgets/doc/images/gtk-listview.png
new file mode 100644
index 0000000000..d32f8e8aee
--- /dev/null
+++ b/src/widgets/doc/images/gtk-listview.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-progressbar.png b/src/widgets/doc/images/gtk-progressbar.png
new file mode 100644
index 0000000000..6162484bf3
--- /dev/null
+++ b/src/widgets/doc/images/gtk-progressbar.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-pushbutton.png b/src/widgets/doc/images/gtk-pushbutton.png
new file mode 100644
index 0000000000..f4f4d7c1e4
--- /dev/null
+++ b/src/widgets/doc/images/gtk-pushbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-radiobutton.png b/src/widgets/doc/images/gtk-radiobutton.png
new file mode 100644
index 0000000000..b3620fa054
--- /dev/null
+++ b/src/widgets/doc/images/gtk-radiobutton.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-slider.png b/src/widgets/doc/images/gtk-slider.png
new file mode 100644
index 0000000000..3d8e0ee89e
--- /dev/null
+++ b/src/widgets/doc/images/gtk-slider.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-spinbox.png b/src/widgets/doc/images/gtk-spinbox.png
new file mode 100644
index 0000000000..a39eb3aa93
--- /dev/null
+++ b/src/widgets/doc/images/gtk-spinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-tableview.png b/src/widgets/doc/images/gtk-tableview.png
new file mode 100644
index 0000000000..a025193188
--- /dev/null
+++ b/src/widgets/doc/images/gtk-tableview.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-tabwidget.png b/src/widgets/doc/images/gtk-tabwidget.png
new file mode 100644
index 0000000000..089c76dad2
--- /dev/null
+++ b/src/widgets/doc/images/gtk-tabwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-textedit.png b/src/widgets/doc/images/gtk-textedit.png
new file mode 100644
index 0000000000..e4b91c01c9
--- /dev/null
+++ b/src/widgets/doc/images/gtk-textedit.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-timeedit.png b/src/widgets/doc/images/gtk-timeedit.png
new file mode 100644
index 0000000000..acf6730a86
--- /dev/null
+++ b/src/widgets/doc/images/gtk-timeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-toolbox.png b/src/widgets/doc/images/gtk-toolbox.png
new file mode 100644
index 0000000000..25e6137699
--- /dev/null
+++ b/src/widgets/doc/images/gtk-toolbox.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-toolbutton.png b/src/widgets/doc/images/gtk-toolbutton.png
new file mode 100644
index 0000000000..f0eb86efc5
--- /dev/null
+++ b/src/widgets/doc/images/gtk-toolbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/gtk-treeview.png b/src/widgets/doc/images/gtk-treeview.png
new file mode 100644
index 0000000000..7b4e3044be
--- /dev/null
+++ b/src/widgets/doc/images/gtk-treeview.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/branchindicatorimage.png b/src/widgets/doc/images/javastyle/branchindicatorimage.png
new file mode 100644
index 0000000000..f2cfc4b2e9
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/branchindicatorimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/button.png b/src/widgets/doc/images/javastyle/button.png
new file mode 100644
index 0000000000..c3a97425b1
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/button.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/checkbox.png b/src/widgets/doc/images/javastyle/checkbox.png
new file mode 100644
index 0000000000..bc841a6a6d
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/checkbox.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/checkboxexample.png b/src/widgets/doc/images/javastyle/checkboxexample.png
new file mode 100644
index 0000000000..69217fb2e5
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/checkboxexample.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/combobox.png b/src/widgets/doc/images/javastyle/combobox.png
new file mode 100644
index 0000000000..de9745a218
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/combobox.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/comboboximage.png b/src/widgets/doc/images/javastyle/comboboximage.png
new file mode 100644
index 0000000000..1f05e5fe86
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/comboboximage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/conceptualpushbuttontree.png b/src/widgets/doc/images/javastyle/conceptualpushbuttontree.png
new file mode 100644
index 0000000000..910000a6e8
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/conceptualpushbuttontree.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/dockwidget.png b/src/widgets/doc/images/javastyle/dockwidget.png
new file mode 100644
index 0000000000..4bfec142bf
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/dockwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/dockwidgetimage.png b/src/widgets/doc/images/javastyle/dockwidgetimage.png
new file mode 100644
index 0000000000..eefe171e3e
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/dockwidgetimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/groupbox.png b/src/widgets/doc/images/javastyle/groupbox.png
new file mode 100644
index 0000000000..a39cd42c9f
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/groupbox.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/groupboximage.png b/src/widgets/doc/images/javastyle/groupboximage.png
new file mode 100644
index 0000000000..5baf6092d4
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/groupboximage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/header.png b/src/widgets/doc/images/javastyle/header.png
new file mode 100644
index 0000000000..b4546d840e
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/header.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/headerimage.png b/src/widgets/doc/images/javastyle/headerimage.png
new file mode 100644
index 0000000000..41171497d5
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/headerimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/menu.png b/src/widgets/doc/images/javastyle/menu.png
new file mode 100644
index 0000000000..8d44da4054
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/menu.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/menubar.png b/src/widgets/doc/images/javastyle/menubar.png
new file mode 100644
index 0000000000..e68e4a3a55
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/menubar.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/menubarimage.png b/src/widgets/doc/images/javastyle/menubarimage.png
new file mode 100644
index 0000000000..b0cf28edcc
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/menubarimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/menuimage.png b/src/widgets/doc/images/javastyle/menuimage.png
new file mode 100644
index 0000000000..282dde7159
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/menuimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/progressbar.png b/src/widgets/doc/images/javastyle/progressbar.png
new file mode 100644
index 0000000000..de3a838c38
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/progressbar.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/progressbarimage.png b/src/widgets/doc/images/javastyle/progressbarimage.png
new file mode 100644
index 0000000000..433b900ab5
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/progressbarimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/pushbutton.png b/src/widgets/doc/images/javastyle/pushbutton.png
new file mode 100644
index 0000000000..e5f92bea12
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/pushbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/rubberband.png b/src/widgets/doc/images/javastyle/rubberband.png
new file mode 100644
index 0000000000..087424a3f0
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/rubberband.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/rubberbandimage.png b/src/widgets/doc/images/javastyle/rubberbandimage.png
new file mode 100644
index 0000000000..2794638dbc
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/rubberbandimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/scrollbar.png b/src/widgets/doc/images/javastyle/scrollbar.png
new file mode 100644
index 0000000000..c1ecb5d655
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/scrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/scrollbarimage.png b/src/widgets/doc/images/javastyle/scrollbarimage.png
new file mode 100644
index 0000000000..6d3e29d8dd
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/scrollbarimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/sizegrip.png b/src/widgets/doc/images/javastyle/sizegrip.png
new file mode 100644
index 0000000000..667e6fb465
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/sizegrip.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/sizegripimage.png b/src/widgets/doc/images/javastyle/sizegripimage.png
new file mode 100644
index 0000000000..ccbf5254d3
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/sizegripimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/slider.png b/src/widgets/doc/images/javastyle/slider.png
new file mode 100644
index 0000000000..a382233f58
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/slider.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/sliderimage.png b/src/widgets/doc/images/javastyle/sliderimage.png
new file mode 100644
index 0000000000..df700dd712
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/sliderimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/spinbox.png b/src/widgets/doc/images/javastyle/spinbox.png
new file mode 100644
index 0000000000..ec9d6e0d75
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/spinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/spinboximage.png b/src/widgets/doc/images/javastyle/spinboximage.png
new file mode 100644
index 0000000000..d0d57c8ffb
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/spinboximage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/tab.png b/src/widgets/doc/images/javastyle/tab.png
new file mode 100644
index 0000000000..616580c839
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/tab.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/tabwidget.png b/src/widgets/doc/images/javastyle/tabwidget.png
new file mode 100644
index 0000000000..737155ccb9
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/tabwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/titlebar.png b/src/widgets/doc/images/javastyle/titlebar.png
new file mode 100644
index 0000000000..5d7ecc481d
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/titlebar.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/titlebarimage.png b/src/widgets/doc/images/javastyle/titlebarimage.png
new file mode 100644
index 0000000000..50287aeb1d
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/titlebarimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/toolbar.png b/src/widgets/doc/images/javastyle/toolbar.png
new file mode 100644
index 0000000000..e69e8df4c8
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/toolbar.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/toolbarimage.png b/src/widgets/doc/images/javastyle/toolbarimage.png
new file mode 100644
index 0000000000..b9025f582a
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/toolbarimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/toolbox.png b/src/widgets/doc/images/javastyle/toolbox.png
new file mode 100644
index 0000000000..c5f61ecec8
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/toolbox.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/toolboximage.png b/src/widgets/doc/images/javastyle/toolboximage.png
new file mode 100644
index 0000000000..7bcbd26432
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/toolboximage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/toolbutton.png b/src/widgets/doc/images/javastyle/toolbutton.png
new file mode 100644
index 0000000000..9167e83f75
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/toolbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/toolbuttonimage.png b/src/widgets/doc/images/javastyle/toolbuttonimage.png
new file mode 100644
index 0000000000..3217172fca
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/toolbuttonimage.png
Binary files differ
diff --git a/src/widgets/doc/images/javastyle/windowstabimage.png b/src/widgets/doc/images/javastyle/windowstabimage.png
new file mode 100644
index 0000000000..485e847844
--- /dev/null
+++ b/src/widgets/doc/images/javastyle/windowstabimage.png
Binary files differ
diff --git a/src/widgets/doc/images/licensewizard-flow.png b/src/widgets/doc/images/licensewizard-flow.png
new file mode 100644
index 0000000000..76df63a98f
--- /dev/null
+++ b/src/widgets/doc/images/licensewizard-flow.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-calendarwidget.png b/src/widgets/doc/images/macintosh-calendarwidget.png
new file mode 100644
index 0000000000..2f743501a9
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-calendarwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-checkbox.png b/src/widgets/doc/images/macintosh-checkbox.png
new file mode 100644
index 0000000000..d0130e3f22
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-checkbox.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-combobox.png b/src/widgets/doc/images/macintosh-combobox.png
new file mode 100644
index 0000000000..c1dc3c0c96
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-combobox.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-dateedit.png b/src/widgets/doc/images/macintosh-dateedit.png
new file mode 100644
index 0000000000..45aee90a9b
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-dateedit.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-datetimeedit.png b/src/widgets/doc/images/macintosh-datetimeedit.png
new file mode 100644
index 0000000000..62af02d64e
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-datetimeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-dial.png b/src/widgets/doc/images/macintosh-dial.png
new file mode 100644
index 0000000000..df0ffe23a1
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-dial.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-doublespinbox.png b/src/widgets/doc/images/macintosh-doublespinbox.png
new file mode 100644
index 0000000000..a0695ff278
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-doublespinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-fontcombobox.png b/src/widgets/doc/images/macintosh-fontcombobox.png
new file mode 100644
index 0000000000..8a5a3c78a3
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-fontcombobox.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-frame.png b/src/widgets/doc/images/macintosh-frame.png
new file mode 100644
index 0000000000..fee61a3643
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-frame.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-groupbox.png b/src/widgets/doc/images/macintosh-groupbox.png
new file mode 100644
index 0000000000..f6c7bce580
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-groupbox.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-horizontalscrollbar.png b/src/widgets/doc/images/macintosh-horizontalscrollbar.png
new file mode 100644
index 0000000000..8b63572a9e
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-horizontalscrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-label.png b/src/widgets/doc/images/macintosh-label.png
new file mode 100644
index 0000000000..753aa4d138
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-label.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-lcdnumber.png b/src/widgets/doc/images/macintosh-lcdnumber.png
new file mode 100644
index 0000000000..2ea9ea0713
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-lcdnumber.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-lineedit.png b/src/widgets/doc/images/macintosh-lineedit.png
new file mode 100644
index 0000000000..0e992c7ffe
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-lineedit.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-listview.png b/src/widgets/doc/images/macintosh-listview.png
new file mode 100644
index 0000000000..346e6427ff
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-listview.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-menu.png b/src/widgets/doc/images/macintosh-menu.png
new file mode 100644
index 0000000000..59bdceaab6
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-menu.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-progressbar.png b/src/widgets/doc/images/macintosh-progressbar.png
new file mode 100644
index 0000000000..2dfc8aba81
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-progressbar.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-pushbutton.png b/src/widgets/doc/images/macintosh-pushbutton.png
new file mode 100644
index 0000000000..7ec14910d8
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-pushbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-radiobutton.png b/src/widgets/doc/images/macintosh-radiobutton.png
new file mode 100644
index 0000000000..8b02f509ff
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-radiobutton.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-slider.png b/src/widgets/doc/images/macintosh-slider.png
new file mode 100644
index 0000000000..bf0c5464e9
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-slider.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-spinbox.png b/src/widgets/doc/images/macintosh-spinbox.png
new file mode 100644
index 0000000000..4196c37246
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-spinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-tableview.png b/src/widgets/doc/images/macintosh-tableview.png
new file mode 100644
index 0000000000..e6512494de
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-tableview.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-tabwidget.png b/src/widgets/doc/images/macintosh-tabwidget.png
new file mode 100644
index 0000000000..1d174a47e6
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-tabwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-textedit.png b/src/widgets/doc/images/macintosh-textedit.png
new file mode 100644
index 0000000000..4f0ce36baf
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-textedit.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-timeedit.png b/src/widgets/doc/images/macintosh-timeedit.png
new file mode 100644
index 0000000000..4bcfce33f8
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-timeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-toolbox.png b/src/widgets/doc/images/macintosh-toolbox.png
new file mode 100644
index 0000000000..18d41ea595
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-toolbox.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-toolbutton.png b/src/widgets/doc/images/macintosh-toolbutton.png
new file mode 100644
index 0000000000..f91331cc51
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-toolbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/macintosh-treeview.png b/src/widgets/doc/images/macintosh-treeview.png
new file mode 100644
index 0000000000..afda6d8372
--- /dev/null
+++ b/src/widgets/doc/images/macintosh-treeview.png
Binary files differ
diff --git a/src/widgets/doc/images/mainwindow-docks.png b/src/widgets/doc/images/mainwindow-docks.png
new file mode 100644
index 0000000000..24f42a28ea
--- /dev/null
+++ b/src/widgets/doc/images/mainwindow-docks.png
Binary files differ
diff --git a/src/widgets/doc/images/mainwindowlayout.png b/src/widgets/doc/images/mainwindowlayout.png
new file mode 100644
index 0000000000..4776ce4f1b
--- /dev/null
+++ b/src/widgets/doc/images/mainwindowlayout.png
Binary files differ
diff --git a/src/widgets/doc/images/mdi-cascade.png b/src/widgets/doc/images/mdi-cascade.png
new file mode 100644
index 0000000000..ca55a5b894
--- /dev/null
+++ b/src/widgets/doc/images/mdi-cascade.png
Binary files differ
diff --git a/src/widgets/doc/images/mdi-tile.png b/src/widgets/doc/images/mdi-tile.png
new file mode 100644
index 0000000000..1486d9654e
--- /dev/null
+++ b/src/widgets/doc/images/mdi-tile.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-calendarwidget.png b/src/widgets/doc/images/motif-calendarwidget.png
new file mode 100644
index 0000000000..4ce6aebc21
--- /dev/null
+++ b/src/widgets/doc/images/motif-calendarwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-checkbox.png b/src/widgets/doc/images/motif-checkbox.png
new file mode 100644
index 0000000000..2a263273a6
--- /dev/null
+++ b/src/widgets/doc/images/motif-checkbox.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-combobox.png b/src/widgets/doc/images/motif-combobox.png
new file mode 100644
index 0000000000..2a288d9f40
--- /dev/null
+++ b/src/widgets/doc/images/motif-combobox.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-dateedit.png b/src/widgets/doc/images/motif-dateedit.png
new file mode 100644
index 0000000000..d00c45ff65
--- /dev/null
+++ b/src/widgets/doc/images/motif-dateedit.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-datetimeedit.png b/src/widgets/doc/images/motif-datetimeedit.png
new file mode 100644
index 0000000000..cc43ef888d
--- /dev/null
+++ b/src/widgets/doc/images/motif-datetimeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-dial.png b/src/widgets/doc/images/motif-dial.png
new file mode 100644
index 0000000000..36b3ff7be0
--- /dev/null
+++ b/src/widgets/doc/images/motif-dial.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-doublespinbox.png b/src/widgets/doc/images/motif-doublespinbox.png
new file mode 100644
index 0000000000..6092913ab0
--- /dev/null
+++ b/src/widgets/doc/images/motif-doublespinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-fontcombobox.png b/src/widgets/doc/images/motif-fontcombobox.png
new file mode 100644
index 0000000000..c07452d85e
--- /dev/null
+++ b/src/widgets/doc/images/motif-fontcombobox.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-frame.png b/src/widgets/doc/images/motif-frame.png
new file mode 100644
index 0000000000..55dcc32227
--- /dev/null
+++ b/src/widgets/doc/images/motif-frame.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-groupbox.png b/src/widgets/doc/images/motif-groupbox.png
new file mode 100644
index 0000000000..13742b116e
--- /dev/null
+++ b/src/widgets/doc/images/motif-groupbox.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-horizontalscrollbar.png b/src/widgets/doc/images/motif-horizontalscrollbar.png
new file mode 100644
index 0000000000..dab1d3f6f6
--- /dev/null
+++ b/src/widgets/doc/images/motif-horizontalscrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-label.png b/src/widgets/doc/images/motif-label.png
new file mode 100644
index 0000000000..7ae6674f50
--- /dev/null
+++ b/src/widgets/doc/images/motif-label.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-lcdnumber.png b/src/widgets/doc/images/motif-lcdnumber.png
new file mode 100644
index 0000000000..e2cc9a8058
--- /dev/null
+++ b/src/widgets/doc/images/motif-lcdnumber.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-lineedit.png b/src/widgets/doc/images/motif-lineedit.png
new file mode 100644
index 0000000000..a335c8c107
--- /dev/null
+++ b/src/widgets/doc/images/motif-lineedit.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-listview.png b/src/widgets/doc/images/motif-listview.png
new file mode 100644
index 0000000000..47bd3eae6d
--- /dev/null
+++ b/src/widgets/doc/images/motif-listview.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-menubar.png b/src/widgets/doc/images/motif-menubar.png
new file mode 100644
index 0000000000..f1d9f4bb3d
--- /dev/null
+++ b/src/widgets/doc/images/motif-menubar.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-progressbar.png b/src/widgets/doc/images/motif-progressbar.png
new file mode 100644
index 0000000000..f6d6979b86
--- /dev/null
+++ b/src/widgets/doc/images/motif-progressbar.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-pushbutton.png b/src/widgets/doc/images/motif-pushbutton.png
new file mode 100644
index 0000000000..9dc6a9db78
--- /dev/null
+++ b/src/widgets/doc/images/motif-pushbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-radiobutton.png b/src/widgets/doc/images/motif-radiobutton.png
new file mode 100644
index 0000000000..468e54cfcf
--- /dev/null
+++ b/src/widgets/doc/images/motif-radiobutton.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-slider.png b/src/widgets/doc/images/motif-slider.png
new file mode 100644
index 0000000000..6301e2b26d
--- /dev/null
+++ b/src/widgets/doc/images/motif-slider.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-spinbox.png b/src/widgets/doc/images/motif-spinbox.png
new file mode 100644
index 0000000000..9acc2821c8
--- /dev/null
+++ b/src/widgets/doc/images/motif-spinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-tableview.png b/src/widgets/doc/images/motif-tableview.png
new file mode 100644
index 0000000000..a1d205aaed
--- /dev/null
+++ b/src/widgets/doc/images/motif-tableview.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-tabwidget.png b/src/widgets/doc/images/motif-tabwidget.png
new file mode 100644
index 0000000000..19da66a76c
--- /dev/null
+++ b/src/widgets/doc/images/motif-tabwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-textedit.png b/src/widgets/doc/images/motif-textedit.png
new file mode 100644
index 0000000000..205bc19cfa
--- /dev/null
+++ b/src/widgets/doc/images/motif-textedit.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-timeedit.png b/src/widgets/doc/images/motif-timeedit.png
new file mode 100644
index 0000000000..1ad459b886
--- /dev/null
+++ b/src/widgets/doc/images/motif-timeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-toolbox.png b/src/widgets/doc/images/motif-toolbox.png
new file mode 100644
index 0000000000..4bc3c37bb2
--- /dev/null
+++ b/src/widgets/doc/images/motif-toolbox.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-toolbutton.png b/src/widgets/doc/images/motif-toolbutton.png
new file mode 100644
index 0000000000..8ef51ddd8d
--- /dev/null
+++ b/src/widgets/doc/images/motif-toolbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/motif-treeview.png b/src/widgets/doc/images/motif-treeview.png
new file mode 100644
index 0000000000..a7dd0f2466
--- /dev/null
+++ b/src/widgets/doc/images/motif-treeview.png
Binary files differ
diff --git a/src/widgets/doc/images/msgbox1.png b/src/widgets/doc/images/msgbox1.png
new file mode 100644
index 0000000000..1380e20a5f
--- /dev/null
+++ b/src/widgets/doc/images/msgbox1.png
Binary files differ
diff --git a/src/widgets/doc/images/msgbox2.png b/src/widgets/doc/images/msgbox2.png
new file mode 100644
index 0000000000..e7946996e4
--- /dev/null
+++ b/src/widgets/doc/images/msgbox2.png
Binary files differ
diff --git a/src/widgets/doc/images/msgbox3.png b/src/widgets/doc/images/msgbox3.png
new file mode 100644
index 0000000000..bd81f4d4da
--- /dev/null
+++ b/src/widgets/doc/images/msgbox3.png
Binary files differ
diff --git a/src/widgets/doc/images/msgbox4.png b/src/widgets/doc/images/msgbox4.png
new file mode 100644
index 0000000000..dbe6701cdd
--- /dev/null
+++ b/src/widgets/doc/images/msgbox4.png
Binary files differ
diff --git a/src/widgets/doc/images/pangesture.png b/src/widgets/doc/images/pangesture.png
new file mode 100644
index 0000000000..24caf91d3b
--- /dev/null
+++ b/src/widgets/doc/images/pangesture.png
Binary files differ
diff --git a/src/widgets/doc/images/parent-child-widgets.png b/src/widgets/doc/images/parent-child-widgets.png
new file mode 100644
index 0000000000..094e2e96b6
--- /dev/null
+++ b/src/widgets/doc/images/parent-child-widgets.png
Binary files differ
diff --git a/src/widgets/doc/images/pinchgesture.png b/src/widgets/doc/images/pinchgesture.png
new file mode 100644
index 0000000000..95614c4052
--- /dev/null
+++ b/src/widgets/doc/images/pinchgesture.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-calendarwidget.png b/src/widgets/doc/images/plastique-calendarwidget.png
new file mode 100644
index 0000000000..5e65945c72
--- /dev/null
+++ b/src/widgets/doc/images/plastique-calendarwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-checkbox.png b/src/widgets/doc/images/plastique-checkbox.png
new file mode 100644
index 0000000000..91a5109d65
--- /dev/null
+++ b/src/widgets/doc/images/plastique-checkbox.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-colordialog.png b/src/widgets/doc/images/plastique-colordialog.png
new file mode 100644
index 0000000000..68bf4d0b4b
--- /dev/null
+++ b/src/widgets/doc/images/plastique-colordialog.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-combobox.png b/src/widgets/doc/images/plastique-combobox.png
new file mode 100644
index 0000000000..e3bf8a321f
--- /dev/null
+++ b/src/widgets/doc/images/plastique-combobox.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-dateedit.png b/src/widgets/doc/images/plastique-dateedit.png
new file mode 100644
index 0000000000..2e28a40f01
--- /dev/null
+++ b/src/widgets/doc/images/plastique-dateedit.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-datetimeedit.png b/src/widgets/doc/images/plastique-datetimeedit.png
new file mode 100644
index 0000000000..810bf1660a
--- /dev/null
+++ b/src/widgets/doc/images/plastique-datetimeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-dial.png b/src/widgets/doc/images/plastique-dial.png
new file mode 100644
index 0000000000..b65e7c78cd
--- /dev/null
+++ b/src/widgets/doc/images/plastique-dial.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-doublespinbox.png b/src/widgets/doc/images/plastique-doublespinbox.png
new file mode 100644
index 0000000000..627c4a20fe
--- /dev/null
+++ b/src/widgets/doc/images/plastique-doublespinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-fontcombobox.png b/src/widgets/doc/images/plastique-fontcombobox.png
new file mode 100644
index 0000000000..d3823081d8
--- /dev/null
+++ b/src/widgets/doc/images/plastique-fontcombobox.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-fontdialog.png b/src/widgets/doc/images/plastique-fontdialog.png
new file mode 100644
index 0000000000..7e799a8815
--- /dev/null
+++ b/src/widgets/doc/images/plastique-fontdialog.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-frame.png b/src/widgets/doc/images/plastique-frame.png
new file mode 100644
index 0000000000..9f81f6cba4
--- /dev/null
+++ b/src/widgets/doc/images/plastique-frame.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-groupbox.png b/src/widgets/doc/images/plastique-groupbox.png
new file mode 100644
index 0000000000..d353c40071
--- /dev/null
+++ b/src/widgets/doc/images/plastique-groupbox.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-horizontalscrollbar.png b/src/widgets/doc/images/plastique-horizontalscrollbar.png
new file mode 100644
index 0000000000..d20300c23f
--- /dev/null
+++ b/src/widgets/doc/images/plastique-horizontalscrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-label.png b/src/widgets/doc/images/plastique-label.png
new file mode 100644
index 0000000000..d2a55a862c
--- /dev/null
+++ b/src/widgets/doc/images/plastique-label.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-lcdnumber.png b/src/widgets/doc/images/plastique-lcdnumber.png
new file mode 100644
index 0000000000..74149ee158
--- /dev/null
+++ b/src/widgets/doc/images/plastique-lcdnumber.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-lineedit.png b/src/widgets/doc/images/plastique-lineedit.png
new file mode 100644
index 0000000000..f455383520
--- /dev/null
+++ b/src/widgets/doc/images/plastique-lineedit.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-listview.png b/src/widgets/doc/images/plastique-listview.png
new file mode 100644
index 0000000000..64bd00fe1f
--- /dev/null
+++ b/src/widgets/doc/images/plastique-listview.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-menu.png b/src/widgets/doc/images/plastique-menu.png
new file mode 100644
index 0000000000..88df2493af
--- /dev/null
+++ b/src/widgets/doc/images/plastique-menu.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-menubar.png b/src/widgets/doc/images/plastique-menubar.png
new file mode 100644
index 0000000000..642f95d6cf
--- /dev/null
+++ b/src/widgets/doc/images/plastique-menubar.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-progressbar.png b/src/widgets/doc/images/plastique-progressbar.png
new file mode 100644
index 0000000000..fe8dd90274
--- /dev/null
+++ b/src/widgets/doc/images/plastique-progressbar.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-progressdialog.png b/src/widgets/doc/images/plastique-progressdialog.png
new file mode 100644
index 0000000000..4373bcac16
--- /dev/null
+++ b/src/widgets/doc/images/plastique-progressdialog.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-pushbutton-menu.png b/src/widgets/doc/images/plastique-pushbutton-menu.png
new file mode 100644
index 0000000000..d090033aa7
--- /dev/null
+++ b/src/widgets/doc/images/plastique-pushbutton-menu.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-pushbutton.png b/src/widgets/doc/images/plastique-pushbutton.png
new file mode 100644
index 0000000000..83c44fd38d
--- /dev/null
+++ b/src/widgets/doc/images/plastique-pushbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-radiobutton.png b/src/widgets/doc/images/plastique-radiobutton.png
new file mode 100644
index 0000000000..a2c820d7d1
--- /dev/null
+++ b/src/widgets/doc/images/plastique-radiobutton.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-sizegrip.png b/src/widgets/doc/images/plastique-sizegrip.png
new file mode 100644
index 0000000000..09a551efab
--- /dev/null
+++ b/src/widgets/doc/images/plastique-sizegrip.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-slider.png b/src/widgets/doc/images/plastique-slider.png
new file mode 100644
index 0000000000..492f0fdfbd
--- /dev/null
+++ b/src/widgets/doc/images/plastique-slider.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-spinbox.png b/src/widgets/doc/images/plastique-spinbox.png
new file mode 100644
index 0000000000..af15db3c23
--- /dev/null
+++ b/src/widgets/doc/images/plastique-spinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-statusbar.png b/src/widgets/doc/images/plastique-statusbar.png
new file mode 100644
index 0000000000..c8f9792ab9
--- /dev/null
+++ b/src/widgets/doc/images/plastique-statusbar.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-tabbar-truncated.png b/src/widgets/doc/images/plastique-tabbar-truncated.png
new file mode 100644
index 0000000000..8e906d9928
--- /dev/null
+++ b/src/widgets/doc/images/plastique-tabbar-truncated.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-tabbar.png b/src/widgets/doc/images/plastique-tabbar.png
new file mode 100644
index 0000000000..3371dda1b6
--- /dev/null
+++ b/src/widgets/doc/images/plastique-tabbar.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-tableview.png b/src/widgets/doc/images/plastique-tableview.png
new file mode 100644
index 0000000000..b20c1cce7f
--- /dev/null
+++ b/src/widgets/doc/images/plastique-tableview.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-tabwidget.png b/src/widgets/doc/images/plastique-tabwidget.png
new file mode 100644
index 0000000000..92ae398844
--- /dev/null
+++ b/src/widgets/doc/images/plastique-tabwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-textedit.png b/src/widgets/doc/images/plastique-textedit.png
new file mode 100644
index 0000000000..a802d75fcc
--- /dev/null
+++ b/src/widgets/doc/images/plastique-textedit.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-timeedit.png b/src/widgets/doc/images/plastique-timeedit.png
new file mode 100644
index 0000000000..2d70b84c4c
--- /dev/null
+++ b/src/widgets/doc/images/plastique-timeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-toolbox.png b/src/widgets/doc/images/plastique-toolbox.png
new file mode 100644
index 0000000000..10bcd7af62
--- /dev/null
+++ b/src/widgets/doc/images/plastique-toolbox.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-toolbutton.png b/src/widgets/doc/images/plastique-toolbutton.png
new file mode 100644
index 0000000000..4e51831408
--- /dev/null
+++ b/src/widgets/doc/images/plastique-toolbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/plastique-treeview.png b/src/widgets/doc/images/plastique-treeview.png
new file mode 100644
index 0000000000..db0bc01a25
--- /dev/null
+++ b/src/widgets/doc/images/plastique-treeview.png
Binary files differ
diff --git a/src/widgets/doc/images/progressBar-stylesheet.png b/src/widgets/doc/images/progressBar-stylesheet.png
new file mode 100644
index 0000000000..b4bf755b6c
--- /dev/null
+++ b/src/widgets/doc/images/progressBar-stylesheet.png
Binary files differ
diff --git a/src/widgets/doc/images/progressBar2-stylesheet.png b/src/widgets/doc/images/progressBar2-stylesheet.png
new file mode 100644
index 0000000000..8b5ecc0a66
--- /dev/null
+++ b/src/widgets/doc/images/progressBar2-stylesheet.png
Binary files differ
diff --git a/src/widgets/doc/images/propagation-custom.png b/src/widgets/doc/images/propagation-custom.png
new file mode 100644
index 0000000000..866b44d677
--- /dev/null
+++ b/src/widgets/doc/images/propagation-custom.png
Binary files differ
diff --git a/src/widgets/doc/images/propagation-standard.png b/src/widgets/doc/images/propagation-standard.png
new file mode 100644
index 0000000000..b010fccc95
--- /dev/null
+++ b/src/widgets/doc/images/propagation-standard.png
Binary files differ
diff --git a/src/widgets/doc/images/qcalendarwidget-grid.png b/src/widgets/doc/images/qcalendarwidget-grid.png
new file mode 100644
index 0000000000..3df4dd99e2
--- /dev/null
+++ b/src/widgets/doc/images/qcalendarwidget-grid.png
Binary files differ
diff --git a/src/widgets/doc/images/qcalendarwidget-maximum.png b/src/widgets/doc/images/qcalendarwidget-maximum.png
new file mode 100644
index 0000000000..1e78d20e85
--- /dev/null
+++ b/src/widgets/doc/images/qcalendarwidget-maximum.png
Binary files differ
diff --git a/src/widgets/doc/images/qcalendarwidget-minimum.png b/src/widgets/doc/images/qcalendarwidget-minimum.png
new file mode 100644
index 0000000000..f860429309
--- /dev/null
+++ b/src/widgets/doc/images/qcalendarwidget-minimum.png
Binary files differ
diff --git a/src/widgets/doc/images/qcolumnview.png b/src/widgets/doc/images/qcolumnview.png
new file mode 100644
index 0000000000..1d312bf953
--- /dev/null
+++ b/src/widgets/doc/images/qcolumnview.png
Binary files differ
diff --git a/src/widgets/doc/images/qdesktopwidget.png b/src/widgets/doc/images/qdesktopwidget.png
new file mode 100644
index 0000000000..02f8e8b5ad
--- /dev/null
+++ b/src/widgets/doc/images/qdesktopwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/qformlayout-kde.png b/src/widgets/doc/images/qformlayout-kde.png
new file mode 100644
index 0000000000..c32bb12499
--- /dev/null
+++ b/src/widgets/doc/images/qformlayout-kde.png
Binary files differ
diff --git a/src/widgets/doc/images/qformlayout-mac.png b/src/widgets/doc/images/qformlayout-mac.png
new file mode 100644
index 0000000000..0a0824efb6
--- /dev/null
+++ b/src/widgets/doc/images/qformlayout-mac.png
Binary files differ
diff --git a/src/widgets/doc/images/qformlayout-qpe.png b/src/widgets/doc/images/qformlayout-qpe.png
new file mode 100644
index 0000000000..3abecc5716
--- /dev/null
+++ b/src/widgets/doc/images/qformlayout-qpe.png
Binary files differ
diff --git a/src/widgets/doc/images/qformlayout-win.png b/src/widgets/doc/images/qformlayout-win.png
new file mode 100644
index 0000000000..1ed44bdd3b
--- /dev/null
+++ b/src/widgets/doc/images/qformlayout-win.png
Binary files differ
diff --git a/src/widgets/doc/images/qformlayout-with-6-children.png b/src/widgets/doc/images/qformlayout-with-6-children.png
new file mode 100644
index 0000000000..f743599702
--- /dev/null
+++ b/src/widgets/doc/images/qformlayout-with-6-children.png
Binary files differ
diff --git a/src/widgets/doc/images/qgraphicsproxywidget-embed.png b/src/widgets/doc/images/qgraphicsproxywidget-embed.png
new file mode 100644
index 0000000000..10d8f6fddd
--- /dev/null
+++ b/src/widgets/doc/images/qgraphicsproxywidget-embed.png
Binary files differ
diff --git a/src/widgets/doc/images/qgridlayout-with-5-children.png b/src/widgets/doc/images/qgridlayout-with-5-children.png
new file mode 100644
index 0000000000..8d0c2962e4
--- /dev/null
+++ b/src/widgets/doc/images/qgridlayout-with-5-children.png
Binary files differ
diff --git a/src/widgets/doc/images/qhboxlayout-with-5-children.png b/src/widgets/doc/images/qhboxlayout-with-5-children.png
new file mode 100644
index 0000000000..9b48dc5c47
--- /dev/null
+++ b/src/widgets/doc/images/qhboxlayout-with-5-children.png
Binary files differ
diff --git a/src/widgets/doc/images/qmdisubwindowlayout.png b/src/widgets/doc/images/qmdisubwindowlayout.png
new file mode 100644
index 0000000000..ffe5cc3949
--- /dev/null
+++ b/src/widgets/doc/images/qmdisubwindowlayout.png
Binary files differ
diff --git a/src/widgets/doc/images/qscrollarea-noscrollbars.png b/src/widgets/doc/images/qscrollarea-noscrollbars.png
new file mode 100644
index 0000000000..a1520f3e21
--- /dev/null
+++ b/src/widgets/doc/images/qscrollarea-noscrollbars.png
Binary files differ
diff --git a/src/widgets/doc/images/qscrollarea-onescrollbar.png b/src/widgets/doc/images/qscrollarea-onescrollbar.png
new file mode 100644
index 0000000000..b4f7976bc4
--- /dev/null
+++ b/src/widgets/doc/images/qscrollarea-onescrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/qscrollarea-twoscrollbars.png b/src/widgets/doc/images/qscrollarea-twoscrollbars.png
new file mode 100644
index 0000000000..bf720e498c
--- /dev/null
+++ b/src/widgets/doc/images/qscrollarea-twoscrollbars.png
Binary files differ
diff --git a/src/widgets/doc/images/qscrollbar-picture.png b/src/widgets/doc/images/qscrollbar-picture.png
new file mode 100644
index 0000000000..898e014c40
--- /dev/null
+++ b/src/widgets/doc/images/qscrollbar-picture.png
Binary files differ
diff --git a/src/widgets/doc/images/qscrollbar-values.png b/src/widgets/doc/images/qscrollbar-values.png
new file mode 100644
index 0000000000..cea744b3be
--- /dev/null
+++ b/src/widgets/doc/images/qscrollbar-values.png
Binary files differ
diff --git a/src/widgets/doc/images/qspinbox-plusminus.png b/src/widgets/doc/images/qspinbox-plusminus.png
new file mode 100644
index 0000000000..3b35a408a0
--- /dev/null
+++ b/src/widgets/doc/images/qspinbox-plusminus.png
Binary files differ
diff --git a/src/widgets/doc/images/qspinbox-updown.png b/src/widgets/doc/images/qspinbox-updown.png
new file mode 100644
index 0000000000..a6caa4419b
--- /dev/null
+++ b/src/widgets/doc/images/qspinbox-updown.png
Binary files differ
diff --git a/src/widgets/doc/images/qstyle-comboboxes.png b/src/widgets/doc/images/qstyle-comboboxes.png
new file mode 100644
index 0000000000..aecec914a0
--- /dev/null
+++ b/src/widgets/doc/images/qstyle-comboboxes.png
Binary files differ
diff --git a/src/widgets/doc/images/qstyleoptiontoolbar-position.png b/src/widgets/doc/images/qstyleoptiontoolbar-position.png
new file mode 100644
index 0000000000..5eaae7e4cd
--- /dev/null
+++ b/src/widgets/doc/images/qstyleoptiontoolbar-position.png
Binary files differ
diff --git a/src/widgets/doc/images/qtableview-resized.png b/src/widgets/doc/images/qtableview-resized.png
new file mode 100644
index 0000000000..813256ee9e
--- /dev/null
+++ b/src/widgets/doc/images/qtableview-resized.png
Binary files differ
diff --git a/src/widgets/doc/images/qtwizard-aero1.png b/src/widgets/doc/images/qtwizard-aero1.png
new file mode 100644
index 0000000000..fe9e9bc21c
--- /dev/null
+++ b/src/widgets/doc/images/qtwizard-aero1.png
Binary files differ
diff --git a/src/widgets/doc/images/qtwizard-aero2.png b/src/widgets/doc/images/qtwizard-aero2.png
new file mode 100644
index 0000000000..261c0651fe
--- /dev/null
+++ b/src/widgets/doc/images/qtwizard-aero2.png
Binary files differ
diff --git a/src/widgets/doc/images/qtwizard-classic1.png b/src/widgets/doc/images/qtwizard-classic1.png
new file mode 100644
index 0000000000..be3edbecaf
--- /dev/null
+++ b/src/widgets/doc/images/qtwizard-classic1.png
Binary files differ
diff --git a/src/widgets/doc/images/qtwizard-classic2.png b/src/widgets/doc/images/qtwizard-classic2.png
new file mode 100644
index 0000000000..165f569d1d
--- /dev/null
+++ b/src/widgets/doc/images/qtwizard-classic2.png
Binary files differ
diff --git a/src/widgets/doc/images/qtwizard-mac1.png b/src/widgets/doc/images/qtwizard-mac1.png
new file mode 100644
index 0000000000..bc8cd9b715
--- /dev/null
+++ b/src/widgets/doc/images/qtwizard-mac1.png
Binary files differ
diff --git a/src/widgets/doc/images/qtwizard-mac2.png b/src/widgets/doc/images/qtwizard-mac2.png
new file mode 100644
index 0000000000..850f6b85a5
--- /dev/null
+++ b/src/widgets/doc/images/qtwizard-mac2.png
Binary files differ
diff --git a/src/widgets/doc/images/qtwizard-macpage.png b/src/widgets/doc/images/qtwizard-macpage.png
new file mode 100644
index 0000000000..1ba3122f91
--- /dev/null
+++ b/src/widgets/doc/images/qtwizard-macpage.png
Binary files differ
diff --git a/src/widgets/doc/images/qtwizard-modern1.png b/src/widgets/doc/images/qtwizard-modern1.png
new file mode 100644
index 0000000000..223e3ddec3
--- /dev/null
+++ b/src/widgets/doc/images/qtwizard-modern1.png
Binary files differ
diff --git a/src/widgets/doc/images/qtwizard-modern2.png b/src/widgets/doc/images/qtwizard-modern2.png
new file mode 100644
index 0000000000..d66c374a4c
--- /dev/null
+++ b/src/widgets/doc/images/qtwizard-modern2.png
Binary files differ
diff --git a/src/widgets/doc/images/qtwizard-nonmacpage.png b/src/widgets/doc/images/qtwizard-nonmacpage.png
new file mode 100644
index 0000000000..cbe464d57f
--- /dev/null
+++ b/src/widgets/doc/images/qtwizard-nonmacpage.png
Binary files differ
diff --git a/src/widgets/doc/images/qundoview.png b/src/widgets/doc/images/qundoview.png
new file mode 100644
index 0000000000..3bdb1cf2ed
--- /dev/null
+++ b/src/widgets/doc/images/qundoview.png
Binary files differ
diff --git a/src/widgets/doc/images/qvboxlayout-with-5-children.png b/src/widgets/doc/images/qvboxlayout-with-5-children.png
new file mode 100644
index 0000000000..57c37d7247
--- /dev/null
+++ b/src/widgets/doc/images/qvboxlayout-with-5-children.png
Binary files differ
diff --git a/src/widgets/doc/images/simpleanchorlayout-example.png b/src/widgets/doc/images/simpleanchorlayout-example.png
new file mode 100644
index 0000000000..1d5c8ac048
--- /dev/null
+++ b/src/widgets/doc/images/simpleanchorlayout-example.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-border-image-normal.png b/src/widgets/doc/images/stylesheet-border-image-normal.png
new file mode 100644
index 0000000000..8afe3c9a67
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-border-image-normal.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-border-image-stretched.png b/src/widgets/doc/images/stylesheet-border-image-stretched.png
new file mode 100644
index 0000000000..3f9ca92dd3
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-border-image-stretched.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-border-image-wrong.png b/src/widgets/doc/images/stylesheet-border-image-wrong.png
new file mode 100644
index 0000000000..19d6e449f4
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-border-image-wrong.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-boxmodel.png b/src/widgets/doc/images/stylesheet-boxmodel.png
new file mode 100644
index 0000000000..a0249d77b7
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-boxmodel.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-branch-closed.png b/src/widgets/doc/images/stylesheet-branch-closed.png
new file mode 100644
index 0000000000..213ffdd88f
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-branch-closed.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-branch-end.png b/src/widgets/doc/images/stylesheet-branch-end.png
new file mode 100644
index 0000000000..54915b3b01
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-branch-end.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-branch-more.png b/src/widgets/doc/images/stylesheet-branch-more.png
new file mode 100644
index 0000000000..664ad44740
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-branch-more.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-branch-open.png b/src/widgets/doc/images/stylesheet-branch-open.png
new file mode 100644
index 0000000000..e8cad95ccf
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-branch-open.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-coffee-cleanlooks.png b/src/widgets/doc/images/stylesheet-coffee-cleanlooks.png
new file mode 100644
index 0000000000..e75df0d80a
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-coffee-cleanlooks.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-coffee-xp.png b/src/widgets/doc/images/stylesheet-coffee-xp.png
new file mode 100644
index 0000000000..8bedd80ee9
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-coffee-xp.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-pagefold-mac.png b/src/widgets/doc/images/stylesheet-pagefold-mac.png
new file mode 100644
index 0000000000..5c061b9cfd
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-pagefold-mac.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-pagefold.png b/src/widgets/doc/images/stylesheet-pagefold.png
new file mode 100644
index 0000000000..5ccb4edbc9
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-pagefold.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-redbutton1.png b/src/widgets/doc/images/stylesheet-redbutton1.png
new file mode 100644
index 0000000000..cb03375e12
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-redbutton1.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-redbutton2.png b/src/widgets/doc/images/stylesheet-redbutton2.png
new file mode 100644
index 0000000000..5325708942
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-redbutton2.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-redbutton3.png b/src/widgets/doc/images/stylesheet-redbutton3.png
new file mode 100644
index 0000000000..dd976f0760
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-redbutton3.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-scrollbar1.png b/src/widgets/doc/images/stylesheet-scrollbar1.png
new file mode 100644
index 0000000000..666ff1119a
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-scrollbar1.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-scrollbar2.png b/src/widgets/doc/images/stylesheet-scrollbar2.png
new file mode 100644
index 0000000000..439cf8035d
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-scrollbar2.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-treeview.png b/src/widgets/doc/images/stylesheet-treeview.png
new file mode 100644
index 0000000000..883d190f36
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-treeview.png
Binary files differ
diff --git a/src/widgets/doc/images/stylesheet-vline.png b/src/widgets/doc/images/stylesheet-vline.png
new file mode 100644
index 0000000000..8f0c336fd8
--- /dev/null
+++ b/src/widgets/doc/images/stylesheet-vline.png
Binary files differ
diff --git a/src/widgets/doc/images/swipegesture.png b/src/widgets/doc/images/swipegesture.png
new file mode 100644
index 0000000000..0b7d35af3a
--- /dev/null
+++ b/src/widgets/doc/images/swipegesture.png
Binary files differ
diff --git a/src/widgets/doc/images/system-tray.png b/src/widgets/doc/images/system-tray.png
new file mode 100644
index 0000000000..298b193cf7
--- /dev/null
+++ b/src/widgets/doc/images/system-tray.png
Binary files differ
diff --git a/src/widgets/doc/images/tabWidget-stylesheet1.png b/src/widgets/doc/images/tabWidget-stylesheet1.png
new file mode 100644
index 0000000000..fc8fc19e74
--- /dev/null
+++ b/src/widgets/doc/images/tabWidget-stylesheet1.png
Binary files differ
diff --git a/src/widgets/doc/images/tabWidget-stylesheet2.png b/src/widgets/doc/images/tabWidget-stylesheet2.png
new file mode 100644
index 0000000000..2cbf2bf36d
--- /dev/null
+++ b/src/widgets/doc/images/tabWidget-stylesheet2.png
Binary files differ
diff --git a/src/widgets/doc/images/tabWidget-stylesheet3.png b/src/widgets/doc/images/tabWidget-stylesheet3.png
new file mode 100644
index 0000000000..f57a9c9f9c
--- /dev/null
+++ b/src/widgets/doc/images/tabWidget-stylesheet3.png
Binary files differ
diff --git a/src/widgets/doc/images/tableWidget-stylesheet.png b/src/widgets/doc/images/tableWidget-stylesheet.png
new file mode 100644
index 0000000000..e99e7a97c8
--- /dev/null
+++ b/src/widgets/doc/images/tableWidget-stylesheet.png
Binary files differ
diff --git a/src/widgets/doc/images/widgetdelegate.png b/src/widgets/doc/images/widgetdelegate.png
new file mode 100644
index 0000000000..3df4c4b6a5
--- /dev/null
+++ b/src/widgets/doc/images/widgetdelegate.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-calendarwidget.png b/src/widgets/doc/images/windows-calendarwidget.png
new file mode 100644
index 0000000000..ad016238ad
--- /dev/null
+++ b/src/widgets/doc/images/windows-calendarwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-checkbox.png b/src/widgets/doc/images/windows-checkbox.png
new file mode 100644
index 0000000000..eb1be4b736
--- /dev/null
+++ b/src/widgets/doc/images/windows-checkbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-combobox.png b/src/widgets/doc/images/windows-combobox.png
new file mode 100644
index 0000000000..d6bc483494
--- /dev/null
+++ b/src/widgets/doc/images/windows-combobox.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-dateedit.png b/src/widgets/doc/images/windows-dateedit.png
new file mode 100644
index 0000000000..95587ec62e
--- /dev/null
+++ b/src/widgets/doc/images/windows-dateedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-datetimeedit.png b/src/widgets/doc/images/windows-datetimeedit.png
new file mode 100644
index 0000000000..6aa1766146
--- /dev/null
+++ b/src/widgets/doc/images/windows-datetimeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-dial.png b/src/widgets/doc/images/windows-dial.png
new file mode 100644
index 0000000000..0aa3a26159
--- /dev/null
+++ b/src/widgets/doc/images/windows-dial.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-doublespinbox.png b/src/widgets/doc/images/windows-doublespinbox.png
new file mode 100644
index 0000000000..244b5f66cd
--- /dev/null
+++ b/src/widgets/doc/images/windows-doublespinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-fontcombobox.png b/src/widgets/doc/images/windows-fontcombobox.png
new file mode 100644
index 0000000000..bf98cad922
--- /dev/null
+++ b/src/widgets/doc/images/windows-fontcombobox.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-frame.png b/src/widgets/doc/images/windows-frame.png
new file mode 100644
index 0000000000..5979b31b25
--- /dev/null
+++ b/src/widgets/doc/images/windows-frame.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-groupbox.png b/src/widgets/doc/images/windows-groupbox.png
new file mode 100644
index 0000000000..88f46a3832
--- /dev/null
+++ b/src/widgets/doc/images/windows-groupbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-horizontalscrollbar.png b/src/widgets/doc/images/windows-horizontalscrollbar.png
new file mode 100644
index 0000000000..1f36b9a352
--- /dev/null
+++ b/src/widgets/doc/images/windows-horizontalscrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-label.png b/src/widgets/doc/images/windows-label.png
new file mode 100644
index 0000000000..a1c3a396a9
--- /dev/null
+++ b/src/widgets/doc/images/windows-label.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-lcdnumber.png b/src/widgets/doc/images/windows-lcdnumber.png
new file mode 100644
index 0000000000..b463511aab
--- /dev/null
+++ b/src/widgets/doc/images/windows-lcdnumber.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-lineedit.png b/src/widgets/doc/images/windows-lineedit.png
new file mode 100644
index 0000000000..270e4517ff
--- /dev/null
+++ b/src/widgets/doc/images/windows-lineedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-listview.png b/src/widgets/doc/images/windows-listview.png
new file mode 100644
index 0000000000..2884fae1b1
--- /dev/null
+++ b/src/widgets/doc/images/windows-listview.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-progressbar.png b/src/widgets/doc/images/windows-progressbar.png
new file mode 100644
index 0000000000..361799a70e
--- /dev/null
+++ b/src/widgets/doc/images/windows-progressbar.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-pushbutton.png b/src/widgets/doc/images/windows-pushbutton.png
new file mode 100644
index 0000000000..14528d6808
--- /dev/null
+++ b/src/widgets/doc/images/windows-pushbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-radiobutton.png b/src/widgets/doc/images/windows-radiobutton.png
new file mode 100644
index 0000000000..db328cb563
--- /dev/null
+++ b/src/widgets/doc/images/windows-radiobutton.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-slider.png b/src/widgets/doc/images/windows-slider.png
new file mode 100644
index 0000000000..fde85024b6
--- /dev/null
+++ b/src/widgets/doc/images/windows-slider.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-spinbox.png b/src/widgets/doc/images/windows-spinbox.png
new file mode 100644
index 0000000000..d4e93c584a
--- /dev/null
+++ b/src/widgets/doc/images/windows-spinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-tableview.png b/src/widgets/doc/images/windows-tableview.png
new file mode 100644
index 0000000000..89da89fb5f
--- /dev/null
+++ b/src/widgets/doc/images/windows-tableview.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-tabwidget.png b/src/widgets/doc/images/windows-tabwidget.png
new file mode 100644
index 0000000000..8622f7ec6a
--- /dev/null
+++ b/src/widgets/doc/images/windows-tabwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-textedit.png b/src/widgets/doc/images/windows-textedit.png
new file mode 100644
index 0000000000..fd21ade02f
--- /dev/null
+++ b/src/widgets/doc/images/windows-textedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-timeedit.png b/src/widgets/doc/images/windows-timeedit.png
new file mode 100644
index 0000000000..6ae0e406bc
--- /dev/null
+++ b/src/widgets/doc/images/windows-timeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-toolbox.png b/src/widgets/doc/images/windows-toolbox.png
new file mode 100644
index 0000000000..99b471e6df
--- /dev/null
+++ b/src/widgets/doc/images/windows-toolbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-toolbutton.png b/src/widgets/doc/images/windows-toolbutton.png
new file mode 100644
index 0000000000..9ceb846ed4
--- /dev/null
+++ b/src/widgets/doc/images/windows-toolbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/windows-treeview.png b/src/widgets/doc/images/windows-treeview.png
new file mode 100644
index 0000000000..f55cd69c79
--- /dev/null
+++ b/src/widgets/doc/images/windows-treeview.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-calendarwidget.png b/src/widgets/doc/images/windowsvista-calendarwidget.png
new file mode 100644
index 0000000000..3cb1ab78dc
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-calendarwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-checkbox.png b/src/widgets/doc/images/windowsvista-checkbox.png
new file mode 100644
index 0000000000..b9bc909988
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-checkbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-combobox.png b/src/widgets/doc/images/windowsvista-combobox.png
new file mode 100644
index 0000000000..f53192f45a
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-combobox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-dateedit.png b/src/widgets/doc/images/windowsvista-dateedit.png
new file mode 100644
index 0000000000..bb79482849
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-dateedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-datetimeedit.png b/src/widgets/doc/images/windowsvista-datetimeedit.png
new file mode 100644
index 0000000000..0a104de084
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-datetimeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-dial.png b/src/widgets/doc/images/windowsvista-dial.png
new file mode 100644
index 0000000000..7081269c31
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-dial.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-doublespinbox.png b/src/widgets/doc/images/windowsvista-doublespinbox.png
new file mode 100644
index 0000000000..6efa9379fd
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-doublespinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-fontcombobox.png b/src/widgets/doc/images/windowsvista-fontcombobox.png
new file mode 100644
index 0000000000..3771e84bd4
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-fontcombobox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-frame.png b/src/widgets/doc/images/windowsvista-frame.png
new file mode 100644
index 0000000000..63b8422d2b
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-frame.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-groupbox.png b/src/widgets/doc/images/windowsvista-groupbox.png
new file mode 100644
index 0000000000..967d8878a7
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-groupbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-horizontalscrollbar.png b/src/widgets/doc/images/windowsvista-horizontalscrollbar.png
new file mode 100644
index 0000000000..996865d66c
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-horizontalscrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-label.png b/src/widgets/doc/images/windowsvista-label.png
new file mode 100644
index 0000000000..caef8d8361
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-label.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-lcdnumber.png b/src/widgets/doc/images/windowsvista-lcdnumber.png
new file mode 100644
index 0000000000..911438e2b1
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-lcdnumber.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-lineedit.png b/src/widgets/doc/images/windowsvista-lineedit.png
new file mode 100644
index 0000000000..9fcde3a851
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-lineedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-listview.png b/src/widgets/doc/images/windowsvista-listview.png
new file mode 100644
index 0000000000..36a03438ab
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-listview.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-progressbar.png b/src/widgets/doc/images/windowsvista-progressbar.png
new file mode 100644
index 0000000000..0bda010811
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-progressbar.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-pushbutton.png b/src/widgets/doc/images/windowsvista-pushbutton.png
new file mode 100644
index 0000000000..3bc438dc10
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-pushbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-radiobutton.png b/src/widgets/doc/images/windowsvista-radiobutton.png
new file mode 100644
index 0000000000..fdfd2d66dd
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-radiobutton.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-slider.png b/src/widgets/doc/images/windowsvista-slider.png
new file mode 100644
index 0000000000..be2fffb7b5
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-slider.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-spinbox.png b/src/widgets/doc/images/windowsvista-spinbox.png
new file mode 100644
index 0000000000..4a2293e724
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-spinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-tableview.png b/src/widgets/doc/images/windowsvista-tableview.png
new file mode 100644
index 0000000000..96f4937bc1
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-tableview.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-tabwidget.png b/src/widgets/doc/images/windowsvista-tabwidget.png
new file mode 100644
index 0000000000..259c4f1a89
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-tabwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-textedit.png b/src/widgets/doc/images/windowsvista-textedit.png
new file mode 100644
index 0000000000..5e5696623e
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-textedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-timeedit.png b/src/widgets/doc/images/windowsvista-timeedit.png
new file mode 100644
index 0000000000..e24fdd268a
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-timeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-toolbox.png b/src/widgets/doc/images/windowsvista-toolbox.png
new file mode 100644
index 0000000000..8cfe5f9cab
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-toolbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-toolbutton.png b/src/widgets/doc/images/windowsvista-toolbutton.png
new file mode 100644
index 0000000000..0baa9809c1
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-toolbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsvista-treeview.png b/src/widgets/doc/images/windowsvista-treeview.png
new file mode 100644
index 0000000000..db211e4b5f
--- /dev/null
+++ b/src/widgets/doc/images/windowsvista-treeview.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-calendarwidget.png b/src/widgets/doc/images/windowsxp-calendarwidget.png
new file mode 100644
index 0000000000..9a5fa6ebcd
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-calendarwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-checkbox.png b/src/widgets/doc/images/windowsxp-checkbox.png
new file mode 100644
index 0000000000..505d3a3641
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-checkbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-combobox.png b/src/widgets/doc/images/windowsxp-combobox.png
new file mode 100644
index 0000000000..2363c8401c
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-combobox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-dateedit.png b/src/widgets/doc/images/windowsxp-dateedit.png
new file mode 100644
index 0000000000..060ba07b2c
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-dateedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-datetimeedit.png b/src/widgets/doc/images/windowsxp-datetimeedit.png
new file mode 100644
index 0000000000..4e41f0fc14
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-datetimeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-dial.png b/src/widgets/doc/images/windowsxp-dial.png
new file mode 100644
index 0000000000..0aa3a26159
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-dial.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-doublespinbox.png b/src/widgets/doc/images/windowsxp-doublespinbox.png
new file mode 100644
index 0000000000..3165a61b93
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-doublespinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-fontcombobox.png b/src/widgets/doc/images/windowsxp-fontcombobox.png
new file mode 100644
index 0000000000..96292b84ef
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-fontcombobox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-frame.png b/src/widgets/doc/images/windowsxp-frame.png
new file mode 100644
index 0000000000..5979b31b25
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-frame.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-groupbox.png b/src/widgets/doc/images/windowsxp-groupbox.png
new file mode 100644
index 0000000000..0b6f7e21ad
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-groupbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-horizontalscrollbar.png b/src/widgets/doc/images/windowsxp-horizontalscrollbar.png
new file mode 100644
index 0000000000..38812ec107
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-horizontalscrollbar.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-label.png b/src/widgets/doc/images/windowsxp-label.png
new file mode 100644
index 0000000000..a1c3a396a9
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-label.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-lcdnumber.png b/src/widgets/doc/images/windowsxp-lcdnumber.png
new file mode 100644
index 0000000000..102023c8ed
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-lcdnumber.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-lineedit.png b/src/widgets/doc/images/windowsxp-lineedit.png
new file mode 100644
index 0000000000..9102b53ca4
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-lineedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-listview.png b/src/widgets/doc/images/windowsxp-listview.png
new file mode 100644
index 0000000000..b0fc9bd3a7
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-listview.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-menu.png b/src/widgets/doc/images/windowsxp-menu.png
new file mode 100644
index 0000000000..b8ca947e73
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-menu.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-progressbar.png b/src/widgets/doc/images/windowsxp-progressbar.png
new file mode 100644
index 0000000000..c8a73d6754
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-progressbar.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-pushbutton.png b/src/widgets/doc/images/windowsxp-pushbutton.png
new file mode 100644
index 0000000000..bf6b7bf15d
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-pushbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-radiobutton.png b/src/widgets/doc/images/windowsxp-radiobutton.png
new file mode 100644
index 0000000000..ad8a908fb2
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-radiobutton.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-slider.png b/src/widgets/doc/images/windowsxp-slider.png
new file mode 100644
index 0000000000..9e2fca7c40
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-slider.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-spinbox.png b/src/widgets/doc/images/windowsxp-spinbox.png
new file mode 100644
index 0000000000..e42073cd6b
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-spinbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-tableview.png b/src/widgets/doc/images/windowsxp-tableview.png
new file mode 100644
index 0000000000..5d12137ad5
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-tableview.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-tabwidget.png b/src/widgets/doc/images/windowsxp-tabwidget.png
new file mode 100644
index 0000000000..3c8e777a0b
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-tabwidget.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-textedit.png b/src/widgets/doc/images/windowsxp-textedit.png
new file mode 100644
index 0000000000..d89c75c71b
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-textedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-timeedit.png b/src/widgets/doc/images/windowsxp-timeedit.png
new file mode 100644
index 0000000000..751cca9e6a
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-timeedit.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-toolbox.png b/src/widgets/doc/images/windowsxp-toolbox.png
new file mode 100644
index 0000000000..99b471e6df
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-toolbox.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-toolbutton.png b/src/widgets/doc/images/windowsxp-toolbutton.png
new file mode 100644
index 0000000000..ea63e16aae
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-toolbutton.png
Binary files differ
diff --git a/src/widgets/doc/images/windowsxp-treeview.png b/src/widgets/doc/images/windowsxp-treeview.png
new file mode 100644
index 0000000000..050cc2f4d6
--- /dev/null
+++ b/src/widgets/doc/images/windowsxp-treeview.png
Binary files differ
diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf
new file mode 100644
index 0000000000..c90f25338e
--- /dev/null
+++ b/src/widgets/doc/qtwidgets.qdocconf
@@ -0,0 +1,92 @@
+include(../../../doc/global/qt-cpp-ignore.qdocconf)
+
+project = QtWidgets
+description = Qt Widgets Reference Documentation
+url = http://qt-project.org/doc/qt-5.0/qtwidgets
+version = 5.0.0
+
+sourceencoding = UTF-8
+outputencoding = UTF-8
+naturallanguage = en_US
+qhp.projects = QtWidgets
+
+qhp.QtWidgets.file = qtwidgets.qhp
+qhp.QtWidgets.namespace = org.qt-project.qtwidgets.500
+qhp.QtWidgets.virtualFolder = qdoc
+qhp.QtWidgets.indexTitle = Qt Widgets Reference Documentation
+qhp.QtWidgets.indexRoot =
+
+qhp.QtWidgets.filterAttributes = qtwidgets 5.0.0 qtrefdoc
+qhp.QtWidgets.customFilters.Qt.name = QtWidgets 5.0.0
+qhp.QtWidgets.customFilters.Qt.filterAttributes = qtwidgets 5.0.0
+qhp.QtWidgets.subprojects = classes overviews examples
+qhp.QtWidgets.subprojects.classes.title = Classes
+qhp.QtWidgets.subprojects.classes.indexTitle = Qt Widgets' Classes
+qhp.QtWidgets.subprojects.classes.selectors = class fake:headerfile
+qhp.QtWidgets.subprojects.classes.sortPages = true
+qhp.QtWidgets.subprojects.overviews.title = Overviews
+qhp.QtWidgets.subprojects.overviews.indexTitle = All Overviews and HOWTOs
+qhp.QtWidgets.subprojects.overviews.selectors = fake:page,group,module
+qhp.QtWidgets.subprojects.examples.title = Qt Widgets Examples
+qhp.QtWidgets.subprojects.examples.indexTitle = Qt Widgets Examples
+qhp.QtWidgets.subprojects.examples.selectors = fake:example
+
+dita.metadata.default.author = Qt Project
+dita.metadata.default.permissions = all
+dita.metadata.default.publisher = Qt Project
+dita.metadata.default.copyryear = 2012
+dita.metadata.default.copyrholder = Nokia
+dita.metadata.default.audience = programmer
+
+sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc"
+headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx"
+
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css"
+examples.imageextensions = "*.png"
+
+outputdir = ../../../doc/qtwidgets
+tagfile = ../../../doc/qtwidgets/qtwidgets.tags
+
+HTML.generatemacrefs = "true"
+HTML.nobreadcrumbs = "true"
+
+HTML.templatedir = .
+
+HTML.stylesheets = ../../../doc/global/style/offline.css
+
+HTML.headerstyles = \
+ " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
+
+HTML.endheader = \
+ "</head>\n" \
+
+defines = Q_QDOC \
+ QT_.*_SUPPORT \
+ QT_.*_LIB \
+ QT_COMPAT \
+ QT_KEYPAD_NAVIGATION \
+ QT_NO_EGL \
+ Q_WS_.* \
+ Q_OS_.* \
+ Q_BYTE_ORDER \
+ QT_DEPRECATED \
+ QT_DEPRECATED_* \
+ Q_NO_USING_KEYWORD \
+ __cplusplus \
+ Q_COMPILER_INITIALIZER_LISTS
+
+versionsym = QT_VERSION_STR
+
+codeindent = 1
+
+depends += qtcore qtgui
+
+headerdirs += ..
+
+sourcedirs += ..
+
+exampledirs += ../../../examples \
+ ../ \
+ snippets
+
+imagedirs += images
diff --git a/src/widgets/doc/snippets/code/doc_src_layout.cpp b/src/widgets/doc/snippets/code/doc_src_layout.cpp
new file mode 100644
index 0000000000..b6abab61d3
--- /dev/null
+++ b/src/widgets/doc/snippets/code/doc_src_layout.cpp
@@ -0,0 +1,166 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#ifndef CARD_H
+#define CARD_H
+
+#include <QtGui>
+#include <QList>
+
+class CardLayout : public QLayout
+{
+public:
+ CardLayout(QWidget *parent, int dist): QLayout(parent, 0, dist) {}
+ CardLayout(QLayout *parent, int dist): QLayout(parent, dist) {}
+ CardLayout(int dist): QLayout(dist) {}
+ ~CardLayout();
+
+ void addItem(QLayoutItem *item);
+ QSize sizeHint() const;
+ QSize minimumSize() const;
+ QLayoutItem *count() const;
+ QLayoutItem *itemAt(int) const;
+ QLayoutItem *takeAt(int);
+ void setGeometry(const QRect &rect);
+
+private:
+ QList<QLayoutItem*> list;
+};
+#endif
+//! [0]
+
+
+//! [1]
+//#include "card.h"
+//! [1]
+
+//! [2]
+QLayoutItem *CardLayout::count() const
+{
+ // QList::size() returns the number of QLayoutItems in the list
+ return list.size();
+}
+//! [2]
+
+//! [3]
+QLayoutItem *CardLayout::itemAt(int idx) const
+{
+ // QList::value() performs index checking, and returns 0 if we are
+ // outside the valid range
+ return list.value(idx);
+}
+
+QLayoutItem *CardLayout::takeAt(int idx)
+{
+ // QList::take does not do index checking
+ return idx >= 0 && idx < list.size() ? list.takeAt(idx) : 0;
+}
+//! [3]
+
+
+//! [4]
+void CardLayout::addItem(QLayoutItem *item)
+{
+ list.append(item);
+}
+//! [4]
+
+
+//! [5]
+CardLayout::~CardLayout()
+{
+ QLayoutItem *item;
+ while ((item = takeAt(0)))
+ delete item;
+}
+//! [5]
+
+
+//! [6]
+void CardLayout::setGeometry(const QRect &r)
+{
+ QLayout::setGeometry(r);
+
+ if (list.size() == 0)
+ return;
+
+ int w = r.width() - (list.count() - 1) * spacing();
+ int h = r.height() - (list.count() - 1) * spacing();
+ int i = 0;
+ while (i < list.size()) {
+ QLayoutItem *o = list.at(i);
+ QRect geom(r.x() + i * spacing(), r.y() + i * spacing(), w, h);
+ o->setGeometry(geom);
+ ++i;
+ }
+}
+//! [6]
+
+
+//! [7]
+QSize CardLayout::sizeHint() const
+{
+ QSize s(0,0);
+ int n = list.count();
+ if (n > 0)
+ s = QSize(100,70); //start with a nice default size
+ int i = 0;
+ while (i < n) {
+ QLayoutItem *o = list.at(i);
+ s = s.expandedTo(o->sizeHint());
+ ++i;
+ }
+ return s + n*QSize(spacing(), spacing());
+}
+
+QSize CardLayout::minimumSize() const
+{
+ QSize s(0,0);
+ int n = list.count();
+ int i = 0;
+ while (i < n) {
+ QLayoutItem *o = list.at(i);
+ s = s.expandedTo(o->minimumSize());
+ ++i;
+ }
+ return s + n*QSize(spacing(), spacing());
+}
+//! [7]
diff --git a/src/widgets/doc/snippets/code/doc_src_qt4-styles.cpp b/src/widgets/doc/snippets/code/doc_src_qt4-styles.cpp
new file mode 100644
index 0000000000..9bebb825e4
--- /dev/null
+++ b/src/widgets/doc/snippets/code/doc_src_qt4-styles.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+const QStyleOptionFocusRect *focusRectOption =
+ qstyleoption_cast<const QStyleOptionFocusRect *>(option);
+if (focusRectOption) {
+ ...
+}
+//! [0]
+
+
+//! [1]
+void MyWidget::paintEvent(QPaintEvent *event)
+{
+ QPainter painter(this);
+ ...
+
+ QStyleOptionFocusRect option(1);
+ option.init(this);
+ option.backgroundColor = palette().color(QPalette::Window);
+
+ style().drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter,
+ this);
+}
+//! [1]
+
+
+//! [2]
+void drawControl(ControlElement element,
+ QPainter *painter,
+ const QWidget *widget,
+ const QRect &rect,
+ const QColorGroup &colorGroup,
+ SFlags how = Style_Default,
+ const QStyleOption &option = QStyleOption::Default) const;
+//! [2]
+
+
+//! [3]
+void drawControl(ControlElement element,
+ const QStyleOption *option,
+ QPainter *painter,
+ const QWidget *widget = 0) const;
+//! [3]
diff --git a/src/widgets/doc/snippets/code/doc_src_qtwidgets.cpp b/src/widgets/doc/snippets/code/doc_src_qtwidgets.cpp
new file mode 100644
index 0000000000..74888e3891
--- /dev/null
+++ b/src/widgets/doc/snippets/code/doc_src_qtwidgets.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [1]
+#include <QtWidgets>
+//! [1]
diff --git a/src/widgets/doc/snippets/code/doc_src_qtwidgets.pro b/src/widgets/doc/snippets/code/doc_src_qtwidgets.pro
new file mode 100644
index 0000000000..7e3c633dd5
--- /dev/null
+++ b/src/widgets/doc/snippets/code/doc_src_qtwidgets.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#! [0]
+QT += widgets
+#! [0]
diff --git a/src/widgets/doc/snippets/code/doc_src_styles.cpp b/src/widgets/doc/snippets/code/doc_src_styles.cpp
new file mode 100644
index 0000000000..6c079c6637
--- /dev/null
+++ b/src/widgets/doc/snippets/code/doc_src_styles.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+ opt.initFrom(q);
+ if (down)
+ opt.state |= QStyle::State_Sunken;
+ if (tristate && noChange)
+ opt.state |= QStyle::State_NoChange;
+ else
+ opt.state |= checked ? QStyle::State_On :
+ QStyle::State_Off;
+ if (q->testAttribute(Qt::WA_Hover) && q->underMouse()) {
+ if (hovering)
+ opt.state |= QStyle::State_MouseOver;
+ else
+ opt.state &= ~QStyle::State_MouseOver;
+ }
+ opt.text = text;
+ opt.icon = icon;
+ opt.iconSize = q->iconSize();
+//! [0]
+
+
+//! [1]
+ state = QStyle::State_None;
+ if (widget->isEnabled())
+ state |= QStyle::State_Enabled;
+ if (widget->hasFocus())
+ state |= QStyle::State_HasFocus;
+ if (widget->window()->testAttribute(Qt::WA_KeyboardFocusChange))
+ state |= QStyle::State_KeyboardFocusChange;
+ if (widget->underMouse())
+ state |= QStyle::State_MouseOver;
+ if (widget->window()->isActiveWindow())
+ state |= QStyle::State_Active;
+#ifdef Q_WS_MAC
+ extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp
+ if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
+ state &= ~QStyle::State_Enabled;
+#endif
+#ifdef QT_KEYPAD_NAVIGATION
+ if (widget->hasEditFocus())
+ state |= QStyle::State_HasEditFocus;
+#endif
+
+ direction = widget->layoutDirection();
+ rect = widget->rect();
+ palette = widget->palette();
+ fontMetrics = widget->fontMetrics();
+//! [1]
+
+
+//! [2]
+ QStylePainter p(this);
+ QStyleOptionButton opt = d->getStyleOption();
+ p.drawControl(QStyle::CE_CheckBox, opt);
+//! [2]
+
+
+//! [3]
+ QStyleOptionButton subopt = *btn;
+ subopt.rect = subElementRect(SE_CheckBoxIndicator, btn, widget);
+ drawPrimitive(PE_IndicatorCheckBox, &subopt, p, widget);
+ subopt.rect = subElementRect(SE_CheckBoxContents, btn, widget);
+ drawControl(CE_CheckBoxLabel, &subopt, p, widget);
+
+ if (btn->state & State_HasFocus) {
+ QStyleOptionFocusRect fropt;
+ fropt.QStyleOption::operator=(*btn);
+ fropt.rect = subElementRect(SE_CheckBoxFocusRect, btn, widget);
+ drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ }
+//! [3]
+
+
+//! [4]
+ const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt);
+ uint alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter);
+
+ if (!styleHint(SH_UnderlineShortcut, btn, widget))
+ alignment |= Qt::TextHideMnemonic;
+ QPixmap pix;
+ QRect textRect = btn->rect;
+ if (!btn->icon.isNull()) {
+ pix = btn->icon.pixmap(btn->iconSize, btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled);
+ drawItemPixmap(p, btn->rect, alignment, pix);
+ if (btn->direction == Qt::RightToLeft)
+ textRect.setRight(textRect.right() - btn->iconSize.width() - 4);
+ else
+ textRect.setLeft(textRect.left() + btn->iconSize.width() + 4);
+ }
+ if (!btn->text.isEmpty()){
+ drawItemText(p, textRect, alignment | Qt::TextShowMnemonic,
+ btn->palette, btn->state & State_Enabled, btn->text, QPalette::WindowText);
+ }
+//! [4]
diff --git a/src/widgets/doc/snippets/code/doc_src_stylesheet.cpp b/src/widgets/doc/snippets/code/doc_src_stylesheet.cpp
new file mode 100644
index 0000000000..eb02634c6d
--- /dev/null
+++ b/src/widgets/doc/snippets/code/doc_src_stylesheet.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [21]
+qApp->setStyleSheet("QPushButton { color: white }");
+//! [21]
+
+
+//! [22]
+myPushButton->setStyleSheet("* { color: blue }");
+//! [22]
+
+
+//! [23]
+myPushButton->setStyleSheet("color: blue");
+//! [23]
+
+
+//! [24]
+qApp->setStyleSheet("QGroupBox { color: red; } ");
+//! [24]
+
+//! [25]
+qApp->setStyleSheet("QGroupBox, QGroupBox * { color: red; }");
+//! [25]
+
+
+//! [26]
+class MyPushButton : public QPushButton {
+ // ...
+}
+
+// ...
+qApp->setStyleSheet("MyPushButton { background: yellow; }");
+//! [26]
+
+
+//! [27]
+namespace ns {
+ class MyPushButton : public QPushButton {
+ // ...
+ }
+}
+
+// ...
+qApp->setStyleSheet("ns--MyPushButton { background: yellow; }");
+//! [27]
+
+
+//! [32]
+void CustomWidget::paintEvent(QPaintEvent *)
+{
+ QStyleOption opt;
+ opt.init(this);
+ QPainter p(this);
+ style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+}
+//! [32]
+
+
+//! [88]
+qApp->setStyleSheet("QLineEdit { background-color: yellow }");
+//! [88]
+
+
+//! [89]
+myDialog->setStyleSheet("QLineEdit { background-color: yellow }");
+//! [89]
+
+
+//! [90]
+myDialog->setStyleSheet("QLineEdit#nameEdit { background-color: yellow }");
+//! [90]
+
+
+//! [91]
+nameEdit->setStyleSheet("background-color: yellow");
+//! [91]
+
+
+//! [92]
+nameEdit->setStyleSheet("color: blue; background-color: yellow");
+//! [92]
+
+
+//! [93]
+nameEdit->setStyleSheet("color: blue;"
+ "background-color: yellow;"
+ "selection-color: yellow;"
+ "selection-background-color: blue;");
+//! [93]
+
+
+//! [95]
+QLineEdit *nameEdit = new QLineEdit(this);
+nameEdit->setProperty("mandatoryField", true);
+
+QLineEdit *emailEdit = new QLineEdit(this);
+emailEdit->setProperty("mandatoryField", true);
+
+QSpinBox *ageSpinBox = new QSpinBox(this);
+ageSpinBox->setProperty("mandatoryField", true);
+//! [95]
diff --git a/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc b/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc
new file mode 100644
index 0000000000..9acba09c67
--- /dev/null
+++ b/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc
@@ -0,0 +1,1866 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QLineEdit { background: yellow }
+QCheckBox { color: red }
+//! [0]
+
+
+//! [1]
+QPushButton { color: red }
+//! [1]
+
+
+//! [2]
+QPushButton, QLineEdit, QComboBox { color: red }
+//! [2]
+
+
+//! [3]
+QPushButton { color: red }
+QLineEdit { color: red }
+QComboBox { color: red }
+//! [3]
+
+
+//! [4]
+QPushButton { color: red; background-color: white }
+//! [4]
+
+
+//! [5]
+QComboBox::drop-down { image: url(dropdown.png) }
+//! [5]
+
+
+//! [6]
+QComboBox {
+ margin-right: 20px;
+}
+QComboBox::drop-down {
+ subcontrol-origin: margin;
+}
+//! [6]
+
+
+//! [7]
+QComboBox::down-arrow {
+ image: url(down_arrow.png);
+}
+QComboBox::down-arrow:pressed {
+ position: relative;
+ top: 1px; left: 1px;
+}
+//! [7]
+
+
+//! [8]
+QPushButton:hover { color: white }
+//! [8]
+
+
+//! [9]
+QRadioButton:!hover { color: red }
+//! [9]
+
+
+//! [10]
+QCheckBox:hover:checked { color: white }
+//! [10]
+
+
+//! [11]
+QPushButton:hover:!pressed { color: blue; }
+//! [11]
+
+
+//! [12]
+QCheckBox:hover, QCheckBox:checked { color: white }
+//! [12]
+
+
+//! [13]
+QComboBox::drop-down:hover { image: url(dropdown_bright.png) }
+//! [13]
+
+
+//! [14]
+QPushButton#okButton { color: gray }
+QPushButton { color: red }
+//! [14]
+
+
+//! [15]
+QPushButton:hover { color: white }
+QPushButton { color: red }
+//! [15]
+
+
+//! [16]
+QPushButton:hover { color: white }
+QPushButton:enabled { color: red }
+//! [16]
+
+
+//! [17]
+QPushButton:enabled { color: red }
+QPushButton:hover { color: white }
+//! [17]
+
+
+//! [18]
+QPushButton:hover:enabled { color: white }
+QPushButton:enabled { color: red }
+//! [18]
+
+
+//! [19]
+QPushButton { color: red }
+QAbstractButton { color: gray }
+//! [19]
+
+
+//! [20]
+* {} /* a=0 b=0 c=0 -> specificity = 0 */
+LI {} /* a=0 b=0 c=1 -> specificity = 1 */
+UL LI {} /* a=0 b=0 c=2 -> specificity = 2 */
+UL OL+LI {} /* a=0 b=0 c=3 -> specificity = 3 */
+H1 + *[REL=up]{} /* a=0 b=1 c=1 -> specificity = 11 */
+UL OL LI.red {} /* a=0 b=1 c=3 -> specificity = 13 */
+LI.red.level {} /* a=0 b=2 c=1 -> specificity = 21 */
+#x34y {} /* a=1 b=0 c=0 -> specificity = 100 */
+//! [20]
+
+
+//! [28]
+MyLabel { qproperty-pixmap: url(pixmap.png); }
+MyGroupBox { qproperty-titleColor: rgb(100, 200, 100); }
+QPushButton { qproperty-iconSize: 20px 20px; }
+//! [28]
+
+
+//! [30]
+QPushButton { background-color: red; border: none; }
+//! [30]
+
+
+//! [31]
+QToolButton { background-color: red; border: none; }
+//! [31]
+
+
+//! [33]
+QTreeView {
+ alternate-background-color: blue;
+ background: yellow;
+}
+//! [33]
+
+
+//! [34]
+QTextEdit { background: yellow }
+//! [34]
+
+
+//! [35]
+QLabel {
+ background-image: url(dense6pattern.png);
+ background-repeat: repeat-xy;
+}
+//! [35]
+
+
+//! [36]
+QLabel { background-color: yellow }
+QLineEdit { background-color: rgb(255, 0, 0) }
+//! [36]
+
+
+//! [37]
+QFrame { background-image: url(:/images/hydro.png) }
+//! [37]
+
+
+//! [38]
+QFrame {
+ background: white url(:/images/ring.png);
+ background-repeat: repeat-y;
+ background-position: left;
+}
+//! [38]
+
+
+//! [39]
+QFrame {
+ background: url(:/images/footer.png);
+ background-position: bottom left;
+}
+//! [39]
+
+
+//! [40]
+QTextEdit {
+ background-image: url("leaves.png");
+ background-attachment: fixed;
+}
+//! [40]
+
+
+//! [41]
+QFrame {
+ background-image: url(:/images/header.png);
+ background-position: top left;
+ background-origin: content;
+ background-clip: padding;
+}
+//! [41]
+
+
+//! [42]
+QFrame {
+ background-image: url(:/images/header.png);
+ background-position: top left;
+ background-origin: content;
+}
+//! [42]
+
+
+//! [43]
+QLineEdit { border: 1px solid white }
+//! [43]
+
+
+//! [44]
+QLineEdit {
+ border-width: 1px;
+ border-style: solid;
+ border-color: white;
+}
+//! [44]
+
+
+//! [45]
+QLineEdit {
+ border-width: 1px;
+ border-style: solid;
+ border-radius: 4px;
+}
+//! [45]
+
+
+//! [46]
+QLineEdit {
+ border-width: 1px;
+ border-style: solid;
+ border-color: blue;
+}
+//! [46]
+
+
+//! [47]
+QLineEdit {
+ border-width: 2px;
+ border-style: solid;
+ border-color: darkblue;
+}
+//! [47]
+
+
+//! [48]
+QSpinBox::down-button { bottom: 2px }
+//! [48]
+
+
+//! [49]
+* { button-layout: 2 }
+//! [49]
+
+
+//! [50]
+QPushButton { color: red }
+//! [50]
+
+
+//! [51]
+QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 1; }
+//! [51]
+
+
+//! [52]
+* { etch-disabled-text: 1 }
+//! [52]
+
+
+//! [53]
+QCheckBox { font: bold italic large "Times New Roman" }
+//! [53]
+
+
+//! [54]
+QCheckBox { font-family: "New Century Schoolbook" }
+//! [54]
+
+
+//! [55]
+QTextEdit { font-size: 12px }
+//! [55]
+
+
+//! [56]
+QTextEdit { font-style: italic }
+//! [56]
+
+
+//! [57]
+* { gridline-color: gray }
+//! [57]
+
+
+//! [58]
+QSpinBox::down-button { height: 10px }
+//! [58]
+
+
+//! [59]
+/* implicitly sets the size of down-button to the size of spindown.png */
+QSpinBox::down-button { image: url(:/images/spindown.png) }
+//! [59]
+
+
+//! [60]
+QSpinBox::down-button { left: 2px }
+//! [60]
+
+
+//! [61]
+* { lineedit-password-character: 9679 }
+//! [61]
+
+
+//! [62]
+QLineEdit { margin: 2px }
+//! [62]
+
+
+//! [63]
+QSpinBox { max-height: 24px }
+//! [63]
+
+
+//! [64]
+QComboBox { max-width: 72px }
+//! [64]
+
+
+//! [65]
+QMessageBox { messagebox-text-interaction-flags: 5 }
+//! [65]
+
+
+//! [66]
+QComboBox { min-height: 24px }
+//! [66]
+
+
+//! [67]
+QComboBox { min-width: 72px }
+//! [67]
+
+
+//! [68]
+QToolTip { opacity: 223 }
+//! [68]
+
+
+//! [69]
+QLineEdit { padding: 3px }
+//! [69]
+
+
+//! [70]
+QSpinBox::down-button { right: 2px }
+//! [70]
+
+
+//! [71]
+QTextEdit { selection-background-color: darkblue }
+//! [71]
+
+
+//! [72]
+QTextEdit { selection-color: white }
+//! [72]
+
+
+//! [73]
+* { show-decoration-selected: 1 }
+//! [73]
+
+
+//! [74]
+QMenuBar { spacing: 10 }
+//! [74]
+
+
+//! [75]
+QSpinBox::up-button {
+ image: url(:/images/spinup.png);
+ subcontrol-origin: content;
+ subcontrol-position: right top;
+}
+//! [75]
+
+
+//! [76]
+QSpinBox::down-button {
+ image: url(:/images/spindown.png);
+ subcontrol-origin: padding;
+ subcontrol-position: right bottom;
+}
+//! [76]
+
+
+//! [77]
+QPushButton {
+ text-align: left;
+}
+//! [77]
+
+
+//! [78]
+QSpinBox::up-button { top: 2px }
+//! [78]
+
+
+//! [79]
+QSpinBox::up-button { width: 12px }
+//! [79]
+
+
+//! [80]
+QTextEdit { background-position: bottom center }
+//! [80]
+
+
+//! [81]
+QDialog { etch-disabled-text: 1 }
+//! [81]
+
+
+//! [82]
+QLabel { border-color: red } /* red red red red */
+QLabel { border-color: red blue } /* red blue red blue */
+QLabel { border-color: red blue green } /* red blue green blue */
+QLabel { border-color: red blue green yellow } /* red blue green yellow */
+//! [82]
+
+
+//! [83]
+QLabel { border-width: 1px } /* 1px 1px 1px 1px */
+QLabel { border-width: 1px 2px } /* 1px 2px 1px 2px */
+QLabel { border-width: 1px 2px 3px } /* 1px 2px 3px 2px */
+QLabel { border-width: 1px 2px 3px 4px } /* 1px 2px 3px 4px */
+//! [83]
+
+
+//! [84]
+QLabel { border-color: red } /* opaque red */
+QLabel { border-color: #FF0000 } /* opaque red */
+QLabel { border-color: rgba(255, 0, 0, 75%) } /* 75% opaque red */
+QLabel { border-color: rgb(255, 0, 0) } /* opaque red */
+QLabel { border-color: rgb(100%, 0%, 0%) } /* opaque red */
+QLabel { border-color: hsv(60, 255, 255) } /* opaque yellow */
+QLabel { border-color: hsva(240, 255, 255, 75%) } /* 75% blue */
+//! [84]
+
+
+//! [85]
+/* linear gradient from white to green */
+QTextEdit {
+ background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
+ stop:0 white, stop: 0.4 gray, stop:1 green)
+}
+
+/* linear gradient from white to green */
+QTextEdit {
+ background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
+ stop:0 white, stop: 0.4 rgba(10, 20, 30, 40), stop:1 rgb(0, 200, 230, 200))
+}
+
+
+/* conical gradient from white to green */
+QTextEdit {
+ background: qconicalgradient(cx:0.5, cy:0.5, angle:30,
+ stop:0 white, stop:1 #00FF00)
+}
+
+/* radial gradient from white to green */
+QTextEdit {
+ background: qradialgradient(cx:0, cy:0, radius: 1,
+ fx:0.5, fy:0.5, stop:0 white, stop:1 green)
+}
+//! [85]
+
+
+//! [86]
+* {
+ file-icon: url(file.png),
+ url(file_selected.png) selected;
+ }
+
+QMessageBox {
+ dialogbuttonbox-buttons-have-icons: true;
+ dialog-ok-icon: url(ok.svg);
+ dialog-cancel-icon: url(cancel.png), url(grayed_cancel.png) disabled;
+}
+//! [86]
+
+
+//! [87]
+QPushButton { color: palette(dark); }
+//! [87]
+
+
+//! [94]
+*[mandatoryField="true"] { background-color: yellow }
+//! [94]
+
+
+//! [96]
+QPushButton#evilButton { background-color: red }
+//! [96]
+
+
+//! [97]
+QPushButton#evilButton {
+ background-color: red;
+ border-style: outset;
+ border-width: 2px;
+ border-color: beige;
+}
+//! [97]
+
+
+//! [98]
+QPushButton#evilButton {
+ background-color: red;
+ border-style: outset;
+ border-width: 2px;
+ border-radius: 10px;
+ border-color: beige;
+ font: bold 14px;
+ min-width: 10em;
+ padding: 6px;
+}
+//! [98]
+
+
+//! [99]
+QPushButton#evilButton {
+ background-color: red;
+ border-style: outset;
+ border-width: 2px;
+ border-radius: 10px;
+ border-color: beige;
+ font: bold 14px;
+ min-width: 10em;
+ padding: 6px;
+}
+QPushButton#evilButton:pressed {
+ background-color: rgb(224, 0, 0);
+ border-style: inset;
+}
+//! [99]
+
+
+//! [100]
+QPushButton#evilButton::menu-indicator {
+ image: url(myindicator.png);
+}
+//! [100]
+
+
+//! [101]
+QPushButton::menu-indicator {
+ image: url(myindicator.png);
+ subcontrol-position: right center;
+ subcontrol-origin: padding;
+ left: -2px;
+}
+//! [101]
+
+
+//! [102]
+QLineEdit { color: red }
+//! [102]
+
+
+//! [103]
+QLineEdit { color: red }
+QLineEdit[readOnly="true"] { color: gray }
+//! [103]
+
+
+//! [104]
+QLineEdit { color: red }
+QLineEdit[readOnly="true"] { color: gray }
+#registrationDialog QLineEdit { color: brown }
+//! [104]
+
+
+//! [105]
+QLineEdit { color: red }
+QLineEdit[readOnly="true"] { color: gray }
+QDialog QLineEdit { color: brown }
+//! [105]
+
+
+//! [106]
+QTextEdit, QListView {
+ background-color: white;
+ background-image: url(draft.png);
+ background-attachment: scroll;
+}
+//! [106]
+
+
+//! [107]
+QTextEdit, QListView {
+ background-color: white;
+ background-image: url(draft.png);
+ background-attachment: fixed;
+}
+//! [107]
+
+
+//! [108]
+QCheckBox {
+ spacing: 5px;
+}
+
+QCheckBox::indicator {
+ width: 13px;
+ height: 13px;
+}
+
+QCheckBox::indicator:unchecked {
+ image: url(:/images/checkbox_unchecked.png);
+}
+
+QCheckBox::indicator:unchecked:hover {
+ image: url(:/images/checkbox_unchecked_hover.png);
+}
+
+QCheckBox::indicator:unchecked:pressed {
+ image: url(:/images/checkbox_unchecked_pressed.png);
+}
+
+QCheckBox::indicator:checked {
+ image: url(:/images/checkbox_checked.png);
+}
+
+QCheckBox::indicator:checked:hover {
+ image: url(:/images/checkbox_checked_hover.png);
+}
+
+QCheckBox::indicator:checked:pressed {
+ image: url(:/images/checkbox_checked_pressed.png);
+}
+
+QCheckBox::indicator:indeterminate:hover {
+ image: url(:/images/checkbox_indeterminate_hover.png);
+}
+
+QCheckBox::indicator:indeterminate:pressed {
+ image: url(:/images/checkbox_indeterminate_pressed.png);
+}
+//! [108]
+
+
+//! [109]
+QComboBox {
+ border: 1px solid gray;
+ border-radius: 3px;
+ padding: 1px 18px 1px 3px;
+ min-width: 6em;
+}
+
+QComboBox:editable {
+ background: white;
+}
+
+QComboBox:!editable, QComboBox::drop-down:editable {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
+ stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
+}
+
+/* QComboBox gets the "on" state when the popup is open */
+QComboBox:!editable:on, QComboBox::drop-down:editable:on {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #D3D3D3, stop: 0.4 #D8D8D8,
+ stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1);
+}
+
+QComboBox:on { /* shift the text when the popup opens */
+ padding-top: 3px;
+ padding-left: 4px;
+}
+
+QComboBox::drop-down {
+ subcontrol-origin: padding;
+ subcontrol-position: top right;
+ width: 15px;
+
+ border-left-width: 1px;
+ border-left-color: darkgray;
+ border-left-style: solid; /* just a single line */
+ border-top-right-radius: 3px; /* same radius as the QComboBox */
+ border-bottom-right-radius: 3px;
+}
+
+QComboBox::down-arrow {
+ image: url(/usr/share/icons/crystalsvg/16x16/actions/1downarrow.png);
+}
+
+QComboBox::down-arrow:on { /* shift the arrow when popup is open */
+ top: 1px;
+ left: 1px;
+}
+//! [109]
+
+
+//! [110]
+QComboBox QAbstractItemView {
+ border: 2px solid darkgray;
+ selection-background-color: lightgray;
+}
+//! [110]
+
+
+//! [111]
+QDockWidget {
+ border: 1px solid lightgray;
+ titlebar-close-icon: url(close.png);
+ titlebar-normal-icon: url(undock.png);
+}
+
+QDockWidget::title {
+ text-align: left; /* align the text to the left */
+ background: lightgray;
+ padding-left: 5px;
+}
+
+QDockWidget::close-button, QDockWidget::float-button {
+ border: 1px solid transparent;
+ background: darkgray;
+ padding: 0px;
+}
+
+QDockWidget::close-button:hover, QDockWidget::float-button:hover {
+ background: gray;
+}
+
+QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
+ padding: 1px -1px -1px 1px;
+}
+//! [111]
+
+
+//! [112]
+QDockWidget {
+ border: 1px solid lightgray;
+ titlebar-close-icon: url(close.png);
+ titlebar-normal-icon: url(float.png);
+}
+
+QDockWidget::title {
+ text-align: left;
+ background: lightgray;
+ padding-left: 35px;
+}
+
+QDockWidget::close-button, QDockWidget::float-button {
+ background: darkgray;
+ padding: 0px;
+ icon-size: 14px; /* maximum icon size */
+}
+
+QDockWidget::close-button:hover, QDockWidget::float-button:hover {
+ background: gray;
+}
+
+QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
+ padding: 1px -1px -1px 1px;
+}
+
+QDockWidget::close-button {
+ subcontrol-position: top left;
+ subcontrol-origin: margin;
+ position: absolute;
+ top: 0px; left: 0px; bottom: 0px;
+ width: 14px;
+}
+
+QDockWidget::float-button {
+ subcontrol-position: top left;
+ subcontrol-origin: margin;
+ position: absolute;
+ top: 0px; left: 16px; bottom: 0px;
+ width: 14px;
+}
+//! [112]
+
+
+//! [113]
+QFrame, QLabel, QToolTip {
+ border: 2px solid green;
+ border-radius: 4px;
+ padding: 2px;
+ background-image: url(images/welcome.png);
+}
+//! [113]
+
+
+//! [114]
+QGroupBox {
+ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #E0E0E0, stop: 1 #FFFFFF);
+ border: 2px solid gray;
+ border-radius: 5px;
+ margin-top: 1ex; /* leave space at the top for the title */
+}
+
+QGroupBox::title {
+ subcontrol-origin: margin;
+ subcontrol-position: top center; /* position at the top center */
+ padding: 0 3px;
+ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #FFOECE, stop: 1 #FFFFFF);
+}
+//! [114]
+
+
+//! [115]
+QGroupBox::indicator {
+ width: 13px;
+ height: 13px;
+}
+
+QGroupBox::indicator:unchecked {
+ image: url(:/images/checkbox_unchecked.png);
+}
+
+/* proceed with styling just like QCheckBox */
+//! [115]
+
+
+//! [116]
+QHeaderView::section {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 #616161, stop: 0.5 #505050,
+ stop: 0.6 #434343, stop:1 #656565);
+ color: white;
+ padding-left: 4px;
+ border: 1px solid #6c6c6c;
+}
+
+QHeaderView::section:checked
+{
+ background-color: red;
+}
+
+/* style the sort indicator */
+QHeaderView::down-arrow {
+ image: url(down_arrow.png);
+}
+
+QHeaderView::up-arrow {
+ image: url(up_arrow.png);
+}
+//! [116]
+
+
+//! [117]
+QLineEdit {
+ border: 2px solid gray;
+ border-radius: 10px;
+ padding: 0 8px;
+ background: yellow;
+ selection-background-color: darkgray;
+}
+//! [117]
+
+
+//! [118]
+QLineEdit[echoMode="2"] {
+ lineedit-password-character: 9679;
+}
+//! [118]
+
+
+//! [119]
+QLineEdit:read-only {
+ background: lightblue;
+//! [119]
+
+
+//! [120]
+QListView {
+ alternate-background-color: yellow;
+}
+//! [120]
+
+
+//! [121]
+QListView {
+ show-decoration-selected: 1; /* make the selection span the entire width of the view */
+}
+
+QListView::item:alternate {
+ background: #EEEEEE;
+}
+
+QListView::item:selected {
+ border: 1px solid #6a6ea9;
+}
+
+QListView::item:selected:!active {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #ABAFE5, stop: 1 #8588B2);
+}
+
+QListView::item:selected:active {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #6a6ea9, stop: 1 #888dd9);
+}
+
+QListView::item:hover {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #FAFBFE, stop: 1 #DCDEF1);
+}
+//! [121]
+
+
+//! [122]
+QMainWindow::separator {
+ background: yellow;
+ width: 10px; /* when vertical */
+ height: 10px; /* when horizontal */
+}
+
+QMainWindow::separator:hover {
+ background: red;
+}
+//! [122]
+
+
+//! [123]
+QMenu {
+ background-color: #ABABAB; /* sets background of the menu */
+ border: 1px solid black;
+}
+
+QMenu::item {
+ /* sets background of menu item. set this to something non-transparent
+ if you want menu color and menu item color to be different */
+ background-color: transparent;
+}
+
+QMenu::item:selected { /* when user selects item using mouse or keyboard */
+ background-color: #654321;
+}
+//! [123]
+
+
+//! [124]
+QMenu {
+ background-color: white;
+ margin: 2px; /* some spacing around the menu */
+}
+
+QMenu::item {
+ padding: 2px 25px 2px 20px;
+ border: 1px solid transparent; /* reserve space for selection border */
+}
+
+QMenu::item:selected {
+ border-color: darkblue;
+ background: rgba(100, 100, 100, 150);
+}
+
+QMenu::icon:checked { /* appearance of a 'checked' icon */
+ background: gray;
+ border: 1px inset gray;
+ position: absolute;
+ top: 1px;
+ right: 1px;
+ bottom: 1px;
+ left: 1px;
+}
+
+QMenu::separator {
+ height: 2px;
+ background: lightblue;
+ margin-left: 10px;
+ margin-right: 5px;
+}
+
+QMenu::indicator {
+ width: 13px;
+ height: 13px;
+}
+
+/* non-exclusive indicator = check box style indicator (see QActionGroup::setExclusive) */
+QMenu::indicator:non-exclusive:unchecked {
+ image: url(:/images/checkbox_unchecked.png);
+}
+
+QMenu::indicator:non-exclusive:unchecked:selected {
+ image: url(:/images/checkbox_unchecked_hover.png);
+}
+
+QMenu::indicator:non-exclusive:checked {
+ image: url(:/images/checkbox_checked.png);
+}
+
+QMenu::indicator:non-exclusive:checked:selected {
+ image: url(:/images/checkbox_checked_hover.png);
+}
+
+/* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */
+QMenu::indicator:exclusive:unchecked {
+ image: url(:/images/radiobutton_unchecked.png);
+}
+
+QMenu::indicator:exclusive:unchecked:selected {
+ image: url(:/images/radiobutton_unchecked_hover.png);
+}
+
+QMenu::indicator:exclusive:checked {
+ image: url(:/images/radiobutton_checked.png);
+}
+
+QMenu::indicator:exclusive:checked:selected {
+ image: url(:/images/radiobutton_checked_hover.png);
+}
+
+//! [124]
+
+
+//! [125]
+QMenuBar {
+ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
+ stop:0 lightgray, stop:1 darkgray);
+}
+
+QMenuBar::item {
+ spacing: 3px; /* spacing between menu bar items */
+ padding: 1px 4px;
+ background: transparent;
+ border-radius: 4px;
+}
+
+QMenuBar::item:selected { /* when selected using mouse or keyboard */
+ background: #a8a8a8;
+}
+
+QMenuBar::item:pressed {
+ background: #888888;
+}
+//! [125]
+
+
+//! [126]
+QProgressBar {
+ border: 2px solid grey;
+ border-radius: 5px;
+}
+
+QProgressBar::chunk {
+ background-color: #05B8CC;
+ width: 20px;
+}
+//! [126]
+
+
+//! [127]
+QProgressBar {
+ border: 2px solid grey;
+ border-radius: 5px;
+ text-align: center;
+}
+//! [127]
+
+
+//! [128]
+QProgressBar::chunk {
+ background-color: #CD96CD;
+ width: 10px;
+ margin: 0.5px;
+}
+//! [128]
+
+
+//! [129]
+QPushButton {
+ border: 2px solid #8f8f91;
+ border-radius: 6px;
+ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #f6f7fa, stop: 1 #dadbde);
+ min-width: 80px;
+}
+
+QPushButton:pressed {
+ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #dadbde, stop: 1 #f6f7fa);
+}
+
+QPushButton:flat {
+ border: none; /* no border for a flat push button */
+}
+
+QPushButton:default {
+ border-color: navy; /* make the default button prominent */
+}
+//! [129]
+
+
+//! [130]
+QPushButton:open { /* when the button has its menu open */
+ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #dadbde, stop: 1 #f6f7fa);
+}
+
+QPushButton::menu-indicator {
+ image: url(menu_indicator.png);
+ subcontrol-origin: padding;
+ subcontrol-position: bottom right;
+}
+
+QPushButton::menu-indicator:pressed, QPushButton::menu-indicator:open {
+ position: relative;
+ top: 2px; left: 2px; /* shift the arrow by 2 px */
+}
+//! [130]
+
+
+//! [131]
+QRadioButton::indicator {
+ width: 13px;
+ height: 13px;
+}
+
+QRadioButton::indicator::unchecked {
+ image: url(:/images/radiobutton_unchecked.png);
+}
+
+QRadioButton::indicator:unchecked:hover {
+ image: url(:/images/radiobutton_unchecked_hover.png);
+}
+
+QRadioButton::indicator:unchecked:pressed {
+ image: url(:/images/radiobutton_unchecked_pressed.png);
+}
+
+QRadioButton::indicator::checked {
+ image: url(:/images/radiobutton_checked.png);
+}
+
+QRadioButton::indicator:checked:hover {
+ image: url(:/images/radiobutton_checked_hover.png);
+}
+
+QRadioButton::indicator:checked:pressed {
+ image: url(:/images/radiobutton_checked_pressed.png);
+}
+//! [131]
+
+
+//! [132]
+QScrollBar:horizontal {
+ border: 2px solid grey;
+ background: #32CC99;
+ height: 15px;
+ margin: 0px 20px 0 20px;
+}
+//! [132]
+
+
+//! [133]
+QScrollBar::handle:horizontal {
+ background: white;
+ min-width: 20px;
+}
+//! [133]
+
+
+//! [134]
+QScrollBar::add-line:horizontal {
+ border: 2px solid grey;
+ background: #32CC99;
+ width: 20px;
+ subcontrol-position: right;
+ subcontrol-origin: margin;
+}
+
+QScrollBar::sub-line:horizontal {
+ border: 2px solid grey;
+ background: #32CC99;
+ width: 20px;
+ subcontrol-position: left;
+ subcontrol-origin: margin;
+}
+//! [134]
+
+
+//! [135]
+QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {
+ border: 2px solid grey;
+ width: 3px;
+ height: 3px;
+ background: white;
+}
+
+QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
+ background: none;
+}
+//! [135]
+
+
+//! [136]
+QScrollBar:horizontal {
+ border: 2px solid green;
+ background: cyan;
+ height: 15px;
+ margin: 0px 40px 0 0px;
+}
+
+QScrollBar::handle:horizontal {
+ background: gray;
+ min-width: 20px;
+}
+
+QScrollBar::add-line:horizontal {
+ background: blue;
+ width: 16px;
+ subcontrol-position: right;
+ subcontrol-origin: margin;
+ border: 2px solid black;
+}
+
+QScrollBar::sub-line:horizontal {
+ background: magenta;
+ width: 16px;
+ subcontrol-position: top right;
+ subcontrol-origin: margin;
+ border: 2px solid black;
+ position: absolute;
+ right: 20px;
+}
+
+QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {
+ width: 3px;
+ height: 3px;
+ background: pink;
+}
+
+QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
+ background: none;
+}
+
+//! [136]
+
+
+//! [137]
+ QScrollBar:vertical {
+ border: 2px solid grey;
+ background: #32CC99;
+ width: 15px;
+ margin: 22px 0 22px 0;
+ }
+ QScrollBar::handle:vertical {
+ background: white;
+ min-height: 20px;
+ }
+ QScrollBar::add-line:vertical {
+ border: 2px solid grey;
+ background: #32CC99;
+ height: 20px;
+ subcontrol-position: bottom;
+ subcontrol-origin: margin;
+ }
+
+ QScrollBar::sub-line:vertical {
+ border: 2px solid grey;
+ background: #32CC99;
+ height: 20px;
+ subcontrol-position: top;
+ subcontrol-origin: margin;
+ }
+ QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
+ border: 2px solid grey;
+ width: 3px;
+ height: 3px;
+ background: white;
+ }
+
+ QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
+ background: none;
+ }
+//! [137]
+
+
+//! [138]
+QSizeGrip {
+ image: url(:/images/sizegrip.png);
+ width: 16px;
+ height: 16px;
+}
+//! [138]
+
+
+//! [139]
+QSlider::groove:horizontal {
+ border: 1px solid #999999;
+ height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
+ background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);
+ margin: 2px 0;
+}
+
+QSlider::handle:horizontal {
+ background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
+ border: 1px solid #5c5c5c;
+ width: 18px;
+ margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
+ border-radius: 3px;
+}
+//! [139]
+
+
+//! [140]
+QSlider::groove:vertical {
+ background: red;
+ position: absolute; /* absolutely position 4px from the left and right of the widget. setting margins on the widget should work too... */
+ left: 4px; right: 4px;
+}
+
+QSlider::handle:vertical {
+ height: 10px;
+ background: green;
+ margin: 0 -4px; /* expand outside the groove */
+}
+
+QSlider::add-page:vertical {
+ background: white;
+}
+
+QSlider::sub-page:vertical {
+ background: pink;
+}
+//! [140]
+
+
+//! [141]
+QSpinBox {
+ padding-right: 15px; /* make room for the arrows */
+ border-image: url(:/images/frame.png) 4;
+ border-width: 3;
+}
+
+QSpinBox::up-button {
+ subcontrol-origin: border;
+ subcontrol-position: top right; /* position at the top right corner */
+
+ width: 16px; /* 16 + 2*1px border-width = 15px padding + 3px parent border */
+ border-image: url(:/images/spinup.png) 1;
+ border-width: 1px;
+}
+
+QSpinBox::up-button:hover {
+ border-image: url(:/images/spinup_hover.png) 1;
+}
+
+QSpinBox::up-button:pressed {
+ border-image: url(:/images/spinup_pressed.png) 1;
+}
+
+QSpinBox::up-arrow {
+ image: url(:/images/up_arrow.png);
+ width: 7px;
+ height: 7px;
+}
+
+QSpinBox::up-arrow:disabled, QSpinBox::up-arrow:off { /* off state when value is max */
+ image: url(:/images/up_arrow_disabled.png);
+}
+
+QSpinBox::down-button {
+ subcontrol-origin: border;
+ subcontrol-position: bottom right; /* position at bottom right corner */
+
+ width: 16px;
+ border-image: url(:/images/spindown.png) 1;
+ border-width: 1px;
+ border-top-width: 0;
+}
+
+QSpinBox::down-button:hover {
+ border-image: url(:/images/spindown_hover.png) 1;
+}
+
+QSpinBox::down-button:pressed {
+ border-image: url(:/images/spindown_pressed.png) 1;
+}
+
+QSpinBox::down-arrow {
+ image: url(:/images/down_arrow.png);
+ width: 7px;
+ height: 7px;
+}
+
+QSpinBox::down-arrow:disabled,
+QSpinBox::down-arrow:off { /* off state when value in min */
+ image: url(:/images/down_arrow_disabled.png);
+}
+
+//! [141]
+
+
+//! [142]
+QSplitter::handle {
+ image: url(images/splitter.png);
+}
+
+QSplitter::handle:horizontal {
+ width: 2px;
+}
+
+QSplitter::handle:vertical {
+ height: 2px;
+}
+
+QSplitter::handle:pressed {
+ url(images/splitter_pressed.png);
+}
+
+//! [142]
+
+
+//! [143]
+QStatusBar {
+ background: brown;
+}
+
+QStatusBar::item {
+ border: 1px solid red;
+ border-radius: 3px;
+}
+//! [143]
+
+
+//! [144]
+QStatusBar QLabel {
+ border: 3px solid white;
+}
+//! [144]
+
+
+//! [145]
+QTabWidget::pane { /* The tab widget frame */
+ border-top: 2px solid #C2C7CB;
+}
+
+QTabWidget::tab-bar {
+ left: 5px; /* move to the right by 5px */
+}
+
+/* Style the tab using the tab sub-control. Note that
+ it reads QTabBar _not_ QTabWidget */
+QTabBar::tab {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
+ stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
+ border: 2px solid #C4C4C3;
+ border-bottom-color: #C2C7CB; /* same as the pane color */
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+ min-width: 8ex;
+ padding: 2px;
+}
+
+QTabBar::tab:selected, QTabBar::tab:hover {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #fafafa, stop: 0.4 #f4f4f4,
+ stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
+}
+
+QTabBar::tab:selected {
+ border-color: #9B9B9B;
+ border-bottom-color: #C2C7CB; /* same as pane color */
+}
+
+QTabBar::tab:!selected {
+ margin-top: 2px; /* make non-selected tabs look smaller */
+}
+//! [145]
+
+
+//! [146]
+QTabWidget::pane { /* The tab widget frame */
+ border-top: 2px solid #C2C7CB;
+}
+
+QTabWidget::tab-bar {
+ left: 5px; /* move to the right by 5px */
+}
+
+/* Style the tab using the tab sub-control. Note that
+ it reads QTabBar _not_ QTabWidget */
+QTabBar::tab {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
+ stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
+ border: 2px solid #C4C4C3;
+ border-bottom-color: #C2C7CB; /* same as the pane color */
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+ min-width: 8ex;
+ padding: 2px;
+}
+
+QTabBar::tab:selected, QTabBar::tab:hover {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #fafafa, stop: 0.4 #f4f4f4,
+ stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
+}
+
+QTabBar::tab:selected {
+ border-color: #9B9B9B;
+ border-bottom-color: #C2C7CB; /* same as pane color */
+}
+
+QTabBar::tab:!selected {
+ margin-top: 2px; /* make non-selected tabs look smaller */
+}
+
+/* make use of negative margins for overlapping tabs */
+QTabBar::tab:selected {
+ /* expand/overlap to the left and right by 4px */
+ margin-left: -4px;
+ margin-right: -4px;
+}
+
+QTabBar::tab:first:selected {
+ margin-left: 0; /* the first selected tab has nothing to overlap with on the left */
+}
+
+QTabBar::tab:last:selected {
+ margin-right: 0; /* the last selected tab has nothing to overlap with on the right */
+}
+
+QTabBar::tab:only-one {
+ margin: 0; /* if there is only one tab, we don't want overlapping margins */
+}
+//! [146]
+
+
+//! [147]
+QTabWidget::pane { /* The tab widget frame */
+ border-top: 2px solid #C2C7CB;
+ position: absolute;
+ top: -0.5em;
+}
+
+QTabWidget::tab-bar {
+ alignment: center;
+}
+
+/* Style the tab using the tab sub-control. Note that
+ it reads QTabBar _not_ QTabWidget */
+QTabBar::tab {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
+ stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
+ border: 2px solid #C4C4C3;
+ border-bottom-color: #C2C7CB; /* same as the pane color */
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+ min-width: 8ex;
+ padding: 2px;
+}
+
+QTabBar::tab:selected, QTabBar::tab:hover {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #fafafa, stop: 0.4 #f4f4f4,
+ stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
+}
+
+QTabBar::tab:selected {
+ border-color: #9B9B9B;
+ border-bottom-color: #C2C7CB; /* same as pane color */
+}
+//! [147]
+
+
+//! [148]
+QTabBar::tear {
+ image: url(tear_indicator.png);
+}
+
+QTabBar::scroller { /* the width of the scroll buttons */
+ width: 20px;
+}
+
+QTabBar QToolButton { /* the scroll buttons are tool buttons */
+ border-image: url(scrollbutton.png) 2;
+ border-width: 2px;
+}
+
+QTabBar QToolButton::right-arrow { /* the arrow mark in the tool buttons */
+ image: url(rightarrow.png);
+}
+
+QTabBar QToolButton::left-arrow {
+ image: url(leftarrow.png);
+}
+//! [148]
+
+
+//! [149]
+QTableView {
+ selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,
+ stop: 0 #FF92BB, stop: 1 white);
+}
+//! [149]
+
+
+//! [150]
+QTableView QTableCornerButton::section {
+ background: red;
+ border: 2px outset red;
+}
+//! [150]
+
+
+//! [151]
+QToolBar {
+ background: red;
+ spacing: 3px; /* spacing between items in the tool bar */
+}
+
+QToolBar::handle {
+ image: url(handle.png);
+}
+//! [151]
+
+
+//! [152]
+QToolBox::tab {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
+ stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
+ border-radius: 5px;
+ color: darkgray;
+}
+
+QToolBox::tab:selected { /* italicize selected tabs */
+ font: italic;
+ color: white;
+}
+//! [152]
+
+
+//! [153]
+QToolButton { /* all types of tool button */
+ border: 2px solid #8f8f91;
+ border-radius: 6px;
+ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #f6f7fa, stop: 1 #dadbde);
+}
+
+QToolButton[popupMode="1"] { /* only for MenuButtonPopup */
+ padding-right: 20px; /* make way for the popup button */
+}
+
+QToolButton:pressed {
+ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+ stop: 0 #dadbde, stop: 1 #f6f7fa);
+}
+
+/* the subcontrols below are used only in the MenuButtonPopup mode */
+QToolButton::menu-button {
+ border: 2px solid gray;
+ border-top-right-radius: 6px;
+ border-bottom-right-radius: 6px;
+ /* 16px width + 4px for border = 20px allocated above */
+ width: 16px;
+}
+
+QToolButton::menu-arrow {
+ image: url(downarrow.png);
+}
+
+QToolButton::menu-arrow:open {
+ top: 1px; left: 1px; /* shift it a bit */
+}
+//! [153]
+
+
+//! [154]
+QToolTip {
+ border: 2px solid darkkhaki;
+ padding: 5px;
+ border-radius: 3px;
+ opacity: 200;
+}
+//! [154]
+
+
+//! [155]
+QTreeView {
+ alternate-background-color: yellow;
+}
+//! [155]
+
+
+//! [156]
+QTreeView {
+ show-decoration-selected: 1;
+}
+
+QTreeView::item {
+ border: 1px solid #d9d9d9;
+ border-top-color: transparent;
+ border-bottom-color: transparent;
+}
+
+QTreeView::item:hover {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
+ border: 1px solid #bfcde4;
+}
+
+QTreeView::item:selected {
+ border: 1px solid #567dbc;
+}
+
+QTreeView::item:selected:active{
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);
+}
+
+QTreeView::item:selected:!active {
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf);
+}
+//! [156]
+
+
+//! [157]
+QTreeView::branch {
+ background: palette(base);
+}
+
+QTreeView::branch:has-siblings:!adjoins-item {
+ background: cyan;
+}
+
+QTreeView::branch:has-siblings:adjoins-item {
+ background: red;
+}
+
+QTreeView::branch:!has-children:!has-siblings:adjoins-item {
+ background: blue;
+}
+
+QTreeView::branch:closed:has-children:has-siblings {
+ background: pink;
+}
+
+QTreeView::branch:has-children:!has-siblings:closed {
+ background: gray;
+}
+
+QTreeView::branch:open:has-children:has-siblings {
+ background: magenta;
+}
+
+QTreeView::branch:open:has-children:!has-siblings {
+ background: green;
+}
+
+//! [157]
+
+
+//! [158]
+QTreeView::branch:has-siblings:!adjoins-item {
+ border-image: url(vline.png) 0;
+}
+
+QTreeView::branch:has-siblings:adjoins-item {
+ border-image: url(branch-more.png) 0;
+}
+
+QTreeView::branch:!has-children:!has-siblings:adjoins-item {
+ border-image: url(branch-end.png) 0;
+}
+
+QTreeView::branch:has-children:!has-siblings:closed,
+QTreeView::branch:closed:has-children:has-siblings {
+ border-image: none;
+ image: url(branch-closed.png);
+}
+
+QTreeView::branch:open:has-children:!has-siblings,
+QTreeView::branch:open:has-children:has-siblings {
+ border-image: none;
+ image: url(branch-open.png);
+}
+//! [158]
+
+//! [159]
+QTabBar::close-button {
+ image: url(close.png)
+ subcontrol-position: left;
+}
+QTabBar::close-button:hover {
+ image: url(close-hover.png)
+}
+
+//! [159]
diff --git a/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp b/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp
new file mode 100644
index 0000000000..1a89ff327f
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+fileName = QFileDialog::getOpenFileName(this,
+ tr("Open Image"), "/home/jana", tr("Image Files (*.png *.jpg *.bmp)"));
+//! [0]
+
+
+//! [1]
+"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
+//! [1]
+
+
+//! [2]
+QFileDialog dialog(this);
+dialog.setFileMode(QFileDialog::AnyFile);
+//! [2]
+
+
+//! [3]
+dialog.setNameFilter(tr("Images (*.png *.xpm *.jpg)"));
+//! [3]
+
+
+//! [4]
+dialog.setViewMode(QFileDialog::Detail);
+//! [4]
+
+
+//! [5]
+QStringList fileNames;
+if (dialog.exec())
+ fileNames = dialog.selectedFiles();
+//! [5]
+
+
+//! [6]
+dialog.setNameFilter("All C++ files (*.cpp *.cc *.C *.cxx *.c++)");
+dialog.setNameFilter("*.cpp *.cc *.C *.cxx *.c++");
+//! [6]
+
+
+//! [7]
+QStringList filters;
+filters << "Image files (*.png *.xpm *.jpg)"
+ << "Text files (*.txt)"
+ << "Any files (*)";
+
+QFileDialog dialog(this);
+dialog.setNameFilters(filters);
+dialog.exec();
+//! [7]
+
+
+//! [8]
+QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
+ "/home",
+ tr("Images (*.png *.xpm *.jpg)"));
+//! [8]
+
+
+//! [9]
+QStringList files = QFileDialog::getOpenFileNames(
+ this,
+ "Select one or more files to open",
+ "/home",
+ "Images (*.png *.xpm *.jpg)");
+//! [9]
+
+
+//! [10]
+QStringList list = files;
+QStringList::Iterator it = list.begin();
+while(it != list.end()) {
+ myProcessing(*it);
+ ++it;
+}
+//! [10]
+
+
+//! [11]
+QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
+ "/home/jana/untitled.png",
+ tr("Images (*.png *.xpm *.jpg)"));
+//! [11]
+
+
+//! [12]
+QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
+ "/home",
+ QFileDialog::ShowDirsOnly
+ | QFileDialog::DontResolveSymlinks);
+//! [12]
diff --git a/src/widgets/doc/snippets/code/src_gui_dialogs_qfontdialog.cpp b/src/widgets/doc/snippets/code/src_gui_dialogs_qfontdialog.cpp
new file mode 100644
index 0000000000..e07ecbca3e
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_dialogs_qfontdialog.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+bool ok;
+QFont font = QFontDialog::getFont(
+ &ok, QFont("Helvetica [Cronyx]", 10), this);
+if (ok) {
+ // the user clicked OK and font is set to the font the user selected
+} else {
+ // the user canceled the dialog; font is set to the initial
+ // value, in this case Helvetica [Cronyx], 10
+}
+//! [0]
+
+
+//! [1]
+myWidget.setFont(QFontDialog::getFont(0, myWidget.font()));
+//! [1]
+
+
+//! [2]
+bool ok;
+QFont font = QFontDialog::getFont(&ok, QFont("Times", 12), this);
+if (ok) {
+ // font is set to the font the user selected
+} else {
+ // the user canceled the dialog; font is set to the initial
+ // value, in this case Times, 12.
+}
+//! [2]
+
+
+//! [3]
+myWidget.setFont(QFontDialog::getFont(0, myWidget.font()));
+//! [3]
+
+
+//! [4]
+bool ok;
+QFont font = QFontDialog::getFont(&ok, this);
+if (ok) {
+ // font is set to the font the user selected
+} else {
+ // the user canceled the dialog; font is set to the default
+ // application font, QApplication::font()
+}
+//! [4]
diff --git a/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp b/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp
new file mode 100644
index 0000000000..90bc2e9b0a
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+int ret = QMessageBox::warning(this, tr("My Application"),
+ tr("The document has been modified.\n"
+ "Do you want to save your changes?"),
+ QMessageBox::Save | QMessageBox::Discard
+ | QMessageBox::Cancel,
+ QMessageBox::Save);
+//! [0]
+
+
+//! [1]
+QMessageBox msgBox;
+msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+switch (msgBox.exec()) {
+case QMessageBox::Yes:
+ // yes was clicked
+ break;
+case QMessageBox::No:
+ // no was clicked
+ break;
+default:
+ // should never be reached
+ break;
+}
+//! [1]
+
+
+//! [2]
+QMessageBox msgBox;
+QPushButton *connectButton = msgBox.addButton(tr("Connect"), QMessageBox::ActionRole);
+QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort);
+
+msgBox.exec();
+
+if (msgBox.clickedButton() == connectButton) {
+ // connect
+} else if (msgBox.clickedButton() == abortButton) {
+ // abort
+}
+//! [2]
+
+
+//! [3]
+QMessageBox messageBox(this);
+QAbstractButton *disconnectButton =
+ messageBox.addButton(tr("Disconnect"), QMessageBox::ActionRole);
+...
+messageBox.exec();
+if (messageBox.clickedButton() == disconnectButton) {
+ ...
+}
+//! [3]
+
+
+//! [4]
+#include <QApplication>
+#include <QMessageBox>
+
+int main(int argc, char *argv[])
+{
+ QT_REQUIRE_VERSION(argc, argv, "4.0.2")
+
+ QApplication app(argc, argv);
+ ...
+ return app.exec();
+}
+//! [4]
+
+//! [5]
+QMessageBox msgBox;
+msgBox.setText("The document has been modified.");
+msgBox.exec();
+//! [5]
+
+//! [6]
+QMessageBox msgBox;
+msgBox.setText("The document has been modified.");
+msgBox.setInformativeText("Do you want to save your changes?");
+msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
+msgBox.setDefaultButton(QMessageBox::Save);
+int ret = msgBox.exec();
+//! [6]
+
+//! [7]
+switch (ret) {
+ case QMessageBox::Save:
+ // Save was clicked
+ break;
+ case QMessageBox::Discard:
+ // Don't Save was clicked
+ break;
+ case QMessageBox::Cancel:
+ // Cancel was clicked
+ break;
+ default:
+ // should never be reached
+ break;
+}
+//! [7]
+
+//! [9]
+QMessageBox msgBox(this);
+msgBox.setText(tr("The document has been modified.\n"
+ "Do you want to save your changes?"));
+msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard
+ | QMessageBox::Cancel);
+msgBox.setDefaultButton(QMessageBox::Save);
+//! [9]
diff --git a/src/widgets/doc/snippets/code/src_gui_dialogs_qwizard.cpp b/src/widgets/doc/snippets/code/src_gui_dialogs_qwizard.cpp
new file mode 100644
index 0000000000..47db20da99
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_dialogs_qwizard.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+int LicenseWizard::nextId() const
+{
+ switch (currentId()) {
+ case Page_Intro:
+ if (field("intro.evaluate").toBool()) {
+ return Page_Evaluate;
+ } else {
+ return Page_Register;
+ }
+ case Page_Evaluate:
+ return Page_Conclusion;
+ case Page_Register:
+ if (field("register.upgradeKey").toString().isEmpty()) {
+ return Page_Details;
+ } else {
+ return Page_Conclusion;
+ }
+ case Page_Details:
+ return Page_Conclusion;
+ case Page_Conclusion:
+ default:
+ return -1;
+ }
+}
+//! [0]
+
+
+//! [1]
+MyWizard::MyWizard(QWidget *parent)
+ : QWizard(parent)
+{
+ ...
+ QList<QWizard::WizardButton> layout;
+ layout << QWizard::Stretch << QWizard::BackButton << QWizard::CancelButton
+ << QWizard::NextButton << QWizard::FinishButton;
+ setButtonLayout(layout);
+ ...
+}
+//! [1]
diff --git a/src/widgets/doc/snippets/code/src_gui_effects_qgraphicseffect.cpp b/src/widgets/doc/snippets/code/src_gui_effects_qgraphicseffect.cpp
new file mode 100644
index 0000000000..3e0b0b64ee
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_effects_qgraphicseffect.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+MyGraphicsOpacityEffect::draw(QPainter *painter)
+{
+ // Fully opaque; draw directly without going through a pixmap.
+ if (qFuzzyCompare(m_opacity, 1)) {
+ drawSource(painter);
+ return;
+ }
+ ...
+}
+//! [0]
+
+//! [1]
+MyGraphicsEffect::draw(QPainter *painter)
+{
+ ...
+ QPoint offset;
+ if (sourceIsPixmap()) {
+ // No point in drawing in device coordinates (pixmap will be scaled anyways).
+ const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset);
+ ...
+ painter->drawPixmap(offset, pixmap);
+ } else {
+ // Draw pixmap in device coordinates to avoid pixmap scaling;
+ const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset);
+ painter->setWorldTransform(QTransform());
+ ...
+ painter->drawPixmap(offset, pixmap);
+ }
+ ...
+}
+//! [1]
+
+//! [2]
+...
+QLinearGradient alphaGradient(rect.topLeft(), rect.bottomLeft());
+alphaGradient.setColorAt(0.0, Qt::transparent);
+alphaGradient.setColorAt(0.5, Qt::black);
+alphaGradient.setColorAt(1.0, Qt::transparent);
+QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
+effect->setOpacityMask(alphaGradient);
+...
+//! [2]
diff --git a/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsgridlayout.cpp b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsgridlayout.cpp
new file mode 100644
index 0000000000..9a974de016
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsgridlayout.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QGraphicsScene scene;
+QGraphicsWidget *textEdit = scene.addWidget(new QTextEdit);
+QGraphicsWidget *pushButton = scene.addWidget(new QPushButton);
+
+QGraphicsGridLayout *layout = new QGraphicsGridLayout;
+layout->addItem(textEdit, 0, 0);
+layout->addItem(pushButton, 0, 1);
+
+QGraphicsWidget *form = new QGraphicsWidget;
+form->setLayout(layout);
+scene.addItem(form);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp
new file mode 100644
index 0000000000..01df05c084
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp
@@ -0,0 +1,278 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+class SimpleItem : public QGraphicsItem
+{
+public:
+ QRectF boundingRect() const
+ {
+ qreal penWidth = 1;
+ return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,
+ 20 + penWidth, 20 + penWidth);
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget)
+ {
+ painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);
+ }
+};
+//! [0]
+
+
+//! [1]
+class CustomItem : public QGraphicsItem
+{
+ ...
+ enum { Type = UserType + 1 };
+
+ int type() const
+ {
+ // Enable the use of qgraphicsitem_cast with this item.
+ return Type;
+ }
+ ...
+};
+//! [1]
+
+
+//! [2]
+item->setCursor(Qt::IBeamCursor);
+//! [2]
+
+
+//! [3]
+item->setCursor(Qt::IBeamCursor);
+//! [3]
+
+
+//! [4]
+QGraphicsRectItem rect;
+rect.setPos(100, 100);
+
+rect.sceneTransform().map(QPointF(0, 0));
+// returns QPointF(100, 100);
+
+rect.sceneTransform().inverted().map(QPointF(100, 100));
+// returns QPointF(0, 0);
+//! [4]
+
+
+//! [5]
+QGraphicsRectItem rect;
+rect.setPos(100, 100);
+
+rect.deviceTransform(view->viewportTransform()).map(QPointF(0, 0));
+// returns the item's (0, 0) point in view's viewport coordinates
+
+rect.deviceTransform(view->viewportTransform()).inverted().map(QPointF(100, 100));
+// returns view's viewport's (100, 100) coordinate in item coordinates
+//! [5]
+
+
+//! [6]
+// Rotate an item 45 degrees around (0, 0).
+item->rotate(45);
+
+// Rotate an item 45 degrees around (x, y).
+item->setTransform(QTransform().translate(x, y).rotate(45).translate(-x, -y));
+//! [6]
+
+
+//! [7]
+// Scale an item by 3x2 from its origin
+item->scale(3, 2);
+
+// Scale an item by 3x2 from (x, y)
+item->setTransform(QTransform().translate(x, y).scale(3, 2).translate(-x, -y));
+//! [7]
+
+
+//! [8]
+QRectF CircleItem::boundingRect() const
+{
+ qreal penWidth = 1;
+ return QRectF(-radius - penWidth / 2, -radius - penWidth / 2,
+ diameter + penWidth, diameter + penWidth);
+}
+//! [8]
+
+
+//! [9]
+QPainterPath RoundItem::shape() const
+{
+ QPainterPath path;
+ path.addEllipse(boundingRect());
+ return path;
+}
+//! [9]
+
+
+//! [10]
+void RoundRectItem::paint(QPainter *painter,
+ const QStyleOptionGraphicsItem *option,
+ QWidget *widget)
+{
+ painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);
+}
+//! [10]
+
+
+//! [11]
+static const int ObjectName = 0;
+
+QGraphicsItem *item = scene.itemAt(100, 50);
+if (item->data(ObjectName).toString().isEmpty()) {
+ if (qgraphicsitem_cast<ButtonItem *>(item))
+ item->setData(ObjectName, "Button");
+}
+//! [11]
+
+
+//! [12]
+QGraphicsScene scene;
+QGraphicsEllipseItem *ellipse = scene.addEllipse(QRectF(-10, -10, 20, 20));
+QGraphicsLineItem *line = scene.addLine(QLineF(-10, -10, 20, 20));
+
+line->installSceneEventFilter(ellipse);
+// line's events are filtered by ellipse's sceneEventFilter() function.
+
+ellipse->installSceneEventFilter(line);
+// ellipse's events are filtered by line's sceneEventFilter() function.
+//! [12]
+
+
+//! [13]
+void CustomItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
+{
+ QMenu menu;
+ QAction *removeAction = menu.addAction("Remove");
+ QAction *markAction = menu.addAction("Mark");
+ QAction *selectedAction = menu.exec(event->screenPos());
+ // ...
+}
+//! [13]
+
+
+//! [14]
+CustomItem::CustomItem()
+{
+ setAcceptDrops(true);
+ ...
+}
+
+void CustomItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
+{
+ event->setAccepted(event->mimeData()->hasFormat("text/plain"));
+}
+//! [14]
+
+
+//! [15]
+QVariant Component::itemChange(GraphicsItemChange change, const QVariant &value)
+{
+ if (change == ItemPositionChange && scene()) {
+ // value is the new position.
+ QPointF newPos = value.toPointF();
+ QRectF rect = scene()->sceneRect();
+ if (!rect.contains(newPos)) {
+ // Keep the item inside the scene rect.
+ newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left())));
+ newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top())));
+ return newPos;
+ }
+ }
+ return QGraphicsItem::itemChange(change, value);
+}
+//! [15]
+
+
+//! [16]
+void CircleItem::setRadius(qreal newRadius)
+{
+ if (radius != newRadius) {
+ prepareGeometryChange();
+ radius = newRadius;
+ }
+}
+//! [16]
+
+
+//! [17]
+// Group all selected items together
+QGraphicsItemGroup *group = scene->createItemGroup(scene->selecteditems());
+
+// Destroy the group, and delete the group item
+scene->destroyItemGroup(group);
+//! [17]
+
+
+//! [QGraphicsItem type]
+class CustomItem : public QGraphicsItem
+{
+ ...
+ enum { Type = UserType + 1 };
+
+ int type() const
+ {
+ // Enable the use of qgraphicsitem_cast with this item.
+ return Type;
+ }
+ ...
+};
+//! [QGraphicsItem type]
+
+//! [18]
+class QGraphicsPathItem : public QAbstractGraphicsShapeItem
+{
+ public:
+ enum { Type = 2 };
+ int type() const { return Type; }
+ ...
+};
+//! [18]
+
+//! [19]
+QTransform xform = item->deviceTransform(view->viewportTransform());
+QRect deviceRect = xform.mapRect(rect).toAlignedRect();
+view->viewport()->scroll(dx, dy, deviceRect);
+//! [19]
+
diff --git a/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicslinearlayout.cpp b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicslinearlayout.cpp
new file mode 100644
index 0000000000..e3998201af
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicslinearlayout.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QGraphicsScene scene;
+QGraphicsWidget *textEdit = scene.addWidget(new QTextEdit);
+QGraphicsWidget *pushButton = scene.addWidget(new QPushButton);
+
+QGraphicsLinearLayout *layout = new QGraphicsLinearLayout;
+layout->addItem(textEdit);
+layout->addItem(pushButton);
+
+QGraphicsWidget *form = new QGraphicsWidget;
+form->setLayout(layout);
+scene.addItem(form);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp
new file mode 100644
index 0000000000..e508dbfb2b
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QTabWidget *tabWidget = new QTabWidget;
+
+ QGraphicsScene scene;
+ QGraphicsProxyWidget *proxy = scene.addWidget(tabWidget);
+
+ QGraphicsView view(&scene);
+ view.show();
+
+ return app.exec();
+}
+//! [0]
+
+//! [1]
+QGroupBox *groupBox = new QGroupBox("Contact Details");
+QLabel *numberLabel = new QLabel("Telephone number");
+QLineEdit *numberEdit = new QLineEdit;
+
+QFormLayout *layout = new QFormLayout;
+layout->addRow(numberLabel, numberEdit);
+groupBox->setLayout(layout);
+
+QGraphicsScene scene;
+QGraphicsProxyWidget *proxy = scene.addWidget(groupBox);
+
+QGraphicsView view(&scene);
+view.show();
+//! [1]
+
+//! [2]
+QGraphicsScene scene;
+
+QLineEdit *edit = new QLineEdit;
+QGraphicsProxyWidget *proxy = scene.addWidget(edit);
+
+edit->isVisible(); // returns true
+proxy->isVisible(); // also returns true
+
+edit->hide();
+
+edit->isVisible(); // returns false
+proxy->isVisible(); // also returns false
+//! [2]
diff --git a/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp
new file mode 100644
index 0000000000..40b240c56f
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QGraphicsScene scene;
+scene.addText("Hello, world!");
+
+QGraphicsView view(&scene);
+view.show();
+//! [0]
+
+
+//! [1]
+QGraphicsScene scene;
+scene.addItem(...
+...
+QPrinter printer(QPrinter::HighResolution);
+printer.setPaperSize(QPrinter::A4);
+
+QPainter painter(&printer);
+scene.render(&painter);
+//! [1]
+
+
+//! [2]
+QSizeF segmentSize = sceneRect().size() / pow(2, depth - 1);
+//! [2]
+
+
+//! [3]
+QGraphicsScene scene;
+QGraphicsView view(&scene);
+view.show();
+
+// a blue background
+scene.setBackgroundBrush(Qt::blue);
+
+// a gradient background
+QRadialGradient gradient(0, 0, 10);
+gradient.setSpread(QGradient::RepeatSpread);
+scene.setBackgroundBrush(gradient);
+//! [3]
+
+
+//! [4]
+QGraphicsScene scene;
+QGraphicsView view(&scene);
+view.show();
+
+// a white semi-transparent foreground
+scene.setForegroundBrush(QColor(255, 255, 255, 127));
+
+// a grid foreground
+scene.setForegroundBrush(QBrush(Qt::lightGray, Qt::CrossPattern));
+//! [4]
+
+
+//! [5]
+QRectF TileScene::rectForTile(int x, int y) const
+{
+ // Return the rectangle for the tile at position (x, y).
+ return QRectF(x * tileWidth, y * tileHeight, tileWidth, tileHeight);
+}
+
+void TileScene::setTile(int x, int y, const QPixmap &pixmap)
+{
+ // Sets or replaces the tile at position (x, y) with pixmap.
+ if (x >= 0 && x < numTilesH && y >= 0 && y < numTilesV) {
+ tiles[y][x] = pixmap;
+ invalidate(rectForTile(x, y), BackgroundLayer);
+ }
+}
+
+void TileScene::drawBackground(QPainter *painter, const QRectF &exposed)
+{
+ // Draws all tiles that intersect the exposed area.
+ for (int y = 0; y < numTilesV; ++y) {
+ for (int x = 0; x < numTilesH; ++x) {
+ QRectF rect = rectForTile(x, y);
+ if (exposed.intersects(rect))
+ painter->drawPixmap(rect.topLeft(), tiles[y][x]);
+ }
+ }
+}
+//! [5]
diff --git a/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicssceneevent.cpp b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicssceneevent.cpp
new file mode 100644
index 0000000000..0e9ceea6a0
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicssceneevent.cpp
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+
+setDropAction(proposedAction());
+
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsview.cpp b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsview.cpp
new file mode 100644
index 0000000000..d07b5f7cf6
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsview.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QGraphicsScene scene;
+scene.addText("Hello, world!");
+
+QGraphicsView view(&scene);
+view.show();
+//! [0]
+
+
+//! [1]
+QGraphicsScene scene;
+scene.addRect(QRectF(-10, -10, 20, 20));
+
+QGraphicsView view(&scene);
+view.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
+view.show();
+//! [1]
+
+
+//! [2]
+QGraphicsView view;
+view.setBackgroundBrush(QImage(":/images/backgroundtile.png"));
+view.setCacheMode(QGraphicsView::CacheBackground);
+//! [2]
+
+
+//! [3]
+QGraphicsScene scene;
+scene.addText("GraphicsView rotated clockwise");
+
+QGraphicsView view(&scene);
+view.rotate(90); // the text is rendered with a 90 degree clockwise rotation
+view.show();
+//! [3]
+
+
+//! [4]
+QGraphicsScene scene;
+scene.addItem(...
+...
+
+QGraphicsView view(&scene);
+view.show();
+...
+
+QPrinter printer(QPrinter::HighResolution);
+printer.setPageSize(QPrinter::A4);
+QPainter painter(&printer);
+
+// print, fitting the viewport contents into a full page
+view.render(&painter);
+
+// print the upper half of the viewport into the lower.
+// half of the page.
+QRect viewport = view.viewport()->rect();
+view.render(&painter,
+ QRectF(0, printer.height() / 2,
+ printer.width(), printer.height() / 2),
+ viewport.adjusted(0, 0, 0, -viewport.height() / 2));
+
+//! [4]
+
+
+//! [5]
+void CustomView::mousePressEvent(QMouseEvent *event)
+{
+ qDebug() << "There are" << items(event->pos()).size()
+ << "items at position" << mapToScene(event->pos());
+}
+//! [5]
+
+
+//! [6]
+void CustomView::mousePressEvent(QMouseEvent *event)
+{
+ if (QGraphicsItem *item = itemAt(event->pos())) {
+ qDebug() << "You clicked on item" << item;
+ } else {
+ qDebug() << "You didn't click on an item.";
+ }
+}
+//! [6]
+
+
+//! [7]
+QGraphicsScene scene;
+scene.addText("GraphicsView rotated clockwise");
+
+QGraphicsView view(&scene);
+view.rotate(90); // the text is rendered with a 90 degree clockwise rotation
+view.show();
+//! [7]
diff --git a/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp
new file mode 100644
index 0000000000..da92f2d2e1
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+void MyGroupBoxWidget::initStyleOption(QStyleOption *option) const
+{
+ QGraphicsWidget::initStyleOption(option);
+ if (QStyleOptionGroupBox *box = qstyleoption_cast<QStyleOptionGroupBox *>(option)) {
+ // Add group box specific state.
+ box->flat = isFlat();
+ ...
+ }
+}
+//! [0]
+
+
+//! [1]
+setTabOrder(a, b); // a to b
+setTabOrder(b, c); // a to b to c
+setTabOrder(c, d); // a to b to c to d
+//! [1]
+
+
+//! [2]
+// WRONG
+setTabOrder(c, d); // c to d
+setTabOrder(a, b); // a to b AND c to d
+setTabOrder(b, c); // a to b to c, but not c to d
+//! [2]
diff --git a/src/widgets/doc/snippets/code/src_gui_image_qicon.cpp b/src/widgets/doc/snippets/code/src_gui_image_qicon.cpp
new file mode 100644
index 0000000000..28ebea8f65
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_image_qicon.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QToolButton *button = new QToolButton;
+button->setIcon(QIcon("open.xpm"));
+//! [0]
+
+
+//! [1]
+button->setIcon(QIcon());
+//! [1]
+
+
+//! [2]
+void MyWidget::drawIcon(QPainter *painter, QPoint pos)
+{
+ QPixmap pixmap = icon.pixmap(QSize(22, 22),
+ isEnabled() ? QIcon::Normal
+ : QIcon::Disabled,
+ isChecked() ? QIcon::On
+ : QIcon::Off);
+ painter->drawPixmap(pos, pixmap);
+}
+//! [2]
+
+//! [3]
+ QIcon undoicon = QIcon::fromTheme("edit-undo");
+//! [3]
+
+//! [4]
+ QIcon undoicon = QIcon::fromTheme("edit-undo", QIcon(":/undo.png"));
+//! [4]
+
diff --git a/src/widgets/doc/snippets/code/src_gui_image_qpixmapfilter.cpp b/src/widgets/doc/snippets/code/src_gui_image_qpixmapfilter.cpp
new file mode 100644
index 0000000000..55d5aa4897
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_image_qpixmapfilter.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QPixmapColorizeFilter *myFilter = new QPixmapColorFilter;
+myFilter->setColor(QColor(128, 0, 0));
+myFilter->draw(painter, QPoint(0, 0), originalPixmap);
+//! [0]
+
+//! [1]
+QPixmapConvolutionFilter *myFilter = new QPixmapConvolutionFilter;
+qreal kernel[] = {
+ 0.0,-1.0, 0.0,
+ -1.0, 5.0,-1.0,
+ 0.0,-1.0, 0.0
+ };
+myFilter->setConvolutionKernel(kernel, 3, 3);
+myFilter->draw(painter, QPoint(0, 0), originalPixmap);
+//! [1]
+
+//! [2]
+QPixmapDropShadowFilter *myFilter = new QPixmapDropShadowFilter;
+myFilter->draw(painter, QPoint(0, 0), originalPixmap);
+//! [2]
+
diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qabstractitemview.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qabstractitemview.cpp
new file mode 100644
index 0000000000..2a497ff37c
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qabstractitemview.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+void MyView::resizeEvent(QResizeEvent *event) {
+ horizontalScrollBar()->setRange(0, realWidth - width());
+ ...
+}
+//! [0]
+
+//! [1]
+setIndexWidget(index, new QLineEdit);
+...
+setIndexWidget(index, new QTextEdit);
+//! [1]
+
+//! [2]
+QItemSelectionModel *m = view->selectionModel();
+view->setModel(new model);
+delete m;
+//! [2]
diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp
new file mode 100644
index 0000000000..d968260d39
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QDataWidgetMapper *mapper = new QDataWidgetMapper;
+mapper->setModel(model);
+mapper->addMapping(mySpinBox, 0);
+mapper->addMapping(myLineEdit, 1);
+mapper->addMapping(myCountryChooser, 2);
+mapper->toFirst();
+//! [0]
+
+
+//! [1]
+QDataWidgetMapper *mapper = new QDataWidgetMapper();
+mapper->setModel(myModel);
+mapper->addMapping(nameLineEdit, 0);
+mapper->addMapping(ageSpinBox, 1);
+//! [1]
+
+
+//! [2]
+QDataWidgetMapper *mapper = new QDataWidgetMapper();
+connect(myTableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
+ mapper, SLOT(setCurrentModelIndex(QModelIndex)));
+//! [2]
diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp
new file mode 100644
index 0000000000..3f1e11c04c
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+Q_PROPERTY(QColor color READ color WRITE setColor USER true)
+//! [0]
+
+
+//! [1]
+QItemEditorCreator<MyEditor> *itemCreator =
+ new QItemEditorCreator<MyEditor>("myProperty");
+
+QItemEditorFactory *factory = new QItemEditorFactory;
+//! [1]
+
+
+//! [2]
+QItemEditorFactory *editorFactory = new QItemEditorFactory;
+QItemEditorCreatorBase *creator = new QStandardItemEditorCreator<MyFancyDateTimeEdit>();
+editorFactory->registerEditor(QVariant::DateType, creator);
+//! [2]
+
+
+//! [3]
+Q_PROPERTY(QColor color READ color WRITE setColor USER true)
+//! [3]
diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp
new file mode 100644
index 0000000000..ae91339867
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QStandardItemModel model(4, 4);
+for (int row = 0; row < 4; ++row) {
+ for (int column = 0; column < 4; ++column) {
+ QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column));
+ model.setItem(row, column, item);
+ }
+}
+//! [0]
+
+
+//! [1]
+QStandardItemModel model;
+QStandardItem *parentItem = model.invisibleRootItem();
+for (int i = 0; i < 4; ++i) {
+ QStandardItem *item = new QStandardItem(QString("item %0").arg(i));
+ parentItem->appendRow(item);
+ parentItem = item;
+}
+//! [1]
+
+
+//! [2]
+QTreeView *treeView = new QTreeView(this);
+treeView->setModel(myStandardItemModel);
+connect(treeView, SIGNAL(clicked(QModelIndex)),
+ this, SLOT(clicked(QModelIndex)));
+//! [2]
+
+
+//! [3]
+void MyWidget::clicked(const QModelIndex &index)
+{
+ QStandardItem *item = myStandardItemModel->itemFromIndex(index);
+ // Do stuff with the item ...
+}
+//! [3]
+
+
+//! [4]
+treeView->scrollTo(item->index());
+//! [4]
diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp
new file mode 100644
index 0000000000..169fff57b9
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+setCellWidget(index, new QLineEdit);
+...
+setCellWidget(index, new QTextEdit);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qtreewidget.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qtreewidget.cpp
new file mode 100644
index 0000000000..b299d765f3
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qtreewidget.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QTreeWidget *treeWidget = new QTreeWidget();
+treeWidget->setColumnCount(1);
+QList<QTreeWidgetItem *> items;
+for (int i = 0; i < 10; ++i)
+ items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i))));
+treeWidget->insertTopLevelItems(0, items);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qaction.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qaction.cpp
new file mode 100644
index 0000000000..af876cd872
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_kernel_qaction.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QApplication app(argc, argv);
+app.setAttribute(Qt::AA_DontShowIconsInMenus); // Icons are *no longer shown* in menus
+// ...
+QAction *myAction = new QAction();
+// ...
+myAction->setIcon(SomeIcon);
+myAction->setIconVisibleInMenu(true); // Icon *will* be shown in menus for *this* action.
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp
new file mode 100644
index 0000000000..b32e8c3f39
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+int main(int argc, char **argv)
+{
+#ifdef Q_WS_X11
+ bool useGUI = getenv("DISPLAY") != 0;
+#else
+ bool useGUI = true;
+#endif
+ QApplication app(argc, argv, useGUI);
+
+ if (useGUI) {
+ // start GUI version
+ ...
+ } else {
+ // start non-GUI version
+ ...
+ }
+ return app.exec();
+}
+//! [0]
+
+
+//! [1]
+QApplication::setStyle(new QWindowsStyle);
+//! [1]
+
+
+//! [2]
+int main(int argc, char *argv[])
+{
+ QApplication::setColorSpec(QApplication::ManyColor);
+ QApplication app(argc, argv);
+ ...
+ return app.exec();
+}
+//! [2]
+
+
+//! [3]
+QSize MyWidget::sizeHint() const
+{
+ return QSize(80, 25).expandedTo(QApplication::globalStrut());
+}
+//! [3]
+
+
+//! [4]
+void showAllHiddenTopLevelWidgets()
+{
+ foreach (QWidget *widget, QApplication::topLevelWidgets()) {
+ if (widget->isHidden())
+ widget->show();
+ }
+}
+//! [4]
+
+
+//! [5]
+void updateAllWidgets()
+{
+ foreach (QWidget *widget, QApplication::allWidgets())
+ widget->update();
+}
+//! [5]
+
+
+//! [6]
+int main(int argc, char *argv[])
+{
+ QApplication::setDesktopSettingsAware(false);
+ QApplication app(argc, argv);
+ ...
+ return app.exec();
+}
+//! [6]
+
+
+//! [7]
+if ((startPos - currentPos).manhattanLength() >=
+ QApplication::startDragDistance())
+ startTheDrag();
+//! [7]
+
+
+//! [8]
+void MyApplication::commitData(QSessionManager& manager)
+{
+ if (manager.allowsInteraction()) {
+ int ret = QMessageBox::warning(
+ mainWindow,
+ tr("My Application"),
+ tr("Save changes to document?"),
+ QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
+
+ switch (ret) {
+ case QMessageBox::Save:
+ manager.release();
+ if (!saveDocument())
+ manager.cancel();
+ break;
+ case QMessageBox::Discard:
+ break;
+ case QMessageBox::Cancel:
+ default:
+ manager.cancel();
+ }
+ } else {
+ // we did not get permission to interact, then
+ // do something reasonable instead
+ }
+}
+//! [8]
+
+
+//! [9]
+appname -session id
+//! [9]
+
+
+//! [10]
+foreach (const QString &command, mySession.restartCommand())
+ do_something(command);
+//! [10]
+
+
+//! [11]
+foreach (const QString &command, mySession.discardCommand())
+ do_something(command);
+//! [11]
+
+
+//! [12]
+QWidget *widget = qApp->widgetAt(x, y);
+if (widget)
+ widget = widget->window();
+//! [12]
+
+
+//! [13]
+QWidget *widget = qApp->widgetAt(point);
+if (widget)
+ widget = widget->window();
+//! [13]
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qformlayout.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qformlayout.cpp
new file mode 100644
index 0000000000..1f7517b613
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_kernel_qformlayout.cpp
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QFormLayout *formLayout = new QFormLayout;
+formLayout->addRow(tr("&Name:"), nameLineEdit);
+formLayout->addRow(tr("&Email:"), emailLineEdit);
+formLayout->addRow(tr("&Age:"), ageSpinBox);
+setLayout(formLayout);
+//! [0]
+
+
+//! [1]
+nameLabel = new QLabel(tr("&Name:"));
+nameLabel->setBuddy(nameLineEdit);
+
+emailLabel = new QLabel(tr("&Name:"));
+emailLabel->setBuddy(emailLineEdit);
+
+ageLabel = new QLabel(tr("&Name:"));
+ageLabel->setBuddy(ageSpinBox);
+
+QGridLayout *gridLayout = new QGridLayout;
+gridLayout->addWidget(nameLabel, 0, 0);
+gridLayout->addWidget(nameLineEdit, 0, 1);
+gridLayout->addWidget(emailLabel, 1, 0);
+gridLayout->addWidget(emailLineEdit, 1, 1);
+gridLayout->addWidget(ageLabel, 2, 0);
+gridLayout->addWidget(ageSpinBox, 2, 1);
+setLayout(gridLayout);
+//! [1]
+
+
+//! [2]
+formLayout->setRowWrapPolicy(QFormLayout::DontWrapRows);
+formLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
+formLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
+formLayout->setLabelAlignment(Qt::AlignLeft);
+//! [2]
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qlayout.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qlayout.cpp
new file mode 100644
index 0000000000..cabd753b5d
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_kernel_qlayout.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+static void paintLayout(QPainter *painter, QLayoutItem *item)
+{
+ QLayout *layout = item->layout();
+ if (layout) {
+ for (int i = 0; i < layout->count(); ++i)
+ paintLayout(painter, layout->itemAt(i));
+ }
+ painter->drawRect(item->geometry());
+}
+
+void MyWidget::paintEvent(QPaintEvent *)
+{
+ QPainter painter(this);
+ if (layout())
+ paintLayout(&painter, layout());
+}
+//! [0]
+
+
+//! [1]
+QLayoutItem *child;
+while ((child = layout->takeAt(0)) != 0) {
+ ...
+ delete child;
+}
+//! [1]
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp
new file mode 100644
index 0000000000..378253c605
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+int MyLayout::heightForWidth(int w) const
+{
+ if (cache_dirty || cached_width != w) {
+ // not all C++ compilers support "mutable"
+ MyLayout *that = (MyLayout*)this;
+ int h = calculateHeightForWidth(w);
+ that->cached_hfw = h;
+ return h;
+ }
+ return cached_hfw;
+}
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qshortcut.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qshortcut.cpp
new file mode 100644
index 0000000000..31e3e3291e
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_kernel_qshortcut.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+shortcut = new QShortcut(QKeySequence(tr("Ctrl+O", "File|Open")),
+ parent);
+//! [0]
+
+
+//! [1]
+setKey(0); // no signal emitted
+setKey(QKeySequence()); // no signal emitted
+setKey(0x3b1); // Greek letter alpha
+setKey(Qt::Key_D); // 'd', e.g. to delete
+setKey('q'); // 'q', e.g. to quit
+setKey(Qt::CTRL + Qt::Key_P); // Ctrl+P, e.g. to print document
+setKey("Ctrl+P"); // Ctrl+P, e.g. to print document
+//! [1]
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qwidget.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qwidget.cpp
new file mode 100644
index 0000000000..3e94519073
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_kernel_qwidget.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+w->setWindowState(w->windowState() ^ Qt::WindowFullScreen);
+//! [0]
+
+
+//! [1]
+w->setWindowState(w->windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
+//! [1]
+
+
+//! [2]
+width = baseSize().width() + i * sizeIncrement().width();
+height = baseSize().height() + j * sizeIncrement().height();
+//! [2]
+
+
+//! [3]
+aWidget->window()->setWindowTitle("New Window Title");
+//! [3]
+
+
+//! [4]
+QFont font("Helvetica", 12, QFont::Bold);
+setFont(font);
+//! [4]
+
+
+//! [5]
+QFont font;
+font.setBold(false);
+setFont(font);
+//! [5]
+
+
+//! [6]
+setCursor(Qt::IBeamCursor);
+//! [6]
+
+
+//! [7]
+QPixmap pixmap(widget->size());
+widget->render(&pixmap);
+//! [7]
+
+
+//! [8]
+QPainter painter(this);
+...
+painter.end();
+myWidget->render(this);
+//! [8]
+
+
+//! [9]
+setTabOrder(a, b); // a to b
+setTabOrder(b, c); // a to b to c
+setTabOrder(c, d); // a to b to c to d
+//! [9]
+
+
+//! [10]
+// WRONG
+setTabOrder(c, d); // c to d
+setTabOrder(a, b); // a to b AND c to d
+setTabOrder(b, c); // a to b to c, but not c to d
+//! [10]
+
+
+//! [11]
+void MyWidget::closeEvent(QCloseEvent *event)
+{
+ QSettings settings("MyCompany", "MyApp");
+ settings.setValue("geometry", saveGeometry());
+ QWidget::closeEvent(event);
+}
+//! [11]
+
+
+//! [12]
+QSettings settings("MyCompany", "MyApp");
+myWidget->restoreGeometry(settings.value("myWidget/geometry").toByteArray());
+//! [12]
+
+
+//! [13]
+setUpdatesEnabled(false);
+bigVisualChanges();
+setUpdatesEnabled(true);
+//! [13]
+
+
+//! [14]
+...
+extern void qt_x11_set_global_double_buffer(bool);
+qt_x11_set_global_double_buffer(false);
+...
+//! [14]
diff --git a/src/widgets/doc/snippets/code/src_gui_painting_qdrawutil.cpp b/src/widgets/doc/snippets/code/src_gui_painting_qdrawutil.cpp
new file mode 100644
index 0000000000..0f70fce8ef
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_painting_qdrawutil.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QFrame frame:
+frame.setFrameStyle(QFrame::HLine | QFrame::Sunken);
+//! [0]
+
+
+//! [1]
+QFrame frame:
+frame.setFrameStyle(QFrame::Box | QFrame::Raised);
+//! [1]
+
+
+//! [2]
+QFrame frame:
+frame.setFrameStyle( QFrame::Panel | QFrame::Sunken);
+//! [2]
+
+
+//! [3]
+QFrame frame:
+frame.setFrameStyle(QFrame::WinPanel | QFrame::Raised);
+//! [3]
+
+
+//! [4]
+QFrame frame:
+frame.setFrameStyle(QFrame::Box | QFrame::Plain);
+//! [4]
+
+
+//! [5]
+QFrame frame:
+frame.setFrameStyle(QFrame::HLine | QFrame::Sunken);
+//! [5]
+
+
+//! [6]
+QFrame frame:
+frame.setFrameStyle(QFrame::Box | QFrame::Raised);
+//! [6]
+
+
+//! [7]
+QFrame frame:
+frame.setFrameStyle( QFrame::Panel | QFrame::Sunken);
+//! [7]
+
+
+//! [8]
+QFrame frame:
+frame.setFrameStyle(QFrame::WinPanel | QFrame::Raised);
+//! [8]
+
+
+//! [9]
+QFrame frame:
+frame.setFrameStyle(QFrame::Box | QFrame::Plain);
+//! [9]
diff --git a/src/widgets/doc/snippets/code/src_gui_qproxystyle.cpp b/src/widgets/doc/snippets/code/src_gui_qproxystyle.cpp
new file mode 100644
index 0000000000..ae9ff131aa
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_qproxystyle.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+class MyProxyStyle : public QProxyStyle
+{
+public:
+
+ int styleHint(StyleHint hint, const QStyleOption *option = 0,
+ const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const
+ {
+ if (hint == QStyle::SH_UnderlineShortcut)
+ return 1;
+ return QProxyStyle::styleHint(hint, option, widget, returnData);
+ }
+};
+
+//! [0]
+
+//! [1]
+#include "textedit.h"
+#include <QApplication>
+#include <QProxyStyle>
+
+class MyProxyStyle : public QProxyStyle
+{
+ public:
+ int styleHint(StyleHint hint, const QStyleOption *option = 0,
+ const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const
+ {
+ if (hint == QStyle::SH_UnderlineShortcut)
+ return 0;
+ return QProxyStyle::styleHint(hint, option, widget, returnData);
+ }
+};
+
+int main(int argc, char **argv)
+{
+ Q_INIT_RESOURCE(textedit);
+
+ QApplication a(argc, argv);
+ a.setStyle(new MyProxyStyle);
+ TextEdit mw;
+ mw.resize(700, 800);
+ mw.show();
+ //...
+}
+//! [1]
diff --git a/src/widgets/doc/snippets/code/src_gui_styles_qstyle.cpp b/src/widgets/doc/snippets/code/src_gui_styles_qstyle.cpp
new file mode 100644
index 0000000000..ed4ebb60a4
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_styles_qstyle.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+./myapplication -style motif
+//! [0]
+
+
+//! [1]
+./myapplication -style custom
+//! [1]
diff --git a/src/widgets/doc/snippets/code/src_gui_styles_qstyleoption.cpp b/src/widgets/doc/snippets/code/src_gui_styles_qstyleoption.cpp
new file mode 100644
index 0000000000..962212388f
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_styles_qstyleoption.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+int MyStyle::styleHint(StyleHint stylehint, const QStyleOption *opt,
+ const QWidget *widget, QStyleHintReturn* returnData) const;
+{
+ if (stylehint == SH_RubberBand_Mask) {
+ const QStyleHintReturnMask *maskReturn =
+ qstyleoption_cast<const QStyleHintReturnMask *>(hint);
+ if (maskReturn) {
+ ...
+ }
+ }
+ ...
+}
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_util_qcompleter.cpp b/src/widgets/doc/snippets/code/src_gui_util_qcompleter.cpp
new file mode 100644
index 0000000000..2e8eac17ad
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_util_qcompleter.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QStringList wordList;
+wordList << "alpha" << "omega" << "omicron" << "zeta";
+
+QLineEdit *lineEdit = new QLineEdit(this);
+
+QCompleter *completer = new QCompleter(wordList, this);
+completer->setCaseSensitivity(Qt::CaseInsensitive);
+lineEdit->setCompleter(completer);
+//! [0]
+
+
+//! [1]
+QCompleter *completer = new QCompleter(this);
+completer->setModel(new QDirModel(completer));
+lineEdit->setCompleter(completer);
+//! [1]
+
+
+//! [2]
+for (int i = 0; completer->setCurrentRow(i); i++)
+ qDebug() << completer->currentCompletion() << " is match number " << i;
+//! [2]
diff --git a/src/widgets/doc/snippets/code/src_gui_util_qundostack.cpp b/src/widgets/doc/snippets/code/src_gui_util_qundostack.cpp
new file mode 100644
index 0000000000..7e06a8ef6f
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_util_qundostack.cpp
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+class AppendText : public QUndoCommand
+{
+public:
+ AppendText(QString *doc, const QString &text)
+ : m_document(doc), m_text(text) { setText("append text"); }
+ virtual void undo()
+ { m_document->chop(m_text.length()); }
+ virtual void redo()
+ { m_document->append(m_text); }
+private:
+ QString *m_document;
+ QString m_text;
+};
+//! [0]
+
+
+//! [1]
+MyCommand *command1 = new MyCommand();
+stack->push(command1);
+MyCommand *command2 = new MyCommand();
+stack->push(command2);
+
+stack->undo();
+
+MyCommand *command3 = new MyCommand();
+stack->push(command3); // command2 gets deleted
+//! [1]
+
+
+//! [2]
+QUndoCommand *insertRed = new QUndoCommand(); // an empty command
+insertRed->setText("insert red text");
+
+new InsertText(document, idx, text, insertRed); // becomes child of insertRed
+new SetColor(document, idx, text.length(), Qt::red, insertRed);
+
+stack.push(insertRed);
+//! [2]
+
+
+//! [3]
+bool AppendText::mergeWith(const QUndoCommand *other)
+{
+ if (other->id() != id()) // make sure other is also an AppendText command
+ return false;
+ m_text += static_cast<const AppendText*>(other)->m_text;
+ return true;
+}
+//! [3]
+
+
+//! [4]
+stack.beginMacro("insert red text");
+stack.push(new InsertText(document, idx, text));
+stack.push(new SetColor(document, idx, text.length(), Qt::red));
+stack.endMacro(); // indexChanged() is emitted
+//! [4]
+
+
+//! [5]
+QUndoCommand *insertRed = new QUndoCommand(); // an empty command
+insertRed->setText("insert red text");
+
+new InsertText(document, idx, text, insertRed); // becomes child of insertRed
+new SetColor(document, idx, text.length(), Qt::red, insertRed);
+
+stack.push(insertRed);
+//! [5]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qabstractbutton.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qabstractbutton.cpp
new file mode 100644
index 0000000000..948ed0e958
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qabstractbutton.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QPushButton *button = new QPushButton(tr("Ro&ck && Roll"), this);
+//! [0]
+
+
+//! [1]
+button->setIcon(QIcon(":/images/print.png"));
+button->setShortcut(tr("Alt+F7"));
+//! [1]
+
+
+//! [2]
+void MyWidget::reactToToggle(bool checked)
+{
+ if (checked) {
+ // Examine the new button states.
+ ...
+ }
+}
+//! [2]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qabstractspinbox.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qabstractspinbox.cpp
new file mode 100644
index 0000000000..66f3449760
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qabstractspinbox.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QSpinBox *spinBox = new QSpinBox(this);
+spinBox->setRange(0, 100);
+spinBox->setWrapping(true);
+spinBox->setValue(100);
+spinBox->stepBy(1);
+// value is 0
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qcalendarwidget.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qcalendarwidget.cpp
new file mode 100644
index 0000000000..6f99bdf0ce
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qcalendarwidget.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QCalendarWidget *calendar;
+calendar->setGridVisible(true);
+//! [0]
+
+
+//! [1]
+QCalendarWidget *calendar;
+calendar->setGridVisible(true);
+calendar->setMinimumDate(QDate(2006, 6, 19));
+//! [1]
+
+
+//! [2]
+QCalendarWidget *calendar;
+calendar->setGridVisible(true);
+calendar->setMaximumDate(QDate(2006, 7, 3));
+//! [2]
+
+
+//! [3]
+QCalendarWidget *calendar;
+
+calendar->setDateRange(min, max);
+//! [3]
+
+
+//! [4]
+QCalendarWidget *calendar;
+
+calendar->setMinimumDate(min);
+calendar->setMaximumDate(max);
+//! [4]
+
+
+//! [5]
+QCalendarWidget *calendar;
+calendar->setGridVisible(true);
+//! [5]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qcheckbox.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qcheckbox.cpp
new file mode 100644
index 0000000000..71ee59bc85
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qcheckbox.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QCheckBox *checkbox = new QCheckBox("C&ase sensitive", this);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qdatetimeedit.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qdatetimeedit.cpp
new file mode 100644
index 0000000000..5eb9e739ea
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qdatetimeedit.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate());
+dateEdit->setMinimumDate(QDate::currentDate().addDays(-365));
+dateEdit->setMaximumDate(QDate::currentDate().addDays(365));
+dateEdit->setDisplayFormat("yyyy.MM.dd");
+//! [0]
+
+
+//! [1]
+setDateTimeRange(min, max);
+//! [1]
+
+
+//! [2]
+setMinimumDateTime(min);
+setMaximumDateTime(max);
+//! [2]
+
+
+//! [3]
+setDateRange(min, max);
+//! [3]
+
+
+//! [4]
+setMinimumDate(min);
+setMaximumDate(max);
+//! [4]
+
+
+//! [5]
+setTimeRange(min, max);
+//! [5]
+
+
+//! [6]
+setMinimumTime(min);
+setMaximumTime(max);
+//! [6]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qdockwidget.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qdockwidget.cpp
new file mode 100644
index 0000000000..690e3d5f33
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qdockwidget.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QDockWidget *dockWidget = qobject_cast<QDockWidget*>(parentWidget());
+if (dockWidget->features() & QDockWidget::DockWidgetVerticalTitleBar) {
+ // I need to be vertical
+} else {
+ // I need to be horizontal
+}
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qframe.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qframe.cpp
new file mode 100644
index 0000000000..6e3afcd8cf
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qframe.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QLabel label(...);
+label.setFrameStyle(QFrame::Panel | QFrame::Raised);
+label.setLineWidth(2);
+
+QProgressBar pbar(...);
+label.setFrameStyle(QFrame::NoFrame);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qgroupbox.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qgroupbox.cpp
new file mode 100644
index 0000000000..fc0339f690
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qgroupbox.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+g->setTitle("&User information");
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qlabel.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qlabel.cpp
new file mode 100644
index 0000000000..83b02a2f22
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qlabel.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QLabel *label = new QLabel(this);
+label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+label->setText("first line\nsecond line");
+label->setAlignment(Qt::AlignBottom | Qt::AlignRight);
+//! [0]
+
+
+//! [1]
+QLineEdit* phoneEdit = new QLineEdit(this);
+QLabel* phoneLabel = new QLabel("&Phone:", this);
+phoneLabel->setBuddy(phoneEdit);
+//! [1]
+
+
+//! [2]
+QLineEdit *nameEd = new QLineEdit(this);
+QLabel *nameLb = new QLabel("&Name:", this);
+nameLb->setBuddy(nameEd);
+QLineEdit *phoneEd = new QLineEdit(this);
+QLabel *phoneLb = new QLabel("&Phone:", this);
+phoneLb->setBuddy(phoneEd);
+// (layout setup not shown)
+//! [2]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qlineedit.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qlineedit.cpp
new file mode 100644
index 0000000000..12ed38ad65
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qlineedit.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+void LineEdit::contextMenuEvent(QContextMenuEvent *event)
+{
+ QMenu *menu = createStandardContextMenu();
+ menu->addAction(tr("My Menu Item"));
+ //...
+ menu->exec(event->globalPos());
+ delete menu;
+}
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qmainwindow.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qmainwindow.cpp
new file mode 100644
index 0000000000..3558922ec9
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qmainwindow.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+void MyMainWindow::closeEvent(QCloseEvent *event)
+{
+ QSettings settings("MyCompany", "MyApp");
+ settings.setValue("geometry", saveGeometry());
+ settings.setValue("windowState", saveState());
+ QMainWindow::closeEvent(event);
+}
+//! [0]
+
+
+//! [1]
+void MainWindow::readSettings()
+{
+ QSettings settings("MyCompany", "MyApp");
+ restoreGeometry(settings.value("myWidget/geometry").toByteArray());
+ restoreState(settings.value("myWidget/windowState").toByteArray());
+}
+//! [1]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qmenu.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qmenu.cpp
new file mode 100644
index 0000000000..5799248bf4
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qmenu.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+exec(QCursor::pos());
+//! [0]
+
+
+//! [1]
+exec(somewidget.mapToGlobal(QPoint(0,0)));
+//! [1]
+
+
+//! [2]
+exec(e->globalPos());
+//! [2]
+
+
+//! [3]
+exec(QCursor::pos());
+//! [3]
+
+
+//! [4]
+exec(somewidget.mapToGlobal(QPoint(0, 0)));
+//! [4]
+
+
+//! [5]
+exec(e->globalPos());
+//! [5]
+
+
+//! [6]
+QMenu menu;
+QAction *at = actions[0]; // Assumes actions is not empty
+foreach (QAction *a, actions)
+ menu.addAction(a);
+menu.exec(pos, at);
+//! [6]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qmenubar.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qmenubar.cpp
new file mode 100644
index 0000000000..412bc2d5eb
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qmenubar.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+menubar->addMenu(fileMenu);
+//! [0]
+
+
+//! [1]
+QMenuBar *menuBar = new QMenuBar(0);
+//! [1]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qplaintextedit.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qplaintextedit.cpp
new file mode 100644
index 0000000000..931c6c69a6
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qplaintextedit.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+void MyQPlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
+{
+ QMenu *menu = createStandardContextMenu();
+ menu->addAction(tr("My Menu Item"));
+ //...
+ menu->exec(event->globalPos());
+ delete menu;
+}
+//! [0]
+
+
+//! [1]
+edit->textCursor().insertText(text);
+//! [1]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qpushbutton.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qpushbutton.cpp
new file mode 100644
index 0000000000..e0ae945620
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qpushbutton.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QPushButton *button = new QPushButton("&Download", this);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qradiobutton.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qradiobutton.cpp
new file mode 100644
index 0000000000..a93809fa5d
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qradiobutton.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QRadioButton *button = new QRadioButton("Search from the &cursor", this);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qrubberband.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qrubberband.cpp
new file mode 100644
index 0000000000..b8d6a14d1c
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qrubberband.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+void Widget::mousePressEvent(QMouseEvent *event)
+{
+ origin = event->pos();
+ if (!rubberBand)
+ rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
+ rubberBand->setGeometry(QRect(origin, QSize()));
+ rubberBand->show();
+}
+
+void Widget::mouseMoveEvent(QMouseEvent *event)
+{
+ rubberBand->setGeometry(QRect(origin, event->pos()).normalized());
+}
+
+void Widget::mouseReleaseEvent(QMouseEvent *event)
+{
+ rubberBand->hide();
+ // determine selection, for example using QRect::intersects()
+ // and QRect::contains().
+}
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qscrollarea.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qscrollarea.cpp
new file mode 100644
index 0000000000..9c90a0c53d
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qscrollarea.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QLabel *imageLabel = new QLabel;
+QImage image("happyguy.png");
+imageLabel->setPixmap(QPixmap::fromImage(image));
+
+scrollArea = new QScrollArea;
+scrollArea->setBackgroundRole(QPalette::Dark);
+scrollArea->setWidget(imageLabel);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qspinbox.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qspinbox.cpp
new file mode 100644
index 0000000000..fc1f5b7e47
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qspinbox.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+sb->setPrefix("$");
+//! [0]
+
+
+//! [1]
+sb->setSuffix(" km");
+//! [1]
+
+
+//! [2]
+setRange(minimum, maximum);
+//! [2]
+
+
+//! [3]
+setMinimum(minimum);
+setMaximum(maximum);
+//! [3]
+
+
+//! [4]
+spinbox->setPrefix("$");
+//! [4]
+
+
+//! [5]
+spinbox->setSuffix(" km");
+//! [5]
+
+
+//! [6]
+setRange(minimum, maximum);
+//! [6]
+
+
+//! [7]
+setMinimum(minimum);
+setMaximum(maximum);
+//! [7]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qsplashscreen.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qsplashscreen.cpp
new file mode 100644
index 0000000000..48f1051e2c
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qsplashscreen.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QPixmap pixmap(":/splash.png");
+QSplashScreen *splash = new QSplashScreen(pixmap);
+splash->show();
+
+... // Loading some items
+splash->showMessage("Loaded modules");
+
+qApp->processEvents();
+
+... // Establishing connections
+splash->showMessage("Established connections");
+
+qApp->processEvents();
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qsplitter.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qsplitter.cpp
new file mode 100644
index 0000000000..18007a4cdf
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qsplitter.cpp
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QWidget *widget = splitter->widget(index);
+QSizePolicy policy = widget->sizePolicy();
+policy.setHorizontalStretch(stretch);
+policy.setVerticalStretch(stretch);
+widget->setSizePolicy(policy);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qstatusbar.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qstatusbar.cpp
new file mode 100644
index 0000000000..6ea752b237
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qstatusbar.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+statusBar()->addWidget(new MyReadWriteIndication);
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qtextbrowser.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qtextbrowser.cpp
new file mode 100644
index 0000000000..ed30c2d80a
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qtextbrowser.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+backaction.setToolTip(browser.historyTitle(-1));
+forwardaction.setToolTip(browser.historyTitle(+1));
+//! [0]
diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qtextedit.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qtextedit.cpp
new file mode 100644
index 0000000000..cd1ae62c84
--- /dev/null
+++ b/src/widgets/doc/snippets/code/src_gui_widgets_qtextedit.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+void MyTextEdit::contextMenuEvent(QContextMenuEvent *event)
+{
+ QMenu *menu = createStandardContextMenu();
+ menu->addAction(tr("My Menu Item"));
+ //...
+ menu->exec(event->globalPos());
+ delete menu;
+}
+//! [0]
+
+
+//! [1]
+edit->textCursor().insertText(text);
+//! [1]
+
+
+//! [2]
+edit->textCursor().insertHtml(fragment);
+//! [2]
diff --git a/src/widgets/doc/snippets/customstyle/customstyle.cpp b/src/widgets/doc/snippets/customstyle/customstyle.cpp
new file mode 100644
index 0000000000..2e0843c49c
--- /dev/null
+++ b/src/widgets/doc/snippets/customstyle/customstyle.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "customstyle.h"
+
+CustomStyle::CustomStyle()
+{
+//! [0]
+ QSpinBox *spinBox = qobject_cast<QSpinBox *>(widget);
+ if (spinBox) {
+//! [0] //! [1]
+ }
+//! [1]
+}
+
+//! [2]
+void CustomStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
+ QPainter *painter, const QWidget *widget) const
+{
+ if (element == PE_IndicatorSpinUp || element == PE_IndicatorSpinDown) {
+ QPolygon points(3);
+ int x = option->rect.x();
+ int y = option->rect.y();
+ int w = option->rect.width() / 2;
+ int h = option->rect.height() / 2;
+ x += (option->rect.width() - w) / 2;
+ y += (option->rect.height() - h) / 2;
+
+ if (element == PE_IndicatorSpinUp) {
+ points[0] = QPoint(x, y + h);
+ points[1] = QPoint(x + w, y + h);
+ points[2] = QPoint(x + w / 2, y);
+ } else { // PE_SpinBoxDown
+ points[0] = QPoint(x, y);
+ points[1] = QPoint(x + w, y);
+ points[2] = QPoint(x + w / 2, y + h);
+ }
+
+ if (option->state & State_Enabled) {
+ painter->setPen(option->palette.mid().color());
+ painter->setBrush(option->palette.buttonText());
+ } else {
+ painter->setPen(option->palette.buttonText().color());
+ painter->setBrush(option->palette.mid());
+ }
+ painter->drawPolygon(points);
+ } else {
+ QWindowsStyle::drawPrimitive(element, option, painter, widget);
+//! [2] //! [3]
+ }
+//! [3] //! [4]
+}
+//! [4]
diff --git a/src/widgets/doc/snippets/customstyle/customstyle.h b/src/widgets/doc/snippets/customstyle/customstyle.h
new file mode 100644
index 0000000000..437994d2e2
--- /dev/null
+++ b/src/widgets/doc/snippets/customstyle/customstyle.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CUSTOMSTYLE_H
+#define CUSTOMSTYLE_H
+
+#include <QWindowsStyle>
+
+//! [0]
+class CustomStyle : public QWindowsStyle
+{
+ Q_OBJECT
+
+public:
+ CustomStyle()
+ ~CustomStyle() {}
+
+ void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
+ QPainter *painter, const QWidget *widget) const;
+};
+//! [0]
+
+#endif
diff --git a/src/widgets/doc/snippets/customstyle/customstyle.pro b/src/widgets/doc/snippets/customstyle/customstyle.pro
new file mode 100644
index 0000000000..af0ee4e141
--- /dev/null
+++ b/src/widgets/doc/snippets/customstyle/customstyle.pro
@@ -0,0 +1,2 @@
+HEADERS += customstyle.h
+SOURCES += customstyle.cpp main.cpp
diff --git a/src/widgets/doc/snippets/customstyle/main.cpp b/src/widgets/doc/snippets/customstyle/main.cpp
new file mode 100644
index 0000000000..b3bea3bd7b
--- /dev/null
+++ b/src/widgets/doc/snippets/customstyle/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [using a custom style]
+#include <QtGui>
+
+#include "customstyle.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication::setStyle(new CustomStyle);
+ QApplication app(argc, argv);
+ QSpinBox spinBox;
+ spinBox.show();
+ return app.exec();
+}
+//! [using a custom style]
diff --git a/src/widgets/doc/snippets/customviewstyle.cpp b/src/widgets/doc/snippets/customviewstyle.cpp
new file mode 100644
index 0000000000..55a766d17d
--- /dev/null
+++ b/src/widgets/doc/snippets/customviewstyle.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "customviewstyle.h"
+
+
+
+void CustomViewStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
+{
+
+//![0]
+ switch (element) {
+ case (PE_PanelItemViewItem): {
+ painter->save();
+
+ QPoint topLeft = option->rect.topLeft();
+ QPoint bottomRight = option->rect.topRight();
+ QLinearGradient backgroundGradient(topLeft, bottomRight);
+ backgroundGradient.setColorAt(0.0, QColor(Qt::yellow).lighter(190));
+ backgroundGradient.setColorAt(1.0, Qt::white);
+ painter->fillRect(option->rect, QBrush(backgroundGradient));
+
+ painter->restore();
+ break;
+ }
+ default:
+ QWindowsStyle::drawPrimitive(element, option, painter, widget);
+ }
+//![0]
+}
diff --git a/src/widgets/doc/snippets/dialogs/dialogs.cpp b/src/widgets/doc/snippets/dialogs/dialogs.cpp
new file mode 100644
index 0000000000..78916f862c
--- /dev/null
+++ b/src/widgets/doc/snippets/dialogs/dialogs.cpp
@@ -0,0 +1,268 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+typedef QDialog WordCountDialog;
+typedef QDialog FindDialog;
+
+#define this 0
+#define setWordCount(x) isVisible()
+
+QString tr(const char *text)
+{
+ return QApplication::translate(text, text);
+}
+
+class EditorWindow : public QMainWindow
+{
+public:
+ void find();
+ void countWords();
+
+private:
+ FindDialog *findDialog;
+};
+
+//! [0]
+void EditorWindow::find()
+{
+ if (!findDialog) {
+ findDialog = new FindDialog(this);
+ connect(findDialog, SIGNAL(findNext()), this, SLOT(findNext()));
+ }
+
+ findDialog->show();
+ findDialog->raise();
+ findDialog->activateWindow();
+}
+//! [0]
+
+//! [1]
+void EditorWindow::countWords()
+{
+ WordCountDialog dialog(this);
+ dialog.setWordCount(document().wordCount());
+ dialog.exec();
+}
+//! [1]
+
+inline bool boo()
+{
+ QMessageBox::information(this, "Application name",
+ "Unable to find the user preferences file.\n"
+ "The factory default will be used instead.");
+
+ QString filename;
+ if (QFile::exists(filename) &&
+ QMessageBox::question(
+ this,
+ tr("Overwrite File? -- Application Name"),
+ tr("A file called %1 already exists."
+ "Do you want to overwrite it?")
+ .arg(filename),
+ tr("&Yes"), tr("&No"),
+ QString(), 0, 1))
+ return false;
+
+ switch(QMessageBox::warning(this, "Application name",
+ "Could not connect to the <mumble> server.\n"
+ "This program can't function correctly "
+ "without the server.\n\n",
+ "Retry",
+ "Quit", 0, 0, 1)) {
+ case 0: // The user clicked the Retry again button or pressed Enter
+ // try again
+ break;
+ case 1: // The user clicked the Quit or pressed Escape
+ // exit
+ break;
+ }
+
+ switch(QMessageBox::information(this, "Application name here",
+ "The document contains unsaved changes\n"
+ "Do you want to save the changes before exiting?",
+ "&Save", "&Discard", "Cancel",
+ 0, // Enter == button 0
+ 2)) { // Escape == button 2
+ case 0: // Save clicked or Alt+S pressed or Enter pressed.
+ // save
+ break;
+ case 1: // Discard clicked or Alt+D pressed
+ // don't save but exit
+ break;
+ case 2: // Cancel clicked or Escape pressed
+ // don't exit
+ break;
+ }
+
+ switch(QMessageBox::warning(this, "Application name here",
+ "Could not save the user preferences,\n"
+ "because the disk is full. You can delete\n"
+ "some files and press Retry, or you can\n"
+ "abort the Save Preferences operation.",
+ QMessageBox::Retry | QMessageBox::Default,
+ QMessageBox::Abort | QMessageBox::Escape)) {
+ case QMessageBox::Retry: // Retry clicked or Enter pressed
+ // try again
+ break;
+ case QMessageBox::Abort: // Abort clicked or Escape pressed
+ // abort
+ break;
+ }
+
+ QString errorDetails;
+ QMessageBox::critical(0, "Application name here",
+ QString("An internal error occurred. Please ") +
+ "call technical support at 1234-56789 and report\n"+
+ "these numbers:\n\n" + errorDetails +
+ "\n\nApplication will now exit.");
+
+ QMessageBox::about(this, "About <Application>",
+ "<Application> is a <one-paragraph blurb>\n\n"
+ "Copyright 1991-2003 Such-and-such. "
+ "<License words here.>\n\n"
+ "For technical support, call 1234-56789 or see\n"
+ "http://www.such-and-such.com/Application/\n");
+
+ {
+ // saving the file
+ QMessageBox mb("Application name here",
+ "Saving the file will overwrite the original file on the disk.\n"
+ "Do you really want to save?",
+ QMessageBox::Information,
+ QMessageBox::Yes | QMessageBox::Default,
+ QMessageBox::No,
+ QMessageBox::Cancel | QMessageBox::Escape);
+ mb.setButtonText(QMessageBox::Yes, "Save");
+ mb.setButtonText(QMessageBox::No, "Discard");
+ switch(mb.exec()) {
+ case QMessageBox::Yes:
+ // save and exit
+ break;
+ case QMessageBox::No:
+ // exit without saving
+ break;
+ case QMessageBox::Cancel:
+ // don't save and don't exit
+ break;
+ }
+ }
+
+ {
+ // hardware failure
+//! [2]
+ QMessageBox mb("Application Name",
+ "Hardware failure.\n\nDisk error detected\nDo you want to stop?",
+ QMessageBox::Question,
+ QMessageBox::Yes | QMessageBox::Default,
+ QMessageBox::No | QMessageBox::Escape,
+ QMessageBox::NoButton);
+ if (mb.exec() == QMessageBox::No) {
+ // try again
+//! [2]
+ }
+ }
+}
+
+inline void moo()
+{
+ int numFiles;
+//! [3]
+ QProgressDialog progress("Copying files...", "Abort Copy", 0, numFiles, this);
+ progress.setWindowModality(Qt::WindowModal);
+
+ for (int i = 0; i < numFiles; i++) {
+ progress.setValue(i);
+
+ if (progress.wasCanceled())
+ break;
+ //... copy one file
+ }
+ progress.setValue(numFiles);
+//! [3]
+}
+
+class Operation : public QObject
+{
+public:
+ Operation(QObject *parent);
+ void perform();
+ void cancel();
+
+private:
+ int steps;
+ QProgressDialog *pd;
+ QTimer *t;
+};
+
+//! [4]
+// Operation constructor
+Operation::Operation(QObject *parent)
+ : QObject(parent), steps(0)
+{
+ pd = new QProgressDialog("Operation in progress.", "Cancel", 0, 100);
+ connect(pd, SIGNAL(canceled()), this, SLOT(cancel()));
+ t = new QTimer(this);
+ connect(t, SIGNAL(timeout()), this, SLOT(perform()));
+ t->start(0);
+}
+//! [4] //! [5]
+
+void Operation::perform()
+{
+ pd->setValue(steps);
+ //... perform one percent of the operation
+ steps++;
+ if (steps > pd->maximum())
+ t->stop();
+}
+//! [5] //! [6]
+
+void Operation::cancel()
+{
+ t->stop();
+ //... cleanup
+}
+//! [6]
+
+int main()
+{
+}
diff --git a/src/widgets/doc/snippets/filedialogurls.cpp b/src/widgets/doc/snippets/filedialogurls.cpp
new file mode 100644
index 0000000000..b1e41cbcad
--- /dev/null
+++ b/src/widgets/doc/snippets/filedialogurls.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+int main(int argv, char **args)
+{
+ QApplication app(argv, args);
+
+//![0]
+ QList<QUrl> urls;
+ urls << QUrl::fromLocalFile("/home/gvatteka/dev/qt-45")
+ << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
+
+ QFileDialog dialog;
+ dialog.setSidebarUrls(urls);
+ dialog.setFileMode(QFileDialog::AnyFile);
+ if(dialog.exec()) {
+ // ...
+ }
+//![0]
+
+ return app.exec();
+}
diff --git a/src/widgets/doc/snippets/graphicssceneadditemsnippet.cpp b/src/widgets/doc/snippets/graphicssceneadditemsnippet.cpp
new file mode 100644
index 0000000000..1130a59217
--- /dev/null
+++ b/src/widgets/doc/snippets/graphicssceneadditemsnippet.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+class CustomScene : public QGraphicsScene
+{
+public:
+ CustomScene()
+ { addItem(new QGraphicsEllipseItem(QRect(10, 10, 30, 30))); }
+
+ void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[],
+ const QStyleOptionGraphicsItem options[],
+ QWidget *widget = 0);
+};
+
+//! [0]
+void CustomScene::drawItems(QPainter *painter, int numItems,
+ QGraphicsItem *items[],
+ const QStyleOptionGraphicsItem options[],
+ QWidget *widget)
+{
+ for (int i = 0; i < numItems; ++i) {
+ // Draw the item
+ painter->save();
+ painter->setMatrix(items[i]->sceneMatrix(), true);
+ items[i]->paint(painter, &options[i], widget);
+ painter->restore();
+ }
+}
+//! [0]
+
+int main(int argv, char **args)
+{
+ QApplication app(argv, args);
+
+ CustomScene scene;
+ QGraphicsView view(&scene);
+
+ view.show();
+
+ return app.exec();
+}
diff --git a/src/widgets/doc/snippets/javastyle.cpp b/src/widgets/doc/snippets/javastyle.cpp
new file mode 100644
index 0000000000..a00df57e82
--- /dev/null
+++ b/src/widgets/doc/snippets/javastyle.cpp
@@ -0,0 +1,2745 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "javastyle.h"
+#include <math.h>
+
+static const int windowsItemFrame = 2;
+static const int windowsSepHeight = 2;
+static const int windowsItemHMargin = 3;
+static const int windowsItemVMargin = 2;
+static const int windowsArrowHMargin = 6;
+static const int windowsTabSpacing = 12;
+static const int windowsCheckMarkHMargin = 2;
+static const int windowsRightBorder = 15;
+static const int windowsCheckMarkWidth = 12;
+
+JavaStyle::JavaStyle()
+{
+ qApp->setPalette(standardPalette());
+}
+
+
+inline QPoint JavaStyle::adjustScrollPoint(const QPoint &point,
+ Qt::Orientation orientation,
+ bool add) const
+{
+ int adder = add ? -1 : 1;
+ QPoint retPoint;
+
+ if (orientation == Qt::Horizontal) {
+ retPoint = QPoint(point.y() * adder, point.x());
+ } else {
+ retPoint = QPoint(point.x(), point.y() * adder);
+ }
+
+ return retPoint;
+}
+
+QPalette JavaStyle::standardPalette() const
+{
+ QPalette palette = QWindowsStyle::standardPalette();
+
+ palette.setBrush(QPalette::Active, QPalette::Button,
+ QColor(184, 207, 229));
+ palette.setBrush(QPalette::Active, QPalette::WindowText,
+ Qt::black);
+ palette.setBrush(QPalette::Active, QPalette::Background,
+ QColor(238, 238, 238));
+ palette.setBrush(QPalette::Active, QPalette::Window,
+ QColor(238 ,238, 238));
+ palette.setBrush(QPalette::Active, QPalette::Base, Qt::white);
+ palette.setBrush(QPalette::Active, QPalette::AlternateBase, QColor(238, 238, 238));
+ palette.setBrush(QPalette::Active, QPalette::Text, Qt::black);
+ palette.setBrush(QPalette::Active, QPalette::BrightText, Qt::white);
+
+ palette.setBrush(QPalette::Active, QPalette::Light, QColor(163, 184, 204)); // focusFrameColor
+ palette.setBrush(QPalette::Active, QPalette::Midlight, QColor(99, 130, 191)); // tabBarBorderColor
+ palette.setBrush(QPalette::Active, QPalette::Dark, QColor(106, 104, 100));
+ palette.setBrush(QPalette::Active, QPalette::Mid, QColor(122, 138, 153)); //defaultFrameColor
+ palette.setBrush(QPalette::Active, QPalette::Shadow, QColor(122, 138, 153)); // defaultFrame
+
+ palette.setBrush(QPalette::Active, QPalette::Highlight, QColor(184, 207, 229));
+ palette.setBrush(QPalette::Active, QPalette::HighlightedText, Qt::black);
+
+ palette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(184, 207, 229));
+ palette.setBrush(QPalette::Inactive, QPalette::HighlightedText, Qt::black);
+
+ palette.setBrush(QPalette::Disabled, QPalette::Button,
+ QColor(238, 238, 238));
+ palette.setBrush(QPalette::Disabled, QPalette::WindowText,
+ QColor(153, 153, 153));
+ palette.setBrush(QPalette::Disabled, QPalette::Background, QColor(238, 238, 238));
+
+ palette.setBrush(QPalette::Inactive, QPalette::Button,
+ QColor(184, 207, 229));
+ palette.setBrush(QPalette::Inactive, QPalette::Background,
+ QColor(238, 238, 238));
+ palette.setBrush(QPalette::Inactive, QPalette::Window,
+ QColor(238 ,238, 238));
+ palette.setBrush(QPalette::Inactive, QPalette::Light, QColor(163, 184, 204)); // focusFrameColor
+ palette.setBrush(QPalette::Inactive, QPalette::Midlight, QColor(99, 130, 191)); // tabBarBorderColor
+ palette.setBrush(QPalette::Inactive, QPalette::Dark,QColor(106, 104, 100));
+ palette.setBrush(QPalette::Inactive, QPalette::Mid, QColor(122, 138, 153)); //defaultFrame
+ palette.setBrush(QPalette::Inactive, QPalette::Shadow, QColor(122, 138, 153)); // defaultFrame
+
+ return palette;
+}
+
+inline void JavaStyle::drawScrollBarArrow(const QRect &rect, QPainter *painter,
+ const QStyleOptionSlider *option,
+ bool add) const
+{
+
+ painter->save();
+
+ Qt::Orientation orient = option->orientation;
+ QPoint offset;
+
+ if (add) {
+ if (orient == Qt::Vertical) {
+ offset = rect.bottomLeft();
+ } else {
+ offset = rect.topRight();
+ }
+ } else {
+ offset = rect.topLeft();
+ }
+
+ QPainterPath arrow;
+ arrow.moveTo(offset + adjustScrollPoint(QPoint(4, 8), orient, add));
+ arrow.lineTo(offset + adjustScrollPoint(QPoint(7, 5), orient, add));
+ arrow.lineTo(offset + adjustScrollPoint(QPoint(8, 5), orient, add));
+ arrow.lineTo(offset + adjustScrollPoint(QPoint(11, 8), orient, add));
+ arrow.lineTo(offset + adjustScrollPoint(QPoint(4, 8), orient, add));
+
+ QColor fillColor;
+ if (option->state & State_Sunken)
+ fillColor = QColor(option->palette.color(QPalette::Button));
+ else
+ fillColor = option->palette.color(QPalette::Background);
+
+ painter->fillRect(rect, fillColor);
+
+ painter->setPen(option->palette.color(QPalette::Base));
+ int adjust = option->state & State_Sunken ? 0 : 1;
+ painter->drawRect(rect.adjusted(adjust, adjust, -1, -1));
+ painter->setPen(option->palette.color(QPalette::Mid));
+ painter->drawRect(rect.adjusted(0, 0, -1, -1));
+
+ painter->setPen(option->palette.color(QPalette::WindowText));
+ painter->setBrush(option->palette.color(QPalette::WindowText));
+ painter->drawPath(arrow);
+
+ painter->restore();
+}
+
+inline QPoint JavaStyle::adjustScrollHandlePoint(Qt::Orientation orig,
+ const QPoint &point) const
+{
+ QPoint retPoint;
+
+ if (orig == Qt::Vertical)
+ retPoint = point;
+ else
+ retPoint = QPoint(point.y(), point.x());
+
+ return retPoint;
+}
+
+void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
+ QPainter *painter, const QWidget *widget) const
+{
+
+ painter->save();
+
+ switch (control) {
+ case CE_ToolBoxTabShape: {
+ const QStyleOptionToolBox *box =
+ qstyleoption_cast<const QStyleOptionToolBox *>(option);
+
+ painter->save();
+
+ if (box->direction == Qt::RightToLeft) {
+ painter->rotate(1);
+ painter->translate(box->rect.width(), -box->rect.height());
+ }
+
+ int textWidth = box->fontMetrics.width(box->text) + 20;
+
+ QPolygon innerLine;
+ innerLine << (box->rect.topLeft() + QPoint(0, 1)) <<
+ (box->rect.topLeft() + QPoint(textWidth, 1)) <<
+ (box->rect.bottomLeft() + QPoint(textWidth + 15, -3)) <<
+ (box->rect.bottomRight() + QPoint(0, -3)) <<
+ box->rect.bottomRight() <<
+ box->rect.bottomLeft() <<
+ box->rect.topLeft();
+
+ painter->setPen(box->palette.color(QPalette::Base));
+ painter->setBrush(QColor(200, 221, 242));
+ painter->drawPolygon(innerLine);
+
+ QPolygon outerLine;
+ outerLine << (box->rect.bottomRight() + QPoint(0, -3)) <<
+ box->rect.bottomRight() <<
+ box->rect.bottomLeft() <<
+ box->rect.topLeft() <<
+ (box->rect.topLeft() + QPoint(textWidth, 0)) <<
+ (box->rect.bottomLeft() + QPoint(textWidth + 15, -4)) <<
+ (box->rect.bottomRight() + QPoint(0, -4));
+
+ painter->setPen(box->palette.color(QPalette::Midlight));
+ painter->setBrush(Qt::NoBrush);
+ painter->drawPolyline(outerLine);
+
+ painter->restore();
+ break;
+ }
+ case CE_DockWidgetTitle: {
+ const QStyleOptionDockWidgetV2 *docker =
+ new QStyleOptionDockWidgetV2(
+ *qstyleoption_cast<const QStyleOptionDockWidget *>(option));
+
+ QRect rect = docker->rect;
+ QRect titleRect = rect;
+ if (docker->verticalTitleBar) {
+ QRect r = rect;
+ QSize s = r.size();
+ s.transpose();
+ r.setSize(s);
+
+ titleRect = QRect(r.left() + rect.bottom()
+ - titleRect.bottom(),
+ r.top() + titleRect.left() - rect.left(),
+ titleRect.height(), titleRect.width());
+
+ painter->translate(r.left(), r.top() + r.width());
+ painter->rotate(-90);
+ painter->translate(-r.left(), -r.top());
+
+ rect = r;
+ }
+
+ QLinearGradient gradient(rect.topLeft(),
+ rect.bottomLeft());
+ gradient.setColorAt(1.0, QColor(191, 212, 231));
+ gradient.setColorAt(0.3, Qt::white);
+ gradient.setColorAt(0.0, QColor(221, 232, 243));
+
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(gradient);
+ painter->drawRect(rect.adjusted(0, 0, -1, -1));
+
+ if (!docker->title.isEmpty()) {
+ QRect textRect = docker->fontMetrics.boundingRect(docker->title);
+ textRect.moveCenter(rect.center());
+
+ QFont font = painter->font();
+ font.setPointSize(font.pointSize() - 1);
+ painter->setFont(font);
+ painter->setPen(docker->palette.text().color());
+ painter->drawText(textRect, docker->title,
+ QTextOption(Qt::AlignHCenter |
+ Qt::AlignVCenter));
+ }
+ break;
+ }
+ case CE_RubberBand: {
+ painter->setPen(option->palette.color(QPalette::Active,
+ QPalette::WindowText));
+ painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
+ break;
+ }
+ case CE_SizeGrip: {
+ break;
+ }
+ case CE_HeaderSection: {
+ const QStyleOptionHeader *header =
+ qstyleoption_cast<const QStyleOptionHeader *>(option);
+
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(option->palette.color(QPalette::Active,
+ QPalette::Background));
+ painter->drawRect(option->rect);
+
+ painter->setPen(header->palette.color(QPalette::Mid));
+ if (header->orientation == Qt::Horizontal) {
+ if (header->position == QStyleOptionHeader::Beginning ||
+ header->position == QStyleOptionHeader::OnlyOneSection) {
+ painter->drawRect(header->rect.adjusted(0, 0, -1, -1));
+ painter->setPen(header->palette.color(QPalette::Base));
+ painter->drawLine(header->rect.bottomLeft() + QPoint(1, -1),
+ header->rect.topLeft() + QPoint(1, 1));
+ painter->drawLine(header->rect.topLeft() + QPoint(1, 1),
+ header->rect.topRight() + QPoint(-1, 1));
+ } else {
+ painter->drawLine(header->rect.bottomRight(),
+ header->rect.topRight());
+ painter->drawLine(header->rect.topLeft(),
+ header->rect.topRight());
+ painter->drawLine(header->rect.bottomLeft(),
+ header->rect.bottomRight());
+ painter->setPen(option->palette.color(QPalette::Base));
+ painter->drawLine(header->rect.bottomLeft() + QPoint(0, -1),
+ header->rect.topLeft() + QPoint(0, 1));
+ painter->drawLine(header->rect.topLeft() + QPoint(1, 1),
+ header->rect.topRight() + QPoint(-1, 1));
+ }
+ } else { // Vertical
+ if (header->position == QStyleOptionHeader::Beginning ||
+ header->position == QStyleOptionHeader::OnlyOneSection) {
+ painter->drawRect(header->rect.adjusted(0, 0, -1, -1));
+ painter->setPen(header->palette.color(QPalette::Base));
+ painter->drawLine(header->rect.bottomLeft() + QPoint(1, -1),
+ header->rect.topLeft() + QPoint(1, 1));
+ painter->drawLine(header->rect.topLeft() + QPoint(1, 1),
+ header->rect.topRight() + QPoint(-1, 1));
+ } else {
+ painter->drawLine(header->rect.bottomLeft(),
+ header->rect.bottomRight());
+ painter->drawLine(header->rect.topLeft(),
+ header->rect.bottomLeft());
+ painter->drawLine(header->rect.topRight(),
+ header->rect.bottomRight());
+ painter->setPen(header->palette.color(QPalette::Base));
+ painter->drawLine(header->rect.topLeft(),
+ header->rect.topRight() + QPoint(-1, 0));
+ painter->drawLine(header->rect.bottomLeft() + QPoint(1, -1),
+ header->rect.topLeft() + QPoint(1, 0));
+ }
+ }
+ break;
+ }
+ case CE_ToolBar: {
+ QRect rect = option->rect;
+
+ QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
+ gradient.setColorAt(1.0, QColor(221, 221, 221));
+ gradient.setColorAt(0.0, QColor(241, 241, 241));
+
+ if (option->state & State_Horizontal) {
+ painter->setPen(QColor(204, 204, 204));
+ painter->setBrush(gradient);
+ } else {
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(option->palette.color(QPalette::Background));
+ }
+ painter->drawRect(rect.adjusted(0, 0, -1, -1));
+ break;
+ }
+ case CE_ProgressBar: {
+ const QStyleOptionProgressBar *bar1 =
+ qstyleoption_cast<const QStyleOptionProgressBar *>(option);
+
+ QStyleOptionProgressBarV2 *bar = new QStyleOptionProgressBarV2(*bar1);
+
+ QRect rect = bar->rect;
+ if (bar->orientation == Qt::Vertical) {
+ rect = QRect(rect.left(), rect.top(), rect.height(), rect.width());
+ QMatrix m;
+ m.translate(rect.height()-1, 0);
+ m.rotate(90.0);
+ painter->setMatrix(m);
+ }
+
+ painter->setPen(bar->palette.color(QPalette::Mid));
+ painter->drawRect(rect.adjusted(0, 0, -1, -1));
+
+ QRect grooveRect = subElementRect(SE_ProgressBarGroove, bar,
+ widget);
+ if (bar->orientation == Qt::Vertical) {
+ grooveRect = QRect(grooveRect.left(), grooveRect.top(),
+ grooveRect.height(), grooveRect.width());
+ }
+
+ QStyleOptionProgressBar grooveBar = *bar;
+ grooveBar.rect = grooveRect;
+
+ drawControl(CE_ProgressBarGroove, &grooveBar, painter, widget);
+
+ QRect progressRect = subElementRect(SE_ProgressBarContents, bar,
+ widget);
+ if (bar->orientation == Qt::Vertical) {
+ progressRect = QRect(progressRect.left(), progressRect.top(),
+ progressRect.height(), progressRect.width());
+ progressRect.adjust(0, 0, 0, -1);
+ }
+ QStyleOptionProgressBar progressOpt = *bar;
+ progressOpt.rect = progressRect;
+ drawControl(CE_ProgressBarContents, &progressOpt, painter, widget);
+
+ QRect labelRect = subElementRect(SE_ProgressBarLabel, bar, widget);
+ if (bar->orientation == Qt::Vertical) {
+ labelRect = QRect(labelRect.left(), labelRect.top(),
+ labelRect.height(), labelRect.width());
+ }
+ QStyleOptionProgressBar subBar = *bar;
+ subBar.rect = labelRect;
+ if (bar->textVisible)
+ drawControl(CE_ProgressBarLabel, &subBar, painter, widget);
+
+ delete bar;
+ break;
+ }
+ case CE_ProgressBarGroove: {
+ painter->setBrush(option->palette.color(QPalette::Background));
+ painter->setPen(Qt::NoPen);
+ painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
+
+ painter->setPen(option->palette.color(QPalette::Button));
+ painter->drawLine(option->rect.topLeft() + QPoint(0, 0),
+ option->rect.topRight() + QPoint(0, 0));
+ break;
+ }
+ case CE_ProgressBarContents: {
+ const QStyleOptionProgressBar *bar =
+ qstyleoption_cast<const QStyleOptionProgressBar *>(option);
+ int progress = int((double(bar->progress) /
+ double(bar->maximum - bar->minimum)) *
+ bar->rect.width());
+
+ painter->setBrush(bar->palette.color(QPalette::Light));
+ painter->setPen(Qt::NoPen);
+ QRect progressRect = QRect(bar->rect.topLeft(), QPoint(progress,
+ bar->rect.bottom()));
+ painter->drawRect(progressRect);
+
+ painter->setPen(bar->palette.color(QPalette::Midlight));
+ painter->setBrush(Qt::NoBrush);
+
+ painter->drawLine(bar->rect.bottomLeft(), bar->rect.topLeft());
+ painter->drawLine(bar->rect.topLeft(), QPoint(progress,
+ bar->rect.top()));
+ break;
+ }
+ case CE_ProgressBarLabel: {
+ painter->save();
+ const QStyleOptionProgressBar *bar =
+ qstyleoption_cast<const QStyleOptionProgressBar *>(option);
+
+ QRect rect = bar->rect;
+ QRect leftRect;
+
+ int progressIndicatorPos = int((double(bar->progress) /
+ double(bar->maximum - bar->minimum)) *
+ bar->rect.width());
+
+ QFont font;
+ font.setBold(true);
+ painter->setFont(font);
+ painter->setPen(bar->palette.color(QPalette::Midlight));
+
+ if (progressIndicatorPos >= 0 &&
+ progressIndicatorPos <= rect.width()) {
+ leftRect = QRect(bar->rect.topLeft(),
+ QPoint(progressIndicatorPos,
+ bar->rect.bottom()));
+ } else if (progressIndicatorPos > rect.width()) {
+ painter->setPen(bar->palette.color(QPalette::Base));
+ } else {
+ painter->setPen(bar->palette.color(QPalette::Midlight));
+ }
+
+ QRect textRect = QFontMetrics(font).boundingRect(bar->text);
+ textRect.moveCenter(option->rect.center());
+ painter->drawText(textRect, bar->text,
+ QTextOption(Qt::AlignCenter));
+ if (!leftRect.isNull()) {
+ painter->setPen(bar->palette.color(QPalette::Base));
+ painter->setClipRect(leftRect, Qt::IntersectClip);
+ painter->drawText(textRect, bar->text,
+ QTextOption(Qt::AlignCenter));
+ }
+
+ painter->restore();
+ break;
+ }
+ case CE_MenuBarEmptyArea: {
+ QRect emptyArea = option->rect.adjusted(0, 0, -1, -1);
+ QLinearGradient gradient(emptyArea.topLeft(), emptyArea.bottomLeft()
+ - QPoint(0, 1));
+ gradient.setColorAt(0.0, option->palette.color(QPalette::Base));
+ gradient.setColorAt(1.0, QColor(223, 223, 223));
+
+ painter->setPen(QColor(238, 238, 238));
+ painter->setBrush(gradient);
+ painter->drawRect(emptyArea.adjusted(0, 0, 0, -1));
+ break;
+ }
+ case CE_MenuBarItem: {
+ if (!(option->state & State_Sunken)) {
+ QLinearGradient gradient(option->rect.topLeft(),
+ option->rect.bottomLeft());
+ gradient.setColorAt(0.0, Qt::white);
+ gradient.setColorAt(1.0, QColor(223, 223, 223));
+
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(gradient);
+ } else {
+ painter->setBrush(option->palette.color(QPalette::Light));
+ }
+
+ painter->drawRect(option->rect);
+ if (option->state & State_Sunken) {
+ painter->setPen(option->palette.color(QPalette::Mid));
+ painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
+ painter->setPen(option->palette.color(QPalette::Base));
+ painter->setBrush(Qt::NoBrush);
+ painter->drawLine(option->rect.bottomRight() + QPoint(0, -1),
+ option->rect.topRight() + QPoint(0, -1));
+ }
+ QCommonStyle::drawControl(control, option, painter, widget);
+ break;
+ }
+ case CE_MenuItem: {
+ const QStyleOptionMenuItem *menuItem =
+ qstyleoption_cast<const QStyleOptionMenuItem *>(option);
+
+ bool selected = menuItem->state & State_Selected;
+ bool checkable = menuItem->checkType !=
+ QStyleOptionMenuItem::NotCheckable;
+ bool checked = menuItem->checked;
+
+ if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
+ QPoint center = menuItem->rect.center();
+
+ painter->setPen(menuItem->palette.color(QPalette::Midlight));
+ painter->drawLine(QPoint(menuItem->rect.left() - 2, center.y()),
+ QPoint(menuItem->rect.right(), center.y()));
+ painter->setPen(menuItem->palette.color(QPalette::Base));
+ painter->drawLine(QPoint(menuItem->rect.left() - 2,
+ center.y() + 1),
+ QPoint(menuItem->rect.right(),
+ center.y() + 1));
+
+ break;
+ }
+
+ if (selected) {
+ painter->setBrush(menuItem->palette.color(QPalette::Light));
+ painter->setPen(Qt::NoPen);
+ painter->drawRect(menuItem->rect);
+ painter->setPen(menuItem->palette.color(QPalette::Midlight));
+ painter->drawLine(menuItem->rect.topLeft(),
+ menuItem->rect.topRight());
+ painter->setPen(menuItem->palette.color(QPalette::Base));
+ painter->drawLine(menuItem->rect.bottomLeft(),
+ menuItem->rect.bottomRight());
+ }
+
+ if (checkable) {
+ QRect checkRect(option->rect.left() + 5,
+ option->rect.center().y() - 5, 10, 10);
+ if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) {
+ QStyleOptionButton button;
+ button.rect = checkRect;
+ button.state = menuItem->state;
+ if (button.state & State_Sunken)
+ button.state ^= State_Sunken;
+ if (checked)
+ button.state |= State_On;
+ button.palette = menuItem->palette;
+ drawPrimitive(PE_IndicatorRadioButton, &button, painter,
+ widget);
+ } else {
+ QBrush buttonBrush = gradientBrush(option->rect);
+ painter->setBrush(buttonBrush);
+ painter->setPen(option->palette.color(QPalette::Mid));
+
+ painter->drawRect(checkRect);
+
+ if (checked) {
+ QImage image(":/images/checkboxchecked.png");
+ painter->drawImage(QPoint(option->rect.left() + 5,
+ option->rect.center().y() - 8), image);
+ }
+ }
+ }
+
+ bool dis = !(menuItem->state & State_Enabled);
+ bool act = menuItem->state & State_Selected;
+ const QStyleOption *opt = option;
+ const QStyleOptionMenuItem *menuitem = menuItem;
+ int checkcol = qMax(menuitem->maxIconWidth, 20);
+ if (menuItem->icon.isNull())
+ checkcol = 0;
+
+ QPainter *p = painter;
+ QRect vCheckRect = visualRect(opt->direction, menuitem->rect,
+ QRect(menuitem->rect.x(),
+ menuitem->rect.y(),
+ checkcol, menuitem->rect.height()));
+ if (!menuItem->icon.isNull()) {
+ QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
+ if (act && !dis)
+ mode = QIcon::Active;
+ QPixmap pixmap;
+ if (checked)
+ pixmap = menuItem->icon.pixmap(
+ pixelMetric(PM_SmallIconSize), mode, QIcon::On);
+ else
+ pixmap = menuItem->icon.pixmap(
+ pixelMetric(PM_SmallIconSize), mode);
+ int pixw = pixmap.width();
+ int pixh = pixmap.height();
+
+ int adjustedIcon = checkable ? 15 : 0;
+ QRect pmr(0, 0, pixw, pixh);
+ pmr.moveCenter(vCheckRect.center());
+ painter->setPen(menuItem->palette.text().color());
+ if (checkable && checked)
+ painter->drawPixmap(QPoint(pmr.left() +
+ adjustedIcon, pmr.top() + 1), pixmap);
+ else
+ painter->drawPixmap(pmr.topLeft() +
+ QPoint(adjustedIcon, 0), pixmap);
+ }
+
+ if (selected) {
+ painter->setPen(menuItem->palette.highlightedText().color());
+ } else {
+ painter->setPen(menuItem->palette.text().color());
+ }
+ int x, y, w, h;
+ menuitem->rect.getRect(&x, &y, &w, &h);
+ int tab = menuitem->tabWidth;
+ QColor discol;
+ if (dis) {
+ discol = menuitem->palette.text().color();
+ p->setPen(discol);
+ }
+ int xm = windowsItemFrame + checkcol + windowsItemHMargin;
+ int xpos = menuitem->rect.x() + xm;
+ QRect textRect;
+ if (!menuItem->icon.isNull())
+ textRect.setRect(xpos, y + windowsItemVMargin, w - xm -
+ windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
+ else
+ textRect.setRect(menuItem->rect.left() + 9,
+ y + windowsItemVMargin,
+ w - xm - windowsRightBorder - tab,
+ h - 2 * windowsItemVMargin);
+
+ if (checkable)
+ textRect.adjust(10, 0, 10, 0);
+
+ QRect vTextRect = visualRect(opt->direction, menuitem->rect,
+ textRect);
+ QString s = menuitem->text;
+ if (!s.isEmpty()) {
+ int t = s.indexOf(QLatin1Char('\t'));
+ int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic |
+ Qt::TextDontClip | Qt::TextSingleLine;
+ if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
+ text_flags |= Qt::TextHideMnemonic;
+ text_flags |= Qt::AlignLeft;
+ if (t >= 0) {
+ QRect vShortcutRect = visualRect(opt->direction,
+ menuitem->rect,
+ QRect(textRect.topRight(),
+ QPoint(menuitem->rect.right(), textRect.bottom())));
+ if (dis && !act) {
+ p->setPen(menuitem->palette.light().color());
+ p->drawText(vShortcutRect.adjusted(1, 1, 1, 1),
+ text_flags,
+ s.mid(t + 1));
+ p->setPen(discol);
+ }
+ p->drawText(vShortcutRect, text_flags, s.mid(t + 1));
+ s = s.left(t);
+ }
+ QFont font = menuitem->font;
+ if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
+ font.setBold(true);
+ p->setFont(font);
+ if (dis && !act) {
+ p->setPen(menuitem->palette.light().color());
+ p->drawText(vTextRect.adjusted(1,1,1,1), text_flags,
+ s.left(t));
+ p->setPen(discol);
+ }
+ p->drawText(vTextRect, text_flags, s.left(t));
+ }
+
+ if (menuItem->menuItemType & QStyleOptionMenuItem::SubMenu) {
+ QPoint center = menuItem->rect.center();
+ QPoint drawStart(menuItem->rect.right() - 6, center.y() + 4);
+
+ QPainterPath arrow;
+ arrow.moveTo(drawStart);
+ arrow.lineTo(drawStart + QPoint(0, -8));
+ arrow.lineTo(drawStart + QPoint(4, -5));
+ arrow.lineTo(drawStart + QPoint(4, -4));
+ arrow.lineTo(drawStart + QPoint(0, 0));
+
+ painter->save();
+ painter->setBrush(menuItem->palette.color(QPalette::Text));
+ painter->setPen(Qt::NoPen);
+ painter->drawPath(arrow);
+ painter->restore();
+ }
+
+ break;
+ }
+ case CE_MenuVMargin: {
+ break;
+ }
+ case CE_MenuHMargin: {
+ break;
+ }
+ case CE_Splitter: {
+ drawSplitter(option, painter, option->state & State_Horizontal);
+ break;
+ }
+ case CE_ScrollBarAddPage: {
+ case CE_ScrollBarSubPage:
+ const QStyleOptionSlider *scrollBar =
+ qstyleoption_cast<const QStyleOptionSlider *>(option);
+ QRect myRect;
+ if (scrollBar->orientation == Qt::Horizontal) {
+ myRect = QRect(option->rect.topLeft(),
+ option->rect.bottomRight()).adjusted(0, 0, 1, -1);
+ } else {
+ myRect = option->rect;
+ }
+
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(option->palette.color(QPalette::Background));
+ painter->drawRect(myRect);
+
+ painter->setBrush(Qt::NoBrush);
+ painter->setPen(scrollBar->palette.color(QPalette::Mid));
+ painter->drawRect(myRect.adjusted(0, 0, -1, 0));
+ painter->setPen(scrollBar->palette.color(QPalette::Button));
+ painter->drawLine(myRect.bottomLeft() + QPoint(1, 0),
+ myRect.topLeft() + QPoint(1, 1));
+ painter->drawLine(myRect.topLeft() + QPoint(1, 1),
+ myRect.topRight() + QPoint(-1, 1));
+ break;
+ }
+ case CE_ScrollBarSubLine: {
+ const QStyleOptionSlider *scrollBar =
+ qstyleoption_cast<const QStyleOptionSlider *>(option);
+ int scrollBarExtent = pixelMetric(PM_ScrollBarExtent);
+ QRect scrollBarSubLine = option->rect;
+
+ QRect button1;
+ QRect button2;
+
+ if (scrollBar->orientation == Qt::Horizontal) {
+ button1.setRect(scrollBarSubLine.left(), scrollBarSubLine.top(),
+ 16, scrollBarExtent);
+ button2.setRect(scrollBarSubLine.right() - 15,
+ scrollBarSubLine.top(), 16, scrollBarExtent);
+ } else {
+ button1.setRect(scrollBarSubLine.left(), scrollBarSubLine.top(),
+ scrollBarExtent, 16);
+ button2.setRect(scrollBarSubLine.left(),
+ scrollBarSubLine.bottom() - 15, scrollBarExtent, 16);
+ }
+
+ painter->fillRect(button2, Qt::blue);
+
+ drawScrollBarArrow(button1, painter, scrollBar);
+ drawScrollBarArrow(button2, painter, scrollBar);
+ break;
+ }
+ case CE_ScrollBarAddLine: {
+ const QStyleOptionSlider *scrollBar =
+ qstyleoption_cast<const QStyleOptionSlider *>(option);
+ QRect button(option->rect.left(), option->rect.top(), 16, 16);
+ drawScrollBarArrow(button, painter, scrollBar, true);
+ break;
+ }
+ case CE_ScrollBarSlider: {
+ const QStyleOptionSlider *scrollBar =
+ qstyleoption_cast<const QStyleOptionSlider *>(option);
+
+ painter->setPen(scrollBar->palette.color(QPalette::Midlight));
+ painter->drawRect(scrollBar->rect.adjusted(-1, 0, -3, -1));
+
+ QPoint g1, g2;
+ if (scrollBar->orientation == Qt::Horizontal) {
+ g1 = option->rect.topLeft();
+ g2 = option->rect.bottomLeft();
+ } else {
+ g1 = option->rect.topLeft();
+ g2 = option->rect.topRight();
+ }
+
+ if (scrollBar->state & State_Enabled) {
+ QLinearGradient gradient(g1, g2);
+ gradient.setColorAt(1.0, QColor(188, 210, 230));
+ gradient.setColorAt(0.3, Qt::white);
+ gradient.setColorAt(0.0, QColor(223, 233, 243));
+ painter->setBrush(gradient);
+ } else {
+ painter->setPen(scrollBar->palette.buttonText().color());
+ painter->setBrush(scrollBar->palette.button());
+ }
+ painter->drawRect(scrollBar->rect.adjusted(0, 0, -1, -1));
+
+ int sliderLength = option->rect.height();
+ int drawPos = scrollBar->orientation == Qt::Vertical ?
+ (sliderLength / 2) + 1 : 1 - ((option->rect.width() / 2));
+
+ QPoint origin;
+ if (scrollBar->orientation == Qt::Vertical)
+ origin = option->rect.bottomLeft();
+ else
+ origin = option->rect.topLeft();
+
+ painter->setPen(scrollBar->palette.color(QPalette::Base));
+ painter->drawLine(origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(4, -drawPos)),
+ origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(13, -drawPos)));
+ painter->drawLine(origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(4, 2 - drawPos)),
+ origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(13, 2 - drawPos)));
+ painter->drawLine(origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(4, 4 - drawPos)),
+ origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(13, 4 - drawPos)));
+
+ painter->setPen(option->palette.color(QPalette::Midlight));
+ painter->drawLine(origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(3, -(drawPos + 1))),
+ origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(12, -(drawPos + 1))));
+ painter->drawLine(origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(3, 1 - drawPos)),
+ origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(12, 1 - drawPos)));
+ painter->drawLine(origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(3, 3 - drawPos)),
+ origin + adjustScrollHandlePoint(
+ scrollBar->orientation,
+ QPoint(12, 3 - drawPos)));
+
+ break;
+ }
+ case CE_TabBarTabLabel: {
+ QStyleOptionTab copy =
+ *qstyleoption_cast<const QStyleOptionTab *>(option);
+ if (copy.state & State_HasFocus)
+ copy.state ^= State_HasFocus;
+ painter->setBrush(Qt::NoBrush);
+ QWindowsStyle::drawControl(CE_TabBarTabLabel, &copy, painter,
+ widget);
+ break;
+ }
+ case CE_TabBarTabShape: {
+ const QStyleOptionTab *tab =
+ qstyleoption_cast<const QStyleOptionTab *>(option);
+ QRect myRect = option->rect;
+ QPoint bottomLeft, bottomRight, topLeft, topRight;
+
+ if ((tab->position == QStyleOptionTab::Beginning) ||
+ (tab->position == QStyleOptionTab::OnlyOneTab)) {
+ if (tab->shape == QTabBar::RoundedSouth ||
+ tab->shape == QTabBar::RoundedNorth) {
+ myRect = myRect.adjusted(2, 0, 0, 0);
+ } else {
+ myRect = myRect.adjusted(0, 2, 0, 0);
+ }
+ }
+
+ switch (tab->shape) {
+ case QTabBar::RoundedNorth:
+ topLeft = myRect.topLeft();
+ topRight = myRect.topRight();
+ bottomLeft = myRect.bottomLeft();
+ bottomRight = myRect.bottomRight();
+ break;
+ case QTabBar::RoundedSouth:
+ topLeft = myRect.bottomLeft();
+ topRight = myRect.bottomRight();
+ bottomLeft = myRect.topLeft();
+ bottomRight = myRect.topRight();
+ break;
+ case QTabBar::RoundedWest:
+ topLeft = myRect.topLeft();
+ topRight = myRect.bottomLeft();
+ bottomLeft = myRect.topRight();
+ bottomRight = myRect.bottomRight();
+ break;
+ case QTabBar::RoundedEast:
+ topLeft = myRect.topRight();
+ topRight = myRect.bottomRight();
+ bottomLeft = myRect.topLeft();
+ bottomRight = myRect.bottomLeft();
+ break;
+ default:
+ ;
+ }
+
+ QPainterPath outerPath;
+ outerPath.moveTo(bottomLeft + adjustTabPoint(QPoint(0, -2),
+ tab->shape));
+ outerPath.lineTo(bottomLeft + adjustTabPoint(QPoint(0, -14),
+ tab->shape));
+ outerPath.lineTo(topLeft + adjustTabPoint(QPoint(6 , 0),
+ tab->shape));
+ outerPath.lineTo(topRight + adjustTabPoint(QPoint(0, 0),
+ tab->shape));
+ outerPath.lineTo(bottomRight + adjustTabPoint(QPoint(0, -2),
+ tab->shape));
+
+ if (tab->state & State_Selected ||
+ tab->position == QStyleOptionTab::OnlyOneTab) {
+ QPainterPath innerPath;
+ innerPath.moveTo(topLeft + adjustTabPoint(QPoint(6, 2),
+ tab->shape));
+ innerPath.lineTo(topRight + adjustTabPoint(QPoint(-1, 2),
+ tab->shape));
+ innerPath.lineTo(bottomRight + adjustTabPoint(QPoint(-1 , -2),
+ tab->shape));
+ innerPath.lineTo(bottomLeft + adjustTabPoint(QPoint(2 , -2),
+ tab->shape));
+ innerPath.lineTo(bottomLeft + adjustTabPoint(QPoint(2 , -14),
+ tab->shape));
+ innerPath.lineTo(topLeft + adjustTabPoint(QPoint(6, 2),
+ tab->shape));
+
+ QPainterPath whitePath;
+ whitePath.moveTo(bottomLeft + adjustTabPoint(QPoint(1, -2),
+ tab->shape));
+ whitePath.lineTo(bottomLeft + adjustTabPoint(QPoint(1, -14),
+ tab->shape));
+ whitePath.lineTo(topLeft + adjustTabPoint(QPoint(6, 1),
+ tab->shape));
+ whitePath.lineTo(topRight + adjustTabPoint(QPoint(-1, 1),
+ tab->shape));
+
+ painter->setPen(tab->palette.color(QPalette::Midlight));
+ painter->setBrush(QColor(200, 221, 242));
+ painter->drawPath(outerPath);
+ painter->setPen(QColor(200, 221, 242));
+ painter->drawRect(QRect(bottomLeft + adjustTabPoint(
+ QPoint(2, -3), tab->shape),
+ bottomRight + adjustTabPoint(
+ QPoint(-2, 0), tab->shape)));
+ painter->setPen(tab->palette.color(QPalette::Base));
+ painter->setBrush(Qt::NoBrush);
+ painter->drawPath(whitePath);
+
+ if (option->state & State_HasFocus) {
+ painter->setPen(option->palette.color(QPalette::Mid));
+ painter->drawPath(innerPath);
+ }
+ } else {
+ painter->setPen(tab->palette.color(QPalette::Mid));
+ painter->drawPath(outerPath);
+ }
+ break;
+ }
+ case CE_PushButtonLabel:
+ painter->save();
+
+ if (const QStyleOptionButton *button =
+ qstyleoption_cast<const QStyleOptionButton *>(option)) {
+ QRect ir = button->rect;
+ uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
+ if (!styleHint(SH_UnderlineShortcut, button, widget))
+ tf |= Qt::TextHideMnemonic;
+
+ if (!button->icon.isNull()) {
+ QPoint point;
+
+ QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal
+ : QIcon::Disabled;
+ if (mode == QIcon::Normal && button->state & State_HasFocus)
+ mode = QIcon::Active;
+ QIcon::State state = QIcon::Off;
+ if (button->state & State_On)
+ state = QIcon::On;
+
+ QPixmap pixmap = button->icon.pixmap(button->iconSize, mode,
+ state);
+ int w = pixmap.width();
+ int h = pixmap.height();
+
+ if (!button->text.isEmpty())
+ w += button->fontMetrics.width(button->text) + 2;
+
+ point = QPoint(ir.x() + ir.width() / 2 - w / 2,
+ ir.y() + ir.height() / 2 - h / 2);
+
+ if (button->direction == Qt::RightToLeft)
+ point.rx() += pixmap.width();
+
+ painter->drawPixmap(visualPos(button->direction, button->rect,
+ point), pixmap);
+
+ if (button->direction == Qt::RightToLeft)
+ ir.translate(-point.x() - 2, 0);
+ else
+ ir.translate(point.x() + pixmap.width(), 0);
+
+ if (!button->text.isEmpty())
+ tf |= Qt::AlignLeft;
+
+ } else {
+ tf |= Qt::AlignHCenter;
+ }
+
+ if (button->fontMetrics.height() > 14)
+ ir.translate(0, 1);
+
+ drawItemText(painter, ir, tf, button->palette, (button->state &
+ State_Enabled),
+ button->text, QPalette::ButtonText);
+ }
+
+ painter->restore();
+ break;
+
+ default:
+ QWindowsStyle::drawControl(control, option, painter, widget);
+ }
+ painter->restore();
+}
+
+inline QPoint JavaStyle::adjustTabPoint(const QPoint &point,
+ QTabBar::Shape shape) const
+{
+ QPoint rPoint;
+
+ switch (shape) {
+ case QTabBar::RoundedWest:
+ rPoint = QPoint(point.y(), point.x());
+ break;
+ case QTabBar::RoundedSouth:
+ rPoint = QPoint(point.x(), point.y() * -1);
+ break;
+ case QTabBar::RoundedEast:
+ rPoint = QPoint(point.y() * -1, point.x());
+ break;
+ default:
+ rPoint = point;
+ }
+ return rPoint;
+}
+
+QRect JavaStyle::subControlRect(ComplexControl control,
+ const QStyleOptionComplex *option,
+ SubControl subControl,
+ const QWidget *widget) const
+{
+ QRect rect = QWindowsStyle::subControlRect(control, option, subControl,
+ widget);
+
+ switch (control) {
+ case CC_TitleBar: {
+ const QStyleOptionTitleBar *bar =
+ qstyleoption_cast<const QStyleOptionTitleBar *>(option);
+
+ switch (subControl) {
+ case SC_TitleBarMinButton: {
+ rect = QRect(bar->rect.topRight() + QPoint(-68, 2),
+ QSize(15, 15));
+ break;
+ }
+ case SC_TitleBarMaxButton: {
+ rect = QRect(bar->rect.topRight() + QPoint(-43, 3),
+ QSize(15, 15));
+ break;
+ }
+ case SC_TitleBarCloseButton: {
+ rect = QRect(bar->rect.topRight() + QPoint(-18, 3),
+ QSize(15, 15));
+ break;
+ }
+ case SC_TitleBarLabel: {
+ QRect labelRect = bar->fontMetrics.boundingRect(bar->text);
+ rect = labelRect;
+ rect.translate(bar->rect.left() + 30, 0);
+ rect.moveTop(bar->rect.top());
+ rect.adjust(0, 2, 2, 2);
+ break;
+ }
+ case SC_TitleBarSysMenu: {
+ rect = QRect(bar->rect.topLeft() + QPoint(6, 3),
+ QSize(16, 16));
+ break;
+ }
+ default:
+ ;
+ }
+ break;
+ }
+ case CC_GroupBox: {
+ const QStyleOptionGroupBox *box =
+ qstyleoption_cast<const QStyleOptionGroupBox *>(option);
+ bool hasCheckbox = box->subControls & SC_GroupBoxCheckBox;
+ int checkAdjust = 13;
+
+ QRect textRect = box->fontMetrics.boundingRect(box->text);
+
+ switch (subControl) {
+ case SC_GroupBoxFrame: {
+ rect = box->rect;
+ break;
+ }
+ case SC_GroupBoxCheckBox: {
+ if (hasCheckbox) {
+ rect = QRect(box->rect.topLeft() + QPoint(7, 4 +
+ (textRect.height() / 2 - checkAdjust / 2)),
+ QSize(checkAdjust, checkAdjust));
+ }
+ else {
+ rect = QRect();
+ }
+ break;
+ }
+ case SC_GroupBoxLabel: {
+ rect = QRect(box->rect.topLeft() + QPoint(7 + (hasCheckbox ?
+ checkAdjust + 2 : 0), 4), textRect.size());
+ break;
+ }
+ case SC_GroupBoxContents: {
+ rect = box->rect.adjusted(10, 10 + textRect.height(), -10,
+ -10);
+ break;
+ }
+ default:
+ ;
+ }
+ break;
+ }
+ case CC_SpinBox: {
+ const QStyleOptionSpinBox *spinBox =
+ qstyleoption_cast<const QStyleOptionSpinBox *>(option);
+ int spinnerWidth = 16;
+ QRect myRect = spinBox->rect;
+ QPoint center = myRect.center();
+ int frameWidth = pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget);
+
+ switch (subControl) {
+ case SC_SpinBoxUp: {
+ rect = QRect(myRect.topRight() + QPoint(-16, 0),
+ QSize(16, center.y() - myRect.topRight().y()));
+ break;
+ }
+ case SC_SpinBoxDown: {
+ rect = QRect(QPoint(myRect.bottomRight().x() - 16,
+ center.y() + 1),
+ QSize(16, myRect.bottomRight().y() -
+ center.y() - 1));
+ break;
+ }
+ case SC_SpinBoxFrame: {
+ rect = QRect(myRect.topLeft(), myRect.bottomRight() +
+ QPoint(-16, 0));
+ break;
+ }
+ case SC_SpinBoxEditField: {
+ rect = QRect(myRect.topLeft() + QPoint(2, 2),
+ myRect.bottomRight() + QPoint(-15 - frameWidth, -2));
+ break;
+ }
+ default:
+ ;
+ }
+ break;
+ }
+ case CC_ToolButton: {
+ const QStyleOptionToolButton *button =
+ qstyleoption_cast<const QStyleOptionToolButton *>(option);
+
+ switch (subControl) {
+ case SC_ToolButton: {
+ rect = option->rect.adjusted(1, 1, -1, -1);
+ break;
+ }
+ case SC_ToolButtonMenu: {
+ rect = QRect(option->rect.bottomRight() +
+ QPoint(-11, -11), QSize(10, 10));
+ break;
+ }
+ }
+ break;
+ }
+ case CC_ComboBox: {
+ const QStyleOptionComboBox *combo =
+ qstyleoption_cast<const QStyleOptionComboBox *>(option);
+
+ bool reverse = combo->direction == Qt::RightToLeft;
+
+ switch (subControl) {
+ case SC_ComboBoxFrame:
+ rect = combo->rect;
+ break;
+ case SC_ComboBoxArrow:
+ if (reverse) {
+ rect = QRect(combo->rect.topLeft(),
+ combo->rect.bottomLeft() + QPoint(17, 0));
+ } else {
+ rect = QRect(combo->rect.topRight() + QPoint(-17, 0),
+ combo->rect.bottomRight());
+ }
+ break;
+ case SC_ComboBoxEditField:
+ if (reverse) {
+ rect = QRect(combo->rect.topLeft() + QPoint(19, 2),
+ combo->rect.bottomRight() + QPoint(-2, 2));
+ } else {
+ rect = QRect(combo->rect.topLeft() + QPoint(2, 2),
+ combo->rect.bottomRight() + QPoint(-19, -2));
+ }
+ break;
+ case SC_ComboBoxListBoxPopup:
+ rect = combo->rect;
+ break;
+ }
+ break;
+ }
+ case CC_ScrollBar: {
+ const QStyleOptionSlider *scrollBar =
+ qstyleoption_cast<const QStyleOptionSlider *>(option);
+ int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, scrollBar,
+ widget);
+ int sliderMaxLength = ((scrollBar->orientation == Qt::Horizontal) ?
+ scrollBar->rect.width() :
+ scrollBar->rect.height()) - (16 * 3);
+ int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar,
+ widget);
+ int sliderLength;
+
+ if (scrollBar->maximum != scrollBar->minimum) {
+ uint valueRange = scrollBar->maximum - scrollBar->minimum;
+ sliderLength = (scrollBar->pageStep * sliderMaxLength) /
+ (valueRange + scrollBar->pageStep);
+
+ if (sliderLength < sliderMinLength || valueRange > INT_MAX / 2)
+ sliderLength = sliderMinLength;
+ if (sliderLength > sliderMaxLength)
+ sliderLength = sliderMaxLength;
+ } else {
+ sliderLength = sliderMaxLength;
+ }
+ int sliderStart = 16 + sliderPositionFromValue(scrollBar->minimum,
+ scrollBar->maximum,
+ scrollBar->sliderPosition,
+ sliderMaxLength - sliderLength,
+ scrollBar->upsideDown);
+ QRect scrollBarRect = scrollBar->rect;
+
+ switch (subControl) {
+ case SC_ScrollBarSubLine:
+ if (scrollBar->orientation == Qt::Horizontal) {
+ rect.setRect(scrollBarRect.left(), scrollBarRect.top(),
+ scrollBarRect.width() - 16, scrollBarExtent);
+ } else {
+ rect.setRect(scrollBarRect.left(), scrollBarRect.top(),
+ scrollBarExtent, scrollBarRect.height() - 16);
+ }
+ break;
+ case SC_ScrollBarAddLine:
+ if (scrollBar->orientation == Qt::Horizontal) {
+ rect.setRect(scrollBarRect.right() - 15,
+ scrollBarRect.top(), 16, scrollBarExtent);
+ } else {
+ rect.setRect(scrollBarRect.left(), scrollBarRect.bottom()
+ - 15, scrollBarExtent, 16);
+ }
+ break;
+ case SC_ScrollBarSubPage:
+ if (scrollBar->orientation == Qt::Horizontal) {
+ rect.setRect(scrollBarRect.left() + 16, scrollBarRect.top(),
+ sliderStart - (scrollBarRect.left() + 16),
+ scrollBarExtent);
+ } else {
+ rect.setRect(scrollBarRect.left(), scrollBarRect.top() + 16,
+ scrollBarExtent,
+ sliderStart - (scrollBarRect.left() + 16));
+ }
+ break;
+ case SC_ScrollBarAddPage:
+ if (scrollBar->orientation == Qt::Horizontal)
+ rect.setRect(sliderStart + sliderLength, 0,
+ sliderMaxLength - sliderStart -
+ sliderLength + 16, scrollBarExtent);
+ else
+ rect.setRect(0, sliderStart + sliderLength,
+ scrollBarExtent, sliderMaxLength -
+ sliderStart - sliderLength + 16);
+ break;
+ case SC_ScrollBarGroove:
+ if (scrollBar->orientation == Qt::Horizontal) {
+ rect = scrollBarRect.adjusted(16, 0, -32, 0);
+ } else {
+ rect = scrollBarRect.adjusted(0, 16, 0, -32);
+ }
+ break;
+ case SC_ScrollBarSlider:
+ if (scrollBar->orientation == Qt::Horizontal) {
+ rect.setRect(sliderStart, 0, sliderLength,
+ scrollBarExtent);
+ } else {
+ rect.setRect(0, sliderStart, scrollBarExtent,
+ sliderLength);
+ }
+ break;
+ default:
+ return QWindowsStyle::subControlRect(control, option,
+ subControl, widget);
+ }
+ break;
+ }
+ case CC_Slider: {
+ const QStyleOptionSlider *slider =
+ qstyleoption_cast<const QStyleOptionSlider *>(option);
+ rect = slider->rect;
+ int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
+ int handleSize = pixelMetric(PM_SliderControlThickness, option,
+ widget);
+
+ int dist = slider->orientation == Qt::Vertical ? slider->rect.height() :
+ slider->rect.width();
+ int pos = QStyle::sliderPositionFromValue(slider->minimum,
+ slider->maximum, slider->sliderValue, dist - handleSize);
+
+ switch (subControl) {
+ case SC_SliderGroove: {
+ QPoint center = rect.center();
+
+ if (slider->orientation == Qt::Horizontal) {
+ rect.setHeight(handleSize);
+ if (slider->tickPosition == QSlider::TicksBelow) {
+ center.ry() -= tickSize;
+ }
+ } else {
+ rect.adjust(0, 0, 0, 0);
+ rect.setWidth(handleSize);
+ if (slider->tickPosition == QSlider::TicksBelow) {
+ center.rx() -= tickSize;
+ }
+ }
+ rect.moveCenter(center);
+ break;
+ }
+ case SC_SliderHandle: {
+ QPoint center = rect.center();
+
+ if (slider->orientation == Qt::Horizontal) {
+ rect.setHeight(handleSize);
+ if (slider->tickPosition == QSlider::TicksBelow) {
+ center.ry() -= tickSize;
+ }
+
+ rect.moveCenter(center);
+
+ if (slider->upsideDown)
+ rect.setLeft(slider->rect.right() -
+ pos - (handleSize - 1));
+ else
+ rect.setLeft(pos);
+
+ rect.setWidth(handleSize - 1);
+ } else {
+ rect.setWidth(handleSize);
+ if (slider->tickPosition == QSlider::TicksBelow) {
+ center.rx() -= tickSize;
+ }
+
+ rect.moveCenter(center);
+
+ if (slider->upsideDown)
+ rect.setTop(slider->rect.bottom() -
+ ((pos + handleSize) - 2));
+ else
+ rect.setTop(slider->rect.top() + pos);
+
+ rect.setHeight(handleSize);
+ }
+ break;
+ }
+ case SC_SliderTickmarks: {
+ QPoint center = slider->rect.center();
+
+ if (slider->tickPosition & QSlider::TicksBelow) {
+ if (slider->orientation == Qt::Horizontal) {
+ rect.setHeight(tickSize);
+ center.ry() += tickSize / 2;
+ rect.adjust(6, 0, -10, 0);
+ } else {
+ rect.setWidth(tickSize);
+ center.rx() += tickSize / 2;
+ rect.adjust(0, 6, 0, -10);
+ }
+ } else {
+ rect = QRect();
+ }
+ rect.moveCenter(center);
+ break;
+ }
+ default:
+ ;
+ }
+ break;
+ }
+ default:
+ return QWindowsStyle::subControlRect(control, option, subControl,
+ widget);
+ }
+ return rect;
+}
+
+static const char * const sliderHandleImage[] = {
+ "15 16 7 1",
+ " c None",
+ "+ c #FFFFFF",
+ "@ c #FFFFFF",
+ "$ c #FFFFFF",
+ "( c #E5EDF5",
+ ") c #F2F6FA",
+ "[ c #FFFFFF",
+ " +++++++++++++ ",
+ "+@@@@@@@@@@@@@+",
+ "+@(((((((((((@+",
+ "+@(((((((((((@+",
+ "+@)))))))))))@+",
+ "+@[[[[[[[[[[[@+",
+ "+@[[[[[[[[[[[@+",
+ "+@)))))))))))@+",
+ "+@)))))))))))@+",
+ " +@)))))))))@+ ",
+ " +@(((((((@+ ",
+ " +@(((((@+ ",
+ " +@(((@+ ",
+ " +@(@+ ",
+ " +@+ ",
+ " + "};
+
+
+void JavaStyle::drawComplexControl(ComplexControl control,
+ const QStyleOptionComplex *option,
+ QPainter *painter,
+ const QWidget *widget) const
+{
+ painter->save();
+
+ switch (control) {
+ case CC_TitleBar: {
+ const QStyleOptionTitleBar *bar =
+ qstyleoption_cast<const QStyleOptionTitleBar *>(option);
+
+ bool sunken = bar->state & State_Sunken;
+
+ QLinearGradient gradient(bar->rect.bottomLeft(),
+ bar->rect.topLeft());
+ gradient.setColorAt(0.0, QColor(191, 212, 231));
+ gradient.setColorAt(0.7, Qt::white);
+ gradient.setColorAt(1.0, QColor(221, 232, 243));
+
+ painter->setPen(Qt::NoPen);
+ if (bar->titleBarState & State_Active) {
+ painter->setBrush(gradient);
+ }
+ else
+ painter->setBrush(bar->palette.color(QPalette::Active,
+ QPalette::Background));
+
+ painter->drawRect(bar->rect.adjusted(0, 0, -1, -1));
+
+ painter->setBrush(QColor(233, 233, 233));
+ painter->drawRect(QRect(bar->rect.bottomLeft() + QPoint(0, 1),
+ bar->rect.bottomRight() + QPoint(0, 2)));
+
+ QRect minButtonRect = subControlRect(control, bar,
+ SC_TitleBarMinButton);
+ QRect maxButtonRect = subControlRect(control, bar,
+ SC_TitleBarMaxButton);
+ QRect closeButtonRect = subControlRect(control, bar,
+ SC_TitleBarCloseButton);
+ QRect systemButtonRect = subControlRect(control, bar,
+ SC_TitleBarSysMenu);
+ QRect labelRect = subControlRect(control, bar, SC_TitleBarLabel);
+ QRect gripRect = QRect(QPoint(labelRect.right() + 5, bar->rect.top() + 5),
+ QPoint(minButtonRect.left() - 5,
+ bar->rect.bottom() - 4));
+
+ QColor textColor = option->palette.color(QPalette::Text);
+ painter->setPen(textColor);
+ painter->setBrush(Qt::NoBrush);
+
+ drawItemText(painter, labelRect, Qt::TextShowMnemonic |
+ Qt::AlignHCenter | Qt::AlignCenter,
+ bar->palette, bar->state & State_Enabled, bar->text,
+ textColor.isValid() ? QPalette::NoRole :
+ QPalette::WindowText);
+
+ for (int i = 0; i < gripRect.width(); ++i) {
+ painter->setPen(i % 2 ? bar->palette.color(QPalette::Midlight)
+ : Qt::white);
+
+ for (int j = 0; j < 4; ++j) {
+ painter->drawPoint(i + gripRect.left(),
+ gripRect.top() - 2 + i % 4 + 4 * j);
+ }
+ }
+
+ QPixmap maximizePixmap(":/images/internalmaximize.png");
+ QPixmap minimizePixmap(":/images/internalminimize.png");
+ QPixmap closePixmap(":/images/internalclose.png");
+ QPixmap internalPixmap(":/images/internalsystem.png");
+ QPixmap internalCloseDownPixmap(":/images/internalclosedown.png");
+ QPixmap minimizeDownPixmap(":/images/internalminimizedown.png");
+ QPixmap maximizeDownPixmap(":/images/internalmaximizedown.png");
+
+ if (bar->activeSubControls & SC_TitleBarCloseButton &&
+ bar->state & State_Sunken)
+ painter->drawPixmap(closeButtonRect.topLeft(),
+ internalCloseDownPixmap);
+ else
+ painter->drawPixmap(closeButtonRect.topLeft(), closePixmap);
+
+ if (bar->activeSubControls & SC_TitleBarMinButton &&
+ bar->state & State_Sunken)
+ painter->drawPixmap(minButtonRect.topLeft(),
+ minimizeDownPixmap);
+ else
+ painter->drawPixmap(minButtonRect.topLeft(), minimizePixmap);
+
+ if (bar->activeSubControls & SC_TitleBarMaxButton &&
+ bar->state & State_Sunken)
+ painter->drawPixmap(maxButtonRect.topLeft(),
+ maximizeDownPixmap);
+ else
+ painter->drawPixmap(maxButtonRect.topLeft(), maximizePixmap);
+
+ painter->drawPixmap(systemButtonRect.topLeft(), internalPixmap);
+
+ break;
+ }
+ case CC_GroupBox: {
+ const QStyleOptionGroupBox *box =
+ qstyleoption_cast<const QStyleOptionGroupBox *>(option);
+
+ QRect frameRect = subControlRect(control, box, SC_GroupBoxFrame);
+ QRect labelRect = subControlRect(control, box, SC_GroupBoxLabel);
+ QRect contentsRect = subControlRect(control, box,
+ SC_GroupBoxContents);
+ QRect checkerRect = subControlRect(control, box,
+ SC_GroupBoxCheckBox);
+
+ int y = labelRect.center().y();
+
+ painter->setPen(box->palette.color(QPalette::Button));
+ painter->drawRect(frameRect.adjusted(2, y - frameRect.top(), -2,
+ -2));
+
+ painter->setPen(box->palette.color(QPalette::Background));
+
+ if (box->subControls & SC_GroupBoxCheckBox) {
+ painter->drawLine(checkerRect.left() - 1, y,
+ checkerRect.right() + 2, y);
+ QStyleOptionButton checker;
+ checker.QStyleOption::operator=(*box);
+ checker.rect = checkerRect;
+ drawPrimitive(PE_IndicatorCheckBox, &checker, painter, widget);
+ }
+
+ if (box->subControls & SC_GroupBoxLabel && !box->text.isEmpty()) {
+ painter->drawLine(labelRect.left() - 1, y,
+ labelRect.right() +1, y);
+
+ QColor textColor = box->textColor;
+ if (textColor.isValid())
+ painter->setPen(textColor);
+
+ drawItemText(painter, labelRect, Qt::TextShowMnemonic |
+ Qt::AlignHCenter | int(box->textAlignment),
+ box->palette, box->state & State_Enabled,
+ box->text, textColor.isValid() ? QPalette::NoRole :
+ QPalette::WindowText);
+ }
+ break;
+ }
+ case CC_SpinBox: {
+ const QStyleOptionSpinBox *spinner =
+ qstyleoption_cast<const QStyleOptionSpinBox *>(option);
+
+ QRect frameRect = subControlRect(control, spinner, SC_SpinBoxFrame);
+ QRect upRect = subControlRect(control, spinner, SC_SpinBoxUp);
+ QRect downRect = subControlRect(control, spinner, SC_SpinBoxDown);
+
+ painter->setPen(Qt::white);
+ painter->drawRect(frameRect.adjusted(1, 1, -1, -1));
+ painter->drawPoint(frameRect.bottomLeft());
+
+ painter->setPen(spinner->palette.color(QPalette::Mid));
+ painter->drawRect(frameRect.adjusted(0, 0, -1, -2));
+
+ bool isEnabled = (spinner->state & State_Enabled);
+ bool hover = isEnabled && (spinner->state & State_MouseOver);
+ bool sunken = (spinner->state & State_Sunken);
+ bool upIsActive = (spinner->activeSubControls == SC_SpinBoxUp);
+ bool downIsActive = (spinner->activeSubControls == SC_SpinBoxDown);
+ bool stepUpEnabled = spinner->stepEnabled &
+ QAbstractSpinBox::StepUpEnabled;
+ bool stepDownEnabled = spinner->stepEnabled &
+ QAbstractSpinBox::StepDownEnabled;
+
+ painter->setBrush(spinner->palette.color(QPalette::Background));
+
+ painter->drawRect(upRect);
+ if (upIsActive && stepUpEnabled) {
+ if (sunken) {
+ drawSunkenButtonShadow(painter, upRect,
+ spinner->palette.color(QPalette::Mid));
+ } else if (hover) {
+ drawButtonHoverFrame(painter, upRect,
+ spinner->palette.color(QPalette::Mid),
+ spinner->palette.color(QPalette::Button));
+ }
+ }
+
+ QStyleOptionSpinBox upSpin = *spinner;
+ upSpin.rect = upRect;
+ drawPrimitive(PE_IndicatorSpinUp, &upSpin, painter, widget);
+
+ painter->drawRect(downRect);
+ if (downIsActive && stepDownEnabled) {
+ if (sunken) {
+ drawSunkenButtonShadow(painter, downRect,
+ spinner->palette.color(QPalette::Mid));
+ } else if (hover) {
+ drawButtonHoverFrame(painter, downRect,
+ spinner->palette.color(QPalette::Mid),
+ spinner->palette.color(QPalette::Button));
+ }
+ }
+
+ QStyleOptionSpinBox downSpin = *spinner;
+ downSpin.rect = downRect;
+ drawPrimitive(PE_IndicatorSpinDown, &downSpin, painter, widget);
+
+ break;
+ }
+ case CC_ToolButton: {
+ const QStyleOptionToolButton *button =
+ qstyleoption_cast<const QStyleOptionToolButton *>(option);
+
+ painter->setPen(Qt::white);
+ painter->drawRect(button->rect.adjusted(1, 1, -1, -1));
+
+ QStyleOptionToolButton panelOption = *button;
+ QRect panelRect;
+ if (!(button->state & State_MouseOver) &&
+ !(button->state & State_On)) {
+ painter->setPen(QColor(153, 153, 153));
+ painter->drawRect(button->rect.adjusted(0, 0, -2, -2));
+
+ panelRect = subControlRect(control, option, SC_ToolButton);
+ panelOption.rect = panelRect;
+ } else {
+ panelOption.rect.adjust(0, 0, -1, -1);
+ }
+
+ QRect menuRect = subControlRect(control, option, SC_ToolButtonMenu);
+
+ drawPrimitive(PE_PanelButtonTool, &panelOption, painter, widget);
+
+ QStyleOptionToolButton menuOption = *button;
+ menuOption.rect = menuRect;
+
+ QStyleOptionToolButton label = *button;
+ int fw = 5;
+
+ drawControl(CE_ToolButtonLabel, &label, painter, widget);
+ if (button->subControls & SC_ToolButtonMenu) {
+ painter->setPen(button->palette.color(QPalette::WindowText));
+ drawPrimitive(PE_IndicatorArrowDown, &menuOption, painter, widget);
+ }
+
+ if (button->state & State_HasFocus) {
+ QStyleOptionToolButton focusOption = *button;
+ focusOption.rect = label.rect.adjusted(-1, -1, 1, 1);
+
+ drawPrimitive(PE_FrameFocusRect, &focusOption, painter, widget);
+ }
+
+ break;
+ }
+ case CC_ComboBox: {
+ const QStyleOptionComboBox *combo =
+ qstyleoption_cast<const QStyleOptionComboBox *>(option);
+
+ QRect frameRect = subControlRect(control, option, SC_ComboBoxFrame,
+ widget);
+ painter->setPen(combo->palette.color(QPalette::Mid));
+
+ if (option->state & State_HasFocus)
+ painter->setBrush(option->palette.color(QPalette::Light));
+ else
+ painter->setBrush(combo->palette.color(QPalette::Background));
+
+ painter->drawRect(frameRect.adjusted(0, 0, -1, -1));
+
+ QRect arrowRect = subControlRect(control, option, SC_ComboBoxArrow,
+ widget);
+ painter->setPen(combo->palette.color(QPalette::Button));
+ painter->setBrush(Qt::NoBrush);
+
+ if (combo->direction == Qt::LeftToRight) {
+ painter->drawRect(QRect(frameRect.topLeft() + QPoint(1, 1),
+ arrowRect.bottomLeft() + QPoint(-2, -2)));
+ } else {
+ painter->drawRect(QRect(arrowRect.topLeft() + QPoint(1, 1),
+ frameRect.bottomRight() + QPoint(-2, -2)));
+ }
+
+ QStyleOptionButton button;
+ button.rect = arrowRect;
+ button.state = combo->state;
+ button.palette = combo->palette;
+
+ if (button.state & State_On)
+ button.state ^= State_On;
+
+ painter->save();
+ drawButtonBackground(&button, painter, false);
+ painter->restore();
+
+ QPoint center = arrowRect.center();
+ QPoint offset = QPoint(arrowRect.bottomLeft().x() + 1,
+ center.y() + 7);
+ QPainterPath arrow;
+ arrow.moveTo(offset + QPoint(4, -8));
+ arrow.lineTo(offset + QPoint(7, -5));
+ arrow.lineTo(offset + QPoint(8, -5));
+ arrow.lineTo(offset + QPoint(11, -8));
+ arrow.lineTo(offset + QPoint(4, -8));
+
+ painter->setBrush(combo->palette.color(QPalette::WindowText));
+ painter->setPen(combo->palette.color(QPalette::WindowText));
+
+ painter->drawPath(arrow);
+
+ QRect fieldRect = subControlRect(control, option,
+ SC_ComboBoxEditField, widget);
+
+ break;
+ }
+ case CC_Slider: {
+ const QStyleOptionSlider *slider =
+ qstyleoption_cast<const QStyleOptionSlider *>(option);
+
+ bool horizontal = slider->orientation == Qt::Horizontal;
+
+ QRect groove = subControlRect(control, option, SC_SliderGroove,
+ widget);
+ QRect ticks = subControlRect(control, option, SC_SliderTickmarks,
+ widget);
+ QRect handle = subControlRect(control, option, SC_SliderHandle,
+ widget);
+
+ QRect afterHandle = QRect(handle.topLeft() + xySwitch(QPoint(4, 6), horizontal),
+ groove.bottomRight() + xySwitch(QPoint(-4, -6), horizontal));
+ QRect beforeHandle = QRect(groove.topLeft() + xySwitch(QPoint(4, 6), horizontal),
+ handle.bottomRight() + xySwitch(QPoint(-4, -6), horizontal));
+
+ if (slider->upsideDown || !horizontal) {
+ QRect remember;
+ remember = afterHandle;
+ afterHandle = beforeHandle;
+ beforeHandle = remember;
+ }
+
+ painter->setPen(slider->palette.color(QPalette::Mid));
+ painter->setBrush(option->palette.color(QPalette::Background));
+ painter->drawRect(afterHandle);
+ painter->setPen(slider->palette.color(QPalette::Light));
+ painter->drawLine(afterHandle.topLeft() + xySwitch(QPoint(0, 1), horizontal),
+ afterHandle.topRight() + xySwitch(QPoint(0, 1), horizontal));
+ painter->setPen(option->palette.color(QPalette::Midlight));
+
+ if (horizontal) {
+ painter->setBrush(gradientBrush(QRect(QPoint(groove.x(),
+ handle.y() + 1),
+ QSize(groove.width(),
+ handle.height() + 1))));
+ } else {
+ QRect rect = QRect(QPoint(groove.x(),
+ handle.x() - 1),
+ QSize(groove.height(),
+ handle.width() + 1));
+ QLinearGradient gradient(groove.bottomLeft(),
+ groove.bottomRight());
+ gradient.setColorAt(1.0, QColor(188, 210, 230));
+ gradient.setColorAt(0.3, Qt::white);
+ gradient.setColorAt(0.0, QColor(223, 233, 243));
+
+ painter->setBrush(gradient);
+ }
+
+ painter->drawRect(beforeHandle);
+
+ QPainterPath handlePath;
+ QPainterPath innerPath;
+ QPoint topLeft, topRight, bottomLeft;
+ if (horizontal) {
+ topLeft = handle.topLeft();
+ topRight = handle.topRight();
+ bottomLeft = handle.bottomLeft();
+ } else {
+ topLeft = handle.bottomLeft();
+ topRight = handle.topLeft();
+ bottomLeft = handle.topRight();
+ }
+
+ if (horizontal) {
+ QImage image(sliderHandleImage);
+
+ image.setColor(1,
+ option->palette.color(QPalette::Midlight).rgb());
+ image.setColor(2,
+ option->palette.color(QPalette::Button).rgb());
+
+ if (!(slider->state & State_Enabled)) {
+ image.setColor(4, slider->palette.color(QPalette::Background).rgb());
+ image.setColor(5, slider->palette.color(QPalette::Background).rgb());
+ image.setColor(6, slider->palette.color(QPalette::Background).rgb());
+ }
+
+ painter->drawImage(handle.topLeft(), image);
+ } else {
+ QImage image(":/images/verticalsliderhandle.png");
+ painter->drawImage(handle.topLeft(), image);
+ }
+
+ if (slider->tickPosition & QSlider::TicksBelow) {
+ painter->setPen(slider->palette.color(QPalette::Light));
+ int tickInterval = slider->tickInterval ? slider->tickInterval :
+ slider->pageStep;
+
+ for (int i = 0; i <= slider->maximum; i += tickInterval) {
+ if (horizontal) {
+ int pos = int(((i / double(slider->maximum)) *
+ ticks.width()) - 1);
+ painter->drawLine(QPoint(ticks.left() + pos,
+ ticks.top() + 2), QPoint(ticks.left() + pos, ticks.top() + 8));
+ } else {
+ int pos = int(((i / double(slider->maximum)) *
+ ticks.height()) - 1);
+ painter->drawLine(QPoint(ticks.left() + 2, ticks.bottom() - pos),
+ QPoint(ticks.right() - 2, ticks.bottom() - pos));
+ }
+ }
+ if (horizontal) {
+ painter->drawLine(QPoint(ticks.right(), ticks.top() + 2),
+ QPoint(ticks.right(), ticks.top() + 8));
+ } else {
+ painter->drawLine(QPoint(ticks.left() + 2, ticks.top()),
+ QPoint(ticks.right() - 2, ticks.top()));
+ }
+ }
+ break;
+ }
+ default:
+ QWindowsStyle::drawComplexControl(control, option, painter, widget);
+ }
+ painter->restore();
+}
+
+inline void JavaStyle::drawSunkenButtonShadow(QPainter *painter,
+ QRect rect,
+ const QColor &frameColor,
+ bool reverse) const
+{
+ painter->save();
+
+ painter->setPen(frameColor);
+
+ if (!reverse) {
+ painter->drawLine(QLine(QPoint(rect.x() + 1, rect.y() + 1),
+ QPoint(rect.x() + rect.width() - 1, rect.y() + 1)));
+ painter->drawLine(QLine(QPoint(rect.x() + 1, rect.y()),
+ QPoint(rect.x() + 1, rect.y() + rect.height())));
+ } else {
+ painter->drawLine(QLine(QPoint(rect.right(), rect.bottom()),
+ QPoint(rect.right(), rect.top())));
+ painter->drawLine(QLine(QPoint(rect.left(), rect.top() + 1),
+ QPoint(rect.right(), rect.top() + 1)));
+ }
+ painter->restore();
+}
+
+inline void JavaStyle::drawButtonHoverFrame(QPainter *painter, QRect rect,
+ const QColor &frameColor,
+ const QColor &activeFrame) const
+{
+ painter->save();
+
+ painter->setPen(activeFrame);
+ painter->drawRect(rect);
+ rect.adjust(1, 1, -1, -1);
+ painter->setPen(frameColor);
+ painter->drawRect(rect);
+ rect.adjust(1, 1, -1, -1);
+ painter->setPen(activeFrame);
+ painter->drawRect(rect);
+
+ painter->restore();
+}
+
+QStyle::SubControl JavaStyle::hitTestComplexControl(ComplexControl control,
+ const QStyleOptionComplex *option,
+ const QPoint &pos,
+ const QWidget *widget) const
+{
+ SubControl ret = SC_None;
+
+ switch (control) {
+ case CC_TitleBar: {
+ const QStyleOptionTitleBar *bar =
+ qstyleoption_cast<const QStyleOptionTitleBar *>(option);
+
+ QRect maximize = subControlRect(control, bar, SC_TitleBarMaxButton);
+ if (maximize.contains(pos)) {
+ ret = SC_TitleBarMaxButton;
+ break;
+ }
+ QRect minimize = subControlRect(control, bar, SC_TitleBarMinButton);
+ if (minimize.contains(pos)) {
+ ret = SC_TitleBarMinButton;
+ break;
+ }
+ QRect close = subControlRect(control, bar, SC_TitleBarCloseButton);
+ if (close.contains(pos)) {
+ ret = SC_TitleBarCloseButton;
+ break;
+ }
+ QRect system = subControlRect(control, bar, SC_TitleBarSysMenu);
+ if (system.contains(pos)) {
+ ret = SC_TitleBarSysMenu;
+ break;
+ }
+ ret = SC_TitleBarLabel;
+ break;
+ }
+ case CC_ScrollBar:
+ if (const QStyleOptionSlider *scrollBar =
+ qstyleoption_cast<const QStyleOptionSlider *>(option)) {
+ QRect slider = subControlRect(control, scrollBar,
+ SC_ScrollBarSlider, widget);
+ if (slider.contains(pos)) {
+ ret = SC_ScrollBarSlider;
+ break;
+ }
+
+ QRect scrollBarAddLine = subControlRect(control, scrollBar,
+ SC_ScrollBarAddLine, widget);
+ if (scrollBarAddLine.contains(pos)) {
+ ret = SC_ScrollBarAddLine;
+ break;
+ }
+
+ QRect scrollBarSubPage = subControlRect(control, scrollBar,
+ SC_ScrollBarSubPage, widget);
+ if (scrollBarSubPage.contains(pos)) {
+ ret = SC_ScrollBarSubPage;
+ break;
+ }
+
+ QRect scrollBarAddPage = subControlRect(control, scrollBar,
+ SC_ScrollBarAddPage, widget);
+ if (scrollBarAddPage.contains(pos)) {
+ ret = SC_ScrollBarAddPage;
+ break;
+ }
+
+ QRect scrollBarSubLine = subControlRect(control, scrollBar,
+ SC_ScrollBarSubLine, widget);
+ if (scrollBarSubLine.contains(pos)) {
+ ret = SC_ScrollBarSubLine;
+ break;
+ }
+ }
+ break;
+
+ default:
+ ret = QWindowsStyle::hitTestComplexControl(control, option, pos,
+ widget);
+ }
+ return ret;
+}
+
+void JavaStyle::polish(QWidget *widget)
+{
+ if (qobject_cast<QCheckBox *>(widget) ||
+ qobject_cast<QRadioButton *>(widget) ||
+ qobject_cast<QPushButton *>(widget) ||
+ qobject_cast<QToolButton *>(widget) ||
+ qobject_cast<QSpinBox *>(widget) ||
+ qobject_cast<QGroupBox *>(widget))
+ widget->setAttribute(Qt::WA_Hover, true);
+}
+
+void JavaStyle::unpolish(QWidget *widget)
+{
+ if (qobject_cast<QPushButton *>(widget) ||
+ qobject_cast<QCheckBox *>(widget) ||
+ qobject_cast<QRadioButton *>(widget) ||
+ qobject_cast<QToolButton *>(widget) ||
+ qobject_cast<QSpinBox *>(widget) ||
+ qobject_cast<QGroupBox *>(widget))
+ widget->setAttribute(Qt::WA_Hover, false);
+}
+
+void JavaStyle::drawSplitter(const QStyleOption *option, QPainter *painter,
+ bool horizontal) const
+{
+ QRect rect = option->rect;
+
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(option->palette.color(QPalette::Background));
+
+ painter->drawRect(rect);
+
+ QColor colors[] = { Qt::white, option->palette.color(QPalette::Mid) };
+ int iterations = horizontal ? rect.height() - 1 : rect.width() - 1;
+ for (int i = 0; i < iterations; ++i) {
+ painter->setPen(colors[i % 2]);
+ painter->drawPoint(xySwitch(QPoint(rect.x() + 0 + (i % 4),
+ rect.y() + i), horizontal));
+ }
+}
+
+inline QPoint JavaStyle::xySwitch(const QPoint &point, bool horizontal) const
+{
+ QPoint retPoint = point;
+
+ if (!horizontal) {
+ retPoint = QPoint(point.y(), point.x());
+ }
+
+ return retPoint;
+}
+
+void JavaStyle::drawPrimitive(PrimitiveElement element,
+ const QStyleOption *option,
+ QPainter *painter,
+ const QWidget *widget) const
+{
+ painter->save();
+
+ switch (element) {
+ case PE_PanelButtonBevel:
+ case PE_FrameButtonBevel: {
+ painter->save();
+ painter->setBrush(option->palette.background());
+ painter->setPen(Qt::NoPen);
+ painter->drawRect(option->rect);
+ painter->restore();
+ break;
+ }
+ case PE_IndicatorBranch: {
+ painter->save();
+ QColor lineColor(204, 204, 255);
+ QPixmap openPixmap(":/images/jtreeopen.png");
+ QPixmap closedPixmap(":/images/jtreeclosed.png");
+ QRect pixmapRect(QPoint(0, 0), QSize(12, 12));
+ pixmapRect.moveCenter(option->rect.center());
+ pixmapRect.translate(2, 0);
+ QPoint center = option->rect.center();
+
+ painter->setPen(lineColor);
+ painter->setBrush(Qt::NoBrush);
+
+ if (option->state & State_Item) {
+ painter->drawLine(center,
+ QPoint(option->rect.right(), center.y()));
+
+ painter->drawLine(center, QPoint(center.x(),
+ option->rect.top()));
+
+ if (option->state & State_Sibling) {
+ painter->drawLine(center, QPoint(center.x(),
+ option->rect.bottom()));
+ }
+
+ if (option->state & State_Children)
+ if (option->state & State_Open)
+ painter->drawPixmap(pixmapRect.topLeft(), closedPixmap);
+ else
+ painter->drawPixmap(pixmapRect.topLeft(), openPixmap);
+ } else if (option->state & State_Sibling) {
+ painter->drawLine(center.x(), option->rect.top(), center.x(),
+ option->rect.bottom());
+ }
+
+ painter->restore();
+ break;
+ }
+ case PE_IndicatorViewItemCheck: {
+ break;
+ }
+ case PE_FrameWindow: {
+ painter->save();
+ bool active = option->state & State_Active;
+
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(active ? option->palette.color(QPalette::Midlight)
+ : option->palette.color(QPalette::Mid));
+
+ painter->drawRect(QRect(option->rect.topLeft(), option->rect.bottomLeft() + QPoint(5, 0)));
+ painter->drawRect(QRect(option->rect.bottomLeft(), option->rect.bottomRight() + QPoint(0, -5)));
+ painter->drawRect(QRect(option->rect.bottomRight() + QPoint(-5, 0), option->rect.topRight()));
+ painter->drawRect(QRect(option->rect.topLeft(), option->rect.topRight() + QPoint(0, 4)));
+
+ painter->setBrush(Qt::NoBrush);
+ painter->setPen(option->palette.color(QPalette::Active, QPalette::WindowText));
+ painter->drawLine(option->rect.topLeft() + QPoint(2, 14),
+ option->rect.bottomLeft() + QPoint(2, -14));
+
+ painter->drawLine(option->rect.topRight() + QPoint(-2, 14),
+ option->rect.bottomRight() + QPoint(-2, -14));
+
+ painter->drawLine(option->rect.topLeft() + QPoint(14, 2),
+ option->rect.topRight() + QPoint(-14, 2));
+
+ painter->drawLine(option->rect.bottomLeft() + QPoint(14, -2),
+ option->rect.bottomRight() + QPoint(-14, -2));
+
+ painter->setPen(active ? option->palette.color(QPalette::Light) :
+ option->palette.color(QPalette::Button));
+ painter->drawLine(option->rect.topLeft() + QPoint(3, 15),
+ option->rect.bottomLeft() + QPoint(3, -13));
+
+ painter->drawLine(option->rect.topRight() + QPoint(-1, 15),
+ option->rect.bottomRight() + QPoint(-1, -13));
+
+ painter->drawLine(option->rect.topLeft() + QPoint(15, 3),
+ option->rect.topRight() + QPoint(-13, 3));
+
+ painter->drawLine(option->rect.bottomLeft() + QPoint(15, -1),
+ option->rect.bottomRight() + QPoint(-13, -1));
+
+ painter->restore();
+ break;
+ }
+ case PE_IndicatorSpinUp: {
+ const QStyleOptionSpinBox *spinner =
+ qstyleoption_cast<const QStyleOptionSpinBox *>(option);
+ int add = spinner->state & State_Sunken &&
+ spinner->activeSubControls & SC_SpinBoxUp ? 1 : 0;
+
+ QPoint center = option->rect.center();
+ painter->drawLine(center.x() + add, center.y() + 1 + add,
+ center.x() + 2 + add, center.y() + 1 + add);
+ painter->drawPoint(center.x() + 1 + add, center.y() + add);
+ break;
+ }
+ case PE_IndicatorSpinDown: {
+ const QStyleOptionSpinBox *spinner =
+ qstyleoption_cast<const QStyleOptionSpinBox *>(option);
+
+ int add = spinner->state & State_Sunken &&
+ spinner->activeSubControls & SC_SpinBoxDown ? 1 : 0;
+ QPoint center = option->rect.center();
+ painter->drawLine(center.x() + add, center.y() + add,
+ center.x() + 2 + add, center.y() + add);
+ painter->drawPoint(center.x() + 1 + add, center.y() + 1 + add);
+ break;
+ }
+ case PE_FrameDockWidget: {
+ drawPrimitive(PE_FrameWindow, option, painter, widget);
+ break;
+ }
+ case PE_IndicatorToolBarHandle: {
+ QPoint offset;
+ bool horizontal = option->state & State_Horizontal;
+
+ if (horizontal)
+ offset = option->rect.topLeft();
+ else
+ offset = option->rect.topLeft();
+
+ int iterations = horizontal ? option->rect.height() :
+ option->rect.width();
+
+ for (int i = 0; i < iterations; ++i) {
+ painter->setPen(i % 2 ? Qt::white :
+ option->palette.color(QPalette::Mid));
+ int add = i % 4;
+ painter->drawPoint(offset + xySwitch(QPoint(add, i),
+ horizontal));
+ painter->drawPoint(offset + xySwitch(QPoint(add + 4, i),
+ horizontal));
+ if (add + 8 < 10)
+ painter->drawPoint(offset + xySwitch(QPoint(add + 8, i),
+ horizontal));
+ }
+
+ break;
+ }
+ case PE_IndicatorToolBarSeparator: {
+ break;
+ }
+ case PE_PanelButtonTool: {
+ const QStyleOptionToolButton *button =
+ qstyleoption_cast<const QStyleOptionToolButton *>(option);
+
+ if (!button) {
+ painter->setPen(Qt::red);
+ if (!(option->state & State_Enabled))
+ painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
+ drawButtonBackground(option, painter, false);
+ break;
+ }
+
+ if (button->state & State_MouseOver || button->state & State_On) {
+ QStyleOptionButton bevel;
+ bevel.state = button->state;
+ bevel.rect = button->rect;
+ bevel.palette = button->palette;
+
+ drawButtonBackground(&bevel, painter, false);
+ } else {
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(button->palette.color(QPalette::Background));
+
+ painter->drawRect(button->rect.adjusted(0, 0, -1, -1));
+ }
+ break;
+ }
+ case PE_FrameMenu: {
+ painter->setPen(option->palette.color(QPalette::Midlight));
+ painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
+ break;
+ }
+ case PE_PanelButtonCommand: {
+ const QStyleOptionButton *btn =
+ qstyleoption_cast<const QStyleOptionButton *>(option);
+ bool hover = (btn->state & State_Enabled) &&
+ (btn->state & State_MouseOver);
+ bool sunken = btn->state & State_Sunken;
+ bool isDefault = btn->features & QStyleOptionButton::DefaultButton;
+ bool on = option->state & State_On;
+
+ drawButtonBackground(option, painter, false);
+
+ QRect rect = option->rect.adjusted(0, 0, -1, -1);
+ if (hover && !sunken && !isDefault && !on) {
+ drawButtonHoverFrame(painter, rect,
+ btn->palette.color(QPalette::Mid),
+ btn->palette.color(QPalette::Button));
+ } else if (isDefault) {
+ drawPrimitive(PE_FrameDefaultButton, option, painter, widget);
+ }
+ break;
+ }
+ case PE_FrameDefaultButton: {
+ painter->setPen(option->palette.color(QPalette::Mid));
+ QRect rect = option->rect.adjusted(0, 0, -1, -1);
+ painter->drawRect(rect);
+ painter->drawRect(rect.adjusted(1, 1, -1, -1));
+ break;
+ }
+//! [0]
+ case PE_IndicatorCheckBox: {
+ painter->save();
+ drawButtonBackground(option, painter, true);
+
+ if (option->state & State_Enabled &&
+ option->state & State_MouseOver &&
+ !(option->state & State_Sunken)) {
+ painter->setPen(option->palette.color(QPalette::Button));
+ QRect rect = option->rect.adjusted(1, 1, -2, -2);
+ painter->drawRect(rect);
+ rect = rect.adjusted(1, 1, -1, -1);
+ painter->drawRect(rect);
+ }
+
+ if (option->state & State_On) {
+ QImage image(":/images/checkboxchecked.png");
+ painter->drawImage(option->rect.topLeft(), image);
+ }
+ painter->restore();
+ break;
+//! [0]
+ }
+ case PE_IndicatorRadioButton: {
+ painter->save();
+ QBrush radioBrush = option->palette.button();
+
+ if (!(option->state & State_Sunken) &&
+ option->state & State_Enabled)
+ radioBrush = gradientBrush(option->rect);
+
+ painter->setBrush(radioBrush);
+ if (option->state & State_Enabled)
+ painter->setPen(option->palette.color(QPalette::Mid));
+ else
+ painter->setPen(option->palette.color(QPalette::Disabled,
+ QPalette::WindowText));
+ painter->drawEllipse(option->rect.adjusted(0, 0, -1, -1));
+
+ if (option->state & State_MouseOver &&
+ option->state & State_Enabled &&
+ !(option->state & State_Sunken)) {
+ gradientBrush(option->rect);
+ painter->setPen(option->palette.color(QPalette::Button));
+ painter->setBrush(Qt::NoBrush);
+ QRect rect = option->rect.adjusted(1, 1, -2, -2);
+ painter->drawEllipse(rect);
+ rect = rect.adjusted(1, 1, -1, -1);
+ painter->drawEllipse(rect);
+ }
+
+ if (option->state & State_On) {
+ painter->setBrush(option->palette.color(QPalette::Text));
+ painter->setPen(Qt::NoPen);
+ painter->drawEllipse(option->rect.adjusted(3, 3, -3, -3));
+ }
+ if (option->state & State_Sunken &&
+ option->state & State_Enabled) {
+ painter->setPen(option->palette.color(QPalette::Mid));
+ painter->drawArc(option->rect.adjusted(1, 1, -2, -2), 80 * 16,
+ 100 * 16);
+ }
+ painter->restore();
+ break;
+ }
+ case PE_FrameTabWidget: {
+ painter->setPen(option->palette.color(QPalette::Midlight));
+ painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
+ painter->setPen(Qt::white);
+ painter->drawRect(option->rect.adjusted(1, 1, -2, -2));
+ break;
+ }
+ case PE_Frame:
+ case PE_FrameLineEdit: {
+ const QStyleOptionFrame *frame =
+ qstyleoption_cast<const QStyleOptionFrame *>(option);
+ const QStyleOptionFrameV2 frameV2(*frame);
+
+ painter->setPen(frame->palette.color(QPalette::Mid));
+ painter->drawRect(frameV2.rect.adjusted(0, 0, -2, -2));
+ painter->setPen(Qt::white);
+ painter->drawRect(frameV2.rect.adjusted(1, 1, -1, -1));
+ painter->setPen(frameV2.palette.color(QPalette::Active,
+ QPalette::Background));
+ painter->drawLine(frameV2.rect.bottomLeft(),
+ frameV2.rect.bottomLeft() + QPoint(1, -1));
+ painter->drawLine(frameV2.rect.topRight(),
+ frameV2.rect.topRight() + QPoint(-1, 1));
+ break;
+ }
+ case PE_FrameFocusRect: {
+ painter->setPen(option->palette.color(QPalette::Light));
+ painter->setBrush(Qt::NoBrush);
+ QRect rect = option->rect;
+ rect = rect.adjusted(0,0, -1, -1);
+ painter->drawRect(rect);
+ break;
+ }
+ default:
+ QWindowsStyle::drawPrimitive(element, option, painter, widget);
+ }
+ painter->restore();
+}
+
+//! [1]
+void JavaStyle::drawButtonBackground(const QStyleOption *option,
+ QPainter *painter, bool isCheckbox) const
+{
+ QBrush buttonBrush = option->palette.button();
+ bool sunken = option->state & State_Sunken;
+ bool disabled = !(option->state & State_Enabled);
+ bool on = option->state & State_On;
+
+ if (!sunken && !disabled && (!on || isCheckbox))
+ buttonBrush = gradientBrush(option->rect);
+
+ painter->fillRect(option->rect, buttonBrush);
+
+ QRect rect = option->rect.adjusted(0, 0, -1, -1);
+
+ if (disabled)
+ painter->setPen(option->palette.color(QPalette::Disabled,
+ QPalette::WindowText));
+ else
+ painter->setPen(option->palette.color(QPalette::Mid));
+
+ painter->drawRect(rect);
+
+ if (sunken && !disabled) {
+ drawSunkenButtonShadow(painter, rect,
+ option->palette.color(QPalette::Mid),
+ option->direction == Qt::RightToLeft);
+ }
+}
+//! [1]
+
+QBrush JavaStyle::gradientBrush(const QRect &rect) const
+{
+ QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
+ gradient.setColorAt(1.0, QColor(188, 210, 230));
+ gradient.setColorAt(0.3, Qt::white);
+ gradient.setColorAt(0.0, QColor(223, 233, 243));
+
+ return QBrush(gradient);
+}
+
+QRect JavaStyle::subElementRect(SubElement element,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
+ QRect rect;
+
+ switch (element) {
+ case SE_ToolBoxTabContents: {
+ const QStyleOptionToolBox *box =
+ qstyleoption_cast<const QStyleOptionToolBox *>(option);
+
+ rect.moveTopLeft(box->rect.topLeft() + QPoint(0, 2));
+ rect.setHeight(box->rect.height() - 4);
+ rect.setWidth(box->fontMetrics.width(box->text) + 15);
+ break;
+ }
+ case SE_ProgressBarLabel:
+ case SE_ProgressBarGroove:
+ case SE_ProgressBarContents: {
+ rect = option->rect.adjusted(1, 1, -1, -1);
+ break;
+ }
+ case SE_PushButtonFocusRect: {
+ const QStyleOptionButton *btn =
+ qstyleoption_cast<const QStyleOptionButton *>(option);
+
+ rect = btn->fontMetrics.boundingRect(btn->text);
+ rect = QRect(0, 0, btn->fontMetrics.width(btn->text),
+ rect.height());
+
+ if (!btn->icon.isNull()) {
+ rect.adjust(0, 0, btn->iconSize.width(), btn->iconSize.height()
+ > rect.height() ? btn->iconSize.height() - rect.height() : 0);
+ rect.translate(-btn->iconSize.width(), 0);
+ rect.adjust(-1, -1, 1, 1);
+ }
+ rect = QRect(int(ceil((btn->rect.width() - rect.width()) / 2.0)),
+ int(ceil((btn->rect.height() - rect.height()) / 2.0)),
+ rect.width() - 1, rect.height());
+ rect.adjust(-1, 0, 1, 0);
+
+ break;
+ }
+ default:
+ rect = QWindowsStyle::subElementRect(element, option, widget);
+ }
+ return rect;
+}
+
+int JavaStyle::pixelMetric(PixelMetric metric,
+ const QStyleOption* /* option */,
+ const QWidget* /*widget*/) const
+{
+ int value = 0;
+
+ switch (metric) {
+ case PM_ButtonShiftHorizontal:
+ case PM_ButtonShiftVertical:
+ case PM_TabBarTabShiftHorizontal:
+ case PM_ButtonDefaultIndicator:
+ case PM_TabBarTabShiftVertical:
+ value = 0;
+ break;
+ case PM_TabBarBaseOverlap:
+ case PM_DefaultFrameWidth:
+ value = 2;
+ break;
+ case PM_TabBarTabVSpace:
+ value = 4;
+ break;
+ case PM_ScrollBarExtent:
+ value = 16;
+ break;
+ case PM_ScrollBarSliderMin:
+ value = 26;
+ break;
+ case PM_SplitterWidth:
+ value = 8;
+ break;
+ case PM_SliderThickness:
+ value = 16;
+ break;
+ case PM_SliderControlThickness:
+ value = 16;
+ break;
+ case PM_SliderTickmarkOffset:
+ value = 10;
+ break;
+ case PM_SliderSpaceAvailable:
+ break;
+ case PM_MenuPanelWidth:
+ value = 1;
+ break;
+ case PM_MenuVMargin:
+ value = 2;
+ break;
+ case PM_MenuBarPanelWidth:
+ value = 1;
+ break;
+ case PM_MenuBarItemSpacing:
+ value = 0;
+ break;
+ case PM_MenuBarHMargin:
+ value = 3;
+ break;
+ case PM_MenuBarVMargin:
+ value = 0;
+ break;
+ case PM_ComboBoxFrameWidth:
+ value = 1;
+ break;
+ case PM_MenuButtonIndicator:
+ value = 15;
+ break;
+ case PM_ToolBarItemMargin:
+ value = 3;
+ break;
+ case PM_ToolBarHandleExtent:
+ value = 13;
+ break;
+ case PM_SpinBoxFrameWidth:
+ value = 2;
+ break;
+ case PM_TitleBarHeight: {
+ value = 21;
+ break;
+ case PM_MDIFrameWidth:
+ value = 6;
+ break;
+ }
+ case PM_DockWidgetFrameWidth: {
+ value = 5;
+ break;
+ }
+ default:
+ value = QWindowsStyle::pixelMetric(metric);
+ }
+ return value;
+}
+
+
+int JavaStyle::styleHint(StyleHint hint, const QStyleOption *option,
+ const QWidget *widget,
+ QStyleHintReturn *returnData) const
+{
+ int ret;
+
+ switch (hint) {
+ case SH_Table_GridLineColor: {
+ ret = static_cast<int>(option->palette.color(QPalette::Mid).rgb());
+ break;
+ }
+ case QStyle::SH_Menu_Scrollable:
+ ret = 1;
+ break;
+ default:
+ ret = QWindowsStyle::styleHint(hint, option, widget, returnData);
+ }
+ return ret;
+}
+
+QPixmap JavaStyle::standardPixmap(StandardPixmap standardPixmap,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
+ QPixmap pixmap = QWindowsStyle::standardPixmap(standardPixmap, option,
+ widget);
+
+ QPixmap maximizePixmap(":/images/internalmaximize.png");
+ QPixmap minimizePixmap(":/images/internalminimize.png");
+ QPixmap closePixmap(":/images/internalclose.png");
+ QPixmap internalPixmap(":/images/internalsystem.png");
+ QPixmap internalCloseDownPixmap(":/images/internalclosedown.png");
+ QPixmap minimizeDownPixmap(":/images/internalminimizedown.png");
+ QPixmap maximizeDownPixmap(":/images/internalmaximizedown.png");
+ QPixmap dirOpenPixmap(":/images/open24.png");
+ QPixmap filePixmap(":/images/file.png");
+
+ switch (standardPixmap) {
+ case SP_DirLinkIcon:
+ case SP_DirClosedIcon:
+ case SP_DirIcon:
+ case SP_DirOpenIcon: {
+ pixmap = closePixmap;
+ break;
+ }
+ case SP_FileIcon: {
+ pixmap = filePixmap;
+ break;
+ }
+ case SP_FileDialogBack: {
+ pixmap = QPixmap(":/images/fileback.png");
+ break;
+ }
+ case SP_FileDialogToParent: {
+ pixmap = QPixmap(":/images/fileparent.png");
+ break;
+ }
+ case SP_FileDialogNewFolder: {
+ pixmap = QPixmap(":/images/open24.png");
+ break;
+ }
+ case SP_FileDialogListView: {
+ pixmap = QPixmap(":/images/filelist.png");
+ break;
+ }
+ case SP_FileDialogDetailedView: {
+ pixmap = QPixmap(":/images/filedetail.png");
+ break;
+ }
+ case SP_MessageBoxInformation: {
+ pixmap = QPixmap(":/images/information.png");
+ break;
+ }
+ case SP_MessageBoxWarning: {
+ pixmap = QPixmap(":/images/warning.png");
+ }
+ case SP_MessageBoxCritical: {
+ pixmap = QPixmap(":/images/critical.png");
+ break;
+ }
+ case SP_MessageBoxQuestion: {
+ pixmap = QPixmap(":/images/question.png");
+ break;
+ }
+ case SP_TitleBarNormalButton:
+ pixmap = maximizePixmap;
+ break;
+ case SP_TitleBarCloseButton:
+ pixmap = closePixmap;
+ break;
+ default:
+ ;
+ }
+
+ return pixmap;
+}
+
+QSize JavaStyle::sizeFromContents(ContentsType type,
+ const QStyleOption *option,
+ const QSize &contentsSize,
+ const QWidget *widget) const
+{
+ switch (type) {
+ case CT_ComboBox: {
+ return QSize(contentsSize.width() + 27, contentsSize.height());
+ }
+ case CT_Slider: {
+ const QStyleOptionSlider *slider =
+ qstyleoption_cast<const QStyleOptionSlider *>(option);
+ if (slider->tickPosition == QSlider::TicksBelow) {
+ return QSize(contentsSize.width(), contentsSize.height() + 15);
+ } else {
+ return contentsSize;
+ }
+ }
+ case CT_MenuBarItem: {
+ const QStyleOptionMenuItem *menuItem =
+ qstyleoption_cast<const QStyleOptionMenuItem *>(option);
+ QFontMetrics metrics(menuItem->font);
+ QRect boundingRect = metrics.boundingRect(menuItem->text);
+ int width = boundingRect.width() + 14;
+ int height = boundingRect.height() + 3;
+ if (height < 20)
+ height = 20;
+
+ return QSize(width, height);
+ }
+ case CT_MenuItem: {
+ const QStyleOptionMenuItem *menuItem =
+ qstyleoption_cast<const QStyleOptionMenuItem *>(option);
+ QSize defaultSize = QWindowsStyle::sizeFromContents(type, option,
+ contentsSize, widget);
+
+ if (menuItem->menuItemType == QStyleOptionMenuItem::Separator)
+ return defaultSize;
+
+ int width = 30;
+ int height = 0;
+
+ if (!menuItem->icon.isNull()) {
+ width += 20;
+ height += 20;
+ }
+ if (!menuItem->text.isEmpty()) {
+ QFontMetrics metrics(menuItem->font);
+ QString text = menuItem->text;
+ text.remove(QLatin1Char('\t'));
+ QRect textRect = metrics.boundingRect(text);
+ width += textRect.width();
+ if (height < textRect.height())
+ height += textRect.height();
+ }
+ if (menuItem->checkType != QStyleOptionMenuItem::NotCheckable) {
+ width += 10;
+ if (height < 10)
+ height = 10;
+ }
+ return QSize(width, height);
+ }
+ default:
+ return QWindowsStyle::sizeFromContents(type, option, contentsSize,
+ widget);
+ }
+}
diff --git a/src/widgets/doc/snippets/layouts/layouts.cpp b/src/widgets/doc/snippets/layouts/layouts.cpp
new file mode 100644
index 0000000000..49c341c048
--- /dev/null
+++ b/src/widgets/doc/snippets/layouts/layouts.cpp
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ {
+//! [0]
+ QWidget *window = new QWidget;
+//! [0] //! [1]
+ QPushButton *button1 = new QPushButton("One");
+//! [1] //! [2]
+ QPushButton *button2 = new QPushButton("Two");
+ QPushButton *button3 = new QPushButton("Three");
+ QPushButton *button4 = new QPushButton("Four");
+ QPushButton *button5 = new QPushButton("Five");
+//! [2]
+
+//! [3]
+ QHBoxLayout *layout = new QHBoxLayout;
+//! [3] //! [4]
+ layout->addWidget(button1);
+ layout->addWidget(button2);
+ layout->addWidget(button3);
+ layout->addWidget(button4);
+ layout->addWidget(button5);
+
+ window->setLayout(layout);
+//! [4]
+ window->setWindowTitle("QHBoxLayout");
+//! [5]
+ window->show();
+//! [5]
+ }
+
+ {
+//! [6]
+ QWidget *window = new QWidget;
+//! [6] //! [7]
+ QPushButton *button1 = new QPushButton("One");
+//! [7] //! [8]
+ QPushButton *button2 = new QPushButton("Two");
+ QPushButton *button3 = new QPushButton("Three");
+ QPushButton *button4 = new QPushButton("Four");
+ QPushButton *button5 = new QPushButton("Five");
+//! [8]
+
+//! [9]
+ QVBoxLayout *layout = new QVBoxLayout;
+//! [9] //! [10]
+ layout->addWidget(button1);
+ layout->addWidget(button2);
+ layout->addWidget(button3);
+ layout->addWidget(button4);
+ layout->addWidget(button5);
+
+ window->setLayout(layout);
+//! [10]
+ window->setWindowTitle("QVBoxLayout");
+//! [11]
+ window->show();
+//! [11]
+ }
+
+ {
+//! [12]
+ QWidget *window = new QWidget;
+//! [12] //! [13]
+ QPushButton *button1 = new QPushButton("One");
+//! [13] //! [14]
+ QPushButton *button2 = new QPushButton("Two");
+ QPushButton *button3 = new QPushButton("Three");
+ QPushButton *button4 = new QPushButton("Four");
+ QPushButton *button5 = new QPushButton("Five");
+//! [14]
+
+//! [15]
+ QGridLayout *layout = new QGridLayout;
+//! [15] //! [16]
+ layout->addWidget(button1, 0, 0);
+ layout->addWidget(button2, 0, 1);
+ layout->addWidget(button3, 1, 0, 1, 2);
+ layout->addWidget(button4, 2, 0);
+ layout->addWidget(button5, 2, 1);
+
+ window->setLayout(layout);
+//! [16]
+ window->setWindowTitle("QGridLayout");
+//! [17]
+ window->show();
+//! [17]
+ }
+
+ {
+//! [18]
+ QWidget *window = new QWidget;
+//! [18]
+//! [19]
+ QPushButton *button1 = new QPushButton("One");
+ QLineEdit *lineEdit1 = new QLineEdit();
+//! [19]
+//! [20]
+ QPushButton *button2 = new QPushButton("Two");
+ QLineEdit *lineEdit2 = new QLineEdit();
+ QPushButton *button3 = new QPushButton("Three");
+ QLineEdit *lineEdit3 = new QLineEdit();
+//! [20]
+//! [21]
+ QFormLayout *layout = new QFormLayout;
+//! [21]
+//! [22]
+ layout->addRow(button1, lineEdit1);
+ layout->addRow(button2, lineEdit2);
+ layout->addRow(button3, lineEdit3);
+
+ window->setLayout(layout);
+//! [22]
+ window->setWindowTitle("QFormLayout");
+//! [23]
+ window->show();
+//! [23]
+ }
+
+ return app.exec();
+}
diff --git a/src/widgets/doc/snippets/mainwindowsnippet.cpp b/src/widgets/doc/snippets/mainwindowsnippet.cpp
new file mode 100644
index 0000000000..76305e9ce2
--- /dev/null
+++ b/src/widgets/doc/snippets/mainwindowsnippet.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "mainwindow.h"
+
+MainWindow::MainWindow()
+{
+ createMenus();
+ createToolBars();
+ createDockWidgets();
+ //setMenuWidget(new QPushButton("Hello"));
+}
+
+void MainWindow::createMenus()
+{
+ //setMenuWidget(new QPushButton("Hello"));
+ QMenu *menu = new QMenu("File");
+ menu->addAction("Save &As");
+
+ QMenuBar *bar = new QMenuBar;
+ bar->addMenu(menu);
+
+ setMenuWidget(new QWidget());
+}
+
+void MainWindow::createToolBars()
+{
+ setToolButtonStyle(Qt::ToolButtonTextOnly);
+ QToolBar *t1 = new QToolBar;
+ t1->addAction(new QAction("t1", this));
+
+ QToolBar *t2 = new QToolBar;
+ t2->addAction(new QAction("t2", this));
+
+ addToolBar(Qt::LeftToolBarArea, t1);
+ addToolBar(Qt::LeftToolBarArea, t2);
+}
+
+void MainWindow::createDockWidgets()
+{
+ QWidget *dockWidgetContents = new QWidget;
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(new QPushButton("My Button."));
+ dockWidgetContents->setLayout(layout);
+
+//! [0]
+ QDockWidget *dockWidget = new QDockWidget(tr("Dock Widget"), this);
+ dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea |
+ Qt::RightDockWidgetArea);
+ dockWidget->setWidget(dockWidgetContents);
+ addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
+//! [0]
+}
diff --git a/src/widgets/doc/snippets/mdiareasnippets.cpp b/src/widgets/doc/snippets/mdiareasnippets.cpp
new file mode 100644
index 0000000000..711f25bd83
--- /dev/null
+++ b/src/widgets/doc/snippets/mdiareasnippets.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+void mainWindowExample()
+{
+ QMdiArea *mdiArea = new QMdiArea;
+//! [0]
+ QMainWindow *mainWindow = new QMainWindow;
+ mainWindow->setCentralWidget(mdiArea);
+//! [0]
+
+ mdiArea->addSubWindow(new QPushButton("Push Me Now!"));
+
+ mainWindow->show();
+}
+
+void addingSubWindowsExample()
+{
+ QWidget *internalWidget1 = new QWidget;
+ QWidget *internalWidget2 = new QWidget;
+
+//! [1]
+ QMdiArea mdiArea;
+ QMdiSubWindow *subWindow1 = new QMdiSubWindow;
+ subWindow1->setWidget(internalWidget1);
+ subWindow1->setAttribute(Qt::WA_DeleteOnClose);
+ mdiArea.addSubWindow(subWindow1);
+
+ QMdiSubWindow *subWindow2 =
+ mdiArea.addSubWindow(internalWidget2);
+
+//! [1]
+ subWindow1->show();
+ subWindow2->show();
+
+ mdiArea.show();
+}
+
+int main(int argv, char **args)
+{
+ QApplication app(argv, args);
+
+ mainWindowExample();
+ //addingSubWindowsExample();
+
+ QAction *act = new QAction(qApp);
+ act->setShortcut(Qt::ALT + Qt::Key_S);
+ act->setShortcutContext( Qt::ApplicationShortcut );
+ QObject::connect(act, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+
+ QWidget widget5;
+ widget5.show();
+ widget5.addAction(act);
+
+ return app.exec();
+}
+
+
diff --git a/src/widgets/doc/snippets/myscrollarea.cpp b/src/widgets/doc/snippets/myscrollarea.cpp
new file mode 100644
index 0000000000..a6a575f922
--- /dev/null
+++ b/src/widgets/doc/snippets/myscrollarea.cpp
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+class MyScrollArea : public QAbstractScrollArea
+{
+public:
+ MyScrollArea(QWidget *w);
+ void setWidget(QWidget *w);
+
+protected:
+ void scrollContentsBy(int dx, int dy);
+ void resizeEvent(QResizeEvent *event);
+
+private:
+ void updateWidgetPosition();
+ void updateArea();
+
+ QWidget *widget;
+};
+
+MyScrollArea::MyScrollArea(QWidget *widget)
+ : QAbstractScrollArea()
+{
+ setWidget(widget);
+}
+
+void MyScrollArea::setWidget(QWidget *w)
+{
+ widget = w;
+ widget->setParent(viewport());
+ if (!widget->testAttribute(Qt::WA_Resized))
+ widget->resize(widget->sizeHint());
+
+ verticalScrollBar()->setValue(0);
+ verticalScrollBar()->setValue(0);
+
+ updateArea();
+}
+
+void MyScrollArea::updateWidgetPosition()
+{
+//! [0]
+ int hvalue = horizontalScrollBar()->value();
+ int vvalue = verticalScrollBar()->value();
+ QPoint topLeft = viewport()->rect().topLeft();
+
+ widget->move(topLeft.x() - hvalue, topLeft.y() - vvalue);
+//! [0]
+}
+
+void MyScrollArea::scrollContentsBy(int /*dx*/, int /*dy*/)
+{
+ updateWidgetPosition();
+}
+
+void MyScrollArea::updateArea()
+{
+//! [1]
+ QSize areaSize = viewport()->size();
+ QSize widgetSize = widget->size();
+
+ verticalScrollBar()->setPageStep(areaSize.height());
+ horizontalScrollBar()->setPageStep(areaSize.width());
+ verticalScrollBar()->setRange(0, widgetSize.height() - areaSize.height());
+ horizontalScrollBar()->setRange(0, widgetSize.width() - areaSize.width());
+ updateWidgetPosition();
+//! [1]
+}
+
+void MyScrollArea::resizeEvent(QResizeEvent *event)
+{
+ updateArea();
+}
+
+int main(int argv, char **args)
+{
+ QApplication app(argv, args);
+
+ QPixmap pixmap("mypixmap.png");
+ QLabel label;
+ label.setPixmap(pixmap);
+ MyScrollArea area(&label);
+ area.resize(300, 300);
+ area.show();
+
+ area.setWidget(&label);
+
+ return app.exec();
+}
diff --git a/src/widgets/doc/snippets/qlistwidget-using/mainwindow.cpp b/src/widgets/doc/snippets/qlistwidget-using/mainwindow.cpp
new file mode 100644
index 0000000000..8e30f7979b
--- /dev/null
+++ b/src/widgets/doc/snippets/qlistwidget-using/mainwindow.cpp
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "mainwindow.h"
+
+MainWindow::MainWindow()
+{
+ QMenu *fileMenu = new QMenu(tr("&File"));
+
+ QAction *quitAction = fileMenu->addAction(tr("E&xit"));
+ quitAction->setShortcut(tr("Ctrl+Q"));
+
+ QMenu *itemsMenu = new QMenu(tr("&Items"));
+
+ insertAction = itemsMenu->addAction(tr("&Insert Item"));
+ removeAction = itemsMenu->addAction(tr("&Remove Item"));
+ QAction *ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order"));
+ QAction *descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order"));
+
+ menuBar()->addMenu(fileMenu);
+ menuBar()->addMenu(itemsMenu);
+
+/* For convenient quoting:
+//! [0]
+ QListWidget *listWidget = new QListWidget(this);
+//! [0]
+*/
+ listWidget = new QListWidget(this);
+ listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+
+ connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
+ connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
+ connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending()));
+ connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem()));
+ connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem()));
+ connect(listWidget,
+ SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
+ this, SLOT(updateMenus(QListWidgetItem *)));
+
+ setupListItems();
+ updateMenus(listWidget->currentItem());
+
+ setCentralWidget(listWidget);
+ setWindowTitle(tr("List Widget"));
+}
+
+void MainWindow::setupListItems()
+{
+//! [1]
+ new QListWidgetItem(tr("Oak"), listWidget);
+ new QListWidgetItem(tr("Fir"), listWidget);
+ new QListWidgetItem(tr("Pine"), listWidget);
+//! [1]
+ new QListWidgetItem(tr("Birch"), listWidget);
+//! [2]
+ new QListWidgetItem(tr("Hazel"), listWidget);
+//! [2]
+ new QListWidgetItem(tr("Redwood"), listWidget);
+//! [3]
+ new QListWidgetItem(tr("Sycamore"), listWidget);
+ new QListWidgetItem(tr("Chestnut"), listWidget);
+ new QListWidgetItem(tr("Mahogany"), listWidget);
+//! [3]
+}
+
+void MainWindow::sortAscending()
+{
+//! [4]
+ listWidget->sortItems(Qt::AscendingOrder);
+//! [4]
+}
+
+void MainWindow::sortDescending()
+{
+//! [5]
+ listWidget->sortItems(Qt::DescendingOrder);
+//! [5]
+}
+
+void MainWindow::insertItem()
+{
+ if (!listWidget->currentItem())
+ return;
+
+ QString itemText = QInputDialog::getText(this, tr("Insert Item"),
+ tr("Input text for the new item:"));
+
+ if (itemText.isNull())
+ return;
+
+//! [6]
+ QListWidgetItem *newItem = new QListWidgetItem;
+ newItem->setText(itemText);
+//! [6]
+ int row = listWidget->row(listWidget->currentItem());
+//! [7]
+ listWidget->insertItem(row, newItem);
+//! [7]
+
+ QString toolTipText = tr("Tooltip:") + itemText;
+ QString statusTipText = tr("Status tip:") + itemText;
+ QString whatsThisText = tr("What's This?:") + itemText;
+//! [8]
+ newItem->setToolTip(toolTipText);
+ newItem->setStatusTip(toolTipText);
+ newItem->setWhatsThis(whatsThisText);
+//! [8]
+}
+
+void MainWindow::removeItem()
+{
+ listWidget->takeItem(listWidget->row(listWidget->currentItem()));
+}
+
+void MainWindow::updateMenus(QListWidgetItem *current)
+{
+ insertAction->setEnabled(current != 0);
+ removeAction->setEnabled(current != 0);
+}
diff --git a/src/widgets/doc/snippets/qmacnativewidget/main.mm b/src/widgets/doc/snippets/qmacnativewidget/main.mm
new file mode 100644
index 0000000000..2c5c49769a
--- /dev/null
+++ b/src/widgets/doc/snippets/qmacnativewidget/main.mm
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QtGui>
+#include <QtGui/qmacnativewidget_mac.h>
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+//![0]
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect(200, app.desktop()->height() - 200, 239, 200)
+ styleMask:NSTitledWindowMask | NSClosableWindowMask
+ | NSMiniaturizableWindowMask | NSResizableWindowMask
+ backing:NSBackingStoreBuffered defer:NO];
+
+ QMacNativeWidget *nativeWidget = new QMacNativeWidget();
+ nativeWidget->move(0, 0);
+ nativeWidget->setPalette(QPalette(Qt::red));
+ nativeWidget->setAutoFillBackground(true);
+ QVBoxLayout *layout = new QVBoxLayout();
+ QPushButton *pushButton = new QPushButton("An Embedded Qt Button!", nativeWidget);
+ pushButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // Don't use the layout rect calculated from QMacStyle.
+ layout->addWidget(pushButton);
+ nativeWidget->setLayout(layout);
+
+ // Adjust Cocoa layouts
+ NSView *nativeWidgetView = reinterpret_cast<NSView *>(nativeWidget->winId());
+ NSView *contentView = [window contentView];
+ [contentView setAutoresizesSubviews:YES];
+ [nativeWidgetView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+ [nativeWidgetView setAutoresizesSubviews:YES];
+ NSView *pushButtonView = reinterpret_cast<NSView *>(pushButton->winId());
+ [pushButtonView setAutoresizingMask:NSViewWidthSizable];
+
+ // Add the nativeWidget to the window.
+ [contentView addSubview:nativeWidgetView positioned:NSWindowAbove relativeTo:nil];
+ nativeWidget->show();
+ pushButton->show();
+
+ // Show the window.
+ [window makeKeyAndOrderFront:window];
+ [pool release];
+//![0]
+ return app.exec(); // gives us the same behavior in both
+}
diff --git a/src/widgets/doc/snippets/qsplashscreen/main.cpp b/src/widgets/doc/snippets/qsplashscreen/main.cpp
new file mode 100644
index 0000000000..49bc084412
--- /dev/null
+++ b/src/widgets/doc/snippets/qsplashscreen/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <stdlib.h>
+
+#include "mainwindow.h"
+
+//! [0]
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QPixmap pixmap(":/splash.png");
+ QSplashScreen splash(pixmap);
+ splash.show();
+ app.processEvents();
+//! [0]
+
+ sleep(5);
+//! [1]
+ QMainWindow window;
+ window.show();
+ splash.finish(&window);
+ return app.exec();
+}
+//! [1]
diff --git a/src/widgets/doc/snippets/qstackedlayout/main.cpp b/src/widgets/doc/snippets/qstackedlayout/main.cpp
new file mode 100644
index 0000000000..771c36c721
--- /dev/null
+++ b/src/widgets/doc/snippets/qstackedlayout/main.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QApplication>
+
+class Widget : public QWidget
+{
+public:
+ Widget(QWidget *parent = 0);
+};
+
+Widget::Widget(QWidget *parent)
+ : QWidget(parent)
+{
+//! [0]
+ QWidget *firstPageWidget = new QWidget;
+ QWidget *secondPageWidget = new QWidget;
+ QWidget *thirdPageWidget = new QWidget;
+
+ QStackedLayout *stackedLayout = new QStackedLayout;
+ stackedLayout->addWidget(firstPageWidget);
+ stackedLayout->addWidget(secondPageWidget);
+ stackedLayout->addWidget(thirdPageWidget);
+
+//! [0] //! [1]
+ QComboBox *pageComboBox = new QComboBox;
+ pageComboBox->addItem(tr("Page 1"));
+ pageComboBox->addItem(tr("Page 2"));
+ pageComboBox->addItem(tr("Page 3"));
+ connect(pageComboBox, SIGNAL(activated(int)),
+ stackedLayout, SLOT(setCurrentIndex(int)));
+//! [1]
+
+//! [2]
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+//! [2]
+ mainLayout->addWidget(pageComboBox);
+//! [3]
+ mainLayout->addLayout(stackedLayout);
+ setLayout(mainLayout);
+//! [3]
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Widget widget;
+ widget.show();
+ return app.exec();
+}
+
diff --git a/src/widgets/doc/snippets/qstackedwidget/main.cpp b/src/widgets/doc/snippets/qstackedwidget/main.cpp
new file mode 100644
index 0000000000..9a29d773e6
--- /dev/null
+++ b/src/widgets/doc/snippets/qstackedwidget/main.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QApplication>
+
+class Widget : public QWidget
+{
+public:
+ Widget(QWidget *parent = 0);
+};
+
+Widget::Widget(QWidget *parent)
+ : QWidget(parent)
+{
+//! [0]
+ QWidget *firstPageWidget = new QWidget;
+ QWidget *secondPageWidget = new QWidget;
+ QWidget *thirdPageWidget = new QWidget;
+
+ QStackedWidget *stackedWidget = new QStackedWidget;
+ stackedWidget->addWidget(firstPageWidget);
+ stackedWidget->addWidget(secondPageWidget);
+ stackedWidget->addWidget(thirdPageWidget);
+
+//! [0] //! [1]
+ QComboBox *pageComboBox = new QComboBox;
+ pageComboBox->addItem(tr("Page 1"));
+ pageComboBox->addItem(tr("Page 2"));
+ pageComboBox->addItem(tr("Page 3"));
+ connect(pageComboBox, SIGNAL(activated(int)),
+ stackedWidget, SLOT(setCurrentIndex(int)));
+
+//! [1] //! [2]
+ QVBoxLayout *layout = new QVBoxLayout;
+//! [2]
+ layout->addWidget(pageComboBox);
+//! [3]
+ layout->addWidget(stackedWidget);
+ setLayout(layout);
+//! [3]
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Widget widget;
+ widget.show();
+ return app.exec();
+}
diff --git a/src/widgets/doc/snippets/qstyleoption/main.cpp b/src/widgets/doc/snippets/qstyleoption/main.cpp
new file mode 100644
index 0000000000..78f663012c
--- /dev/null
+++ b/src/widgets/doc/snippets/qstyleoption/main.cpp
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QApplication>
+
+class MyPushButton : public QPushButton
+{
+public:
+ MyPushButton(QWidget *parent = 0);
+
+ void paintEvent(QPaintEvent *);
+};
+
+MyPushButton::MyPushButton(QWidget *parent)
+ : QPushButton(parent)
+{
+}
+
+//! [0]
+void MyPushButton::paintEvent(QPaintEvent *)
+{
+ QStyleOptionButton option;
+ option.initFrom(this);
+ option.state = isDown() ? QStyle::State_Sunken : QStyle::State_Raised;
+ if (isDefault())
+ option.features |= QStyleOptionButton::DefaultButton;
+ option.text = text();
+ option.icon = icon();
+
+ QPainter painter(this);
+ style()->drawControl(QStyle::CE_PushButton, &option, &painter, this);
+}
+//! [0]
+
+
+
+class MyStyle : public QStyle
+{
+public:
+ MyStyle();
+
+ void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
+ QPainter *painter, const QWidget *widget);
+};
+
+MyStyle::MyStyle()
+{
+//! [1]
+ QStyleOptionFrame *option;
+
+ if (const QStyleOptionFrame *frameOption =
+ qstyleoption_cast<const QStyleOptionFrame *>(option)) {
+ QStyleOptionFrameV2 frameOptionV2(*frameOption);
+
+ // draw the frame using frameOptionV2
+ }
+//! [1]
+
+//! [2]
+ if (const QStyleOptionProgressBar *progressBarOption =
+ qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
+ QStyleOptionProgressBarV2 progressBarV2(*progressBarOption);
+
+ // draw the progress bar using progressBarV2
+ }
+//! [2]
+
+//! [3]
+ if (const QStyleOptionTab *tabOption =
+ qstyleoption_cast<const QStyleOptionTab *>(option)) {
+ QStyleOptionTabV2 tabV2(*tabOption);
+
+ // draw the tab using tabV2
+ }
+//! [3]
+}
+
+//! [4]
+void MyStyle::drawPrimitive(PrimitiveElement element,
+ const QStyleOption *option,
+ QPainter *painter,
+ const QWidget *widget)
+{
+ if (element == PE_FrameFocusRect) {
+ const QStyleOptionFocusRect *focusRectOption =
+ qstyleoption_cast<const QStyleOptionFocusRect *>(option);
+ if (focusRectOption) {
+ // ...
+ }
+ }
+ // ...
+}
+//! [4]
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ MyPushButton button;
+ button.show();
+ return app.exec();
+}
diff --git a/src/widgets/doc/snippets/qstyleplugin/main.cpp b/src/widgets/doc/snippets/qstyleplugin/main.cpp
new file mode 100644
index 0000000000..10a122016f
--- /dev/null
+++ b/src/widgets/doc/snippets/qstyleplugin/main.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QtGui>
+
+class MyStylePlugin : public QStylePlugin
+{
+public:
+ MyStylePlugin(QObject *parent = 0);
+
+ QStyle *create(const QString &key);
+ QStringList keys() const;
+};
+
+class RocketStyle : public QCommonStyle
+{
+public:
+ RocketStyle() {};
+
+};
+
+class StarBusterStyle : public QCommonStyle
+{
+public:
+ StarBusterStyle() {};
+};
+
+MyStylePlugin::MyStylePlugin(QObject *parent)
+ : QStylePlugin(parent)
+{
+}
+
+//! [0]
+QStringList MyStylePlugin::keys() const
+{
+ return QStringList() << "Rocket" << "StarBuster";
+}
+//! [0]
+
+//! [1]
+QStyle *MyStylePlugin::create(const QString &key)
+{
+ QString lcKey = key;
+ if (lcKey == "rocket") {
+ return new RocketStyle;
+ } else if (lcKey == "starbuster") {
+ return new StarBusterStyle;
+ }
+ return 0;
+//! [1] //! [2]
+}
+//! [2]
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ MyStylePlugin plugin;
+ return app.exec();
+}
diff --git a/src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp b/src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp
new file mode 100644
index 0000000000..f3ab01784e
--- /dev/null
+++ b/src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "mainwindow.h"
+
+MainWindow::MainWindow()
+{
+ QMenu *fileMenu = new QMenu(tr("&File"));
+
+ QAction *quitAction = fileMenu->addAction(tr("E&xit"));
+ quitAction->setShortcut(tr("Ctrl+Q"));
+
+ QMenu *tableMenu = new QMenu(tr("&Table"));
+
+ QAction *tableWidthAction = tableMenu->addAction(tr("Change Table &Width"));
+ QAction *tableHeightAction = tableMenu->addAction(tr("Change Table &Height"));
+
+ menuBar()->addMenu(fileMenu);
+ menuBar()->addMenu(tableMenu);
+
+//! [0]
+ tableWidget = new QTableWidget(this);
+//! [0]
+ tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+ connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
+ connect(tableWidthAction, SIGNAL(triggered()), this, SLOT(changeWidth()));
+ connect(tableHeightAction, SIGNAL(triggered()), this, SLOT(changeHeight()));
+
+ setupTableItems();
+
+ setCentralWidget(tableWidget);
+ setWindowTitle(tr("Table Widget Resizing"));
+}
+
+void MainWindow::setupTableItems()
+{
+//! [1]
+ tableWidget->setRowCount(10);
+ tableWidget->setColumnCount(5);
+//! [1]
+
+ for (int row = 0; row < tableWidget->rowCount(); ++row) {
+ for (int column = 0; column < tableWidget->columnCount(); ++column) {
+//! [2]
+ QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(
+ (row+1)*(column+1)));
+ tableWidget->setItem(row, column, newItem);
+//! [2]
+ }
+ }
+}
+
+void MainWindow::changeWidth()
+{
+ bool ok;
+
+ int newWidth = QInputDialog::getInteger(this, tr("Change table width"),
+ tr("Input the number of columns required (1-20):"),
+ tableWidget->columnCount(), 1, 20, 1, &ok);
+
+ if (ok)
+ tableWidget->setColumnCount(newWidth);
+}
+
+void MainWindow::changeHeight()
+{
+ bool ok;
+
+ int newHeight = QInputDialog::getInteger(this, tr("Change table height"),
+ tr("Input the number of rows required (1-20):"),
+ tableWidget->rowCount(), 1, 20, 1, &ok);
+
+ if (ok)
+ tableWidget->setRowCount(newHeight);
+}
diff --git a/src/widgets/doc/snippets/qtablewidget-using/mainwindow.cpp b/src/widgets/doc/snippets/qtablewidget-using/mainwindow.cpp
new file mode 100644
index 0000000000..b03a5e4999
--- /dev/null
+++ b/src/widgets/doc/snippets/qtablewidget-using/mainwindow.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "math.h"
+
+#include "mainwindow.h"
+
+MainWindow::MainWindow()
+{
+ QMenu *fileMenu = new QMenu(tr("&File"));
+
+ QAction *quitAction = fileMenu->addAction(tr("E&xit"));
+ quitAction->setShortcut(tr("Ctrl+Q"));
+
+ QMenu *itemsMenu = new QMenu(tr("&Items"));
+
+ QAction *sumItemsAction = itemsMenu->addAction(tr("&Sum Items"));
+ QAction *averageItemsAction = itemsMenu->addAction(tr("&Average Items"));
+
+ menuBar()->addMenu(fileMenu);
+ menuBar()->addMenu(itemsMenu);
+
+//! [0]
+ tableWidget = new QTableWidget(12, 3, this);
+//! [0]
+ tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+//! [1]
+ QTableWidgetItem *valuesHeaderItem = new QTableWidgetItem(tr("Values"));
+ tableWidget->setHorizontalHeaderItem(0, valuesHeaderItem);
+//! [1]
+ valuesHeaderItem->setTextAlignment(Qt::AlignVCenter);
+ QTableWidgetItem *squaresHeaderItem = new QTableWidgetItem(tr("Squares"));
+ squaresHeaderItem->setIcon(QIcon(QPixmap(":/Images/squared.png")));
+ squaresHeaderItem->setTextAlignment(Qt::AlignVCenter);
+//! [2]
+ QTableWidgetItem *cubesHeaderItem = new QTableWidgetItem(tr("Cubes"));
+ cubesHeaderItem->setIcon(QIcon(QPixmap(":/Images/cubed.png")));
+ cubesHeaderItem->setTextAlignment(Qt::AlignVCenter);
+//! [2]
+ tableWidget->setHorizontalHeaderItem(1, squaresHeaderItem);
+ tableWidget->setHorizontalHeaderItem(2, cubesHeaderItem);
+
+ connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
+ connect(sumItemsAction, SIGNAL(triggered()), this, SLOT(sumItems()));
+ connect(averageItemsAction, SIGNAL(triggered()), this, SLOT(averageItems()));
+
+ setupTableItems();
+
+ setCentralWidget(tableWidget);
+ setWindowTitle(tr("Table Widget"));
+}
+
+void MainWindow::setupTableItems()
+{
+ for (int row = 0; row < tableWidget->rowCount()-1; ++row) {
+ for (int column = 0; column < tableWidget->columnCount(); ++column) {
+//! [3]
+ QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(
+ pow(row, column+1)));
+ tableWidget->setItem(row, column, newItem);
+//! [3]
+ }
+ }
+ for (int column = 0; column < tableWidget->columnCount(); ++column) {
+ QTableWidgetItem *newItem = new QTableWidgetItem;
+ newItem->setFlags(Qt::ItemIsEnabled);
+ tableWidget->setItem(tableWidget->rowCount()-1, column, newItem);
+ }
+}
+
+void MainWindow::averageItems()
+{
+ QList<QTableWidgetItem *> selected = tableWidget->selectedItems();
+ QTableWidgetItem *item;
+ int number = 0;
+ double total = 0;
+
+ foreach (item, selected) {
+ bool ok;
+ double value = item->text().toDouble(&ok);
+
+ if (ok && !item->text().isEmpty()) {
+ total += value;
+ number++;
+ }
+ }
+ if (number > 0)
+ tableWidget->currentItem()->setText(QString::number(total/number));
+}
+
+void MainWindow::sumItems()
+{
+//! [4]
+ QList<QTableWidgetItem *> selected = tableWidget->selectedItems();
+ QTableWidgetItem *item;
+ int number = 0;
+ double total = 0;
+
+ foreach (item, selected) {
+ bool ok;
+ double value = item->text().toDouble(&ok);
+
+ if (ok && !item->text().isEmpty()) {
+ total += value;
+ number++;
+ }
+ }
+//! [4]
+ if (number > 0)
+ tableWidget->currentItem()->setText(QString::number(total));
+}
diff --git a/src/widgets/doc/snippets/qtreewidget-using/mainwindow.cpp b/src/widgets/doc/snippets/qtreewidget-using/mainwindow.cpp
new file mode 100644
index 0000000000..2a62c3e5f8
--- /dev/null
+++ b/src/widgets/doc/snippets/qtreewidget-using/mainwindow.cpp
@@ -0,0 +1,230 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "mainwindow.h"
+
+MainWindow::MainWindow()
+{
+ QMenu *fileMenu = new QMenu(tr("&File"));
+
+ QAction *quitAction = fileMenu->addAction(tr("E&xit"));
+ quitAction->setShortcut(tr("Ctrl+Q"));
+
+ QMenu *itemsMenu = new QMenu(tr("&Items"));
+
+ insertAction = itemsMenu->addAction(tr("&Insert Item"));
+ removeAction = itemsMenu->addAction(tr("&Remove Item"));
+ removeAction->setEnabled(false);
+ itemsMenu->addSeparator();
+ ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order"));
+ descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order"));
+ autoSortAction = itemsMenu->addAction(tr("&Automatically Sort Items"));
+ autoSortAction->setCheckable(true);
+ itemsMenu->addSeparator();
+ QAction *findItemsAction = itemsMenu->addAction(tr("&Find Items"));
+ findItemsAction->setShortcut(tr("Ctrl+F"));
+
+ menuBar()->addMenu(fileMenu);
+ menuBar()->addMenu(itemsMenu);
+
+/* For convenient quoting:
+//! [0]
+ QTreeWidget *treeWidget = new QTreeWidget(this);
+//! [0]
+*/
+ treeWidget = new QTreeWidget(this);
+//! [1]
+ treeWidget->setColumnCount(2);
+//! [1] //! [2]
+ QStringList headers;
+ headers << tr("Subject") << tr("Default");
+ treeWidget->setHeaderLabels(headers);
+//! [2]
+
+ connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
+ connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
+ connect(autoSortAction, SIGNAL(triggered()), this, SLOT(updateSortItems()));
+ connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending()));
+ connect(findItemsAction, SIGNAL(triggered()), this, SLOT(findItems()));
+ connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem()));
+ connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem()));
+ connect(treeWidget,
+ SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
+ this, SLOT(updateMenus(QTreeWidgetItem *)));
+
+ setupTreeItems();
+ updateMenus(treeWidget->currentItem());
+
+ setCentralWidget(treeWidget);
+ setWindowTitle(tr("Tree Widget"));
+}
+
+void MainWindow::setupTreeItems()
+{
+//! [3]
+ QTreeWidgetItem *cities = new QTreeWidgetItem(treeWidget);
+ cities->setText(0, tr("Cities"));
+ QTreeWidgetItem *osloItem = new QTreeWidgetItem(cities);
+ osloItem->setText(0, tr("Oslo"));
+ osloItem->setText(1, tr("Yes"));
+//! [3]
+
+ (new QTreeWidgetItem(cities))->setText(0, tr("Stockholm"));
+ (new QTreeWidgetItem(cities))->setText(0, tr("Helsinki"));
+ (new QTreeWidgetItem(cities))->setText(0, tr("Copenhagen"));
+
+//! [4] //! [5]
+ QTreeWidgetItem *planets = new QTreeWidgetItem(treeWidget, cities);
+//! [4]
+ planets->setText(0, tr("Planets"));
+//! [5]
+ (new QTreeWidgetItem(planets))->setText(0, tr("Mercury"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Venus"));
+
+ QTreeWidgetItem *earthItem = new QTreeWidgetItem(planets);
+ earthItem->setText(0, tr("Earth"));
+ earthItem->setText(1, tr("Yes"));
+
+ (new QTreeWidgetItem(planets))->setText(0, tr("Mars"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Jupiter"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Saturn"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Uranus"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Neptune"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Pluto"));
+}
+
+void MainWindow::findItems()
+{
+ QString itemText = QInputDialog::getText(this, tr("Find Items"),
+ tr("Text to find (including wildcards):"));
+
+ if (itemText.isEmpty())
+ return;
+
+//! [6]
+ QTreeWidgetItem *item;
+//! [6]
+ foreach (item, treeWidget->selectedItems())
+ treeWidget->setItemSelected(item, false);
+
+//! [7]
+ QList<QTreeWidgetItem *> found = treeWidget->findItems(
+ itemText, Qt::MatchWildcard);
+
+ foreach (item, found) {
+ treeWidget->setItemSelected(item, true);
+ // Show the item->text(0) for each item.
+ }
+//! [7]
+}
+
+void MainWindow::insertItem()
+{
+ QTreeWidgetItem *currentItem = treeWidget->currentItem();
+
+ if (!currentItem)
+ return;
+
+ QString itemText = QInputDialog::getText(this, tr("Insert Item"),
+ tr("Input text for the new item:"));
+
+ if (itemText.isEmpty())
+ return;
+
+//! [8]
+ QTreeWidgetItem *parent = currentItem->parent();
+ QTreeWidgetItem *newItem;
+ if (parent)
+ newItem = new QTreeWidgetItem(parent, treeWidget->currentItem());
+ else
+//! [8] //! [9]
+ newItem = new QTreeWidgetItem(treeWidget, treeWidget->currentItem());
+//! [9]
+
+ newItem->setText(0, itemText);
+}
+
+void MainWindow::removeItem()
+{
+ QTreeWidgetItem *currentItem = treeWidget->currentItem();
+
+ if (!currentItem)
+ return;
+
+//! [10]
+ QTreeWidgetItem *parent = currentItem->parent();
+ int index;
+
+ if (parent) {
+ index = parent->indexOfChild(treeWidget->currentItem());
+ delete parent->takeChild(index);
+ } else {
+ index = treeWidget->indexOfTopLevelItem(treeWidget->currentItem());
+ delete treeWidget->takeTopLevelItem(index);
+//! [10] //! [11]
+ }
+//! [11]
+}
+
+void MainWindow::sortAscending()
+{
+ treeWidget->sortItems(0, Qt::AscendingOrder);
+}
+
+void MainWindow::sortDescending()
+{
+ treeWidget->sortItems(0, Qt::DescendingOrder);
+}
+
+void MainWindow::updateMenus(QTreeWidgetItem *current)
+{
+ insertAction->setEnabled(current != 0);
+ removeAction->setEnabled(current != 0);
+}
+
+void MainWindow::updateSortItems()
+{
+ ascendingAction->setEnabled(!autoSortAction->isChecked());
+ descendingAction->setEnabled(!autoSortAction->isChecked());
+
+ treeWidget->setSortingEnabled(autoSortAction->isChecked());
+}
diff --git a/src/widgets/doc/snippets/qtreewidgetitemiterator-using/mainwindow.cpp b/src/widgets/doc/snippets/qtreewidgetitemiterator-using/mainwindow.cpp
new file mode 100644
index 0000000000..a0648b18c5
--- /dev/null
+++ b/src/widgets/doc/snippets/qtreewidgetitemiterator-using/mainwindow.cpp
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "mainwindow.h"
+
+MainWindow::MainWindow()
+{
+ QMenu *fileMenu = new QMenu(tr("&File"));
+
+ QAction *quitAction = fileMenu->addAction(tr("E&xit"));
+ quitAction->setShortcut(tr("Ctrl+Q"));
+
+ QMenu *itemsMenu = new QMenu(tr("&Items"));
+
+ insertAction = itemsMenu->addAction(tr("&Insert Item"));
+ removeAction = itemsMenu->addAction(tr("&Remove Item"));
+ removeAction->setEnabled(false);
+ itemsMenu->addSeparator();
+ ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order"));
+ descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order"));
+ autoSortAction = itemsMenu->addAction(tr("&Automatically Sort Items"));
+ autoSortAction->setCheckable(true);
+ itemsMenu->addSeparator();
+ QAction *findItemsAction = itemsMenu->addAction(tr("&Find Items"));
+ findItemsAction->setShortcut(tr("Ctrl+F"));
+
+ menuBar()->addMenu(fileMenu);
+ menuBar()->addMenu(itemsMenu);
+
+/* For convenient quoting:
+ QTreeWidget *treeWidget = new QTreeWidget(this);
+*/
+ treeWidget = new QTreeWidget(this);
+ treeWidget->setColumnCount(2);
+ QStringList headers;
+ headers << tr("Subject") << tr("Default");
+ treeWidget->setHeaderLabels(headers);
+
+ connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
+ connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
+ connect(autoSortAction, SIGNAL(triggered()), this, SLOT(updateSortItems()));
+ connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending()));
+ connect(findItemsAction, SIGNAL(triggered()), this, SLOT(findItems()));
+ connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem()));
+ connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem()));
+ connect(treeWidget,
+ SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
+ this, SLOT(updateMenus(QTreeWidgetItem *)));
+
+ setupTreeItems();
+ updateMenus(treeWidget->currentItem());
+
+ setCentralWidget(treeWidget);
+ setWindowTitle(tr("Tree Widget"));
+}
+
+void MainWindow::setupTreeItems()
+{
+ QTreeWidgetItem *planets = new QTreeWidgetItem(treeWidget);
+ planets->setText(0, tr("Planets"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Mercury"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Venus"));
+
+ QTreeWidgetItem *earthItem = new QTreeWidgetItem(planets);
+ earthItem->setText(0, tr("Earth"));
+ earthItem->setText(1, tr("Yes"));
+
+ (new QTreeWidgetItem(planets))->setText(0, tr("Mars"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Jupiter"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Saturn"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Uranus"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Neptune"));
+ (new QTreeWidgetItem(planets))->setText(0, tr("Pluto"));
+}
+
+void MainWindow::findItems()
+{
+ QString itemText = QInputDialog::getText(this, tr("Find Items"),
+ tr("Text to find:"));
+
+ if (itemText.isEmpty())
+ return;
+
+//! [0]
+ QTreeWidgetItemIterator it(treeWidget);
+ while (*it) {
+ if ((*it)->text(0) == itemText)
+ (*it)->setSelected(true);
+ ++it;
+ }
+//! [0]
+}
+
+void MainWindow::insertItem()
+{
+ QTreeWidgetItem *currentItem = treeWidget->currentItem();
+
+ if (!currentItem)
+ return;
+
+ QString itemText = QInputDialog::getText(this, tr("Insert Item"),
+ tr("Input text for the new item:"));
+
+ if (itemText.isEmpty())
+ return;
+
+ QTreeWidgetItem *parent = currentItem->parent();
+ QTreeWidgetItem *newItem;
+ if (parent)
+ newItem = new QTreeWidgetItem(parent, treeWidget->currentItem());
+ else
+ newItem = new QTreeWidgetItem(treeWidget, treeWidget->currentItem());
+
+ newItem->setText(0, itemText);
+}
+
+void MainWindow::removeItem()
+{
+ QTreeWidgetItem *currentItem = treeWidget->currentItem();
+
+ if (!currentItem)
+ return;
+
+ QTreeWidgetItem *parent = currentItem->parent();
+ int index;
+
+ if (parent) {
+ index = parent->indexOfChild(treeWidget->currentItem());
+ delete parent->takeChild(index);
+ } else {
+ index = treeWidget->indexOfTopLevelItem(treeWidget->currentItem());
+ delete treeWidget->takeTopLevelItem(index);
+ }
+}
+
+void MainWindow::sortAscending()
+{
+ treeWidget->sortItems(0, Qt::AscendingOrder);
+}
+
+void MainWindow::sortDescending()
+{
+ treeWidget->sortItems(0, Qt::DescendingOrder);
+}
+
+void MainWindow::updateMenus(QTreeWidgetItem *current)
+{
+ insertAction->setEnabled(current != 0);
+ removeAction->setEnabled(current != 0);
+}
+
+void MainWindow::updateSortItems()
+{
+ ascendingAction->setEnabled(!autoSortAction->isChecked());
+ descendingAction->setEnabled(!autoSortAction->isChecked());
+
+ treeWidget->setSortingEnabled(autoSortAction->isChecked());
+}
diff --git a/src/widgets/doc/snippets/shareddirmodel/main.cpp b/src/widgets/doc/snippets/shareddirmodel/main.cpp
new file mode 100644
index 0000000000..78d439b752
--- /dev/null
+++ b/src/widgets/doc/snippets/shareddirmodel/main.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ main.cpp
+
+ A simple example of how to view a model in several views, and share a
+ selection model.
+*/
+
+#include <QtGui>
+
+//! [0] //! [1]
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QSplitter *splitter = new QSplitter;
+
+//! [2] //! [3]
+ QFileSystemModel *model = new QFileSystemModel;
+ model->setRootPath(QDir::currentPath());
+//! [0] //! [2] //! [4] //! [5]
+ QTreeView *tree = new QTreeView(splitter);
+//! [3] //! [6]
+ tree->setModel(model);
+//! [4] //! [6] //! [7]
+ tree->setRootIndex(model->index(QDir::currentPath()));
+//! [7]
+
+ QListView *list = new QListView(splitter);
+ list->setModel(model);
+ list->setRootIndex(model->index(QDir::currentPath()));
+
+//! [5]
+ QItemSelectionModel *selection = new QItemSelectionModel(model);
+ tree->setSelectionModel(selection);
+ list->setSelectionModel(selection);
+
+//! [8]
+ splitter->setWindowTitle("Two views onto the same file system model");
+ splitter->show();
+ return app.exec();
+}
+//! [1] //! [8]
diff --git a/src/widgets/doc/snippets/splitter/splitter.cpp b/src/widgets/doc/snippets/splitter/splitter.cpp
new file mode 100644
index 0000000000..3908f1b0e3
--- /dev/null
+++ b/src/widgets/doc/snippets/splitter/splitter.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+void processSize(int)
+{
+}
+
+int main()
+{
+ QWidget *parent = 0;
+
+//! [0]
+ QSplitter *splitter = new QSplitter(parent);
+ QListView *listview = new QListView;
+ QTreeView *treeview = new QTreeView;
+ QTextEdit *textedit = new QTextEdit;
+ splitter->addWidget(listview);
+ splitter->addWidget(treeview);
+ splitter->addWidget(textedit);
+//! [0]
+
+ {
+ // SAVE STATE
+//! [1]
+ QSettings settings;
+ settings.setValue("splitterSizes", splitter->saveState());
+//! [1]
+ }
+
+ {
+ // RESTORE STATE
+//! [2]
+ QSettings settings;
+ splitter->restoreState(settings.value("splitterSizes").toByteArray());
+//! [2]
+ }
+
+//! [3]
+ QListIterator<int> it(splitter->sizes());
+ while (it.hasNext())
+ processSize(it.next());
+//! [3]
+
+ return 0;
+}
diff --git a/src/widgets/doc/snippets/splitterhandle/splitter.cpp b/src/widgets/doc/snippets/splitterhandle/splitter.cpp
new file mode 100644
index 0000000000..b8b729bb91
--- /dev/null
+++ b/src/widgets/doc/snippets/splitterhandle/splitter.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "splitter.h"
+
+SplitterHandle::SplitterHandle(Qt::Orientation orientation, QSplitter *parent)
+ : QSplitterHandle(orientation, parent)
+{
+ gradient.setColorAt(0.0, Qt::darkGreen);
+ gradient.setColorAt(0.25, Qt::white);
+ gradient.setColorAt(1.0, Qt::darkGreen);
+}
+
+//! [0]
+void SplitterHandle::paintEvent(QPaintEvent *event)
+{
+ QPainter painter(this);
+ if (orientation() == Qt::Horizontal) {
+ gradient.setStart(rect().left(), rect().height()/2);
+ gradient.setFinalStop(rect().right(), rect().height()/2);
+ } else {
+ gradient.setStart(rect().width()/2, rect().top());
+ gradient.setFinalStop(rect().width()/2, rect().bottom());
+ }
+ painter.fillRect(event->rect(), QBrush(gradient));
+}
+//! [0]
+
+Splitter::Splitter(Qt::Orientation orientation, QWidget *parent)
+ : QSplitter(orientation, parent)
+{
+}
+
+//! [1]
+QSplitterHandle *Splitter::createHandle()
+{
+ return new SplitterHandle(orientation(), this);
+}
+//! [1]
diff --git a/src/widgets/doc/snippets/splitterhandle/splitter.h b/src/widgets/doc/snippets/splitterhandle/splitter.h
new file mode 100644
index 0000000000..ba310b9e8d
--- /dev/null
+++ b/src/widgets/doc/snippets/splitterhandle/splitter.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SPLITTER_H
+#define SPLITTER_H
+
+#include <QLinearGradient>
+#include <QSplitter>
+#include <QSplitterHandle>
+
+class QPaintEvent;
+
+//! [0]
+class Splitter : public QSplitter
+{
+public:
+ Splitter(Qt::Orientation orientation, QWidget *parent = 0);
+
+protected:
+ QSplitterHandle *createHandle();
+};
+//! [0]
+
+class SplitterHandle : public QSplitterHandle
+{
+public:
+ SplitterHandle(Qt::Orientation orientation, QSplitter *parent);
+
+protected:
+ void paintEvent(QPaintEvent *event);
+
+private:
+ QLinearGradient gradient;
+};
+
+#endif
diff --git a/src/widgets/doc/snippets/styles/styles.cpp b/src/widgets/doc/snippets/styles/styles.cpp
new file mode 100644
index 0000000000..1109669bcb
--- /dev/null
+++ b/src/widgets/doc/snippets/styles/styles.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QStyleOption>
+#include <QStylePainter>
+#include <QWidget>
+
+class MyWidget : public QWidget
+{
+protected:
+ void paintEvent(QPaintEvent *event);
+ void paintEvent2(QPaintEvent *event);
+
+};
+
+//! [0] //! [1]
+void MyWidget::paintEvent(QPaintEvent * /* event */)
+//! [0]
+{
+//! [2]
+ QPainter painter(this);
+//! [2]
+
+ QStyleOptionFocusRect option;
+ option.initFrom(this);
+ option.backgroundColor = palette().color(QPalette::Background);
+
+//! [3]
+ style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, this);
+//! [3]
+}
+//! [1]
+
+void MyWidget::paintEvent2(QPaintEvent * /* event */)
+//! [4]
+{
+//! [4] //! [5] //! [6]
+ QStylePainter painter(this);
+//! [5]
+
+ QStyleOptionFocusRect option;
+ option.initFrom(this);
+ option.backgroundColor = palette().color(QPalette::Background);
+
+//! [7]
+ painter.drawPrimitive(QStyle::PE_FrameFocusRect, option);
+//! [7]
+}
+//! [6]
+
+int main()
+{
+ return 0;
+}
diff --git a/src/widgets/doc/snippets/stylesheet/common-mistakes.cpp b/src/widgets/doc/snippets/stylesheet/common-mistakes.cpp
new file mode 100644
index 0000000000..d4552fcf1d
--- /dev/null
+++ b/src/widgets/doc/snippets/stylesheet/common-mistakes.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [1]
+ QPushButton {
+ color: grey;
+ border-image: url(/home/kamlie/code/button.png) 3 10 3 10;
+ border-top: 3px transparent;
+ border-bottom: 3px transparent;
+ border-right: 10px transparent;
+ border-left: 10px transparent;
+ }
+//! [1]
+
+
diff --git a/src/widgets/doc/snippets/textdocument-imagedrop/textedit.cpp b/src/widgets/doc/snippets/textdocument-imagedrop/textedit.cpp
new file mode 100644
index 0000000000..fbb6f73ddc
--- /dev/null
+++ b/src/widgets/doc/snippets/textdocument-imagedrop/textedit.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "textedit.h"
+#include <QtGui>
+
+TextEdit::TextEdit(QWidget *parent)
+ : QTextEdit(parent)
+{
+}
+
+//! [0]
+bool TextEdit::canInsertFromMimeData( const QMimeData *source ) const
+{
+ if (source->hasImage())
+ return true;
+ else
+ return QTextEdit::canInsertFromMimeData(source);
+}
+//! [0]
+
+//! [1]
+void TextEdit::insertFromMimeData( const QMimeData *source )
+{
+ if (source->hasImage())
+ {
+ QImage image = qvariant_cast<QImage>(source->imageData());
+ QTextCursor cursor = this->textCursor();
+ QTextDocument *document = this->document();
+ document->addResource(QTextDocument::ImageResource, QUrl("image"), image);
+ cursor.insertImage("image");
+ }
+}
+//! [1]
diff --git a/src/widgets/doc/snippets/timeline/main.cpp b/src/widgets/doc/snippets/timeline/main.cpp
new file mode 100644
index 0000000000..f4be7f3c5b
--- /dev/null
+++ b/src/widgets/doc/snippets/timeline/main.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <math.h>
+
+int main(int argv, char *args[])
+{
+ QApplication app(argv, args);
+
+//! [0]
+ QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);
+
+ QTimeLine *timer = new QTimeLine(5000);
+ timer->setFrameRange(0, 100);
+
+ QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
+ animation->setItem(ball);
+ animation->setTimeLine(timer);
+
+ for (int i = 0; i < 200; ++i)
+ animation->setPosAt(i / 200.0, QPointF(i, i));
+
+ QGraphicsScene *scene = new QGraphicsScene();
+ scene->setSceneRect(0, 0, 250, 250);
+ scene->addItem(ball);
+
+ QGraphicsView *view = new QGraphicsView(scene);
+ view->show();
+
+ timer->start();
+//! [0]
+
+ return app.exec();
+}
diff --git a/src/widgets/doc/snippets/whatsthis/whatsthis.cpp b/src/widgets/doc/snippets/whatsthis/whatsthis.cpp
new file mode 100644
index 0000000000..3d3f65d317
--- /dev/null
+++ b/src/widgets/doc/snippets/whatsthis/whatsthis.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+class MainWindow : public QMainWindow
+{
+public:
+ MainWindow();
+
+ QAction *newAct;
+};
+
+MainWindow()
+{
+//! [0]
+ newAct = new QAction(tr("&New"), this);
+ newAct->setShortcut(tr("Ctrl+N"));
+ newAct->setStatusTip(tr("Create a new file"));
+ newAct->setWhatsThis(tr("Click this option to create a new file."));
+//! [0]
+}
+
+int main()
+{
+ return 0;
+}
diff --git a/src/widgets/doc/snippets/widget-mask/main.cpp b/src/widgets/doc/snippets/widget-mask/main.cpp
new file mode 100644
index 0000000000..18653deb4c
--- /dev/null
+++ b/src/widgets/doc/snippets/widget-mask/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+//! [0]
+ QLabel topLevelLabel;
+ QPixmap pixmap(":/images/tux.png");
+ topLevelLabel.setPixmap(pixmap);
+ topLevelLabel.setMask(pixmap.mask());
+//! [0]
+ topLevelLabel.show();
+ return app.exec();
+}
diff --git a/src/widgets/doc/snippets/widgetdelegate.cpp b/src/widgets/doc/snippets/widgetdelegate.cpp
new file mode 100644
index 0000000000..4d2a6559a5
--- /dev/null
+++ b/src/widgets/doc/snippets/widgetdelegate.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "widgetdelegate.h"
+
+//![0]
+void WidgetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
+{
+ if (index.column() == 1) {
+ int progress = index.data().toInt();
+
+ QStyleOptionProgressBar progressBarOption;
+ progressBarOption.rect = option.rect;
+ progressBarOption.minimum = 0;
+ progressBarOption.maximum = 100;
+ progressBarOption.progress = progress;
+ progressBarOption.text = QString::number(progress) + "%";
+ progressBarOption.textVisible = true;
+
+ QApplication::style()->drawControl(QStyle::CE_ProgressBar,
+ &progressBarOption, painter);
+ } else
+ QStyledItemDelegate::paint(painter, option, index);
+
+//![0]
+}
diff --git a/src/widgets/doc/src/qtwidgets.qdoc b/src/widgets/doc/src/qtwidgets.qdoc
new file mode 100644
index 0000000000..9267b0fb44
--- /dev/null
+++ b/src/widgets/doc/src/qtwidgets.qdoc
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \module QtWidgets
+ \title QtWidgets Module
+ \ingroup modules
+
+ \brief The QtWidgets module extends QtGui with C++ widget functionality.
+
+ To include the definitions of the module's classes, use the
+ following directive:
+
+ \snippet code/doc_src_qtwidgets.cpp 1
+
+ To link against the module, add this line to your \l qmake \c
+ .pro file:
+
+ \snippet code/doc_src_qtwidgets.pro 0
+*/
+
diff --git a/src/widgets/doc/src/widgets-and-layouts/focus.qdoc b/src/widgets/doc/src/widgets-and-layouts/focus.qdoc
new file mode 100644
index 0000000000..60f05948b4
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/focus.qdoc
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page focus.html
+ \title Keyboard Focus
+ \brief Keyboard focus management and handling.
+ \ingroup frameworks-technologies
+
+ \keyword keyboard focus
+
+ Qt's widgets handle keyboard focus in the ways that have become
+ customary in GUIs.
+
+ The basic issue is that the user's key strokes can be directed at any
+ of several windows on the screen, and any of several widgets inside
+ the intended window. When the user presses a key, they expect it to go
+ to the right place, and the software must try to meet this
+ expectation. The system must determine which application the key stroke
+ is directed at, which window within that application, and which widget
+ within that window.
+
+ \section1 Focus Motion
+
+ The customs which have evolved for directing keyboard focus to a
+ particular widget are these:
+
+ \list 1
+
+ \li The user presses \key Tab (or \key Shift+Tab).
+ \li The user clicks a widget.
+ \li The user presses a keyboard shortcut.
+ \li The user uses the mouse wheel.
+ \li The user moves the focus to a window, and the application must
+ determine which widget within the window should get the focus.
+ \endlist
+
+ Each of these motion mechanisms is different, and different types of
+ widgets receive focus in only some of them. We'll cover each of them
+ in turn.
+
+ \section2 Tab or Shift+Tab
+
+ Pressing \key Tab is by far the most common way to move focus
+ using the keyboard. (Sometimes in data-entry applications Enter
+ does the same as \key{Tab}; this can easily be achieved in Qt by
+ implementing an \l{The Event System}{event filter}.)
+
+ Pressing \key Tab, in all window systems in common use today,
+ moves the keyboard focus to the next widget in a circular
+ per-window list. \key Tab moves focus along the circular list in
+ one direction, \key Shift+Tab in the other. The order in which
+ \key Tab presses move from widget to widget is called the tab order.
+
+ You can customize the tab order using QWidget::setTabOrder(). (If
+ you don't, \key Tab generally moves focus in the order of widget
+ construction.) \l{Qt Designer} provides a means of visually
+ changing the tab order.
+
+ Since pressing \key Tab is so common, most widgets that can have focus
+ should support tab focus. The major exception is widgets that are
+ rarely used, and where there is some keyboard accelerator or error
+ handler that moves the focus.
+
+ For example, in a data entry dialog, there might be a field that
+ is only necessary in one per cent of all cases. In such a dialog,
+ \key Tab could skip this field, and the dialog could use one of
+ these mechanisms:
+
+ \list 1
+
+ \li If the program can determine whether the field is needed, it can
+ move focus there when the user finishes entry and presses \gui OK, or when
+ the user presses Enter after finishing the other fields. Alternately,
+ include the field in the tab order but disable it. Enable it if it
+ becomes appropriate in view of what the user has set in the other
+ fields.
+
+ \li The label for the field can include a keyboard shortcut that moves
+ focus to this field.
+
+ \endlist
+
+ Another exception to \key Tab support is text-entry widgets that
+ must support the insertion of tabs; almost all text editors fall
+ into this class. Qt treats \key Ctrl+Tab as \key Tab and \key
+ Ctrl+Shift+Tab as \key Shift+Tab, and such widgets can
+ reimplement QWidget::event() and handle Tab before calling
+ QWidget::event() to get normal processing of all other keys.
+ However, since some systems use \key Ctrl+Tab for other purposes,
+ and many users aren't aware of \key Ctrl+Tab anyway, this isn't a
+ complete solution.
+
+ \section2 The User Clicks a Widget
+
+ This is perhaps even more common than pressing \key Tab on
+ computers with a mouse or other pointing device.
+
+ Clicking to move the focus is slightly more powerful than \key
+ Tab. While it moves the focus \e to a widget, for editor widgets
+ it also moves the text cursor (the widget's internal focus) to
+ the spot where the mouse is clicked.
+
+ Since it is so common and people are used to it, it's a good idea to
+ support it for most widgets. However, there is also an important
+ reason to avoid it: you may not want to remove focus from the widget
+ where it was.
+
+ For example, in a word processor, when the user clicks the 'B' (bold)
+ tool button, what should happen to the keyboard focus? Should it
+ remain where it was, almost certainly in the editing widget, or should
+ it move to the 'B' button?
+
+ We advise supporting click-to-focus for widgets that support text
+ entry, and to avoid it for most widgets where a mouse click has a
+ different effect. (For buttons, we also recommend adding a keyboard
+ shortcut: QAbstractButton and its subclasses make this very easy.)
+
+ In Qt, only the QWidget::setFocusPolicy() function affects
+ click-to-focus.
+
+ \section2 The User Presses a Keyboard Shortcut
+
+ It's not unusual for keyboard shortcuts to move the focus. This
+ can happen implicitly by opening modal dialogs, but also
+ explicitly using focus accelerators such as those provided by
+ QLabel::setBuddy(), QGroupBox, and QTabBar.
+
+ We advise supporting shortcut focus for all widgets that the user
+ may want to jump to. For example, a tab dialog can have keyboard
+ shortcuts for each of its pages, so the user can press e.g. \key
+ Alt+P to step to the \underline{P}rinting page. It is easy to
+ overdo this: there are only a few keys, and it's also important
+ to provide keyboard shortcuts for commands. \key Alt+P is also
+ used for Paste, Play, Print, and Print Here in the \l{Standard
+ Accelerator Keys} list, for example.
+
+ \section2 The User Rotates the Mouse Wheel
+
+ On Microsoft Windows, mouse wheel usage is always handled by the
+ widget that has keyboard focus. On Mac OS X and X11, it's handled by
+ the widget that gets other mouse events.
+
+ The way Qt handles this platform difference is by letting widgets move
+ the keyboard focus when the wheel is used. With the right focus policy
+ on each widget, applications can work idiomatically correctly on
+ Windows, Mac OS X, and X11.
+
+ \section2 The User Moves the Focus to This Window
+
+ In this situation the application must determine which widget within
+ the window should receive the focus.
+
+ This can be simple: If the focus has been in this window before,
+ then the last widget to have focus should regain it. Qt does this
+ automatically.
+
+ If focus has never been in this window before and you know where
+ focus should start out, call QWidget::setFocus() on the widget
+ which should receive focus before you call QWidget::show() it. If
+ you don't, Qt will pick a suitable widget.
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-cde.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-cde.qdoc
new file mode 100644
index 0000000000..a74cab0509
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery-cde.qdoc
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page gallery-cde.html
+
+ \title CDE Style Widget Gallery
+ \ingroup gallery
+
+ This page shows some of the widgets available in Qt
+ when configured to use the "cde" style.
+
+\section2 Buttons
+
+\table 100%
+\row
+\li \image cde-checkbox.png
+ \caption The QCheckBox widget provides a checkbox with a text label.
+\li \image cde-radiobutton.png
+ \caption The QRadioButton widget provides a radio button with a text or pixmap label.
+\li \image cde-pushbutton.png
+ \image cde-toolbutton.png
+ \caption The QPushButton widget provides a command button.
+\endtable
+
+\section2 Containers
+
+\table 100%
+\row
+\li \image cde-groupbox.png
+ The The QGroupBox widget provides a group box frame with a title.
+\li \image cde-tabwidget.png
+ The QTabWidget class provides a stack of tabbed widgets.
+\li \image cde-frame.png
+ The QFrame widget provides a simple decorated container for other widgets.
+\li \image cde-toolbox.png
+ The QToolBox class provides a column of tabbed widget items.
+\endtable
+
+\section2 Item Views
+
+\table 100%
+\row
+\li \image cde-listview.png
+ The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.
+\li \image cde-treeview.png
+ The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.
+\li \image cde-tableview.png
+ The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\li
+\li
+\endtable
+
+\section2 Display Widgets
+
+\table 100%
+\row
+\li \image cde-progressbar.png
+ The QProgressBar widget provides a horizontal progress bar.
+\li \image cde-label.png
+ The QLabel widget provides a text or image display.
+\li \image cde-lcdnumber.png
+ The QLCDNumber widget displays a number with LCD-like digits.
+\endtable
+
+\section2 Input Widgets
+
+\table 100%
+\row
+\li \image cde-lineedit.png
+ The QLineEdit widget is a one-line text editor.
+\li \image cde-dateedit.png
+ The QDateEdit class provides a widget for editing dates.
+\li \image cde-timeedit.png
+ The QTimeEdit class provides a widget for editing times.
+\li \image cde-datetimeedit.png
+ The QDateTimeEdit class provides a widget for editing dates and times.
+\endtable
+
+\table 100%
+\row
+\li \image cde-slider.png
+ The QSlider widget provides a vertical or horizontal slider.
+\li \image cde-combobox.png
+ The QComboBox widget is a combined button and pop-up list.
+\li \image cde-spinbox.png
+ The QSpinBox class provides a spin box widget.
+\endtable
+
+\table 100%
+\row
+\li \image cde-fontcombobox.png
+ The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.
+\li \image cde-doublespinbox.png
+ The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.
+\li \image cde-horizontalscrollbar.png
+ The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.
+\endtable
+
+\table 100%
+\row
+\li \image cde-dial.png
+ The QDial class provides a rounded range control (like a speedometer or potentiometer).
+\li \image cde-textedit.png
+ The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
+\li \image cde-calendarwidget.png
+ The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.
+\endtable
+
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc
new file mode 100644
index 0000000000..bed6d0ca40
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page gallery-cleanlooks.html
+
+ \title Cleanlooks Style Widget Gallery
+ \ingroup gallery
+
+ This page shows some of the widgets available in Qt
+ when configured to use the "cleanlooks" style.
+
+\section2 Buttons
+
+\table 100%
+\row
+\li \image cleanlooks-pushbutton.png
+ \caption The QPushButton widget provides a command button.
+\li \image cleanlooks-toolbutton.png
+ \caption The QToolButton class provides a quick-access button to commands
+ or options, usually used inside a QToolBar.
+\endtable
+
+\table 100%
+\row
+\li \image cleanlooks-checkbox.png
+ \caption The QCheckBox widget provides a checkbox with a text label.
+\li \image cleanlooks-radiobutton.png
+ \caption The QRadioButton widget provides a radio button with a text or pixmap label.
+\endtable
+
+\section2 Containers
+
+\table 100%
+\row
+\li \image cleanlooks-groupbox.png
+ The The QGroupBox widget provides a group box frame with a title.
+\li \image cleanlooks-tabwidget.png
+ The QTabWidget class provides a stack of tabbed widgets.
+\li \image cleanlooks-frame.png
+ The QFrame widget provides a simple decorated container for other widgets.
+\li \image cleanlooks-toolbox.png
+ The QToolBox class provides a column of tabbed widget items.
+\endtable
+
+\section2 Item Views
+
+\table 100%
+\row
+\li \image cleanlooks-listview.png
+ The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.
+\li \image cleanlooks-treeview.png
+ The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.
+\li \image cleanlooks-tableview.png
+ The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\li
+\li
+\endtable
+
+\section2 Display Widgets
+
+\table 100%
+\row
+\li \image cleanlooks-progressbar.png
+ The QProgressBar widget provides a horizontal progress bar.
+\li \image cleanlooks-label.png
+ The QLabel widget provides a text or image display.
+\li \image cleanlooks-lcdnumber.png
+ The QLCDNumber widget displays a number with LCD-like digits.
+\endtable
+
+\section2 Input Widgets
+
+\table 100%
+\row
+\li \image cleanlooks-lineedit.png
+ The QLineEdit widget is a one-line text editor.
+\li \image cleanlooks-dateedit.png
+ The QDateEdit class provides a widget for editing dates.
+\li \image cleanlooks-timeedit.png
+ The QTimeEdit class provides a widget for editing times.
+\li \image cleanlooks-datetimeedit.png
+ The QDateTimeEdit class provides a widget for editing dates and times.
+\endtable
+
+\table 100%
+\row
+\li \image cleanlooks-slider.png
+ The QSlider widget provides a vertical or horizontal slider.
+\li \image cleanlooks-combobox.png
+ The QComboBox widget is a combined button and pop-up list.
+\li \image cleanlooks-spinbox.png
+ The QSpinBox class provides a spin box widget.
+\endtable
+
+\table 100%
+\row
+\li \image cleanlooks-fontcombobox.png
+ The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.
+\li \image cleanlooks-doublespinbox.png
+ The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.
+\li \image cleanlooks-horizontalscrollbar.png
+ The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.
+\endtable
+
+\table 100%
+\row
+\li \image cleanlooks-dial.png
+ The QDial class provides a rounded range control (like a speedometer or potentiometer).
+\li \image cleanlooks-textedit.png
+ The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
+\li \image cleanlooks-calendarwidget.png
+ The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.
+\endtable
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-gtk.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-gtk.qdoc
new file mode 100644
index 0000000000..820f0b4140
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery-gtk.qdoc
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page gallery-gtk.html
+
+ \title GTK Style Widget Gallery
+ \ingroup gallery
+
+ This page shows some of the widgets available in Qt
+ when configured to use the "gtk" style.
+
+ Take a look at the \l{Qt Widget Gallery} to see how Qt
+ applications appear in other styles.
+
+\section2 Buttons
+
+\table 100%
+\row
+\li \image gtk-pushbutton.png
+ \caption The QPushButton widget provides a command button.
+\li \image gtk-toolbutton.png
+ \caption The QToolButton class provides a quick-access button to commands
+ or options, usually used inside a QToolBar.
+\endtable
+
+\table 100%
+\row
+\li \image gtk-checkbox.png
+ \caption The QCheckBox widget provides a checkbox with a text label.
+\li \image gtk-radiobutton.png
+ \caption The QRadioButton widget provides a radio button with a text or pixmap label.
+\endtable
+
+\section2 Containers
+
+\table 100%
+\row
+\li \image gtk-groupbox.png
+ The The QGroupBox widget provides a group box frame with a title.
+\li \image gtk-tabwidget.png
+ The QTabWidget class provides a stack of tabbed widgets.
+\li \image gtk-frame.png
+ The QFrame widget provides a simple decorated container for other widgets.
+\li \image gtk-toolbox.png
+ The QToolBox class provides a column of tabbed widget items.
+\endtable
+
+\section2 Item Views
+
+\table 100%
+\row
+\li \image gtk-listview.png
+ The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.
+\li \image gtk-treeview.png
+ The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.
+\li \image gtk-tableview.png
+ The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\li
+\li
+\endtable
+
+\section2 Display Widgets
+
+\table 100%
+\row
+\li \image gtk-progressbar.png
+ The QProgressBar widget provides a horizontal progress bar.
+\li \image gtk-label.png
+ The QLabel widget provides a text or image display.
+\li \image gtk-lcdnumber.png
+ The QLCDNumber widget displays a number with LCD-like digits.
+\endtable
+
+\section2 Input Widgets
+
+\table 100%
+\row
+\li \image gtk-lineedit.png
+ The QLineEdit widget is a one-line text editor.
+\li \image gtk-dateedit.png
+ The QDateEdit class provides a widget for editing dates.
+\li \image gtk-timeedit.png
+ The QTimeEdit class provides a widget for editing times.
+\li \image gtk-datetimeedit.png
+ The QDateTimeEdit class provides a widget for editing dates and times.
+\endtable
+
+\table 100%
+\row
+\li \image gtk-slider.png
+ The QSlider widget provides a vertical or horizontal slider.
+\li \image gtk-combobox.png
+ The QComboBox widget is a combined button and pop-up list.
+\li \image gtk-spinbox.png
+ The QSpinBox class provides a spin box widget.
+\endtable
+
+\table 100%
+\row
+\li \image gtk-fontcombobox.png
+ The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.
+\li \image gtk-doublespinbox.png
+ The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.
+\li \image gtk-horizontalscrollbar.png
+ The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.
+\endtable
+
+\table 100%
+\row
+\li \image gtk-dial.png
+ The QDial class provides a rounded range control (like a speedometer or potentiometer).
+\li \image gtk-textedit.png
+ The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
+\li \image gtk-calendarwidget.png
+ The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.
+\endtable
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-macintosh.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-macintosh.qdoc
new file mode 100644
index 0000000000..488a3f7665
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery-macintosh.qdoc
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page gallery-macintosh.html
+
+ \title Macintosh Style Widget Gallery
+ \ingroup gallery
+
+ This page shows some of the widgets available in Qt
+ when configured to use the "macintosh" style.
+
+\section2 Buttons
+
+\table 100%
+\row
+\li \image macintosh-pushbutton.png
+ \caption The QPushButton widget provides a command button.
+\li \image macintosh-toolbutton.png
+ \caption The QToolButton class provides a quick-access button to commands
+ or options, usually used inside a QToolBar.
+\endtable
+
+\table 100%
+\row
+\li \image macintosh-checkbox.png
+ \caption The QCheckBox widget provides a checkbox with a text label.
+\li \image macintosh-radiobutton.png
+ \caption The QRadioButton widget provides a radio button with a text or pixmap label.
+\endtable
+
+\section2 Containers
+
+\table 100%
+\row
+\li \image macintosh-groupbox.png
+ The The QGroupBox widget provides a group box frame with a title.
+\li \image macintosh-tabwidget.png
+ The QTabWidget class provides a stack of tabbed widgets.
+\li \image macintosh-frame.png
+ The QFrame widget provides a simple decorated container for other widgets.
+\li \image macintosh-toolbox.png
+ The QToolBox class provides a column of tabbed widget items.
+\endtable
+
+\section2 Item Views
+
+\table 100%
+\row
+\li \image macintosh-listview.png
+ The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.
+\li \image macintosh-treeview.png
+ The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.
+\li \image macintosh-tableview.png
+ The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\li
+\li
+\endtable
+
+\section2 Display Widgets
+
+\table 100%
+\row
+\li \image macintosh-progressbar.png
+ The QProgressBar widget provides a horizontal progress bar.
+\li \image macintosh-label.png
+ The QLabel widget provides a text or image display.
+\li \image macintosh-lcdnumber.png
+ The QLCDNumber widget displays a number with LCD-like digits.
+\endtable
+
+\section2 Input Widgets
+
+\table 100%
+\row
+\li \image macintosh-lineedit.png
+ The QLineEdit widget is a one-line text editor.
+\li \image macintosh-dateedit.png
+ The QDateEdit class provides a widget for editing dates.
+\li \image macintosh-timeedit.png
+ The QTimeEdit class provides a widget for editing times.
+\li \image macintosh-datetimeedit.png
+ The QDateTimeEdit class provides a widget for editing dates and times.
+\endtable
+
+\table 100%
+\row
+\li \image macintosh-slider.png
+ The QSlider widget provides a vertical or horizontal slider.
+\li \image macintosh-combobox.png
+ The QComboBox widget is a combined button and pop-up list.
+\li \image macintosh-spinbox.png
+ The QSpinBox class provides a spin box widget.
+\endtable
+
+\table 100%
+\row
+\li \image macintosh-fontcombobox.png
+ The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.
+\li \image macintosh-doublespinbox.png
+ The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.
+\li \image macintosh-horizontalscrollbar.png
+ The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.
+\endtable
+
+\table 100%
+\row
+\li \image macintosh-dial.png
+ The QDial class provides a rounded range control (like a speedometer or potentiometer).
+\li \image macintosh-textedit.png
+ The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
+\li \image macintosh-calendarwidget.png
+ The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.
+\endtable
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-motif.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-motif.qdoc
new file mode 100644
index 0000000000..5cbffc5516
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery-motif.qdoc
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page gallery-motif.html
+
+ \title Motif Style Widget Gallery
+ \ingroup gallery
+
+ This page shows some of the widgets available in Qt
+ when configured to use the "motif" style.
+
+\section2 Buttons
+
+\table 100%
+\row
+\li \image motif-pushbutton.png
+ \caption The QPushButton widget provides a command button.
+\li \image motif-toolbutton.png
+ \caption The QToolButton class provides a quick-access button to commands
+ or options, usually used inside a QToolBar.
+\endtable
+
+\table 100%
+\row
+\li \image motif-checkbox.png
+ \caption The QCheckBox widget provides a checkbox with a text label.
+\li \image motif-radiobutton.png
+ \caption The QRadioButton widget provides a radio button with a text or pixmap label.
+\endtable
+
+\section2 Containers
+
+\table 100%
+\row
+\li \image motif-groupbox.png
+ The The QGroupBox widget provides a group box frame with a title.
+\li \image motif-tabwidget.png
+ The QTabWidget class provides a stack of tabbed widgets.
+\li \image motif-frame.png
+ The QFrame widget provides a simple decorated container for other widgets.
+\li \image motif-toolbox.png
+ The QToolBox class provides a column of tabbed widget items.
+\endtable
+
+\section2 Item Views
+
+\table 100%
+\row
+\li \image motif-listview.png
+ The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.
+\li \image motif-treeview.png
+ The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.
+\li \image motif-tableview.png
+ The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\li
+\li
+\endtable
+
+\section2 Display Widgets
+
+\table 100%
+\row
+\li \image motif-progressbar.png
+ The QProgressBar widget provides a horizontal progress bar.
+\li \image motif-label.png
+ The QLabel widget provides a text or image display.
+\li \image motif-lcdnumber.png
+ The QLCDNumber widget displays a number with LCD-like digits.
+\endtable
+
+\section2 Input Widgets
+
+\table 100%
+\row
+\li \image motif-lineedit.png
+ The QLineEdit widget is a one-line text editor.
+\li \image motif-dateedit.png
+ The QDateEdit class provides a widget for editing dates.
+\li \image motif-timeedit.png
+ The QTimeEdit class provides a widget for editing times.
+\li \image motif-datetimeedit.png
+ The QDateTimeEdit class provides a widget for editing dates and times.
+\endtable
+
+\table 100%
+\row
+\li \image motif-slider.png
+ The QSlider widget provides a vertical or horizontal slider.
+\li \image motif-combobox.png
+ The QComboBox widget is a combined button and pop-up list.
+\li \image motif-spinbox.png
+ The QSpinBox class provides a spin box widget.
+\endtable
+
+\table 100%
+\row
+\li \image motif-fontcombobox.png
+ The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.
+\li \image motif-doublespinbox.png
+ The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.
+\li \image motif-horizontalscrollbar.png
+ The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.
+\endtable
+
+\table 100%
+\row
+\li \image motif-dial.png
+ The QDial class provides a rounded range control (like a speedometer or potentiometer).
+\li \image motif-textedit.png
+ The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
+\li \image motif-calendarwidget.png
+ The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.
+\endtable
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-plastique.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-plastique.qdoc
new file mode 100644
index 0000000000..359fac8018
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery-plastique.qdoc
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page gallery-plastique.html
+
+ \title Plastique Style Widget Gallery
+ \ingroup gallery
+
+ This page shows some of the widgets available in Qt
+ when configured to use the "plastique" style.
+
+\section2 Buttons
+
+\table 100%
+\row
+\li \image plastique-pushbutton.png
+ \caption The QPushButton widget provides a command button.
+\li \image plastique-toolbutton.png
+ \caption The QToolButton class provides a quick-access button to commands
+ or options, usually used inside a QToolBar.
+\endtable
+
+\table 100%
+\row
+\li \image plastique-checkbox.png
+ \caption The QCheckBox widget provides a checkbox with a text label.
+\li \image plastique-radiobutton.png
+ \caption The QRadioButton widget provides a radio button with a text or pixmap label.
+\endtable
+
+\section2 Containers
+
+\table 100%
+\row
+\li \image plastique-groupbox.png
+ The The QGroupBox widget provides a group box frame with a title.
+\li \image plastique-tabwidget.png
+ The QTabWidget class provides a stack of tabbed widgets.
+\li \image plastique-frame.png
+ The QFrame widget provides a simple decorated container for other widgets.
+\li \image plastique-toolbox.png
+ The QToolBox class provides a column of tabbed widget items.
+\endtable
+
+\section2 Item Views
+
+\table 100%
+\row
+\li \image plastique-listview.png
+ The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.
+\li \image plastique-treeview.png
+ The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.
+\li \image plastique-tableview.png
+ The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\li
+\li
+\endtable
+
+\section2 Display Widgets
+
+\table 100%
+\row
+\li \image plastique-progressbar.png
+ The QProgressBar widget provides a horizontal progress bar.
+\li \image plastique-label.png
+ The QLabel widget provides a text or image display.
+\li \image plastique-lcdnumber.png
+ The QLCDNumber widget displays a number with LCD-like digits.
+\endtable
+
+\section2 Input Widgets
+
+\table 100%
+\row
+\li \image plastique-lineedit.png
+ The QLineEdit widget is a one-line text editor.
+\li \image plastique-dateedit.png
+ The QDateEdit class provides a widget for editing dates.
+\li \image plastique-timeedit.png
+ The QTimeEdit class provides a widget for editing times.
+\li \image plastique-datetimeedit.png
+ The QDateTimeEdit class provides a widget for editing dates and times.
+\endtable
+
+\table 100%
+\row
+\li \image plastique-slider.png
+ The QSlider widget provides a vertical or horizontal slider.
+\li \image plastique-combobox.png
+ The QComboBox widget is a combined button and pop-up list.
+\li \image plastique-spinbox.png
+ The QSpinBox class provides a spin box widget.
+\endtable
+
+\table 100%
+\row
+\li \image plastique-fontcombobox.png
+ The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.
+\li \image plastique-doublespinbox.png
+ The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.
+\li \image plastique-horizontalscrollbar.png
+ The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.
+\endtable
+
+\table 100%
+\row
+\li \image plastique-dial.png
+ The QDial class provides a rounded range control (like a speedometer or potentiometer).
+\li \image plastique-textedit.png
+ The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
+\li \image plastique-calendarwidget.png
+ The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.
+\endtable
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-windows.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-windows.qdoc
new file mode 100644
index 0000000000..b118c845c6
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery-windows.qdoc
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page gallery-windows.html
+
+ \title Windows Style Widget Gallery
+ \ingroup gallery
+
+ This page shows some of the widgets available in Qt
+ when configured to use the "windows" style.
+
+\section2 Buttons
+
+\table 100%
+\row
+\li \image windows-pushbutton.png
+ \caption The QPushButton widget provides a command button.
+\li \image windows-toolbutton.png
+ \caption The QToolButton class provides a quick-access button to commands
+ or options, usually used inside a QToolBar.
+\endtable
+
+\table 100%
+\row
+\li \image windows-checkbox.png
+ \caption The QCheckBox widget provides a checkbox with a text label.
+\li \image windows-radiobutton.png
+ \caption The QRadioButton widget provides a radio button with a text or pixmap label.
+\endtable
+
+\section2 Containers
+
+\table 100%
+\row
+\li \image windows-groupbox.png
+ The The QGroupBox widget provides a group box frame with a title.
+\li \image windows-tabwidget.png
+ The QTabWidget class provides a stack of tabbed widgets.
+\li \image windows-frame.png
+ The QFrame widget provides a simple decorated container for other widgets.
+\li \image windows-toolbox.png
+ The QToolBox class provides a column of tabbed widget items.
+\endtable
+
+\section2 Item Views
+
+\table 100%
+\row
+\li \image windows-listview.png
+ The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.
+\li \image windows-treeview.png
+ The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.
+\li \image windows-tableview.png
+ The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\li
+\li
+\endtable
+
+\section2 Display Widgets
+
+\table 100%
+\row
+\li \image windows-progressbar.png
+ The QProgressBar widget provides a horizontal progress bar.
+\li \image windows-label.png
+ The QLabel widget provides a text or image display.
+\li \image windows-lcdnumber.png
+ The QLCDNumber widget displays a number with LCD-like digits.
+\endtable
+
+\section2 Input Widgets
+
+\table 100%
+\row
+\li \image windows-lineedit.png
+ The QLineEdit widget is a one-line text editor.
+\li \image windows-dateedit.png
+ The QDateEdit class provides a widget for editing dates.
+\li \image windows-timeedit.png
+ The QTimeEdit class provides a widget for editing times.
+\li \image windows-datetimeedit.png
+ The QDateTimeEdit class provides a widget for editing dates and times.
+\endtable
+
+\table 100%
+\row
+\li \image windows-slider.png
+ The QSlider widget provides a vertical or horizontal slider.
+\li \image windows-combobox.png
+ The QComboBox widget is a combined button and pop-up list.
+\li \image windows-spinbox.png
+ The QSpinBox class provides a spin box widget.
+\endtable
+
+\table 100%
+\row
+\li \image windows-fontcombobox.png
+ The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.
+\li \image windows-doublespinbox.png
+ The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.
+\li \image windows-horizontalscrollbar.png
+ The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.
+\endtable
+
+\table 100%
+\row
+\li \image windows-dial.png
+ The QDial class provides a rounded range control (like a speedometer or potentiometer).
+\li \image windows-textedit.png
+ The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
+\li \image windows-calendarwidget.png
+ The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.
+\endtable
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc
new file mode 100644
index 0000000000..db1a7cee90
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page gallery-windowsvista.html
+
+ \title Windows Vista Style Widget Gallery
+ \ingroup gallery
+
+ This page shows some of the widgets available in Qt
+ when configured to use the "windowsvista" style.
+
+\section2 Buttons
+
+\table 100%
+\row
+\li \image windowsvista-pushbutton.png
+ \caption The QPushButton widget provides a command button.
+\li \image windowsvista-toolbutton.png
+ \caption The QToolButton class provides a quick-access button to commands
+ or options, usually used inside a QToolBar.
+\endtable
+
+\table 100%
+\row
+\li \image windowsvista-checkbox.png
+ \caption The QCheckBox widget provides a checkbox with a text label.
+\li \image windowsvista-radiobutton.png
+ \caption The QRadioButton widget provides a radio button with a text or pixmap label.
+\endtable
+
+\section2 Containers
+
+\table 100%
+\row
+\li \image windowsvista-groupbox.png
+ The The QGroupBox widget provides a group box frame with a title.
+\li \image windowsvista-tabwidget.png
+ The QTabWidget class provides a stack of tabbed widgets.
+\li \image windowsvista-frame.png
+ The QFrame widget provides a simple decorated container for other widgets.
+\li \image windowsvista-toolbox.png
+ The QToolBox class provides a column of tabbed widget items.
+\endtable
+
+\section2 Item Views
+
+\table 100%
+\row
+\li \image windowsvista-listview.png
+ The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.
+\li \image windowsvista-treeview.png
+ The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.
+\li \image windowsvista-tableview.png
+ The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\li
+\li
+\endtable
+
+\section2 Display Widgets
+
+\table 100%
+\row
+\li \image windowsvista-progressbar.png
+ The QProgressBar widget provides a horizontal progress bar.
+\li \image windowsvista-label.png
+ The QLabel widget provides a text or image display.
+\li \image windowsvista-lcdnumber.png
+ The QLCDNumber widget displays a number with LCD-like digits.
+\endtable
+
+\section2 Input Widgets
+
+\table 100%
+\row
+\li \image windowsvista-lineedit.png
+ The QLineEdit widget is a one-line text editor.
+\li \image windowsvista-dateedit.png
+ The QDateEdit class provides a widget for editing dates.
+\li \image windowsvista-timeedit.png
+ The QTimeEdit class provides a widget for editing times.
+\li \image windowsvista-datetimeedit.png
+ The QDateTimeEdit class provides a widget for editing dates and times.
+\endtable
+
+\table 100%
+\row
+\li \image windowsvista-slider.png
+ The QSlider widget provides a vertical or horizontal slider.
+\li \image windowsvista-combobox.png
+ The QComboBox widget is a combined button and pop-up list.
+\li \image windowsvista-spinbox.png
+ The QSpinBox class provides a spin box widget.
+\endtable
+
+\table 100%
+\row
+\li \image windowsvista-fontcombobox.png
+ The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.
+\li \image windowsvista-doublespinbox.png
+ The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.
+\li \image windowsvista-horizontalscrollbar.png
+ The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.
+\endtable
+
+\table 100%
+\row
+\li \image windowsvista-dial.png
+ The QDial class provides a rounded range control (like a speedometer or potentiometer).
+\li \image windowsvista-textedit.png
+ The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
+\li \image windowsvista-calendarwidget.png
+ The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.
+\endtable
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc
new file mode 100644
index 0000000000..2ade5681e2
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page gallery-windowsxp.html
+
+ \title Windows XP Style Widget Gallery
+ \ingroup gallery
+
+ This page shows some of the widgets available in Qt
+ when configured to use the "windowsxp" style.
+
+\section2 Buttons
+
+\table 100%
+\row
+\li \image windowsxp-pushbutton.png
+ \caption The QPushButton widget provides a command button.
+\li \image windowsxp-toolbutton.png
+ \caption The QToolButton class provides a quick-access button to commands
+ or options, usually used inside a QToolBar.
+\endtable
+
+\table 100%
+\row
+\li \image windowsxp-checkbox.png
+ \caption The QCheckBox widget provides a checkbox with a text label.
+\li \image windowsxp-radiobutton.png
+ \caption The QRadioButton widget provides a radio button with a text or pixmap label.
+\endtable
+
+\section2 Containers
+
+\table 100%
+\row
+\li \image windowsxp-groupbox.png
+ The The QGroupBox widget provides a group box frame with a title.
+\li \image windowsxp-tabwidget.png
+ The QTabWidget class provides a stack of tabbed widgets.
+\li \image windowsxp-frame.png
+ The QFrame widget provides a simple decorated container for other widgets.
+\li \image windowsxp-toolbox.png
+ The QToolBox class provides a column of tabbed widget items.
+\endtable
+
+\section2 Item Views
+
+\table 100%
+\row
+\li \image windowsxp-listview.png
+ The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.
+\li \image windowsxp-treeview.png
+ The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.
+\li \image windowsxp-tableview.png
+ The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\li
+\li
+\endtable
+
+\section2 Display Widgets
+
+\table 100%
+\row
+\li \image windowsxp-progressbar.png
+ The QProgressBar widget provides a horizontal progress bar.
+\li \image windowsxp-label.png
+ The QLabel widget provides a text or image display.
+\li \image windowsxp-lcdnumber.png
+ The QLCDNumber widget displays a number with LCD-like digits.
+\endtable
+
+\section2 Input Widgets
+
+\table 100%
+\row
+\li \image windowsxp-lineedit.png
+ The QLineEdit widget is a one-line text editor.
+\li \image windowsxp-dateedit.png
+ The QDateEdit class provides a widget for editing dates.
+\li \image windowsxp-timeedit.png
+ The QTimeEdit class provides a widget for editing times.
+\li \image windowsxp-datetimeedit.png
+ The QDateTimeEdit class provides a widget for editing dates and times.
+\endtable
+
+\table 100%
+\row
+\li \image windowsxp-slider.png
+ The QSlider widget provides a vertical or horizontal slider.
+\li \image windowsxp-combobox.png
+ The QComboBox widget is a combined button and pop-up list.
+\li \image windowsxp-spinbox.png
+ The QSpinBox class provides a spin box widget.
+\endtable
+
+\table 100%
+\row
+\li \image windowsxp-fontcombobox.png
+ The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.
+\li \image windowsxp-doublespinbox.png
+ The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.
+\li \image windowsxp-horizontalscrollbar.png
+ The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.
+\endtable
+
+\table 100%
+\row
+\li \image windowsxp-dial.png
+ The QDial class provides a rounded range control (like a speedometer or potentiometer).
+\li \image windowsxp-textedit.png
+ The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
+\li \image windowsxp-calendarwidget.png
+ The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.
+\endtable
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc
new file mode 100644
index 0000000000..a2f4db5a7b
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group gallery
+ \title Qt Widget Gallery
+ \brief Qt widgets shown in different styles on various platforms.
+
+ Qt's support for widget styles and themes enables your application to fit in
+ with the native desktop environment. Below, you can find links to the various
+ widget styles that are supplied with Qt 4.
+
+ \table
+ \row
+ \li \image plastique-tabwidget.png Plastique Style Widget Gallery
+ \caption \l{Plastique Style Widget Gallery}
+
+ The Plastique style is provided by QPlastiqueStyle.
+ \li \image windowsxp-tabwidget.png Windows XP Style Widget Gallery
+ \caption \l{Windows XP Style Widget Gallery}
+
+ The Windows XP style is provided by QWindowsXPStyle.
+ \li \image windows-tabwidget.png Windows Style Widget Gallery
+ \caption \l{Windows Style Widget Gallery}
+
+ The Windows style is provided by QWindowsStyle.
+ \endtable
+
+ \table
+ \row
+ \li \image macintosh-tabwidget.png Macintosh Style Widget Gallery
+ \caption \l{Macintosh Style Widget Gallery}
+
+ The Macintosh style is provided by QMacStyle.
+ \li \image cleanlooks-tabwidget.png Cleanlooks Style Widget Gallery
+ \caption \l{Cleanlooks Style Widget Gallery}
+
+ The Cleanlooks style is provided by QCleanlooksStyle.
+ \li \image windowsvista-tabwidget.png Windows Vista Style Widget Gallery
+ \caption \l{Windows Vista Style Widget Gallery}
+
+ The Windows Vista style is provided by QWindowsVistaStyle.
+ \endtable
+
+ \table
+ \row
+ \li \image gtk-tabwidget.png GTK Style Widget Gallery
+ \caption \l{GTK Style Widget Gallery}
+
+ The GTK style is provided by QGtkStyle.
+ \li \image motif-tabwidget.png Motif Style Widget Gallery
+ \caption \l{Motif Style Widget Gallery}
+
+ The Motif style is provided by QMotifStyle.
+ \li \image cde-tabwidget.png CDE Style Widget Gallery
+ \caption \l{CDE Style Widget Gallery}
+
+ The Common Desktop Environment style is provided by QCDEStyle.
+ \endtable
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
new file mode 100644
index 0000000000..807f9ae8f9
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
@@ -0,0 +1,396 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group geomanagement
+ \title Layout Classes
+*/
+
+/*!
+ \page layout.html
+ \title Layout Management
+ \ingroup qt-basic-concepts
+ \ingroup qt-gui-concepts
+ \brief A tour of the standard layout managers and an introduction to custom
+ layouts.
+
+ \previouspage Widgets and Layouts
+ \contentspage Widgets and Layouts
+ \nextpage {Styles and Style Aware Widgets}{Styles}
+
+ \ingroup frameworks-technologies
+
+ The Qt layout system provides a simple and powerful way of automatically
+ arranging child widgets within a widget to ensure that they make good use
+ of the available space.
+
+ \tableofcontents
+
+ \section1 Introduction
+
+ Qt includes a set of layout management classes that are used to describe
+ how widgets are laid out in an application's user interface. These layouts
+ automatically position and resize widgets when the amount of space
+ available for them changes, ensuring that they are consistently arranged
+ and that the user interface as a whole remains usable.
+
+ All QWidget subclasses can use layouts to manage their children. The
+ QWidget::setLayout() function applies a layout to a widget. When a layout
+ is set on a widget in this way, it takes charge of the following tasks:
+
+ \list
+ \li Positioning of child widgets.
+ \li Sensible default sizes for windows.
+ \li Sensible minimum sizes for windows.
+ \li Resize handling.
+ \li Automatic updates when contents change:
+ \list
+ \li Font size, text or other contents of child widgets.
+ \li Hiding or showing a child widget.
+ \li Removal of child widgets.
+ \endlist
+ \endlist
+
+ \section1 Qt's Layout Classes
+
+ Qt's layout classes were designed for hand-written C++ code, allowing
+ measurements to be specified in pixels for simplicity, so they are easy to
+ understand and use. The code generated for forms created using \QD also
+ uses the layout classes. \QD is useful to use when experimenting with the
+ design of a form since it avoids the compile, link and run cycle usually
+ involved in user interface development.
+
+ \annotatedlist geomanagement
+
+ \section1 Horizontal, Vertical, Grid, and Form Layouts
+
+ The easiest way to give your widgets a good layout is to use the built-in
+ layout managers: QHBoxLayout, QVBoxLayout, QGridLayout, and QFormLayout.
+ These classes inherit from QLayout, which in turn derives from QObject (not
+ QWidget). They take care of geometry management for a set of widgets. To
+ create more complex layouts, you can nest layout managers inside each other.
+
+ \list
+ \li A QHBoxLayout lays out widgets in a horizontal row, from left to
+ right (or right to left for right-to-left languages).
+ \image qhboxlayout-with-5-children.png
+
+ \li A QVBoxLayout lays out widgets in a vertical column, from top to
+ bottom.
+ \image qvboxlayout-with-5-children.png
+
+ \li A QGridLayout lays out widgets in a two-dimensional grid. Widgets
+ can occupy multiple cells.
+ \image qgridlayout-with-5-children.png
+
+ \li A QFormLayout lays out widgets in a 2-column descriptive label-
+ field style.
+ \image qformlayout-with-6-children.png
+ \endlist
+
+
+ \section2 Laying Out Widgets in Code
+
+ The following code creates a QHBoxLayout that manages the geometry of five
+ \l{QPushButton}{QPushButtons}, as shown on the first screenshot above:
+
+ \snippet layouts/layouts.cpp 0
+ \snippet layouts/layouts.cpp 1
+ \snippet layouts/layouts.cpp 2
+ \codeline
+ \snippet layouts/layouts.cpp 3
+ \snippet layouts/layouts.cpp 4
+ \snippet layouts/layouts.cpp 5
+
+ The code for QVBoxLayout is identical, except the line where the layout is
+ created. The code for QGridLayout is a bit different, because we need to
+ specify the row and column position of the child widget:
+
+ \snippet layouts/layouts.cpp 12
+ \snippet layouts/layouts.cpp 13
+ \snippet layouts/layouts.cpp 14
+ \codeline
+ \snippet layouts/layouts.cpp 15
+ \snippet layouts/layouts.cpp 16
+ \snippet layouts/layouts.cpp 17
+
+ The third QPushButton spans 2 columns. This is possible by specifying 2 as
+ the fifth argument to QGridLayout::addWidget().
+
+ QFormLayout will add two widgets on a row, commonly a QLabel and a QLineEdit
+ to create forms. Adding a QLabel and a QLineEdit on the same row will set
+ the QLineEdit as the QLabel's buddy. The following code will use the
+ QFormLayout to place three \l{QPushButton}{QPushButtons} and a corresponding
+ QLineEdit on a row.
+
+ \snippet layouts/layouts.cpp 18
+ \snippet layouts/layouts.cpp 19
+ \snippet layouts/layouts.cpp 20
+ \codeline
+ \snippet layouts/layouts.cpp 21
+ \snippet layouts/layouts.cpp 22
+ \snippet layouts/layouts.cpp 23
+
+
+ \section2 Tips for Using Layouts
+
+ When you use a layout, you do not need to pass a parent when constructing
+ the child widgets. The layout will automatically reparent the widgets
+ (using QWidget::setParent()) so that they are children of the widget on
+ which the layout is installed.
+
+ \note Widgets in a layout are children of the widget on which the layout
+ is installed, \e not of the layout itself. Widgets can only have other
+ widgets as parent, not layouts.
+
+ You can nest layouts using \c addLayout() on a layout; the inner layout
+ then becomes a child of the layout it is inserted into.
+
+
+ \section1 Adding Widgets to a Layout
+
+ When you add widgets to a layout, the layout process works as follows:
+
+ \list 1
+ \li All the widgets will initially be allocated an amount of space in
+ accordance with their QWidget::sizePolicy() and
+ QWidget::sizeHint().
+
+ \li If any of the widgets have stretch factors set, with a value
+ greater than zero, then they are allocated space in proportion to
+ their stretch factor (explained below).
+
+ \li If any of the widgets have stretch factors set to zero they will
+ only get more space if no other widgets want the space. Of these,
+ space is allocated to widgets with an
+ \l{QSizePolicy::Expanding}{Expanding} size policy first.
+
+ \li Any widgets that are allocated less space than their minimum size
+ (or minimum size hint if no minimum size is specified) are
+ allocated this minimum size they require. (Widgets don't have to
+ have a minimum size or minimum size hint in which case the stretch
+ factor is their determining factor.)
+
+ \li Any widgets that are allocated more space than their maximum size
+ are allocated the maximum size space they require. (Widgets do not
+ have to have a maximum size in which case the stretch factor is
+ their determining factor.)
+ \endlist
+
+
+ \section2 Stretch Factors
+ \keyword stretch factor
+
+ Widgets are normally created without any stretch factor set. When they are
+ laid out in a layout the widgets are given a share of space in accordance
+ with their QWidget::sizePolicy() or their minimum size hint whichever is
+ the greater. Stretch factors are used to change how much space widgets are
+ given in proportion to one another.
+
+ If we have three widgets laid out using a QHBoxLayout with no stretch
+ factors set we will get a layout like this:
+
+ \img layout1.png Three widgets in a row
+
+ If we apply stretch factors to each widget, they will be laid out in
+ proportion (but never less than their minimum size hint), e.g.
+
+ \img layout2.png Three widgets with different stretch factors in a row
+
+
+ \section1 Custom Widgets in Layouts
+
+ When you make your own widget class, you should also communicate its layout
+ properties. If the widget has a one of Qt's layouts, this is already taken
+ care of. If the widget does not have any child widgets, or uses manual
+ layout, you can change the behavior of the widget using any or all of the
+ following mechanisms:
+
+ \list
+ \li Reimplement QWidget::sizeHint() to return the preferred size of the
+ widget.
+ \li Reimplement QWidget::minimumSizeHint() to return the smallest size
+ the widget can have.
+ \li Call QWidget::setSizePolicy() to specify the space requirements of
+ the widget.
+ \endlist
+
+ Call QWidget::updateGeometry() whenever the size hint, minimum size hint or
+ size policy changes. This will cause a layout recalculation. Multiple
+ consecutive calls to QWidget::updateGeometry() will only cause one layout
+ recalculation.
+
+ If the preferred height of your widget depends on its actual width (e.g.,
+ a label with automatic word-breaking), set the
+ \l{QSizePolicy::hasHeightForWidth()}{height-for-width} flag in the
+ widget's \l{QWidget::sizePolicy}{size policy} and reimplement
+ QWidget::heightForWidth().
+
+ Even if you implement QWidget::heightForWidth(), it is still a good idea to
+ provide a reasonable sizeHint().
+
+ For further guidance when implementing these functions, see the
+ \e{Qt Quarterly} article
+ \l{http://doc.qt.nokia.com/qq/qq04-height-for-width.html}
+ {Trading Height for Width}.
+
+
+ \section1 Layout Issues
+
+ The use of rich text in a label widget can introduce some problems to the
+ layout of its parent widget. Problems occur due to the way rich text is
+ handled by Qt's layout managers when the label is word wrapped.
+
+ In certain cases the parent layout is put into QLayout::FreeResize mode,
+ meaning that it will not adapt the layout of its contents to fit inside
+ small sized windows, or even prevent the user from making the window too
+ small to be usable. This can be overcome by subclassing the problematic
+ widgets, and implementing suitable \l{QWidget::}{sizeHint()} and
+ \l{QWidget::}{minimumSizeHint()} functions.
+
+ In some cases, it is relevant when a layout is added to a widget. When
+ you set the widget of a QDockWidget or a QScrollArea (with
+ QDockWidget::setWidget() and QScrollArea::setWidget()), the layout must
+ already have been set on the widget. If not, the widget will not be
+ visible.
+
+
+ \section1 Manual Layout
+
+ If you are making a one-of-a-kind special layout, you can also make a
+ custom widget as described above. Reimplement QWidget::resizeEvent() to
+ calculate the required distribution of sizes and call
+ \l{QWidget::}{setGeometry()} on each child.
+
+ The widget will get an event of type QEvent::LayoutRequest when the
+ layout needs to be recalculated. Reimplement QWidget::event() to handle
+ QEvent::LayoutRequest events.
+
+
+ \section1 How to Write A Custom Layout Manager
+
+ An alternative to manual layout is to write your own layout manager by
+ subclassing QLayout. The \l{layouts/borderlayout}{Border Layout} and
+ \l{layouts/flowlayout}{Flow Layout} examples show how to do this.
+
+ Here we present an example in detail. The \c CardLayout class is inspired
+ by the Java layout manager of the same name. It lays out the items (widgets
+ or nested layouts) on top of each other, each item offset by
+ QLayout::spacing().
+
+ To write your own layout class, you must define the following:
+ \list
+ \li A data structure to store the items handled by the layout. Each
+ item is a \link QLayoutItem QLayoutItem\endlink. We will use a
+ QList in this example.
+ \li \l{QLayout::}{addItem()}, how to add items to the layout.
+ \li \l{QLayout::}{setGeometry()}, how to perform the layout.
+ \li \l{QLayout::}{sizeHint()}, the preferred size of the layout.
+ \li \l{QLayout::}{itemAt()}, how to iterate over the layout.
+ \li \l{QLayout::}{takeAt()}, how to remove items from the layout.
+ \endlist
+
+ In most cases, you will also implement \l{QLayout::}{minimumSize()}.
+
+
+ \section2 The Header File (\c card.h)
+
+ \snippet code/doc_src_layout.cpp 0
+
+
+ \section2 The Implementation File (\c card.cpp)
+
+ \snippet code/doc_src_layout.cpp 1
+
+ First we define \c{count()} to fetch the number of items in the list.
+
+ \snippet code/doc_src_layout.cpp 2
+
+ Then we define two functions that iterate over the layout: \c{itemAt()}
+ and \c{takeAt()}. These functions are used internally by the layout system
+ to handle deletion of widgets. They are also available for application
+ programmers.
+
+ \c{itemAt()} returns the item at the given index. \c{takeAt()} removes the
+ item at the given index, and returns it. In this case we use the list index
+ as the layout index. In other cases where we have a more complex data
+ structure, we may have to spend more effort defining a linear order for the
+ items.
+
+ \snippet code/doc_src_layout.cpp 3
+
+ \c{addItem()} implements the default placement strategy for layout items.
+ This function must be implemented. It is used by QLayout::add(), by the
+ QLayout constructor that takes a layout as parent. If your layout has
+ advanced placement options that require parameters, you must provide extra
+ access functions such as the row and column spanning overloads of
+ QGridLayout::addItem(), QGridLayout::addWidget(), and
+ QGridLayout::addLayout().
+
+ \snippet code/doc_src_layout.cpp 4
+
+ The layout takes over responsibility of the items added. Since QLayoutItem
+ does not inherit QObject, we must delete the items manually. In the
+ destructor, we remove each item from the list using \c{takeAt()}, and
+ then delete it.
+
+ \snippet code/doc_src_layout.cpp 5
+
+ The \c{setGeometry()} function actually performs the layout. The rectangle
+ supplied as an argument does not include \c{margin()}. If relevant, use
+ \c{spacing()} as the distance between items.
+
+ \snippet code/doc_src_layout.cpp 6
+
+ \c{sizeHint()} and \c{minimumSize()} are normally very similar in
+ implementation. The sizes returned by both functions should include
+ \c{spacing()}, but not \c{margin()}.
+
+ \snippet code/doc_src_layout.cpp 7
+
+
+ \section2 Further Notes
+
+ \list
+ \li This custom layout does not handle height for width.
+ \li We ignore QLayoutItem::isEmpty(); this means that the layout will
+ treat hidden widgets as visible.
+ \li For complex layouts, speed can be greatly increased by caching
+ calculated values. In that case, implement
+ QLayoutItem::invalidate() to mark the cached data is dirty.
+ \li Calling QLayoutItem::sizeHint(), etc. may be expensive. So, you
+ should store the value in a local variable if you need it again
+ later within in the same function.
+ \li You should not call QLayoutItem::setGeometry() twice on the same
+ item in the same function. This call can be very expensive if the
+ item has several child widgets, because the layout manager must do
+ a complete layout every time. Instead, calculate the geometry and
+ then set it. (This does not only apply to layouts, you should do
+ the same if you implement your own resizeEvent(), for example.)
+ \endlist
+*/
+
diff --git a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
new file mode 100644
index 0000000000..d6706d7994
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
@@ -0,0 +1,2102 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group appearance
+ \title Widget Appearance and Style
+ \brief Classes used for customizing UI appearance and style.
+*/
+
+/*!
+ \page style-reference.html
+ \title Styles and Style Aware Widgets
+ \ingroup qt-gui-concepts
+ \brief Styles and the styling of widgets.
+
+ Styles (classes that inherit QStyle) draw on behalf of widgets
+ and encapsulate the look and feel of a GUI. The QStyle class is
+ an abstract base class that encapsulates the look and feel of a
+ GUI. Qt's built-in widgets use it to perform nearly all of their
+ drawing, ensuring that they look exactly like the equivalent
+ native widgets.
+
+ Several styles are built into Qt (e.g., windows style and motif style).
+ Other styles are only available on specific platforms (such as
+ the windows XP style). Custom styles are made available as plugins
+ or by creating an instance of the style class in an application and
+ setting it with QApplication::setStyle().
+
+ To implement a new style, you inherit one of Qt's existing styles
+ - the one most resembling the style you want to create - and
+ reimplement a few virtual functions. This process is somewhat
+ involved, and we therefore provide this overview. We give a
+ step-by-step walkthrough of how to style individual Qt widgets.
+ We will examine the QStyle virtual functions, member variables,
+ and enumerations.
+
+ The part of this document that does not concern the styling of
+ individual widgets is meant to be read sequentially because later
+ sections tend to depend on earlier ones. The description of the
+ widgets can be used for reference while implementing a style.
+ However, you may need to consult the Qt source code in some cases.
+ The sequence in the styling process should become clear after
+ reading this document, which will aid you in locating relevant code.
+
+ To develop style aware widgets (i.e., widgets that conform to
+ the style in which they are drawn), you need to draw them using the
+ current style. This document shows how widgets draw themselves
+ and which possibilities the style gives them.
+
+ \section1 Classes for Widget Styling
+
+ These classes are used to customize an application's appearance and
+ style.
+
+ \annotatedlist appearance
+
+ \section1 The QStyle implementation
+
+ The API of QStyle contains functions that draw the widgets, static
+ helper functions to do common and difficult tasks (e.g.,
+ calculating the position of slider handles) and functions to do
+ the various calculations necessary while drawing (e.g., for the
+ widgets to calculate their size hints). The style also help some
+ widgets with the layout of their contents. In addition, it creates
+ a QPalette that contains \l{QBrush}es to draw with.
+
+ QStyle draws graphical elements; an element is a widget or a
+ widget part like a push button bevel, a window frame, or a scroll
+ bar. Most draw functions now take four arguments:
+
+ \list
+ \li an enum value specifying which graphical element to draw
+ \li a QStyleOption specifying how and where to render that element
+ \li a QPainter that should be used to draw the element
+ \li a QWidget on which the drawing is performed (optional)
+ \endlist
+
+ When a widget asks a style to draw an element, it provides the style
+ with a QStyleOption, which is a class that contains the information
+ necessary for drawing. Thanks to QStyleOption, it is possible to make
+ QStyle draw widgets without linking in any code for the widget. This
+ makes it possible to use \l{QStyle}'s draw functions on any paint
+ device, i.e., you can draw a combobox on any widget, not just on a
+ QComboBox.
+
+ The widget is passed as the last argument in case the style needs
+ it to perform special effects (such as animated default buttons on
+ Mac OS X), but it isn't mandatory.
+
+ We will in the course of this section look at the style elements,
+ the style options, and the functions of QStyle. Finally, we describe
+ how the palette is used.
+
+ Items in item views is drawn by \l{Delegate Classes}{delegates} in
+ Qt. The item view headers are still drawn by the style. Qt's
+ default delegate, QStyledItemDelegate, draws its items partially
+ through the current style; it draws the check box indicators and
+ calculate bounding rectangles for the elements of which the item
+ consists. In this document, we only describe how to implement a
+ QStyle subclass. If you wish to add support for other datatypes
+ than those supported by the QStyledItemDelegate, you need to
+ implement a custom delegate. Note that delegates must be set
+ programmatically for each individual widget (i.e., default
+ delegates cannot be provided as plugins).
+
+ \section2 The Style Elements
+
+ A style element is a graphical part of a GUI. A widget consists
+ of a hierarchy (or tree) of style elements. For instance, when a
+ style receives a request to draw a push button (from QPushButton,
+ for example), it draws a label (text and icon), a button bevel,
+ and a focus frame. The button bevel, in turn, consists of a frame
+ around the bevel and two other elements, which we will look at
+ later. Below is a conceptual illustration of the push button
+ element tree. We will see the actual tree for QPushButton when we
+ go through the individual widgets.
+
+ \image javastyle/conceptualpushbuttontree.png
+
+ Widgets are not necessarily drawn by asking the style to draw
+ only one element. Widgets can make several calls to the style to
+ draw different elements. An example is QTabWidget, which draws its
+ tabs and frame individually.
+
+ There are three element types: primitive elements, control
+ elements, and complex control elements. The elements are defined
+ by the \l{QStyle::}{ComplexControl}, \l{QStyle::}{ControlElement},
+ and \l{QStyle::}{PrimitiveElement} enums. The values of
+ each element enum has a prefix to identify their type: \c{CC_} for
+ complex elements, \c{CE_} for control elements, and \c{PE_} for
+ primitive elements. We will in the following three sections see what
+ defines the different elements and see examples of widgets that use
+ them.
+
+ The QStyle class description contains a list of these elements and
+ their roles in styling widgets. We will see how they are used when
+ we style individual widgets.
+
+ \section3 Primitive Elements
+
+ Primitive elements are GUI elements that are common and often used
+ by several widgets. Examples of these are frames, button bevels,
+ and arrows for spin boxes, scroll bars, and combo boxes.
+ Primitive elements cannot exist on their own: they are always part
+ of a larger construct. They take no part in the interaction with
+ the user, but are passive decorations in the GUI.
+
+ \section3 Control Elements
+
+ A control element performs an action or displays information
+ to the user. Examples of control elements are push buttons, check
+ boxes, and header sections in tables and tree views. Control
+ elements are not necessarily complete widgets such as push
+ buttons, but can also be widget parts such as tab bar tabs and
+ scroll bar sliders. They differ from primitive elements in that
+ they are not passive, but fill a function in the interaction with
+ the user. Controls that consist of several elements often use the
+ style to calculate the bounding rectangles of the elements. The
+ available sub elements are defined by the \l{QStyle::}{SubElement}
+ enum. This enum is only used for calculating bounding rectangles,
+ and sub elements are as such not graphical elements to be drawn
+ like primitive, control, and complex elements.
+
+ \section3 Complex Control Elements
+
+ Complex control elements contain sub controls. Complex controls
+ behave differently depending on where the user handles them with
+ the mouse and which keyboard keys are pressed. This is dependent
+ on which sub control (if any) that the mouse is over or received a
+ mouse press. Examples of complex controls are scroll bars and
+ combo boxes. With a scroll bar, you can use the mouse to move the
+ slider and press the line up and line down buttons. The available
+ sub controls are defined by the \l{QStyle}{SubControl} enum.
+
+ In addition to drawing, the style needs to provide the widgets
+ with information on which sub control (if any) a mouse press was
+ made on. For instance, a QScrollBar needs to know if the user
+ pressed the slider, the slider groove, or one of the buttons.
+
+ Note that sub controls are not the same as the control elements
+ described in the previous section. You cannot use the style to
+ draw a sub control; the style will only calculate the bounding
+ rectangle in which the sub control should be drawn. It is common,
+ though, that complex elements use control and primitive elements
+ to draw their sub controls, which is an approach that is
+ frequently used by the built-in styles in Qt and also the Java
+ style. For instance, the Java style uses PE_IndicatorCheckBox to
+ draw the check box in group boxes (which is a sub control of
+ CC_GroupBox). Some sub controls have an equivalent control element,
+ e.g., the scroll bar slider (SC_SCrollBarSlider and
+ CE_ScrollBarSlider).
+
+ \section3 Other QStyle Tasks
+
+ The style elements and widgets, as mentioned, use the style to
+ calculate bounding rectangles of sub elements and sub controls,
+ and pixel metrics, which is a style dependent size in screen
+ pixels, for measures when drawing. The available rectangles and
+ pixel metrics are represented by three enums in QStyle:
+ \l{QStyle::}{SubElement}, \l{QStyle::}{SubControl}, and
+ \l{QStyle::}{PixelMetric}. Values of the enums can easily by
+ identified as they start with SE_, SC_ and PM_.
+
+ The style also contain a set of style hints, which is
+ represented as values in the \l{QStyle::}{StyleHint} enum. All
+ widgets do not have the same functionality and look in the
+ different styles. For instance, when the menu items in a menu do not
+ fit in a single column on the screen, some styles support
+ scrolling while others draw more than one column to fit all items.
+
+ A style usually has a set of standard images (such as a warning, a
+ question, and an error image) for message boxes, file dialogs,
+ etc. QStyle provides the \l{QStyle::}{StandardPixmap} enum. Its
+ values represent the standard images. Qt's widgets use these, so
+ when you implement a custom style you should supply the images
+ used by the style that is being implemented.
+
+ The style calculates the spacing between widgets in layouts. There
+ are two ways the style can handle these calculations. You can set
+ the PM_LayoutHorizontalSpacing and PM_LayoutVerticalSpacing, which
+ is the way the java style does it (through QCommonStyle).
+ Alternatively, you can implement QStyle::layoutSpacing() and
+ QStyle::layoutSpacingImplementation() if you need more control over
+ this part of the layout. In these functions you can calculate the
+ spacing based on control types (QSizePolicy::ControlType) for
+ different size policies (QSizePolicy::Policy) and also the style
+ option for the widget in question.
+
+ \section2 Style Options
+
+ The sub-classes of QStyleOption contain all information necessary
+ to style the individual elements. Style options are instantiated -
+ usually on the stack - and filled out by the caller of the QStyle
+ function. Depending on what is drawn the style will expect
+ different a different style option class. For example, the
+ QStyle::PE_FrameFocusRect element expects a QStyleOptionFocusRect
+ argument, and it's possible to create custom subclasses that a
+ custom style can use. The style options keep public variables
+ for performance reasons.
+
+ The widgets can be in a number of different states, which are
+ defined by the \l{QStyle::}{State} enum. Some of the state flags have
+ different meanings depending on the widget, but others are common
+ for all widgets like State_Disabled. It is QStyleOption that sets
+ the common states with QStyleOption::initFrom(); the rest of the
+ states are set by the individual widgets.
+
+ Most notably, the style options contain the palette and bounding
+ rectangles of the widgets to be drawn. Most widgets have
+ specialized style options. QPushButton and QCheckBox, for
+ instance, use QStyleOptionButton as style option, which contain
+ the text, icon, and the size of their icon. The exact contents of
+ all options are described when we go through individual widgets.
+
+ When reimplementing QStyle functions that take a
+ QStyleOption parameter, you often need to cast the
+ QStyleOption to a subclass (e.g., QStyleOptionFocusRect). For
+ safety, you can use qstyleoption_cast() to ensure that the
+ pointer type is correct. If the object isn't of the right type,
+ qstyleoption_cast() returns 0. For example:
+
+ \snippet code/doc_src_qt4-styles.cpp 0
+
+ The following code snippet illustrates how to use QStyle to
+ draw the focus rectangle from a custom widget's paintEvent():
+
+ \snippet code/doc_src_qt4-styles.cpp 1
+
+ The next example shows how to derive from an existing style to
+ customize the look of a graphical element:
+
+ \snippet customstyle/customstyle.h 0
+ \codeline
+ \snippet customstyle/customstyle.cpp 2
+ \snippet customstyle/customstyle.cpp 3
+ \snippet customstyle/customstyle.cpp 4
+
+ \section2 QStyle Functions
+
+ The QStyle class defines three functions for drawing the primitive,
+ control, and complex elements:
+ \l{QStyle::}{drawPrimitive()},
+ \l{QStyle::}{drawControl()}, and
+ \l{QStyle::}{drawComplexControl()}. The functions takes the
+ following parameters:
+
+ \list
+ \li the enum value of the element to draw
+ \li a QStyleOption which contains the information needed to
+ draw the element.
+ \li a QPainter with which to draw the element.
+ \li a pointer to a QWidget, typically the widget
+ that the element is painted on.
+ \endlist
+
+ Not all widgets send a pointer to themselves. If the style
+ option sent to the function does not contain the information you
+ need, you should check the widget implementation to see if it
+ sends a pointer to itself.
+
+ The QStyle class also provides helper functions that are used
+ when drawing the elements. The \l{QStyle::}{drawItemText()}
+ function draws text within a specified rectangle and taking a
+ QPalette as a parameter. The \l{QStyle::}{drawItemPixmap()}
+ function helps to align a pixmap within a specified bounding
+ rectangle.
+
+ Other QStyle functions do various calculations for the
+ functions that draw. The widgets also use these functions for
+ calculating size hints and also for bounding rectangle
+ calculations if they draw several style elements themselves.
+ As with the functions that draw elements the helper functions
+ typically takes the same arguments.
+
+ \list
+ \li The \l{QStyle::}{subElementRect()} function takes a
+ \l{QStyle::}{SubElement} enum value, and calculates a bounding
+ rectangle for a sub element. The style uses this function to
+ know where to draw the different parts of an element. This is
+ mainly done for reuse. If you create a new style, you can use
+ the same location of sub elements as the super class.
+
+ \li The \l{QStyle::}{subControlRect()} function is used to
+ calculate bounding rectangles for sub controls in complex
+ controls. When you implement a new style, you reimplement \c
+ subControlRect() and calculate the rectangles that are different
+ from the super class.
+
+ \li The \l{QStyle::}{pixelMetric()} function returns a pixel
+ metric, which is a style dependent size given in screen
+ pixels. It takes a value of the \l{QStyle::}{PixelMetric} enum
+ and returns the correct measure. Note that pixel metrics do
+ not necessarily have to be static measures, but can be
+ calculated with, for example, the style option.
+
+ \li The \l{QStyle::}{hitTestComplexControl()} function returns the
+ sub control that the mouse pointer is over in a complex control.
+ Usually, this is simply a matter of using
+ \l{QStyle::}{subControlRect()} to get the bounding rectangles of
+ the sub controls, and see which rectangle contains the position of
+ the cursor.
+ \endlist
+
+ QStyle also have the functions \l{QStyle::}{polish()} and
+ \l{QStyle::}{unpolish()}. All widgets are sent to the \c polish()
+ function before being shown and to \c unpolish() when they
+ are hidden. You can use these functions to set attributes on the
+ widgets or do other work that is required by your style. For
+ instance, if you need to know when the mouse is hovering over the
+ widget, you need to set the \l{Qt::}{WA_Hover} widget attribute.
+ The State_MouseOver state flag will then be set in the widget's
+ style options.
+
+ QStyle has a few static helper functions that do some common and
+ difficult tasks. They can calculate the position of a slider
+ handle from the value of the slider and transform rectangles
+ and draw text considering reverse layouts; see the QStyle
+ class documentation for more details.
+
+ The usual approach when one reimplements QStyle virtual
+ functions is to do work on elements that are different from the
+ super class; for all other elements, you can simply use the super
+ class implementation.
+
+ \section2 The Palette
+
+ Each style provides a color - that is, QBrush - palette that
+ should be used for drawing the widgets. There is one set of colors
+ for the different widget states (QPalette::ColorGroup): active
+ (widgets in the window that has keyboard focus), inactive (widgets
+ used for other windows), and disabled (widgets that are set
+ disabled). The states can be found by querying the State_Active
+ and State_Enabled state flags. Each set contains color certain
+ roles given by the QPalette::ColorRole enum. The roles describe in
+ which situations the colors should be used (e.g., for painting
+ widget backgrounds, text, or buttons).
+
+ How the color roles are used is up to the style. For instance, if
+ the style uses gradients, one can use a palette color and make it
+ darker or lighter with QColor::darker() and QColor::lighter() to
+ create the gradient. In general, if you need a brush that is not
+ provided by the palette, you should try to derive it from one.
+
+ QPalette, which provides the palette, stores colors for
+ different widget states and color roles. The palette for a style
+ is returned by \l{QStyle::}{standardPalette()}. The standard
+ palette is not installed automatically when a new style is set
+ on the application (QApplication::setStyle()) or widget
+ (QWidget::setStyle()), so you must set the palette yourself
+ with (QApplication::setPalette()) or (QWidget::setPalette()).
+
+ It is not recommended to hard code colors as applications and
+ individual widgets can set their own palette and also use the
+ styles palette for drawing. Note that none of Qt's widgets set
+ their own palette. The java style does hard code some colors, but
+ its author looks past this in silence. Of course, it is not
+ intended that the style should look good with any palette.
+
+ \section2 Implementation Issues
+
+ When you implement styles, there are several issues to
+ consider. We will give some hints and advice on implementation
+ here.
+
+ When implementing styles, it is necessary to look through the
+ code of the widgets and code of the base class and its ancestors.
+ This is because the widgets use the style differently, because the
+ implementation in the different styles virtual functions can
+ affect the state of the drawing (e.g., by altering the QPainter
+ state without restoring it and drawing some elements without using
+ the appropriate pixel metrics and sub elements).
+
+ It is recommended that the styles do not alter the proposed size
+ of widgets with the QStyle::sizeFromContents() function but let
+ the QCommonStyle implementation handle it. If changes need to be
+ made, you should try to keep them small; application development
+ may be difficult if the layout of widgets looks considerably
+ different in the various styles.
+
+ We recommend using the QPainter directly for drawing, i.e., not
+ use pixmaps or images. This makes it easier for the style conform
+ to the palette (although you can set your own color table on a
+ QImage with \l{QImage::}{setColorTable()}).
+
+ It is, naturally, possible to draw elements without using the
+ style to draw the sub elements as intended by Qt. This is
+ discouraged as custom widgets may depend on these sub elements to
+ be implemented correctly. The widget walkthrough shows how Qt
+ uses the sub elements.
+
+ \section1 Java Style
+
+ We have implemented a style that resembles the Java default look
+ and feel (previously known as Metal). We have done this as it is
+ relatively simple to implement and we wanted to build a style for
+ this overview document. To keep it simple and not to extensive, we
+ have simplified the style somewhat, but Qt is perfectly able to
+ make an exact copy of the style. However, there are no concrete
+ plans to implement the style as a part of Qt.
+
+ In this section we will have a look at some implementation
+ issues. Finally, we will see a complete example on the styling of
+ a Java widget. We will continue to use the java style
+ throughout the document for examples and widget images. The
+ implementation itself is somewhat involved, and it is not
+ intended that you should read through it.
+
+ \section2 Design and Implementation
+
+ The first step in designing the style was to select the base
+ class. We chose to subclass QWindowsStyle. This class implements
+ most of the functionality we need other than performing the actual
+ drawing. Also, windows and java share layout of sub controls for
+ several of the complex controls (which reduces the amount of code
+ required considerably).
+
+ The style is implemented in one class. We have done this
+ because we find it convenient to keep all code in one file. Also,
+ it is an advantage with regards to optimization as we instantiate
+ less objects. We also keep the number of functions at a minimum by
+ using switches to identify which element to draw in the functions.
+ This results in large functions, but since we divide the code for
+ each element in the switches, the code should still be easy to
+ read.
+
+ \section2 Limitations and Differences from Java
+
+ We have not fully implemented every element in the Java style.
+ This way, we have reduced the amount and complexity of the code.
+ In general, the style was intended as a practical example for
+ this style overview document, and not to be a part of Qt
+ itself.
+
+ Not all widgets have every state implemented. This goes for
+ states that are common, e.g., State_Disabled. Each state is,
+ however, implemented for at least one widget.
+
+ We have only implemented ticks below the slider. Flat push
+ buttons are also left out. We do not handle the case where the
+ title bars and dock window titles grows to small for their
+ contents, but simply draw sub controls over each other.
+
+ We have not tried to emulate the Java fonts. Java and Qt use very
+ different font engines, so we don't consider it worth the effort
+ as we only use the style as an example for this overview.
+
+ We have hardcoded the colors (we don't use the QPalette) for
+ the linear gradients, which are used, for example, for button
+ bevels, tool bars, and check boxes. This is because the Java
+ palette cannot produce these colors. Java does not change these
+ colors based on widget color group or role anyway (they are not
+ dependent on the palette), so it does not present a problem in any
+ case.
+
+ It is Qt's widgets that are styled. Some widgets do not exist
+ at all in Java, e.g., QToolBox. Others contain elements that the
+ Java widgets don't. The tree widget is an example of the latter in
+ which Java's JTree does not have a header.
+
+ The style does not handle reverse layouts. We assume that the
+ layout direction is left to right. QWindowsStyle handles reverse
+ widgets; if we implemented reverse layouts, widgets that we change
+ the position of sub elements, or handle text alignment in labels
+ our selves would need to be updated.
+
+ \section2 Styling Java Check Boxes
+
+ As an example, we will examine the styling of check boxes in the
+ java style. We describe the complete process and print all code in
+ both the java style and Qt classes involved. In the rest of this
+ document, we will not examine the source code of the individual
+ widgets. Hopefully, this will give you an idea on how to search
+ through the code if you need to check specific implementation
+ details; most widgets follow the same structure as the check
+ boxes. We have edited the QCommonStyle code somewhat to remove
+ code that is not directly relevant for check box styling.
+
+ We start with a look at how QCheckBox builds it style option,
+ which is QStyleOptionButton for checkboxes:
+
+ \snippet code/doc_src_styles.cpp 0
+
+ First we let QStyleOption set up the option with the information
+ that is common for all widgets with \c initFrom(). We will look at
+ this shortly.
+
+ The down boolean is true when the user press the box down; this is
+ true whether the box is checked or not of the checkbox. The
+ State_NoChange state is set when we have a tristate checkbox and
+ it is partially checked. It has State_On if the box is checked and
+ State_Off if it is unchecked. State_MouseOver is set if the mouse
+ hovers over the checkbox and the widget has attribute Qt::WA_Hover
+ set - you set this in QStyle::polish(). In addition, the style
+ option also contains the text, icon, and icon size of the button.
+
+ \l{QStyleOption::}{initFrom()} sets up the style option with the
+ attributes that are common for all widgets. We print its
+ implementation here:
+
+ \snippet code/doc_src_styles.cpp 1
+
+ The State_Enabled is set when the widget is enabled. When the
+ widget has focus the State_HasFocus flag is set. Equally, the
+ State_Active flag is set when the widget is a child of the active
+ window. The State_MouseOver will only be set if the widget has
+ the WA_HoverEnabled windows flag set. Notice that keypad
+ navigation must be enabled in Qt for the State_HasEditFocus to
+ be included; it is not included by default.
+
+ In addition to setting state flags the QStyleOption contains
+ other information about the widget: \c direction is the layout
+ direction of the layout, \c rect is the bounding rectangle of the
+ widget (the area in which to draw), \c palette is the QPalette
+ that should be used for drawing the widget, and \c fontMetrics is
+ the metrics of the font that is used by the widget.
+
+ We give an image of a checkbox and the style option to match
+ it.
+
+ \image javastyle/checkboxexample.png A java style checkbox
+
+ The above checkbox will have the following state flags in its
+ style option:
+
+ \table 90%
+ \header
+ \li State flag
+ \li Set
+ \row
+ \li State_Sunken
+ \li Yes
+ \row
+ \li State_NoChange
+ \li No
+ \row
+ \li State_On
+ \li Yes
+ \row
+ \li State_Off
+ \li No
+ \row
+ \li State_MouseOver
+ \li Yes
+ \row
+ \li State_Enabled
+ \li Yes
+ \row
+ \li State_HasFocus
+ \li Yes
+ \row
+ \li State_KeyboardFocusChange
+ \li No
+ \row
+ \li State_Active
+ \li Yes
+ \endtable
+
+ The QCheckBox paints itself in QWidget::paintEvent() with
+ style option \c opt and QStylePainter \c p. The QStylePainter
+ class is a convenience class to draw style elements. Most
+ notably, it wraps the methods in QStyle used for painting. The
+ QCheckBox draws itself as follows:
+
+ \snippet code/doc_src_styles.cpp 2
+
+ QCommonStyle handles the CE_CheckBox element. The QCheckBox
+ has two sub elements: SE_CheckBoxIndicator (the checked indicator)
+ and SE_CheckBoxContents (the contents, which is used for the
+ checkbox label). QCommonStyle also implements these sub element
+ bounding rectangles. We have a look at the QCommonStyle code:
+
+ \snippet code/doc_src_styles.cpp 3
+
+ As can be seen from the code extract, the common style gets
+ the bounding rectangles of the two sub elements of
+ CE_CheckBox, and then draws them. If the checkbox has focus,
+ the focus frame is also drawn.
+
+ The java style draws CE_CheckBoxIndicator, while QCommonStyle
+ handles CE_CheckboxLabel. We will examine each implementation and
+ start with CE_CheckBoxLabel:
+
+ \snippet code/doc_src_styles.cpp 4
+
+ \l{QStyle::}{visualAlignment()} adjusts the alignment of text
+ according to the layout direction. We then draw an icon if it
+ exists, and adjust the space left for the text.
+ \l{QStyle::}{drawItemText()} draws the text taking alignment,
+ layout direction, and the mnemonic into account. It also uses the
+ palette to draw the text in the right color.
+
+ The drawing of labels often get somewhat involved. Luckily, it
+ can usually be handled by the base class. The java style
+ implements its own push button label since Java-contrary to
+ windows-center button contents also when the button has an icon.
+ You can examine that implementation if you need an example of
+ reimplementing label drawing.
+
+ We take a look at the java implementation
+ of CE_CheckBoxIndicator in \c drawControl():
+
+ \snippet javastyle.cpp 0
+
+ We first save the state of the painter. This is not always
+ necessary but in this case the QWindowsStyle needs the painter in
+ the same state as it was when PE_IndicatorCheckBox was called (We
+ could also set the state with function calls, of course). We then
+ use \c drawButtonBackground() to draw the background of the check
+ box indicator. This is a helper function that draws the background
+ and also the frame of push buttons and check boxes. We take a look
+ at that function below. We then check if the mouse is hovering
+ over the checkbox. If it is, we draw the frame java checkboxes
+ have when the box is not pressed down and the mouse is over it.
+ You may note that java does not handle tristate boxes, so we have
+ not implemented it.
+
+ Here we use a png image for our indicator. We could also check
+ here if the widget is disabled. We would then have to use
+ another image with the indicator in the disabled color.
+
+ \snippet javastyle.cpp 1
+
+ We have seen how check boxes are styled in the java style from the
+ widget gets a paint request to the style is finished painting. To
+ learn in detail how each widget is painted, you need to go through
+ the code step-by-step as we have done here. However, it is
+ usually enough to know which style elements the widgets draw. The
+ widget builds a style option and calls on the style one or more
+ times to draw the style elements of which it consists. Usually,
+ it is also sufficient to know the states a widget can be in and the
+ other contents of the style option, i.e., what we list in the next
+ section.
+
+ \section1 Widget Walkthrough
+
+ In this section, we will examine how most of Qt's widgets are
+ styled. Hopefully, this will save you some time and effort while
+ developing your own styles and widgets. You will not find
+ information here that is not attainable elsewhere (i.e., by
+ examining the source code or the class descriptions for the style
+ related classes).
+
+ We mostly use java style widgets as examples. The java style does not
+ draw every element in the element trees. This is because they are
+ not visible for that widget in the java style. We still make sure
+ that all elements are implemented in a way that conforms with the
+ java style as custom widgets might need them (this does not
+ exclude leaving implementations to QWindowsStyle though).
+
+ The following is given for each widget:
+
+ \list
+ \li A table with the members (variables, etc.) of its style option.
+ \li A table over the state flags (QStyle::StateFlag) that
+ can be set on the widget and when the states are set.
+ \li Its element tree (see section \l{The Style Elements}).
+ \li An image of the widget in which the elements are outlined.
+ \omit This is not written yet - probably never will be
+ either
+ \li List of style hints that should be checked for the
+ widget.
+ \li List of standard pixmaps that could be used by the
+ elements.
+ \endomit
+ \endlist
+
+ The element tree contains the primitive, control, and complex
+ style elements. By doing a top-down traversal of the element tree,
+ you get the sequence in which the elements should be drawn. In the
+ nodes, we have written the sub element rectangles, sub control
+ elements, and pixel metrics that should be considered when drawing
+ the element of the node.
+
+ Our approach on styling center on the drawing of the widgets. The
+ calculations of sub elements rectangles, sub controls, and pixel
+ metrics used \b during drawing is only listed as contents in
+ the element trees. Note that there are rectangles and pixel
+ metrics that are only used by widgets. This leaves these
+ calculations untreated in the walkthrough. For instance, the
+ \l{QStyle::}{subControlRect()} and
+ \l{QStyle::}{sizeFromContents()} functions often call
+ \l{QStyle::}{subElementRect()} to calculate their bounding
+ rectangles. We could draw trees for this as well. However, how
+ these calculations are done is completely up to the individual
+ styles, and they do not have to follow a specific structure (Qt
+ does not impose a specific structure). You should still make sure
+ that you use the appropriate pixel metrics, though. To limit the
+ size of the document, we have therefore chosen not to include
+ trees or describe the calculations made by the Java (or any other)
+ style.
+
+ You may be confused about how the different pixel metrics, sub
+ element rectangles, and sub control rectangles should be used when
+ examining the trees. If you are in doubt after reading the QStyle
+ enum descriptions, we suggest that you examine the QCommonStyle
+ and QWindowsStyle implementations.
+
+ Some of the bounding rectangles that we outline in the widget
+ images are equal. Reasons for this are that some elements draw
+ backgrounds while others draw frames and labels. If in doubt,
+ check the description of each element in QStyle. Also, some
+ elements are there to layout, i.e., decide where to draw, other
+ elements.
+
+ \section2 Common Widget Properties
+
+ Some states and variables are common for all widgets. These are
+ set with QStyleOption::initFrom(). Not all elements use this function;
+ it is the widgets that create the style options, and for some
+ elements the information from \l{QStyleOption::}{initFrom()} is not
+ necessary.
+
+ A table with the common states follows:
+
+ \table 90%
+ \header
+ \li State
+ \li State Set When
+ \row
+ \li State_Enabled
+ \li Set if the widget is not disabled (see
+ QWidget::setEnabled())
+ \row
+ \li State_Focus
+ \li Set if the widget has focus (see
+ QWidget::hasFocus())
+ \row
+ \li State_KeyobordFocusChange
+ \li Set when the user changes focus with the keyboard
+ (see Qt::WA_KeyboardFocusChange)
+ \row
+ \li State_MouseOver
+ \li Set if the mouse cursor is over the widget
+ \row
+ \li State_Active
+ \li Set if the widget is a child of the active window.
+ \row
+ \li State_HasEditFocus
+ \li Set if the widget has the edit focus
+ \endtable
+
+ The other common members for widgets are:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li rect
+ \li The bounding rectangle of the element to draw. This
+ is set to the widget bounding rectangle
+ (QWidget::rect()).
+ \row
+ \li direction
+ \li The layout direction; a value of the
+ Qt::LayoutDirection enum.
+ \row
+ \li palette
+ \li The QPalette to use when drawing the element. This
+ is set to the widgets palette (QWidget::palette()).
+ \row
+ \li fontMetrics
+ \li The QFontMetrics to use when drawing text on the
+ widget.
+ \endtable
+
+ The complex style options (classes that inherit
+ QStyleOptionComplex) used for complex style elements share two
+ variables: \l{QStyleOptionComplex::}{subControls} and
+ \l{QStyleOptionComplex::}{activeSubControls}. Both variables are
+ an OR'ed combination of QStyle::SubControl enum values. They
+ indicate which sub controls the complex control consists of and
+ which of these controls are currently active.
+
+ As mentioned, the style calculates the size of the widgets
+ contents, which the widgets calculate their size hints from. In
+ addition, complex controls also use the style to test which
+ sub-controls the mouse is over.
+
+ \section2 Widget Reference
+
+ Without further delay, we present the widget walkthrough; each
+ widget has its own sub-section.
+
+ \section3 Push Buttons
+
+ The style structure for push buttons is shown below. By doing a
+ top-down traversal of the tree, you get the sequence in which the
+ elements should be drawn.
+
+ \image javastyle/pushbutton.png The style structure for push buttons
+
+ The layout of the buttons, with regard element bounds, varies from
+ style to style. This makes it difficult to show conceptual images
+ of this. Also, elements may - even be intended to - have the same
+ bounds; the PE_PushButtonBevel, for instance, is used in
+ QCommonStyle to draw the elements that contains it:
+ PE_FrameDefaultButton, PE_FrameButtonBevel, and
+ PE_PanelButtonCommand, all of which have the same bounds in common
+ and windows style. PE_PushButtonBevel is also responsible for
+ drawing the menu indicator (QCommonStyle draws
+ PE_IndicatorArrowDown).
+
+ An image of a push button in the java style that show the bounding
+ rectangles of the elements is given below. Colors are used to
+ separate the bounding rectangles in the image; they do not fill
+ any other purpose. This is also true for similar images for the
+ other widgets.
+
+ \image javastyle/button.png
+
+ The java style, as well as all other styles implemented in Qt,
+ does not use PE_FrameButtonBevel. It is usual that a button
+ with a PE_DefaultFrame adjusts the PE_PanelButtonCommand's
+ rectangle by PM_ButtonDefaultIndicator. The CE_PushButtonLabel
+ is found by adjusting the rect by PM_DefaultFrameWidth.
+
+ We will now examine the style option for push
+ buttons - QStyleOptionButton. A table for the states that
+ QPushButton can set on the style option follows:
+
+ \table 90%
+ \header
+ \li State
+ \li State Set When
+ \row
+ \li State_Sunken
+ \li Button is down or menu is pressed shown
+ \row
+ \li State_On
+ \li Button is checked
+ \row
+ \li State_Raised
+ \li Button is not flat and not pressed down
+ \endtable
+
+ Other members of QStyleOptionButton is:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li features
+ \li Flags of the QStyleOptionButton::ButtonFeatures enum,
+ which describes various button properties (see enum)
+ \row
+ \li icon
+ \li The buttons QIcon (if any)
+ \row
+ \li iconSize
+ \li The QSize of the icon
+ \row
+ \li text
+ \li a QString with the buttons text
+ \endtable
+
+ \section3 Check and Radio Buttons
+
+ The structures for radio and check buttons are identical.
+ We show the structure using QCheckBox element and pixel
+ metric names:
+
+ \image javastyle/checkbox.png
+
+ QStyleOptionButton is used as the style option for both check
+ and radio buttons. We first give a table of the states that
+ can be set in the option:
+
+ \table 90%
+ \header
+ \li State
+ \li State Set When
+ \row
+ \li State_sunken
+ \li The box is pressed down
+ \row
+ \li State_NoChange
+ \li The box is partially checked (for tristate
+ checkboxes.)
+ \row
+ \li State_On
+ \li The box is checked
+ \row
+ \li State_Off
+ \li The box is unchecked
+ \endtable
+
+ See \l{Push Buttons} for a table over other members in the
+ QStyleOptionButtonClass.
+
+ \section3 Tabs
+
+ In Qt, QTabBar uses the style to draw its tabs. Tabs exist either
+ in a QTabWidget, which contains a QTabBar, or as a separate bar.
+ If the bar is not part of a tab widget, it draws its own base.
+
+ QTabBar lays out the tabs, so the style does not have control over
+ tab placement. However, while laying out its tabs, the bar asks
+ the style for PM_TabBarTabHSpace and PM_TabBarTabVSpace, which is
+ extra width and height over the minimum size of the tab bar tab
+ label (icon and text). The style can also further influence the
+ tab size before it is laid out, as the tab bar asks for
+ CT_TabBarTab. The bounding rectangle of the bar is decided by the
+ tab widget when it is part of the widget (still considering
+ CT_TabBarTab).
+
+ The tab bar is responsible for drawing the buttons that appear on
+ the tab bar when all tabs do not fit. Their placement is not
+ controlled by the style, but the buttons are \l{QToolButton}s
+ and are therefore drawn by the style.
+
+ Here is the style structure for QTabWidget and QTabBar:
+
+ \image javastyle/tab.png
+
+ The dotted lines indicate that the QTabWidget contains a tab bar,
+ but does not draw it itself, that QTabBar only draws its base line
+ when not part of a tab widget, and that the tab bar keeps two tool
+ buttons that scroll the bar when all tabs do not fit; see \l{Tool
+ Buttons} for their element tree. Also note that since the buttons
+ are children of the tab bar, they are drawn after the bar. The
+ tabs bounding rectangles overlap the base by PM_TabBarBaseOverlap.
+
+ Here is a tab widget in the java style:
+
+ \image javastyle/tabwidget.png
+
+ In the java style (and also windows), the tab bar shape and label
+ have the same bounding rectangle as CE_TabBarTab. Notice that the
+ tabs overlap with the tab widget frame. The base of the tab bar
+ (if drawn) is the area where the tabs and frame overlap.
+
+ The style option for tabs (QStyleOptionTab) contains the necessary
+ information for drawing tabs. The option contains the position of
+ the tab in the tab bar, the position of the selected tab, the
+ shape of the tab, the text, and icon. After Qt 4.1 the option
+ should be cast to a QStyleOptionTabV2, which also contains the
+ icons size.
+
+ As the java style tabs don't overlap, we also present an image of
+ a tab widget in the windows style. Note that if you want the tabs
+ to overlap horizontally, you do that when drawing the tabs in
+ CE_TabBarTabShape; the tabs bounding rectangles will not be
+ altered by the tab bar. The tabs are drawn from left to right in a
+ north tab bar shape, top to bottom in an east tab bar shape, etc.
+ The selected tab is drawn last, so that it is easy to draw it over
+ the other tabs (if it is to be bigger).
+
+ \image javastyle/windowstabimage.png
+
+ A table of the states a tab bar can set on its tabs follows:
+
+ \table 90%
+ \header
+ \li State
+ \li State Set When
+ \row
+ \li State_Sunken
+ \li The tab is pressed on with the mouse.
+ \row
+ \li State_Selected
+ \li If it is the current tab.
+ \row
+ \li State_HasFocus
+ \li The tab bar has focus and the tab is selected
+ \endtable
+
+ Note that individual tabs may be disabled even if the tab bar
+ is not. The tab will be active if the tab bar is active.
+
+ Here follows a table of QStyleOptionTabV2's members:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li cornerWidgets
+ \li Is flags of the CornerWidget enum, which indicate
+ if and which corner widgets the tab bar has.
+ \row
+ \li icon
+ \li The QIcon of the tab
+ \row
+ \li iconSize
+ \li The QSize of the icon
+ \row
+ \li position
+ \li A TabPosition enum value that indicates the tabs
+ position on the bar relative to the other tabs.
+ \row
+ \li row
+ \li holds which row the tab is in
+ \row
+ \li selectedPosition
+ \li A value of the SelectedPosition enum that indicates
+ whether the selected tab is adjacent to or is the
+ tab.
+ \row
+ \li shape
+ \li A value of the QTabBar::Shape enum indication
+ whether the tab has rounded or triangular corners
+ and the orientation of the tab.
+ \row
+ \li text
+ \li The tab text
+ \endtable
+
+ The frame for tab widgets use QStyleOptionTabWidgetFrame as
+ style option. We list its members here. It does not have
+ states set besides the common flags.
+
+ \table 90%
+ \header
+ \li Member
+ \li content
+ \row
+ \li leftCornerWidgetSize
+ \li The QSize of the left corner widget (if any).
+ \row
+ \li rightCornerWidgetSize
+ \li The QSize of the right corner widget (if any).
+ \row
+ \li lineWidth
+ \li holds the line with for drawing the panel.
+ \row
+ \li midLineWith
+ \li this value is currently always 0.
+ \row
+ \li shape
+ \li The shape of the tabs on the tab bar.
+ \row
+ \li tabBarSize
+ \li The QSize of the tab bar.
+ \endtable
+
+ \section3 Scroll Bars
+
+ Here is the style structure for scrollBars:
+
+ \image javastyle/scrollbar.png
+
+ QScrollBar simply creates its style option and then draws
+ CC_ScrollBar. Some styles draw the background of add page and sub
+ page with PE_PanelButtonBevel and also use indicator arrows to
+ draw the arrows in the nest and previous line indicators; we have
+ not included these in the tree as their use is up to the
+ individual style. The style's PM_MaximumDragDistance is the
+ maximum distance in pixels the mouse can move from the bounds
+ of the scroll bar and still move the handle.
+
+ Here is an image of a scrollbar in the java style:
+
+ \image javastyle/scrollbarimage.png
+
+ You may notice that the scrollbar is slightly different from
+ Java's as it has two line up indicators. We have done this to show
+ how that you can have two separate bounding rectangles for a
+ single sub control. The scroll bar is an example of a widget that
+ is entirely implemented by the java style - neither QWindowsStyle
+ nor QCommonStyle are involved in the drawing.
+
+ We have a look at the different states a scroll bar can set on
+ the style option:
+
+ \table 90%
+ \header
+ \li State
+ \li State Set When
+ \row
+ \li State_Horizontal
+ \li The scroll bar is horizontal
+ \endtable
+
+ The style option of QScrollBar is QStyleOptionSlider. Its
+ members are listed in the following table. The option is used
+ by all \l{QAbstractSlider}s; we only describe the members
+ relevant for scroll bars here.
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li maximum
+ \li the maximum value of the scroll bar
+ \row
+ \li minimum
+ \li the minimum value of the scroll bar
+ \row
+ \li notchTarget
+ \li the number of pixels between notches
+ \row
+ \li orientation
+ \li a value of the Qt::Orientation enum that specifies
+ whether the scroll bar is vertical or horizontal
+ \row
+ \li pageStep
+ \li the number to increase or decrease the sliders
+ value (relative to the size of the slider and its value
+ range) on page steps.
+ \row
+ \li singleStep
+ \li the number to increase or decrease the sliders
+ value on single (or line) steps
+ \row
+ \li sliderValue
+ \li The value of the slider
+ \row
+ \li sliderPosition
+ \li the position of the slider handle. This is the same
+ as \c sliderValue if the scroll bar is
+ QAbstractSlider::tracking. If not, the scroll
+ bar does not update its value before the mouse
+ releases the handle.
+ \row
+ \li upsideDown
+ \li holds the direction in which the scroll bar
+ increases its value. This is used instead of
+ QStyleOption::direction for all abstract sliders.
+ \endtable
+
+ \section3 Sliders
+
+ When calculating the sliders size hint, PM_SliderTickness and
+ PM_SliderLength is queried from the style. As with scroll bars,
+ the QSlider only lets the user move the handle if the mouse is
+ within PM_MaximumDragDistance from the slider bounds. When it
+ draws itself it creates the style option and calls \c
+ drawComplexControl() with CC_Slider:
+
+ \image javastyle/slider.png
+
+ We also show a picture of a slider in the java style. We show
+ the bounding rectangles of the sub elements as all drawing is done
+ in CC_Slider.
+
+ \image javastyle/sliderimage.png
+
+ QSlider uses QStyleOptionSlider as all \l{QAbstractSlider}s do. We
+ present a table with the members that affect QSlider:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li maximum
+ \li the maximum value of the slider
+ \row
+ \li minimum
+ \li the minimum value of the slider
+ \row
+ \li notchTarget
+ \li this is the number of pixels between each notch
+ \row
+ \li orientation
+ \li a Qt::Orientation enum value that gives whether the
+ slider is vertical or horizontal.
+ \row
+ \li pageStep
+ \li a number in slider value to increase or decrease
+ for page steps
+ \row
+ \li singleStep
+ \li the number to increase or decrease the sliders
+ value on single (or line) steps.
+ \row
+ \li sliderValue
+ \li the value of the slider.
+ \row
+ \li sliderPosition
+ \li the position of the slider given as a slider value.
+ This will be equal to the \c sliderValue if the
+ slider is \l{QAbstractSlider::}{tracking}; if
+ not, the sliders value will not change until the handle is
+ released with the mouse.
+ \row
+ \li upsideDown
+ \li this member is used instead of QStyleOption::direction
+ for all abstract sliders.
+ \endtable
+
+ You should note that the slider does not use direction for
+ reverse layouts; it uses \c upsideDown.
+
+ \section3 Spin Boxes
+
+ When QSpinBox paints itself it creates a QStyleOptionSpinBox and
+ asks the style to draw CC_SpinBox. The edit field is a line
+ edit that is a child of the spin box. The dimensions of the
+ field is calculated by the style with SC_SpinBoxEditField.
+
+ Here follows the style tree for spin boxes. It is not
+ required that a style uses the button panel primitive to paint
+ the indicator backgrounds. You can see an image below the tree
+ showing the sub elements in QSpinBox in the java style.
+
+ \image javastyle/spinbox.png
+
+ \image javastyle/spinboximage.png
+
+ The QStyleOptionSpinBox, which is the style option for spin
+ boxes. It can set the following states on the spin box.:
+
+ \table 90%
+ \header
+ \li State
+ \li State Set When
+ \row
+ \li State_Sunken
+ \li Is set if one of the sub controls CC_SpinUp or
+ CC_SpinDown is pressed on with the mouse.
+ \endtable
+
+ The rest of the members in the spin boxes style options are:
+
+ \table 90%
+ \header
+ \li Property
+ \li Function
+ \row
+ \li frame
+ \li boolean that is true if the spin box is to draw a
+ frame.
+ \row
+ \li buttonSymbols
+ \li Value of the ButtonSymbols enum that decides the
+ symbol on the up/down buttons.
+ \row
+ \li stepEnabled
+ \li A value of the StepEnabled indication which of the
+ spin box buttons are pressed down.
+ \endtable
+
+ \section3 Title Bar
+
+ The title bar complex control, CC_TitleBar, is used to draw
+ the title bars of internal windows in QMdiArea. It typically
+ consists of a window title and close, minimize, system menu, and
+ maximize buttons. Some styles also provide buttons for shading
+ the window, and a button for context sensitive help.
+
+ The bar is drawn in CC_TitleBar without using any sub elements.
+ How the individual styles draw their buttons is individual, but
+ there are standard pixmaps for the buttons that the style should
+ provide.
+
+ \image javastyle/titlebar.png
+
+ In an image over a title bar in the java style, we show the
+ bounding rectangles of the sub elements supported by the java style
+ (all of which are drawn with standard pixmaps). It is usual to
+ draw the button backgrounds using PE_PanelButtonTool, but it's no
+ rule.
+
+ \image javastyle/titlebarimage.png
+
+ The style option for title bars is QStyleOptionTitleBar. It's
+ members are:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li icon
+ \li The title bars icon
+ \row
+ \li text
+ \li the text for the title bar's label
+ \row
+ \li windowFlags
+ \li flags of the Qt::WindowFlag enum. The window flags
+ used by QMdiArea for window management.
+ \row
+ \li titleBarState
+ \li this is the QWidget::windowState() of the window
+ that contains the title bar.
+ \endtable
+
+ \section3 Combo Box
+
+ A QComboBox uses the style to draw the button and label of
+ non-editable boxes with CC_ComboBox and CE_ComboBoxLabel.
+
+ The list that pops up when the user clicks on the combo box is
+ drawn by a \l{Delegate Classes}{delegate}, which we do not cover
+ in this overview. You can, however, use the style to control the
+ list's size and position with the sub element
+ SC_ComboBoxListBoxPopup. The style also decides where the edit
+ field for editable boxes should be with SC_ComboBoxEditField; the
+ field itself is a QLineEdit that is a child of the combo box.
+
+ \image javastyle/combobox.png
+
+ We show an image over a java style combo box in which we have
+ outlined its sub elements and sub element rectangles:
+
+ \image javastyle/comboboximage.png
+
+ Java combo boxes do not use the focus rect; it changes its
+ background color when it has focus. The SC_ComboBoxEdit field is
+ used both by QComboBox to calculate the size of the edit field and
+ the style for calculating the size of the combo box label.
+
+ The style option for combo boxes is QStyleOptionComboBox. It
+ can set the following states:
+
+ \table 90%
+ \header
+ \li State
+ \li Set When
+ \row
+ \li State_Selected
+ \li The box is not editable and has focus
+ \row
+ \li State_Sunken
+ \li SC_ComboBoxArrow is active
+ \row
+ \li State_on
+ \li The container (list) of the box is visible
+ \endtable
+
+ The style options other members are:
+
+ \table
+ \header
+ \li Member
+ \li Content
+ \row
+ \li currentIcon
+ \li the icon of the current (selected) item of the
+ combo box.
+ \row
+ \li currentText
+ \li the text of the current item in the box.
+ \row
+ \li editable
+ \li holds whether the combo box is editable or not
+ \row
+ \li frame
+ \li holds whether the combo box has a frame or not
+ \row
+ \li iconSize
+ \li the size of the current items icon.
+ \row
+ \li popupRect
+ \li the bounding rectangle of the combo box's popup
+ list.
+ \endtable
+
+ \section3 Group Boxes
+
+ When calculating the size hint, QGroupBox fetches three pixel
+ metrics from the style: PM_IndicatorWidth,
+ PM_CheckBoxLabelSpacing, and PM_IndicatorHeight. QGroupBox has
+ the following style element tree:
+
+ \image javastyle/groupbox.png
+
+ Qt does not impose restrictions on how the check box is drawn; the
+ java style draws it with CE_IndicatorCheckBox. See \l{Check and
+ Radio Buttons} for the complete tree.
+
+ We also give an image of the widget with the sub controls and
+ sub control rectangles drawn:
+
+ \image javastyle/groupboximage.png
+
+ The style option for group boxes are QStyleOptionGroupBox. The
+ following states can be set on it:
+
+ \table 90%
+ \header
+ \li State
+ \li Set When
+ \row
+ \li State_On
+ \li The check box is checked
+ \row
+ \li State_Sunken
+ \li The checkbox is pressed down
+ \row
+ \li State_Off
+ \li The check box is unchecked (or there is no check box)
+ \endtable
+
+ The remaining members of QStyleOptionGroupBox are:
+
+ \table
+ \header
+ \li Member
+ \li Content
+ \row
+ \li features
+ \li flags of the QStyleOptionFrameV2::FrameFeatures
+ enum describing the frame of the group box.
+ \row
+ \li lineWidth
+ \li the line width with which to draw the panel. This
+ is always 1.
+ \row
+ \li text
+ \li the text of the group box.
+ \row
+ \li textAlignment
+ \li the alignment of the group box title
+ \row
+ \li textColor
+ \li the QColor of the text
+ \endtable
+
+ \section3 Splitters
+
+ As the structure of splitters are simple and do not contain any
+ sub elements, we do not include image of splitters. CE_Splitter
+ does not use any other elements or metrics.
+
+ For its style option, Splitters uses the base class QStyleOption.
+ It can set the following state flags on it:
+
+ \table 90%
+ \header
+ \li State
+ \li Set When
+ \row
+ \li State_Horizontal
+ \li Set if it is a horizontal splitter
+ \endtable
+
+ QSplitter does not use \l{QStyleOption::}{initFrom()} to set up its
+ option; it sets the State_MouseOver and State_Disabled flags
+ itself.
+
+ \section3 Progress Bar
+
+ The CE_ProgressBar element is used by QProgressBar, and it is the
+ only element used by this widget. We start with looking at the
+ style structure:
+
+ \image javastyle/progressbar.png
+
+ Here is a progress bar in the windows style (the java style
+ bounding rectangles are equal):
+
+ \image javastyle/progressbarimage.png
+
+ The style option for QProgressBar is QStyleOptionProgressBarV2.
+ The bar does not set any state flags, but the other members of the
+ option are:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li minimum
+ \li The minimum value of the bar
+ \row
+ \li maximum
+ \li The maximum value of the bar
+ \row
+ \li progress
+ \li The current value of the bar
+ \row
+ \li textAlignment
+ \li How the text is aligned in the label
+ \row
+ \li textVisible
+ \li Whether the label is drawn
+ \row
+ \li text
+ \li The label text
+ \row
+ \li orientation
+ \li Progress bars can be vertical or horizontal
+ \row
+ \li invertedAppearance
+ \li The progress is inverted (i.e., right to left in a
+ horizontal bar)
+ \row
+ \li bottomToTop
+ \li Boolean that if true, turns the label of vertical
+ progress bars 90 degrees.
+ \endtable
+
+ \section3 Tool Buttons
+
+ Tool buttons exist either independently or as part of tool bars.
+ They are drawn equally either way. The QToolButton draws only one
+ style element: CC_ToolButton.
+
+ As you must be used to by now (at least if you have read this
+ document sequentially), we have a tree of the widget's style
+ structure:
+
+ \image javastyle/toolbutton.png
+
+ Note that PE_FrameButtonTool and PE_IndicatorArrowDown are
+ included in the tree as the java style draws them, but they can
+ safely be omitted if you prefer it. The structure may also be
+ different. QWindowsStyle, for instance, draws both
+ PE_IndicatorButtonDropDown and PE_IndicatorArrowDown in
+ CE_ToolButton.
+
+ We also have an image of a tool button where we have outlined
+ the sub element bounding rectangles and sub controls.
+
+ \image javastyle/toolbuttonimage.png
+
+ Here is the states table for tool buttons:
+
+ \table 90%
+ \header
+ \li State
+ \li Set When
+ \row
+ \li State_AutoRise
+ \li the tool button has the autoRise property set
+ \row
+ \li State_raised
+ \li the button is not sunken (i.e., by being checked or
+ pressed on with the mouse).
+ \row
+ \li State_Sunken
+ \li the button is down
+ \row
+ \li State_On
+ \li the button is checkable and checked.
+ \endtable
+
+ QStyleOptionToolButton also contains the following members:
+
+ \table
+ \header
+ \li Member
+ \li Content
+ \row
+ \li arrowType
+ \li a Qt::ArrowType enum value, which contains the
+ direction of the buttons arrow (if an arrow is to
+ be used in place of an icon)
+ \row
+ \li features
+ \li flags of the QStyleOptionToolButton::ButtonFeature
+ enum describing if the button has an arrow, a menu,
+ and/or has a popup-delay.
+ \row
+ \li font
+ \li the QFont of the buttons label
+ \row
+ \li icon
+ \li the QIcon of the tool button
+ \row
+ \li iconSize
+ \li the icon size of the button's icon
+ \row
+ \li pos
+ \li the position of the button, as given by
+ QWidget::pos()
+ \row
+ \li text
+ \li the text of the button
+ \row
+ \li toolButtonStyle
+ \li a Qt::ToolButtonStyle enum value which decides
+ whether the button shows the icon, the text, or both.
+ \endtable
+
+ \section3 Toolbars
+
+ Toolbars are part of the \l{QMainWindow}{main window framework}
+ and cooperates with the QMainWindow to which it belongs while it
+ builds its style option. A main window has 4 areas that toolbars
+ can be placed in. They are positioned next to the four sides of
+ the window (i.e., north, south, west, and east). Within each area
+ there can be more than one line of toolbars; a line consists of
+ toolbars with equal orientation (vertical or horizontal) placed
+ next to each other.
+
+ \l{QToolbar}{QToolbar}s in Qt consists of three elements
+ CE_ToolBar, PE_IndicatorToolBarHandle, and
+ PE_IndicatorToolBarSeparator. It is QMainWindowLayout that
+ calculates the bounding rectangles (i.e., position and size of the
+ toolbars and their contents. The main window also uses the \c
+ sizeHint() of the items in the toolbars when calculating the size
+ of the bars.
+
+ Here is the element tree for QToolBar:
+
+ \image javastyle/toolbar.png
+
+ The dotted lines indicate that the QToolBar keeps an instance of
+ QToolBarLayout and that QToolBarSeparators are kept by
+ QToolBarLayout. When the toolbar is floating (i.e., has its own
+ window) the PE_FrameMenu element is drawn, else QToolbar draws
+ CE_ToolBar.
+
+ Here is an image of a toolbar in the java style:
+
+ \image javastyle/toolbarimage.png
+
+ QToolBarSaparator uses QStyleOption for their style option. It
+ sets the State_horizontal flag if the toolbar they live in is
+ horizontal. Other than that, they use \l{QStyleOption::}{initFrom()}.
+
+ The style option for QToolBar is QStyleOptionToolBar. The only
+ state flag set (besides the common flags) is State_Horizontal
+ if the bar is horizontal (i.e., in the north or south toolbar area).
+ The member variables of the style option are:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li features
+ \li Holds whether the bar is movable in a value of the
+ ToolBarFeature, which is either Movable or None.
+ \row
+ \li lineWidth
+ \li The width of the tool bar frame.
+ \row
+ \li midLineWidth
+ \li This variable is currently not used and is always
+ 0.
+ \row
+ \li positionOfLine
+ \li The position of the toolbar line within the toolbar
+ area to which it belongs.
+ \row
+ \li positionWithinLine
+ \li The position of the toolbar within the toolbar line.
+ \row
+ \li toolBarArea
+ \li The toolbar area in which the toolbar lives.
+ \endtable
+
+ \section3 Menus
+
+ Menus in Qt are implemented in QMenu. The QMenu keeps a list of
+ action, which it draws as menu items. When QMenu receives paint
+ events ,it calculates the size of each menu item and draws them
+ individually with CE_MenuItem. (Menu items do not have a separate
+ element for their label (contents), so all drawing is done in
+ CE_MenuItem. The menu also draws the frame of the menu with
+ PE_FrameMenu. It also draws CE_MenuScroller if the style supports
+ scrolling. CE_MenuTearOff is drawn if the menu is to large for its
+ bounding rectangle.
+
+ In the style structure tree, we also include QMenu as it also does
+ styling related work. The bounding rectangles of menu items are
+ calculated for the menus size hint and when the menu is displayed
+ or resized.
+
+ \image javastyle/menu.png
+
+ The CE_MenuScroller and CE_MenuTearOff elements are handled by
+ QCommonStyle and are not shown unless the menu is to large to fit
+ on the screen. PE_FrameMenu is only drawn for pop-up menus.
+
+ QMenu calculates rectangles based on its actions and calls
+ CE_MenuItem and CE_MenuScroller if the style supports that.
+
+ It is also usual to use PE_IndicatorCheckBox (instead of using
+ PE_IndicatorMenuCheckMark) and PE_IndicatorRadioButton for drawing
+ checkable menu items; we have not included them in the style tree
+ as this is optional and varies from style to style.
+
+ \image javastyle/menuimage.png
+
+ The style option for menu items is QStyleOptionMenuItem. The
+ following tables describe its state flags and other members.
+
+ \table 90%
+ \header
+ \li State
+ \li Set When
+ \row
+ \li State_Selected
+ \li The mouse is over the action and the action is not
+ a separator.
+ \row
+ \li State_Sunken
+ \li The mouse is pressed down on the menu item.
+ \row
+ \li State_DownArrow
+ \li Set if the menu item is a menu scroller and it scrolls
+ the menu downwards.
+ \endtable
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li checkType
+ \li A value of the \l{QStyleOptionMenuItem::}{CheckType} enum,
+ which is either NotCheckable, Exclusive, or
+ NonExclusive.
+ \row
+ \li checked
+ \li Boolean that is true if the menu item is checked.
+ \row
+ \li font
+ \li The QFont to use for the menu item's text.
+ \row
+ \li icon
+ \li the QIcon of the menu item.
+ \row
+ \li maxIconWidth
+ \li The maximum width allowed for the icon
+ \row
+ \li menuHasChecableItem
+ \li Boolean which is true if at least one item in the
+ menu is checkable.
+ \row
+ \li menuItemType
+ \li The type of the menu item. This a value of the
+ \l{QStyleOptionMenuItem::}{MenuItemType}.
+ \row
+ \li menuRect
+ \li The bounding rectangle for the QMenu that the menu
+ item lives in.
+ \row
+ \li tabWidth
+ \li This is the distance between the text of the menu
+ item and the shortcut.
+ \row
+ \li text
+ \li The text of the menu item.
+ \endtable
+
+ The setup of the style option for CE_MenuTearOff and
+ CE_MenuScroller also uses QStyleOptionMenuItem; they only set the
+ \c menuRect variable in addition to the common settings with
+ QStyleOption's \l{QStyleOption::}{initFrom()}.
+
+ \section3 Menu Bar
+
+ QMenuBar uses the style to draw each menu bar item and the empty
+ area of the menu bar. The pull-down menus themselves are
+ \l{QMenu}s (see \l{Menus}). The style element tree for the menu
+ bar follows:
+
+ \image javastyle/menubar.png
+
+ The panel and empty area is drawn after the menu items. The
+ QPainter that the QMenuBar sends to the style has the bounding
+ rectangles of the items clipped out (i.e., clip region), so you
+ don't need to worry about drawing over the items. The pixel
+ metrics in QMenuBar is used when the bounding rectangles of the
+ menu bar items are calculated.
+
+ \image javastyle/menubarimage.png
+
+ QStyleOptionMenuItem is used for menu bar items. The members that
+ are used by QMenuBar is described in the following table:
+
+ \table
+ \header
+ \li Member
+ \li Content
+ \row
+ \li menuRect
+ \li the bounding rectangle of the entire menu bar to
+ which the item belongs.
+ \row
+ \li text
+ \li the text of the item
+ \row
+ \li icon
+ \li the icon of the menu item (it is not common that
+ styles draw this icon)
+ \endtable
+
+ QStyleOptionMenuItem is also used for drawing CE_EmptyMenuBarArea.
+
+ QStyleOptionFrame is used for drawing the panel frame The
+ \l{QStyleOptionFrame::}{lineWidth} is set to PM_MenuBarPanelWidth.
+ The \l{QStyleOptionFrame::}{midLineWidth} is currently always set
+ to 0.
+
+ \section3 Item View Headers
+
+ It is the style that draws the headers of Qt's item views. The
+ item views keeps the dimensions on individual sections. Also
+ note that the delegates may use the style to paint decorations
+ and frames around items. QItemDelegate, for instance, draws
+ PE_FrameFocusRect and PE_IndicatorViewItemCheck.
+
+ \image javastyle/header.png
+
+ Here is a QTableWidget showing the bounding rects of a Java
+ header:
+
+ \image javastyle/headerimage.png
+
+ The QHeaderView uses CT_HeaderSection, PM_HeaderMargin and
+ PM_HeaderGripMargin for size and hit test calculations. The
+ PM_HeaderMarkSize is currently not used by Qt. QTableView draws
+ the button in the top-left corner (i.e., the area where the
+ vertical and horizontal headers intersect) as a CE_Header.
+
+ The style option for header views is QStyleOptionHeader. The view
+ paints one header section at a time, so the data is for the
+ section being drawn. Its contents are:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li icon
+ \li the icon of the header (for section that is being
+ drawn).
+ \row
+ \li iconAlignment
+ \li the alignment (Qt::Alignment) of the icon in the header.
+ \row
+ \li orientation
+ \li a Qt::Orientation value deciding whether the header
+ is the horizontal header above the view or the
+ vertical header on the left.
+ \row
+ \li position
+ \li a QStyleOptionHeader::SectionPosition value
+ giving the header section's position relative to
+ the other sections.
+ \row
+ \li section
+ \li holds the section that is being drawn.
+ \row
+ \li selectedPosition
+ \li a QStyleOptionHeader::SelectedPosition value giving
+ the selected section's position relative to the
+ section that is being painted.
+ \row
+ \li sortIndicator
+ \li a QStyleOptionHeader::SortIndicator value that
+ describes the direction in which the section's sort
+ indicator should be drawn.
+ \row
+ \li text
+ \li the text of the currently drawn section.
+ \row
+ \li textAlignment
+ \li the Qt::Alignment of the text within the
+ headersection.
+ \endtable
+
+ \section3 Tree Branch Indicators
+
+ The branch indicators in a tree view is drawn by the style with
+ PE_IndicatorBranch. We think of indicators here as the indicators
+ that describe the relationship of the nodes in the tree. The
+ generic QStyleOption is sent to the style for drawing this
+ elements. The various branch types are described by states. Since
+ there are no specific style option, we simply present the states
+ table:
+
+ \table 90%
+ \header
+ \li State
+ \li Set When
+ \row
+ \li State_Sibling
+ \li the node in the tree has a sibling (i.e., there is
+ another node in the same column).
+ \row
+ \li State_Item
+ \li this branch indicator has an item.
+ \row
+ \li State_Children
+ \li the branch has children (i.e., a new sub-tree can
+ be opened at the branch).
+ \row
+ \li State_Open
+ \li the branch indicator has an opened sub-tree.
+ \endtable
+
+ The tree view (and tree widget) use the style to draw the branches
+ (or nodes if you will) of the tree.
+
+ QStyleOption is used as the style for PE_IndicatorBranch has state
+ flags set depending on what type of branch it is.
+
+ Since there is no tree structure for branch indicators, we only
+ present an image of a tree in the java style. Each state is marked
+ in the image with a rectangle in a specific color (i.e., these
+ rectangles are not bounding rectangles). All combinations of
+ states you must be aware of are represented in the image.
+
+ \image javastyle/branchindicatorimage.png
+
+ \section3 Tool Boxes
+
+ PM_SmallIconSize for sizeHints.
+
+ QToolBox is a container that keeps a collection of widgets. It has
+ one tab for each widget and display one of them at a time. The
+ tool box lays the components it displays (the tool box buttons
+ and selected widget) in a QVBoxLayout. The style tree for tool
+ boxes looks like this:
+
+ \image javastyle/toolbox.png
+
+ We show an image of a tool box in the Plastique style:
+
+ \image javastyle/toolboximage.png
+
+ All elements have the same bounding rectangles in the
+ Plastique as well as the other Qt built-in styles.
+
+ The style option for tool boxes is QStyleOptionToolBox. It
+ contains the text and icon of the tool box contents. The only
+ state set by QToolBox is State_Sunken, which is set when the user
+ presses a tab down with the mouse. The rest of the
+ QStyleOptionToolBox members are:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li icon
+ \li the icon on the toolbox tab
+ \row
+ \li text
+ \li the text on the toolbox tab
+ \endtable
+
+ \section3 Size Grip
+
+ The size grip calculates its size hint with CT_SizeGrip. The pixel
+ metric PM_SizeGripSize is currently unused by Qt. The element tree
+ for and an image in the Plastique style of QSizeGrip follows:
+
+ \image javastyle/sizegrip.png
+
+ \image javastyle/sizegripimage.png
+
+ We show the size grip in a \l{QMainWindow}'s bottom right
+ corner.
+
+ The size grip style option, QStyleOptionSizeGrip, have one
+ member except the common members from QStyleOption:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li corner
+ \li a Qt::Corner value that describe which corner in a
+ window (or equivalent) the grip is located.
+ \endtable
+
+ \section3 Rubber Band
+
+ The \l{QRubberBand}'s style tree consists of two nodes.
+
+ \image javastyle/rubberband.png
+
+ We present an image of a Java style window being moved in a
+ QMdiArea with a rubber band:
+
+ \image javastyle/rubberbandimage.png
+
+ The style option for rubber bands is QStyleOptionRubberBand.
+ Its members are:
+
+ \table
+ \header
+ \li Member
+ \li Content
+ \row
+ \li opaque
+ \li boolean that is true if the rubber band must be
+ drawn in an opaque style (i.e., color)
+ \row
+ \li shape
+ \li a QRubberBand::Shape enum value that holds the
+ shape of the band (which is either a rectangle or a
+ line)
+ \endtable
+
+ \section3 Dock Widgets
+
+ When the dock widget lays out its contents it asks the style for
+ these pixel metrics: PM_DockWidgetSeparatorExtent,
+ PM_DockWidgetTitleBarButtonMargin, PM_DockWidgetFrameWidth, and
+ PM_DockWidgetTitleMargin. It also calculates the bounding
+ rectangles of the float and close buttons with
+ SE_DockWidgetCloseButton and SE_DockWidgetFloatButton.
+
+ \image javastyle/dockwidget.png
+
+ The dotted lines indicate that the sender keeps instances of the
+ recipient of the arrow (i.e., it is not a style element to draw).
+ The dock widget only draws PE_frameDockWidget when it is detached
+ from its main window (i.e., it is a top level window). If it is
+ docked it draws the indicator dock widget resize handle. We show a
+ dock widget in both docked and floating state in the plastique
+ style:
+
+ \image javastyle/dockwidgetimage.png
+
+ The style option is QStyleOptionDockWidget:
+
+ \table 90%
+ \header
+ \li Member
+ \li Content
+ \row
+ \li closeable
+ \li boolean that holds whether the dock window can be
+ closed
+ \row
+ \li floatable
+ \li boolean that holds whether the dock window can
+ float (i.e., detach from the main window in which
+ it lives)
+ \row
+ \li movable
+ \li boolean that holds whether the window is movable
+ (i.e., can move to other dock widget areas)
+ \row
+ \li title
+ \li the title text of the dock window
+ \endtable
+
+ For the buttons, QStyleOptionButton is used (see \l{Tool Buttons}
+ for content description). The dock widget resize handle has a
+ plain QStyleOption.
+*/
diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
new file mode 100644
index 0000000000..3b31efbdfc
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -0,0 +1,3963 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page stylesheet.html
+ \title Qt Style Sheets
+ \brief How to use style sheets to customize the appearance of widgets.
+
+ \ingroup frameworks-technologies
+ \ingroup qt-basic-concepts
+ \ingroup qt-gui-concepts
+
+ \previouspage {Styles and Style Aware Widgets}{Styles}
+ \contentspage Widgets and Layouts
+ \nextpage The Style Sheet Syntax
+
+ \keyword style sheet
+ \keyword stylesheet
+
+ Qt Style Sheets are a powerful mechanism that allows you to
+ customize the appearance of widgets, in addition to what is
+ already possible by subclassing QStyle. The concepts,
+ terminology, and syntax of Qt Style Sheets are heavily inspired
+ by HTML \l{http://www.w3.org/Style/CSS/}{Cascading Style Sheets
+ (CSS)} but adapted to the world of widgets.
+
+ Topics:
+
+ \list
+ \li \l{Overview}
+ \li \l{The Style Sheet Syntax}
+ \li \l{Qt Designer Integration}
+ \li \l{Customizing Qt Widgets Using Style Sheets}
+ \li \l{Qt Style Sheets Reference}
+ \li \l{Qt Style Sheets Examples}
+ \endlist
+
+ \target overview
+ \section1 Overview
+
+ Styles sheets are textual specifications that can be set on the
+ whole application using QApplication::setStyleSheet() or on a
+ specific widget (and its children) using
+ QWidget::setStyleSheet(). If several style sheets are set at
+ different levels, Qt derives the effective style sheet from all
+ of those that are set. This is called cascading.
+
+ For example, the following style sheet specifies that all
+ \l{QLineEdit}s should use yellow as their background color, and
+ all \l{QCheckBox}es should use red as the text color:
+
+ \snippet code/doc_src_stylesheet.qdoc 0
+
+ For this kind of customization, style sheets are much more
+ powerful than QPalette. For example, it might be tempting to set
+ the QPalette::Button role to red for a QPushButton to obtain a
+ red push button. However, this wasn't guaranteed to work for all
+ styles, because style authors are restricted by the different
+ platforms' guidelines and (on Windows XP and Mac OS X) by the
+ native theme engine.
+
+ Style sheets let you perform all kinds of customizations that are
+ difficult or impossible to perform using QPalette alone. If you
+ want yellow backgrounds for mandatory fields, red text for
+ potentially destructive push buttons, or fancy check boxes, style
+ sheets are the answer.
+
+ Style sheets are applied on top of the current \l{QStyle}{widget
+ style}, meaning that your applications will look as native as
+ possible, but any style sheet constraints will be taken into
+ consideration. Unlike palette fiddling, style sheets offer
+ guarantees: If you set the background color of a QPushButton to be
+ red, you can be assured that the button will have a red background
+ in all styles, on all platforms. In addition, \l{Qt Designer}
+ provides style sheet integration, making it easy to view the effects
+ of a style sheet in different \l{QStyle}{widget styles}.
+
+ In addition, style sheets can be used to provide a distinctive
+ look and feel for your application, without having to subclass
+ QStyle. For example, you can specify arbitrary images for radio
+ buttons and check boxes to make them stand out. Using this
+ technique, you can also achieve minor customizations that would
+ normally require subclassing several style classes, such as
+ specifying a \l{QStyle::styleHint()}{style hint}. The
+ \l{widgets/stylesheet}{Style Sheet} example depicted below defines
+ two distinctive style sheets that you can try out and modify at
+ will.
+
+ \table
+ \row \li \inlineimage stylesheet-coffee-xp.png
+ \li \inlineimage stylesheet-pagefold.png
+ \row \li Coffee theme running on Windows XP
+ \li Pagefold theme running on Windows XP
+ \endtable
+
+ \table
+ \row \li \inlineimage stylesheet-coffee-cleanlooks.png
+ \li \inlineimage stylesheet-pagefold-mac.png
+ \row \li Coffee theme running on Ubuntu Linux
+ \li Pagefold theme running on Mac OS X
+ \endtable
+
+ When a style sheet is active, the QStyle returned by QWidget::style()
+ is a wrapper "style sheet" style, \e not the platform-specific style. The
+ wrapper style ensures that any active style sheet is respected and
+ otherwise forwards the drawing operations to the underlying,
+ platform-specific style (e.g., QWindowsXPStyle on Windows XP).
+
+ Since Qt 4.5, Qt style sheets fully supports Mac OS X.
+
+ \warning Qt style sheets are currently not supported for custom QStyle
+ subclasses. We plan to address this in some future release.
+*/
+
+/*!
+ \page stylesheet-syntax.html
+ \contentspage {Qt Style Sheet}{Contents}
+ \previouspage Qt Style Sheet
+ \nextpage Qt Designer Integration
+ \title The Style Sheet Syntax
+
+ Qt Style Sheet terminology and syntactic rules are almost
+ identical to those of HTML CSS. If you already know CSS, you can
+ probably skim quickly through this section.
+
+ \tableofcontents
+
+ \section1 Style Rules
+
+ Style sheets consist of a sequence of style rules. A \e{style
+ rule} is made up of a selector and a declaration. The
+ \e{selector} specifies which widgets are affected by the rule;
+ the \e{declaration} specifies which properties should be set on
+ the widget. For example:
+
+ \snippet code/doc_src_stylesheet.qdoc 1
+
+ In the above style rule, \c QPushButton is the selector and \c{{
+ color: red }} is the declaration. The rule specifies that
+ QPushButton and its subclasses (e.g., \c MyPushButton) should use
+ red as their foreground color.
+
+ Qt Style Sheet is generally case insensitive (i.e., \c color,
+ \c Color, \c COLOR, and \c cOloR refer to the same property).
+ The only exceptions are class names,
+ \l{QObject::setObjectName()}{object names}, and Qt property
+ names, which are case sensitive.
+
+ Several selectors can be specified for the same declaration,
+ using commas (\c{,}) to separate the selectors. For example,
+ the rule
+
+ \snippet code/doc_src_stylesheet.qdoc 2
+
+ is equivalent to this sequence of three rules:
+
+ \snippet code/doc_src_stylesheet.qdoc 3
+
+ The declaration part of a style rule is a list of
+ \tt{\e{property}: \e{value}} pairs, enclosed in braces (\c{{}})
+ and separated with semicolons. For example:
+
+ \snippet code/doc_src_stylesheet.qdoc 4
+
+ See the \l{List of Properties} section below for the list of
+ properties provided by Qt widgets.
+
+ \section1 Selector Types
+
+ All the examples so far used the simplest type of selector, the
+ Type Selector. Qt Style Sheets support all the
+ \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{selectors
+ defined in CSS2}. The table below summarizes the most useful
+ types of selectors.
+
+ \table 100%
+ \header
+ \li Selector
+ \li Example
+ \li Explanation
+
+ \row
+ \li Universal Selector
+ \li \c *
+ \li Matches all widgets.
+
+ \row
+ \li Type Selector
+ \li \c QPushButton
+ \li Matches instances of QPushButton and of its subclasses.
+
+ \row
+ \li Property Selector
+ \li \c{QPushButton[flat="false"]}
+ \li Matches instances of QPushButton that are not
+ \l{QPushButton::}{flat}. You may use this selector to test
+ for any Qt \l{Qt's Property System}{property} that supports
+ QVariant::toString() (see the \l{QVariant::}{toString()}
+ function documentation for details). In addition, the
+ special \c class property is supported, for the name of the
+ class.
+
+ This selector may also be used to test dynamic properties.
+ For more information on customization using dynamic properties,
+ refer to \l{Customizing Using Dynamic Properties}.
+
+ Instead of \c =, you can also use \c ~= to test whether a
+ Qt property of type QStringList contains a given QString.
+
+ \warning If the value of the Qt property changes after the
+ style sheet has been set, it might be necessary to force a
+ style sheet recomputation. One way to achieve this is to
+ unset the style sheet and set it again.
+
+ \row
+ \li Class Selector
+ \li \c .QPushButton
+ \li Matches instances of QPushButton, but not of its subclasses.
+
+ This is equivalent to \c{*[class~="QPushButton"]}.
+
+ \row
+ \li ID \target ID Selector
+ Selector
+ \li \c{QPushButton#okButton}
+ \li Matches all QPushButton instances whose
+ \l{QObject::objectName}{object name} is \c okButton.
+
+ \row
+ \li Descendant Selector
+ \li \c{QDialog QPushButton}
+ \li Matches all instances of QPushButton that are descendants
+ (children, grandchildren, etc.) of a QDialog.
+
+ \row
+ \li Child Selector
+ \li \c{QDialog > QPushButton}
+ \li Matches all instances of QPushButton that are direct
+ children of a QDialog.
+ \endtable
+
+ \section1 Sub-Controls
+
+ For styling complex widgets, it is necessary to access subcontrols of the
+ widget, such as the drop-down button of a QComboBox or the up and down
+ arrows of a QSpinBox. Selectors may contain \e{subcontrols} that make it
+ possible to restrict the application of a rule to specific widget
+ subcontrols. For example:
+
+ \snippet code/doc_src_stylesheet.qdoc 5
+
+ The above rule styles the drop-down button of all \l{QComboBox}es.
+ Although the double-colon (\c{::}) syntax is reminiscent of CSS3
+ Pseudo-Elements, Qt Sub-Controls differ conceptually from these and have
+ different cascading semantics.
+
+ Sub-controls are always positioned with respect to another element - a
+ reference element. This reference element could be the widget or another
+ Sub-control. For example, the \l{Qt Style Sheets Reference#drop-down-sub}
+ {::drop-down} of a QComboBox is placed, by default, in the top right corner
+ of the Padding rectangle of the QComboBox. The
+ \l{Qt Style Sheets Reference#drop-down-sub}{::drop-down} is placed,
+ by default, in the Center of the Contents rectangle of the
+ \l{Qt Style Sheets Reference#drop-down-sub}{::drop-down} Sub-control. See
+ the \l{List of Stylable Widgets} below for the Sub-controls to use to
+ style a widget and their default positions.
+
+ The origin rectangle to be used can be changed using the
+ \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin}
+ property. For example, if we want to place the drop-down in the margin
+ rectangle of the QComboBox instead of the default Padding rectangle, we
+ can specify:
+
+ \snippet code/doc_src_stylesheet.qdoc 6
+
+ The alignment of the drop-down within the Margin rectangle is changed
+ using \l{Qt Style Sheets Reference#subcontrol-position-prop}
+ {subcontrol-position} property.
+
+ The \l{Qt Style Sheets Reference#width-prop}{width} and
+ \l{Qt Style Sheets Reference#height-prop}{height} properties can be used
+ to control the size of the Sub-control. Note that setting a
+ \l{Qt Style Sheets Reference#image-prop}{image} implicitly sets the size
+ of a Sub-control.
+
+ The relative positioning scheme
+ (\l{Qt Style Sheets Reference#position-prop}{position} : relative),
+ allows the position of the Sub-Control to be offset from its initial
+ position. For example, when the QComboBox's drop-down button is
+ pressed, we might like the arrow inside to be offset to give a
+ "pressed" effect. To achieve this, we can specify:
+
+ \snippet code/doc_src_stylesheet.qdoc 7
+
+ The absolute positioning scheme
+ (\l{Qt Style Sheets Reference#position-prop}{position} : absolute),
+ allows the position and size of the Sub-control to be changed with
+ respect to the reference element.
+
+ Once positioned, they are treated the same as widgets and can be styled
+ using the \l{box model}.
+
+ See the \l{List of Sub-Controls} below for a list of supported
+ sub-controls, and \l{Customizing the QPushButton's Menu Indicator
+ Sub-Control} for a realistic example.
+
+ \note With complex widgets such as QComboBox and QScrollBar, if one
+ property or sub-control is customized, \b{all} the other properties or
+ sub-controls must be customized as well.
+
+ \section1 Pseudo-States
+
+ Selectors may contain \e{pseudo-states} that denote that restrict
+ the application of the rule based on the widget's state.
+ Pseudo-states appear at the end of the selector, with a colon
+ (\c{:}) in between. For example, the following rule applies when
+ the mouse hovers over a QPushButton:
+
+ \snippet code/doc_src_stylesheet.qdoc 8
+
+ Pseudo-states can be negated using the exclamation operator. For
+ example, the following rule applies when the mouse does not hover
+ over a QRadioButton:
+
+ \snippet code/doc_src_stylesheet.qdoc 9
+
+ Pseudo-states can be chained, in which case a logical AND is
+ implied. For example, the following rule applies to when the
+ mouse hovers over a checked QCheckBox:
+
+ \snippet code/doc_src_stylesheet.qdoc 10
+
+ Negated Pseudo-states may appear in Pseudo-state chains. For example,
+ the following rule applies when the mouse hovers over a QPushButton
+ that is not pressed:
+
+ \snippet code/doc_src_stylesheet.qdoc 11
+
+ If needed, logical OR can be expressed using the comma operator:
+
+ \snippet code/doc_src_stylesheet.qdoc 12
+
+ Pseudo-states can appear in combination with subcontrols. For
+ example:
+
+ \snippet code/doc_src_stylesheet.qdoc 13
+
+ See the \l{List of Pseudo-States} section below for the list of
+ pseudo-states provided by Qt widgets.
+
+ \section1 Conflict Resolution
+
+ Conflicts arise when several style rules specify the same
+ properties with different values. Consider the following style
+ sheet:
+
+ \snippet code/doc_src_stylesheet.qdoc 14
+
+ Both rules match QPushButton instances called \c okButton and
+ there is a conflict for the \c color property. To resolve this
+ conflict, we must take into account the \e specificity of the
+ selectors. In the above example, \c{QPushButton#okButton} is
+ considered more specific than \c QPushButton, because it
+ (usually) refers to a single object, not to all instances of a
+ class.
+
+ Similarly, selectors with pseudo-states are more specific than
+ ones that do not specify pseudo-states. Thus, the following style
+ sheet specifies that a \l{QPushButton} should have white text
+ when the mouse is hovering over it, otherwise red text:
+
+ \snippet code/doc_src_stylesheet.qdoc 15
+
+ Here's a tricky one:
+
+ \snippet code/doc_src_stylesheet.qdoc 16
+
+ Here, both selectors have the same specificity, so if the mouse
+ hovers over the button while it is enabled, the second rule takes
+ precedence. If we want the text to be white in that case, we can
+ reorder the rules like this:
+
+ \snippet code/doc_src_stylesheet.qdoc 17
+
+ Alternatively, we can make the first rule more specific:
+
+ \snippet code/doc_src_stylesheet.qdoc 18
+
+ A similar issue arises in conjunction with Type Selectors.
+ Consider the following example:
+
+ \snippet code/doc_src_stylesheet.qdoc 19
+
+ Both rules apply to QPushButton instances (since QPushButton
+ inherits QAbstractButton) and there is a conflict for the
+ \l{Qt Style Sheets Reference#color-prop}{color} property. Because QPushButton
+ inherits QAbstractButton, it might be tempting to assume that
+ \c QPushButton is more specific than \c QAbstractButton. However,
+ for style sheet computations, all Type Selectors have the same
+ specificity, and the rule that appears last takes precedence. In
+ other words, \l{Qt Style Sheets Reference#color-prop}{color} is set to \c gray
+ for all \l{QAbstractButton}s, including \l{QPushButton}s. If we really
+ want \l{QPushButton}s to have red text, we can always reorder the
+ rules.
+
+ For determining the specificity of a rule, Qt Style Sheets follow
+ the
+ \l{http://www.w3.org/TR/REC-CSS2/cascade.html#specificity}{CSS2
+ Specification}:
+
+ \quotation
+ \e{A selector's specificity is calculated as follows:}
+
+ \list
+ \li \e{count the number of ID attributes in the selector (= a)}
+ \li \e{count the number of other attributes and pseudo-classes in the selector (= b)}
+ \li \e{count the number of element names in the selector (= c)}
+ \li \e{ignore pseudo-elements [i.e., \l{subcontrols}].}
+ \endlist
+
+ \e{Concatenating the three numbers a-b-c (in a number system with a
+ large base) gives the specificity.}
+
+ \e{Some examples:}
+
+ \snippet code/doc_src_stylesheet.qdoc 20
+ \endquotation
+
+ \section1 Cascading
+
+ Style sheets can be set on the QApplication, on parent widgets,
+ and on child widgets. An arbitrary widget's effective style sheet
+ is obtained by merging the style sheets set on the widget's
+ ancestors (parent, grandparent, etc.), as well as any style sheet
+ set on the QApplication.
+
+ When conflicts arise, the widget's own style sheet is always
+ preferred to any inherited style sheet, irrespective of the
+ specificity of the conflicting rules. Likewise, the parent
+ widget's style sheet is preferred to the grandparent's, etc.
+
+ One consequence of this is that setting a style rule on a widget
+ automatically gives it precedence over other rules specified in
+ the ancestor widgets' style sheets or the QApplication style
+ sheet. Consider the following example. First, we set a style
+ sheet on the QApplication:
+
+ \snippet code/doc_src_stylesheet.cpp 21
+
+ Then we set a style sheet on a QPushButton object:
+
+ \snippet code/doc_src_stylesheet.cpp 22
+
+ The style sheet on the QPushButton forces the QPushButton (and
+ any child widget) to have blue text, in spite of the more
+ specific rule set provided by the application-wide style sheet.
+
+ The result would have been the same if we had written
+
+ \snippet code/doc_src_stylesheet.cpp 23
+
+ except that if the QPushButton had children (which is unlikely),
+ the style sheet would have no impact on them.
+
+ Style sheet cascading is a complex topic. Refer to the
+ \l{http://www.w3.org/TR/CSS2/cascade.html#cascade}{CSS2
+ Specification} for the gory details. Be aware that Qt currently
+ doesn't implement \c{!important}.
+
+ \section1 Inheritance
+
+ In classic CSS, when font and color of an item is not explicitly set,
+ it gets automatically inherited from the parent. When using Qt Style Sheets,
+ a widget does \b{not} automatically inherit its font and color setting
+ from its parent widget.
+
+ For example, consider a QPushButton inside a QGroupBox:
+
+ \snippet code/doc_src_stylesheet.cpp 24
+
+ The QPushButton does not have an explicit color set. Hence, instead
+ of inheriting color of its parent QGroupBox, it has the system color.
+ If we want to set the color on a QGroupBox and its children,
+ we can write:
+
+ \snippet code/doc_src_stylesheet.cpp 25
+
+ In contrast, setting a font and propagate using QWidget::setFont() and
+ QWidget::setPalette() propagates to child widgets.
+
+ \section1 Widgets inside C++ namespaces
+
+ The Type Selector can be used to style widgets of a particular type. For
+ example,
+
+ \snippet code/doc_src_stylesheet.cpp 26
+
+ Qt Style Sheet uses QObject::className() of the widget to determine
+ when to apply the Type Selector. When custom widgets are inside namespaces,
+ the QObject::className() returns <namespace>::<classname>. This conflicts
+ with the syntax for \l{Sub-Controls}. To overcome this problem,
+ when using the Type Selector for widgets inside namespaces, we must
+ replace the "::" with "--". For example,
+
+ \snippet code/doc_src_stylesheet.cpp 27
+
+ \section1 Setting QObject properties
+
+ From 4.3 and above, any designable Q_PROPERTY
+ can be set using the qproperty-<property name> syntax.
+
+ For example,
+ \snippet code/doc_src_stylesheet.qdoc 28
+
+ If the property references an enum declared with Q_ENUMS, you should
+ reference its constants by name, i.e., not their numeric value.
+
+*/
+
+/*!
+ \page stylesheet-designer.html
+ \contentspage {Qt Style Sheet}{Contents}
+ \previouspage The Style Sheet Syntax
+ \nextpage Customizing Qt Widgets Using Style Sheets
+ \title Qt Designer Integration
+
+ \l{Qt Designer}{Qt Designer} is an excellent tool
+ to preview style sheets. You can right-click on any widget in Designer
+ and select \gui{Change styleSheet...} to set the style sheet.
+
+ \image designer-stylesheet-options.png
+
+ In Qt 4.2 and later, \l{Qt Designer}{Qt Designer} also includes a
+ style sheet syntax highlighter and validator. The validator indicates
+ if the syntax is valid or invalid, at the bottom left of the \gui{Edit
+ Style Sheet} dialog.
+
+ \image designer-validator-highlighter.png
+
+ When you click \gui{OK} or \gui{Apply}, \QD will automatically display
+ the widget with its new stylesheet.
+
+ \image designer-stylesheet-usage.png
+ */
+
+/*!
+ \page stylesheet-customizing.html
+ \contentspage {Qt Style Sheet}{Contents}
+ \previouspage Qt Designer Integration
+ \nextpage Qt Style Sheets Reference
+ \title Customizing Qt Widgets Using Style Sheets
+
+ When using style sheets, every widget is treated as a box with four
+ concentric rectangles: the margin rectangle, the border rectangle, the
+ padding rectangle, and the content rectangle. The box model describes
+ this in further detail.
+
+ \tableofcontents
+
+ \target box model
+ \section1 The Box Model
+
+ The four concentric rectangles appear conceptually as below:
+
+ \image stylesheet-boxmodel.png
+
+ \list
+ \li The margin falls outside the border.
+ \li The border is drawn between the margin and the padding.
+ \li The padding falls inside the border, between the border and
+ the actual contents.
+ \li The content is what is left from the original widget or
+ subcontrol once we have removed the margin, the border, and
+ the padding.
+ \endlist
+
+ The \l{Qt Style Sheets Reference#margin-prop}{margin},
+ \l{Qt Style Sheets Reference#border-width-prop}
+ {border-width}, and
+ \l{Qt Style Sheets Reference#padding-prop}{padding}
+ properties all default to zero. In that case, all four rectangles
+ (\c margin, \c border, \c padding, and \c content) coincide exactly.
+
+ You can specify a background for the widget using the
+ \l{Qt Style Sheets Reference#background-image-prop}{background-image}
+ property. By default, the background-image is drawn only for the area
+ inside the border. This can be changed using the
+ \l{Qt Style Sheets Reference#background-clip-prop}{background-clip}
+ property. You can use
+ \l{Qt Style Sheets Reference#background-repeat-prop}{background-repeat}
+ and
+ \l{Qt Style Sheets Reference#background-origin-prop}{background-origin}
+ to control the repetition and origin of the background image.
+
+ A background-image does not scale with the size of the widget. To provide
+ a "skin" or background that scales along with the widget size, one must
+ use
+ \l{Qt Style Sheets Reference#border-image-prop}{border-image}. Since the
+ border-image property provides an alternate background, it is not required
+ to specify a background-image when border-image is specified. In the case,
+ when both of them are specified, the border-image draws over the
+ background-image.
+
+ In addition, the \l{Qt Style Sheets Reference#image-prop}{image} property
+ may be used to draw an image over the border-image. The image specified does
+ not tile or stretch and when its size does not match the size of the widget,
+ its alignment is specified using the
+ \l{Qt Style Sheets Reference#image-position-prop}{image-position}
+ property. Unlike background-image and border-image, one may specify a
+ SVG in the image property, in which case the image is scaled automatically
+ according to the widget size.
+
+ The steps to render a rule are as follows:
+ \list
+ \li Set clip for entire rendering operation (border-radius)
+ \li Draw the background (background-image)
+ \li Draw the border (border-image, border)
+ \li Draw overlay image (image)
+ \endlist
+
+ \target sub controls
+ \section1 Sub-controls
+
+ A widget is considered as a hierarchy (tree) of subcontrols drawn on top
+ of each other. For example, the QComboBox draws the drop-down sub-control
+ followed by the down-arrow sub-control. A QComboBox is thus rendered as
+ follows:
+ \list
+ \li Render the QComboBox { } rule
+ \li Render the QComboBox::drop-down { } rule
+ \li Render the QComboBox::down-arrow { } rule
+ \endlist
+
+ Sub-controls share a parent-child relationship. In the case of QComboBox,
+ the parent of down-arrow is the drop-down and the parent of drop-down is
+ the widget itself. Sub-controls are positioned within their parent using
+ the \l{Qt Style Sheets Reference#subcontrol-position-prop}
+ {subcontrol-position} and
+ \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin}
+ properties.
+
+ Once positioned, sub-controls can be styled using the \l{box model}.
+
+ \note With complex widgets such as QComboBox and QScrollBar, if one
+ property or sub-control is customized, \b{all} the other properties or
+ sub-controls must be customized as well.
+
+*/
+
+/*!
+ \page stylesheet-reference.html
+ \contentspage {Qt Style Sheet}{Contents}
+ \previouspage Customizing Qt Widgets Using Style Sheets
+ \nextpage Qt Style Sheets Examples
+ \title Qt Style Sheets Reference
+
+ Qt Style Sheets support various properties, pseudo-states, and
+ subcontrols that make it possible to customize the look of
+ widgets.
+
+ \tableofcontents
+
+ \section1 List of Stylable Widgets
+
+ The following table lists the Qt widgets that can be customized
+ using style sheets:
+
+ \table 100%
+ \header
+ \li Widget
+ \li How to Style
+
+ \row
+ \li QAbstractScrollArea \target qabstractscrollarea-widget
+ \li Supports the \l{box model}.
+
+ All derivatives of QAbstractScrollArea, including QTextEdit,
+ and QAbstractItemView (all item view classes), support
+ scrollable backgrounds using
+ \l{Qt Style Sheets Reference#background-attachment-prop}
+ {background-attachment}. Setting the background-attachment to
+ \c{fixed} provides a background-image that does not scroll with the
+ viewport. Setting the background-attachment to \c{scroll}, scrolls
+ the background-image when the scroll bars move.
+
+ See \l{Qt Style Sheets Examples#Customizing QAbstractScrollArea}
+ {Customizing QAbstractScrollArea} for an example.
+
+ \row
+ \li QCheckBox \target qcheckbox-widget
+ \li Supports the \l{box model}. The check indicator can be
+ styled using the \l{#indicator-sub}{::indicator}
+ subcontrol. By default, the indicator is placed in the Top
+ Left corner of the Contents rectangle of the widget.
+
+ The \l{#spacing-prop}{spacing} property
+ specifies the spacing between the check indicator and
+ the text.
+
+ See \l{Qt Style Sheets Examples#Customizing QCheckBox}
+ {Customizing QCheckBox} for an example.
+
+ \row
+ \li QColumnView \target qcolumnview-widget
+ \li The grip can be styled be using the \l{image-prop}{image} property.
+ The arrow indicators can by styled using the
+ \l{left-arrow-sub}{::left-arrow} subcontrol and the
+ \l{right-arrow-sub}{::right-arrow} subcontrol.
+
+ \row
+ \li QComboBox \target qcombobox-widget
+ \li The frame around the combobox can be styled using the
+ \l{box model}. The drop-down button can be styled using
+ the \l{#drop-down-sub}{::drop-down} subcontrol. By default, the
+ drop-down button is placed in the top right corner of the padding
+ rectangle of the widget. The arrow mark inside the drop-down button
+ can be styled using the \l{#down-arrow-sub}{::down-arrow}
+ subcontrol. By default, the arrow is placed in the center of the
+ contents rectangle of the drop-down subcontrol.
+
+ See \l{Qt Style Sheets Examples#Customizing QComboBox}{Customizing QComboBox}
+ for an example.
+
+ \row
+ \li QDateEdit \target qdateedit-widget
+ \li See \l{#qspinbox-widget}{QSpinBox}.
+
+ \row
+ \li QDateTimeEdit \target qdatetimeedit-widget
+ \li See \l{#qspinbox-widget}{QSpinBox}.
+
+ \row
+ \li QDialog \target qdialog-widget
+ \li Supports only the \l{Qt Style Sheets Reference#background-prop}{background},
+ \l{#background-clip-prop}{background-clip} and
+ \l{#background-origin-prop}{background-origin} properties.
+
+ \warning Make sure you define the Q_OBJECT macro for your custom
+ widget.
+
+ \row
+ \li QDialogButtonBox \target qdialogbuttonbox-widget
+ \li The layout of buttons can be altered using the
+ \l{#button-layout-prop}{button-layout} property.
+
+ \row
+ \li QDockWidget \target qdockwidget-widget
+ \li Supports styling of the title bar and the title bar buttons when docked.
+
+ The dock widget border can be styled using the \l{#border-prop}{border}
+ property. The \l{#title-sub}{::title} subcontrol can be used to customize
+ the title bar. The close and float buttons are positioned with respect
+ to the \l{title-sub}{::title} subcontrol using the
+ \l{#close-button-sub}{::close-button} and
+ \l{#float-button-sub}{::float-button} respectively.
+
+ When the title bar is vertical, the \l{#vertical-ps}{:vertical} pseudo
+ class is set. In addition, depending on QDockWidget::DockWidgetFeature,
+ the \l{#closable-ps}{:closable}, \l{#floatable-ps}{:floatable} and
+ \l{#movable-ps}{:movable} pseudo states are set.
+
+ \note Use QMainWindow::separator to style the resize handle.
+
+ \warning The style sheet has no effect when the QDockWidget is undocked
+ as Qt uses native top level windows when undocked.
+
+ See \l{Qt Style Sheets Examples#Customizing QDockWidget}
+ {Customizing QDockWidget} for an example.
+
+ \row
+ \li QDoubleSpinBox \target qdoublespinbox-widget
+ \li See \l{#qspinbox-widget}{QSpinBox}.
+
+ \row
+ \li QFrame \target qframe-widget
+ \li Supports the \l{box model}.
+
+ Since 4.3, setting a stylesheet on a QLabel automatically
+ sets the QFrame::frameStyle property to QFrame::StyledPanel.
+
+ See \l{Qt Style Sheets Examples#Customizing QFrame}{Customizing QFrame}
+ for an example.
+
+ \row
+ \li QGroupBox \target qgroupbox-widget
+ \li Supports the \l{box model}. The title can be styled using the
+ \l{#title-sub}{::title} subcontrol. By default, the title is placed
+ depending on QGroupBox::textAlignment.
+
+ In the case of a checkable QGroupBox, the title includes the
+ check indicator. The indicator is styled using the
+ the \l{#indicator-sub}{::indicator} subcontrol. The
+ \l{#spacing-prop}{spacing} property can be used to control
+ the spacing between the text and indicator.
+
+ See \l{Qt Style Sheets Examples#Customizing QGroupBox}{Customizing QGroupBox}
+ for an example.
+
+ \row
+ \li QHeaderView \target qheaderview-widget
+ \li Supports the \l{box model}. The sections of the header view are
+ styled using the \l{#section-sub}{::section} sub control. The
+ \c{section} Sub-control supports the \l{#middle-ps}{:middle},
+ \l{#first-ps}{:first}, \l{#last-ps}{:last},
+ \l{#only-one-ps}{:only-one}, \l{#next-selected-ps}{:next-selected},
+ \l{#previous-selected-ps}{:previous-selected},
+ \l{#selected-ps}{:selected},
+ and \l{#checked-ps}{:checked} pseudo states.
+
+ Sort indicator in can be styled using the
+ \l{#up-arrow-sub}{::up-arrow} and the
+ \l{#down-arrow-sub}{::down-arrow} Sub-control.
+
+ See \l{Qt Style Sheets Examples#Customizing QHeaderView}{Customizing QHeaderView}
+ for an example.
+
+ \row
+ \li QLabel \target qlabel-widget
+ \li Supports the \l{box model}. Does not support the
+ \l{#hover-ps}{:hover} pseudo-state.
+
+ Since 4.3, setting a stylesheet on a QLabel automatically
+ sets the QFrame::frameStyle property to QFrame::StyledPanel.
+
+ See \l{Qt Style Sheets Examples#Customizing QFrame}{Customizing QFrame} for an
+ example (a QLabel derives from QFrame).
+
+ \row
+ \li QLineEdit \target qlineedit-widget
+ \li Support the \l{box model}.
+
+ The color and background of the selected item is styled using
+ \l{#selection-color-prop}{selection-color} and
+ \l{#selection-background-color-prop}{selection-background-color}
+ respectively.
+
+ The password character can be styled using the
+ \l{#lineedit-password-character-prop}{lineedit-password-character}
+ property.
+
+ See \l{Qt Style Sheets Examples#Customizing QLineEdit}{Customizing QLineEdit}
+ for an example.
+
+ \row
+ \li QListView \target qlistview-widget
+ \li Supports the \l{box model}. When
+ \l{QAbstractItemView::alternatingRowColors}{alternating row colors}
+ is enabled, the alternating colors can be styled using the
+ \l{#alternate-background-color-prop}{alternate-background-color}
+ property.
+
+ The color and background of the selected item is styled using
+ \l{#selection-color-prop}{selection-color} and
+ \l{#selection-background-color-prop}{selection-background-color}
+ respectively.
+
+ The selection behavior is controlled by the
+ \l{#show-decoration-selected-prop}{show-decoration-selected} property.
+
+ Use the \l{#item-sub}{::item} subcontrol for more fine grained
+ control over the items in the QListView.
+
+ See \l{qabstractscrollarea-widget}{QAbsractScrollArea} to
+ style scrollable backgrounds.
+
+ See \l{Qt Style Sheets Examples#Customizing QListView}
+ {Customzing QListView} for an example.
+
+ \row
+ \li QListWidget \target qlistwidget-widget
+ \li See \l{#qlistview-widget}{QListView}.
+
+ \row
+ \li QMainWindow \target qmainwindow-widget
+ \li Supports styling of the separator
+
+ The separator in a QMainWindow when using QDockWidget is styled
+ using the \l{#separator-sub}{::separator} subcontrol.
+
+ See \l{Qt Style Sheets Examples#Customizing QMainWindow}{Customizing QMainWindow}
+ for an example.
+
+ \row
+ \li QMenu \target qmenu-widget
+ \li Supports the \l{box model}.
+
+ Individual items are styled using the \l{#item-sub}{::item}
+ subcontrol. In addition to the usually supported pseudo states,
+ \c{item} subcontrol supports the
+ \l{#selected-ps}{:selected}, \l{#default-ps}{:default},
+ \l{#exclusive-ps}{:exclusive} and the
+ \l{#non-exclusive-ps}{non-exclusive} pseudo states.
+
+ The indicator of checkable menu items is styled using the
+ \l{#indicator-sub}{::indicator} subcontrol.
+
+ The separator is styled using the \l{#separator-sub}{::separator}
+ subcontrol.
+
+ For items with a sub menu, the arrow marks are styled using the
+ \l{right-arrow-sub}{right-arrow} and
+ \l{left-arrow-sub}{left-arrow}.
+
+ The scroller is styled using the \l{#scroller-sub}{::scroller}.
+
+ The tear-off is styled using the \l{#tearoff-sub}{::tearoff}.
+
+ See \l{Qt Style Sheets Examples#Customizing QMenu}{Customizing QMenu}
+ for an example.
+
+ \row
+ \li QMenuBar \target qmenubar-widget
+ \li Supports the \l{box model}. The \l{#spacing-prop}{spacing}
+ property specifies the spacing between menu items.
+ Individual items are styled using the \l{#item-sub}{::item}
+ subcontrol.
+
+ \warning When running on Qt/Mac, the menu bar is usually embedded into the
+ system-wide menu bar. In this case, the style sheet will have no effect.
+
+ See \l{Qt Style Sheets Examples#Customizing QMenuBar}{Customizing QMenuBar}
+ for an example.
+
+ \row
+ \li QMessageBox \target qmessagebox-widget
+ \li The \l{#messagebox-text-interaction-flags-prop}
+ {messagebox-text-interaction-flags} property can be used to alter
+ the interaction with text in the message box.
+
+ \row
+ \li QProgressBar \target qprogressbar-widget
+ \li Supports the \l{box model}. The chunks of the progress bar
+ can be styled using the \l{#chunk-sub}{::chunk} subcontrol.
+ The chunk is displayed on the Contents rectangle of the widget.
+
+ If the progress bar displays text, use the \l{text-align-prop}{text-align}
+ property to position the text.
+
+ Indeterminate progress bars have the
+ \l{#indeterminate-ps}{:indeterminate} pseudo state set.
+
+ See \l{Qt Style Sheets Examples#Customizing QProgressBar}{Customizing QProgressBar}
+ for an example.
+
+ \row
+ \li QPushButton \target qpushbutton-widget
+ \li Supports the \l{box model}. Supports the \l{#default-ps}{:default},
+ \l{#flat-ps}{:flat}, \l{#checked-ps}{:checked} pseudo states.
+
+ For QPushButton with a menu, the menu indicator is styled
+ using the \l{#menu-indicator-sub}{::menu-indicator}
+ subcontrol. Appearance of checkable push buttons can be
+ customized using the \l{#open-ps}{:open} and
+ \l{#closed-ps}{:closed} pseudo-states.
+
+ \warning If you only set a background-color on a QPushButton, the background
+ may not appear unless you set the border property to some value. This is
+ because, by default, the QPushButton draws a native border which completely
+ overlaps the background-color. For example,
+
+ \snippet code/doc_src_stylesheet.qdoc 30
+
+ See \l{Qt Style Sheets Examples#Customizing QPushButton}{Customizing QPushButton}
+ for an example.
+
+ \row
+ \li QRadioButton \target qradiobutton-widget
+ \li Supports the \l{box model}. The check indicator can be
+ styled using the \l{#indicator-sub}{::indicator}
+ subcontrol. By default, the indicator is placed in the Top
+ Left corner of the Contents rectangle of the widget.
+
+ The \l{#spacing-prop}{spacing} property
+ specifies the spacing between the check indicator and
+ the text.
+
+ See \l{Qt Style Sheets Examples#Customizing QRadioButton}
+ {Customizing QRadioButton} for an example.
+
+ \row
+ \li QScrollBar \target qscrollbar-widget
+ \li Supports the \l{box model}. The Contents rectangle of the widget
+ is considered to be the groove over which the slider moves. The extent
+ of the QScrollBar (i.e the width or the height depending on the orientation)
+ is set using the \l{#width-prop}{width} or \l{#height-prop}{height} property
+ respectively. To determine the orientation, use the
+ \l{#horizontal-ps}{:horizontal} and the \l{vertical-ps}{:vertical}
+ pseudo states.
+
+ The slider can be styled using the \l{#handle-sub}{::handle} subcontrol.
+ Setting the \l{#min-width-prop}{min-width} or \l{#min-height-prop}{min-height}
+ provides size contraints for the slider depending on the orientation.
+
+ The \l{add-line-sub}{::add-line} subcontrol can be used to style the
+ button to add a line. By default, the add-line subcontrol is placed in
+ top right corner of the Border rectangle of the widget. Depending on the
+ orientation the \l{#right-arrow-sub}{::right-arrow} or
+ \l{#down-arrow-sub}{::down-arrow}. By default, the arrows are placed in
+ the center of the Contents rectangle of the add-line subcontrol.
+
+ The \l{sub-line-sub}{::sub-line} subcontrol can be used to style the
+ button to subtract a line. By default, the sub-line subcontrol is placed in
+ bottom right corner of the Border rectangle of the widget. Depending on the
+ orientation the \l{#left-arrow-sub}{::left-arrow} or
+ \l{#up-arrow-sub}{::up-arrow}. By default, the arrows are placed in
+ the center of the Contents rectangle of the sub-line subcontrol.
+
+ The \l{sub-page-sub}{::sub-page} subcontrol can be used to style the
+ region of the slider that subtracts a page. The \l{add-page-sub}{::add-page}
+ subcontrol can be used to style the region of the slider that adds a page.
+
+ See \l{Qt Style Sheets Examples#Customizing QScrollBar}{Customizing QScrollBar}
+ for an example.
+
+ \row
+ \li QSizeGrip \target qsizegrip-widget
+ \li Supports the \l{#width-prop}{width},
+ \l{#height-prop}{height}, and \l{#image-prop}{image}
+ properties.
+
+ See \l{Qt Style Sheets Examples#Customizing QSizeGrip}{Customizing QSizeGrip}
+ for an example.
+
+ \row
+ \li QSlider \target qslider-widget
+ \li Supports the \l{box model}. For horizontal slides, the
+ \l{min-width-prop}{min-width} and \l{height-prop}{height}
+ properties must be provided. For vertical sliders, the
+ \l{min-height-prop}{min-height} and \l{width-prop}{width}
+ properties must be provided.
+
+ The groove of the slider is styled
+ using the \l{#groove-sub}{::groove}. The groove is
+ positioned by default in the Contents rectangle of the widget.
+ The thumb of the slider is styled using \l{#handle-sub}{::handle}
+ subcontrol. The subcontrol moves in the Contents rectangle of
+ the groove subcontrol.
+
+ See \l{Qt Style Sheets Examples#Customizing QSlider}{Customizing QSlider}
+ for an example.
+
+ \row
+ \li QSpinBox \target qspinbox-widget
+ \li The frame of the spin box can be styled using the \l{box
+ model}.
+
+ The up button and arrow can be styled using the
+ \l{#up-button-sub}{::up-button} and
+ \l{#up-arrow-sub}{::up-arrow} subcontrols. By default,
+ the up-button is placed in the top right corner in the
+ Padding rectangle of the widget. Without an explicit size,
+ it occupies half the height of its reference rectangle.
+ The up-arrow is placed in the center of the Contents
+ rectangle of the up-button.
+
+ The down button and arrow can be styled using the
+ \l{#down-button-sub}{::down-button} and
+ \l{#down-arrow-sub}{::down-arrow} subcontrols. By default,
+ the down-button is placed in the bottom right corner in the
+ Padding rectangle of the widget. Without an explicit size,
+ it occupies half the height of its reference rectangle.
+ The bottom-arrow is placed in the center of the Contents
+ rectangle of the bottom-button.
+
+ See \l{Qt Style Sheets Examples#Customizing QSpinBox}{Customizing QSpinBox}
+ for an example.
+
+ \row
+ \li QSplitter \target qsplitter-widget
+ \li Supports the \l{box model}. The handle of the splitter
+ is styled using the \l{#handle-sub}{::handle} subcontrol.
+
+ See \l{Qt Style Sheets Examples#Customizing QSplitter}{Customizing QSplitter}
+ for an example.
+
+ \row
+ \li QStatusBar \target qstatusbar-widget
+ \li Supports only the \l{Qt Style Sheets Reference#background-prop}
+ {background} property.
+ The frame for individual items can be style using the
+ \l{#item-sub}{::item} subcontrol.
+
+ See \l{Qt Style Sheets Examples#Customizing QStatusBar}{Customizing QStatusBar}
+ for an example.
+
+ \row
+ \li QTabBar \target qtabbar-widget
+ \li Individual tabs may be styled using the \l{#tab-sub}{::tab} subcontrol.
+ Close buttons using the \l{#close-button-sub}{::close-button}
+ The tabs support the
+ \l{#only-one-ps}{:only-one}, \l{#first-ps}{:first},
+ \l{#last-ps}{:last}, \l{#middle-ps}{:middle},
+ \l{#previous-selected-ps}{:previous--selected},
+ \l{#next-selected-ps}{:next-selected},
+ \l{#selected-ps}{:selected} pseudo states.
+
+ The \l{#top-ps}{:top}, \l{#left-ps}{:left}, \l{#right-ps}{:right},
+ \l{#bottom-ps}{:bottom} pseudo states depending on the orientation
+ of the tabs.
+
+ Overlapping tabs for the selected state are created by using
+ negative margins or using the \c{absolute} position scheme.
+
+ The tear indicator of the QTabBar is styled using the
+ \l{#tear-sub}{::tear} subcontrol.
+
+ QTabBar used two QToolButtons for its scrollers that can be styled
+ using the \c{QTabBar QToolButton} selector. To specify the width
+ of the scroll button use the \l{#scroller-sub}{::scroller}
+ subcontrol.
+
+ The alignment of the tabs within the QTabBar is styled
+ using the \l{#Alignment}{alignment} property. \warning
+
+ To change the position of the QTabBar within a QTabWidget, use the
+ \l{#tab-bar-sub}{tab-bar} subcontrol (and set subcontrol-position).
+
+ See \l{Qt Style Sheets Examples#Customizing QTabWidget and QTabBar}{Customizing QTabBar}
+ for an example.
+
+ \row
+ \li QTabWidget \target qtabwidget-widget
+ \li The frame of the tab widget is styled using the
+ \l{#pane-sub}{::pane} subcontrol. The left and right
+ corners are styled using the \l{#left-corner-sub}{::left-corner}
+ and \l{#right-corner-sub}{::right-corner} respectively.
+ The position of the tab bar is controlled using the
+ \l{#tab-bar-sub}{::tab-bar} subcontrol.
+
+ By default, the subcontrols have positions of a QTabWidget in
+ the QWindowsStyle. To place the QTabBar in the center, set the
+ subcontrol-position of the tab-bar subcontrol.
+
+ The \l{#top-ps}{:top}, \l{#left-ps}{:left}, \l{#right-ps}{:right},
+ \l{#bottom-ps}{:bottom} pseudo states depending on the orientation
+ of the tabs.
+
+ See \l{Qt Style Sheets Examples#Customizing QTabWidget and QTabBar}
+ {Customizing QTabWidget} for an example.
+
+ \row
+ \li QTableView \target qtableview-widget
+ \li Supports the \l{box model}. When
+ \l{QAbstractItemView::alternatingRowColors}{alternating row colors}
+ is enabled, the alternating colors can be styled using the
+ \l{#alternate-background-color-prop}{alternate-background-color}
+ property.
+
+ The color and background of the selected item is styled using
+ \l{#selection-color-prop}{selection-color} and
+ \l{#selection-background-color-prop}{selection-background-color}
+ respectively.
+
+ The corner widget in a QTableView is implemented as a QAbstractButton
+ and can be styled using the "QTableView QTableCornerButton::section"
+ selector.
+
+ \warning If you only set a background-color on a QTableCornerButton,
+ the background may not appear unless you set the border property to
+ some value. This is because, by default, the QTableCornerButton draws a
+ native border which completely overlaps the background-color.
+
+ The color of the grid can be specified using the
+ \l{#gridline-color-prop}{gridline-color} property.
+
+ See \l{qabstractscrollarea-widget}{QAbsractScrollArea} to
+ style scrollable backgrounds.
+
+ See \l{Qt Style Sheets Examples#Customizing QTableView}
+ {Customzing QTableView} for an example.
+
+ \row
+ \li QTableWidget \target qtablewidget-widget
+ \li See \l{#qtableview-widget}{QTableView}.
+
+ \row
+ \li QTextEdit \target qtextedit-widget
+ \li Supports the \l{box model}.
+
+ The color and background of selected text is styled using
+ \l{#selection-color-prop}{selection-color} and
+ \l{#selection-background-color-prop}{selection-background-color}
+ respectively.
+
+ See \l{qabstractscrollarea-widget}{QAbsractScrollArea} to
+ style scrollable backgrounds.
+
+ \row
+ \li QTimeEdit \target qtimeedit-widget
+ \li See \l{#qspinbox-widget}{QSpinBox}.
+
+ \row
+ \li QToolBar \target qtoolbar-widget
+ \li Supports the \l{box model}.
+
+ The \l{#top-ps}{:top}, \l{#left-ps}{:left}, \l{#right-ps}{:right},
+ \l{#bottom-ps}{:bottom} pseudo states depending on the area in
+ which the tool bar is grouped.
+
+ The \l{#first-ps}{:first}, \l{#last-ps}{:last}, \l{#middle-ps}{:middle},
+ \l{#only-one-ps}{:only-one} pseudo states indicator the position
+ of the tool bar within a line group (See
+ QStyleOptionToolBar::positionWithinLine).
+
+ The separator of a QToolBar is styled using the
+ \l{#separator-sub}{::separator} subcontrol.
+
+ The handle (to move the toolbar) is styled using the
+ \l{#handle-sub}{::handle} subcontrol.
+
+ See \l{Qt Style Sheets Examples#Customizing QToolBar}{Customizing QToolBar}
+ for an example.
+
+ \row
+ \li QToolButton \target qtoolbutton-widget
+ \li Supports the \l{box model}.
+
+ If the QToolButton has a menu, is
+ \l{#menu-indicator-sub}{::menu-indicator} subcontrol can be used to
+ style the indicator. By default, the menu-indicator is positioned
+ at the bottom right of the Padding rectangle of the widget.
+
+ If the QToolButton is in QToolButton::MenuButtonPopup mode,
+ the \l{#menu-button-sub}{::menu-button} subcontrol is used to draw the
+ menu button. \l{#menu-arrow-sub}{::menu-arrow} subcontrol is used to
+ draw the menu arrow inside the menu-button. By default, it is
+ positioned in the center of the Contents rectangle of the
+ menu-button subcontrol.
+
+ When the QToolButton displays arrows, the \l{#up-arrow-sub}{::up-arrow},
+ \l{#down-arrow-sub}{::down-arrow}, \l{#left-arrow-sub}{::left-arrow}
+ and \l{#right-arrow-sub}{::right-arrow} subcontrols are used.
+
+ \warning If you only set a background-color on a QToolButton, the background
+ will not appear unless you set the border property to some value. This is
+ because, by default, the QToolButton draws a native border which completely
+ overlaps the background-color. For example,
+
+ \snippet code/doc_src_stylesheet.qdoc 31
+
+ See \l{Qt Style Sheets Examples#Customizing QToolButton}{Customizing QToolButton}
+ for an example.
+
+ \row
+ \li QToolBox \target qtoolbox-widget
+ \li Supports the \l{box model}.
+
+ The individual tabs can by styled using the
+ \l{#tab-sub}{::tab} subcontrol. The tabs support the
+ \l{#only-one-ps}{:only-one}, \l{#first-ps}{:first},
+ \l{#last-ps}{:last}, \l{#middle-ps}{:middle},
+ \l{#previous-selected-ps}{:previous-selected},
+ \l{#next-selected-ps}{:next-selected},
+ \l{#selected-ps}{:selected} pseudo states.
+
+ \row
+ \li QToolTip \target qtooltip-widget
+ \li Supports the \l{box model}. The \l{#opacity-prop}{opacity}
+ property controls the opacity of the tooltip.
+
+ See \l{Qt Style Sheets Examples#Customizing QFrame}{Customizing QFrame}
+ for an example (a QToolTip is a QFrame).
+
+ \row
+ \li QTreeView \target qtreeview-widget
+ \li Supports the \l{box model}. When
+ \l{QAbstractItemView::alternatingRowColors}{alternating row colors}
+ is enabled, the alternating colors can be styled using the
+ \l{#alternate-background-color-prop}{alternate-background-color}
+ property.
+
+ The color and background of the selected item is styled using
+ \l{#selection-color-prop}{selection-color} and
+ \l{#selection-background-color-prop}{selection-background-color}
+ respectively.
+
+ The selection behavior is controlled by the
+ \l{#show-decoration-selected-prop}{show-decoration-selected} property.
+
+ The branches of the tree view can be styled using the
+ \l{#branch-sub}{::branch} subcontrol. The
+ ::branch Sub-control supports the \l{open-ps}{:open},
+ \l{closed-ps}{:closed}, \l{has-siblings-ps}{:has-sibling} and
+ \l{has-children-ps}{:has-children} pseudo states.
+
+ Use the \l{#item-sub}{::item} subcontrol for more fine grained
+ control over the items in the QTreeView.
+
+ See \l{qabstractscrollarea-widget}{QAbsractScrollArea} to
+ style scrollable backgrounds.
+
+ See \l{Qt Style Sheets Examples#Customizing QTreeView}{Customizing QTreeView}
+ for an example to style the branches.
+
+ \row
+ \li QTreeWidget \target qtreewidget-widget
+ \li See \l{#qtreeview-widget}{QTreeView}.
+
+ \row
+ \li QWidget \target qwidget-widget
+ \li Supports only the \l{Qt Style Sheets Reference#background-prop}{background},
+ \l{#background-clip-prop}{background-clip} and
+ \l{#background-origin-prop}{background-origin} properties.
+
+ If you subclass from QWidget, you need to provide a paintEvent for your
+ custom QWidget as below:
+ \snippet code/doc_src_stylesheet.cpp 32
+
+ The above code is a no-operation if there is no stylesheet set.
+
+ \warning Make sure you define the Q_OBJECT macro for your custom
+ widget.
+
+ \endtable
+
+ \section1 List of Properties
+
+ The table below lists all the properties supported by Qt Style
+ Sheets. Which values can be given to an property depend on the
+ \l{List of Property Types}{property's type}. Unless otherwise
+ specified, properties below apply to all widgets. Properties
+ marked with an asterisk * are specific to Qt and have no equivalent
+ in CSS2 or CSS3.
+
+ \table 100%
+ \header
+ \li Property
+ \li Type
+ \li Description
+
+ \row
+ \li \b{\c alternate-background-color} \target alternate-background-color-prop
+ \li \l{#Brush}{Brush} \BR
+ \li The \l{QAbstractItemView::alternatingRowColors}
+ {alternate background color} used in QAbstractItemView subclasses.
+
+ If this property is not set, the default value is
+ whatever is set for the palette's
+ \l{QPalette::}{AlternateBase} role.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 33
+
+ See also \l{Qt Style Sheets Reference#background-prop}{background} and
+ \l{#selection-background-color-prop}{selection-background-color}.
+
+ \row
+ \li \b{\c background} \target background-prop
+ \li \l{#Background}{Background}
+ \li Shorthand notation for setting the background. Equivalent
+ to specifying \c background-color, \c background-image, \c
+ background-repeat, and/or \c background-position.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QDialog, QFrame, QGroupBox, QLabel, QLineEdit,
+ QMenu, QMenuBar, QPushButton, QRadioButton, QSplitter,
+ QTextEdit, QToolTip, and plain \l{QWidget}s.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 34
+
+
+ Often, it is required to set a fill pattern similar to the styles
+ in Qt::BrushStyle. You can use the background-color property for
+ Qt::SolidPattern, Qt::RadialGradientPattern, Qt::LinearGradientPattern
+ and Qt::ConicalGradientPattern. The other patterns are easily achieved
+ by creating a background image that contains the pattern.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 35
+
+ See also \l{#background-origin-prop}{background-origin},
+ \l{#selection-background-color-prop}{selection-background-color},
+ \l{#background-clip-prop}{background-clip},
+ \l{#background-attachment-prop}{background-attachment}
+ and \l{#alternate-background-color-prop}{alternate-background-color}.
+
+ \row
+ \li \c background-color \target background-color-prop
+ \li \l{#Brush}{Brush} \BR
+ \li The background color used for the widget.
+
+ Examples:
+
+ \snippet code/doc_src_stylesheet.qdoc 36
+
+ \row
+ \li \c background-image \target background-image-prop
+ \li \l{#Url}{Url}
+ \li The background image used for the widget. Semi-transparent
+ parts of the image let the \c background-color shine
+ through.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 37
+
+ \row
+ \li \c background-repeat \target background-repeat-prop
+ \li \l{#Repeat}{Repeat}
+ \li Whether and how the background image is repeated to fill
+ the \c background-origin rectangle.
+
+ If this property is not specified, the background image
+ is repeated in both directions (\c repeat).
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 38
+
+ \row
+ \li \c background-position
+ \li \l{#Alignment}{Alignment}
+ \li The alignment of the background image within the \c
+ background-origin rectangle.
+
+ If this property is not specified, the alignment is \c
+ top \c left.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 39
+
+ \row
+ \li \b{\c background-attachment} \target background-attachment-prop
+ \li \l{#Attachment}{Attachment}
+ \li Determines whether the background-image in a QAbstractScrollArea
+ is scrolled or fixed with respect to the viewport.
+ By default, the background-image scrolls with the viewport.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 40
+
+ See also \l{Qt Style Sheets Reference#background-prop}{background}
+
+ \row
+ \li \b{\c background-clip} \target background-clip-prop
+ \li \l{#Origin}{Origin}
+ \li The widget's rectangle, in which the \c background is drawn.
+
+ This property specifies the rectangle to which the \c background-color
+ and \c background-image are clipped.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QDialog, QFrame, QGroupBox, QLabel,
+ QPushButton, QRadioButton, QSplitter, QTextEdit, QToolTip,
+ and plain \l{QWidget}s.
+
+ If this property is not specified, the default is \c
+ border.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 41
+
+ See also \l{Qt Style Sheets Reference#background-prop}{background},
+ \l{#background-origin-prop}{background-origin} and \l{The Box Model}.
+
+ \row
+ \li \b{\c background-origin} \target background-origin-prop
+ \li \l{#Origin}{Origin}
+ \li The widget's background rectangle, to use in conjunction
+ with \c background-position and \c background-image.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QDialog, QFrame, QGroupBox, QLabel,
+ QPushButton, QRadioButton, QSplitter, QTextEdit, QToolTip,
+ and plain \l{QWidget}s.
+
+ If this property is not specified, the default is \c
+ padding.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 42
+
+ See also \l{Qt Style Sheets Reference#background-prop}{background} and
+ \l{The Box Model}.
+
+ \row
+ \li \b{\c border} \target border-prop
+ \li \l{#Border}{Border}
+ \li Shorthand notation for setting the widget's border. Equivalent
+ to specifying \c border-color, \c border-style, and/or
+ \c border-width.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit,
+ QMenu, QMenuBar, QPushButton, QRadioButton, QSplitter,
+ QTextEdit, QToolTip, and plain \l{QWidget}s.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 43
+
+ \row
+ \li \c border-top
+ \li \l{#Border}{Border}
+ \li Shorthand notation for setting the widget's top border.
+ Equivalent to specifying \c border-top-color, \c
+ border-top-style, and/or \c border-top-width.
+
+ \row
+ \li \c border-right
+ \li \l{#Border}{Border}
+ \li Shorthand notation for setting the widget's right border.
+ Equivalent to specifying \c border-right-color, \c
+ border-right-style, and/or \c border-right-width.
+
+ \row
+ \li \c border-bottom
+ \li \l{#Border}{Border}
+ \li Shorthand notation for setting the widget's bottom border.
+ Equivalent to specifying \c border-bottom-color, \c
+ border-bottom-style, and/or \c border-bottom-width.
+
+ \row
+ \li \c border-left
+ \li \l{#Border}{Border}
+ \li Shorthand notation for setting the widget's left border.
+ Equivalent to specifying \c border-left-color, \c
+ border-left-style, and/or \c border-left-width.
+
+ \row
+ \li \b{\c border-color} \target border-attrs
+ \target border-color-prop
+ \li \l{#Box Colors}{Box Colors}
+ \li The color of all the border's edges. Equivalent to
+ specifying \c border-top-color, \c border-right-color, \c
+ border-bottom-color, and \c border-left-color.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit,
+ QMenu, QMenuBar, QPushButton, QRadioButton, QSplitter,
+ QTextEdit, QToolTip, and plain \l{QWidget}s.
+
+ If this property is not specified, it defaults to
+ \l{#color-prop}{color} (i.e., the widget's foreground
+ color).
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 44
+
+ See also \l{Qt Style Sheets Reference#border-style-prop}{border-style},
+ \l{Qt Style Sheets Reference#border-width-prop}{border-width},
+ \l{#border-image-prop}{border-image}, and \l{The Box Model}.
+
+ \row
+ \li \c border-top-color
+ \li \l{#Brush}{Brush} \BR
+ \li The color of the border's top edge.
+
+ \row
+ \li \c border-right-color
+ \li \l{#Brush}{Brush} \BR
+ \li The color of the border's right edge.
+
+ \row
+ \li \c border-bottom-color
+ \li \l{#Brush}{Brush} \BR
+ \li The color of the border's bottom edge.
+
+ \row
+ \li \c border-left-color
+ \li \l{#Brush}{Brush} \BR
+ \li The color of the border's left edge.
+
+ \row
+ \li \b{\c border-image} \target border-image-prop
+ \li \l{#Border Image}{Border Image}
+ \li The image used to fill the border. The image is cut into
+ nine parts and stretched appropriately if necessary. See
+ \l{#Border Image}{Border Image} for details.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit,
+ QMenu, QMenuBar, QPushButton, QRadioButton, QSplitter,
+ QTextEdit and QToolTip.
+
+ See also \l{#border-color-prop}{border-color},
+ \l{Qt Style Sheets Reference#border-style-prop}{border-style},
+ \l{Qt Style Sheets Reference#border-width-prop}{border-width}, and
+ \l{The Box Model}.
+
+ \row
+ \li \b{\c border-radius} \target border-radius-prop
+ \li \l{#Radius}{Radius}
+ \li The radius of the border's corners. Equivalent to
+ specifying \c border-top-left-radius, \c
+ border-top-right-radius, \c border-bottom-right-radius,
+ and \c border-bottom-left-radius.
+
+ The border-radius clips the element's
+ \l{Qt Style Sheets Reference#background-prop}{background}.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
+ QMenuBar, QPushButton, QRadioButton, QSplitter, QTextEdit,
+ and QToolTip.
+
+ If this property is not specified, it defaults to 0.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 45
+
+ See also \l{Qt Style Sheets Reference#border-width-prop}{border-width} and
+ \l{The Box Model}.
+
+ \row
+ \li \c border-top-left-radius
+ \li \l{#Radius}{Radius}
+ \li The radius of the border's top-left corner.
+
+ \row
+ \li \c border-top-right-radius
+ \li \l{#Radius}{Radius}
+ \li The radius of the border's top-right corner.
+
+ \row
+ \li \c border-bottom-right-radius
+ \li \l{#Radius}{Radius}
+ \li The radius of the border's bottom-right corner. Setting
+ this property to a positive value results in a rounded
+ corner.
+
+ \row
+ \li \c border-bottom-left-radius
+ \li \l{#Radius}{Radius}
+ \li The radius of the border's bottom-left corner. Setting this
+ property to a positive value results in a rounded corner.
+
+ \row
+ \li \b{\c border-style} \target border-style-prop
+ \li \l {Border Style}
+ \li The style of all the border's edges.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
+ QMenuBar, QPushButton, QRadioButton, QSplitter, QTextEdit,
+ and QToolTip.
+
+ If this property is not specified, it defaults to \c none.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 46
+
+ See also \l{#border-color-prop}{border-color},
+ \l{Qt Style Sheets Reference#border-style-prop}{border-style},
+ \l{#border-image-prop}{border-image}, and \l{The Box Model}.
+
+ \row
+ \li \c border-top-style
+ \li \l{#Border Style}{Border Style}
+ \li The style of the border's top edge.
+
+ \row
+ \li \c border-right-style
+ \li \l{#Border Style}{Border Style}
+ \li The style of the border's right edge/
+
+ \row
+ \li \c border-bottom-style
+ \li \l{#Border Style}{Border Style}
+ \li The style of the border's bottom edge.
+
+ \row
+ \li \c border-left-style
+ \li \l{#Border Style}{Border Style}
+ \li The style of the border's left edge.
+
+ \row
+ \li \b{\c border-width} \target border-width-prop
+ \li \l{#Box Lengths}{Box Lengths}
+ \li The width of the border. Equivalent to setting \c
+ border-top-width, \c border-right-width, \c
+ border-bottom-width, and \c border-left-width.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
+ QMenuBar, QPushButton, QRadioButton, QSplitter, QTextEdit,
+ and QToolTip.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 47
+
+ See also \l{#border-color-prop}{border-color},
+ \l{#border-radius-prop}{border-radius},
+ \l{Qt Style Sheets Reference#border-style-prop}{border-style},
+ \l{#border-image-prop}{border-image}, and
+ \l{The Box Model}.
+
+ \row
+ \li \c border-top-width
+ \li \l{#Length}{Length}
+ \li The width of the border's top edge.
+
+ \row
+ \li \c border-right-width
+ \li \l{#Length}{Length}
+ \li The width of the border's right edge.
+
+ \row
+ \li \c border-bottom-width
+ \li \l{#Length}{Length}
+ \li The width of the border's bottom edge.
+
+ \row
+ \li \c border-left-width
+ \li \l{#Length}{Length}
+ \li The width of the border's left edge.
+
+ \row
+ \li \b{\c bottom} \target bottom-prop
+ \li \l{#Length}{Length}
+ \li If \l{#position-prop}{position} is \c relative (the
+ default), moves a \l{subcontrol} by a certain offset up;
+ specifying \tt{bottom: \e{y}} is then equivalent to
+ specifying \tt{\l{Qt Style Sheets Reference#top-prop}{top}: -\e{y}}.
+
+ If \l{#position-prop}{position} is \c absolute, the \c
+ bottom property specifies the subcontrol's bottom edge
+ in relation to the parent's bottom edge (see also
+ \l{Qt Style Sheets Reference#subcontrol-origin-prop}
+ {subcontrol-origin}).
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 48
+
+ See also \l{Qt Style Sheets Reference#left-prop}{left}, \l{#right-prop}{right}, and
+ \l{Qt Style Sheets Reference#top-prop}{top}.
+
+ \row
+ \li \b{\c button-layout} \target button-layout-prop
+ \li \l{#Number}{Number}
+ \li The layout of buttons in a QDialogButtonBox or
+ a QMessageBox. The possible values are 0
+ (\l{QDialogButtonBox::}{WinLayout}), 1
+ (\l{QDialogButtonBox::}{MacLayout}), 2
+ (\l{QDialogButtonBox::}{KdeLayout}), and 3
+ (\l{QDialogButtonBox::}{GnomeLayout}).
+
+ If this property is not specified, it defaults to the
+ value specified by the current style for the
+ \l{QStyle::}{SH_DialogButtonLayout} style hint.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 49
+
+ \row
+ \li \b{\c color} \target color-prop
+ \li \l{#Brush}{Brush} \BR
+ \li The color used to render text.
+
+ This property is supported by all widgets that respect
+ the \l QWidget::palette.
+
+ If this property is not set, the default is whatever is
+ set for in the widget's palette for the
+ QWidget::foregroundRole (typically black).
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 50
+
+ See also \l{Qt Style Sheets Reference#background-prop}{background} and
+ \l{#selection-color-prop}{selection-color}.
+
+ \row
+ \li \b{\c dialogbuttonbox-buttons-have-icons}
+ \li \l{#Boolean}{Boolean}
+ \li Whether the buttons in a QDialogButtonBox show icons
+
+ If this property is set to 1, the buttons of a QDialogButtonBox
+ show icons; if it is set to 0, the icons are not shown.
+
+ See the \l{Qt Style Sheets Reference#list of icons}{List of Icons}
+ section for information on how to set icons.
+
+ \snippet code/doc_src_stylesheet.qdoc 51
+
+ \note Styles defining this property must be applied before the
+ QDialogButtonBox is created; this means that you must apply the
+ style to the parent widget or to the application itself.
+
+ \omit
+ \row
+ \li \b{\c etch-disabled-text}*
+ \li \l{#Boolean}{Boolean}
+ \li Whether disabled text is drawn etched.
+
+ If this property is not specified, it defaults to the
+ value specified by the current style for the
+ \l{QStyle::}{SH_EtchDisabledText} style hint.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 52
+ \endomit
+
+ \row
+ \li \b{\c font} \target font-prop
+ \li \l{#Font}{Font}
+ \li Shorthand notation for setting the text's font. Equivalent
+ to specifying \c font-family, \c font-size, \c font-style,
+ and/or \c font-weight.
+
+ This property is supported by all widgets that respect
+ the \l QWidget::font.
+
+ If this property is not set, the default is the
+ QWidget::font.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 53
+
+ \row
+ \li \c font-family
+ \li String
+ \li The font family.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 54
+
+ \row
+ \li \c font-size
+ \li \l{#Font Size}{Font Size}
+ \li The font size. In this version of Qt, only pt and px metrics are
+ supported.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 55
+
+ \row
+ \li \c font-style
+ \li \l {Font Style}
+ \li The font style.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 56
+
+ \row
+ \li \c font-weight
+ \li \l{#Font Weight}{Font Weight}
+ \li The weight of the font.
+
+ \row
+ \li \b{\c gridline-color}* \target gridline-color-prop
+ \li \l{#Color}{Color} \BR
+ \li The color of the grid line in a QTableView.
+
+ If this property is not specified, it defaults to the
+ value specified by the current style for the
+ \l{QStyle::}{SH_Table_GridLineColor} style hint.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 57
+
+ \row
+ \li \b{\c height} \target height-prop
+ \li \l{#Length}{Length}
+ \li The height of a \l{subcontrol} (or in some case, a widget).
+
+ If this property is not specified, it defaults to a value
+ that depends on the subcontrol/widget and on the current style.
+
+ \warning Unless otherwise specified, this property has no effect
+ when set on widgets. If you want a widget with a fixed height, set
+ the \l{#min-width-prop}{min-height} and
+ \l{#max-width-prop}{max-height} to the same value.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 58
+
+ See also \l{#width-prop}{width}.
+
+ \row
+ \li \b{\c icon-size} \target icon-size-prop
+ \li \l{#Length}{Length}
+ \li The width and height of the icon in a widget.
+
+ The icon size of the following widgets can be set using this
+ property.
+ \list
+ \li QCheckBox
+ \li QListView
+ \li QPushButton
+ \li QRadioButton
+ \li QTabBar
+ \li QToolBar
+ \li QToolBox
+ \li QTreeView
+ \endlist
+
+ \row
+ \li \b{\c image}* \target image-prop
+ \li \l{#Url}{Url}+
+ \li The image that is drawn in the contents rectangle of a
+ \l{subcontrol}.
+
+ The image property accepts a list of \l{#Url}{Url}s or
+ an \c{svg}. The actual image that is drawn is determined
+ using the same algorithm as QIcon (i.e) the image is never scaled
+ up but always scaled down if necessary. If a \c{svg} is specified,
+ the image is scaled to the size of the contents rectangle.
+
+ Setting the image property on sub controls implicitly sets the
+ width and height of the sub-control (unless the image in a SVG).
+
+ In Qt 4.3 and later, the alignment of the
+ image within the rectangle can be specified using
+ \l{image-position-prop}{image-position}.
+
+ This property is for \l{subcontrol}s only--we don't support it for
+ other elements.
+
+ \warning The QIcon SVG plugin is needed to render SVG images.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 59
+
+ \row
+ \li \b{\c image-position} \target image-position-prop
+ \li \l{#Alignment}{alignment}
+ \li In Qt 4.3 and later, the alignment of the image image's position can be specified
+ using relative or absolute position.
+
+ \row
+ \li \b{\c left} \target left-prop
+ \li \l{#Length}{Length}
+ \li If \l{#position-prop}{position} is \c relative (the
+ default), moves a \l{subcontrol} by a certain offset to
+ the right.
+
+ If \l{#position-prop}{position} is \c absolute, the \c
+ left property specifies the subcontrol's left edge in
+ relation to the parent's left edge (see also
+ \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin}).
+
+ If this property is not specified, it defaults to \c 0.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 60
+
+ See also \l{#right-prop}{right}, \l{Qt Style Sheets Reference#top-prop}{top}, and
+ \l{#bottom-prop}{bottom}.
+
+ \row
+ \li \b{\c lineedit-password-character*} \target lineedit-password-character-prop
+ \li \l{#Number}{Number}
+ \li The QLineEdit password character as a Unicode number.
+
+ If this property is not specified, it defaults to the
+ value specified by the current style for the
+ \l{QStyle::}{SH_LineEdit_PasswordCharacter} style hint.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 61
+
+ \row
+ \li \b{\c margin} \target margin-prop
+ \li \l {Box Lengths}
+ \li The widget's margins. Equivalent to specifying \c
+ margin-top, \c margin-right, \c margin-bottom, and \c
+ margin-left.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
+ QMenuBar, QPushButton, QRadioButton, QSplitter, QTextEdit,
+ and QToolTip.
+
+ If this property is not specified, it defaults to \c 0.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 62
+
+ See also \l{Qt Style Sheets Reference#padding-prop}{padding},
+ \l{#spacing-prop}{spacing}, and \l{The Box Model}.
+
+ \row
+ \li \c margin-top
+ \li \l{#Length}{Length}
+ \li The widget's top margin.
+
+ \row
+ \li \c margin-right
+ \li \l{#Length}{Length}
+ \li The widget's right margin.
+
+ \row
+ \li \c margin-bottom
+ \li \l{#Length}{Length}
+ \li The widget's bottom margin.
+
+ \row
+ \li \c margin-left
+ \li \l{#Length}{Length}
+ \li The widget's left margin.
+
+ \row
+ \li \b{\c max-height} \target max-height-prop
+ \li \l{#Length}{Length}
+ \li The widget's or a subcontrol's maximum height.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
+ QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox,
+ QSplitter, QStatusBar, QTextEdit, and QToolTip.
+
+ The value is relative to the contents rect in the \l{The
+ Box Model}{box model}.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 63
+
+ See also \l{#max-width-prop}{max-width}.
+
+ \row
+ \li \b{\c max-width} \target max-width-prop
+ \li \l{#Length}{Length}
+ \li The widget's or a subcontrol's maximum width.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
+ QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox,
+ QSplitter, QStatusBar, QTextEdit, and QToolTip.
+
+ The value is relative to the contents rect in the \l{The
+ Box Model}{box model}.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 64
+
+ See also \l{#max-height-prop}{max-height}.
+
+
+ \row
+ \li \b{\c messagebox-text-interaction-flags*} \target messagebox-text-interaction-flags-prop
+ \li \l{#Number}{Number}
+ \li The interaction behavior for text in a message box.
+ Possible values are based on Qt::TextInteractionFlags.
+
+ If this property is not specified, it defaults to the
+ value specified by the current style for the
+ \l{QStyle::}{SH_MessageBox_TextInteractionFlags} style
+ hint.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 65
+
+ \row
+ \li \b{\c min-height} \target min-height-prop
+ \li \l{#Length}{Length}
+ \li The widget's or a subcontrol's minimum height.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
+ QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox,
+ QSplitter, QStatusBar, QTextEdit, and QToolTip.
+
+ If this property is not specified, the minimum height is
+ derived based on the widget's contents and the style.
+
+ The value is relative to the contents rect in the \l{The
+ Box Model}{box model}.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 66
+
+ See also \l{#min-width-prop}{min-width}.
+
+ \row
+ \li \b{\c min-width} \target min-width-prop
+ \li \l{#Length}{Length}
+ \li The widget's or a subcontrol's minimum width.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
+ QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox,
+ QSplitter, QStatusBar, QTextEdit, and QToolTip.
+
+ If this property is not specified, the minimum width is
+ derived based on the widget's contents and the style.
+
+ The value is relative to the contents rect in the \l{The
+ Box Model}{box model}.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 67
+
+ See also \l{#min-height-prop}{min-height}.
+
+ \row
+ \li \b{\c opacity*} \target opacity-prop
+ \li \l{#Number}{Number}
+ \li The opacity for a widget. Possible values are from 0
+ (transparent) to 255 (opaque). For the moment, this is
+ only supported for \l{QToolTip}{tooltips}.
+
+ If this property is not specified, it defaults to the
+ value specified by the current style for the
+ \l{QStyle::}{SH_ToolTipLabel_Opacity} style hint.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 68
+
+ \row
+ \li \b{\c padding} \target padding-prop
+ \li \l{#Box Lengths}{Box Lengths}
+ \li The widget's padding. Equivalent to specifying \c
+ padding-top, \c padding-right, \c padding-bottom, and \c
+ padding-left.
+
+ This property is supported by QAbstractItemView
+ subclasses, QAbstractSpinBox subclasses, QCheckBox,
+ QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
+ QMenuBar, QPushButton, QRadioButton, QSplitter, QTextEdit,
+ and QToolTip.
+
+ If this property is not specified, it defaults to \c 0.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 69
+
+ See also \l{#margin-prop}{margin},
+ \l{#spacing-prop}{spacing}, and \l{The Box Model}.
+
+ \row
+ \li \c padding-top
+ \li \l{#Length}{Length}
+ \li The widget's top padding.
+
+ \row
+ \li \c padding-right
+ \li \l{#Length}{Length}
+ \li The widget's right padding.
+
+ \row
+ \li \c padding-bottom
+ \li \l{#Length}{Length}
+ \li The widget's bottom padding.
+
+ \row
+ \li \c padding-left
+ \li \l{#Length}{Length}
+ \li The widget's left padding.
+
+ \row
+ \li \b{\c paint-alternating-row-colors-for-empty-area}
+ \target paint-alternating-row-colors-for-empty-area-prop
+ \li \c bool
+ \li Whether the QTreeView paints alternating row colors for the empty
+ area (i.e the area where there are no items)
+
+ \row
+ \li \b{\c position} \target position-prop
+ \li \c relative \BR
+ | \c absolute
+ \li Whether offsets specified using \l{Qt Style Sheets Reference#left-prop}{left},
+ \l{#right-prop}{right}, \l{Qt Style Sheets Reference#top-prop}{top}, and
+ \l{#bottom-prop}{bottom} are relative or absolute
+ coordinates.
+
+ If this property is not specified, it defaults to \c
+ relative.
+
+ \row
+ \li \b{\c right} \target right-prop
+ \li \l{#Length}{Length}
+ \li If \l{#position-prop}{position} is \c relative (the
+ default), moves a \l{subcontrol} by a certain offset to
+ the left; specifying \tt{right: \e{x}} is then equivalent
+ to specifying \tt{\l{Qt Style Sheets Reference#left-prop}{left}: -\e{x}}.
+
+ If \l{#position-prop}{position} is \c absolute, the \c
+ right property specifies the subcontrol's right edge in
+ relation to the parent's right edge (see also
+ \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin}).
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 70
+
+ See also \l{Qt Style Sheets Reference#left-prop}{left}, \l{Qt Style Sheets Reference#top-prop}{top}, and
+ \l{#bottom-prop}{bottom}.
+
+ \row
+ \li \b{\c selection-background-color*} \target selection-background-color-prop
+ \li \l{#Brush}{Brush} \BR
+ \li The background of selected text or items.
+
+ This property is supported by all widgets that respect
+ the \l QWidget::palette and that show selection text.
+
+ If this property is not set, the default value is
+ whatever is set for the palette's
+ \l{QPalette::}{Highlight} role.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 71
+
+ See also \l{#selection-color-prop}{selection-color} and
+ \l{Qt Style Sheets Reference#background-prop}{background}.
+
+ \row
+ \li \b{\c selection-color*} \target selection-color-prop
+ \li \l{#Brush}{Brush} \BR
+ \li The foreground of selected text or items.
+
+ This property is supported by all widgets that respect
+ the \l QWidget::palette and that show selection text.
+
+ If this property is not set, the default value is
+ whatever is set for the palette's
+ \l{QPalette::}{HighlightedText} role.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 72
+
+ See also
+ \l{#selection-background-color-prop}{selection-background-color}
+ and \l{#color-prop}{color}.
+
+ \row
+ \li \b{\c show-decoration-selected*} \target show-decoration-selected-prop
+ \li \l{#Boolean}{Boolean}
+ \li Controls whether selections in a QListView cover the
+ entire row or just the extent of the text.
+
+ If this property is not specified, it defaults to the
+ value specified by the current style for the
+ \l{QStyle::}{SH_ItemView_ShowDecorationSelected} style
+ hint.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 73
+
+ \row
+ \li \b{\c spacing*} \target spacing-prop
+ \li \l{#Length}{Length}
+ \li Internal spacing in the widget.
+
+ This property is supported by QCheckBox, checkable
+ \l{QGroupBox}es, QMenuBar, and QRadioButton.
+
+ If this property is not specified, the default value
+ depends on the widget and on the current style.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 74
+
+ See also \l{Qt Style Sheets Reference#padding-prop}{padding} and
+ \l{#margin-prop}{margin}.
+
+ \row
+ \li \b{\c subcontrol-origin*} \target subcontrol-origin-prop
+ \li \l{#Origin}{Origin}
+ \li The origin rectangle of the \l subcontrol within the
+ parent element.
+
+ If this property is not specified, the default is \c
+ padding.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 75
+
+ See also
+ \l{Qt Style Sheets Reference#subcontrol-position-prop}{subcontrol-position}.
+
+ \row
+ \li \b{\c subcontrol-position*} \target subcontrol-position-prop
+ \li \l{#Alignment}{Alignment}
+ \li The alignment of the \l subcontrol within the origin
+ rectangle specified by \l{Qt Style Sheets Reference#subcontrol-origin-prop}
+ {subcontrol-origin}.
+
+ If this property is not specified, it defaults to a value
+ that depends on the subcontrol.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 76
+
+ See also
+ \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin}.
+
+ \row
+ \li \b{\c text-align} \target text-align-prop
+ \li \l{#Alignment}{Alignment}
+ \li The alignment of text and icon within the contents of the widget.
+
+ If this value is not specified, it defaults to the value
+ that depends on the native style.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 77
+
+ This property is currently supported only by QPushButton
+ and QProgressBar.
+
+ \row
+ \li \b{\c text-decoration}
+ \li \c none \BR
+ \c underline \BR
+ \c overline \BR
+ \c line-through
+ \li Additional text effects
+
+ \row
+ \li \b{\c top} \target top-prop
+ \li \l{#Length}{Length}
+ \li If \l{#position-prop}{position} is \c relative (the
+ default), moves a \l{subcontrol} by a certain offset
+ down.
+
+ If \l{#position-prop}{position} is \c absolute, the \c top
+ property specifies the subcontrol's top edge in relation
+ to the parent's top edge (see also
+ \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin}).
+
+ If this property is not specified, it defaults to \c 0.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 78
+
+ See also \l{Qt Style Sheets Reference#left-prop}{left}, \l{#right-prop}{right}, and
+ \l{#bottom-prop}{bottom}.
+
+ \row
+ \li \b{\c width} \target width-prop
+ \li \l{#Length}{Length}
+ \li The width of a \l{subcontrol} (or a widget in some cases).
+
+ If this property is not specified, it defaults to a value
+ that depends on the subcontrol/widget and on the current style.
+
+ \warning Unless otherwise specified, this property has no effect
+ when set on widgets. If you want a widget with a fixed width, set
+ the \l{#min-width-prop}{min-width} and
+ \l{#max-width-prop}{max-width} to the same value.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 79
+
+ See also \l{#height-prop}{height}.
+
+ \endtable
+
+ \target list of icons
+ \section1 List of Icons
+
+ Icons used in Qt can be customized using the following properties. Each of
+ the properties listed in this section have the type \l{#Icon}{Icon}.
+
+ Note that for icons to appear in buttons in a QDialogButtonBox, you need to
+ set the dialogbuttonbox-buttons-have-icons property to true. Also, to
+ customize the size of the icons, use the icon-size property.
+
+ \table 100%
+ \header
+ \li Name
+ \li QStyle::StandardPixmap
+
+ \row
+ \li backward-icon
+ \li QStyle::SP_ArrowBack
+
+ \row
+ \li cd-icon
+ \li QStyle::SP_DriveCDIcon
+
+ \row
+ \li computer-icon
+ \li QStyle::SP_ComputerIcon
+
+ \row
+ \li desktop-icon
+ \li QStyle::SP_DesktopIcon
+
+ \row
+ \li dialog-apply-icon
+ \li QStyle::SP_DialogApplyButton
+
+ \row
+ \li dialog-cancel-icon
+ \li QStyle::SP_DialogCancelButton
+
+ \row
+ \li dialog-close-icon
+ \li QStyle::SP_DialogCloseButton
+
+ \row
+ \li dialog-discard-icon
+ \li QStyle::SP_DialogDiscardButton
+
+ \row
+ \li dialog-help-icon
+ \li QStyle::SP_DialogHelpButton
+
+ \row
+ \li dialog-no-icon
+ \li QStyle::SP_DialogNoButton
+
+ \row
+ \li dialog-ok-icon
+ \li QStyle::SP_DialogOkButton
+
+ \row
+ \li dialog-open-icon
+ \li QStyle::SP_DialogOpenButton
+
+ \row
+ \li dialog-reset-icon
+ \li QStyle::SP_DialogResetButton
+
+ \row
+ \li dialog-save-icon
+ \li QStyle::SP_DialogSaveButton
+
+ \row
+ \li dialog-yes-icon
+ \li QStyle::SP_DialogYesButton
+
+ \row
+ \li directory-closed-icon
+ \li QStyle::SP_DirClosedIcon
+
+ \row
+ \li directory-icon
+ \li QStyle::SP_DirIcon
+
+ \row
+ \li directory-link-icon
+ \li QStyle::SP_DirLinkIcon
+
+ \row
+ \li directory-open-icon
+ \li QStyle::SP_DirOpenIcon
+
+ \row
+ \li dockwidget-close-icon
+ \li QStyle::SP_DockWidgetCloseButton
+
+ \row
+ \li downarrow-icon
+ \li QStyle::SP_ArrowDown
+
+ \row
+ \li dvd-icon
+ \li QStyle::SP_DriveDVDIcon
+
+ \row
+ \li file-icon
+ \li QStyle::SP_FileIcon
+
+ \row
+ \li file-link-icon
+ \li QStyle::SP_FileLinkIcon
+
+ \omit
+ \row
+ \li filedialog-backward-icon
+ \li QStyle::SP_FileDialogBack
+ \endomit
+
+ \row
+ \li filedialog-contentsview-icon
+ \li QStyle::SP_FileDialogContentsView
+
+ \row
+ \li filedialog-detailedview-icon
+ \li QStyle::SP_FileDialogDetailedView
+
+ \row
+ \li filedialog-end-icon
+ \li QStyle::SP_FileDialogEnd
+
+ \row
+ \li filedialog-infoview-icon
+ \li QStyle::SP_FileDialogInfoView
+
+ \row
+ \li filedialog-listview-icon
+ \li QStyle::SP_FileDialogListView
+
+ \row
+ \li filedialog-new-directory-icon
+ \li QStyle::SP_FileDialogNewFolder
+
+ \row
+ \li filedialog-parent-directory-icon
+ \li QStyle::SP_FileDialogToParent
+
+ \row
+ \li filedialog-start-icon
+ \li QStyle::SP_FileDialogStart
+
+ \row
+ \li floppy-icon
+ \li QStyle::SP_DriveFDIcon
+
+ \row
+ \li forward-icon
+ \li QStyle::SP_ArrowForward
+
+ \row
+ \li harddisk-icon
+ \li QStyle::SP_DriveHDIcon
+
+ \row
+ \li home-icon
+ \li QStyle::SP_DirHomeIcon
+
+ \row
+ \li leftarrow-icon
+ \li QStyle::SP_ArrowLeft
+
+ \row
+ \li messagebox-critical-icon
+ \li QStyle::SP_MessageBoxCritical
+
+ \row
+ \li messagebox-information-icon
+ \li QStyle::SP_MessageBoxInformation
+
+ \row
+ \li messagebox-question-icon
+ \li QStyle::SP_MessageBoxQuestion
+
+ \row
+ \li messagebox-warning-icon
+ \li QStyle::SP_MessageBoxWarning
+
+ \row
+ \li network-icon
+ \li QStyle::SP_DriveNetIcon
+
+ \row
+ \li rightarrow-icon
+ \li QStyle::SP_ArrowRight
+
+ \row
+ \li titlebar-contexthelp-icon
+ \li QStyle::SP_TitleBarContextHelpButton
+
+ \row
+ \li titlebar-maximize-icon
+ \li QStyle::SP_TitleBarMaxButton
+
+ \row
+ \li titlebar-menu-icon
+ \li QStyle::SP_TitleBarMenuButton
+
+ \row
+ \li titlebar-minimize-icon
+ \li QStyle::SP_TitleBarMinButton
+
+ \row
+ \li titlebar-normal-icon
+ \li QStyle::SP_TitleBarNormalButton
+
+ \row
+ \li titlebar-shade-icon
+ \li QStyle::SP_TitleBarShadeButton
+
+ \row
+ \li titlebar-unshade-icon
+ \li QStyle::SP_TitleBarUnshadeButton
+
+ \row
+ \li trash-icon
+ \li QStyle::SP_TrashIcon
+
+ \row
+ \li uparrow-icon
+ \li QStyle::SP_ArrowUp
+
+ \endtable
+
+ \section1 List of Property Types
+
+ The following table summarizes the syntax and meaning of the
+ different property types.
+
+ \table 100%
+ \header
+ \li Type
+ \li Syntax
+ \li Description
+
+ \row
+ \li \b Alignment \target Alignment
+ \li \{ \c top \BR
+ | \c bottom \BR
+ | \c left \BR
+ | \c right \BR
+ | \c center \}*
+ \li Horizontal and/or vertical alignment.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 80
+
+ \row
+ \li \b Attachment \target Attachment
+ \li \{ \c scroll \BR
+ | \c fixed \}*
+ \li Scroll or fixed attachment.
+
+ \row
+ \li \b Background \target Background
+ \li \{ \l{#Brush}{Brush} \BR
+ | \l{#Url}{Url} \BR
+ | \l{#Repeat}{Repeat} \BR
+ | \l{#Alignment}{Alignment} \}*
+ \li A sequence of \l{#Brush}{Brush}, \l{#Url}{Url},
+ \l{#Repeat}{Repeat}, and \l{#Alignment}{Alignment}.
+
+ \row
+ \li \b Boolean \target Boolean
+ \li 0 | 1
+ \li True (\c 1) or false (\c 0).
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 81
+
+ \row
+ \li \b Border \target Border
+ \li \{ \l{#Border Style}{Border Style} \BR
+ | \l{#Length}{Length} \BR
+ | \l{#Brush}{Brush} \}*
+ \li Shorthand border property.
+
+ \row
+ \li \b{Border Image} \target Border Image
+ \li \c none \BR
+ | \l{Url} \l{Number}\{4\} \BR (\c stretch | \c repeat){0,2}
+ \li A border image is an image that is composed of nine parts
+ (top left, top center, top right, center left, center,
+ center right, bottom left, bottom center, and bottom
+ right). When a border of a certain size is required, the
+ corner parts are used as is, and the top, right, bottom,
+ and left parts are stretched or repeated to produce a
+ border with the desired size.
+
+ See the
+ \l{http://www.w3.org/TR/css3-background/#the-border-image}
+ {CSS3 Draft Specification} for details.
+
+ \row
+ \li \b{Border Style} \target Border Style
+ \li \c dashed \BR
+ | \c dot-dash \BR
+ | \c dot-dot-dash \BR
+ | \c dotted \BR
+ | \c double \BR
+ | \c groove \BR
+ | \c inset \BR
+ | \c outset \BR
+ | \c ridge \BR
+ | \c solid \BR
+ | \c none
+ \li Specifies the pattern used to draw a border.
+ See the \l{http://www.w3.org/TR/css3-background/#border-style}
+ {CSS3 Draft Specification} for details.
+
+ \row
+ \li \b{Box Colors} \target Box Colors
+ \li \l{#Brush}{Brush}\{1,4\}
+ \li One to four occurrences of \l{#Brush}{Brush}, specifying the top,
+ right, bottom, and left edges of a box, respectively. If
+ the left color is not specified, it is taken to be the
+ same as the right color. If the bottom color is not
+ specified, it is taken to be the same as the top color. If
+ the right color is not specified, it is taken to be the
+ same as the top color.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 82
+
+ \row
+ \li \b{Box Lengths} \target Box Lengths
+ \li \l{#Length}{Length}\{1,4\}
+ \li One to four occurrences of \l{#Length}{Length}, specifying the
+ top, right, bottom, and left edges of a box,
+ respectively. If the left length is not specified, it is
+ taken to be the same as the right length. If the bottom
+ length is not specified, is it taken to be the same as the
+ top length. If the right length is not specified, it is
+ taken to be the same as the top length.
+
+ Examples:
+
+ \snippet code/doc_src_stylesheet.qdoc 83
+
+ \row
+ \li \b{Brush} \target Brush
+ \li \l{#Color}{Color} \BR
+ | \l{Gradient} \BR
+ | \l{PaletteRole}
+ \li Specifies a Color or a Gradient or an entry in the Palette.
+
+ \row
+ \li \b{Color} \target Color
+ \li \tt{rgb(\e{r}, \e{g}, \e{b})} \BR
+ | \tt{rgba(\e{r}, \e{g}, \e{b}, \e{a})} \BR
+ | \tt{hsv(\e{h}, \e{s}, \e{v})} \BR
+ | \tt{hsva(\e{h}, \e{s}, \e{v}, \e{a})} \BR
+ | \tt{#\e{rrggbb}} \BR
+ | \l{QColor::setNamedColor()}{Color Name} \BR
+ \li Specifies a color as RGB (red, green, blue) or RGBA
+ (red, green, blue, alpha) or HSV (hue, saturation, value) or HSVA
+ (hue, saturation, value, alpha) or a named color. The \c rgb() or \c rgba()
+ syntax can be used with integer values between 0 and 255, or with
+ percentages. The value of s, v, and a in \c hsv() or \c hsva() must all
+ be in the range 0-255; the value of h must be in the range 0-359.
+
+ Examples:
+
+ \snippet code/doc_src_stylesheet.qdoc 84
+
+ \note The RGB colors allowed are the same as those allowed with
+ CSS 2.1, as listed
+ \l{http://www.w3.org/TR/CSS21/syndata.html#color-units}{here}.
+
+ \row
+ \li \b{Font} \target Font
+ \li (\l{#Font Style}{Font Style} | \l{#Font Weight}{Font Weight}){0,2} \l{#Font Size}{Font Size} String
+ \li Shorthand font property.
+
+ \row
+ \li \b{Font Size} \target Font Size
+ \li \l{Length}
+ \li The size of a font.
+
+ \row
+ \li \b{Font Style} \target Font Style
+ \li \c normal \BR
+ | \c italic \BR
+ | \c oblique
+ \li The style of a font.
+
+ \row
+ \li \b{Font Weight} \target Font Weight
+ \li \c normal \BR
+ | \c bold \BR
+ | \c 100 \BR
+ | \c 200 \BR
+ ... \BR
+ | \c 900
+ \li The weight of a font.
+
+ \row
+ \li \b{Gradient} \target Gradient
+ \li \c qlineargradient \BR
+ | \c qradialgradient \BR
+ | \c qconicalgradient
+ \li Specifies gradient fills. There are three types of gradient fills:
+
+ \list
+ \li \e{Linear} gradients interpolate colors between start and
+ end points.
+ \li \e{Radial} gradients interpolate colors between a focal
+ point and end points on a circle surrounding it.
+ \li \e{Conical} gradients interpolate colors around a center
+ point.
+ \endlist
+
+ Gradients are specified in Object Bounding Mode. Imagine the box
+ in which the gradient is rendered, to have its top left corner at (0, 0)
+ and its bottom right corner at (1, 1). Gradient parameters are
+ then specified as percentages from 0 to 1. These values are
+ extrapolated to actual box coordinates at runtime. It is possible
+ specify values that lie outside the bounding box (-0.6 or 1.8, for
+ instance).
+
+ \warning The stops have to appear sorted in ascending order.
+
+ Examples:
+
+ \snippet code/doc_src_stylesheet.qdoc 85
+
+ \row
+ \li \b{Icon} \target Icon
+ \li (\l{#Url}{Url} (\c disabled | \c active | \c normal | \c selected)?
+ (\c on | \c off)? )*
+ \li A list of url, QIcon::Mode and QIcon::State.
+
+ Example:
+ \snippet code/doc_src_stylesheet.qdoc 86
+
+ \row
+ \li \b{Length} \target Length
+ \li \l{#Number}{Number} (\c px | \c pt | \c em | \c ex)?
+ \li A number followed by a measurement unit. The CSS standard recommends
+ that user agents must
+ \l{http://www.w3.org/TR/CSS21/syndata.html#illegalvalues}{ignore}
+ a declaration with an illegal value. In Qt, it is mandatory to
+ specify measurement units. For compatibility with earlier versions
+ of Qt, numbers without measurement units are treated as pixels
+ in most contexts. The supported units are:
+
+ \list
+ \li \c px: pixels
+ \li \c pt: the size of one point (i.e., 1/72 of an inch)
+ \li \c em: the em width of the font (i.e., the width of 'M')
+ \li \c ex: the ex width of the font (i.e., the height of 'x')
+ \endlist
+
+ \row
+ \li \b{Number} \target Number
+ \li A decimal integer or a real number
+ \li Examples: \c 0, \c 18, \c +127, \c -255, \c 12.34, \c -.5,
+ \c 0009.
+
+ \row
+ \li \b{Origin} \target Origin
+ \li \c margin \BR
+ | \c border \BR
+ | \c padding \BR
+ | \c content
+ \li Indicates which of four rectangles to use.
+
+ \list
+ \li \c margin: The margin rectangle. The margin falls outside the border.
+ \li \c border: The border rectangle. This is where any border is drawn.
+ \li \c padding: The padding rectangle. Unlike the margins,
+ padding is located inside the border.
+ \li \c content: The content rectangle. This specifies where
+ the actual contents go, excluding any
+ padding, border, or margin.
+ \endlist
+
+ See also \l{The Box Model}.
+
+ \row
+ \li \b{PaletteRole} \target PaletteRole
+ \li \c alternate-base \BR
+ | \c base \BR
+ | \c bright-text \BR
+ | \c button \BR
+ | \c button-text \BR
+ | \c dark \BR
+ | \c highlight \BR
+ | \c highlighted-text \BR
+ | \c light \BR
+ | \c link \BR
+ | \c link-visited \BR
+ | \c mid \BR
+ | \c midlight \BR
+ | \c shadow \BR
+ | \c text \BR
+ | \c window \BR
+ | \c window-text \BR
+ \li These values correspond the \l{QPalette::ColorRole}{Color roles}
+ in the widget's QPalette.
+
+ For example,
+ \snippet code/doc_src_stylesheet.qdoc 87
+
+ \row
+ \li \b{Radius} \target Radius
+ \li \l{#Length}{Length}\{1, 2\}
+ \li One or two occurrences of \l{#Length}{Length}. If only one length is
+ specified, it is used as the radius of the quarter circle
+ defining the corner. If two lengths are specified, the
+ first length is the horizontal radius of a quarter
+ ellipse, whereas the second length is the vertical radius.
+
+ \row
+ \li \b{Repeat} \target Repeat
+ \li \c repeat-x \BR
+ | \c repeat-y \BR
+ | \c repeat \BR
+ | \c no-repeat
+ \li A value indicating the nature of repetition.
+
+ \list
+ \li \c repeat-x: Repeat horizontally.
+ \li \c repeat-y: Repeat vertically.
+ \li \c repeat: Repeat horizontally and vertically.
+ \li \c no-repeat: Don't repeat.
+ \endlist
+
+ \row
+ \li \b{Url} \target Url
+ \li \tt{url(\e{filename})}
+ \li \tt{\e{filename}} is the name of a file on the local disk
+ or stored using \l{the Qt Resource System}. Setting an
+ image implicitly sets the width and height of the element.
+
+ \endtable
+
+ \section1 List of Pseudo-States
+
+ The following pseudo-states are supported:
+
+ \table 100%
+ \header
+ \li Pseudo-State
+ \li Description
+
+ \row \li \c :active \target active
+ \li This state is set when the widget resides in an active window.
+
+ \row
+ \li \c :adjoins-item \target adjoins-item-ps
+ \li This state is set when the \l{#branch-sub}{::branch} of a QTreeView
+ is adjacent to an item.
+
+ \row
+ \li \c :alternate \target alternate-ps
+ \li This state is set for every alternate row whe painting the row of
+ a QAbstractItemView when QAbstractItemView::alternatingRowColors()
+ is set to true.
+
+ \row
+ \li \c :bottom \target bottom-ps
+ \li The item is positioned at the bottom. For example, a QTabBar
+ that has its tabs positioned at the bottom.
+
+ \row
+ \li \c :checked \target checked-ps
+ \li The item is checked. For example, the
+ \l{QAbstractButton::checked}{checked} state of QAbstractButton.
+
+ \row
+ \li \c :closable \target closable-ps
+ \li The items can be closed. For example, the QDockWidget has the
+ QDockWidget::DockWidgetClosable feature turned on.
+
+ \row
+ \li \c :closed \target closed-ps
+ \li The item is in the closed state. For example, an non-expanded
+ item in a QTreeView
+
+ \row
+ \li \c :default \target default-ps
+ \li The item is the default. For example, a
+ \l{QPushButton::default}{default} QPushButton or a default action
+ in a QMenu.
+
+ \row
+ \li \c :disabled \target disabled-ps
+ \li The item is \l{QWidget::enabled}{disabled}.
+
+ \row
+ \li \c :editable \target editable-ps
+ \li The QComboBox is editable.
+
+ \row
+ \li \c :edit-focus \target edit-focus-ps
+ \li The item has edit focus (See QStyle::State_HasEditFocus). This state
+ is available only for Qt Extended applications.
+
+ \row
+ \li \c :enabled \target enabled-ps
+ \li The item is \l{QWidget::enabled}{enabled}.
+
+ \row
+ \li \c :exclusive \target exclusive-ps
+ \li The item is part of an exclusive item group. For example, a menu
+ item in a exclusive QActionGroup.
+
+ \row
+ \li \c :first \target first-ps
+ \li The item is the first (in a list). For example, the first
+ tab in a QTabBar.
+
+ \row
+ \li \c :flat \target flat-ps
+ \li The item is flat. For example, a
+ \l{QPushButton::flat}{flat} QPushButton.
+
+ \row
+ \li \c :floatable \target floatable-ps
+ \li The items can be floated. For example, the QDockWidget has the
+ QDockWidget::DockWidgetFloatable feature turned on.
+
+ \row
+ \li \c :focus \target focus-ps
+ \li The item has \l{QWidget::hasFocus()}{input focus}.
+
+ \row
+ \li \c :has-children \target has-children-ps
+ \li The item has children. For example, an item in a
+ QTreeView that has child items.
+
+ \row
+ \li \c :has-siblings \target has-siblings-ps
+ \li The item has siblings. For example, an item in a
+ QTreeView that siblings.
+
+ \row
+ \li \c :horizontal \target horizontal-ps
+ \li The item has horizontal orientation
+
+ \row
+ \li \c :hover \target hover-ps
+ \li The mouse is hovering over the item.
+
+ \row
+ \li \c :indeterminate \target indeterminate-ps
+ \li The item has indeterminate state. For example, a QCheckBox
+ or QRadioButton is \l{Qt::PartiallyChecked}{partially checked}.
+
+ \row
+ \li \c :last \target last-ps
+ \li The item is the last (in a list). For example, the last
+ tab in a QTabBar.
+
+ \row
+ \li \c :left \target left-ps
+ \li The item is positioned at the left. For example, a QTabBar
+ that has its tabs positioned at the left.
+
+ \row
+ \li \c :maximized \target maximized-ps
+ \li The item is maximized. For example, a maximized QMdiSubWindow.
+
+ \row
+ \li \c :middle \target middle-ps
+ \li The item is in the middle (in a list). For example, a tab
+ that is not in the beginning or the end in a QTabBar.
+
+ \row
+ \li \c :minimized \target minimized-ps
+ \li The item is minimized. For example, a minimized QMdiSubWindow.
+
+ \row
+ \li \c :movable \target movable-ps
+ \li The item can be moved around. For example, the QDockWidget has the
+ QDockWidget::DockWidgetMovable feature turned on.
+
+ \row
+ \li \c :no-frame \target no-frame-ps
+ \li The item has no frame. For example, a frameless QSpinBox
+ or QLineEdit.
+
+ \row
+ \li \c :non-exclusive \target non-exclusive-ps
+ \li The item is part of a non-exclusive item group. For example, a menu
+ item in a non-exclusive QActionGroup.
+
+ \row
+ \li \c :off \target off-ps
+ \li For items that can be toggled, this applies to items
+ in the "off" state.
+
+ \row
+ \li \c :on \target on-ps
+ \li For items that can be toggled, this applies to widgets
+ in the "on" state.
+
+ \row
+ \li \c :only-one \target only-one-ps
+ \li The item is the only one (in a list). For example, a lone tab
+ in a QTabBar.
+
+ \row
+ \li \c :open \target open-ps
+ \li The item is in the open state. For example, an expanded
+ item in a QTreeView, or a QComboBox or QPushButton with
+ an open menu.
+
+ \row
+ \li \c :next-selected \target next-selected-ps
+ \li The next item (in a list) is selected. For example, the
+ selected tab of a QTabBar is next to this item.
+
+ \row
+ \li \c :pressed \target pressed-ps
+ \li The item is being pressed using the mouse.
+
+ \row
+ \li \c :previous-selected \target previous-selected-ps
+ \li The previous item (in a list) is selected. For example, a
+ tab in a QTabBar that is next to the selected tab.
+
+ \row
+ \li \c :read-only \target read-only-ps
+ \li The item is marked read only or non-editable. For example,
+ a read only QLineEdit or a non-editable QComboBox.
+
+ \row
+ \li \c :right \target right-ps
+ \li The item is positioned at the right. For example, a QTabBar
+ that has its tabs positioned at the right.
+
+ \row
+ \li \c :selected \target selected-ps
+ \li The item is selected. For example, the selected tab in
+ a QTabBar or the selected item in a QMenu.
+
+ \row
+ \li \c :top \target top-ps
+ \li The item is positioned at the top. For example, a QTabBar
+ that has its tabs positioned at the top.
+
+ \row
+ \li \c :unchecked \target unchecked-ps
+ \li The item is
+ \l{QAbstractButton::checked}{unchecked}.
+
+ \row
+ \li \c :vertical \target vertical-ps
+ \li The item has vertical orientation.
+
+ \row
+ \li \c :window \target window-ps
+ \li The widget is a window (i.e top level widget)
+
+ \endtable
+
+ \target subcontrols
+ \section1 List of Sub-Controls
+
+ The following subcontrols are available:
+
+ \table 100%
+ \header
+ \li Sub-Control
+ \li Description
+
+ \row
+ \li \c ::add-line \target add-line-sub
+ \li The button to add a line of a QScrollBar.
+
+ \row
+ \li \c ::add-page \target add-page-sub
+ \li The region between the handle (slider) and the \l{#add-line-sub}{add-line}
+ of a QScrollBar.
+
+ \row
+ \li \c ::branch \target branch-sub
+ \li The branch indicator of a QTreeView.
+
+ \row
+ \li \c ::chunk \target chunk-sub
+ \li The progress chunk of a QProgressBar.
+
+ \row
+ \li \c ::close-button \target close-button-sub
+ \li The close button of a QDockWidget or tabs of QTabBar
+
+ \row
+ \li \c ::corner \target corner-sub
+ \li The corner between two scrollbars in a QAbstractScrollArea
+
+ \row
+ \li \c ::down-arrow \target down-arrow-sub
+ \li The down arrow of a QComboBox, QHeaderView (sort indicator),
+ QScrollBar or QSpinBox.
+
+ \row
+ \li \c ::down-button \target down-button-sub
+ \li The down button of a QScrollBar or a QSpinBox.
+
+ \row
+ \li \c ::drop-down \target drop-down-sub
+ \li The drop-down button of a QComboBox.
+
+ \row
+ \li \c ::float-button \target float-button-sub
+ \li The float button of a QDockWidget
+
+ \row
+ \li \c ::groove \target groove-sub
+ \li The groove of a QSlider.
+
+ \row
+ \li \c ::indicator \target indicator-sub
+ \li The indicator of a QAbstractItemView, a QCheckBox, a QRadioButton,
+ a checkable QMenu item or a checkable QGroupBox.
+
+ \row
+ \li \c ::handle \target handle-sub
+ \li The handle (slider) of a QScrollBar, a QSplitter, or a QSlider.
+
+ \row
+ \li \c ::icon \target icon-sub
+ \li The icon of a QAbstractItemView or a QMenu.
+
+ \row
+ \li \c ::item \target item-sub
+ \li An item of a QAbstractItemView, a QMenuBar, a QMenu, or
+ a QStatusBar.
+
+ \row
+ \li \c ::left-arrow \target left-arrow-sub
+ \li The left arrow of a QScrollBar.
+
+ \row
+ \li \c ::left-corner \target left-corner-sub
+ \li The left corner of a QTabWidget. For example, this control can be
+ used to control position the left corner widget in a QTabWidget.
+
+ \row
+ \li \c ::menu-arrow \target menu-arrow-sub
+ \li The arrow of a QToolButton with a menu.
+
+ \row
+ \li \c ::menu-button \target menu-button-sub
+ \li The menu button of a QToolButton.
+
+ \row
+ \li \c ::menu-indicator \target menu-indicator-sub
+ \li The menu indicator of a QPushButton.
+
+ \row
+ \li \c ::right-arrow \target right-arrow-sub
+ \li The right arrow of a QMenu or a QScrollBar.
+
+ \row
+ \li \c ::pane \target pane-sub
+ \li The pane (frame) of a QTabWidget.
+
+ \row
+ \li \c ::right-corner \target right-corner-sub
+ \li The right corner of a QTabWidget. For example, this control can be
+ used to control the position the right corner widget in a QTabWidget.
+
+ \row
+ \li \c ::scroller \target scroller-sub
+ \li The scroller of a QMenu or QTabBar.
+
+ \row
+ \li \c ::section \target section-sub
+ \li The section of a QHeaderView.
+
+ \row
+ \li \c ::separator \target separator-sub
+ \li The separator of a QMenu or in a QMainWindow.
+
+ \row
+ \li \c ::sub-line \target sub-line-sub
+ \li The button to subtract a line of a QScrollBar.
+
+ \row
+ \li \c ::sub-page \target sub-page-sub
+ \li The region between the handle (slider) and the \l{#sub-line-sub}{sub-line}
+ of a QScrollBar.
+
+ \row
+ \li \c ::tab \target tab-sub
+ \li The tab of a QTabBar or QToolBox.
+
+ \row
+ \li \c ::tab-bar \target tab-bar-sub
+ \li The tab bar of a QTabWidget. This subcontrol exists only to
+ control the position of the QTabBar inside the QTabWidget. To
+ style the tabs using the \l{#tab-sub}{::tab} subcontrol.
+
+ \row
+ \li \c ::tear \target tear-sub
+ \li The tear indicator of a QTabBar.
+
+ \row
+ \li \c ::tearoff \target tearoff-sub
+ \li The tear-off indicator of a QMenu.
+
+ \row
+ \li \c ::text \target text-ps
+ \li The text of a QAbstractItemView.
+
+ \row
+ \li \c ::title \target title-sub
+ \li The title of a QGroupBox or a QDockWidget.
+
+ \row
+ \li \c ::up-arrow \target up-arrow-sub
+ \li The up arrow of a QHeaderView (sort indicator), QScrollBar
+ or a QSpinBox.
+
+ \row
+ \li \c ::up-button \target up-button-sub
+ \li The up button of a QSpinBox.
+
+ \endtable
+
+ See \l{Customizing the QPushButton's Menu Indicator Sub-Control}
+ for an example of how to customize a subcontrol.
+ */
+
+/*!
+ \page stylesheet-examples.html
+ \contentspage {Qt Style Sheet}{Contents}
+ \previouspage Qt Style Sheets Reference
+ \title Qt Style Sheets Examples
+
+ We will now see a few examples to get started with using Qt Style Sheets.
+
+ \tableofcontents
+ \section1 Style Sheet Usage
+
+ \section2 Customizing the Foreground and Background Colors
+
+ Let's start by setting yellow as the background color of all
+ \l{QLineEdit}s in an application. This could be achieved like
+ this:
+
+ \snippet code/doc_src_stylesheet.cpp 88
+
+ If we want the property to apply only to the \l{QLineEdit}s that are
+ children (or grandchildren or grand-grandchildren) of a specific dialog,
+ we would rather do this:
+
+ \snippet code/doc_src_stylesheet.cpp 89
+
+ If we want the property to apply only to one specific QLineEdit,
+ we can give it a name using QObject::setObjectName() and use an
+ ID Selector to refer to it:
+
+ \snippet code/doc_src_stylesheet.cpp 90
+
+ Alternatively, we can set the
+ \l{Qt Style Sheets Reference#background-prop}{background-color} property directly on the
+ QLineEdit, omitting the selector:
+
+ \snippet code/doc_src_stylesheet.cpp 91
+
+ To ensure a good contrast, we should also specify a suitable
+ color for the text:
+
+ \snippet code/doc_src_stylesheet.cpp 92
+
+ It might be a good idea to change the colors used for selected
+ text as well:
+
+ \snippet code/doc_src_stylesheet.cpp 93
+
+
+ \section2 Customizing Using Dynamic Properties
+
+ There are many situations where we need to present a form that
+ has mandatory fields. To indicate to the user that the field is
+ mandatory, one effective (albeit esthetically dubious) solution
+ is to use yellow as the background color for those fields. It
+ turns out this is very easy to implement using Qt Style Sheets.
+ First, we would use the following application-wide style sheet:
+
+ \snippet code/doc_src_stylesheet.qdoc 94
+
+ This means that every widget whose \c mandatoryField Qt property
+ is set to true would have a yellow background.
+
+ Then, for each mandatory field widget, we would simply create a
+ \c mandatoryField property on the fly and set it to true. For
+ example:
+
+ \snippet code/doc_src_stylesheet.cpp 95
+
+ \section2 Customizing a QPushButton Using the Box Model
+
+ This time, we will show how to create a red QPushButton. This
+ QPushButton would presumably be connected to a very destructive
+ piece of code.
+
+ First, we are tempted to use this style sheet:
+
+ \snippet code/doc_src_stylesheet.qdoc 96
+
+ However, the result is a boring, flat button with no borders:
+
+ \image stylesheet-redbutton1.png A flat red button
+
+ What happened is this:
+
+ \list
+ \li We have made a request that cannot be satisfied using the
+ native styles alone (e.g., the Windows XP theme engine doesn't
+ let us specify the background color of a button).
+ \li Therefore, the button is rendered using style sheets.
+ \li We haven't specified any values for
+ \l{Qt Style Sheets Reference#border-width-prop}{border-width} and
+ \l{Qt Style Sheets Reference#border-style-prop}{border-style}, so by default we obtain
+ a 0-pixel wide border of style \c none.
+ \endlist
+
+ Let's improve the situation by specifying a border:
+
+ \snippet code/doc_src_stylesheet.qdoc 97
+
+ \image stylesheet-redbutton2.png A red button with a beige border
+
+ Things look already a lot better. But the button looks a bit
+ cramped. Let's specify some spacing between the border and the
+ text using the \l{Qt Style Sheets Reference#padding-prop}{padding}. Additionally, we will
+ enforce a minimum width, round the corners, and specify a larger
+ font to make the button look nicer:
+
+ \snippet code/doc_src_stylesheet.qdoc 98
+
+ \image stylesheet-redbutton3.png A red button with a round beige border and big, bold text
+
+ The only issue remaining is that the button doesn't react when we
+ press it. We can fix this by specifying a slightly different
+ background color and use a different border style.
+
+ \snippet code/doc_src_stylesheet.qdoc 99
+
+ \section2 Customizing the QPushButton's Menu Indicator Sub-Control
+
+ Subcontrols give access to the sub-elements of a widget. For
+ example, a QPushButton associated with a menu (using
+ QPushButton::setMenu()) has a menu indicator. Let's customize
+ the menu indicator for the red push button:
+
+ \snippet code/doc_src_stylesheet.qdoc 100
+
+ By default, the menu indicator is located at the bottom-right
+ corner of the padding rectangle. We can change this by specifying
+ \l{Qt Style Sheets Reference#subcontrol-position-prop}{subcontrol-position} and
+ \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin} to anchor the
+ indicator differently. We can also use \l{Qt Style Sheets Reference#top-prop}{top} and
+ \l{Qt Style Sheets Reference#left-prop}{left} to move the indicator by a few pixels. For
+ example:
+
+ \snippet code/doc_src_stylesheet.qdoc 101
+
+ This positions the \c myindicator.png to the center right of the
+ QPushButton's \l{Qt Style Sheets Reference#padding-prop}{padding} rectangle (see
+ \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin} for more
+ information).
+
+ \section2 Complex Selector Example
+
+ Since red seems to be our favorite color, let's make the text in
+ QLineEdit red by setting the following application-wide
+ stylesheet:
+
+ \snippet code/doc_src_stylesheet.qdoc 102
+
+ However, we would like to give a visual indication that a
+ QLineEdit is read-only by making it appear gray:
+
+ \snippet code/doc_src_stylesheet.qdoc 103
+
+ At some point, our design team comes with the requirement that
+ all \l{QLineEdit}s in the registration form (with the
+ \l{QObject::objectName}{object name} \c registrationDialog) to be
+ brown:
+
+ \snippet code/doc_src_stylesheet.qdoc 104
+
+ A few UI design meetings later, we decide that all our
+ \l{QDialog}s should have brown colored \l{QLineEdit}s:
+
+ \snippet code/doc_src_stylesheet.qdoc 105
+
+ Quiz: What happens if we have a read-only QLineEdit in a QDialog?
+ [Hint: The \l{The Style Sheet Syntax#Conflict Resolution}{Conflict Resolution} section above explains
+ what happens in cases like this.]
+
+ \section1 Customizing specific widgets
+
+ This section provides examples to customize specific widgets using Style Sheets.
+
+ \section2 Customizing QAbstractScrollArea
+
+ The background of any QAbstractScrollArea (Item views, QTextEdit
+ and QTextBrowser) can be set using the background properties. For example,
+ to set a background-image that scrolls with the scroll bar:
+ \snippet code/doc_src_stylesheet.qdoc 106
+
+ If the background-image is to be fixed with the viewport:
+ \snippet code/doc_src_stylesheet.qdoc 107
+
+ \section2 Customizing QCheckBox
+
+ Styling of a QCheckBox is almost identical to styling a QRadioButton. The
+ main difference is that a tristate QCheckBox has an indeterminate state.
+
+ \snippet code/doc_src_stylesheet.qdoc 108
+
+ \section2 Customizing QComboBox
+
+ We will look at an example where the drop down button of a QComboBox
+ appears "merged" with the combo box frame.
+
+ \snippet code/doc_src_stylesheet.qdoc 109
+
+ The pop-up of the QComboBox is a QAbstractItemView and is styled using
+ the descendant selector:
+ \snippet code/doc_src_stylesheet.qdoc 110
+
+ \section2 Customizing QDockWidget
+
+ The title bar and the buttons of a QDockWidget can be customized as
+ follows:
+
+ \snippet code/doc_src_stylesheet.qdoc 111
+
+ If one desires to move the dock widget buttons to the left, the following
+ style sheet can be used:
+
+ \snippet code/doc_src_stylesheet.qdoc 112
+
+ \note To customize the separator (resize handle) of a QDockWidget,
+ use QMainWindow::separator.
+
+ \section2 Customizing QFrame
+
+ A QFrame is styled using the \l{The Box Model}.
+
+ \snippet code/doc_src_stylesheet.qdoc 113
+
+ \section2 Customizing QGroupBox
+
+ Let us look at an example that moves the QGroupBox's title to
+ the center.
+
+ \snippet code/doc_src_stylesheet.qdoc 114
+
+ For a checkable QGroupBox, use the \{#indicator-sub}{::indicator} subcontrol
+ and style it exactly like a QCheckBox (i.e)
+
+ \snippet code/doc_src_stylesheet.qdoc 115
+
+ \section2 Customizing QHeaderView
+
+ QHeaderView is customized as follows:
+
+ \snippet code/doc_src_stylesheet.qdoc 116
+
+ \section2 Customizing QLineEdit
+
+ The frame of a QLineEdit is styled using the \l{The Box Model}. To
+ create a line edit with rounded corners, we can set:
+ \snippet code/doc_src_stylesheet.qdoc 117
+
+ The password character of line edits that have QLineEdit::Password
+ echo mode can be set using:
+ \snippet code/doc_src_stylesheet.qdoc 118
+
+ The background of a read only QLineEdit can be modified as below:
+ \snippet code/doc_src_stylesheet.qdoc 119
+
+ \section2 Customizing QListView
+
+ The background color of alternating rows can be customized using the following
+ style sheet:
+
+ \snippet code/doc_src_stylesheet.qdoc 120
+
+ To provide a special background when you hover over items, we can use the
+ \l{item-sub}{::item} subcontrol. For example,
+
+ \snippet code/doc_src_stylesheet.qdoc 121
+
+ \section2 Customizing QMainWindow
+
+ The separator of a QMainWindow can be styled as follows:
+
+ \snippet code/doc_src_stylesheet.qdoc 122
+
+ \section2 Customizing QMenu
+
+ Individual items of a QMenu are styled using the 'item' subcontrol as
+ follows:
+
+ \snippet code/doc_src_stylesheet.qdoc 123
+
+ For a more advanced customization, use a style sheet as follows:
+
+ \snippet code/doc_src_stylesheet.qdoc 124
+
+ \section2 Customizing QMenuBar
+
+ QMenuBar is styled as follows:
+
+ \snippet code/doc_src_stylesheet.qdoc 125
+
+ \section2 Customizing QProgressBar
+
+ The QProgressBar's \l{stylesheet-reference.html#border-prop}{border},
+ \l{stylesheet-reference.html#chunk-sub}{chunk}, and
+ \l{stylesheet-reference.html#text-align-prop}{text-align} can be customized using
+ style sheets. However, if one property or sub-control is customized,
+ all the other properties or sub-controls must be customized as well.
+
+ \image progressBar-stylesheet.png
+
+ For example, we change the \l{stylesheet-reference.html#border-prop}
+ {border} to grey and the \l{stylesheet-reference.html#chunk-sub}{chunk}
+ to cerulean.
+
+ \snippet code/doc_src_stylesheet.qdoc 126
+
+ This leaves the \l{stylesheet-reference.html#text-align-prop}
+ {text-align}, which we customize by positioning the text in the center of
+ the progress bar.
+
+ \snippet code/doc_src_stylesheet.qdoc 127
+
+ A \l{stylesheet-reference.html#margin-prop}{margin} can be included to
+ obtain more visible chunks.
+
+ \image progressBar2-stylesheet.png
+
+ In the screenshot above, we use a
+ \l{stylesheet-reference.html#margin-prop}{margin} of 0.5 pixels.
+
+ \snippet code/doc_src_stylesheet.qdoc 128
+
+ \section2 Customizing QPushButton
+
+ A QPushButton is styled as follows:
+ \snippet code/doc_src_stylesheet.qdoc 129
+
+ For a QPushButton with a menu, use the
+ \l{Qt Style Sheets Reference#menu-indicator-sub}{::menu-indicator}
+ subcontrol.
+
+ \snippet code/doc_src_stylesheet.qdoc 130
+
+ Checkable QPushButton have the \l{Qt Style Sheets Reference#checked-ps}
+ {:checked} pseudo state set.
+
+ \section2 Customizing QRadioButton
+
+ The indicator of a QRadioButton can be changed using:
+ \snippet code/doc_src_stylesheet.qdoc 131
+
+ \section2 Customizing QScrollBar
+
+ The QScrollBar can be styled using its subcontrols like
+ \l{stylesheet-reference.html#handle-sub}{handle},
+ \l{stylesheet-reference.html#add-line-sub}{add-line},
+ \l{stylesheet-reference.html#sub-line-sub}{sub-line}, and so on. Note that
+ if one property or sub-control is customized, all the other properties or
+ sub-controls must be customized as well.
+
+ \image stylesheet-scrollbar1.png
+
+ The scroll bar above has been styled in aquamarine with a solid grey
+ border.
+
+ \snippet code/doc_src_stylesheet.qdoc 132
+
+ \snippet code/doc_src_stylesheet.qdoc 133
+
+ \snippet code/doc_src_stylesheet.qdoc 134
+
+ The \l{stylesheet-reference.html#left-arrow-sub}{left-arrow} and
+ \l{stylesheet-reference.html#right-arrow-sub}{right-arrow} have a solid grey
+ border with a white background. As an alternative, you could also embed the
+ image of an arrow.
+
+ \snippet code/doc_src_stylesheet.qdoc 135
+
+ If you want the scroll buttons of the scroll bar to be placed together
+ (instead of the edges) like on Mac OS X, you can use the following
+ stylesheet:
+ \snippet code/doc_src_stylesheet.qdoc 136
+
+ The scroll bar using the above stylesheet looks like this:
+ \image stylesheet-scrollbar2.png
+
+
+ To customize a vertical scroll bar use a style sheet similar to the following:
+ \snippet code/doc_src_stylesheet.qdoc 137
+
+ \section2 Customizing QSizeGrip
+
+ QSizeGrip is usually styled by just setting an image.
+
+ \snippet code/doc_src_stylesheet.qdoc 138
+
+ \section2 Customizing QSlider
+
+ You can style horizontal slider as below:
+ \snippet code/doc_src_stylesheet.qdoc 139
+
+ If you want to change the color of the slider parts before and after the handle, you can use the add-page
+ and sub-page subcontrols. For example, for a vertical slider:
+
+ \snippet code/doc_src_stylesheet.qdoc 140
+
+ \section2 Customizing QSpinBox
+
+ QSpinBox can be completely customized as below (the style sheet has commentary inline):
+
+ \snippet code/doc_src_stylesheet.qdoc 141
+
+
+ \section2 Customizing QSplitter
+
+ A QSplitter derives from a QFrame and hence can be styled like a QFrame.
+ The grip or the handle is customized using the
+ \l{Qt Style Sheets Reference#handle-sub}{::handle} subcontrol.
+
+ \snippet code/doc_src_stylesheet.qdoc 142
+
+ \section2 Customizing QStatusBar
+
+ We can provide a background for the status bar and a border for items
+ inside the status bar as follows:
+ \snippet code/doc_src_stylesheet.qdoc 143
+
+ Note that widgets that have been added to the QStatusBar can be styled
+ using the descendant declaration (i.e)
+ \snippet code/doc_src_stylesheet.qdoc 144
+
+ \section2 Customizing QTabWidget and QTabBar
+
+ \image tabWidget-stylesheet1.png
+
+ For the screenshot above, we need a stylesheet as follows:
+
+ \snippet code/doc_src_stylesheet.qdoc 145
+
+ Often we require the tabs to overlap to look like below:
+ \image tabWidget-stylesheet2.png
+
+ For a tab widget that looks like above, we make use of
+ \l{http://www.communitymx.com/content/article.cfm?cid=B0029}
+ {negative margins}. The resulting stylesheet looks like this:
+
+ \snippet code/doc_src_stylesheet.qdoc 146
+
+ To move the tab bar to the center (as below), we require the following stylesheet:
+ \image tabWidget-stylesheet3.png
+
+ \snippet code/doc_src_stylesheet.qdoc 147
+
+ The tear indicator and the scroll buttons can be further customized as follows:
+ \snippet code/doc_src_stylesheet.qdoc 148
+
+ Since Qt 4.6 the close button can be customized as follow:
+ \snippet code/doc_src_stylesheet.qdoc 159
+
+ \section2 Customizing QTableView
+
+ Suppose we'd like our selected item in QTableView to have bubblegum pink
+ fade to white as its background.
+
+ \image tableWidget-stylesheet.png
+
+ This is possible with the
+ \l{stylesheet-reference.html#selection-background-color-prop}
+ {selection-background-color} property and the syntax required is:
+
+ \snippet code/doc_src_stylesheet.qdoc 149
+
+ The corner widget can be customized using the following style sheet
+
+ \snippet code/doc_src_stylesheet.qdoc 150
+
+ \section2 Customizing QToolBar
+
+ The background and the handle of a QToolBar is customized as below:
+ \snippet code/doc_src_stylesheet.qdoc 151
+
+ \section2 Customizing QToolBox
+
+ The tabs of the QToolBox are customized using the 'tab' subcontrol.
+
+ \snippet code/doc_src_stylesheet.qdoc 152
+
+ \section2 Customizing QToolButton
+
+ There are three types of QToolButtons.
+ \list
+ \li The QToolButton has no menu. In this case, the QToolButton is styled
+ exactly like QPushButton. See
+ \l{#Customizing QPushButton}{Customizing QPushButton} for an
+ example.
+
+ \li The QToolButton has a menu and has the QToolButton::popupMode set to
+ QToolButton::DelayedPopup or QToolButton::InstantPopup. In this case,
+ the QToolButton is styled exactly like a QPushButton with a menu.
+ See \l{#Customizing QPushButton}{Customizing QPushButton} for an
+ example of the usage of the menu-indicator pseudo state.
+
+ \li The QToolButton has its QToolButton::popupMode set to
+ QToolButton::MenuButtonPopup. In this case, we style it as follows:
+ \endlist
+
+ \snippet code/doc_src_stylesheet.qdoc 153
+
+
+ \section2 Customizing QToolTip
+
+ QToolTip is customized exactly like a QLabel. In addition, for platforms
+ that support it, the opacity property may be set to adjust the opacity.
+
+ For example,
+ \snippet code/doc_src_stylesheet.qdoc 154
+
+ \section2 Customizing QTreeView
+
+ The background color of alternating rows can be customized using the following
+ style sheet:
+
+ \snippet code/doc_src_stylesheet.qdoc 155
+
+ To provide a special background when you hover over items, we can use the
+ \l{item-sub}{::item} subcontrol. For example,
+ \snippet code/doc_src_stylesheet.qdoc 156
+
+ The branches of a QTreeView are styled using the
+ \l{Qt Style Sheets Reference#branch-sub}{::branch} subcontrol. The
+ following stylesheet color codes the various states when drawing
+ a branch.
+
+ \snippet code/doc_src_stylesheet.qdoc 157
+
+ Colorful, though it is, a more useful example can be made using the
+ following images:
+
+ \table
+ \row
+ \li \inlineimage stylesheet-vline.png
+ \li \inlineimage stylesheet-branch-more.png
+ \li \inlineimage stylesheet-branch-end.png
+ \li \inlineimage stylesheet-branch-closed.png
+ \li \inlineimage stylesheet-branch-open.png
+ \row
+ \li vline.png
+ \li branch-more.png
+ \li branch-end.png
+ \li branch-closed.png
+ \li branch-open.png
+ \endtable
+
+ \snippet code/doc_src_stylesheet.qdoc 158
+
+ The resulting tree view looks like this:
+
+ \image stylesheet-treeview.png
+
+ \sa {Style Sheet Example}, {Supported HTML Subset}, QStyle
+
+
+ \section1 Common mistakes
+
+ This section lists some common mistakes when using stylesheets.
+
+ \section2 QPushButton and images
+
+ When styling a QPushButton, it is often desirable to use an image as the
+ button graphic. It is common to try the
+ \l{Qt Style Sheets Reference#background-image-prop}{background-image}
+ property,
+ but this has a number of drawbacks: For instance, the background will
+ often appear hidden behind the button decoration, because it is not
+ considered a background. In addition, if the button is resized, the
+ entire background will be stretched or tiled, which does not
+ always look good.
+
+ It is better to use the
+ \l{Qt Style Sheets Reference#border-image-prop}{border-image}
+ property, as it will always display the image,
+ regardless of the background (you can combine it with a background if it
+ has alpha values in it), and it has special settings to deal with button
+ resizing.
+
+ Consider the following snippet:
+
+ \snippet stylesheet/common-mistakes.cpp 1
+
+ This will produce a button looking like this:
+
+ \image stylesheet-border-image-normal.png
+
+ The numbers after the url gives the top, right, bottom and left number of
+ pixels, respectively. These numbers correspond to the border and should not
+ stretch when the size changes.
+ Whenever you resize the button, the middle part of the image will stretch
+ in both directions, while the pixels specified in the stylesheet
+ will not. This makes the borders of the button look more natural, like
+ this:
+
+ \table
+ \row
+ \li \inlineimage stylesheet-border-image-stretched.png
+ \row
+ \li With borders
+ \endtable
+
+ \table
+ \row
+ \li \inlineimage stylesheet-border-image-wrong.png
+ \row
+ \li Without borders
+ \endtable
+
+ */
diff --git a/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc b/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc
new file mode 100644
index 0000000000..e80b0fbec0
--- /dev/null
+++ b/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page widgets-and-layouts.html
+ \title Widgets and Layouts
+ \ingroup qt-gui-concepts
+ \brief The primary elements for designing user interfaces in Qt.
+
+ \section1 Widgets
+
+ Widgets are the primary elements for creating user interfaces in Qt.
+ \l{The Widget Classes}{Widgets} can display data and status information,
+ receive user input, and provide a container for other widgets that
+ should be grouped together. A widget that is not embedded in a
+ parent widget is called a \l{Window and Dialog Widgets} {window}.
+
+ \image parent-child-widgets.png A parent widget containing various child widgets.
+
+ The QWidget class provides the basic capability to render to the
+ screen, and to handle user input events. All UI elements that Qt
+ provides are either subclasses of QWidget, or are used in connection
+ with a QWidget subclass. Creating custom widgets is done by
+ subclassing QWidget or a suitable subclass and reimplementing the
+ virtual event handlers.
+
+ \section1 Layouts
+
+ \l{Layout Management}{Layouts} are an elegant and flexible way to
+ automatically arrange child widgets within their container. Each
+ widget reports its size requirements to the layout through the
+ \l{QWidget::}{sizeHint} and \l{QWidget::}{sizePolicy} properties,
+ and the layout distributes the available space accordingly.
+
+ \table
+ \row
+ \li \image qgridlayout-with-5-children.png
+ \li \image qformlayout-with-6-children.png
+ \endtable
+
+ \l{Qt Designer Manual}{\QD} is a powerful tool for interactively creating and
+ arranging widgets in layouts.
+
+ \section1 Widget Styles
+
+ \l{Styles and Style Aware Widgets}{Styles} draw on behalf of
+ widgets and encapsulate the look and feel of a GUI. Qt's built-in
+ widgets use the QStyle class to perform nearly all of their drawing,
+ ensuring that they look exactly like the equivalent native widgets.
+
+ \table
+ \row
+ \li \image windowsxp-tabwidget.png
+ \li \image plastique-tabwidget.png
+ \li \image macintosh-tabwidget.png
+ \endtable
+
+ \l{Qt Style Sheets} are a powerful mechanism that allows you to customize the
+ appearance of widgets, in addition to what is already possible by subclassing QStyle.
+
+ \section1 The Widget Classes
+
+ The following sections list the widget classes. See the \l{Qt Widget
+ Gallery} for some examples.
+
+ \section2 Basic Widgets
+
+ These basic widgets (controls), e.g. buttons, comboboxes and
+ scroll bars, are designed for direct use.
+
+ \table
+ \row
+ \li \image windows-label.png
+ \li \image windowsvista-pushbutton.png
+ \li \image gtk-progressbar.png
+ \row
+ \li \image plastique-combobox.png
+ \li \image macintosh-radiobutton.png
+ \li \image cde-lineedit.png
+ \endtable
+
+ \annotatedlist basicwidgets
+
+ \section2 Advanced Widgets
+
+ Advanced GUI widgets, e.g. tab widgets and progress bars, provide
+ more complex user interface controls.
+
+ \table
+ \row
+ \li \image windowsxp-treeview.png
+ \li \image gtk-calendarwidget.png
+ \li \image qundoview.png
+ \endtable
+
+ \annotatedlist advanced
+
+ \table
+ \row
+ \li \image windowsvista-tabwidget.png
+ \li \image macintosh-groupbox.png
+ \endtable
+
+ \section2 Organizer Widgets
+
+ Classes like splitters, tab bars, button groups, etc are used for
+ organizing and grouping GUI primitives into more complex
+ applications and dialogs.
+
+ \annotatedlist organizers
+
+ \section2 Abstract Widget Classes
+
+ The abstract widget classes are base classes. They are not usable as
+ standalone classes but provide functionality when they are subclassed.
+
+ \annotatedlist abstractwidgets
+*/
+
+/*!
+ \group advanced
+ \title Advanced Widgets
+*/
+
+/*!
+ \group abstractwidgets
+ \title Abstract Widget Classes
+*/
+
+/*!
+ \group basicwidgets
+ \title Basic Widgets
+*/
+
+/*!
+ \group organizers
+ \title Organizers
+*/
diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp
index 80c0aff492..5bfa8cc5e5 100644
--- a/src/widgets/effects/qgraphicseffect.cpp
+++ b/src/widgets/effects/qgraphicseffect.cpp
@@ -243,7 +243,7 @@ void QGraphicsEffectSource::draw(QPainter *painter)
For example:
- \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 0
+ \snippet code/src_gui_effects_qgraphicseffect.cpp 0
\sa QGraphicsEffect::draw()
*/
@@ -545,7 +545,7 @@ void QGraphicsEffect::updateBoundingRect()
For example:
- \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 1
+ \snippet code/src_gui_effects_qgraphicseffect.cpp 1
This function should not be called explicitly by the user, since it is
meant for reimplementation purposes only.
@@ -1154,7 +1154,7 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity)
For example:
- \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 2
+ \snippet code/src_gui_effects_qgraphicseffect.cpp 2
There is no opacity mask by default.
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index a141fa9e55..7e42eefef2 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -198,7 +198,7 @@ QRectF QPixmapFilter::boundingRectFor(const QRectF &rect) const
\endomit
Example:
- \snippet doc/src/snippets/code/src_gui_image_qpixmapfilter.cpp 1
+ \snippet code/src_gui_image_qpixmapfilter.cpp 1
\sa {Pixmap Filters Example}, QPixmapColorizeFilter, QPixmapDropShadowFilter
@@ -1011,7 +1011,7 @@ static void grayscale(const QImage &image, QImage &dest, const QRect& rect = QRe
chosen color. The alpha-channel is not changed.
Example:
- \snippet doc/src/snippets/code/src_gui_image_qpixmapfilter.cpp 0
+ \snippet code/src_gui_image_qpixmapfilter.cpp 0
\sa QPainter::CompositionMode
@@ -1194,7 +1194,7 @@ public:
radius of 1 at an offset of 8 pixels towards the lower right.
Example:
- \snippet doc/src/snippets/code/src_gui_image_qpixmapfilter.cpp 2
+ \snippet code/src_gui_image_qpixmapfilter.cpp 2
\sa QPixmapColorizeFilter, QPixmapConvolutionFilter
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
index 348d8f2d09..06db3826ea 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
@@ -64,7 +64,7 @@
Anchors are always set up between edges of an item, where the "center" is also considered to
be an edge. Consider the following example:
- \snippet examples/graphicsview/simpleanchorlayout/main.cpp adding anchors
+ \snippet graphicsview/simpleanchorlayout/main.cpp adding anchors
Here, the right edge of item \c a is anchored to the left edge of item \c b and the bottom
edge of item \c a is anchored to the top edge of item \c b, with the result that
@@ -75,7 +75,7 @@
above. Here, we see how a widget can be anchored to the top-left corner of the enclosing
layout:
- \snippet examples/graphicsview/simpleanchorlayout/main.cpp adding a corner anchor
+ \snippet graphicsview/simpleanchorlayout/main.cpp adding a corner anchor
In cases where anchors are used to match the widths or heights of widgets, it is
convenient to use the addAnchors() function. As with the other functions for specifying
@@ -299,11 +299,11 @@ QGraphicsAnchorLayout::anchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint fi
This is a convenience function, since anchoring corners can be expressed as anchoring
two edges. For instance:
- \snippet examples/graphicsview/simpleanchorlayout/main.cpp adding a corner anchor in two steps
+ \snippet graphicsview/simpleanchorlayout/main.cpp adding a corner anchor in two steps
This can also be achieved with the following line of code:
- \snippet examples/graphicsview/simpleanchorlayout/main.cpp adding a corner anchor
+ \snippet graphicsview/simpleanchorlayout/main.cpp adding a corner anchor
If there is already an anchor between the edge pairs, it will be replaced by the anchors that
this function specifies.
@@ -341,11 +341,11 @@ void QGraphicsAnchorLayout::addCornerAnchors(QGraphicsLayoutItem *firstItem,
For example, the following example anchors the left and right edges of two items
to match their widths:
- \snippet examples/graphicsview/simpleanchorlayout/main.cpp adding anchors to match sizes in two steps
+ \snippet graphicsview/simpleanchorlayout/main.cpp adding anchors to match sizes in two steps
This can also be achieved using the following line of code:
- \snippet examples/graphicsview/simpleanchorlayout/main.cpp adding anchors to match sizes
+ \snippet graphicsview/simpleanchorlayout/main.cpp adding anchors to match sizes
\sa addAnchor(), addCornerAnchors()
*/
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
index c5e7e83cf4..53d7cbd4be 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
@@ -54,7 +54,7 @@
QGraphicsWidget::setLayout(). QGraphicsGridLayout automatically computes
the dimensions of the grid as you add items.
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsgridlayout.cpp 0
+ \snippet code/src_gui_graphicsview_qgraphicsgridlayout.cpp 0
The layout takes ownership of the items. In some cases when the layout
item also inherits from QGraphicsItem (such as QGraphicsWidget) there will be a
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index dab1965da5..1ce914b219 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -90,7 +90,7 @@
by the item, and paint(), which implements the actual painting. For
example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 0
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 0
The boundingRect() function has many different purposes.
QGraphicsScene bases its item index on boundingRect(), and
@@ -277,7 +277,7 @@
classes in Qt are associated with a unique value for Type,
e.g. the value returned by QGraphicsPathItem::type() is 2.
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 18
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 18
*/
/*!
@@ -288,7 +288,7 @@
used in conjunction with a reimplementation of QGraphicsItem::type()
and declaring a Type enum value. Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 1
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 1
\note UserType = 65536
*/
@@ -2133,7 +2133,7 @@ void QGraphicsItem::setToolTip(const QString &toolTip)
An editor item might want to use an I-beam cursor:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 2
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 2
If no cursor has been set, the cursor of the item beneath is used.
@@ -2153,7 +2153,7 @@ QCursor QGraphicsItem::cursor() const
An editor item might want to use an I-beam cursor:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 3
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 3
If no cursor has been set, the cursor of the item beneath is used.
@@ -4146,7 +4146,7 @@ QMatrix QGraphicsItem::sceneMatrix() const
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 4
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 4
Unlike transform(), which returns only an item's local transformation, this
function includes the item's (and any parents') position, and all the transfomation properties.
@@ -4171,7 +4171,7 @@ QTransform QGraphicsItem::sceneTransform() const
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 5
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 5
This function is the same as combining this item's scene transform with
the view's viewport transform, but it also understands the
@@ -4474,7 +4474,7 @@ void QGraphicsItem::resetTransform()
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 6
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 6
\sa setTransform(), transform(), scale(), shear(), translate()
*/
@@ -4500,7 +4500,7 @@ void QGraphicsItem::rotate(qreal angle)
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 7
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 7
\sa setTransform(), transform()
*/
@@ -4787,7 +4787,7 @@ QRectF QGraphicsItem::childrenBoundingRect() const
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 8
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 8
\sa boundingRegion(), shape(), contains(), {The Graphics View Coordinate
System}, prepareGeometryChange()
@@ -4835,7 +4835,7 @@ QRectF QGraphicsItem::sceneBoundingRect() const
may choose to return an elliptic shape for better collision detection. For
example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 9
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 9
The outline of a shape can vary depending on the width and style of the
pen used when drawing. If you want to include this outline in the item's
@@ -5327,7 +5327,7 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity)
provided, it points to the widget that is being painted on; otherwise, it
is 0. For cached painting, \a widget is always 0.
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 10
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 10
The painter's pen is 0-width by default, and its pen is initialized to the
QPalette::Text brush from the paint device's palette. The brush is
@@ -5736,7 +5736,7 @@ void QGraphicsItem::update(const QRectF &rect)
by other items, you can map the \a rect to viewport coordinates and scroll the
viewport.
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 19
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 19
\sa boundingRect()
*/
@@ -6515,7 +6515,7 @@ bool QGraphicsItem::isUnderMouse() const
Custom item data is useful for storing arbitrary properties in any
item. Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 11
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 11
Qt does not use this feature for storing data; it is provided solely
for the convenience of the user.
@@ -6572,7 +6572,7 @@ void QGraphicsItem::setData(int key, const QVariant &value)
For example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp QGraphicsItem type
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp QGraphicsItem type
\sa UserType
*/
@@ -6589,7 +6589,7 @@ int QGraphicsItem::type() const
To filter another item's events, install this item as an event filter
for the other item. Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 12
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 12
An item can only filter events for other items in the same
scene. Also, an item cannot filter its own events; instead, you
@@ -6805,7 +6805,7 @@ bool QGraphicsItem::sceneEvent(QEvent *event)
It's common to open a QMenu in response to receiving a context menu
event. Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 13
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 13
The default implementation ignores the event.
@@ -6830,7 +6830,7 @@ void QGraphicsItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
A common implementation of dragEnterEvent accepts or ignores \a event
depending on the associated mime data in \a event. Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 14
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 14
Items do not receive drag and drop events by default; to enable this
feature, call \c setAcceptDrops(true).
@@ -7424,7 +7424,7 @@ void QGraphicsItem::updateMicroFocus()
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 15
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 15
The default implementation does nothing, and returns \a value.
@@ -7519,7 +7519,7 @@ void QGraphicsItem::removeFromIndex()
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 16
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 16
\sa boundingRect()
*/
@@ -10613,11 +10613,11 @@ Qt::TextInteractionFlags QGraphicsTextItem::textInteractionFlags() const
/*!
\since 4.5
- If \a b is true, the \gui Tab key will cause the widget to change focus;
+ If \a b is true, the \uicontrol Tab key will cause the widget to change focus;
otherwise, the tab key will insert a tab into the document.
In some occasions text edits should not allow the user to input tabulators
- or change indentation using the \gui Tab key, as this breaks the focus
+ or change indentation using the \uicontrol Tab key, as this breaks the focus
chain. The default is false.
\sa tabChangesFocus(), ItemIsFocusable, textInteractionFlags()
@@ -10630,7 +10630,7 @@ void QGraphicsTextItem::setTabChangesFocus(bool b)
/*!
\since 4.5
- Returns true if the \gui Tab key will cause the widget to change focus;
+ Returns true if the \uicontrol Tab key will cause the widget to change focus;
otherwise, false is returned.
By default, this behavior is disabled, and this function will return false.
@@ -11010,7 +11010,7 @@ QVariant QGraphicsSimpleTextItem::extension(const QVariant &variant) const
QGraphicsScene::destroyItemGroup(), or you can manually remove all
items from the group by calling removeFromGroup().
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 17
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 17
The operation of adding and removing items preserves the items'
scene-relative position and transformation, as opposed to calling
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.cpp b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
index f21220b3b1..bb90337c5e 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.cpp
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
@@ -70,7 +70,7 @@
An example animation with a timeline follows:
- \snippet doc/src/snippets/timeline/main.cpp 0
+ \snippet timeline/main.cpp 0
Note that steps lie between 0.0 and 1.0. It may be necessary to use
\l{QTimeLine::}{setUpdateInterval()}. The default update interval
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.cpp b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
index 535e2ddf59..f312e2e7ba 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
@@ -56,7 +56,7 @@
and finally assign the layout to a widget by calling
QGraphicsWidget::setLayout().
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicslinearlayout.cpp 0
+ \snippet code/src_gui_graphicsview_qgraphicslinearlayout.cpp 0
You can add widgets, layouts, stretches (addStretch(), insertStretch() or
setStretchFactor()), and spacings (setItemSpacing()) to a linear
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index 4cda3e51fb..b09ddbab41 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -84,7 +84,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp 0
+ \snippet code/src_gui_graphicsview_qgraphicsproxywidget.cpp 0
QGraphicsProxyWidget takes care of automatically embedding popup children
of embedded widgets through creating a child proxy for each popup. This
@@ -104,7 +104,7 @@ QT_BEGIN_NAMESPACE
For example, in the code snippet below, we embed a group box into the proxy:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp 1
+ \snippet code/src_gui_graphicsview_qgraphicsproxywidget.cpp 1
The image below is the output obtained with its contents margin and
contents rect labeled.
@@ -131,7 +131,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp 2
+ \snippet code/src_gui_graphicsview_qgraphicsproxywidget.cpp 2
QGraphicsProxyWidget maintains symmetry for the following states:
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 583e6da90a..282c6a2a2a 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -60,7 +60,7 @@
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp 0
+ \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 0
Note that QGraphicsScene has no visual appearance of its own; it only
manages the items. You need to create a QGraphicsView widget to visualize
@@ -1715,7 +1715,7 @@ void QGraphicsScene::setSceneRect(const QRectF &rect)
device, such as a QImage (e.g., to take a screenshot), or for printing
with QPrinter. For example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp 1
+ \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 1
If \a source is a null rect, this function will use sceneRect() to
determine what to render. If \a target is a null rect, the dimensions of \a
@@ -1866,7 +1866,7 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method)
granularity of the scene's partitioning. The size of each scene segment is
determined by the following algorithm:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp 2
+ \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 2
The BSP tree has an optimal size when each segment contains between 0 and
10 items.
@@ -3146,7 +3146,7 @@ QGraphicsItem *QGraphicsScene::mouseGrabberItem() const
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp 3
+ \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 3
QGraphicsScene::render() calls drawBackground() to draw the scene
background. For more detailed control over how the background is drawn,
@@ -3181,7 +3181,7 @@ void QGraphicsScene::setBackgroundBrush(const QBrush &brush)
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp 4
+ \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 4
QGraphicsScene::render() calls drawForeground() to draw the scene
foreground. For more detailed control over how the foreground is
@@ -3295,7 +3295,7 @@ void QGraphicsScene::update(const QRectF &rect)
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp 5
+ \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 5
Note that QGraphicsView currently supports background caching only (see
QGraphicsView::CacheBackground). This function is equivalent to calling
@@ -5340,7 +5340,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
Example:
- \snippet doc/src/snippets/graphicssceneadditemsnippet.cpp 0
+ \snippet graphicssceneadditemsnippet.cpp 0
Since Qt 4.6, this function is not called anymore unless
the QGraphicsView::IndirectPainting flag is given as an Optimization
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp
index 91b6fb08da..580380e19a 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.cpp
+++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp
@@ -1461,7 +1461,7 @@ void QGraphicsSceneDragDropEvent::setProposedAction(Qt::DropAction action)
Sets the proposed action as accepted, i.e, the drop action
is set to the proposed action. This is equal to:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicssceneevent.cpp 0
+ \snippet code/src_gui_graphicsview_qgraphicssceneevent.cpp 0
When using this function, one should not call \c accept().
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index cabf2eb5a5..3629341d9e 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -62,7 +62,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
center of the scene and display any items that are visible at this
point. For example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp 0
+ \snippet code/src_gui_graphicsview_qgraphicsview.cpp 0
You can explicitly scroll to any position on the scene by using the
scroll bars, or by calling centerOn(). By passing a point to centerOn(),
@@ -1189,7 +1189,7 @@ QSize QGraphicsView::sizeHint() const
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp 1
+ \snippet code/src_gui_graphicsview_qgraphicsview.cpp 1
*/
QPainter::RenderHints QGraphicsView::renderHints() const
{
@@ -1472,7 +1472,7 @@ void QGraphicsView::setRubberBandSelectionMode(Qt::ItemSelectionMode mode)
especially with a transformed view. The CacheBackground flag enables
caching of the view's background. For example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp 2
+ \snippet code/src_gui_graphicsview_qgraphicsview.cpp 2
The cache is invalidated every time the view is transformed. However, when
scrolling, only partial invalidation is required.
@@ -1727,7 +1727,7 @@ QMatrix QGraphicsView::matrix() const
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp 3
+ \snippet code/src_gui_graphicsview_qgraphicsview.cpp 3
To simplify interation with items using a transformed view, QGraphicsView
provides mapTo... and mapFrom... functions that can translate between
@@ -2030,7 +2030,7 @@ void QGraphicsView::fitInView(const QGraphicsItem *item, Qt::AspectRatioMode asp
onto a paint device, such as a QImage (e.g., to take a screenshot), or for
printing to QPrinter. For example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp 4
+ \snippet code/src_gui_graphicsview_qgraphicsview.cpp 4
If \a source is a null rect, this function will use viewport()->rect() to
determine what to draw. If \a target is a null rect, the full dimensions
@@ -2155,7 +2155,7 @@ QList<QGraphicsItem *> QGraphicsView::items() const
a subclass in QGraphicsView. \a pos is in untransformed viewport
coordinates, just like QMouseEvent::pos().
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp 5
+ \snippet code/src_gui_graphicsview_qgraphicsview.cpp 5
\sa QGraphicsScene::items(), {QGraphicsItem#Sorting}{Sorting}
*/
@@ -2270,7 +2270,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPainterPath &path, Qt::ItemSe
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp 6
+ \snippet code/src_gui_graphicsview_qgraphicsview.cpp 6
\sa items(), {QGraphicsItem#Sorting}{Sorting}
*/
@@ -3792,7 +3792,7 @@ bool QGraphicsView::isTransformed() const
Example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp 7
+ \snippet code/src_gui_graphicsview_qgraphicsview.cpp 7
To simplify interation with items using a transformed view, QGraphicsView
provides mapTo... and mapFrom... functions that can translate between
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index 1f45582442..267d70104d 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -677,7 +677,7 @@ QRectF QGraphicsWidget::windowFrameRect() const
For example:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp 0
+ \snippet code/src_gui_graphicsview_qgraphicswidget.cpp 0
\sa QStyleOption::initFrom()
*/
@@ -2098,11 +2098,11 @@ QList<QAction *> QGraphicsWidget::actions() const
Note that since the tab order of the \a second widget is changed, you
should order a chain like this:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp 1
+ \snippet code/src_gui_graphicsview_qgraphicswidget.cpp 1
\e not like this:
- \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp 2
+ \snippet code/src_gui_graphicsview_qgraphicswidget.cpp 2
If \a first is 0, this indicates that \a second should be the first widget
to receive input focus should the scene gain Tab focus (i.e., the user
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index 125beab91b..890eba3407 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
We create the \c WidgetDelegate class, which inherits from
QStyledItemDelegate. We do the drawing in the paint() function:
- \snippet doc/src/snippets/widgetdelegate.cpp 0
+ \snippet widgetdelegate.cpp 0
Notice that we use a QStyleOptionProgressBar and initialize its
members. We can then use the current QStyle to draw it.
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 2ff039595a..777767ee70 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -308,7 +308,7 @@ void QAbstractItemViewPrivate::_q_scrollerStateChanged()
setVerticalScrollMode(). To set the range of the scroll bars, you
can, for example, reimplement the view's resizeEvent() function:
- \snippet doc/src/snippets/code/src_gui_itemviews_qabstractitemview.cpp 0
+ \snippet code/src_gui_itemviews_qabstractitemview.cpp 0
Note that the range is not updated until the widget is shown.
@@ -654,7 +654,7 @@ QAbstractItemView::~QAbstractItemView()
views. We recommend that you delete the old selection model if it is no
longer required. This is done with the following code:
- \snippet doc/src/snippets/code/src_gui_itemviews_qabstractitemview.cpp 2
+ \snippet code/src_gui_itemviews_qabstractitemview.cpp 2
If both the old model and the old selection model do not have parents, or
if their parents are long-lived objects, it may be preferable to call their
@@ -3124,7 +3124,7 @@ void QAbstractItemView::closePersistentEditor(const QModelIndex &index)
deleted. For example, in the code snippet below, the QLineEdit object will
be deleted.
- \snippet doc/src/snippets/code/src_gui_itemviews_qabstractitemview.cpp 1
+ \snippet code/src_gui_itemviews_qabstractitemview.cpp 1
This function should only be used to display static content within the
visible area corresponding to an item of data. If you want to display
diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp
index 2f7b1f7ecb..4396519810 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.cpp
+++ b/src/widgets/itemviews/qdatawidgetmapper.cpp
@@ -289,7 +289,7 @@ void QDataWidgetMapperPrivate::_q_modelDestroyed()
The following code will map the columns of the model to widgets called \c mySpinBox,
\c myLineEdit and \c{myCountryChooser}:
- \snippet doc/src/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp 0
+ \snippet code/src_gui_itemviews_qdatawidgetmapper.cpp 0
After the call to toFirst(), \c mySpinBox displays the value \c{1}, \c myLineEdit
displays \c{Qt Norway} and \c myCountryChooser displays \c{Oslo}. The
@@ -476,7 +476,7 @@ QModelIndex QDataWidgetMapper::rootIndex() const
is mapped to the QLineEdit \c nameLineEdit, and the second is
mapped to the QSpinBox \c{ageSpinBox}:
- \snippet doc/src/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp 1
+ \snippet code/src_gui_itemviews_qdatawidgetmapper.cpp 1
\b{Notes:}
\list
@@ -737,7 +737,7 @@ int QDataWidgetMapper::currentIndex() const
with new data whenever the selection of a QTableView named
\c myTableView changes:
- \snippet doc/src/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp 2
+ \snippet code/src_gui_itemviews_qdatawidgetmapper.cpp 2
\sa currentIndex()
*/
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index bd9f4510f7..68d31c7dd2 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -400,7 +400,7 @@ QString QItemDelegatePrivate::valueToText(const QVariant &value, const QStyleOpt
For example, a selected item may need to be displayed differently to
unselected items, as shown in the following code:
- \snippet examples/itemviews/pixelator/pixeldelegate.cpp 2
+ \snippet itemviews/pixelator/pixeldelegate.cpp 2
\dots
After painting, you should ensure that the painter is returned to its
@@ -1136,21 +1136,21 @@ QRect QItemDelegate::textRectangle(QPainter * /*painter*/, const QRect &rect,
key press events are handled by default:
\list
- \li \gui Tab
- \li \gui Backtab
- \li \gui Enter
- \li \gui Return
- \li \gui Esc
+ \li \uicontrol Tab
+ \li \uicontrol Backtab
+ \li \uicontrol Enter
+ \li \uicontrol Return
+ \li \uicontrol Esc
\endlist
- In the case of \gui Tab, \gui Backtab, \gui Enter and \gui Return
+ In the case of \uicontrol Tab, \uicontrol Backtab, \uicontrol Enter and \uicontrol Return
key press events, the \a editor's data is comitted to the model
- and the editor is closed. If the \a event is a \gui Tab key press
+ and the editor is closed. If the \a event is a \uicontrol Tab key press
the view will open an editor on the next item in the
- view. Likewise, if the \a event is a \gui Backtab key press the
+ view. Likewise, if the \a event is a \uicontrol Backtab key press the
view will open an editor on the \e previous item in the view.
- If the event is a \gui Esc key press event, the \a editor is
+ If the event is a \uicontrol Esc key press event, the \a editor is
closed \e without committing its data.
\sa commitData(), closeEditor()
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index b4180c18dd..f970a77ab4 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -339,7 +339,7 @@ void QItemEditorFactory::setDefaultFactory(QItemEditorFactory *factory)
editing data. A property is set as the user property with the USER
keyword:
- \snippet doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp 0
+ \snippet code/src_gui_itemviews_qitemeditorfactory.cpp 0
If the editor does not provide a user property, it must return the
name of the property from valuePropertyName(); delegates will then
@@ -405,7 +405,7 @@ void QItemEditorFactory::setDefaultFactory(QItemEditorFactory *factory)
This way, it is not necessary to subclass
QItemEditorCreatorBase.
- \snippet doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp 1
+ \snippet code/src_gui_itemviews_qitemeditorfactory.cpp 1
The constructor takes the name of the property that contains the
editing data. QItemDelegate can then access the property by name
@@ -456,7 +456,7 @@ void QItemEditorFactory::setDefaultFactory(QItemEditorFactory *factory)
Example:
- \snippet doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp 2
+ \snippet code/src_gui_itemviews_qitemeditorfactory.cpp 2
Setting the \c editorFactory created above in an item delegate via
QItemDelegate::setItemEditorFactory() makes sure that all values of type
@@ -468,7 +468,7 @@ void QItemEditorFactory::setDefaultFactory(QItemEditorFactory *factory)
System}{meta-object system}). You set the user property with
the USER keyword:
- \snippet doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp 3
+ \snippet code/src_gui_itemviews_qitemeditorfactory.cpp 3
\sa QItemEditorCreatorBase, QItemEditorCreator,
QItemEditorFactory, QItemDelegate, {Color Editor Factory Example}
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index 01cb7b4235..4a17b65328 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -474,7 +474,7 @@ Qt::DropActions QListModel::supportedDropActions() const
List items can be inserted automatically into a list, when they are
constructed, by specifying the list widget:
- \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 2
+ \snippet qlistwidget-using/mainwindow.cpp 2
Alternatively, list items can also be created without a parent widget, and
later inserted into a list using QListWidget::insertItem().
@@ -1154,7 +1154,7 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
List widgets are constructed in the same way as other widgets:
- \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 0
+ \snippet qlistwidget-using/mainwindow.cpp 0
The selectionMode() of a list widget determines how many of the items in
the list can be selected at the same time, and whether complex selections
@@ -1166,15 +1166,15 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
parent widget and added to the list later. If a list widget already exists
when the items are constructed, the first method is easier to use:
- \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 1
+ \snippet qlistwidget-using/mainwindow.cpp 1
If you need to insert a new item into the list at a particular position,
then it should be constructed without a parent widget. The insertItem()
function should then be used to place it within the list. The list widget
will take ownership of the item.
- \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 6
- \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 7
+ \snippet qlistwidget-using/mainwindow.cpp 6
+ \snippet qlistwidget-using/mainwindow.cpp 7
For multiple items, insertItems() can be used instead. The number of items
in the list is found with the count() function. To remove items from the
@@ -1258,7 +1258,7 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
This signal is emitted when the \a item is activated. The \a item is
activated when the user clicks or double clicks on it, depending on the
system configuration. It is also activated when the user presses the
- activation key (on Windows and X11 this is the \gui Return key, on Mac OS
+ activation key (on Windows and X11 this is the \uicontrol Return key, on Mac OS
X it is \key{Ctrl+0}).
*/
diff --git a/src/widgets/itemviews/qstandarditemmodel.cpp b/src/widgets/itemviews/qstandarditemmodel.cpp
index 5616d76c4a..4f488993f8 100644
--- a/src/widgets/itemviews/qstandarditemmodel.cpp
+++ b/src/widgets/itemviews/qstandarditemmodel.cpp
@@ -1989,11 +1989,11 @@ QDataStream &operator<<(QDataStream &out, const QStandardItem &item)
An example usage of QStandardItemModel to create a table:
- \snippet doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp 0
+ \snippet code/src_gui_itemviews_qstandarditemmodel.cpp 0
An example usage of QStandardItemModel to create a tree:
- \snippet doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp 1
+ \snippet code/src_gui_itemviews_qstandarditemmodel.cpp 1
After setting the model on a view, you typically want to react to user
actions, such as an item being clicked. Since a QAbstractItemView provides
@@ -2005,19 +2005,19 @@ QDataStream &operator<<(QDataStream &out, const QStandardItem &item)
a QAbstractItemView signal, such as QAbstractItemView::clicked(). First
you connect the view's signal to a slot in your class:
- \snippet doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp 2
+ \snippet code/src_gui_itemviews_qstandarditemmodel.cpp 2
When you receive the signal, you call itemFromIndex() on the given model
index to get a pointer to the item:
- \snippet doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp 3
+ \snippet code/src_gui_itemviews_qstandarditemmodel.cpp 3
Conversely, you must obtain the QModelIndex of an item when you want to
invoke a model/view function that takes an index as argument. You can
obtain the index either by using the model's indexFromItem() function, or,
equivalently, by calling QStandardItem::index():
- \snippet doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp 4
+ \snippet code/src_gui_itemviews_qstandarditemmodel.cpp 4
You are, of course, not required to use the item-based approach; you could
instead rely entirely on the QAbstractItemModel interface when working with
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index 119692531f..fc2d18a459 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -602,21 +602,21 @@ void QStyledItemDelegate::setItemEditorFactory(QItemEditorFactory *factory)
key press events are handled by default:
\list
- \li \gui Tab
- \li \gui Backtab
- \li \gui Enter
- \li \gui Return
- \li \gui Esc
+ \li \uicontrol Tab
+ \li \uicontrol Backtab
+ \li \uicontrol Enter
+ \li \uicontrol Return
+ \li \uicontrol Esc
\endlist
- In the case of \gui Tab, \gui Backtab, \gui Enter and \gui Return
+ In the case of \uicontrol Tab, \uicontrol Backtab, \uicontrol Enter and \uicontrol Return
key press events, the \a editor's data is comitted to the model
- and the editor is closed. If the \a event is a \gui Tab key press
+ and the editor is closed. If the \a event is a \uicontrol Tab key press
the view will open an editor on the next item in the
- view. Likewise, if the \a event is a \gui Backtab key press the
+ view. Likewise, if the \a event is a \uicontrol Backtab key press the
view will open an editor on the \e previous item in the view.
- If the event is a \gui Esc key press event, the \a editor is
+ If the event is a \uicontrol Esc key press event, the \a editor is
closed \e without committing its data.
\sa commitData(), closeEditor()
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index 7ae74640d6..a50b6f3111 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -979,7 +979,7 @@ QTableWidgetSelectionRange::~QTableWidgetSelectionRange()
Top-level items are constructed without a parent then inserted at the
position specified by a pair of row and column numbers:
- \snippet doc/src/snippets/qtablewidget-using/mainwindow.cpp 3
+ \snippet qtablewidget-using/mainwindow.cpp 3
Each item can have its own background brush which is set with
the setBackground() function. The current background brush can be
@@ -1504,18 +1504,18 @@ QTableWidgetItem &QTableWidgetItem::operator=(const QTableWidgetItem &other)
Table widgets can be constructed with the required numbers of rows and
columns:
- \snippet doc/src/snippets/qtablewidget-using/mainwindow.cpp 0
+ \snippet qtablewidget-using/mainwindow.cpp 0
Alternatively, tables can be constructed without a given size and resized
later:
- \snippet doc/src/snippets/qtablewidget-resizing/mainwindow.cpp 0
- \snippet doc/src/snippets/qtablewidget-resizing/mainwindow.cpp 1
+ \snippet qtablewidget-resizing/mainwindow.cpp 0
+ \snippet qtablewidget-resizing/mainwindow.cpp 1
Items are created ouside the table (with no parent widget) and inserted
into the table with setItem():
- \snippet doc/src/snippets/qtablewidget-resizing/mainwindow.cpp 2
+ \snippet qtablewidget-resizing/mainwindow.cpp 2
If you want to enable sorting in your table widget, do so after you
have populated it with items, otherwise sorting may interfere with
@@ -1530,7 +1530,7 @@ QTableWidgetItem &QTableWidgetItem::operator=(const QTableWidgetItem &other)
construct a table item with an icon and aligned text, and use it as the
header for a particular column:
- \snippet doc/src/snippets/qtablewidget-using/mainwindow.cpp 2
+ \snippet qtablewidget-using/mainwindow.cpp 2
The number of rows in the table can be found with rowCount(), and the
number of columns with columnCount(). The table can be cleared with the
@@ -2267,7 +2267,7 @@ QWidget *QTableWidget::cellWidget(int row, int column) const
deleted. For example, in the code snippet below, the QLineEdit object will
be deleted.
- \snippet doc/src/snippets/code/src_gui_itemviews_qtablewidget.cpp 0
+ \snippet code/src_gui_itemviews_qtablewidget.cpp 0
\sa cellWidget()
*/
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 04835b63b4..44dd4b0761 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -85,8 +85,8 @@ QT_BEGIN_NAMESPACE
model. In the following example, the contents of a directory are
supplied by a QFileSystemModel and displayed as a tree:
- \snippet doc/src/snippets/shareddirmodel/main.cpp 3
- \snippet doc/src/snippets/shareddirmodel/main.cpp 6
+ \snippet shareddirmodel/main.cpp 3
+ \snippet shareddirmodel/main.cpp 6
The model/view architecture ensures that the contents of the tree view
are updated as the model changes.
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index e2d84825f0..d9d6c1434c 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -901,12 +901,12 @@ void QTreeModel::timerEvent(QTimerEvent *ev)
to represent cities of the world, and adds a entry for Oslo as a child
item:
- \snippet doc/src/snippets/qtreewidget-using/mainwindow.cpp 3
+ \snippet qtreewidget-using/mainwindow.cpp 3
Items can be added in a particular order by specifying the item they
follow when they are constructed:
- \snippet doc/src/snippets/qtreewidget-using/mainwindow.cpp 5
+ \snippet qtreewidget-using/mainwindow.cpp 5
Each column in an item can have its own background brush which is set with
the setBackground() function. The current background brush can be
@@ -2355,7 +2355,7 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
In its simplest form, a tree widget can be constructed in the following way:
- \snippet doc/src/snippets/code/src_gui_itemviews_qtreewidget.cpp 0
+ \snippet code/src_gui_itemviews_qtreewidget.cpp 0
Before items can be added to the tree widget, the number of columns must
be set with setColumnCount(). This allows each item to have one or more
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
index 116860ce89..45fddc7333 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
For example, the following code examples each item in a tree, checking the
text in the first column against a user-specified search string:
- \snippet doc/src/snippets/qtreewidgetitemiterator-using/mainwindow.cpp 0
+ \snippet qtreewidgetitemiterator-using/mainwindow.cpp 0
It is also possible to filter out certain types of node by passing certain
\l{IteratorFlag}{flags} to the constructor of QTreeWidgetItemIterator.
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index c4f7995087..f3455d34ad 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -235,10 +235,10 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
menu and toolbar, then connected to the slot which will perform
the action. For example:
- \snippet examples/mainwindows/application/mainwindow.cpp 19
+ \snippet mainwindows/application/mainwindow.cpp 19
\codeline
- \snippet examples/mainwindows/application/mainwindow.cpp 28
- \snippet examples/mainwindows/application/mainwindow.cpp 31
+ \snippet mainwindows/application/mainwindow.cpp 28
+ \snippet mainwindows/application/mainwindow.cpp 31
We recommend that actions are created as children of the window
they are used in. In most cases actions will be children of
@@ -1037,7 +1037,7 @@ bool QAction::isChecked() const
which indicates that they are unavailable. For example, they might
be displayed using only shades of gray.
- \gui{What's This?} help on disabled actions is still available, provided
+ \uicontrol{What's This?} help on disabled actions is still available, provided
that the QAction::whatsThis property is set.
An action will be disabled when all widgets to which it is added
@@ -1328,7 +1328,7 @@ QAction::SoftKeyRole QAction::softKeyRole() const
the presence (or abscence) of the attribute.
For example:
- \snippet doc/src/snippets/code/src_gui_kernel_qaction.cpp 0
+ \snippet code/src_gui_kernel_qaction.cpp 0
\sa QAction::icon QApplication::setAttribute()
*/
diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp
index 46ca378bbe..2cf8932859 100644
--- a/src/widgets/kernel/qactiongroup.cpp
+++ b/src/widgets/kernel/qactiongroup.cpp
@@ -109,15 +109,15 @@ void QActionGroupPrivate::_q_actionHovered()
\inmodule QtWidgets
In some situations it is useful to group QAction objects together.
- For example, if you have a \gui{Left Align} action, a \gui{Right
- Align} action, a \gui{Justify} action, and a \gui{Center} action,
+ For example, if you have a \uicontrol{Left Align} action, a \uicontrol{Right
+ Align} action, a \uicontrol{Justify} action, and a \uicontrol{Center} action,
only one of these actions should be active at any one time. One
simple way of achieving this is to group the actions together in
an action group.
Here's a example (from the \l{mainwindows/menus}{Menus} example):
- \snippet examples/mainwindows/menus/mainwindow.cpp 6
+ \snippet mainwindows/menus/mainwindow.cpp 6
Here we create a new action group. Since the action group is
exclusive by default, only one of the actions in the group is
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 734c737e84..381aa29eba 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -575,7 +575,7 @@ QApplication::QApplication(int &argc, char **argv, int _internal)
\obsolete
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 0
+ \snippet code/src_gui_kernel_qapplication.cpp 0
*/
QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _internal)
@@ -1106,7 +1106,7 @@ QStyle *QApplication::style()
still the parent of the application object.
Example usage:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 1
+ \snippet code/src_gui_kernel_qapplication.cpp 1
When switching application styles, the color palette is set back to the
initial colors or the system defaults. This is necessary since certain
@@ -1298,7 +1298,7 @@ int QApplication::colorSpec()
Example:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 2
+ \snippet code/src_gui_kernel_qapplication.cpp 2
\sa colorSpec()
*/
@@ -1322,7 +1322,7 @@ void QApplication::setColorSpec(int spec)
Example:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 3
+ \snippet code/src_gui_kernel_qapplication.cpp 3
By default, this property contains a QSize object with zero width and height.
*/
@@ -1675,7 +1675,7 @@ void QApplication::setWindowIcon(const QIcon &icon)
Example:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 4
+ \snippet code/src_gui_kernel_qapplication.cpp 4
\sa allWidgets(), QWidget::isWindow(), QWidget::isHidden()
*/
@@ -1700,7 +1700,7 @@ QWidgetList QApplication::topLevelWidgets()
\note Some of the widgets may be hidden.
Example:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 5
+ \snippet code/src_gui_kernel_qapplication.cpp 5
\sa topLevelWidgets(), QWidget::isVisible()
*/
@@ -1810,10 +1810,10 @@ QFontMetrics QApplication::fontMetrics()
Closes all top-level windows.
This function is particularly useful for applications with many top-level
- windows. It could, for example, be connected to a \gui{Exit} entry in the
- \gui{File} menu:
+ windows. It could, for example, be connected to a \uicontrol{Exit} entry in the
+ \uicontrol{File} menu:
- \snippet examples/mainwindows/mdi/mainwindow.cpp 0
+ \snippet mainwindows/mdi/mainwindow.cpp 0
The windows are closed in random order, until one window does not accept
the close event. The application quits when the last window was
@@ -1850,7 +1850,7 @@ void QApplication::closeAllWindows()
Displays a simple message box about Qt. The message includes the version
number of Qt being used by the application.
- This is useful for inclusion in the \gui Help menu of an application, as
+ This is useful for inclusion in the \uicontrol Help menu of an application, as
shown in the \l{mainwindows/menus}{Menus} example.
This function is a convenience slot for QMessageBox::aboutQt().
@@ -2873,7 +2873,7 @@ void QApplication::setStartDragDistance(int l)
and the current position (e.g. in the mouse move event) is \c currentPos,
you can find out if a drag should be started with code like this:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 7
+ \snippet code/src_gui_kernel_qapplication.cpp 7
Qt uses this value internally, e.g. in QFileDialog.
@@ -3722,7 +3722,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
Here's an example of how an application's QApplication::commitData() might
be implemented:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 8
+ \snippet code/src_gui_kernel_qapplication.cpp 8
If an error occurred within the application while saving its data, you may
want to try allowsErrorInteraction() instead.
@@ -3794,7 +3794,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
If the session manager is capable of restoring sessions it will execute
\a command in order to restore the application. The command defaults to
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 9
+ \snippet code/src_gui_kernel_qapplication.cpp 9
The \c -session option is mandatory; otherwise QApplication cannot tell
whether it has been restored or what the current session identifier is.
@@ -3818,7 +3818,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
To iterate over the list, you can use the \l foreach pseudo-keyword:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 10
+ \snippet code/src_gui_kernel_qapplication.cpp 10
\sa setRestartCommand(), restartHint()
*/
@@ -3839,7 +3839,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
To iterate over the list, you can use the \l foreach pseudo-keyword:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 11
+ \snippet code/src_gui_kernel_qapplication.cpp 11
\sa setDiscardCommand(), restartCommand(), setRestartCommand()
*/
@@ -3967,7 +3967,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
Use the two-argument widgetAt() overload to get the child widget. To get
the top-level widget do this:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 12
+ \snippet code/src_gui_kernel_qapplication.cpp 12
*/
/*!
@@ -3976,7 +3976,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
Use the single-argument widgetAt() overload to get the child widget. To get
the top-level widget do this:
- \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 13
+ \snippet code/src_gui_kernel_qapplication.cpp 13
*/
bool QApplicationPrivate::inPopupMode() const
@@ -4098,7 +4098,7 @@ bool QApplication::keypadNavigationEnabled()
flash time, then hidden for the same amount of time, but this may vary.
The default value on X11 is 1000 milliseconds. On Windows, the
- \gui{Control Panel} value is used and setting this property sets the cursor
+ \uicontrol{Control Panel} value is used and setting this property sets the cursor
flash time for all applications.
We recommend that widgets do not cache this value as it may change at any
diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp
index 7ea77d211c..46c51d1d37 100644
--- a/src/widgets/kernel/qboxlayout.cpp
+++ b/src/widgets/kernel/qboxlayout.cpp
@@ -1239,13 +1239,13 @@ QBoxLayout::Direction QBoxLayout::direction() const
The simplest use of the class is like this:
- \snippet doc/src/snippets/layouts/layouts.cpp 0
- \snippet doc/src/snippets/layouts/layouts.cpp 1
- \snippet doc/src/snippets/layouts/layouts.cpp 2
+ \snippet layouts/layouts.cpp 0
+ \snippet layouts/layouts.cpp 1
+ \snippet layouts/layouts.cpp 2
\codeline
- \snippet doc/src/snippets/layouts/layouts.cpp 3
- \snippet doc/src/snippets/layouts/layouts.cpp 4
- \snippet doc/src/snippets/layouts/layouts.cpp 5
+ \snippet layouts/layouts.cpp 3
+ \snippet layouts/layouts.cpp 4
+ \snippet layouts/layouts.cpp 5
First, we create the widgets we want in the layout. Then, we
create the QHBoxLayout object and add the widgets into the
@@ -1302,13 +1302,13 @@ QHBoxLayout::~QHBoxLayout()
The simplest use of the class is like this:
- \snippet doc/src/snippets/layouts/layouts.cpp 6
- \snippet doc/src/snippets/layouts/layouts.cpp 7
- \snippet doc/src/snippets/layouts/layouts.cpp 8
+ \snippet layouts/layouts.cpp 6
+ \snippet layouts/layouts.cpp 7
+ \snippet layouts/layouts.cpp 8
\codeline
- \snippet doc/src/snippets/layouts/layouts.cpp 9
- \snippet doc/src/snippets/layouts/layouts.cpp 10
- \snippet doc/src/snippets/layouts/layouts.cpp 11
+ \snippet layouts/layouts.cpp 9
+ \snippet layouts/layouts.cpp 10
+ \snippet layouts/layouts.cpp 11
First, we create the widgets we want in the layout. Then, we
create the QVBoxLayout object and add the widgets into the
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 440f3f1dc2..bc4527a1e0 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -1038,11 +1038,11 @@ QStyle* QFormLayoutPrivate::getStyle() const
creates a QLabel behind the scenes and automatically set up
its buddy. We can then write code like this:
- \snippet doc/src/snippets/code/src_gui_kernel_qformlayout.cpp 0
+ \snippet code/src_gui_kernel_qformlayout.cpp 0
Compare this with the following code, written using QGridLayout:
- \snippet doc/src/snippets/code/src_gui_kernel_qformlayout.cpp 1
+ \snippet code/src_gui_kernel_qformlayout.cpp 1
\endlist
The table below shows the default appearance in different styles.
@@ -1083,7 +1083,7 @@ QStyle* QFormLayoutPrivate::getStyle() const
appearance of QMacStyle on all platforms, but with left-aligned
labels, you could write:
- \snippet doc/src/snippets/code/src_gui_kernel_qformlayout.cpp 2
+ \snippet code/src_gui_kernel_qformlayout.cpp 2
\sa QGridLayout, QBoxLayout, QStackedLayout
*/
diff --git a/src/widgets/kernel/qicon.cpp b/src/widgets/kernel/qicon.cpp
index 62c99a64c8..dc506b780c 100644
--- a/src/widgets/kernel/qicon.cpp
+++ b/src/widgets/kernel/qicon.cpp
@@ -467,11 +467,11 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
resource, and then use it, allowing Qt to work out all the required
icon styles and sizes. For example:
- \snippet doc/src/snippets/code/src_gui_image_qicon.cpp 0
+ \snippet code/src_gui_image_qicon.cpp 0
To undo a QIcon, simply set a null icon in its place:
- \snippet doc/src/snippets/code/src_gui_image_qicon.cpp 1
+ \snippet code/src_gui_image_qicon.cpp 1
Use the QImageReader::supportedImageFormats() and
QImageWriter::supportedImageFormats() functions to retrieve a
@@ -500,7 +500,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
Provide a method to set a QIcon, and when you draw the icon, choose
whichever pixmap is appropriate for the current state of your widget.
For example:
- \snippet doc/src/snippets/code/src_gui_image_qicon.cpp 2
+ \snippet code/src_gui_image_qicon.cpp 2
You might also make use of the \c Active mode, perhaps making your
widget \c Active when the mouse is over the widget (see \l
@@ -947,12 +947,12 @@ QString QIcon::themeName()
To fetch an icon from the current icon theme:
- \snippet doc/src/snippets/code/src_gui_image_qicon.cpp 3
+ \snippet code/src_gui_image_qicon.cpp 3
Or if you want to provide a guaranteed fallback for platforms that
do not support theme icons, you can use the second argument:
- \snippet doc/src/snippets/code/src_gui_image_qicon.cpp 4
+ \snippet code/src_gui_image_qicon.cpp 4
\note By default, only X11 will support themed icons. In order to
use themed icons on Mac and Windows, you will have to bundle a
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 8c4e988411..a7760711b6 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -1117,7 +1117,7 @@ bool QLayout::activate()
This function can be used to iterate over a layout. The following
code will draw a rectangle for each layout item in the layout structure of the widget.
- \snippet doc/src/snippets/code/src_gui_kernel_qlayout.cpp 0
+ \snippet code/src_gui_kernel_qlayout.cpp 0
\sa count(), takeAt()
*/
@@ -1134,7 +1134,7 @@ bool QLayout::activate()
The following code fragment shows a safe way to remove all items
from a layout:
- \snippet doc/src/snippets/code/src_gui_kernel_qlayout.cpp 1
+ \snippet code/src_gui_kernel_qlayout.cpp 1
\sa itemAt(), count()
*/
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 6cf3e1fe42..cf220796c5 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -392,7 +392,7 @@ int QLayoutItem::minimumHeightForWidth(int w) const
Reimplement this function in layout managers that support height
for width. A typical implementation will look like this:
- \snippet doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp 0
+ \snippet code/src_gui_kernel_qlayoutitem.cpp 0
Caching is strongly recommended; without it layout will take
exponential time.
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index 92f6fbafba..23487073f8 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -284,17 +284,17 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
objects can be informed when a shortcut is executed. The shortcut
can be set up to contain all the key presses necessary to
describe a keyboard shortcut, including the states of modifier
- keys such as \gui Shift, \gui Ctrl, and \gui Alt.
+ keys such as \uicontrol Shift, \uicontrol Ctrl, and \uicontrol Alt.
\target mnemonic
On certain widgets, using '&' in front of a character will
automatically create a mnemonic (a shortcut) for that character,
- e.g. "E&xit" will create the shortcut \gui Alt+X (use '&&' to
+ e.g. "E&xit" will create the shortcut \uicontrol Alt+X (use '&&' to
display an actual ampersand). The widget might consume and perform
an action on a given shortcut. On X11 the ampersand will not be
shown and the character will be underlined. On Windows, shortcuts
- are normally not displayed until the user presses the \gui Alt
+ are normally not displayed until the user presses the \uicontrol Alt
key, but this is a setting the user can change. On Mac, shortcuts
are disabled by default. Call qt_set_sequence_auto_mnemonic() to
enable them. However, because mnemonic shortcuts do not fit in
@@ -310,7 +310,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
The simplest way to create a shortcut for a particular widget is
to construct the shortcut with a key sequence. For example:
- \snippet doc/src/snippets/code/src_gui_kernel_qshortcut.cpp 0
+ \snippet code/src_gui_kernel_qshortcut.cpp 0
When the user types the \l{QKeySequence}{key sequence}
for a given shortcut, the shortcut's activated() signal is
@@ -449,7 +449,7 @@ QShortcut::~QShortcut()
This is a key sequence with an optional combination of Shift, Ctrl,
and Alt. The key sequence may be supplied in a number of ways:
- \snippet doc/src/snippets/code/src_gui_kernel_qshortcut.cpp 1
+ \snippet code/src_gui_kernel_qshortcut.cpp 1
By default, this property contains an empty key sequence.
*/
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index 0d2e7716e5..7db317e2bb 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -74,17 +74,17 @@ public:
A QStackedLayout can be populated with a number of child widgets
("pages"). For example:
- \snippet doc/src/snippets/qstackedlayout/main.cpp 0
+ \snippet qstackedlayout/main.cpp 0
\codeline
- \snippet doc/src/snippets/qstackedlayout/main.cpp 2
- \snippet doc/src/snippets/qstackedlayout/main.cpp 3
+ \snippet qstackedlayout/main.cpp 2
+ \snippet qstackedlayout/main.cpp 3
QStackedLayout provides no intrinsic means for the user to switch
page. This is typically done through a QComboBox or a QListWidget
that stores the titles of the QStackedLayout's pages. For
example:
- \snippet doc/src/snippets/qstackedlayout/main.cpp 1
+ \snippet qstackedlayout/main.cpp 1
When populating a layout, the widgets are added to an internal
list. The indexOf() function returns the index of a widget in that
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 5df69be020..9f4d8571b3 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE
simple method to determine whether the text can be rendered as
plain text. See Qt::mightBeRichText() for details.
- \snippet doc/src/snippets/whatsthis/whatsthis.cpp 0
+ \snippet whatsthis/whatsthis.cpp 0
An alternative way to enter "What's This?" mode is to call
createAction(), and add the returned QAction to either a menu or
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 9abba54390..6d5bdf92cd 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -2737,12 +2737,12 @@ void QWidget::overrideWindowState(Qt::WindowStates newstate)
windows, the change is immediate. For example, to toggle between
full-screen and normal mode, use the following code:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 0
+ \snippet code/src_gui_kernel_qwidget.cpp 0
In order to restore and activate a minimized window (while
preserving its maximized and/or full-screen state), use the following:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 1
+ \snippet code/src_gui_kernel_qwidget.cpp 1
Calling this function will hide the widget. You must call show() to make
the widget visible again.
@@ -3535,7 +3535,7 @@ QSize QWidget::maximumSize() const
sizeIncrement.height() pixels vertically, with baseSize() as the
basis. Preferred widget sizes are for non-negative integers \e i
and \e j:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 2
+ \snippet code/src_gui_kernel_qwidget.cpp 2
Note that while you can set the size increment for all widgets, it
only affects windows.
@@ -3946,7 +3946,7 @@ QPoint QWidget::mapFromParent(const QPoint &pos) const
Typical usage is changing the window title:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 3
+ \snippet code/src_gui_kernel_qwidget.cpp 3
\sa isWindow()
*/
@@ -4546,7 +4546,7 @@ void QWidget::unsetLayoutDirection()
objects\endlink for a range of useful shapes.
An editor widget might use an I-beam cursor:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 6
+ \snippet code/src_gui_kernel_qwidget.cpp 6
If no cursor has been set, or after a call to unsetCursor(), the
parent's cursor is used.
@@ -4638,7 +4638,7 @@ void QWidget::unsetCursor()
using \a renderFlags to determine how to render. Rendering
starts at \a targetOffset in the \a target. For example:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 7
+ \snippet code/src_gui_kernel_qwidget.cpp 7
If \a sourceRegion is a null region, this function will use QWidget::rect() as
the region, i.e. the entire widget.
@@ -4646,7 +4646,7 @@ void QWidget::unsetCursor()
Ensure that you call QPainter::end() for the \a target device's
active painter (if any) before rendering. For example:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 8
+ \snippet code/src_gui_kernel_qwidget.cpp 8
\note To obtain the contents of an OpenGL widget, use QGLWidget::grabFrameBuffer()
or QGLWidget::renderPixmap() instead.
@@ -6267,11 +6267,11 @@ bool QWidget::isActiveWindow() const
Note that since the tab order of the \a second widget is changed, you
should order a chain like this:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 9
+ \snippet code/src_gui_kernel_qwidget.cpp 9
\e not like this:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 10
+ \snippet code/src_gui_kernel_qwidget.cpp 10
If \a first or \a second has a focus proxy, setTabOrder()
correctly substitutes the proxy.
@@ -6532,7 +6532,7 @@ void QWidget::setGeometry(const QRect &r)
To save the geometry when the window closes, you can
implement a close event like this:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 11
+ \snippet code/src_gui_kernel_qwidget.cpp 11
See the \l{Window Geometry} documentation for an overview of geometry
issues with windows.
@@ -6591,7 +6591,7 @@ QByteArray QWidget::saveGeometry() const
To restore geometry saved using QSettings, you can use code like
this:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 12
+ \snippet code/src_gui_kernel_qwidget.cpp 12
See the \l{Window Geometry} documentation for an overview of geometry
issues with windows.
@@ -6917,7 +6917,7 @@ void QWidget::setFocusPolicy(Qt::FocusPolicy policy)
widgets. Disabling updates solves this.
Example:
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 13
+ \snippet code/src_gui_kernel_qwidget.cpp 13
Disabling a widget implicitly disables all its children. Enabling a widget
enables all child widgets \e except top-level widgets or those that
@@ -8663,7 +8663,7 @@ void QWidget::leaveEvent(QEvent *)
\b{Note for the X11 platform}: It is possible to toggle global double
buffering by calling \c qt_x11_set_global_double_buffer(). For example,
- \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 14
+ \snippet code/src_gui_kernel_qwidget.cpp 14
\note Generally, you should refrain from calling update() or repaint()
\b{inside} a paintEvent(). For example, calling update() or repaint() on
@@ -9124,7 +9124,7 @@ QLayout *QWidget::layout() const
Example:
- \snippet examples/uitools/textfinder/textfinder.cpp 3b
+ \snippet uitools/textfinder/textfinder.cpp 3b
An alternative to calling this function is to pass this widget to
the layout's constructor.
@@ -11363,7 +11363,7 @@ void QWidget::setMask(const QRegion &newMask)
The following code shows how an image with an alpha channel can be
used to generate a mask for a widget:
- \snippet doc/src/snippets/widget-mask/main.cpp 0
+ \snippet widget-mask/main.cpp 0
The label shown by this code is masked using the image it contains,
giving the appearance that an irregularly-shaped image is being drawn
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index 15788e34f5..5c1d0ce098 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE
Alternatively you can use a QFrame widget and apply the
QFrame::setFrameStyle() function to display a shaded line:
- \snippet doc/src/snippets/code/src_gui_painting_qdrawutil.cpp 0
+ \snippet code/src_gui_painting_qdrawutil.cpp 0
\sa qDrawShadeRect(), qDrawShadePanel(), QStyle
*/
@@ -199,7 +199,7 @@ void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2,
Alternatively you can use a QFrame widget and apply the
QFrame::setFrameStyle() function to display a shaded rectangle:
- \snippet doc/src/snippets/code/src_gui_painting_qdrawutil.cpp 1
+ \snippet code/src_gui_painting_qdrawutil.cpp 1
\sa qDrawShadeLine(), qDrawShadePanel(), qDrawPlainRect(), QStyle
*/
@@ -300,7 +300,7 @@ void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
Alternatively you can use a QFrame widget and apply the
QFrame::setFrameStyle() function to display a shaded panel:
- \snippet doc/src/snippets/code/src_gui_painting_qdrawutil.cpp 2
+ \snippet code/src_gui_painting_qdrawutil.cpp 2
\sa qDrawWinPanel(), qDrawShadeLine(), qDrawShadeRect(), QStyle
*/
@@ -471,7 +471,7 @@ void qDrawWinButton(QPainter *p, int x, int y, int w, int h,
Alternatively you can use a QFrame widget and apply the
QFrame::setFrameStyle() function to display a shaded panel:
- \snippet doc/src/snippets/code/src_gui_painting_qdrawutil.cpp 3
+ \snippet code/src_gui_painting_qdrawutil.cpp 3
\sa qDrawShadePanel(), qDrawWinButton(), QStyle
*/
@@ -507,7 +507,7 @@ void qDrawWinPanel(QPainter *p, int x, int y, int w, int h,
Alternatively you can use a QFrame widget and apply the
QFrame::setFrameStyle() function to display a plain rectangle:
- \snippet doc/src/snippets/code/src_gui_painting_qdrawutil.cpp 4
+ \snippet code/src_gui_painting_qdrawutil.cpp 4
\sa qDrawShadeRect(), QStyle
*/
@@ -566,7 +566,7 @@ void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c,
Alternatively you can use a QFrame widget and apply the
QFrame::setFrameStyle() function to display a shaded line:
- \snippet doc/src/snippets/code/src_gui_painting_qdrawutil.cpp 5
+ \snippet code/src_gui_painting_qdrawutil.cpp 5
\sa qDrawShadeRect(), qDrawShadePanel(), QStyle
*/
@@ -605,7 +605,7 @@ void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2,
Alternatively you can use a QFrame widget and apply the
QFrame::setFrameStyle() function to display a shaded rectangle:
- \snippet doc/src/snippets/code/src_gui_painting_qdrawutil.cpp 6
+ \snippet code/src_gui_painting_qdrawutil.cpp 6
\sa qDrawShadeLine(), qDrawShadePanel(), qDrawPlainRect(), QStyle
*/
@@ -642,7 +642,7 @@ void qDrawShadeRect(QPainter *p, const QRect &r,
Alternatively you can use a QFrame widget and apply the
QFrame::setFrameStyle() function to display a shaded panel:
- \snippet doc/src/snippets/code/src_gui_painting_qdrawutil.cpp 7
+ \snippet code/src_gui_painting_qdrawutil.cpp 7
\sa qDrawWinPanel(), qDrawShadeLine(), qDrawShadeRect(), QStyle
*/
@@ -703,7 +703,7 @@ void qDrawWinButton(QPainter *p, const QRect &r,
Alternatively you can use a QFrame widget and apply the
QFrame::setFrameStyle() function to display a shaded panel:
- \snippet doc/src/snippets/code/src_gui_painting_qdrawutil.cpp 8
+ \snippet code/src_gui_painting_qdrawutil.cpp 8
\sa qDrawShadePanel(), qDrawWinButton(), QStyle
*/
@@ -730,7 +730,7 @@ void qDrawWinPanel(QPainter *p, const QRect &r,
Alternatively you can use a QFrame widget and apply the
QFrame::setFrameStyle() function to display a plain rectangle:
- \snippet doc/src/snippets/code/src_gui_painting_qdrawutil.cpp 9
+ \snippet code/src_gui_painting_qdrawutil.cpp 9
\sa qDrawShadeRect(), QStyle
*/
diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp
index 5bcd83a6ea..80124872a6 100644
--- a/src/widgets/styles/qproxystyle.cpp
+++ b/src/widgets/styles/qproxystyle.cpp
@@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
The following example shows how to override the shortcut underline
behavior on any platform:
- \snippet doc/src/snippets/code/src_gui_qproxystyle.cpp 1
+ \snippet code/src_gui_qproxystyle.cpp 1
Warning: The \l {QCommonStyle} {common styles} provided by Qt will
respect this hint, because they call QStyle::proxy(), but there is
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index d78a2ee2fb..b4f24acf84 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -107,7 +107,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
QApplication::setStyle() function. It can also be specified by the
user of the application, using the \c -style command-line option:
- \snippet doc/src/snippets/code/src_gui_styles_qstyle.cpp 0
+ \snippet code/src_gui_styles_qstyle.cpp 0
If no style is specified, Qt will choose the most appropriate
style for the user's platform or desktop environment.
@@ -133,7 +133,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
For example, if you want to draw a focus rectangle on your
widget, you can write:
- \snippet doc/src/snippets/styles/styles.cpp 1
+ \snippet styles/styles.cpp 1
QStyle gets all the information it needs to render the graphical
element from QStyleOption. The widget is passed as the last
@@ -154,15 +154,15 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
combines a QStyle, a QPainter, and a QWidget. This makes it
possible to write
- \snippet doc/src/snippets/styles/styles.cpp 5
+ \snippet styles/styles.cpp 5
\dots
- \snippet doc/src/snippets/styles/styles.cpp 7
+ \snippet styles/styles.cpp 7
instead of
- \snippet doc/src/snippets/styles/styles.cpp 2
+ \snippet styles/styles.cpp 2
\dots
- \snippet doc/src/snippets/styles/styles.cpp 3
+ \snippet styles/styles.cpp 3
\section1 Creating a Custom Style
@@ -190,16 +190,16 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
function, so we need to reimplement that function. We need the
following class declaration:
- \snippet doc/src/snippets/customstyle/customstyle.h 0
+ \snippet customstyle/customstyle.h 0
To draw its up and down arrows, QSpinBox uses the
PE_IndicatorSpinUp and PE_IndicatorSpinDown primitive elements.
Here's how to reimplement the drawPrimitive() function to draw
them differently:
- \snippet doc/src/snippets/customstyle/customstyle.cpp 2
- \snippet doc/src/snippets/customstyle/customstyle.cpp 3
- \snippet doc/src/snippets/customstyle/customstyle.cpp 4
+ \snippet customstyle/customstyle.cpp 2
+ \snippet customstyle/customstyle.cpp 3
+ \snippet customstyle/customstyle.cpp 4
Notice that we don't use the \c widget argument, except to pass it
on to the QWindowStyle::drawPrimitive() function. As mentioned
@@ -211,9 +211,9 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
information, be careful to ensure that it isn't 0 and that it is
of the correct type before using it. For example:
- \snippet doc/src/snippets/customstyle/customstyle.cpp 0
+ \snippet customstyle/customstyle.cpp 0
\dots
- \snippet doc/src/snippets/customstyle/customstyle.cpp 1
+ \snippet customstyle/customstyle.cpp 1
When implementing a custom style, you cannot assume that the
widget is a QSpinBox just because the enum value is called
@@ -233,7 +233,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
QApplication::setStyle() static function before creating the
QApplication object:
- \snippet snippets/customstyle/main.cpp using a custom style
+ \snippet customstyle/main.cpp using a custom style
You can call QApplication::setStyle() at any time, but by calling
it before the constructor, you ensure that the user's preference,
@@ -252,7 +252,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
automatically. To use your new style with existing applications,
simply start the application with the following argument:
- \snippet doc/src/snippets/code/src_gui_styles_qstyle.cpp 1
+ \snippet code/src_gui_styles_qstyle.cpp 1
The application will use the look and feel from the custom style you
implemented.
@@ -306,7 +306,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
We include a small example where we customize the drawing of item
backgrounds.
- \snippet doc/src/snippets/customviewstyle.cpp 0
+ \snippet customviewstyle.cpp 0
The primitive element PE_PanelItemViewItem is responsible for
painting the background of items, and is called from
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 0b0c6e2393..1da5d786c7 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE
The following code snippet shows how to use a specific
QStyleOption subclass to paint a push button:
- \snippet doc/src/snippets/qstyleoption/main.cpp 0
+ \snippet qstyleoption/main.cpp 0
In our example, the control is a QStyle::CE_PushButton, and
according to the QStyle::drawControl() documentation the
@@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE
For safety, you can use qstyleoption_cast() to ensure that the
pointer type is correct. For example:
- \snippet doc/src/snippets/qstyleoption/main.cpp 4
+ \snippet qstyleoption/main.cpp 4
The qstyleoption_cast() function will return 0 if the object to
which \c option points is not of the correct type.
@@ -3240,7 +3240,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
Example:
- \snippet doc/src/snippets/qstyleoption/main.cpp 4
+ \snippet qstyleoption/main.cpp 4
\sa QStyleOption::type, QStyleOption::version
*/
@@ -3958,7 +3958,7 @@ QStyleHintReturnVariant::QStyleHintReturnVariant() : QStyleHintReturn(Version, T
Example:
- \snippet doc/src/snippets/code/src_gui_styles_qstyleoption.cpp 0
+ \snippet code/src_gui_styles_qstyleoption.cpp 0
\sa QStyleHintReturn::type, QStyleHintReturn::version
*/
diff --git a/src/widgets/styles/qstylepainter.cpp b/src/widgets/styles/qstylepainter.cpp
index b15b9d1a38..ff7db79009 100644
--- a/src/widgets/styles/qstylepainter.cpp
+++ b/src/widgets/styles/qstylepainter.cpp
@@ -65,13 +65,13 @@ QT_BEGIN_NAMESPACE
Example using QStyle directly:
- \snippet doc/src/snippets/styles/styles.cpp 1
+ \snippet styles/styles.cpp 1
Example using QStylePainter:
- \snippet doc/src/snippets/styles/styles.cpp 0
- \snippet doc/src/snippets/styles/styles.cpp 4
- \snippet doc/src/snippets/styles/styles.cpp 6
+ \snippet styles/styles.cpp 0
+ \snippet styles/styles.cpp 4
+ \snippet styles/styles.cpp 6
\sa QStyle, QStyleOption
*/
diff --git a/src/widgets/styles/qstyleplugin.cpp b/src/widgets/styles/qstyleplugin.cpp
index 74c29f39c8..b36ffcf181 100644
--- a/src/widgets/styles/qstyleplugin.cpp
+++ b/src/widgets/styles/qstyleplugin.cpp
@@ -83,10 +83,10 @@ QT_BEGIN_NAMESPACE
The style key is usually the class name of the required
style. Note that the keys are case insensitive. For example:
- \snippet doc/src/snippets/qstyleplugin/main.cpp 0
+ \snippet qstyleplugin/main.cpp 0
\codeline
- \snippet doc/src/snippets/qstyleplugin/main.cpp 1
- \snippet doc/src/snippets/qstyleplugin/main.cpp 2
+ \snippet qstyleplugin/main.cpp 1
+ \snippet qstyleplugin/main.cpp 2
\sa keys()
*/
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 91e4a9c3c1..245857b3c3 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -62,12 +62,12 @@
For example, here's how to provide auto completions from a simple
word list in a QLineEdit:
- \snippet doc/src/snippets/code/src_gui_util_qcompleter.cpp 0
+ \snippet code/src_gui_util_qcompleter.cpp 0
A QFileSystemModel can be used to provide auto completion of file names.
For example:
- \snippet doc/src/snippets/code/src_gui_util_qcompleter.cpp 1
+ \snippet code/src_gui_util_qcompleter.cpp 1
To set the model on which QCompleter should operate, call
setModel(). By default, QCompleter will attempt to match the \l
@@ -100,7 +100,7 @@
currentCompletion(). You can iterate through the list of
completions as below:
- \snippet doc/src/snippets/code/src_gui_util_qcompleter.cpp 2
+ \snippet code/src_gui_util_qcompleter.cpp 2
completionCount() returns the total number of completions for the
current prefix. completionCount() should be avoided when possible,
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 5392dd2f8e..3951017f89 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
a change to the document with redo() and undo the change with undo(). The
implementations for these functions must be provided in a derived class.
- \snippet doc/src/snippets/code/src_gui_util_qundostack.cpp 0
+ \snippet code/src_gui_util_qundostack.cpp 0
A QUndoCommand has an associated text(). This is a short string
describing what the command does. It is used to update the text
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
QUndoCommand objects are owned by the stack they were pushed on.
QUndoStack deletes a command if it has been undone and a new command is pushed. For example:
-\snippet doc/src/snippets/code/src_gui_util_qundostack.cpp 1
+\snippet code/src_gui_util_qundostack.cpp 1
In effect, when a command is pushed, it becomes the top-most command
on the stack.
@@ -93,7 +93,7 @@ QT_BEGIN_NAMESPACE
redo() on all its children. The parent should, however, have a meaningful
text().
- \snippet doc/src/snippets/code/src_gui_util_qundostack.cpp 2
+ \snippet code/src_gui_util_qundostack.cpp 2
Another way to create macros is to use the convenience functions
QUndoStack::beginMacro() and QUndoStack::endMacro().
@@ -182,7 +182,7 @@ int QUndoCommand::id() const
The default implementation returns false.
- \snippet doc/src/snippets/code/src_gui_util_qundostack.cpp 3
+ \snippet code/src_gui_util_qundostack.cpp 3
\sa id() QUndoStack::push()
*/
@@ -943,11 +943,11 @@ QAction *QUndoStack::createRedoAction(QObject *parent, const QString &prefix) co
The stack becomes enabled and appropriate signals are emitted when endMacro()
is called for the outermost macro.
- \snippet doc/src/snippets/code/src_gui_util_qundostack.cpp 4
+ \snippet code/src_gui_util_qundostack.cpp 4
This code is equivalent to:
- \snippet doc/src/snippets/code/src_gui_util_qundostack.cpp 5
+ \snippet code/src_gui_util_qundostack.cpp 5
\sa endMacro()
*/
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 4e85eae3ff..0c22576f7f 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -86,7 +86,7 @@ Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets;
ampersand ('&'), QAbstractButton automatically creates a shortcut
key. For example:
- \snippet doc/src/snippets/code/src_gui_widgets_qabstractbutton.cpp 0
+ \snippet code/src_gui_widgets_qabstractbutton.cpp 0
The \key Alt+C shortcut is assigned to the button, i.e., when the
user presses \key Alt+C the button will call animateClick(). See
@@ -97,7 +97,7 @@ Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets;
function. This is useful mostly for buttons that do not have any
text, because they have no automatic shortcut.
- \snippet doc/src/snippets/code/src_gui_widgets_qabstractbutton.cpp 1
+ \snippet code/src_gui_widgets_qabstractbutton.cpp 1
All of the buttons provided by Qt (QPushButton, QToolButton,
QCheckBox, and QRadioButton) can display both \l text and \l{icon}{icons}.
@@ -1361,7 +1361,7 @@ For example, a slot that reacts to signals emitted by newly checked
buttons but which ignores signals from buttons that have been unchecked
can be implemented using the following pattern:
-\snippet doc/src/snippets/code/src_gui_widgets_qabstractbutton.cpp 2
+\snippet code/src_gui_widgets_qabstractbutton.cpp 2
Button groups can be created using the QButtonGroup class, and
updates to the button states monitored with the
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index dc96321599..d97b03128e 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -130,13 +130,13 @@ QT_BEGIN_NAMESPACE
QWidget::move(). When the area contents or the viewport size
changes, we do the following:
- \snippet doc/src/snippets/myscrollarea.cpp 1
+ \snippet myscrollarea.cpp 1
When the scroll bars change value, we need to update the widget
position, i.e., find the part of the widget that is to be drawn in
the viewport:
- \snippet doc/src/snippets/myscrollarea.cpp 0
+ \snippet myscrollarea.cpp 0
In order to track scroll bar movements, reimplement the virtual
function scrollContentsBy(). In order to fine-tune scrolling
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 6c556dc870..4d55c9f0af 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -230,7 +230,7 @@ QString QAbstractSpinBox::text() const
to automatically choose one that will enable the image to fit completely
within the display window, you can set up the spin box like this:
- \snippet examples/widgets/spinboxes/window.cpp 3
+ \snippet widgets/spinboxes/window.cpp 3
The user will then be able to choose a scale from 1% to 1000%
or select "Auto" to leave it up to the application to choose. Your code
@@ -275,7 +275,7 @@ void QAbstractSpinBox::setSpecialValueText(const QString &specialValueText)
to the minimum() value and vica versa. Wrapping only make sense if
you have minimum() and maximum() values set.
- \snippet doc/src/snippets/code/src_gui_widgets_qabstractspinbox.cpp 0
+ \snippet code/src_gui_widgets_qabstractspinbox.cpp 0
\sa QSpinBox::minimum(), QSpinBox::maximum()
*/
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 427af68b64..acd07d2a5b 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -2004,7 +2004,7 @@ void QCalendarWidgetPrivate::_q_editingFinished()
\row \li
\image qcalendarwidget-grid.png
\row \li
- \snippet doc/src/snippets/code/src_gui_widgets_qcalendarwidget.cpp 0
+ \snippet code/src_gui_widgets_qcalendarwidget.cpp 0
\endtable
Finally, the day in the first column can be altered using the
@@ -2421,7 +2421,7 @@ void QCalendarWidget::showToday()
\li \image qcalendarwidget-minimum.png
\row
\li
- \snippet doc/src/snippets/code/src_gui_widgets_qcalendarwidget.cpp 1
+ \snippet code/src_gui_widgets_qcalendarwidget.cpp 1
\endtable
By default, the minimum date is the earliest date that the QDate
@@ -2472,7 +2472,7 @@ void QCalendarWidget::setMinimumDate(const QDate &date)
\li \image qcalendarwidget-maximum.png
\row
\li
- \snippet doc/src/snippets/code/src_gui_widgets_qcalendarwidget.cpp 2
+ \snippet code/src_gui_widgets_qcalendarwidget.cpp 2
\endtable
By default, the maximum date is the last day the QDate class can
@@ -2518,11 +2518,11 @@ void QCalendarWidget::setMaximumDate(const QDate &date)
The date range restricts the user selection, i.e. the user can
only select dates within the specified date range. Note that
- \snippet doc/src/snippets/code/src_gui_widgets_qcalendarwidget.cpp 3
+ \snippet code/src_gui_widgets_qcalendarwidget.cpp 3
is analogous to
- \snippet doc/src/snippets/code/src_gui_widgets_qcalendarwidget.cpp 4
+ \snippet code/src_gui_widgets_qcalendarwidget.cpp 4
If either the \a min or \a max parameters are not valid QDate
objects, this function does nothing.
@@ -2641,7 +2641,7 @@ void QCalendarWidget::setVerticalHeaderFormat(QCalendarWidget::VerticalHeaderFor
\li \inlineimage qcalendarwidget-grid.png
\row
\li
- \snippet doc/src/snippets/code/src_gui_widgets_qcalendarwidget.cpp 5
+ \snippet code/src_gui_widgets_qcalendarwidget.cpp 5
\endtable
The default value is false.
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp
index 13440ac104..a0093800a5 100644
--- a/src/widgets/widgets/qcheckbox.cpp
+++ b/src/widgets/widgets/qcheckbox.cpp
@@ -107,7 +107,7 @@ public:
constructor or with setText(). A shortcut key can be specified by preceding
the preferred character with an ampersand. For example:
- \snippet doc/src/snippets/code/src_gui_widgets_qcheckbox.cpp 0
+ \snippet code/src_gui_widgets_qcheckbox.cpp 0
In this example the shortcut is \e{Alt+A}. See the \l{QShortcut#mnemonic}
{QShortcut} documentation for details (to display an actual ampersand,
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 0cdb2d1176..4c418bde9e 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
QDateTimeEdit box. Dates and times appear in accordance with the
format set; see setDisplayFormat().
- \snippet doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp 0
+ \snippet code/src_gui_widgets_qdatetimeedit.cpp 0
Here we've created a new QDateTimeEdit object initialized with
today's date, and restricted the valid date range to today plus or
@@ -397,11 +397,11 @@ void QDateTimeEdit::setMaximumDateTime(const QDateTime &dt)
function call.
\since 4.4
- \snippet doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp 1
+ \snippet code/src_gui_widgets_qdatetimeedit.cpp 1
is analogous to:
- \snippet doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp 2
+ \snippet code/src_gui_widgets_qdatetimeedit.cpp 2
If either \a min or \a max are not valid, this function does
nothing.
@@ -560,11 +560,11 @@ void QDateTimeEdit::clearMaximumTime()
Convenience function to set minimum and maximum date with one
function call.
- \snippet doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp 3
+ \snippet code/src_gui_widgets_qdatetimeedit.cpp 3
is analogous to:
- \snippet doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp 4
+ \snippet code/src_gui_widgets_qdatetimeedit.cpp 4
If either \a min or \a max are not valid, this function does
nothing.
@@ -587,11 +587,11 @@ void QDateTimeEdit::setDateRange(const QDate &min, const QDate &max)
Convenience function to set minimum and maximum time with one
function call.
- \snippet doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp 5
+ \snippet code/src_gui_widgets_qdatetimeedit.cpp 5
is analogous to:
- \snippet doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp 6
+ \snippet code/src_gui_widgets_qdatetimeedit.cpp 6
If either \a min or \a max are not valid, this function does
nothing.
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index b787522a50..bcf0753d33 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -86,19 +86,19 @@ QT_BEGIN_NAMESPACE
destructive results.
Most dialogs have buttons that can almost be considered standard (e.g.
- \gui OK and \gui Cancel buttons). It is sometimes convenient to create these
+ \uicontrol OK and \uicontrol Cancel buttons). It is sometimes convenient to create these
buttons in a standard way.
There are a couple ways of using QDialogButtonBox. One ways is to create
the buttons (or button texts) yourself and add them to the button box,
specifying their role.
- \snippet examples/dialogs/extension/finddialog.cpp 1
+ \snippet dialogs/extension/finddialog.cpp 1
Alternatively, QDialogButtonBox provides several standard buttons (e.g. OK, Cancel, Save)
that you can use. They exist as flags so you can OR them together in the constructor.
- \snippet examples/dialogs/tabdialog/tabdialog.cpp 2
+ \snippet dialogs/tabdialog/tabdialog.cpp 2
You can mix and match normal buttons and standard buttons.
@@ -133,6 +133,8 @@ QT_BEGIN_NAMESPACE
\table
\row \li modeless horizontal MacLayout
\li \inlineimage buttonbox-mac-modeless-horizontal.png Screenshot of modeless horizontal MacLayout
+ \row \li modeless vertical MacLayout
+ \li \inlineimage buttonbox-mac-modeless-vertical.png Screenshot of modeless vertical MacLayout
\endtable
When a button is clicked in the button box, the clicked() signal is emitted
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index e40b109455..db45bf4e46 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1547,7 +1547,7 @@ QAction * QDockWidget::toggleViewAction() const
\li When DockWidgetVerticalTitleBar is set on QDockWidget, the title
bar widget is repositioned accordingly. In resizeEvent(), the title
bar should check what orientation it should assume:
- \snippet doc/src/snippets/code/src_gui_widgets_qdockwidget.cpp 0
+ \snippet code/src_gui_widgets_qdockwidget.cpp 0
\li The title bar widget must have a valid QWidget::sizeHint() and
QWidget::minimumSizeHint(). These functions should take into account
diff --git a/src/widgets/widgets/qframe.cpp b/src/widgets/widgets/qframe.cpp
index b69f65828b..d11ff09a30 100644
--- a/src/widgets/widgets/qframe.cpp
+++ b/src/widgets/widgets/qframe.cpp
@@ -79,7 +79,7 @@ inline void QFramePrivate::init()
screen. QProgressBar has a "sunken" look. QLabel has a flat look.
The frames of widgets like these can be changed.
- \snippet doc/src/snippets/code/src_gui_widgets_qframe.cpp 0
+ \snippet code/src_gui_widgets_qframe.cpp 0
The QFrame class can also be used directly for creating simple
placeholder frames without any contents.
diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp
index d8ad04cd84..343fc85bc9 100644
--- a/src/widgets/widgets/qgroupbox.cpp
+++ b/src/widgets/widgets/qgroupbox.cpp
@@ -169,7 +169,7 @@ void QGroupBoxPrivate::click()
widgets). The following example shows how we can set up a
QGroupBox with a layout:
- \snippet examples/widgets/groupbox/window.cpp 2
+ \snippet widgets/groupbox/window.cpp 2
\table 100%
\row \li \inlineimage windowsxp-groupbox.png Screenshot of a Windows XP style group box
@@ -261,7 +261,7 @@ void QGroupBox::setTitle(const QString &title)
The group box title text will have a keyboard shortcut if the title
contains an ampersand ('&') followed by a letter.
- \snippet doc/src/snippets/code/src_gui_widgets_qgroupbox.cpp 0
+ \snippet code/src_gui_widgets_qgroupbox.cpp 0
In the example above, \key Alt+U moves the keyboard focus to the
group box. See the \l {QShortcut#mnemonic}{QShortcut}
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index 4450066df4..99deca4709 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -115,7 +115,7 @@ QT_BEGIN_NAMESPACE
the bottom right corner (both lines being flush with the right
side of the label):
- \snippet doc/src/snippets/code/src_gui_widgets_qlabel.cpp 0
+ \snippet code/src_gui_widgets_qlabel.cpp 0
The properties and functions QLabel inherits from QFrame can also
be used to specify the widget frame to be used for any given label.
@@ -125,7 +125,7 @@ QT_BEGIN_NAMESPACE
mnemonic (see QKeySequence) that will set the keyboard focus to
the other widget (called the QLabel's "buddy"). For example:
- \snippet doc/src/snippets/code/src_gui_widgets_qlabel.cpp 1
+ \snippet code/src_gui_widgets_qlabel.cpp 1
In this example, keyboard focus is transferred to the label's
buddy (the QLineEdit) when the user presses Alt+P. If the buddy
@@ -1150,7 +1150,7 @@ void QLabelPrivate::updateLabel()
In a dialog, you might create two data entry widgets and a label
for each, and set up the geometry layout so each label is just to
the left of its data entry widget (its "buddy"), for example:
- \snippet doc/src/snippets/code/src_gui_widgets_qlabel.cpp 2
+ \snippet code/src_gui_widgets_qlabel.cpp 2
With the code above, the focus jumps to the Name field when the
user presses Alt+N, and to the Phone field when the user presses
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 1ea636ffb2..bbf34b9853 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -1980,7 +1980,7 @@ void QLineEdit::dropEvent(QDropEvent* e)
to extend the standard context menu, reimplement this function, call
createStandardContextMenu() and extend the menu returned.
- \snippet doc/src/snippets/code/src_gui_widgets_qlineedit.cpp 0
+ \snippet code/src_gui_widgets_qlineedit.cpp 0
The \a event parameter is used to obtain the position where
the mouse cursor was when the event was generated.
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
index 1c8e6ba0e8..3aff6ee5d9 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
@@ -85,7 +85,7 @@
developer to provide the autorelease pool.
The following is a snippet of subclassing QMacCocoaViewContainer to wrap a NSSearchField.
- \snippet examples/mainwindows/macmainwindow/macmainwindow.mm 0
+ \snippet mainwindows/macmainwindow/macmainwindow.mm 0
*/
diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm
index 7974e93d88..e608b4a756 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.mm
+++ b/src/widgets/widgets/qmacnativewidget_mac.mm
@@ -70,11 +70,11 @@
Here is an example of putting a QPushButton into a NSWindow:
- \snippet doc/src/snippets/qmacnativewidget/main.mm 0
+ \snippet qmacnativewidget/main.mm 0
On Carbon, this would do the equivalent:
- \snippet doc/src/snippets/qmacnativewidget/main.mm 1
+ \snippet qmacnativewidget/main.mm 1
Note that QMacNativeWidget requires knowledge of Carbon or Cocoa. All it
does is get the Qt hierarchy into a window not owned by Qt. It is then up
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 7607f2f238..efd5db07ab 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -261,7 +261,7 @@ void QMainWindowPrivate::init()
An example of how to create menus follows:
- \snippet examples/mainwindows/application/mainwindow.cpp 26
+ \snippet mainwindows/application/mainwindow.cpp 26
The \c createPopupMenu() function creates popup menus when the
main window receives context menu events. The default
@@ -288,7 +288,7 @@ void QMainWindowPrivate::init()
An example of toolbar creation follows:
- \snippet examples/mainwindows/application/mainwindow.cpp 29
+ \snippet mainwindows/application/mainwindow.cpp 29
\section2 Creating Dock Widgets
@@ -312,7 +312,7 @@ void QMainWindowPrivate::init()
We give an example of how to create and add dock widgets to a
main window:
- \snippet doc/src/snippets/mainwindowsnippet.cpp 0
+ \snippet mainwindowsnippet.cpp 0
\section2 The Status Bar
@@ -485,7 +485,7 @@ void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle)
can then share among all the Mac windows. Create a parent-less
menu bar this way:
- \snippet doc/src/snippets/code/src_gui_widgets_qmenubar.cpp 1
+ \snippet code/src_gui_widgets_qmenubar.cpp 1
\sa setMenuBar()
*/
@@ -1213,7 +1213,7 @@ Qt::DockWidgetArea QMainWindow::dockWidgetArea(QDockWidget *dockwidget) const
To save the geometry when the window closes, you can
implement a close event like this:
- \snippet doc/src/snippets/code/src_gui_widgets_qmainwindow.cpp 0
+ \snippet code/src_gui_widgets_qmainwindow.cpp 0
\sa restoreState(), QWidget::saveGeometry(), QWidget::restoreGeometry()
*/
@@ -1237,7 +1237,7 @@ QByteArray QMainWindow::saveState(int version) const
To restore geometry saved using QSettings, you can use code like
this:
- \snippet doc/src/snippets/code/src_gui_widgets_qmainwindow.cpp 1
+ \snippet code/src_gui_widgets_qmainwindow.cpp 1
\sa saveState(), QWidget::saveGeometry(),
QWidget::restoreGeometry(), restoreDockWidget()
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index eb483ac0fe..b859fc437e 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -53,7 +53,7 @@
applications, but can also be placed in any layout. The following
code adds an area to a main window:
- \snippet doc/src/snippets/mdiareasnippets.cpp 0
+ \snippet mdiareasnippets.cpp 0
Unlike the window managers for top-level windows, all window flags
(Qt::WindowFlags) are supported by QMdiArea as long as the flags
@@ -1929,7 +1929,7 @@ void QMdiArea::activatePreviousSubWindow()
\note Once the subwindow has been added, its parent will be the
\e{viewport widget} of the QMdiArea.
- \snippet doc/src/snippets/mdiareasnippets.cpp 1
+ \snippet mdiareasnippets.cpp 1
When you create your own subwindow, you must set the
Qt::WA_DeleteOnClose widget attribute if you want the window to be
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 2abd4ceef7..fccb062e07 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1990,11 +1990,11 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
In most situations you'll want to specify the position yourself,
for example, the current mouse position:
- \snippet doc/src/snippets/code/src_gui_widgets_qmenu.cpp 0
+ \snippet code/src_gui_widgets_qmenu.cpp 0
or aligned to a widget:
- \snippet doc/src/snippets/code/src_gui_widgets_qmenu.cpp 1
+ \snippet code/src_gui_widgets_qmenu.cpp 1
or in reaction to a QMouseEvent *e:
- \snippet doc/src/snippets/code/src_gui_widgets_qmenu.cpp 2
+ \snippet code/src_gui_widgets_qmenu.cpp 2
*/
QAction *QMenu::exec()
{
@@ -2022,11 +2022,11 @@ QAction *QMenu::exec()
Common usage is to position the menu at the current mouse
position:
- \snippet doc/src/snippets/code/src_gui_widgets_qmenu.cpp 3
+ \snippet code/src_gui_widgets_qmenu.cpp 3
or aligned to a widget:
- \snippet doc/src/snippets/code/src_gui_widgets_qmenu.cpp 4
+ \snippet code/src_gui_widgets_qmenu.cpp 4
or in reaction to a QMouseEvent *e:
- \snippet doc/src/snippets/code/src_gui_widgets_qmenu.cpp 5
+ \snippet code/src_gui_widgets_qmenu.cpp 5
When positioning a menu with exec() or popup(), bear in mind that
you cannot rely on the menu's current size(). For performance
@@ -2074,7 +2074,7 @@ QAction *QMenu::exec(const QPoint &p, QAction *action)
(normally because the user pressed Esc).
This is equivalent to:
- \snippet doc/src/snippets/code/src_gui_widgets_qmenu.cpp 6
+ \snippet code/src_gui_widgets_qmenu.cpp 6
\sa popup(), QWidget::mapToGlobal()
*/
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index c9818e056c..104424cabf 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -586,7 +586,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
menu items with addMenu(). For example, asuming that \c menubar
is a pointer to a QMenuBar and \c fileMenu is a pointer to a
QMenu, the following statement inserts the menu into the menu bar:
- \snippet doc/src/snippets/code/src_gui_widgets_qmenubar.cpp 0
+ \snippet code/src_gui_widgets_qmenubar.cpp 0
The ampersand in the menu item's text sets Alt+F as a shortcut for
this menu. (You can use "\&\&" to get a real ampersand in the menu
@@ -605,7 +605,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
Example (from the \l{mainwindows/menus}{Menus} example):
- \snippet examples/mainwindows/menus/mainwindow.cpp 9
+ \snippet mainwindows/menus/mainwindow.cpp 9
Menu items may be removed with removeAction().
@@ -619,7 +619,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
of menu bars and their behavior when the user interacts with them.
For example, Windows systems are often configured so that the
underlined character mnemonics that indicate keyboard shortcuts
- for items in the menu bar are only shown when the \gui{Alt} key is
+ for items in the menu bar are only shown when the \uicontrol{Alt} key is
pressed.
\table
@@ -628,13 +628,13 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
Plastique widget style.
\li The \l{QPlastiqueStyle}{Plastique widget style}, like most
- other styles, handles the \gui{Help} menu in the same way as it
+ other styles, handles the \uicontrol{Help} menu in the same way as it
handles any other menu.
\row \li \inlineimage motif-menubar.png A menu bar shown in the
Motif widget style.
- \li The \l{QMotifStyle}{Motif widget style} treats \gui{Help} menus
+ \li The \l{QMotifStyle}{Motif widget style} treats \uicontrol{Help} menus
in a special way, placing them at right-hand end of the menu bar.
\endtable
@@ -677,7 +677,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
bar, you must create a menu bar that does not have a parent.
Create a parent-less menu bar this way:
- \snippet doc/src/snippets/code/src_gui_widgets_qmenubar.cpp 1
+ \snippet code/src_gui_widgets_qmenubar.cpp 1
\b{Note:} Do \e{not} call QMainWindow::menuBar() to create the
shared menu bar, because that menu bar will have the QMainWindow
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index fad2d4e747..dad0a6b7b6 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -2039,7 +2039,7 @@ bool QPlainTextEdit::focusNextPrevChild(bool next)
Information about the event is passed in the \a event object.
- \snippet doc/src/snippets/code/src_gui_widgets_qplaintextedit.cpp 0
+ \snippet code/src_gui_widgets_qplaintextedit.cpp 0
*/
void QPlainTextEdit::contextMenuEvent(QContextMenuEvent *e)
{
@@ -2479,7 +2479,7 @@ QTextCharFormat QPlainTextEdit::currentCharFormat() const
It is equivalent to
- \snippet doc/src/snippets/code/src_gui_widgets_qplaintextedit.cpp 1
+ \snippet code/src_gui_widgets_qplaintextedit.cpp 1
*/
void QPlainTextEdit::insertPlainText(const QString &text)
{
@@ -2528,10 +2528,10 @@ void QPlainTextEdit::print(QPagedPaintDevice *printer) const
#endif
/*! \property QPlainTextEdit::tabChangesFocus
- \brief whether \gui Tab changes focus or is accepted as input
+ \brief whether \uicontrol Tab changes focus or is accepted as input
In some occasions text edits should not allow the user to input
- tabulators or change indentation using the \gui Tab key, as this breaks
+ tabulators or change indentation using the \uicontrol Tab key, as this breaks
the focus chain. The default is false.
*/
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index 291e3548a2..9853924182 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE
preceding the preferred character with an ampersand in the
text. For example:
- \snippet doc/src/snippets/code/src_gui_widgets_qpushbutton.cpp 0
+ \snippet code/src_gui_widgets_qpushbutton.cpp 0
In this example the shortcut is \e{Alt+D}. See the \l
{QShortcut#mnemonic}{QShortcut} documentation for details (to
diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp
index 11cd89bca2..15dbdd4284 100644
--- a/src/widgets/widgets/qradiobutton.cpp
+++ b/src/widgets/widgets/qradiobutton.cpp
@@ -105,7 +105,7 @@ void QRadioButtonPrivate::init()
can be specified by preceding the preferred character with an
ampersand in the text. For example:
- \snippet doc/src/snippets/code/src_gui_widgets_qradiobutton.cpp 0
+ \snippet code/src_gui_widgets_qradiobutton.cpp 0
In this example the shortcut is \e{Alt+c}. See the \l
{QShortcut#mnemonic}{QShortcut} documentation for details (to
diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp
index 0f95f0188a..8173ffe657 100644
--- a/src/widgets/widgets/qrubberband.cpp
+++ b/src/widgets/widgets/qrubberband.cpp
@@ -112,7 +112,7 @@ void QRubberBand::initStyleOption(QStyleOptionRubberBand *option) const
setGeometry(), move() or resize() to position and size it. A common
pattern is to do this in conjunction with mouse events. For example:
- \snippet doc/src/snippets/code/src_gui_widgets_qrubberband.cpp 0
+ \snippet code/src_gui_widgets_qrubberband.cpp 0
If you pass a parent to QRubberBand's constructor, the rubber band will
display only inside its parent, but stays on top of other child widgets.
diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp
index 84be2d569b..99b4151d8c 100644
--- a/src/widgets/widgets/qscrollarea.cpp
+++ b/src/widgets/widgets/qscrollarea.cpp
@@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE
widget can be viewed. The child widget must be specified with
setWidget(). For example:
- \snippet doc/src/snippets/code/src_gui_widgets_qscrollarea.cpp 0
+ \snippet code/src_gui_widgets_qscrollarea.cpp 0
The code above creates a scroll area (shown in the images below)
containing an image label. When scaling the image, the scroll area
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index 7dcaead2f4..cb88ca1b79 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -168,9 +168,9 @@ public:
for a custom spin box that allows the user to enter icon sizes
(e.g., "32 x 32"):
- \snippet examples/widgets/icons/iconsizespinbox.cpp 1
+ \snippet widgets/icons/iconsizespinbox.cpp 1
\codeline
- \snippet examples/widgets/icons/iconsizespinbox.cpp 2
+ \snippet widgets/icons/iconsizespinbox.cpp 2
See the \l{widgets/icons}{Icons} example for the full source
code.
@@ -238,7 +238,7 @@ void QSpinBox::setValue(int value)
Typical use is to display a unit of measurement or a currency
symbol. For example:
- \snippet doc/src/snippets/code/src_gui_widgets_qspinbox.cpp 0
+ \snippet code/src_gui_widgets_qspinbox.cpp 0
To turn off the prefix display, set this property to an empty
string. The default is no prefix. The prefix is not displayed when
@@ -274,7 +274,7 @@ void QSpinBox::setPrefix(const QString &prefix)
use is to display a unit of measurement or a currency symbol. For
example:
- \snippet doc/src/snippets/code/src_gui_widgets_qspinbox.cpp 1
+ \snippet code/src_gui_widgets_qspinbox.cpp 1
To turn off the suffix display, set this property to an empty
string. The default is no suffix. The suffix is not displayed for
@@ -405,9 +405,9 @@ void QSpinBox::setMaximum(int maximum)
Convenience function to set the \a minimum, and \a maximum values
with a single function call.
- \snippet doc/src/snippets/code/src_gui_widgets_qspinbox.cpp 2
+ \snippet code/src_gui_widgets_qspinbox.cpp 2
is equivalent to:
- \snippet doc/src/snippets/code/src_gui_widgets_qspinbox.cpp 3
+ \snippet code/src_gui_widgets_qspinbox.cpp 3
\sa minimum maximum
*/
@@ -610,7 +610,7 @@ void QDoubleSpinBox::setValue(double value)
Typical use is to display a unit of measurement or a currency
symbol. For example:
- \snippet doc/src/snippets/code/src_gui_widgets_qspinbox.cpp 4
+ \snippet code/src_gui_widgets_qspinbox.cpp 4
To turn off the prefix display, set this property to an empty
string. The default is no prefix. The prefix is not displayed when
@@ -644,7 +644,7 @@ void QDoubleSpinBox::setPrefix(const QString &prefix)
use is to display a unit of measurement or a currency symbol. For
example:
- \snippet doc/src/snippets/code/src_gui_widgets_qspinbox.cpp 5
+ \snippet code/src_gui_widgets_qspinbox.cpp 5
To turn off the suffix display, set this property to an empty
string. The default is no suffix. The suffix is not displayed for
@@ -784,9 +784,9 @@ void QDoubleSpinBox::setMaximum(double maximum)
Note: The maximum and minimum values will be rounded to match the
decimals property.
- \snippet doc/src/snippets/code/src_gui_widgets_qspinbox.cpp 6
+ \snippet code/src_gui_widgets_qspinbox.cpp 6
is equivalent to:
- \snippet doc/src/snippets/code/src_gui_widgets_qspinbox.cpp 7
+ \snippet code/src_gui_widgets_qspinbox.cpp 7
\sa minimum maximum
*/
diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp
index 5a7d6376ca..f3a19c88ec 100644
--- a/src/widgets/widgets/qsplashscreen.cpp
+++ b/src/widgets/widgets/qsplashscreen.cpp
@@ -94,9 +94,9 @@ public:
some initialization tasks are performed before the application's
main window is shown:
- \snippet doc/src/snippets/qsplashscreen/main.cpp 0
+ \snippet qsplashscreen/main.cpp 0
\dots
- \snippet doc/src/snippets/qsplashscreen/main.cpp 1
+ \snippet qsplashscreen/main.cpp 1
The user can hide the splash screen by clicking on it with the
mouse. Since the splash screen is typically displayed before the
@@ -107,7 +107,7 @@ public:
for example, announcing connections established or modules loaded
as the application starts up:
- \snippet doc/src/snippets/code/src_gui_widgets_qsplashscreen.cpp 0
+ \snippet code/src_gui_widgets_qsplashscreen.cpp 0
QSplashScreen supports this with the showMessage() function. If you
wish to do your own drawing you can get a pointer to the pixmap
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index 17e1c39cee..126f819541 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -84,12 +84,12 @@ QT_BEGIN_NAMESPACE
reimplement QSplitter::createHandle() to instantiate the custom splitter
handle. For example, a minimum QSplitter subclass might look like this:
- \snippet doc/src/snippets/splitterhandle/splitter.h 0
+ \snippet splitterhandle/splitter.h 0
The \l{QSplitter::}{createHandle()} implementation simply constructs a
custom splitter handle, called \c Splitter in this example:
- \snippet doc/src/snippets/splitterhandle/splitter.cpp 1
+ \snippet splitterhandle/splitter.cpp 1
Information about a given handle can be obtained using functions like
orientation() and opaqueResize(), and is retrieved from its parent splitter.
@@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE
needs to perform. A simple subclass might only provide a paintEvent()
implementation:
- \snippet doc/src/snippets/splitterhandle/splitter.cpp 0
+ \snippet splitterhandle/splitter.cpp 0
In this example, a predefined gradient is set up differently depending on
the orientation of the handle. QSplitterHandle provides a reasonable
@@ -888,7 +888,7 @@ QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w)
The following example will show a QListView, QTreeView, and
QTextEdit side by side, with two splitter handles:
- \snippet doc/src/snippets/splitter/splitter.cpp 0
+ \snippet splitter/splitter.cpp 0
If a widget is already inside a QSplitter when insertWidget() or
addWidget() is called, it will move to the new position. This can be used
@@ -1569,7 +1569,7 @@ static const qint32 SplitterMagic = 0xff;
for a future session. A version number is stored as part of the data.
Here is an example:
- \snippet doc/src/snippets/splitter/splitter.cpp 1
+ \snippet splitter/splitter.cpp 1
\sa restoreState()
*/
@@ -1604,7 +1604,7 @@ QByteArray QSplitter::saveState() const
Restore the splitters's state:
- \snippet doc/src/snippets/splitter/splitter.cpp 2
+ \snippet splitter/splitter.cpp 2
A failure to restore the splitter's layout may result from either
invalid or out-of-date data in the supplied byte array.
@@ -1657,7 +1657,7 @@ bool QSplitter::restoreState(const QByteArray &state)
This function is provided for convenience. It is equivalent to
- \snippet doc/src/snippets/code/src_gui_widgets_qsplitter.cpp 0
+ \snippet code/src_gui_widgets_qsplitter.cpp 0
\sa setSizes(), widget()
*/
diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp
index 5406f5dcf5..e239f86345 100644
--- a/src/widgets/widgets/qstackedwidget.cpp
+++ b/src/widgets/widgets/qstackedwidget.cpp
@@ -74,16 +74,16 @@ public:
Like QStackedLayout, QStackedWidget can be constructed and
populated with a number of child widgets ("pages"):
- \snippet doc/src/snippets/qstackedwidget/main.cpp 0
- \snippet doc/src/snippets/qstackedwidget/main.cpp 2
- \snippet doc/src/snippets/qstackedwidget/main.cpp 3
+ \snippet qstackedwidget/main.cpp 0
+ \snippet qstackedwidget/main.cpp 2
+ \snippet qstackedwidget/main.cpp 3
QStackedWidget provides no intrinsic means for the user to switch
page. This is typically done through a QComboBox or a QListWidget
that stores the titles of the QStackedWidget's pages. For
example:
- \snippet doc/src/snippets/qstackedwidget/main.cpp 1
+ \snippet qstackedwidget/main.cpp 1
When populating a stacked widget, the widgets are added to an
internal list. The indexOf() function returns the index of a
diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp
index 4b9242499c..2b17d7fb83 100644
--- a/src/widgets/widgets/qstatusbar.cpp
+++ b/src/widgets/widgets/qstatusbar.cpp
@@ -186,12 +186,12 @@ QRect QStatusBarPrivate::messageRect() const
Use the showMessage() slot to display a \e temporary message:
- \snippet examples/mainwindows/dockwidgets/mainwindow.cpp 8
+ \snippet mainwindows/dockwidgets/mainwindow.cpp 8
To remove a temporary message, use the clearMessage() slot, or set
a time limit when calling showMessage(). For example:
- \snippet examples/mainwindows/dockwidgets/mainwindow.cpp 3
+ \snippet mainwindows/dockwidgets/mainwindow.cpp 3
Use the currentMessage() function to retrieve the temporary
message currently shown. The QStatusBar class also provide the
@@ -205,7 +205,7 @@ QRect QStatusBarPrivate::messageRect() const
addPermanentWidget() function. Use the removeWidget() function to
remove such messages from the status bar.
- \snippet doc/src/snippets/code/src_gui_widgets_qstatusbar.cpp 0
+ \snippet code/src_gui_widgets_qstatusbar.cpp 0
By default QStatusBar provides a QSizeGrip in the lower-right
corner. You can disable it using the setSizeGripEnabled()
diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp
index 261b96f8af..b8ffced6bb 100644
--- a/src/widgets/widgets/qtextbrowser.cpp
+++ b/src/widgets/widgets/qtextbrowser.cpp
@@ -1170,7 +1170,7 @@ QUrl QTextBrowser::historyUrl(int i) const
\row \li \a{i} > 0 \li \l forward() history
\endtable
- \snippet doc/src/snippets/code/src_gui_widgets_qtextbrowser.cpp 0
+ \snippet code/src_gui_widgets_qtextbrowser.cpp 0
\since 4.4
*/
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 217fda61dc..7a7b977b89 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -472,12 +472,12 @@ void QTextEditPrivate::_q_ensureVisible(const QRectF &_rect)
For example, to allow the user to drag and drop an image onto a QTextEdit,
you could the implement these functions in the following way:
- \snippet doc/src/snippets/textdocument-imagedrop/textedit.cpp 0
+ \snippet textdocument-imagedrop/textedit.cpp 0
We add support for image MIME types by returning true. For all other
MIME types, we use the default implementation.
- \snippet doc/src/snippets/textdocument-imagedrop/textedit.cpp 1
+ \snippet textdocument-imagedrop/textedit.cpp 1
We unpack the image from the QVariant held by the MIME source and insert
it into the document as a resource.
@@ -1583,7 +1583,7 @@ bool QTextEdit::focusNextPrevChild(bool next)
Information about the event is passed in the \a event object.
- \snippet doc/src/snippets/code/src_gui_widgets_qtextedit.cpp 0
+ \snippet code/src_gui_widgets_qtextedit.cpp 0
*/
void QTextEdit::contextMenuEvent(QContextMenuEvent *e)
{
@@ -2143,7 +2143,7 @@ void QTextEdit::setAutoFormatting(AutoFormatting features)
It is equivalent to
- \snippet doc/src/snippets/code/src_gui_widgets_qtextedit.cpp 1
+ \snippet code/src_gui_widgets_qtextedit.cpp 1
*/
void QTextEdit::insertPlainText(const QString &text)
{
@@ -2157,7 +2157,7 @@ void QTextEdit::insertPlainText(const QString &text)
It is equivalent to:
- \snippet doc/src/snippets/code/src_gui_widgets_qtextedit.cpp 2
+ \snippet code/src_gui_widgets_qtextedit.cpp 2
\note When using this function with a style sheet, the style sheet will
only apply to the current block in the document. In order to apply a style
@@ -2273,10 +2273,10 @@ void QTextEdit::print(QPagedPaintDevice *printer) const
#endif
/*! \property QTextEdit::tabChangesFocus
- \brief whether \gui Tab changes focus or is accepted as input
+ \brief whether \uicontrol Tab changes focus or is accepted as input
In some occasions text edits should not allow the user to input
- tabulators or change indentation using the \gui Tab key, as this breaks
+ tabulators or change indentation using the \uicontrol Tab key, as this breaks
the focus chain. The default is false.
*/