summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2011-04-07 09:08:53 (GMT)
committeraxis <qt-info@nokia.com>2011-04-07 09:08:53 (GMT)
commitd54b3f04fa629fe031f1083073eef0145f0d6b1e (patch)
tree2a06736f812c478bdb21aa3781078fe88b5532fa /doc/src/snippets
parent258c1a8537816f7b4c79e7cf4090a333768a10fa (diff)
parent8031eada2f81963865390b4d899631b09d4ca6f3 (diff)
downloadQt-d54b3f04fa629fe031f1083073eef0145f0d6b1e.zip
Qt-d54b3f04fa629fe031f1083073eef0145f0d6b1e.tar.gz
Qt-d54b3f04fa629fe031f1083073eef0145f0d6b1e.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt into earth-master
Conflicts: src/corelib/thread/qthread_unix.cpp
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp (renamed from doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_appicon.pro53
-rw-r--r--doc/src/snippets/code/doc_src_appicon.qdoc14
-rw-r--r--doc/src/snippets/code/doc_src_containers.cpp (renamed from doc/src/snippets/code/doc_src_containers.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_coordsys.cpp (renamed from doc/src/snippets/code/doc_src_coordsys.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_debug.cpp (renamed from doc/src/snippets/code/doc_src_debug.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_deployment.cpp56
-rw-r--r--doc/src/snippets/code/doc_src_deployment.pro87
-rw-r--r--doc/src/snippets/code/doc_src_deployment.qdoc27
-rw-r--r--doc/src/snippets/code/doc_src_designer-manual.cpp (renamed from doc/src/snippets/code/doc_src_designer-manual.qdoc)26
-rw-r--r--doc/src/snippets/code/doc_src_designer-manual.js43
-rw-r--r--doc/src/snippets/code/doc_src_designer-manual.pro59
-rw-r--r--doc/src/snippets/code/doc_src_dnd.cpp (renamed from doc/src/snippets/code/doc_src_dnd.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_emb-performance.cpp71
-rw-r--r--doc/src/snippets/code/doc_src_emb-performance.qdoc33
-rw-r--r--doc/src/snippets/code/doc_src_emb-pointer.pro46
-rw-r--r--doc/src/snippets/code/doc_src_emb-pointer.qdoc10
-rw-r--r--doc/src/snippets/code/doc_src_examples_arrowpad.cpp43
-rw-r--r--doc/src/snippets/code/doc_src_examples_arrowpad.qdoc5
-rw-r--r--doc/src/snippets/code/doc_src_examples_containerextension.pro (renamed from doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.qdoc)4
-rw-r--r--doc/src/snippets/code/doc_src_examples_customwidgetplugin.pro (renamed from doc/src/snippets/code/doc_src_examples_customwidgetplugin.qdoc)4
-rw-r--r--doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp (renamed from doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_examples_icons.cpp44
-rw-r--r--doc/src/snippets/code/doc_src_examples_icons.qdoc6
-rw-r--r--doc/src/snippets/code/doc_src_examples_imageviewer.cpp54
-rw-r--r--doc/src/snippets/code/doc_src_examples_imageviewer.qdoc16
-rw-r--r--doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp (renamed from doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_examples_simpledommodel.cpp (renamed from doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_examples_taskmenuextension.pro (renamed from doc/src/snippets/code/doc_src_examples_taskmenuextension.qdoc)4
-rw-r--r--doc/src/snippets/code/doc_src_examples_textfinder.pro (renamed from doc/src/snippets/code/doc_src_examples_textfinder.qdoc)4
-rw-r--r--doc/src/snippets/code/doc_src_examples_trollprint.cpp (renamed from doc/src/snippets/code/doc_src_examples_trollprint.qdoc)2
-rw-r--r--doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.pro (renamed from doc/src/snippets/code/doc_src_examples_containerextension.qdoc)4
-rw-r--r--doc/src/snippets/code/doc_src_graphicsview.cpp (renamed from doc/src/snippets/code/doc_src_graphicsview.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_groups.cpp (renamed from doc/src/snippets/code/doc_src_groups.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_i18n.cpp175
-rw-r--r--doc/src/snippets/code/doc_src_i18n.qdoc137
-rw-r--r--doc/src/snippets/code/doc_src_layout.cpp (renamed from doc/src/snippets/code/doc_src_layout.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_linguist-manual.cpp157
-rw-r--r--doc/src/snippets/code/doc_src_linguist-manual.pro62
-rw-r--r--doc/src/snippets/code/doc_src_linguist-manual.qdoc144
-rw-r--r--doc/src/snippets/code/doc_src_mac-differences.cpp52
-rw-r--r--doc/src/snippets/code/doc_src_mac-differences.pro43
-rw-r--r--doc/src/snippets/code/doc_src_moc.cpp144
-rw-r--r--doc/src/snippets/code/doc_src_moc.qdoc106
-rw-r--r--doc/src/snippets/code/doc_src_model-view-programming.cpp (renamed from doc/src/snippets/code/doc_src_model-view-programming.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_modules.pro (renamed from doc/src/snippets/code/doc_src_modules.qdoc)4
-rw-r--r--doc/src/snippets/code/doc_src_objecttrees.cpp (renamed from doc/src/snippets/code/doc_src_objecttrees.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_phonon-api.cpp (renamed from doc/src/snippets/code/doc_src_phonon-api.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_phonon.pro43
-rw-r--r--doc/src/snippets/code/doc_src_plugins-howto.cpp89
-rw-r--r--doc/src/snippets/code/doc_src_plugins-howto.pro50
-rw-r--r--doc/src/snippets/code/doc_src_plugins-howto.qdoc63
-rw-r--r--doc/src/snippets/code/doc_src_porting-qsa.cpp89
-rw-r--r--doc/src/snippets/code/doc_src_porting-qsa.js117
-rw-r--r--doc/src/snippets/code/doc_src_porting-qsa.qdoc128
-rw-r--r--doc/src/snippets/code/doc_src_porting4-canvas.cpp (renamed from doc/src/snippets/code/doc_src_porting4-canvas.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_porting4-designer.cpp173
-rw-r--r--doc/src/snippets/code/doc_src_porting4-designer.pro43
-rw-r--r--doc/src/snippets/code/doc_src_porting4-designer.qdoc140
-rw-r--r--doc/src/snippets/code/doc_src_porting4.cpp (renamed from doc/src/snippets/code/doc_src_porting4.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_properties.cpp (renamed from doc/src/snippets/code/doc_src_properties.qdoc)1
-rw-r--r--doc/src/snippets/code/doc_src_q3asciidict.cpp (renamed from doc/src/snippets/code/doc_src_q3asciidict.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_q3dict.cpp (renamed from doc/src/snippets/code/doc_src_q3dict.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_q3intdict.cpp (renamed from doc/src/snippets/code/doc_src_q3intdict.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_q3memarray.cpp108
-rw-r--r--doc/src/snippets/code/doc_src_q3memarray.qdoc70
-rw-r--r--doc/src/snippets/code/doc_src_q3ptrdict.cpp (renamed from doc/src/snippets/code/doc_src_q3ptrdict.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_q3ptrlist.cpp (renamed from doc/src/snippets/code/doc_src_q3ptrlist.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_q3valuelist.cpp (renamed from doc/src/snippets/code/doc_src_q3valuelist.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_q3valuestack.cpp (renamed from doc/src/snippets/code/doc_src_q3valuestack.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_q3valuevector.cpp (renamed from doc/src/snippets/code/doc_src_q3valuevector.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qalgorithms.cpp (renamed from doc/src/snippets/code/doc_src_qalgorithms.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qaxcontainer.pro (renamed from doc/src/snippets/code/doc_src_qaxcontainer.qdoc)8
-rw-r--r--doc/src/snippets/code/doc_src_qaxserver.cpp218
-rw-r--r--doc/src/snippets/code/doc_src_qaxserver.pro64
-rw-r--r--doc/src/snippets/code/doc_src_qaxserver.qdoc206
-rw-r--r--doc/src/snippets/code/doc_src_qcache.cpp (renamed from doc/src/snippets/code/doc_src_qcache.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qdbusadaptors.cpp (renamed from doc/src/snippets/code/doc_src_qdbusadaptors.qdoc)152
-rw-r--r--doc/src/snippets/code/doc_src_qiterator.cpp (renamed from doc/src/snippets/code/doc_src_qiterator.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qmake-manual.cpp58
-rw-r--r--doc/src/snippets/code/doc_src_qmake-manual.pro (renamed from doc/src/snippets/code/doc_src_qmake-manual.qdoc)650
-rw-r--r--doc/src/snippets/code/doc_src_qnamespace.cpp59
-rw-r--r--doc/src/snippets/code/doc_src_qnamespace.qdoc21
-rw-r--r--doc/src/snippets/code/doc_src_qpair.cpp (renamed from doc/src/snippets/code/doc_src_qpair.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qplugin.cpp (renamed from doc/src/snippets/code/doc_src_qplugin.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qplugin.pro44
-rw-r--r--doc/src/snippets/code/doc_src_qset.cpp (renamed from doc/src/snippets/code/doc_src_qset.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qsignalspy.cpp (renamed from doc/src/snippets/code/doc_src_qsignalspy.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qt3support.cpp (renamed from doc/src/snippets/code/doc_src_qt3support.qdoc)5
-rw-r--r--doc/src/snippets/code/doc_src_qt3support.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qt3to4.cpp43
-rw-r--r--doc/src/snippets/code/doc_src_qt4-accessibility.cpp (renamed from doc/src/snippets/code/doc_src_qt4-accessibility.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qt4-arthur.cpp (renamed from doc/src/snippets/code/doc_src_qt4-arthur.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qt4-intro.cpp (renamed from doc/src/snippets/code/doc_src_qt4-intro.qdoc)35
-rw-r--r--doc/src/snippets/code/doc_src_qt4-intro.pro73
-rw-r--r--doc/src/snippets/code/doc_src_qt4-mainwindow.cpp (renamed from doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qt4-sql.cpp (renamed from doc/src/snippets/code/doc_src_qt4-sql.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qt4-styles.cpp (renamed from doc/src/snippets/code/doc_src_qt4-styles.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qt4-tulip.cpp (renamed from doc/src/snippets/code/doc_src_qt4-tulip.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qtcore.cpp (renamed from doc/src/snippets/code/doc_src_qtcore.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qtdbus.cpp (renamed from doc/src/snippets/code/doc_src_qtdbus.qdoc)5
-rw-r--r--doc/src/snippets/code/doc_src_qtdbus.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtdesigner.cpp (renamed from doc/src/snippets/code/doc_src_qtdesigner.qdoc)5
-rw-r--r--doc/src/snippets/code/doc_src_qtdesigner.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtestevent.cpp (renamed from doc/src/snippets/code/doc_src_qtestevent.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qtestlib.cpp88
-rw-r--r--doc/src/snippets/code/doc_src_qtestlib.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtestlib.qdoc55
-rw-r--r--doc/src/snippets/code/doc_src_qtgui.pro (renamed from doc/src/snippets/code/doc_src_qtgui.qdoc)4
-rw-r--r--doc/src/snippets/code/doc_src_qthelp.cpp63
-rw-r--r--doc/src/snippets/code/doc_src_qthelp.qdoc24
-rw-r--r--doc/src/snippets/code/doc_src_qtmultimedia.cpp (renamed from doc/src/snippets/code/doc_src_qtmultimedia.qdoc)5
-rw-r--r--doc/src/snippets/code/doc_src_qtmultimedia.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtnetwork.cpp (renamed from doc/src/snippets/code/doc_src_qtnetwork.qdoc)5
-rw-r--r--doc/src/snippets/code/doc_src_qtnetwork.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtopengl.cpp (renamed from doc/src/snippets/code/doc_src_qtopengl.qdoc)5
-rw-r--r--doc/src/snippets/code/doc_src_qtopengl.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtscript.cpp568
-rw-r--r--doc/src/snippets/code/doc_src_qtscript.js444
-rw-r--r--doc/src/snippets/code/doc_src_qtscript.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtscript.qdoc937
-rw-r--r--doc/src/snippets/code/doc_src_qtscriptextensions.js (renamed from doc/src/snippets/code/doc_src_qtscriptextensions.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_qtscripttools.cpp43
-rw-r--r--doc/src/snippets/code/doc_src_qtscripttools.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtsql.cpp (renamed from doc/src/snippets/code/doc_src_qtsql.qdoc)5
-rw-r--r--doc/src/snippets/code/doc_src_qtsql.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtsvg.cpp (renamed from doc/src/snippets/code/doc_src_qtsvg.qdoc)5
-rw-r--r--doc/src/snippets/code/doc_src_qtsvg.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qttest.cpp (renamed from doc/src/snippets/code/doc_src_qttest.qdoc)5
-rw-r--r--doc/src/snippets/code/doc_src_qttest.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtuiloader.cpp (renamed from doc/src/snippets/code/doc_src_qtuiloader.qdoc)5
-rw-r--r--doc/src/snippets/code/doc_src_qtuiloader.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtxml.cpp43
-rw-r--r--doc/src/snippets/code/doc_src_qtxml.pro43
-rw-r--r--doc/src/snippets/code/doc_src_qtxml.qdoc15
-rw-r--r--doc/src/snippets/code/doc_src_qtxmlpatterns.cpp44
-rw-r--r--doc/src/snippets/code/doc_src_qtxmlpatterns.pro44
-rw-r--r--doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc9
-rw-r--r--doc/src/snippets/code/doc_src_qvarlengtharray.cpp (renamed from doc/src/snippets/code/doc_src_qvarlengtharray.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_resources.cpp (renamed from doc/src/snippets/declarative/qml-intro/hello-world1.qml)21
-rw-r--r--doc/src/snippets/code/doc_src_resources.qdoc16
-rw-r--r--doc/src/snippets/code/doc_src_richtext.cpp85
-rw-r--r--doc/src/snippets/code/doc_src_richtext.qdoc47
-rw-r--r--doc/src/snippets/code/doc_src_sql-driver.cpp82
-rw-r--r--doc/src/snippets/code/doc_src_sql-driver.qdoc44
-rw-r--r--doc/src/snippets/code/doc_src_styles.cpp (renamed from doc/src/snippets/code/doc_src_styles.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_stylesheet.cpp140
-rw-r--r--doc/src/snippets/code/doc_src_stylesheet.qdoc103
-rw-r--r--doc/src/snippets/code/doc_src_unicode.cpp (renamed from doc/src/snippets/code/doc_src_unicode.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_unix-signal-handlers.cpp (renamed from doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc)0
-rw-r--r--doc/src/snippets/code/doc_src_wince-customization.cpp (renamed from doc/src/snippets/declarative/animation-signalhandler.qml)27
-rw-r--r--doc/src/snippets/code/doc_src_wince-customization.qdoc19
-rw-r--r--doc/src/snippets/code/src_corelib_global_qglobal.cpp24
-rw-r--r--doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp2
-rw-r--r--doc/src/snippets/code/src_gui_painting_qpen.cpp2
-rw-r--r--doc/src/snippets/declarative/Button.qml (renamed from doc/src/snippets/declarative/qml-intro/anchors2.qml)33
-rw-r--r--doc/src/snippets/declarative/animation-elements.qml66
-rw-r--r--doc/src/snippets/declarative/animation-groups.qml104
-rw-r--r--doc/src/snippets/declarative/animation-propertyvaluesource.qml51
-rw-r--r--doc/src/snippets/declarative/animation.qml226
-rw-r--r--doc/src/snippets/declarative/bestpractices/group.qml (renamed from doc/src/snippets/declarative/animation-easing.qml)37
-rw-r--r--doc/src/snippets/declarative/events.qml141
-rw-r--r--doc/src/snippets/declarative/focus/advancedFocus.qml2
-rw-r--r--doc/src/snippets/declarative/focus/basicwidget.qml2
-rw-r--r--doc/src/snippets/declarative/focus/focusscopewidget.qml4
-rw-r--r--doc/src/snippets/declarative/focus/myclickablewidget.qml2
-rw-r--r--doc/src/snippets/declarative/focus/myfocusscopewidget.qml6
-rw-r--r--doc/src/snippets/declarative/focus/mywidget.qml4
-rw-r--r--doc/src/snippets/declarative/focus/widget.qml2
-rw-r--r--doc/src/snippets/declarative/grid-spacing.qml (renamed from doc/src/snippets/declarative/grid/grid-spacing.qml)0
-rw-r--r--doc/src/snippets/declarative/grid/grid-items.qml58
-rw-r--r--doc/src/snippets/declarative/grid/grid-no-spacing.qml57
-rw-r--r--doc/src/snippets/declarative/imports/best-practices.qml (renamed from doc/src/snippets/code/doc_src_phonon.qdoc)20
-rw-r--r--doc/src/snippets/declarative/imports/chart.qml46
-rw-r--r--doc/src/snippets/declarative/imports/installed-module.qml47
-rw-r--r--doc/src/snippets/declarative/imports/merged-named-imports.qml (renamed from doc/src/snippets/code/doc.src.qtscripttools.qdoc)13
-rw-r--r--doc/src/snippets/declarative/imports/named-imports.qml (renamed from doc/src/snippets/declarative/qml-intro/hello-world4.qml)30
-rw-r--r--doc/src/snippets/declarative/imports/network-imports.qml47
-rw-r--r--doc/src/snippets/declarative/imports/qtquick-1.0.qml46
-rw-r--r--doc/src/snippets/declarative/imports/timeexample.qml46
-rw-r--r--doc/src/snippets/declarative/listview-decorations.qml (renamed from doc/src/snippets/declarative/qml-intro/transformations1.qml)87
-rw-r--r--doc/src/snippets/declarative/listview-sections.qml (renamed from doc/src/snippets/declarative/qml-intro/states1.qml)91
-rw-r--r--doc/src/snippets/declarative/listview.qml (renamed from doc/src/snippets/declarative/qml-intro/number-animation1.qml)53
-rw-r--r--doc/src/snippets/declarative/listview/listview-snippet.qml52
-rw-r--r--doc/src/snippets/declarative/models/views-models-delegates.qml (renamed from doc/src/snippets/declarative/animation-behavioral.qml)47
-rw-r--r--doc/src/snippets/declarative/models/visual-model-and-view.qml (renamed from doc/src/snippets/declarative/animation-transitions.qml)31
-rw-r--r--doc/src/snippets/declarative/mousearea/mousearea-snippet.qml55
-rw-r--r--doc/src/snippets/declarative/pics/qt.pngbin514 -> 2991 bytes
-rw-r--r--doc/src/snippets/declarative/properties.qml315
-rw-r--r--doc/src/snippets/declarative/qml-intro/anchors3.qml65
-rw-r--r--doc/src/snippets/declarative/qml-intro/hello-world2.qml56
-rw-r--r--doc/src/snippets/declarative/qml-intro/hello-world3.qml57
-rw-r--r--doc/src/snippets/declarative/qml-intro/images/qt-logo.svg104
-rw-r--r--doc/src/snippets/declarative/qml-intro/number-animation2.qml66
-rw-r--r--doc/src/snippets/declarative/qml-intro/rectangle.qml50
-rw-r--r--doc/src/snippets/declarative/qml-intro/sequential-animation1.qml65
-rw-r--r--doc/src/snippets/declarative/qml-intro/sequential-animation2.qml73
-rw-r--r--doc/src/snippets/declarative/reusablecomponents/Button.qml84
-rw-r--r--doc/src/snippets/declarative/reusablecomponents/application.qml (renamed from doc/src/snippets/declarative/qml-intro/anchors1.qml)17
-rw-r--r--doc/src/snippets/declarative/reusablecomponents/component.qml (renamed from doc/src/snippets/declarative/animation-standalone.qml)44
-rw-r--r--doc/src/snippets/declarative/reusablecomponents/focusbutton.qml (renamed from doc/src/snippets/declarative/qml-intro/sequential-animation3.qml)84
-rw-r--r--doc/src/snippets/declarative/reusablecomponents/qmldir4
-rw-r--r--doc/src/snippets/declarative/states.qml85
-rw-r--r--doc/src/snippets/declarative/texthandling.qml (renamed from doc/src/snippets/declarative/qml-intro/hello-world5.qml)52
-rw-r--r--doc/src/snippets/declarative/webview/webview.qml2
-rw-r--r--doc/src/snippets/qtreeview-dnd/dragdropmodel.h11
-rw-r--r--doc/src/snippets/qtscript/evaluation/main.cpp4
-rw-r--r--doc/src/snippets/qtscript/registeringobjects/main.cpp4
-rw-r--r--doc/src/snippets/qtscript/registeringvalues/main.cpp4
-rw-r--r--doc/src/snippets/textblock-fragments/xmlwriter.cpp5
-rw-r--r--doc/src/snippets/textdocument-frames/xmlwriter.cpp2
-rw-r--r--doc/src/snippets/textdocument-tables/xmlwriter.cpp2
212 files changed, 6718 insertions, 4172 deletions
diff --git a/doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc b/doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp
index 0c29b1c..0c29b1c 100644
--- a/doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc
+++ b/doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp
diff --git a/doc/src/snippets/code/doc_src_appicon.pro b/doc/src/snippets/code/doc_src_appicon.pro
new file mode 100644
index 0000000..176b458
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_appicon.pro
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+RC_FILE = myapp.rc
+#! [1]
+
+
+#! [2]
+ICON = myapp.icns
+#! [2]
+
+
+#! [5]
+ICON = myapp.svg
+#! [5]
diff --git a/doc/src/snippets/code/doc_src_appicon.qdoc b/doc/src/snippets/code/doc_src_appicon.qdoc
index 06bf861..8dd30a4 100644
--- a/doc/src/snippets/code/doc_src_appicon.qdoc
+++ b/doc/src/snippets/code/doc_src_appicon.qdoc
@@ -43,16 +43,6 @@ IDI_ICON1 ICON DISCARDABLE "myappico.ico"
//! [0]
-//! [1]
-RC_FILE = myapp.rc
-//! [1]
-
-
-//! [2]
-ICON = myapp.icns
-//! [2]
-
-
//! [3]
kde-config --path icon
//! [3]
@@ -61,7 +51,3 @@ kde-config --path icon
//! [4]
gnome-config --datadir
//! [4]
-
-//! [5]
-ICON = myapp.svg
-//! [5]
diff --git a/doc/src/snippets/code/doc_src_containers.qdoc b/doc/src/snippets/code/doc_src_containers.cpp
index fa300f9..fa300f9 100644
--- a/doc/src/snippets/code/doc_src_containers.qdoc
+++ b/doc/src/snippets/code/doc_src_containers.cpp
diff --git a/doc/src/snippets/code/doc_src_coordsys.qdoc b/doc/src/snippets/code/doc_src_coordsys.cpp
index 1ebb215..1ebb215 100644
--- a/doc/src/snippets/code/doc_src_coordsys.qdoc
+++ b/doc/src/snippets/code/doc_src_coordsys.cpp
diff --git a/doc/src/snippets/code/doc_src_debug.qdoc b/doc/src/snippets/code/doc_src_debug.cpp
index 40a5ac2..40a5ac2 100644
--- a/doc/src/snippets/code/doc_src_debug.qdoc
+++ b/doc/src/snippets/code/doc_src_debug.cpp
diff --git a/doc/src/snippets/code/doc_src_deployment.cpp b/doc/src/snippets/code/doc_src_deployment.cpp
new file mode 100644
index 0000000..e7f7511
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_deployment.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [9]
+qApp->addLibraryPath("/some/other/path");
+//! [9]
+
+
+//! [19]
+qApp->addLibraryPath("C:\some\other\path");
+//! [19]
+
+
+//! [49]
+QDir dir(QApplication::applicationDirPath());
+dir.cdUp();
+dir.cd("plugins");
+QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
+//! [49]
diff --git a/doc/src/snippets/code/doc_src_deployment.pro b/doc/src/snippets/code/doc_src_deployment.pro
new file mode 100644
index 0000000..b9fdd54
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_deployment.pro
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+#! [8]
+DESTDIR = /path/to/Qt/plugandpaint/plugins
+#! [8]
+
+
+#! [21]
+CONFIG += embed_manifest_exe
+#! [21]
+
+
+#! [23]
+CONFIG-=embed_manifest_dll
+#! [23]
+
+
+#! [26]
+CONFIG-=app_bundle
+#! [26]
+
+
+#! [51]
+QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.3
+#! [51]
+
+#! [53]
+QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk
+CONFIG+=x86 ppc
+#! [53]
+
+#! [56]
+vendorinfo = \
+ "%{\"Example Localized Vendor\"}" \
+ ":\"Example Vendor\""
+
+my_deployment.pkg_prerules = vendorinfo
+DEPLOYMENT += my_deployment
+#! [56]
+
+#! [57]
+supported_platforms = \
+ "; This demo only supports S60 5.0" \
+ "[0x1028315F],0,0,0,{\"S60ProductID\"}"
+
+default_deployment.pkg_prerules -= pkg_platform_dependencies
+my_deployment.pkg_prerules += supported_platforms
+DEPLOYMENT += my_deployment
+#! [57]
diff --git a/doc/src/snippets/code/doc_src_deployment.qdoc b/doc/src/snippets/code/doc_src_deployment.qdoc
index c5f4644..760bd8f 100644
--- a/doc/src/snippets/code/doc_src_deployment.qdoc
+++ b/doc/src/snippets/code/doc_src_deployment.qdoc
@@ -96,20 +96,10 @@ dirname=$PWD/$dirname
fi
LD_LIBRARY_PATH=$dirname
export LD_LIBRARY_PATH
-$dirname/$appname $*
+$dirname/$appname "$@"
//! [7]
-//! [8]
-DESTDIR = /path/to/Qt/plugandpaint/plugins
-//! [8]
-
-
-//! [9]
-qApp->addLibraryPath("/some/other/path");
-//! [9]
-
-
//! [10]
ldd ./application
//! [10]
@@ -164,11 +154,6 @@ plugins\pnp_extrafilters.dll
//! [18]
-//! [19]
-qApp->addLibraryPath("C:\some\other\path");
-//! [19]
-
-
//! [20]
embed_manifest_dll
embed_manifest_exe
@@ -411,14 +396,6 @@ install_name_tool -change /path/to/Qt/lib/QtCore.framework/Versions/4.0/QtCore
//! [48]
-//! [49]
-QDir dir(QApplication::applicationDirPath());
-dir.cdUp();
-dir.cd("plugins");
-QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
-//! [49]
-
-
//! [50]
otool -L MyApp.app/Contents/MacOS/MyApp
//! [50]
@@ -483,4 +460,4 @@ make release-gcce
//! [59]
make installer_sis
-//! [59] \ No newline at end of file
+//! [59]
diff --git a/doc/src/snippets/code/doc_src_designer-manual.qdoc b/doc/src/snippets/code/doc_src_designer-manual.cpp
index 90e34a4..a261818 100644
--- a/doc/src/snippets/code/doc_src_designer-manual.qdoc
+++ b/doc/src/snippets/code/doc_src_designer-manual.cpp
@@ -38,11 +38,6 @@
**
****************************************************************************/
-//! [0]
-CONFIG += uitools
-//! [0]
-
-
//! [1]
#include <QtUiTools>
//! [1]
@@ -53,27 +48,6 @@ void on_<object name>_<signal name>(<signal parameters>);
//! [2]
-//! [3]
-CONFIG += release
-//! [3]
-
-
-//! [4]
-target.path = $$[QT_INSTALL_PLUGINS]/designer
-INSTALLS += target
-//! [4]
-
-
-//! [5]
-QT += script
-//! [5]
-
-
-//! [6]
-widget.text = 'Hi - I was built ' + new Date().toString();
-//! [6]
-
-
//! [7]
class MyExtension: public QObject,
public QdesignerContainerExtension
diff --git a/doc/src/snippets/code/doc_src_designer-manual.js b/doc/src/snippets/code/doc_src_designer-manual.js
new file mode 100644
index 0000000..074b47e
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_designer-manual.js
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [6]
+widget.text = 'Hi - I was built ' + new Date().toString();
+//! [6]
diff --git a/doc/src/snippets/code/doc_src_designer-manual.pro b/doc/src/snippets/code/doc_src_designer-manual.pro
new file mode 100644
index 0000000..4b14a14
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_designer-manual.pro
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+CONFIG += uitools
+#! [0]
+
+
+#! [3]
+CONFIG += release
+#! [3]
+
+
+#! [4]
+target.path = $$[QT_INSTALL_PLUGINS]/designer
+INSTALLS += target
+#! [4]
+
+
+#! [5]
+QT += script
+#! [5]
diff --git a/doc/src/snippets/code/doc_src_dnd.qdoc b/doc/src/snippets/code/doc_src_dnd.cpp
index d5dc721..d5dc721 100644
--- a/doc/src/snippets/code/doc_src_dnd.qdoc
+++ b/doc/src/snippets/code/doc_src_dnd.cpp
diff --git a/doc/src/snippets/code/doc_src_emb-performance.cpp b/doc/src/snippets/code/doc_src_emb-performance.cpp
new file mode 100644
index 0000000..5a465a9
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_emb-performance.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+void *operator new[](size_t size)
+{
+ return malloc(size);
+}
+
+void *operator new(size_t size)
+{
+ return malloc(size);
+}
+
+void operator delete[](void *ptr)
+{
+ free(ptr);
+}
+
+void operator delete[](void *ptr, size_t)
+{
+ free(ptr);
+}
+
+void operator delete(void *ptr)
+{
+ free(ptr);
+}
+
+void operator delete(void *ptr, size_t)
+{
+ free(ptr);
+}
+//! [1]
diff --git a/doc/src/snippets/code/doc_src_emb-performance.qdoc b/doc/src/snippets/code/doc_src_emb-performance.qdoc
index 8c129fd..9abf8d1 100644
--- a/doc/src/snippets/code/doc_src_emb-performance.qdoc
+++ b/doc/src/snippets/code/doc_src_emb-performance.qdoc
@@ -41,36 +41,3 @@
//! [0]
./configure -static
//! [0]
-
-
-//! [1]
-void *operator new[](size_t size)
-{
- return malloc(size);
-}
-
-void *operator new(size_t size)
-{
- return malloc(size);
-}
-
-void operator delete[](void *ptr)
-{
- free(ptr);
-}
-
-void operator delete[](void *ptr, size_t)
-{
- free(ptr);
-}
-
-void operator delete(void *ptr)
-{
- free(ptr);
-}
-
-void operator delete(void *ptr, size_t)
-{
- free(ptr);
-}
-//! [1]
diff --git a/doc/src/snippets/code/doc_src_emb-pointer.pro b/doc/src/snippets/code/doc_src_emb-pointer.pro
new file mode 100644
index 0000000..fed7d79
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_emb-pointer.pro
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+#! [7]
+....
+QMAKE_CFLAGS += -I<path to tslib headers>
+QMAKE_LFLAGS += -L<path to tslib library> -Wl,-rpath-link=<path to tslib library>
+....
+#! [7]
diff --git a/doc/src/snippets/code/doc_src_emb-pointer.qdoc b/doc/src/snippets/code/doc_src_emb-pointer.qdoc
index 4ec1335..1fb6d8f 100644
--- a/doc/src/snippets/code/doc_src_emb-pointer.qdoc
+++ b/doc/src/snippets/code/doc_src_emb-pointer.qdoc
@@ -75,14 +75,6 @@ export QWS_MOUSE_PROTO="Vr41xx:press=500:/dev/misc/ts"
//! [6]
-//! [7]
-....
-QMAKE_CFLAGS += -I<path to tslib headers>
-QMAKE_LFLAGS += -L<path to tslib library> -Wl,-rpath-link=<path to tslib library>
-....
-//! [7]
-
-
//! [8]
module_raw input
module linear
@@ -111,5 +103,3 @@ ls -l /dev/input/mouse0
//! [12]
chmod a+rw /dev/input/mouse0
//! [12]
-
-
diff --git a/doc/src/snippets/code/doc_src_examples_arrowpad.cpp b/doc/src/snippets/code/doc_src_examples_arrowpad.cpp
new file mode 100644
index 0000000..c834b9f
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_examples_arrowpad.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+qApp->translate("ArrowPad", x)
+//! [0]
diff --git a/doc/src/snippets/code/doc_src_examples_arrowpad.qdoc b/doc/src/snippets/code/doc_src_examples_arrowpad.qdoc
index 933f419..ee3c367 100644
--- a/doc/src/snippets/code/doc_src_examples_arrowpad.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_arrowpad.qdoc
@@ -38,11 +38,6 @@
**
****************************************************************************/
-//! [0]
-qApp->translate("ArrowPad", x)
-//! [0]
-
-
//! [1]
lrelease arrowpad.pro
//! [1]
diff --git a/doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.qdoc b/doc/src/snippets/code/doc_src_examples_containerextension.pro
index 7fe0394..cd86693 100644
--- a/doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_containerextension.pro
@@ -38,7 +38,7 @@
**
****************************************************************************/
-//! [0]
+#! [0]
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
-//! [0]
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_examples_customwidgetplugin.qdoc b/doc/src/snippets/code/doc_src_examples_customwidgetplugin.pro
index 7fe0394..cd86693 100644
--- a/doc/src/snippets/code/doc_src_examples_customwidgetplugin.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_customwidgetplugin.pro
@@ -38,7 +38,7 @@
**
****************************************************************************/
-//! [0]
+#! [0]
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
-//! [0]
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc b/doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp
index a69a7bf..a69a7bf 100644
--- a/doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp
diff --git a/doc/src/snippets/code/doc_src_examples_icons.cpp b/doc/src/snippets/code/doc_src_examples_icons.cpp
new file mode 100644
index 0000000..411c49f
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_examples_icons.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+if (!condition)
+ qFatal("ASSERT: "condition" in file ...");
+//! [0]
diff --git a/doc/src/snippets/code/doc_src_examples_icons.qdoc b/doc/src/snippets/code/doc_src_examples_icons.qdoc
index 7684224..8ca5751 100644
--- a/doc/src/snippets/code/doc_src_examples_icons.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_icons.qdoc
@@ -38,12 +38,6 @@
**
****************************************************************************/
-//! [0]
-if (!condition)
- qFatal("ASSERT: "condition" in file ...");
-//! [0]
-
-
//! [1]
qmake "CONFIG += debug" icons.pro
//! [1]
diff --git a/doc/src/snippets/code/doc_src_examples_imageviewer.cpp b/doc/src/snippets/code/doc_src_examples_imageviewer.cpp
new file mode 100644
index 0000000..c86f8ac
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_examples_imageviewer.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+imageLabel->resize(imageLabel->pixmap()->size());
+//! [0]
+
+
+//! [1]
+if (!imageLabel->pixmap())
+ qFatal("ASSERT: "imageLabel->pixmap()" in file ...");
+//! [1]
+
+
+//! [4]
+scrollBar->setValue(int(factor * scrollBar->value()));
+//! [4]
diff --git a/doc/src/snippets/code/doc_src_examples_imageviewer.qdoc b/doc/src/snippets/code/doc_src_examples_imageviewer.qdoc
index 84f822f..1870385 100644
--- a/doc/src/snippets/code/doc_src_examples_imageviewer.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_imageviewer.qdoc
@@ -38,17 +38,6 @@
**
****************************************************************************/
-//! [0]
-imageLabel->resize(imageLabel->pixmap()->size());
-//! [0]
-
-
-//! [1]
-if (!imageLabel->pixmap())
- qFatal("ASSERT: "imageLabel->pixmap()" in file ...");
-//! [1]
-
-
//! [2]
qmake "CONFIG += debug" foo.pro
//! [2]
@@ -57,8 +46,3 @@ qmake "CONFIG += debug" foo.pro
//! [3]
qmake "CONFIG += release" foo.pro
//! [3]
-
-
-//! [4]
-scrollBar->setValue(int(factor * scrollBar->value()));
-//! [4]
diff --git a/doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc b/doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp
index b62236c..b62236c 100644
--- a/doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp
diff --git a/doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc b/doc/src/snippets/code/doc_src_examples_simpledommodel.cpp
index 1abcdc2..1abcdc2 100644
--- a/doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_simpledommodel.cpp
diff --git a/doc/src/snippets/code/doc_src_examples_taskmenuextension.qdoc b/doc/src/snippets/code/doc_src_examples_taskmenuextension.pro
index 7fe0394..cd86693 100644
--- a/doc/src/snippets/code/doc_src_examples_taskmenuextension.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_taskmenuextension.pro
@@ -38,7 +38,7 @@
**
****************************************************************************/
-//! [0]
+#! [0]
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
-//! [0]
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_examples_textfinder.qdoc b/doc/src/snippets/code/doc_src_examples_textfinder.pro
index d99f8ce..cdc2366 100644
--- a/doc/src/snippets/code/doc_src_examples_textfinder.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_textfinder.pro
@@ -38,9 +38,9 @@
**
****************************************************************************/
-//! [0]
+#! [0]
CONFIG += uitools
HEADERS = textfinder.h
RESOURCES = textfinder.qrc
SOURCES = textfinder.cpp main.cpp
-//! [0]
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_examples_trollprint.qdoc b/doc/src/snippets/code/doc_src_examples_trollprint.cpp
index 4b508e9..f7b8f48 100644
--- a/doc/src/snippets/code/doc_src_examples_trollprint.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_trollprint.cpp
@@ -59,6 +59,7 @@ colorsDisabledRadio = new QRadioButton(tr("Disabled", "colors"), colors);
belonging to MainWindow.
...
+*/
//! [2]
@@ -72,4 +73,5 @@ colorsDisabledRadio = new QRadioButton(tr("Disabled", "colors"), colors);
checkbox and then click the Start Processing button. You should
now see a pop up window with the text "Error: Name too long!".
This window is a ZClientErrorDialog.
+*/
//! [3]
diff --git a/doc/src/snippets/code/doc_src_examples_containerextension.qdoc b/doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.pro
index 7fe0394..cd86693 100644
--- a/doc/src/snippets/code/doc_src_examples_containerextension.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.pro
@@ -38,7 +38,7 @@
**
****************************************************************************/
-//! [0]
+#! [0]
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
-//! [0]
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_graphicsview.qdoc b/doc/src/snippets/code/doc_src_graphicsview.cpp
index 00ebab3..00ebab3 100644
--- a/doc/src/snippets/code/doc_src_graphicsview.qdoc
+++ b/doc/src/snippets/code/doc_src_graphicsview.cpp
diff --git a/doc/src/snippets/code/doc_src_groups.qdoc b/doc/src/snippets/code/doc_src_groups.cpp
index 2d5fd97..2d5fd97 100644
--- a/doc/src/snippets/code/doc_src_groups.qdoc
+++ b/doc/src/snippets/code/doc_src_groups.cpp
diff --git a/doc/src/snippets/code/doc_src_i18n.cpp b/doc/src/snippets/code/doc_src_i18n.cpp
new file mode 100644
index 0000000..cc85bd8
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_i18n.cpp
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+LoginWidget::LoginWidget()
+{
+ QLabel *label = new QLabel(tr("Password:"));
+ ...
+}
+//! [0]
+
+
+//! [1]
+void some_global_function(LoginWidget *logwid)
+{
+ QLabel *label = new QLabel(
+ LoginWidget::tr("Password:"), logwid);
+}
+
+void same_global_function(LoginWidget *logwid)
+{
+ QLabel *label = new QLabel(
+ qApp->translate("LoginWidget", "Password:"), logwid);
+}
+//! [1]
+
+
+//! [2]
+QString FriendlyConversation::greeting(int type)
+{
+ static const char *greeting_strings[] = {
+ QT_TR_NOOP("Hello"),
+ QT_TR_NOOP("Goodbye")
+ };
+ return tr(greeting_strings[type]);
+}
+//! [2]
+
+
+//! [3]
+static const char *greeting_strings[] = {
+ QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"),
+ QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye")
+};
+
+QString FriendlyConversation::greeting(int type)
+{
+ return tr(greeting_strings[type]);
+}
+
+QString global_greeting(int type)
+{
+ return qApp->translate("FriendlyConversation",
+ greeting_strings[type]);
+}
+//! [3]
+
+
+//! [4]
+void FileCopier::showProgress(int done, int total,
+ const QString &currentFile)
+{
+ label.setText(tr("%1 of %2 files copied.\nCopying: %3")
+ .arg(done)
+ .arg(total)
+ .arg(currentFile));
+}
+//! [4]
+
+
+//! [5]
+QString s1 = "%1 of %2 files copied. Copying: %3";
+QString s2 = "Kopierer nu %3. Av totalt %2 filer er %1 kopiert.";
+
+qDebug() << s1.arg(5).arg(10).arg("somefile.txt");
+qDebug() << s2.arg(5).arg(10).arg("somefile.txt");
+//! [5]
+
+
+//! [8]
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QTranslator qtTranslator;
+ qtTranslator.load("qt_" + QLocale::system().name(),
+ QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+ app.installTranslator(&qtTranslator);
+
+ QTranslator myappTranslator;
+ myappTranslator.load("myapp_" + QLocale::system().name());
+ app.installTranslator(&myappTranslator);
+
+ ...
+ return app.exec();
+}
+//! [8]
+
+
+//! [9]
+QString string = ...; // some Unicode text
+
+QTextCodec *codec = QTextCodec::codecForName("ISO 8859-5");
+QByteArray encodedString = codec->fromUnicode(string);
+//! [9]
+
+
+//! [10]
+QByteArray encodedString = ...; // some ISO 8859-5 encoded text
+
+QTextCodec *codec = QTextCodec::codecForName("ISO 8859-5");
+QString string = codec->toUnicode(encodedString);
+//! [10]
+
+
+//! [11]
+void Clock::setTime(const QTime &time)
+{
+ if (tr("AMPM") == "AMPM") {
+ // 12-hour clock
+ } else {
+ // 24-hour clock
+ }
+}
+//! [11]
+
+
+//! [12]
+void MyWidget::changeEvent(QEvent *event)
+{
+ if (e->type() == QEvent::LanguageChange) {
+ titleLabel->setText(tr("Document Title"));
+ ...
+ okPushButton->setText(tr("&OK"));
+ } else
+ QWidget::changeEvent(event);
+}
+//! [12]
diff --git a/doc/src/snippets/code/doc_src_i18n.qdoc b/doc/src/snippets/code/doc_src_i18n.qdoc
index f54ce37..f8f8f02 100644
--- a/doc/src/snippets/code/doc_src_i18n.qdoc
+++ b/doc/src/snippets/code/doc_src_i18n.qdoc
@@ -38,82 +38,6 @@
**
****************************************************************************/
-//! [0]
-LoginWidget::LoginWidget()
-{
- QLabel *label = new QLabel(tr("Password:"));
- ...
-}
-//! [0]
-
-
-//! [1]
-void some_global_function(LoginWidget *logwid)
-{
- QLabel *label = new QLabel(
- LoginWidget::tr("Password:"), logwid);
-}
-
-void same_global_function(LoginWidget *logwid)
-{
- QLabel *label = new QLabel(
- qApp->translate("LoginWidget", "Password:"), logwid);
-}
-//! [1]
-
-
-//! [2]
-QString FriendlyConversation::greeting(int type)
-{
- static const char *greeting_strings[] = {
- QT_TR_NOOP("Hello"),
- QT_TR_NOOP("Goodbye")
- };
- return tr(greeting_strings[type]);
-}
-//! [2]
-
-
-//! [3]
-static const char *greeting_strings[] = {
- QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"),
- QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye")
-};
-
-QString FriendlyConversation::greeting(int type)
-{
- return tr(greeting_strings[type]);
-}
-
-QString global_greeting(int type)
-{
- return qApp->translate("FriendlyConversation",
- greeting_strings[type]);
-}
-//! [3]
-
-
-//! [4]
-void FileCopier::showProgress(int done, int total,
- const QString &currentFile)
-{
- label.setText(tr("%1 of %2 files copied.\nCopying: %3")
- .arg(done)
- .arg(total)
- .arg(currentFile));
-}
-//! [4]
-
-
-//! [5]
-QString s1 = "%1 of %2 files copied. Copying: %3";
-QString s2 = "Kopierer nu %3. Av totalt %2 filer er %1 kopiert.";
-
-qDebug() << s1.arg(5).arg(10).arg("somefile.txt");
-qDebug() << s2.arg(5).arg(10).arg("somefile.txt");
-//! [5]
-
-
//! [6]
5 of 10 files copied. Copying: somefile.txt
Kopierer nu somefile.txt. Av totalt 10 filer er 5 kopiert.
@@ -132,64 +56,3 @@ TRANSLATIONS = superapp_dk.ts \
superapp_no.ts \
superapp_se.ts
//! [7]
-
-
-//! [8]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QTranslator qtTranslator;
- qtTranslator.load("qt_" + QLocale::system().name(),
- QLibraryInfo::location(QLibraryInfo::TranslationsPath));
- app.installTranslator(&qtTranslator);
-
- QTranslator myappTranslator;
- myappTranslator.load("myapp_" + QLocale::system().name());
- app.installTranslator(&myappTranslator);
-
- ...
- return app.exec();
-}
-//! [8]
-
-
-//! [9]
-QString string = ...; // some Unicode text
-
-QTextCodec *codec = QTextCodec::codecForName("ISO 8859-5");
-QByteArray encodedString = codec->fromUnicode(string);
-//! [9]
-
-
-//! [10]
-QByteArray encodedString = ...; // some ISO 8859-5 encoded text
-
-QTextCodec *codec = QTextCodec::codecForName("ISO 8859-5");
-QString string = codec->toUnicode(encodedString);
-//! [10]
-
-
-//! [11]
-void Clock::setTime(const QTime &time)
-{
- if (tr("AMPM") == "AMPM") {
- // 12-hour clock
- } else {
- // 24-hour clock
- }
-}
-//! [11]
-
-
-//! [12]
-void MyWidget::changeEvent(QEvent *event)
-{
- if (e->type() == QEvent::LanguageChange) {
- titleLabel->setText(tr("Document Title"));
- ...
- okPushButton->setText(tr("&OK"));
- } else
- QWidget::changeEvent(event);
-}
-//! [12]
diff --git a/doc/src/snippets/code/doc_src_layout.qdoc b/doc/src/snippets/code/doc_src_layout.cpp
index 47db36b..47db36b 100644
--- a/doc/src/snippets/code/doc_src_layout.qdoc
+++ b/doc/src/snippets/code/doc_src_layout.cpp
diff --git a/doc/src/snippets/code/doc_src_linguist-manual.cpp b/doc/src/snippets/code/doc_src_linguist-manual.cpp
new file mode 100644
index 0000000..7cb5b1e
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_linguist-manual.cpp
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [3]
+label->setText(tr("F\374r \310lise"));
+//! [3]
+
+
+void wrapInFunction()
+{
+//! [6]
+button = new QPushButton("&Quit", this);
+//! [6]
+
+
+//! [7]
+button = new QPushButton(tr("&Quit"), this);
+//! [7]
+
+
+//! [8]
+QPushButton::tr("&Quit")
+//! [8]
+
+
+//! [9]
+QObject::tr("&Quit")
+//! [9]
+
+
+//! [10]
+rbc = new QRadioButton(tr("Enabled", "Color frame"), this);
+//! [10]
+
+
+//! [11]
+rbh = new QRadioButton(tr("Enabled", "Hue frame"), this);
+//! [11]
+}
+
+
+//! [12]
+/*
+ TRANSLATOR FindDialog
+
+ Choose Edit|Find from the menu bar or press Ctrl+F to pop up the
+ Find dialog.
+
+ ...
+*/
+//! [12]
+
+//! [13]
+/*
+ TRANSLATOR MyNamespace::MyClass
+
+ Necessary for lupdate.
+
+ ...
+*/
+//! [13]
+
+//! [14]
+void some_global_function(LoginWidget *logwid)
+{
+ QLabel *label = new QLabel(
+ LoginWidget::tr("Password:"), logwid);
+}
+
+void same_global_function(LoginWidget *logwid)
+{
+ QLabel *label = new QLabel(
+ qApp->translate("LoginWidget", "Password:"),
+ logwid);
+}
+//! [14]
+
+
+//! [15]
+QString FriendlyConversation::greeting(int greet_type)
+{
+ static const char* greeting_strings[] = {
+ QT_TR_NOOP("Hello"),
+ QT_TR_NOOP("Goodbye")
+ };
+ return tr(greeting_strings[greet_type]);
+}
+//! [15]
+
+
+//! [16]
+static const char* greeting_strings[] = {
+ QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"),
+ QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye")
+};
+
+QString FriendlyConversation::greeting(int greet_type)
+{
+ return tr(greeting_strings[greet_type]);
+}
+
+QString global_greeting(int greet_type)
+{
+ return qApp->translate("FriendlyConversation",
+ greeting_strings[greet_type]);
+}
+//! [16]
+
+void wrapInFunction()
+{
+
+//! [17]
+QString tr(const char *text, const char *comment, int n);
+//! [17]
+
+//! [18]
+tr("%n item(s) replaced", "", count);
+//! [18]
+
+}
diff --git a/doc/src/snippets/code/doc_src_linguist-manual.pro b/doc/src/snippets/code/doc_src_linguist-manual.pro
new file mode 100644
index 0000000..3b19ba7
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_linguist-manual.pro
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+HEADERS = main-dlg.h \
+ options-dlg.h
+SOURCES = main-dlg.cpp \
+ options-dlg.cpp \
+ main.cpp
+FORMS = search-dlg.ui
+TRANSLATIONS = superapp_dk.ts \
+ superapp_fi.ts \
+ superapp_no.ts \
+ superapp_se.ts
+#! [0]
+
+
+#! [1]
+CODECFORTR = ISO-8859-5
+#! [1]
+
+
+#! [2]
+CODECFORSRC = UTF-8
+#! [2]
diff --git a/doc/src/snippets/code/doc_src_linguist-manual.qdoc b/doc/src/snippets/code/doc_src_linguist-manual.qdoc
index 5975c9a..34b5dcc 100644
--- a/doc/src/snippets/code/doc_src_linguist-manual.qdoc
+++ b/doc/src/snippets/code/doc_src_linguist-manual.qdoc
@@ -38,35 +38,6 @@
**
****************************************************************************/
-//! [0]
-HEADERS = main-dlg.h \
- options-dlg.h
-SOURCES = main-dlg.cpp \
- options-dlg.cpp \
- main.cpp
-FORMS = search-dlg.ui
-TRANSLATIONS = superapp_dk.ts \
- superapp_fi.ts \
- superapp_no.ts \
- superapp_se.ts
-//! [0]
-
-
-//! [1]
-CODECFORTR = ISO-8859-5
-//! [1]
-
-
-//! [2]
-CODECFORSRC = UTF-8
-//! [2]
-
-
-//! [3]
-label->setText(tr("F\374r \310lise"));
-//! [3]
-
-
//! [4]
Usage:
lupdate [options] [project-file]
@@ -116,118 +87,3 @@ Options:
-version
Display the version of lrelease and exit
//! [5]
-
-
-void wrapInFunction()
-{
-//! [6]
-button = new QPushButton("&Quit", this);
-//! [6]
-
-
-//! [7]
-button = new QPushButton(tr("&Quit"), this);
-//! [7]
-
-
-//! [8]
-QPushButton::tr("&Quit")
-//! [8]
-
-
-//! [9]
-QObject::tr("&Quit")
-//! [9]
-
-
-//! [10]
-rbc = new QRadioButton(tr("Enabled", "Color frame"), this);
-//! [10]
-
-
-//! [11]
-rbh = new QRadioButton(tr("Enabled", "Hue frame"), this);
-//! [11]
-}
-
-
-//! [12]
-/*
- TRANSLATOR FindDialog
-
- Choose Edit|Find from the menu bar or press Ctrl+F to pop up the
- Find dialog.
-
- ...
-*/
-//! [12]
-
-//! [13]
-/*
- TRANSLATOR MyNamespace::MyClass
-
- Necessary for lupdate.
-
- ...
-*/
-//! [13]
-
-//! [14]
-void some_global_function(LoginWidget *logwid)
-{
- QLabel *label = new QLabel(
- LoginWidget::tr("Password:"), logwid);
-}
-
-void same_global_function(LoginWidget *logwid)
-{
- QLabel *label = new QLabel(
- qApp->translate("LoginWidget", "Password:"),
- logwid);
-}
-//! [14]
-
-
-//! [15]
-QString FriendlyConversation::greeting(int greet_type)
-{
- static const char* greeting_strings[] = {
- QT_TR_NOOP("Hello"),
- QT_TR_NOOP("Goodbye")
- };
- return tr(greeting_strings[greet_type]);
-}
-//! [15]
-
-
-//! [16]
-static const char* greeting_strings[] = {
- QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"),
- QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye")
-};
-
-QString FriendlyConversation::greeting(int greet_type)
-{
- return tr(greeting_strings[greet_type]);
-}
-
-QString global_greeting(int greet_type)
-{
- return qApp->translate("FriendlyConversation",
- greeting_strings[greet_type]);
-}
-//! [16]
-
-void wrapInFunction()
-{
-
-//! [17]
-QString tr(const char *text, const char *comment, int n);
-//! [17]
-
-//! [18]
-tr("%n item(s) replaced", "", count);
-//! [18]
-
-}
-
diff --git a/doc/src/snippets/code/doc_src_mac-differences.cpp b/doc/src/snippets/code/doc_src_mac-differences.cpp
new file mode 100644
index 0000000..f261083
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_mac-differences.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+#ifdef Q_WS_MAC
+ CFURLRef appUrlRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
+ CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef,
+ kCFURLPOSIXPathStyle);
+ const char *pathPtr = CFStringGetCStringPtr(macPath,
+ CFStringGetSystemEncoding());
+ qDebug("Path = %s", pathPtr);
+ CFRelease(appUrlRef);
+ CFRelease(macPath);
+#endif
+//! [1]
diff --git a/doc/src/snippets/code/doc_src_mac-differences.pro b/doc/src/snippets/code/doc_src_mac-differences.pro
new file mode 100644
index 0000000..3490bfe
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_mac-differences.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Frameworks/
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_moc.cpp b/doc/src/snippets/code/doc_src_moc.cpp
new file mode 100644
index 0000000..ec756e1
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_moc.cpp
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [3]
+#include "foo.moc"
+//! [3]
+
+
+//! [4]
+#ifndef Q_MOC_RUN
+ ...
+#endif
+//! [4]
+
+
+//! [5]
+class SomeTemplate<int> : public QFrame
+{
+ Q_OBJECT
+ ...
+
+signals:
+ void mySignal(int);
+};
+//! [5]
+
+
+//! [6]
+// correct
+class SomeClass : public QObject, public OtherClass
+{
+ ...
+};
+//! [6]
+
+
+//! [7]
+class SomeClass : public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void apply(void (*apply)(List *, void *), char *); // WRONG
+};
+//! [7]
+
+
+//! [8]
+typedef void (*ApplyFunction)(List *, void *);
+
+class SomeClass : public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void apply(ApplyFunction, char *);
+};
+//! [8]
+
+
+//! [9]
+class MyClass : public QObject
+{
+ Q_OBJECT
+
+ enum Error {
+ ConnectionRefused,
+ RemoteHostClosed,
+ UnknownError
+ };
+
+signals:
+ void stateChanged(MyClass::Error error);
+};
+//! [9]
+
+
+//! [10]
+#ifdef ultrix
+#define SIGNEDNESS(a) unsigned a
+#else
+#define SIGNEDNESS(a) a
+#endif
+
+class Whatever : public QObject
+{
+ Q_OBJECT
+
+signals:
+ void someSignal(SIGNEDNESS(int));
+};
+//! [10]
+
+
+//! [11]
+class A
+{
+public:
+ class B
+ {
+ Q_OBJECT
+
+ public slots: // WRONG
+ void b();
+ };
+};
+//! [11]
diff --git a/doc/src/snippets/code/doc_src_moc.qdoc b/doc/src/snippets/code/doc_src_moc.qdoc
index ef85b1b..74ab365 100644
--- a/doc/src/snippets/code/doc_src_moc.qdoc
+++ b/doc/src/snippets/code/doc_src_moc.qdoc
@@ -56,109 +56,3 @@ foo.o: foo.moc
foo.moc: foo.cpp
moc $(DEFINES) $(INCPATH) -i $< -o $@
//! [2]
-
-
-//! [3]
-#include "foo.moc"
-//! [3]
-
-
-//! [4]
-#ifndef Q_MOC_RUN
- ...
-#endif
-//! [4]
-
-
-//! [5]
-class SomeTemplate<int> : public QFrame
-{
- Q_OBJECT
- ...
-
-signals:
- void mySignal(int);
-};
-//! [5]
-
-
-//! [6]
-// correct
-class SomeClass : public QObject, public OtherClass
-{
- ...
-};
-//! [6]
-
-
-//! [7]
-class SomeClass : public QObject
-{
- Q_OBJECT
-
-public slots:
- void apply(void (*apply)(List *, void *), char *); // WRONG
-};
-//! [7]
-
-
-//! [8]
-typedef void (*ApplyFunction)(List *, void *);
-
-class SomeClass : public QObject
-{
- Q_OBJECT
-
-public slots:
- void apply(ApplyFunction, char *);
-};
-//! [8]
-
-
-//! [9]
-class MyClass : public QObject
-{
- Q_OBJECT
-
- enum Error {
- ConnectionRefused,
- RemoteHostClosed,
- UnknownError
- };
-
-signals:
- void stateChanged(MyClass::Error error);
-};
-//! [9]
-
-
-//! [10]
-#ifdef ultrix
-#define SIGNEDNESS(a) unsigned a
-#else
-#define SIGNEDNESS(a) a
-#endif
-
-class Whatever : public QObject
-{
- Q_OBJECT
-
-signals:
- void someSignal(SIGNEDNESS(int));
-};
-//! [10]
-
-
-//! [11]
-class A
-{
-public:
- class B
- {
- Q_OBJECT
-
- public slots: // WRONG
- void b();
- };
-};
-//! [11]
diff --git a/doc/src/snippets/code/doc_src_model-view-programming.qdoc b/doc/src/snippets/code/doc_src_model-view-programming.cpp
index 05c2e1d..05c2e1d 100644
--- a/doc/src/snippets/code/doc_src_model-view-programming.qdoc
+++ b/doc/src/snippets/code/doc_src_model-view-programming.cpp
diff --git a/doc/src/snippets/code/doc_src_modules.qdoc b/doc/src/snippets/code/doc_src_modules.pro
index 643a94d..5871540 100644
--- a/doc/src/snippets/code/doc_src_modules.qdoc
+++ b/doc/src/snippets/code/doc_src_modules.pro
@@ -38,6 +38,6 @@
**
****************************************************************************/
-//! [0]
+#! [0]
QT -= gui
-//! [0]
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_objecttrees.qdoc b/doc/src/snippets/code/doc_src_objecttrees.cpp
index cd92a49..cd92a49 100644
--- a/doc/src/snippets/code/doc_src_objecttrees.qdoc
+++ b/doc/src/snippets/code/doc_src_objecttrees.cpp
diff --git a/doc/src/snippets/code/doc_src_phonon-api.qdoc b/doc/src/snippets/code/doc_src_phonon-api.cpp
index d7a989b..d7a989b 100644
--- a/doc/src/snippets/code/doc_src_phonon-api.qdoc
+++ b/doc/src/snippets/code/doc_src_phonon-api.cpp
diff --git a/doc/src/snippets/code/doc_src_phonon.pro b/doc/src/snippets/code/doc_src_phonon.pro
new file mode 100644
index 0000000..24cc7bd
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_phonon.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 += phonon
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_plugins-howto.cpp b/doc/src/snippets/code/doc_src_plugins-howto.cpp
new file mode 100644
index 0000000..06bf903
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_plugins-howto.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 MyStylePlugin : public QStylePlugin
+{
+public:
+ QStringList keys() const;
+ QStyle *create(const QString &key);
+};
+//! [0]
+
+
+//! [1]
+#include "mystyleplugin.h"
+
+QStringList MyStylePlugin::keys() const
+{
+ return QStringList() << "MyStyle";
+}
+
+QStyle *MyStylePlugin::create(const QString &key)
+{
+ if (key.toLower() == "mystyle")
+ return new MyStyle;
+ return 0;
+}
+
+Q_EXPORT_PLUGIN2(pnp_mystyleplugin, MyStylePlugin)
+//! [1]
+
+
+//! [2]
+QApplication::setStyle(QStyleFactory::create("MyStyle"));
+//! [2]
+
+
+//! [4]
+#include <QApplication>
+#include <QtPlugin>
+
+Q_IMPORT_PLUGIN(qjpeg)
+Q_IMPORT_PLUGIN(qgif)
+Q_IMPORT_PLUGIN(qkrcodecs)
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ ...
+ return app.exec();
+}
+//! [4]
diff --git a/doc/src/snippets/code/doc_src_plugins-howto.pro b/doc/src/snippets/code/doc_src_plugins-howto.pro
new file mode 100644
index 0000000..eb0ec28
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_plugins-howto.pro
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+#! [3]
+CONFIG += release
+#! [3]
+
+
+#! [5]
+QTPLUGIN += qjpeg \
+ qgif \
+ qkrcodecs
+#! [5]
diff --git a/doc/src/snippets/code/doc_src_plugins-howto.qdoc b/doc/src/snippets/code/doc_src_plugins-howto.qdoc
index e80faee..b03dfed 100644
--- a/doc/src/snippets/code/doc_src_plugins-howto.qdoc
+++ b/doc/src/snippets/code/doc_src_plugins-howto.qdoc
@@ -38,69 +38,6 @@
**
****************************************************************************/
-//! [0]
-class MyStylePlugin : public QStylePlugin
-{
-public:
- QStringList keys() const;
- QStyle *create(const QString &key);
-};
-//! [0]
-
-
-//! [1]
-#include "mystyleplugin.h"
-
-QStringList MyStylePlugin::keys() const
-{
- return QStringList() << "MyStyle";
-}
-
-QStyle *MyStylePlugin::create(const QString &key)
-{
- if (key.toLower() == "mystyle")
- return new MyStyle;
- return 0;
-}
-
-Q_EXPORT_PLUGIN2(pnp_mystyleplugin, MyStylePlugin)
-//! [1]
-
-
-//! [2]
-QApplication::setStyle(QStyleFactory::create("MyStyle"));
-//! [2]
-
-
-//! [3]
-CONFIG += release
-//! [3]
-
-
-//! [4]
-#include <QApplication>
-#include <QtPlugin>
-
-Q_IMPORT_PLUGIN(qjpeg)
-Q_IMPORT_PLUGIN(qgif)
-Q_IMPORT_PLUGIN(qkrcodecs)
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- ...
- return app.exec();
-}
-//! [4]
-
-
-//! [5]
-QTPLUGIN += qjpeg \
- qgif \
- qkrcodecs
-//! [5]
-
-
//! [6]
HKEY_CURRENT_USER\Software\Trolltech\OrganizationDefaults\Qt Plugin Cache 4.2.debug
HKEY_CURRENT_USER\Software\Trolltech\OrganizationDefaults\Qt Plugin Cache 4.2.false
diff --git a/doc/src/snippets/code/doc_src_porting-qsa.cpp b/doc/src/snippets/code/doc_src_porting-qsa.cpp
new file mode 100644
index 0000000..f9b9c6b
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_porting-qsa.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [16]
+QPushButton *button = new QPushButton();
+button->setObjectName("button");
+interpreter->addTransientObject(button);
+//! [16]
+
+
+//! [17]
+QPushButton *button = new QPushButton();
+QScriptValue scriptButton = engine.newQObject(button);
+engine.globalObject().setProperty("button", scriptButton);
+//! [17]
+
+
+//! [18]
+ModuleFactory::ModuleFactory()
+{
+ registerClass( "ImageSource", &ImgSource::staticMetaObject);
+ ...
+}
+
+QObject *ModuleFactory::create( const QString &type,
+ const QVariantList &,
+ QObject * )
+{
+ if ( type == "ImageSource" )
+ return new ImgSource();
+ ...
+}
+
+...
+
+interpreter.addObjectFactory(new ModuleFactory());
+//! [18]
+
+
+//! [19]
+QScriptValue construct_QPushButton(QScriptContext *, QScriptEngine *engine) {
+ return engine->newQObject(new QPushButton());
+}
+
+...
+
+QScriptValue constructor = engine.newFunction(construct_QPushButton);
+QScriptValue value =
+ engine.newQMetaObject(&QPushButton::staticMetaObject,
+ constructor);
+engine.globalObject().setProperty("QPushButton", value);
+//! [19]
diff --git a/doc/src/snippets/code/doc_src_porting-qsa.js b/doc/src/snippets/code/doc_src_porting-qsa.js
new file mode 100644
index 0000000..e58f5b7
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_porting-qsa.js
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+point = new Object();
+point.x = 12;
+point.y = 35;
+//! [0]
+
+
+//! [1]
+function manhattanLength(point) {
+ return point.x + point.y;
+}
+//! [1]
+
+
+//! [2]
+manhattanLength = function(point) {
+ return point.x + point.y;
+}
+//! [2]
+
+
+//! [3]
+point.manhattanLength = function() {
+ return this.x + this.y;
+}
+print(point.manhattanLength()); // prints 47
+//! [3]
+
+
+//! [5]
+point.manhattanLength = function() {
+ return this.x + this.y;
+}
+print(point.manhattanLength()); // prints 47
+//! [5]
+
+
+//! [8]
+var car = new Object();
+car.constructor = function(regnr) {
+ // ...
+}
+car.constructor();
+//! [8]
+
+
+//! [10]
+function Car(regnr) {
+ this.regNumber = regnr;
+ this.toString = function() { return this.regNumber; }
+}
+//! [10]
+
+
+//! [11]
+function Car(regnr) {
+ this.regNumber = regnr;
+}
+Car.prototype.toString = function() { return this.regNumber; }
+//! [11]
+
+
+//! [13]
+function GasolineCar(regnr) {
+ Car(regnr);
+}
+GasolineCar.prototype = new Car();
+GasolineCar.prototype.toString = function() {
+ return "GasolineCar(" + this.regNumber + ")";
+}
+//! [13]
+
+
+//! [15]
+Car.globalCount = 0;
+print(Car.globalCount);
+//! [15]
diff --git a/doc/src/snippets/code/doc_src_porting-qsa.qdoc b/doc/src/snippets/code/doc_src_porting-qsa.qdoc
index bb0b7fd..1846640 100644
--- a/doc/src/snippets/code/doc_src_porting-qsa.qdoc
+++ b/doc/src/snippets/code/doc_src_porting-qsa.qdoc
@@ -38,35 +38,6 @@
**
****************************************************************************/
-//! [0]
-point = new Object();
-point.x = 12;
-point.y = 35;
-//! [0]
-
-
-//! [1]
-function manhattanLength(point) {
- return point.x + point.y;
-}
-//! [1]
-
-
-//! [2]
-manhattanLength = function(point) {
- return point.x + point.y;
-}
-//! [2]
-
-
-//! [3]
-point.manhattanLength = function() {
- return this.x + this.y;
-}
-print(point.manhattanLength()); // prints 47
-//! [3]
-
-
//! [4]
class Point() {
var x;
@@ -76,14 +47,6 @@ class Point() {
//! [4]
-//! [5]
-point.manhattanLength = function() {
- return this.x + this.y;
-}
-print(point.manhattanLength()); // prints 47
-//! [5]
-
-
//! [6]
class Car {
var regNumber;
@@ -103,13 +66,6 @@ var car = new Car("ABC 123");
//! [7]
-//! [8]
-var car = new Object();
-car.constructor = function(regnr) { ... }
-car.constructor();
-//! [8]
-
-
//! [9]
class Car {
var regNumber;
@@ -123,22 +79,6 @@ class Car {
//! [9]
-//! [10]
-function Car(regnr) {
- this.regNumber = regnr;
- this.toString = function() { return this.regNumber; }
-}
-//! [10]
-
-
-//! [11]
-function Car(regnr) {
- this.regNumber = regnr;
-}
-Car.prototype.toString = function() { return this.regNumber; }
-//! [11]
-
-
//! [12]
class GasolineCar extends Car {
function GasolineCar(regnr) {
@@ -151,77 +91,9 @@ class GasolineCar extends Car {
//! [12]
-//! [13]
-function GasolineCar(regnr) {
- Car(regnr);
-}
-GasolineCar.prototype = new Car();
-GasolineCar.prototype.toString = function() {
- return "GasolineCar(" + this.regNumber + ")";
-}
-//! [13]
-
-
//! [14]
class Car {
static var globalCount = 0;
}
print(Car.globalCount);
//! [14]
-
-
-//! [15]
-Car.globalCount = 0;
-print(Car.globalCount);
-//! [15]
-
-
-//! [16]
-QPushButton *button = new QPushButton();
-button->setObjectName("button");
-interpreter->addTransientObject(button);
-//! [16]
-
-
-//! [17]
-QPushButton *button = new QPushButton();
-QScriptValue scriptButton = engine.newQObject(button);
-engine.globalObject().setProperty("button", scriptButton);
-//! [17]
-
-
-//! [18]
-ModuleFactory::ModuleFactory()
-{
- registerClass( "ImageSource", &ImgSource::staticMetaObject);
- ...
-}
-
-QObject *ModuleFactory::create( const QString &type,
- const QVariantList &,
- QObject * )
-{
- if ( type == "ImageSource" )
- return new ImgSource();
- ...
-}
-
-...
-
-interpreter.addObjectFactory(new ModuleFactory());
-//! [18]
-
-
-//! [19]
-QScriptValue construct_QPushButton(QScriptContext *, QScriptEngine *engine) {
- return engine->newQObject(new QPushButton());
-}
-
-...
-
-QScriptValue constructor = engine.newFunction(construct_QPushButton);
-QScriptValue value =
- engine.newQMetaObject(&QPushButton::staticMetaObject,
- constructor);
-engine.globalObject().setProperty("QPushButton", value);
-//! [19]
diff --git a/doc/src/snippets/code/doc_src_porting4-canvas.qdoc b/doc/src/snippets/code/doc_src_porting4-canvas.cpp
index 8004163..8004163 100644
--- a/doc/src/snippets/code/doc_src_porting4-canvas.qdoc
+++ b/doc/src/snippets/code/doc_src_porting4-canvas.cpp
diff --git a/doc/src/snippets/code/doc_src_porting4-designer.cpp b/doc/src/snippets/code/doc_src_porting4-designer.cpp
new file mode 100644
index 0000000..1d73aae
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_porting4-designer.cpp
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+namespace Ui {
+
+class HelloWorld
+{
+public:
+ QVBoxLayout *vboxLayout;
+ QPushButton *pushButton;
+
+ void setupUi(QWidget *HelloWorld)
+ {
+ HelloWorld->setObjectName(QString::fromUtf8("HelloWorld"));
+
+ vboxLayout = new QVBoxLayout(HelloWorld);
+ vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
+
+ pushButton = new QPushButton(HelloWorld);
+ pushButton->setObjectName(QString::fromUtf8("pushButton"));
+
+ vboxLayout->addWidget(pushButton);
+
+ retranslateUi(HelloWorld);
+ }
+};
+
+}
+//! [0]
+
+
+//! [1]
+#include <QApplication>
+#include <QWidget>
+
+#include "ui_helloworld.h" // defines Ui::HelloWorld
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QWidget w;
+ Ui::HelloWorld ui;
+ ui.setupUi(&w);
+
+ w.show();
+ return app.exec();
+}
+//! [1]
+
+
+//! [2]
+#include <QApplication>
+#include <QWidget>
+
+#include "ui_helloworld.h" // defines Ui::HelloWorld
+
+class HelloWorldWidget : public QWidget, public Ui::HelloWorld
+{
+ Q_OBJECT
+
+public:
+ HelloWorldWidget(QWidget *parent = 0)
+ : QWidget(parent)
+ { setupUi(this); }
+};
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ HelloWorldWidget w;
+ w.show();
+ return app.exec();
+}
+//! [2]
+
+
+//! [5]
+class HelloWorldWidget : public QWidget, public Ui::HelloWorld
+{
+ Q_OBJECT
+
+public:
+ HelloWorldWidget(QWidget *parent = 0);
+
+public slots:
+ void mySlot();
+};
+
+HelloWorldWidget::HelloWorldWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ setupUi(this);
+
+ QObject::connect(pushButton, SIGNAL(clicked()),
+ this, SLOT(mySlot()));
+}
+
+void HelloWorldWidget::mySlot()
+{
+ ...
+}
+//! [5]
+
+
+//! [6]
+class HelloWorldWidget : public QWidget, public Ui::HelloWorld
+{
+ Q_OBJECT
+
+public:
+ HelloWorldWidget(QWidget *parent = 0);
+
+public slots:
+ void on_pushButton_clicked();
+};
+
+HelloWorldWidget::HelloWorldWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ setupUi(this);
+}
+
+void HelloWorldWidget::on_pushButton_clicked()
+{
+ ...
+}
+//! [6]
+
+
+//! [9]
+QFile file(":/icons/yes.png");
+QIcon icon(":/icons/no.png");
+QPixmap pixmap(":/icons/no.png");
+//! [9]
diff --git a/doc/src/snippets/code/doc_src_porting4-designer.pro b/doc/src/snippets/code/doc_src_porting4-designer.pro
new file mode 100644
index 0000000..673e593
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_porting4-designer.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+#! [8]
+RESOURCES += icons.qrc
+#! [8]
diff --git a/doc/src/snippets/code/doc_src_porting4-designer.qdoc b/doc/src/snippets/code/doc_src_porting4-designer.qdoc
index 2c043f5..b5c686b 100644
--- a/doc/src/snippets/code/doc_src_porting4-designer.qdoc
+++ b/doc/src/snippets/code/doc_src_porting4-designer.qdoc
@@ -38,81 +38,6 @@
**
****************************************************************************/
-//! [0]
-namespace Ui {
-
-class HelloWorld
-{
-public:
- QVBoxLayout *vboxLayout;
- QPushButton *pushButton;
-
- void setupUi(QWidget *HelloWorld)
- {
- HelloWorld->setObjectName(QString::fromUtf8("HelloWorld"));
-
- vboxLayout = new QVBoxLayout(HelloWorld);
- vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
-
- pushButton = new QPushButton(HelloWorld);
- pushButton->setObjectName(QString::fromUtf8("pushButton"));
-
- vboxLayout->addWidget(pushButton);
-
- retranslateUi(HelloWorld);
- }
-};
-
-}
-//! [0]
-
-
-//! [1]
-#include <QApplication>
-#include <QWidget>
-
-#include "ui_helloworld.h" // defines Ui::HelloWorld
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QWidget w;
- Ui::HelloWorld ui;
- ui.setupUi(&w);
-
- w.show();
- return app.exec();
-}
-//! [1]
-
-
-//! [2]
-#include <QApplication>
-#include <QWidget>
-
-#include "ui_helloworld.h" // defines Ui::HelloWorld
-
-class HelloWorldWidget : public QWidget, public Ui::HelloWorld
-{
- Q_OBJECT
-
-public:
- HelloWorldWidget(QWidget *parent = 0)
- : QWidget(parent)
- { setupUi(this); }
-};
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- HelloWorldWidget w;
- w.show();
- return app.exec();
-}
-//! [2]
-
-
//! [3]
uic3 myform.ui > myform.h
uic3 -impl myform.h myform.ui > myform.cpp
@@ -124,59 +49,6 @@ uic3 -convert myform3.ui > myform4.ui
//! [4]
-//! [5]
-class HelloWorldWidget : public QWidget, public Ui::HelloWorld
-{
- Q_OBJECT
-
-public:
- HelloWorldWidget(QWidget *parent = 0);
-
-public slots:
- void mySlot();
-};
-
-HelloWorldWidget::HelloWorldWidget(QWidget *parent)
- : QWidget(parent)
-{
- setupUi(this);
-
- QObject::connect(pushButton, SIGNAL(clicked()),
- this, SLOT(mySlot()));
-}
-
-void HelloWorldWidget::mySlot()
-{
- ...
-}
-//! [5]
-
-
-//! [6]
-class HelloWorldWidget : public QWidget, public Ui::HelloWorld
-{
- Q_OBJECT
-
-public:
- HelloWorldWidget(QWidget *parent = 0);
-
-public slots:
- void on_pushButton_clicked();
-};
-
-HelloWorldWidget::HelloWorldWidget(QWidget *parent)
- : QWidget(parent)
-{
- setupUi(this);
-}
-
-void HelloWorldWidget::on_pushButton_clicked()
-{
- ...
-}
-//! [6]
-
-
//! [7]
<RCC version="1.0">
<qresource prefix="/icons">
@@ -185,15 +57,3 @@ void HelloWorldWidget::on_pushButton_clicked()
</qresource>
</RCC>
//! [7]
-
-
-//! [8]
-RESOURCES += icons.qrc
-//! [8]
-
-
-//! [9]
-QFile file(":/icons/yes.png");
-QIcon icon(":/icons/no.png");
-QPixmap pixmap(":/icons/no.png");
-//! [9]
diff --git a/doc/src/snippets/code/doc_src_porting4.qdoc b/doc/src/snippets/code/doc_src_porting4.cpp
index 14c708a..14c708a 100644
--- a/doc/src/snippets/code/doc_src_porting4.qdoc
+++ b/doc/src/snippets/code/doc_src_porting4.cpp
diff --git a/doc/src/snippets/code/doc_src_properties.qdoc b/doc/src/snippets/code/doc_src_properties.cpp
index 1238bc5..b5a103d 100644
--- a/doc/src/snippets/code/doc_src_properties.qdoc
+++ b/doc/src/snippets/code/doc_src_properties.cpp
@@ -44,6 +44,7 @@ Q_PROPERTY(type name
[WRITE setFunction]
[RESET resetFunction]
[NOTIFY notifySignal]
+ [REVISION int]
[DESIGNABLE bool]
[SCRIPTABLE bool]
[STORED bool]
diff --git a/doc/src/snippets/code/doc_src_q3asciidict.qdoc b/doc/src/snippets/code/doc_src_q3asciidict.cpp
index 4b32817..4b32817 100644
--- a/doc/src/snippets/code/doc_src_q3asciidict.qdoc
+++ b/doc/src/snippets/code/doc_src_q3asciidict.cpp
diff --git a/doc/src/snippets/code/doc_src_q3dict.qdoc b/doc/src/snippets/code/doc_src_q3dict.cpp
index 9c51cae..9c51cae 100644
--- a/doc/src/snippets/code/doc_src_q3dict.qdoc
+++ b/doc/src/snippets/code/doc_src_q3dict.cpp
diff --git a/doc/src/snippets/code/doc_src_q3intdict.qdoc b/doc/src/snippets/code/doc_src_q3intdict.cpp
index 0f15b6f..0f15b6f 100644
--- a/doc/src/snippets/code/doc_src_q3intdict.qdoc
+++ b/doc/src/snippets/code/doc_src_q3intdict.cpp
diff --git a/doc/src/snippets/code/doc_src_q3memarray.cpp b/doc/src/snippets/code/doc_src_q3memarray.cpp
new file mode 100644
index 0000000..2c91050
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_q3memarray.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+#include <q3memarray.h>
+#include <stdio.h>
+
+Q3MemArray<int> fib( int num ) // returns fibonacci array
+{
+ Q_ASSERT( num > 2 );
+ Q3MemArray<int> f( num ); // array of ints
+
+ f[0] = f[1] = 1;
+ for ( int i = 2; i < num; i++ )
+ f[i] = f[i-1] + f[i-2];
+
+ return f;
+}
+
+int main()
+{
+ Q3MemArray<int> a = fib( 6 ); // get first 6 fibonaccis
+ for ( int i = 0; i < a.size(); i++ )
+ qDebug( "%d: %d", i, a[i] );
+
+ qDebug( "1 is found %d times", a.contains(1) );
+ qDebug( "5 is found at index %d", a.find(5) );
+
+ return 0;
+}
+//! [0]
+
+
+//! [2]
+// MyStruct may be padded to 4 or 8 bytes
+struct MyStruct
+{
+ short i; // 2 bytes
+ char c; // 1 byte
+};
+
+Q3MemArray<MyStruct> a(1);
+a[0].i = 5;
+a[0].c = 't';
+
+MyStruct x;
+x.i = '5';
+x.c = 't';
+int i = a.find( x ); // may return -1 if the pad bytes differ
+//! [2]
+
+
+//! [3]
+static char bindata[] = { 231, 1, 44, ... };
+QByteArray a;
+a.setRawData( bindata, sizeof(bindata) ); // a points to bindata
+QDataStream s( a, IO_ReadOnly ); // open on a's data
+s >> <something>; // read raw bindata
+a.resetRawData( bindata, sizeof(bindata) ); // finished
+//! [3]
+
+
+//! [4]
+static char bindata[] = { 231, 1, 44, ... };
+QByteArray a, b;
+a.setRawData( bindata, sizeof(bindata) ); // a points to bindata
+a.resize( 8 ); // will crash
+b = a; // will crash
+a[2] = 123; // might crash
+// forget to resetRawData: will crash
+//! [4]
diff --git a/doc/src/snippets/code/doc_src_q3memarray.qdoc b/doc/src/snippets/code/doc_src_q3memarray.qdoc
index 8e5e008..a966e50 100644
--- a/doc/src/snippets/code/doc_src_q3memarray.qdoc
+++ b/doc/src/snippets/code/doc_src_q3memarray.qdoc
@@ -38,36 +38,6 @@
**
****************************************************************************/
-//! [0]
-#include <q3memarray.h>
-#include <stdio.h>
-
-Q3MemArray<int> fib( int num ) // returns fibonacci array
-{
- Q_ASSERT( num > 2 );
- Q3MemArray<int> f( num ); // array of ints
-
- f[0] = f[1] = 1;
- for ( int i = 2; i < num; i++ )
- f[i] = f[i-1] + f[i-2];
-
- return f;
-}
-
-int main()
-{
- Q3MemArray<int> a = fib( 6 ); // get first 6 fibonaccis
- for ( int i = 0; i < a.size(); i++ )
- qDebug( "%d: %d", i, a[i] );
-
- qDebug( "1 is found %d times", a.contains(1) );
- qDebug( "5 is found at index %d", a.find(5) );
-
- return 0;
-}
-//! [0]
-
-
//! [1]
0: 1
1: 1
@@ -78,43 +48,3 @@ int main()
1 is found 2 times
5 is found at index 4
//! [1]
-
-
-//! [2]
-// MyStruct may be padded to 4 or 8 bytes
-struct MyStruct
-{
- short i; // 2 bytes
- char c; // 1 byte
-};
-
-Q3MemArray<MyStruct> a(1);
-a[0].i = 5;
-a[0].c = 't';
-
-MyStruct x;
-x.i = '5';
-x.c = 't';
-int i = a.find( x ); // may return -1 if the pad bytes differ
-//! [2]
-
-
-//! [3]
-static char bindata[] = { 231, 1, 44, ... };
-QByteArray a;
-a.setRawData( bindata, sizeof(bindata) ); // a points to bindata
-QDataStream s( a, IO_ReadOnly ); // open on a's data
-s >> <something>; // read raw bindata
-a.resetRawData( bindata, sizeof(bindata) ); // finished
-//! [3]
-
-
-//! [4]
-static char bindata[] = { 231, 1, 44, ... };
-QByteArray a, b;
-a.setRawData( bindata, sizeof(bindata) ); // a points to bindata
-a.resize( 8 ); // will crash
-b = a; // will crash
-a[2] = 123; // might crash
-// forget to resetRawData: will crash
-//! [4]
diff --git a/doc/src/snippets/code/doc_src_q3ptrdict.qdoc b/doc/src/snippets/code/doc_src_q3ptrdict.cpp
index e64d874..e64d874 100644
--- a/doc/src/snippets/code/doc_src_q3ptrdict.qdoc
+++ b/doc/src/snippets/code/doc_src_q3ptrdict.cpp
diff --git a/doc/src/snippets/code/doc_src_q3ptrlist.qdoc b/doc/src/snippets/code/doc_src_q3ptrlist.cpp
index 4f97c65..4f97c65 100644
--- a/doc/src/snippets/code/doc_src_q3ptrlist.qdoc
+++ b/doc/src/snippets/code/doc_src_q3ptrlist.cpp
diff --git a/doc/src/snippets/code/doc_src_q3valuelist.qdoc b/doc/src/snippets/code/doc_src_q3valuelist.cpp
index 38ee9f6..38ee9f6 100644
--- a/doc/src/snippets/code/doc_src_q3valuelist.qdoc
+++ b/doc/src/snippets/code/doc_src_q3valuelist.cpp
diff --git a/doc/src/snippets/code/doc_src_q3valuestack.qdoc b/doc/src/snippets/code/doc_src_q3valuestack.cpp
index 50827e6..50827e6 100644
--- a/doc/src/snippets/code/doc_src_q3valuestack.qdoc
+++ b/doc/src/snippets/code/doc_src_q3valuestack.cpp
diff --git a/doc/src/snippets/code/doc_src_q3valuevector.qdoc b/doc/src/snippets/code/doc_src_q3valuevector.cpp
index 8af1568..8af1568 100644
--- a/doc/src/snippets/code/doc_src_q3valuevector.qdoc
+++ b/doc/src/snippets/code/doc_src_q3valuevector.cpp
diff --git a/doc/src/snippets/code/doc_src_qalgorithms.qdoc b/doc/src/snippets/code/doc_src_qalgorithms.cpp
index 0438105..0438105 100644
--- a/doc/src/snippets/code/doc_src_qalgorithms.qdoc
+++ b/doc/src/snippets/code/doc_src_qalgorithms.cpp
diff --git a/doc/src/snippets/code/doc_src_qaxcontainer.qdoc b/doc/src/snippets/code/doc_src_qaxcontainer.pro
index 93aa60b..ff39e67 100644
--- a/doc/src/snippets/code/doc_src_qaxcontainer.qdoc
+++ b/doc/src/snippets/code/doc_src_qaxcontainer.pro
@@ -38,11 +38,11 @@
**
****************************************************************************/
-//! [0]
+#! [0]
CONFIG += qaxcontainer
-//! [0]
+#! [0]
-//! [1]
+#! [1]
TYPELIBS = file.tlb
-//! [1]
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qaxserver.cpp b/doc/src/snippets/code/doc_src_qaxserver.cpp
new file mode 100644
index 0000000..dc16776
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qaxserver.cpp
@@ -0,0 +1,218 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [3]
+#include <QWidget>
+
+class MyActiveX : public QWidget
+{
+ Q_OBJECT
+//! [3]
+
+
+//! [4]
+Q_CLASSINFO("ClassID", "{1D9928BD-4453-4bdd-903D-E525ED17FDE5}")
+Q_CLASSINFO("InterfaceID", "{99F6860E-2C5A-42ec-87F2-43396F4BE389}")
+Q_CLASSINFO("EventsID", "{0A3E9F27-E4F1-45bb-9E47-63099BCCD0E3}")
+//! [4]
+
+
+//! [5]
+Q_PROPERTY(int value READ value WRITE setValue)
+//! [5]
+
+
+//! [6]
+public:
+ MyActiveX(QWidget *parent = 0)
+ ...
+
+ int value() const;
+
+public slots:
+ void setValue(int v);
+ ...
+
+signals:
+ void valueChange(int v);
+ ...
+
+};
+//! [6]
+
+
+//! [7]
+#include <QAxBindable>
+#include <QWidget>
+
+class MyActiveX : public QWidget, public QAxBindable
+{
+ Q_OBJECT
+//! [7]
+
+
+//! [8]
+QAXFACTORY_BEGIN("{ad90301a-849e-4e8b-9a91-0a6dc5f6461f}",
+ "{a8f21901-7ff7-4f6a-b939-789620c03d83}")
+ QAXCLASS(MyWidget)
+ QAXCLASS(MyWidget2)
+ QAXTYPE(MySubType)
+QAXFACTORY_END()
+//! [8]
+
+
+//! [9]
+#include <QApplication>
+#include <QAxFactory>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ if (!QAxFactory::isServer()) {
+ // create and show main window
+ }
+ return app.exec();
+}
+//! [9]
+
+
+//! [10]
+MyFactory(const QUuid &, const QUuid &);
+//! [10]
+
+
+//! [11]
+HMODULE dll = LoadLibrary("myserver.dll");
+typedef HRESULT(__stdcall *DllRegisterServerProc)();
+DllRegisterServerProc DllRegisterServer =
+ (DllRegisterServerProc)GetProcAddress(dll, "DllRegisterServer");
+
+HRESULT res = E_FAIL;
+if (DllRegisterServer)
+ res = DllRegisterServer();
+if (res != S_OK)
+ // error handling
+//! [11]
+
+
+//! [15]
+class MyActiveX : public QWidget
+{
+ Q_OBJECT
+ Q_CLASSINFO("Version", "2.0")
+ Q_CLASSINFO("ClassID", "{7a4cffd8-cbcd-4ae9-ae7e-343e1e5710df}")
+ Q_CLASSINFO("InterfaceID", "{6fb035bf-8019-48d8-be51-ef05427d8994}")
+ Q_CLASSINFO("EventsID", "{c42fffdf-6557-47c9-817a-2da2228bc29c}")
+ Q_CLASSINFO("Insertable", "yes")
+ Q_CLASSINFO("ToSuperClass", "MyActiveX")
+ Q_PROPERTY(...)
+
+public:
+ MyActiveX(QWidget *parent = 0);
+
+ ...
+};
+//! [15]
+
+
+//! [16]
+class MyLicensedControl : public QWidget
+{
+ Q_OBJECT
+ Q_CLASSINFO("LicenseKey", "<key string>")
+ ...
+};
+//! [16]
+
+
+//! [17]
+class AxImpl : public QAxAggregated, public ISomeCOMInterface
+{
+public:
+ AxImpl() {}
+
+ long queryInterface(const QUuid &iid, void **iface);
+
+ // IUnknown
+ QAXAGG_IUNKNOWN
+
+ // ISomeCOMInterface
+ ...
+}
+//! [17]
+
+
+//! [18]
+long AxImpl::queryInterface(const QUuid &iid, void **iface)
+{
+ *iface = 0;
+ if (iid == IID_ISomeCOMInterface)
+ *iface = (ISomeCOMInterface *)this;
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+//! [18]
+
+
+//! [19]
+HRESULT AxImpl::QueryInterface(REFIID iid, void **iface)
+{
+ return controllingUnknown()->QueryInterface(iid, iface);
+}
+//! [19]
+
+
+//! [20]
+class MyActiveX : public QWidget, public QAxBindable
+{
+ Q_OBJECT
+
+public:
+ MyActiveX(QWidget *parent);
+
+ QAxAggregated *createAggregate()
+ {
+ return new AxImpl();
+ }
+};
+//! [20]
diff --git a/doc/src/snippets/code/doc_src_qaxserver.pro b/doc/src/snippets/code/doc_src_qaxserver.pro
new file mode 100644
index 0000000..18d66f3
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qaxserver.pro
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+TEMPLATE = app
+CONFIG += qaxserver
+
+RC_FILE = qaxserver.rc
+...
+#! [0]
+
+
+#! [1]
+TEMPLATE = lib
+CONFIG += qaxserver dll
+
+DEF_FILE = qaxserver.def
+RC_FILE = qaxserver.rc
+...
+#! [1]
+
+
+#! [2]
+TEMPLATE = lib
+VERSION = 2.5
+...
+#! [2]
diff --git a/doc/src/snippets/code/doc_src_qaxserver.qdoc b/doc/src/snippets/code/doc_src_qaxserver.qdoc
index c5906e9..2fd79e3 100644
--- a/doc/src/snippets/code/doc_src_qaxserver.qdoc
+++ b/doc/src/snippets/code/doc_src_qaxserver.qdoc
@@ -38,126 +38,6 @@
**
****************************************************************************/
-//! [0]
-TEMPLATE = app
-CONFIG += qaxserver
-
-RC_FILE = qaxserver.rc
-...
-//! [0]
-
-
-//! [1]
-TEMPLATE = lib
-CONFIG += qaxserver dll
-
-DEF_FILE = qaxserver.def
-RC_FILE = qaxserver.rc
-...
-//! [1]
-
-
-//! [2]
-TEMPLATE = lib
-VERSION = 2.5
-...
-//! [2]
-
-
-//! [3]
-#include <QWidget>
-
-class MyActiveX : public QWidget
-{
- Q_OBJECT
-//! [3]
-
-
-//! [4]
-Q_CLASSINFO("ClassID", "{1D9928BD-4453-4bdd-903D-E525ED17FDE5}")
-Q_CLASSINFO("InterfaceID", "{99F6860E-2C5A-42ec-87F2-43396F4BE389}")
-Q_CLASSINFO("EventsID", "{0A3E9F27-E4F1-45bb-9E47-63099BCCD0E3}")
-//! [4]
-
-
-//! [5]
-Q_PROPERTY(int value READ value WRITE setValue)
-//! [5]
-
-
-//! [6]
-public:
- MyActiveX(QWidget *parent = 0)
- ...
-
- int value() const;
-
-public slots:
- void setValue(int v);
- ...
-
-signals:
- void valueChange(int v);
- ...
-
-};
-//! [6]
-
-
-//! [7]
-#include <QAxBindable>
-#include <QWidget>
-
-class MyActiveX : public QWidget, public QAxBindable
-{
- Q_OBJECT
-//! [7]
-
-
-//! [8]
-QAXFACTORY_BEGIN("{ad90301a-849e-4e8b-9a91-0a6dc5f6461f}",
- "{a8f21901-7ff7-4f6a-b939-789620c03d83}")
- QAXCLASS(MyWidget)
- QAXCLASS(MyWidget2)
- QAXTYPE(MySubType)
-QAXFACTORY_END()
-//! [8]
-
-
-//! [9]
-#include <QApplication>
-#include <QAxFactory>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- if (!QAxFactory::isServer()) {
- // create and show main window
- }
- return app.exec();
-}
-//! [9]
-
-
-//! [10]
-MyFactory(const QUuid &, const QUuid &);
-//! [10]
-
-
-//! [11]
-HMODULE dll = LoadLibrary("myserver.dll");
-typedef HRESULT(__stdcall *DllRegisterServerProc)();
-DllRegisterServerProc DllRegisterServer =
- (DllRegisterServerProc)GetProcAddress(dll, "DllRegisterServer");
-
-HRESULT res = E_FAIL;
-if (DllRegisterServer)
- res = DllRegisterServer();
-if (res != S_OK)
- // error handling
-//! [11]
-
-
//! [12]
cabarc N simpleax.cab simpleax.exe simple.inf
//! [12]
@@ -175,89 +55,3 @@ cabarc N simpleax.cab simpleax.exe simple.inf
<param name="name" value="value">
<\object>
//! [14]
-
-
-//! [15]
-class MyActiveX : public QWidget
-{
- Q_OBJECT
- Q_CLASSINFO("Version", "2.0")
- Q_CLASSINFO("ClassID", "{7a4cffd8-cbcd-4ae9-ae7e-343e1e5710df}")
- Q_CLASSINFO("InterfaceID", "{6fb035bf-8019-48d8-be51-ef05427d8994}")
- Q_CLASSINFO("EventsID", "{c42fffdf-6557-47c9-817a-2da2228bc29c}")
- Q_CLASSINFO("Insertable", "yes")
- Q_CLASSINFO("ToSuperClass", "MyActiveX")
- Q_PROPERTY(...)
-
-public:
- MyActiveX(QWidget *parent = 0);
-
- ...
-};
-//! [15]
-
-
-//! [16]
-class MyLicensedControl : public QWidget
-{
- Q_OBJECT
- Q_CLASSINFO("LicenseKey", "<key string>")
- ...
-};
-//! [16]
-
-
-//! [17]
-class AxImpl : public QAxAggregated, public ISomeCOMInterface
-{
-public:
- AxImpl() {}
-
- long queryInterface(const QUuid &iid, void **iface);
-
- // IUnknown
- QAXAGG_IUNKNOWN
-
- // ISomeCOMInterface
- ...
-}
-//! [17]
-
-
-//! [18]
-long AxImpl::queryInterface(const QUuid &iid, void **iface)
-{
- *iface = 0;
- if (iid == IID_ISomeCOMInterface)
- *iface = (ISomeCOMInterface *)this;
- else
- return E_NOINTERFACE;
-
- AddRef();
- return S_OK;
-}
-//! [18]
-
-
-//! [19]
-HRESULT AxImpl::QueryInterface(REFIID iid, void **iface)
-{
- return controllingUnknown()->QueryInterface(iid, iface);
-}
-//! [19]
-
-
-//! [20]
-class MyActiveX : public QWidget, public QAxBindable
-{
- Q_OBJECT
-
-public:
- MyActiveX(QWidget *parent);
-
- QAxAggregated *createAggregate()
- {
- return new AxImpl();
- }
-};
-//! [20]
diff --git a/doc/src/snippets/code/doc_src_qcache.qdoc b/doc/src/snippets/code/doc_src_qcache.cpp
index 81fa3cf..81fa3cf 100644
--- a/doc/src/snippets/code/doc_src_qcache.qdoc
+++ b/doc/src/snippets/code/doc_src_qcache.cpp
diff --git a/doc/src/snippets/code/doc_src_qdbusadaptors.qdoc b/doc/src/snippets/code/doc_src_qdbusadaptors.cpp
index abb31a1..749e64b 100644
--- a/doc/src/snippets/code/doc_src_qdbusadaptors.qdoc
+++ b/doc/src/snippets/code/doc_src_qdbusadaptors.cpp
@@ -39,82 +39,82 @@
****************************************************************************/
//! [0]
- class MainApplicationAdaptor: public QDBusAbstractAdaptor
- {
- Q_OBJECT
- Q_CLASSINFO("D-Bus Interface", "org.kde.DBus.MainApplication")
- Q_PROPERTY(QString caption READ caption WRITE setCaption)
- Q_PROPERTY(QString organizationName READ organizationName)
- Q_PROPERTY(QString organizationDomain READ organizationDomain)
-
- private:
- QApplication *app;
-
- public:
- MainApplicationAdaptor(QApplication *application)
- : QDBusAbstractAdaptor(application), app(application)
- {
- connect(application, SIGNAL(aboutToQuit()), SIGNAL(aboutToQuit()));
- connect(application, SIGNAL(focusChanged(QWidget*, QWidget*)),
- SLOT(focusChangedSlot(QWidget*, QWidget*)));
- }
-
- QString caption()
- {
- if (app->hasMainWindow())
- return app->mainWindow()->caption();
- return QString(""); // must not return a null QString
- }
-
- void setCaption(const QString &newCaption)
- {
- if (app->hasMainWindow())
- app->mainWindow()->setCaption(newCaption);
- }
-
- QString organizationName()
- {
- return app->organizationName();
- }
-
- QString organizationDomain()
- {
- return app->organizationDomain();
- }
-
- public slots:
- Q_NOREPLY void quit()
- { app->quit(); }
-
- void reparseConfiguration()
- { app->reparseConfiguration(); }
-
- QString mainWindowObject()
- {
- if (app->hasMainWindow())
- return QString("/%1/mainwindow").arg(app->applicationName());
- return QString();
- }
-
- void setSessionManagement(bool enable)
- {
- if (enable)
- app->enableSessionManagement();
- else
- app->disableSessionManagement();
- }
-
- private slots:
- void focusChangedSlot(QWidget *, QWidget *now)
- {
- if (now == app->mainWindow())
- emit mainWindowHasFocus();
- }
-
- signals:
- void aboutToQuit();
- void mainWindowHasFocus();
- };
+class MainApplicationAdaptor: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.kde.DBus.MainApplication")
+ Q_PROPERTY(QString caption READ caption WRITE setCaption)
+ Q_PROPERTY(QString organizationName READ organizationName)
+ Q_PROPERTY(QString organizationDomain READ organizationDomain)
+
+private:
+ QApplication *app;
+
+public:
+ MainApplicationAdaptor(QApplication *application)
+ : QDBusAbstractAdaptor(application), app(application)
+ {
+ connect(application, SIGNAL(aboutToQuit()), SIGNAL(aboutToQuit()));
+ connect(application, SIGNAL(focusChanged(QWidget*, QWidget*)),
+ SLOT(focusChangedSlot(QWidget*, QWidget*)));
+ }
+
+ QString caption()
+ {
+ if (app->hasMainWindow())
+ return app->mainWindow()->caption();
+ return QString(""); // must not return a null QString
+ }
+
+ void setCaption(const QString &newCaption)
+ {
+ if (app->hasMainWindow())
+ app->mainWindow()->setCaption(newCaption);
+ }
+
+ QString organizationName()
+ {
+ return app->organizationName();
+ }
+
+ QString organizationDomain()
+ {
+ return app->organizationDomain();
+ }
+
+public slots:
+ Q_NOREPLY void quit()
+ { app->quit(); }
+
+ void reparseConfiguration()
+ { app->reparseConfiguration(); }
+
+ QString mainWindowObject()
+ {
+ if (app->hasMainWindow())
+ return QString("/%1/mainwindow").arg(app->applicationName());
+ return QString();
+ }
+
+ void setSessionManagement(bool enable)
+ {
+ if (enable)
+ app->enableSessionManagement();
+ else
+ app->disableSessionManagement();
+ }
+
+private slots:
+ void focusChangedSlot(QWidget *, QWidget *now)
+ {
+ if (now == app->mainWindow())
+ emit mainWindowHasFocus();
+ }
+
+signals:
+ void aboutToQuit();
+ void mainWindowHasFocus();
+};
//! [0]
diff --git a/doc/src/snippets/code/doc_src_qiterator.qdoc b/doc/src/snippets/code/doc_src_qiterator.cpp
index 82b1bd3..82b1bd3 100644
--- a/doc/src/snippets/code/doc_src_qiterator.qdoc
+++ b/doc/src/snippets/code/doc_src_qiterator.cpp
diff --git a/doc/src/snippets/code/doc_src_qmake-manual.cpp b/doc/src/snippets/code/doc_src_qmake-manual.cpp
new file mode 100644
index 0000000..4f60e1d
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qmake-manual.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [104]
+// Add C includes here
+
+#if defined __cplusplus
+// Add C++ includes here
+#include <stdlib>
+#include <iostream>
+#include <vector>
+#include <QApplication> // Qt includes
+#include <QPushButton>
+#include <QLabel>
+#include "thirdparty/include/libmain.h"
+#include "my_stable_class.h"
+...
+#endif
+//! [104]
+
+
diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.pro
index a35a3d9..ee35b77 100644
--- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc
+++ b/doc/src/snippets/code/doc_src_qmake-manual.pro
@@ -38,569 +38,569 @@
**
****************************************************************************/
-//! [0]
+#! [0]
make all
-//! [0]
+#! [0]
-//! [1]
+#! [1]
CONFIG += qt thread debug
-//! [1]
+#! [1]
-//! [2]
+#! [2]
CONFIG += qt
QT += network xml
-//! [2]
+#! [2]
-//! [3]
+#! [3]
QT = network xml # This will omit the core and gui modules.
-//! [3]
+#! [3]
-//! [4]
+#! [4]
QT -= gui # Only the core module is used.
-//! [4]
+#! [4]
-//! [5]
+#! [5]
CONFIG += link_pkgconfig
PKGCONFIG += ogg dbus-1
-//! [5]
+#! [5]
-//! [6]
+#! [6]
LIBS += -L/usr/local/lib -lmath
-//! [6]
+#! [6]
-//! [7]
+#! [7]
INCLUDEPATH = c:/msdev/include d:/stl/include
-//! [7]
+#! [7]
-//! [8]
+#! [8]
qmake [mode] [options] files
-//! [8]
+#! [8]
-//! [9]
+#! [9]
qmake -makefile [options] files
-//! [9]
+#! [9]
-//! [10]
+#! [10]
qmake -makefile -unix -o Makefile "CONFIG+=test" test.pro
-//! [10]
+#! [10]
-//! [11]
+#! [11]
qmake "CONFIG+=test" test.pro
-//! [11]
+#! [11]
-//! [12]
+#! [12]
qmake -project [options] files
-//! [12]
+#! [12]
-//! [13]
+#! [13]
qmake -spec macx-g++
-//! [13]
+#! [13]
-//! [14]
+#! [14]
QMAKE_LFLAGS += -F/path/to/framework/directory/
-//! [14]
+#! [14]
-//! [15]
+#! [15]
LIBS += -framework TheFramework
-//! [15]
+#! [15]
-//! [16]
+#! [16]
TEMPLATE = lib
CONFIG += lib_bundle
-//! [16]
+#! [16]
-//! [17]
+#! [17]
FRAMEWORK_HEADERS.version = Versions
FRAMEWORK_HEADERS.files = path/to/header_one.h path/to/header_two.h
FRAMEWORK_HEADERS.path = Headers
QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
-//! [17]
+#! [17]
-//! [18]
+#! [18]
CONFIG += x86 ppc
-//! [18]
+#! [18]
-//! [19]
+#! [19]
qmake -spec macx-xcode project.pro
-//! [19]
+#! [19]
-//! [20]
+#! [20]
qmake -tp vc
-//! [20]
+#! [20]
-//! [21]
+#! [21]
qmake -tp vc -r
-//! [21]
+#! [21]
-//! [22]
+#! [22]
CONFIG -= embed_manifest_exe
-//! [22]
+#! [22]
-//! [23]
+#! [23]
CONFIG -= embed_manifest_dll
-//! [23]
+#! [23]
-//! [24]
+#! [24]
make all
-//! [24]
+#! [24]
-//! [25]
+#! [25]
build_pass:CONFIG(debug, debug|release) {
unix: TARGET = $$join(TARGET,,,_debug)
else: TARGET = $$join(TARGET,,,d)
}
-//! [25]
+#! [25]
-//! [26]
+#! [26]
CONFIG += qt console newstuff
...
newstuff {
SOURCES += new.cpp
HEADERS += new.h
}
-//! [26]
+#! [26]
-//! [27]
+#! [27]
DEFINES += USE_MY_STUFF QT_DLL
-//! [27]
+#! [27]
-//! [28]
+#! [28]
myFiles.files = path\*.png
DEPLOYMENT += myFiles
-//! [28]
+#! [28]
-//! [29]
+#! [29]
myFiles.files = path\file1.ext1 path2\file2.ext1 path3\*
myFiles.path = \some\path\on\device
someother.files = C:\additional\files\*
someother.path = \myFiles\path2
DEPLOYMENT += myFiles someother
-//! [29]
+#! [29]
-//! [30]
+#! [30]
DESTDIR = ../../lib
-//! [30]
+#! [30]
-//! [31]
+#! [31]
DISTFILES += ../program.txt
-//! [31]
+#! [31]
-//! [32]
+#! [32]
FORMS = mydialog.ui \
mywidget.ui \
myconfig.ui
-//! [32]
+#! [32]
-//! [33]
+#! [33]
FORMS3 = my_uic3_dialog.ui \
my_uic3_widget.ui \
my_uic3_config.ui
-//! [33]
+#! [33]
-//! [34]
+#! [34]
HEADERS = myclass.h \
login.h \
mainwindow.h
-//! [34]
+#! [34]
-//! [35]
+#! [35]
INCLUDEPATH = c:/msdev/include d:/stl/include
-//! [35]
+#! [35]
-//! [36]
+#! [36]
target.path += $$[QT_INSTALL_PLUGINS]/imageformats
INSTALLS += target
-//! [36]
+#! [36]
-//! [37]
+#! [37]
LEXSOURCES = lexer.l
-//! [37]
+#! [37]
-//! [38]
+#! [38]
unix:LIBS += -L/usr/local/lib -lmath
win32:LIBS += c:/mylibs/math.lib
-//! [38]
+#! [38]
-//! [39]
+#! [39]
CONFIG += no_lflags_merge
-//! [39]
+#! [39]
-//! [40]
+#! [40]
unix:MOC_DIR = ../myproject/tmp
win32:MOC_DIR = c:/myproject/tmp
-//! [40]
+#! [40]
-//! [41]
+#! [41]
unix:OBJECTS_DIR = ../myproject/tmp
win32:OBJECTS_DIR = c:/myproject/tmp
-//! [41]
+#! [41]
-//! [42]
+#! [42]
app {
# Conditional code for 'app' template here
}
-//! [42]
+#! [42]
-//! [43]
+#! [43]
FRAMEWORK_HEADERS.version = Versions
FRAMEWORK_HEADERS.files = path/to/header_one.h path/to/header_two.h
FRAMEWORK_HEADERS.path = Headers
QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
-//! [43]
+#! [43]
-//! [44]
+#! [44]
QMAKE_BUNDLE_EXTENSION = .myframework
-//! [44]
+#! [44]
-//! [45]
+#! [45]
QMAKE_RESOURCE_FLAGS += -threshold 0 -compress 9
-//! [45]
+#! [45]
-//! [46]
+#! [46]
QMAKE_UIC = uic -L /path/to/plugin
-//! [46]
+#! [46]
-//! [47]
+#! [47]
QT -= gui # Only the core module is used.
-//! [47]
+#! [47]
-//! [48]
+#! [48]
unix:RCC_DIR = ../myproject/resources
win32:RCC_DIR = c:/myproject/resources
-//! [48]
+#! [48]
-//! [49]
+#! [49]
SOURCES = myclass.cpp \
login.cpp \
mainwindow.cpp
-//! [49]
+#! [49]
-//! [50]
+#! [50]
SUBDIRS = kernel \
tools
-//! [50]
+#! [50]
-//! [51]
+#! [51]
CONFIG += ordered
-//! [51]
+#! [51]
-//! [52]
+#! [52]
TEMPLATE = app
TARGET = myapp
SOURCES = main.cpp
-//! [52]
+#! [52]
-//! [53]
+#! [53]
TEMPLATE = lib
SOURCES = main.cpp
TARGET = mylib
-//! [53]
+#! [53]
-//! [54]
+#! [54]
unix:UI_DIR = ../myproject/ui
win32:UI_DIR = c:/myproject/ui
-//! [54]
+#! [54]
-//! [55]
+#! [55]
unix:UI_HEADERS_DIR = ../myproject/ui/include
win32:UI_HEADERS_DIR = c:/myproject/ui/include
-//! [55]
+#! [55]
-//! [56]
+#! [56]
unix:UI_SOURCES_DIR = ../myproject/ui/src
win32:UI_SOURCES_DIR = c:/myproject/ui/src
-//! [56]
+#! [56]
-//! [57]
+#! [57]
VERSION = 1.2.3
-//! [57]
+#! [57]
-//! [58]
+#! [58]
YACCSOURCES = moc.y
-//! [58]
+#! [58]
-//! [59]
+#! [59]
FILE = /etc/passwd
FILENAME = $$basename(FILE) #passwd
-//! [59]
+#! [59]
-//! [60]
+#! [60]
CONFIG = debug
CONFIG += release
CONFIG(release, debug|release):message(Release build!) #will print
CONFIG(debug, debug|release):message(Debug build!) #no print
-//! [60]
+#! [60]
-//! [61]
+#! [61]
contains( drivers, network ) {
# drivers contains 'network'
message( "Configuring for network build..." )
HEADERS += network.h
SOURCES += network.cpp
}
-//! [61]
+#! [61]
-//! [62]
+#! [62]
error(An error has occurred in the configuration process.)
-//! [62]
+#! [62]
-//! [63]
+#! [63]
exists( $(QTDIR)/lib/libqt-mt* ) {
message( "Configuring for multi-threaded Qt..." )
CONFIG += thread
}
-//! [63]
+#! [63]
-//! [64]
+#! [64]
MY_VAR = one two three four
MY_VAR2 = $$join(MY_VAR, " -L", -L) -Lfive
MY_VAR3 = $$member(MY_VAR, 2) $$find(MY_VAR, t.*)
-//! [64]
+#! [64]
-//! [65]
+#! [65]
LIST = 1 2 3
for(a, LIST):exists(file.$${a}):message(I see a file.$${a}!)
-//! [65]
+#! [65]
-//! [66]
+#! [66]
include( shared.pri )
OPTIONS = standard custom
!include( options.pri ) {
message( "No custom build options specified" )
OPTIONS -= custom
}
-//! [66]
+#! [66]
-//! [67]
+#! [67]
isEmpty( CONFIG ) {
CONFIG += qt warn_on debug
}
-//! [67]
+#! [67]
-//! [68]
+#! [68]
message( "This is a message" )
-//! [68]
+#! [68]
-//! [69]
+#! [69]
!build_pass:message( "This is a message" )
-//! [69]
+#! [69]
-//! [70]
+#! [70]
This is a test.
-//! [70]
+#! [70]
-//! [71]
+#! [71]
system(ls /bin):HAS_BIN=FALSE
-//! [71]
+#! [71]
-//! [72]
+#! [72]
UNAME = $$system(uname -s)
contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me )
-//! [72]
+#! [72]
-//! [73]
+#! [73]
ARGS = 1 2 3 2 5 1
ARGS = $$unique(ARGS) #1 2 3 5
-//! [73]
+#! [73]
-//! [74]
+#! [74]
qmake -set VARIABLE VALUE
-//! [74]
+#! [74]
-//! [75]
+#! [75]
qmake -query VARIABLE
qmake -query #queries all current VARIABLE/VALUE pairs..
-//! [75]
+#! [75]
-//! [76]
+#! [76]
qmake -query "1.06a/VARIABLE"
-//! [76]
+#! [76]
-//! [77]
+#! [77]
qmake -query "QT_INSTALL_PREFIX"
-//! [77]
+#! [77]
-//! [78]
+#! [78]
QMAKE_VERS = $$[QMAKE_VERSION]
-//! [78]
+#! [78]
-//! [79]
+#! [79]
documentation.path = /usr/local/program/doc
documentation.files = docs/*
-//! [79]
+#! [79]
-//! [80]
+#! [80]
INSTALLS += documentation
-//! [80]
+#! [80]
-//! [81]
+#! [81]
unix:documentation.extra = create_docs; mv master.doc toc.doc
-//! [81]
+#! [81]
-//! [82]
+#! [82]
target.path = /usr/local/myprogram
INSTALLS += target
-//! [82]
+#! [82]
-//! [83]
+#! [83]
CONFIG += create_prl
-//! [83]
+#! [83]
-//! [84]
+#! [84]
CONFIG += link_prl
-//! [84]
+#! [84]
-//! [85]
+#! [85]
QMAKE_EXT_MOC = .mymoc
-//! [85]
+#! [85]
-//! [86]
+#! [86]
mytarget.target = .buildfile
mytarget.commands = touch $$mytarget.target
mytarget.depends = mytarget2
mytarget2.commands = @echo Building $$mytarget.target
-//! [86]
+#! [86]
-//! [87]
+#! [87]
QMAKE_EXTRA_TARGETS += mytarget mytarget2
-//! [87]
+#! [87]
-//! [88]
+#! [88]
new_moc.output = moc_${QMAKE_FILE_BASE}.cpp
new_moc.commands = moc ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT}
new_moc.depend_command = g++ -E -M ${QMAKE_FILE_NAME} | sed "s,^.*: ,,"
new_moc.input = NEW_HEADERS
QMAKE_EXTRA_COMPILERS += new_moc
-//! [88]
+#! [88]
-//! [89]
+#! [89]
TARGET = myapp
-//! [89]
+#! [89]
-//! [90]
+#! [90]
DEFINES += QT_DLL
-//! [90]
+#! [90]
-//! [91]
+#! [91]
DEFINES -= QT_DLL
-//! [91]
+#! [91]
-//! [92]
+#! [92]
DEFINES *= QT_DLL
-//! [92]
+#! [92]
-//! [93]
+#! [93]
DEFINES ~= s/QT_[DT].+/QT
-//! [93]
+#! [93]
-//! [94]
+#! [94]
EVERYTHING = $$SOURCES $$HEADERS
message("The project contains the following files:")
message($$EVERYTHING)
-//! [94]
+#! [94]
-//! [95]
+#! [95]
win32:DEFINES += QT_DLL
-//! [95]
+#! [95]
-//! [96]
+#! [96]
win32:xml {
message(Building for Windows)
SOURCES += xmlhandler_win.cpp
@@ -609,146 +609,128 @@ win32:xml {
} else {
message("Unknown configuration")
}
-//! [96]
+#! [96]
-//! [97]
+#! [97]
MY_VARIABLE = value
-//! [97]
+#! [97]
-//! [98]
+#! [98]
MY_DEFINES = $$DEFINES
-//! [98]
+#! [98]
-//! [99]
+#! [99]
MY_DEFINES = $${DEFINES}
-//! [99]
+#! [99]
-//! [100]
+#! [100]
TARGET = myproject_$${TEMPLATE}
-//! [100]
+#! [100]
-//! [101]
+#! [101]
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
-//! [101]
+#! [101]
-//! [102]
+#! [102]
defineReplace(functionName){
#function code
}
-//! [102]
+#! [102]
-//! [103]
+#! [103]
CONFIG += myfeatures
-//! [103]
-
-
-//! [104]
-// Add C includes here
-
-#if defined __cplusplus
-// Add C++ includes here
-#include <stdlib>
-#include <iostream>
-#include <vector>
-#include <QApplication> // Qt includes
-#include <QPushButton>
-#include <QLabel>
-#include "thirdparty/include/libmain.h"
-#include "my_stable_class.h"
-...
-#endif
-//! [104]
+#! [103]
-//! [105]
+#! [105]
PRECOMPILED_HEADER = stable.h
-//! [105]
+#! [105]
-//! [106]
+#! [106]
precompile_header:!isEmpty(PRECOMPILED_HEADER) {
DEFINES += USING_PCH
}
-//! [106]
+#! [106]
-//! [107]
+#! [107]
PRECOMPILED_HEADER = window.h
SOURCES = window.cpp
-//! [107]
+#! [107]
-//! [108]
+#! [108]
SOURCES += hello.cpp
-//! [108]
+#! [108]
-//! [109]
+#! [109]
SOURCES += hello.cpp
SOURCES += main.cpp
-//! [109]
+#! [109]
-//! [110]
+#! [110]
SOURCES = hello.cpp \
main.cpp
-//! [110]
+#! [110]
-//! [111]
+#! [111]
HEADERS += hello.h
SOURCES += hello.cpp
SOURCES += main.cpp
-//! [111]
+#! [111]
-//! [112]
+#! [112]
TARGET = helloworld
-//! [112]
+#! [112]
-//! [113]
+#! [113]
CONFIG += qt
HEADERS += hello.h
SOURCES += hello.cpp
SOURCES += main.cpp
-//! [113]
+#! [113]
-//! [114]
+#! [114]
qmake -o Makefile hello.pro
-//! [114]
+#! [114]
-//! [115]
+#! [115]
qmake -tp vc hello.pro
-//! [115]
+#! [115]
-//! [116]
+#! [116]
CONFIG += qt debug
HEADERS += hello.h
SOURCES += hello.cpp
SOURCES += main.cpp
-//! [116]
+#! [116]
-//! [117]
+#! [117]
win32 {
SOURCES += hellowin.cpp
}
-//! [117]
+#! [117]
-//! [118]
+#! [118]
CONFIG += qt debug
HEADERS += hello.h
SOURCES += hello.cpp
@@ -759,17 +741,17 @@ win32 {
unix {
SOURCES += hellounix.cpp
}
-//! [118]
+#! [118]
-//! [119]
+#! [119]
!exists( main.cpp ) {
error( "No main.cpp file found" )
}
-//! [119]
+#! [119]
-//! [120]
+#! [120]
CONFIG += qt debug
HEADERS += hello.h
SOURCES += hello.cpp
@@ -783,19 +765,19 @@ unix {
!exists( main.cpp ) {
error( "No main.cpp file found" )
}
-//! [120]
+#! [120]
-//! [121]
+#! [121]
win32 {
debug {
CONFIG += console
}
}
-//! [121]
+#! [121]
-//! [122]
+#! [122]
CONFIG += qt debug
HEADERS += hello.h
SOURCES += hello.cpp
@@ -812,10 +794,10 @@ unix {
win32:debug {
CONFIG += console
}
-//! [122]
+#! [122]
-//! [123]
+#! [123]
TEMPLATE = app
DESTDIR = c:/helloapp
HEADERS += hello.h
@@ -823,32 +805,32 @@ SOURCES += hello.cpp
SOURCES += main.cpp
DEFINES += QT_DLL
CONFIG += qt warn_on release
-//! [123]
+#! [123]
-//! [124]
+#! [124]
make all
-//! [124]
+#! [124]
-//! [125]
+#! [125]
make
-//! [125]
+#! [125]
-//! [126]
+#! [126]
make install
-//! [126]
+#! [126]
-//! [127]
+#! [127]
CONFIG(debug, debug|release) {
mac: TARGET = $$join(TARGET,,,_debug)
win32: TARGET = $$join(TARGET,,d)
}
-//! [127]
+#! [127]
-//! [128]
+#! [128]
customplugin.files = customimageplugin.dll
customplugin.files += c:\myplugins\othercustomimageplugin.dll
customplugin.path = imageformats
@@ -857,50 +839,50 @@ dynamiclibrary.path = \sys\bin
globalplugin.files = someglobalimageplugin.dll
globalplugin.path = \resource\qt\plugins\imageformats
DEPLOYMENT += customplugin dynamiclibrary globalplugin
-//! [128]
+#! [128]
-//! [129]
+#! [129]
TARGET.EPOCALLOWDLLDATA = 1
-//! [129]
+#! [129]
-//! [130]
+#! [130]
TARGET.EPOCHEAPSIZE = 10000 10000000
TARGET.EPOCSTACKSIZE = 0x8000
-//! [130]
+#! [130]
-//! [131]
+#! [131]
QMAKE_CXXFLAGS.CW += -O2
QMAKE_CXXFLAGS.ARMCC += -O0
-//! [131]
+#! [131]
-//! [132]
+#! [132]
TARGET.UID2 = 0x00000001
TARGET.UID3 = 0x00000002
TARGET.SID = 0x00000003
TARGET.VID = 0x00000004
-//! [132]
+#! [132]
-//! [133]
+#! [133]
TARGET.CAPABILITY += AllFiles
-//! [133]
+#! [133]
-//! [134]
+#! [134]
TARGET.CAPABILITY = ALL -TCB -DRM -AllFiles
-//! [134]
+#! [134]
-//! [135]
+#! [135]
TARGET.EPOCHEAPSIZE = 10000 10000000
-//! [135]
+#! [135]
-//! [136]
+#! [136]
TARGET.EPOCSTACKSIZE = 0x8000
-//! [136]
+#! [136]
-//! [137]
+#! [137]
MMP_RULES += "DEFFILE hello.def"
-//! [137]
+#! [137]
-//! [138]
+#! [138]
myBlock = \
"START RESOURCE foo.rss" \
"TARGET bar" \
@@ -911,37 +893,37 @@ myBlock = \
"END"
MMP_RULES += myBlock
-//! [138]
+#! [138]
-//! [139]
+#! [139]
myIfdefBlock = \
"$${LITERAL_HASH}ifdef WINSCW" \
"DEFFILE hello_winscw.def" \
"$${LITERAL_HASH}endif"
MMP_RULES += myIfdefBlock
-//! [139]
+#! [139]
-//! [140]
+#! [140]
somelib.files = somelib.dll
somelib.path = \sys\bin
somelib.pkg_prerules = "(0x12345678), 2, 2, 0, {\"Some Package\"}" \
"(0x87654321), 1, *, * ~ 2, 2, 0, {\"Some Other Package\"}"
justdep.pkg_prerules = "(0xAAAABBBB), 0, 2, 0, {\"My Framework\"}"
DEPLOYMENT += somelib justdep
-//! [140]
+#! [140]
-//! [141]
+#! [141]
default_deployment.pkg_prerules -= pkg_platform_dependencies
my_deployment.pkg_prerules = "[0x11223344],0,0,0,{\"SomeSpecificDeviceID\"}"
DEPLOYMENT += my_deployment
-//! [141]
+#! [141]
-//! [142]
+#! [142]
DEPLOYMENT_PLUGIN += qjpeg
-//! [142]
+#! [142]
-//! [143]
+#! [143]
myextension = \
"start extension myextension" \
"$${LITERAL_HASH}if defined(WINSCW)" \
@@ -950,28 +932,28 @@ myextension = \
"option MYOPTION bar" \
"end"
BLD_INF_RULES.prj_extensions += myextension
-//! [143]
+#! [143]
-//! [144]
+#! [144]
RSS_RULES += "hidden = KAppIsHidden;"
-//! [144]
+#! [144]
-//! [145]
+#! [145]
myrssrules = \
"hidden = KAppIsHidden;" \
"launch = KAppLaunchInBackground;" \
RSS_RULES += myrssrules
-//! [145]
+#! [145]
-//! [146]
+#! [146]
DEPLOYMENT.installer_header = 0x12345678
-//! [146]
+#! [146]
-//! [147]
+#! [147]
DEPLOYMENT.installer_header = "$${LITERAL_HASH}{\"My Application Installer\"},(0x12345678),1,0,0"
-//! [147]
+#! [147]
-//! [148]
+#! [148]
# Set conditional libraries
LIB.MARM = "LIBRARY myarm.lib"
LIB.WINSCW = "LIBRARY mywinscw.lib"
@@ -982,62 +964,62 @@ MYCONDITIONS = MARM WINSCW
MYVARIABLES = LIB
addMMPRules(MYCONDITIONS, MYVARIABLES)
-//! [148]
+#! [148]
-//! [149]
+#! [149]
SUBDIRS += my_executable my_library
my_executable.subdir = app
my_executable.depends = my_library
my_library.subdir = lib
-//! [149]
+#! [149]
-//! [150]
+#! [150]
symbian {
SUBDIRS += emulator_dll
emulator_dll.condition = WINSCW
}
-//! [150]
+#! [150]
-//! [151]
+#! [151]
RSS_RULES.service_list += "uid = 0x12345678; datatype_list = \{\}; opaque_data = r_my_icon;"
RSS_RULES.footer +="RESOURCE CAPTION_AND_ICON_INFO r_my_icon \{ icon_file =\"$$PWD/my_icon.svg\"; \}"
-//! [151]
+#! [151]
-//! [152]
+#! [152]
my_exports = \
"foo.h /epoc32/include/mylib/foo.h" \
"bar.h /epoc32/include/mylib/bar.h"
BLD_INF_RULES.prj_exports += my_exports
-//! [152]
+#! [152]
-//! [153]
+#! [153]
my_note.pkg_postrules.installer = "\"myinstallnote.txt\" - \"\", FILETEXT, TEXTCONTINUE"
DEPLOYMENT += my_note
-//! [153]
+#! [153]
-//! [154]
+#! [154]
DEPLOYMENT -= default_bin_deployment default_resource_deployment default_reg_deployment
-//! [154]
+#! [154]
-//! [155]
+#! [155]
default_bin_deployment.flags += FILERUN RUNINSTALL
dep_note.files = install_note.txt
dep_note.flags = FILETEXT TEXTEXIT
DEPLOYMENT += dep_note
-//! [155]
+#! [155]
-//! [156]
+#! [156]
DEPLOYMENT.display_name = My Qt App
-//! [156]
+#! [156]
-//! [157]
+#! [157]
packagesExist(sqlite3 QtNetwork QtDeclarative) {
DEFINES += USE_FANCY_UI
}
-//! [157]
+#! [157]
-//! [158]
+#! [158]
#ifdef USE_FANCY_UI
// Use the fancy UI, as we have extra packages available
#endif
-//! [158]
+#! [158]
diff --git a/doc/src/snippets/code/doc_src_qnamespace.cpp b/doc/src/snippets/code/doc_src_qnamespace.cpp
new file mode 100644
index 0000000..c512862
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qnamespace.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+enum CustomEventPriority
+{
+ // An important event
+ ImportantEventPriority = Qt::HighEventPriority,
+
+ // A more important event
+ MoreImportantEventPriority = ImportantEventPriority + 1,
+
+ // A critical event
+ CriticalEventPriority = 100 * MoreImportantEventPriority,
+
+ // Not that important
+ StatusEventPriority = Qt::LowEventPriority,
+
+ // These are less important than Status events
+ IdleProcessingDoneEventPriority = StatusEventPriority - 1
+};
+//! [1]
diff --git a/doc/src/snippets/code/doc_src_qnamespace.qdoc b/doc/src/snippets/code/doc_src_qnamespace.qdoc
index a1bd0b7..6b5ce6a 100644
--- a/doc/src/snippets/code/doc_src_qnamespace.qdoc
+++ b/doc/src/snippets/code/doc_src_qnamespace.qdoc
@@ -41,24 +41,3 @@
//! [0]
QObject::connect: Cannot queue arguments of type 'MyType'
//! [0]
-
-
-//! [1]
-enum CustomEventPriority
-{
- // An important event
- ImportantEventPriority = Qt::HighEventPriority,
-
- // A more important event
- MoreImportantEventPriority = ImportantEventPriority + 1,
-
- // A critical event
- CriticalEventPriority = 100 * MoreImportantEventPriority,
-
- // Not that important
- StatusEventPriority = Qt::LowEventPriority,
-
- // These are less important than Status events
- IdleProcessingDoneEventPriority = StatusEventPriority - 1
-};
-//! [1]
diff --git a/doc/src/snippets/code/doc_src_qpair.qdoc b/doc/src/snippets/code/doc_src_qpair.cpp
index a9a061e..a9a061e 100644
--- a/doc/src/snippets/code/doc_src_qpair.qdoc
+++ b/doc/src/snippets/code/doc_src_qpair.cpp
diff --git a/doc/src/snippets/code/doc_src_qplugin.qdoc b/doc/src/snippets/code/doc_src_qplugin.cpp
index fdacc08..fdacc08 100644
--- a/doc/src/snippets/code/doc_src_qplugin.qdoc
+++ b/doc/src/snippets/code/doc_src_qplugin.cpp
diff --git a/doc/src/snippets/code/doc_src_qplugin.pro b/doc/src/snippets/code/doc_src_qplugin.pro
new file mode 100644
index 0000000..f3444e2
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qplugin.pro
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+#! [3]
+TEMPLATE = app
+QTPLUGIN += qjpeg qgif qmng # image formats
+#! [3]
diff --git a/doc/src/snippets/code/doc_src_qset.qdoc b/doc/src/snippets/code/doc_src_qset.cpp
index 4a4953d..4a4953d 100644
--- a/doc/src/snippets/code/doc_src_qset.qdoc
+++ b/doc/src/snippets/code/doc_src_qset.cpp
diff --git a/doc/src/snippets/code/doc_src_qsignalspy.qdoc b/doc/src/snippets/code/doc_src_qsignalspy.cpp
index 12462e2..12462e2 100644
--- a/doc/src/snippets/code/doc_src_qsignalspy.qdoc
+++ b/doc/src/snippets/code/doc_src_qsignalspy.cpp
diff --git a/doc/src/snippets/code/doc_src_qt3support.qdoc b/doc/src/snippets/code/doc_src_qt3support.cpp
index 9e0f682..196efd4 100644
--- a/doc/src/snippets/code/doc_src_qt3support.qdoc
+++ b/doc/src/snippets/code/doc_src_qt3support.cpp
@@ -41,8 +41,3 @@
//! [0]
#include <Qt3Support>
//! [0]
-
-
-//! [1]
-QT += qt3support
-//! [1]
diff --git a/doc/src/snippets/code/doc_src_qt3support.pro b/doc/src/snippets/code/doc_src_qt3support.pro
new file mode 100644
index 0000000..20fcc14
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qt3support.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QT += qt3support
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qt3to4.cpp b/doc/src/snippets/code/doc_src_qt3to4.cpp
new file mode 100644
index 0000000..d8eb5b4
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qt3to4.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [2]
+using namespace Qt;
+//! [2]
diff --git a/doc/src/snippets/code/doc_src_qt4-accessibility.qdoc b/doc/src/snippets/code/doc_src_qt4-accessibility.cpp
index efbbc5a..efbbc5a 100644
--- a/doc/src/snippets/code/doc_src_qt4-accessibility.qdoc
+++ b/doc/src/snippets/code/doc_src_qt4-accessibility.cpp
diff --git a/doc/src/snippets/code/doc_src_qt4-arthur.qdoc b/doc/src/snippets/code/doc_src_qt4-arthur.cpp
index 6268309..6268309 100644
--- a/doc/src/snippets/code/doc_src_qt4-arthur.qdoc
+++ b/doc/src/snippets/code/doc_src_qt4-arthur.cpp
diff --git a/doc/src/snippets/code/doc_src_qt4-intro.qdoc b/doc/src/snippets/code/doc_src_qt4-intro.cpp
index 45da7d0..76ed4a5 100644
--- a/doc/src/snippets/code/doc_src_qt4-intro.qdoc
+++ b/doc/src/snippets/code/doc_src_qt4-intro.cpp
@@ -38,21 +38,6 @@
**
****************************************************************************/
-//! [0]
-QT -= gui
-//! [0]
-
-
-//! [1]
-QT += network opengl sql qt3support
-//! [1]
-
-
-//! [2]
-CONFIG += uic3
-//! [2]
-
-
//! [3]
#include <QClassName>
//! [3]
@@ -119,23 +104,3 @@ safeLabel->setText("Hello world!");
delete label;
// safeLabel is now 0, whereas label is a dangling pointer
//! [12]
-
-
-//! [13]
-QT += qt3support
-//! [13]
-
-
-//! [14]
-DEFINES += QT3_SUPPORT
-//! [14]
-
-
-//! [15]
-DEFINES += QT3_SUPPORT_WARNINGS
-//! [15]
-
-
-//! [16]
-DEFINES += QT3_SUPPORT
-//! [16]
diff --git a/doc/src/snippets/code/doc_src_qt4-intro.pro b/doc/src/snippets/code/doc_src_qt4-intro.pro
new file mode 100644
index 0000000..40853b3
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qt4-intro.pro
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 -= gui
+#! [0]
+
+
+#! [1]
+QT += network opengl sql qt3support
+#! [1]
+
+
+#! [2]
+CONFIG += uic3
+#! [2]
+
+
+#! [13]
+QT += qt3support
+#! [13]
+
+
+#! [14]
+DEFINES += QT3_SUPPORT
+#! [14]
+
+
+#! [15]
+DEFINES += QT3_SUPPORT_WARNINGS
+#! [15]
+
+
+#! [16]
+DEFINES += QT3_SUPPORT
+#! [16]
diff --git a/doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc b/doc/src/snippets/code/doc_src_qt4-mainwindow.cpp
index d0c758e..d0c758e 100644
--- a/doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc
+++ b/doc/src/snippets/code/doc_src_qt4-mainwindow.cpp
diff --git a/doc/src/snippets/code/doc_src_qt4-sql.qdoc b/doc/src/snippets/code/doc_src_qt4-sql.cpp
index cbcfb2d..cbcfb2d 100644
--- a/doc/src/snippets/code/doc_src_qt4-sql.qdoc
+++ b/doc/src/snippets/code/doc_src_qt4-sql.cpp
diff --git a/doc/src/snippets/code/doc_src_qt4-styles.qdoc b/doc/src/snippets/code/doc_src_qt4-styles.cpp
index effe3cd..effe3cd 100644
--- a/doc/src/snippets/code/doc_src_qt4-styles.qdoc
+++ b/doc/src/snippets/code/doc_src_qt4-styles.cpp
diff --git a/doc/src/snippets/code/doc_src_qt4-tulip.qdoc b/doc/src/snippets/code/doc_src_qt4-tulip.cpp
index 83b1210..83b1210 100644
--- a/doc/src/snippets/code/doc_src_qt4-tulip.qdoc
+++ b/doc/src/snippets/code/doc_src_qt4-tulip.cpp
diff --git a/doc/src/snippets/code/doc_src_qtcore.qdoc b/doc/src/snippets/code/doc_src_qtcore.cpp
index 35916ea..35916ea 100644
--- a/doc/src/snippets/code/doc_src_qtcore.qdoc
+++ b/doc/src/snippets/code/doc_src_qtcore.cpp
diff --git a/doc/src/snippets/code/doc_src_qtdbus.qdoc b/doc/src/snippets/code/doc_src_qtdbus.cpp
index 20ff513..2143b5b 100644
--- a/doc/src/snippets/code/doc_src_qtdbus.qdoc
+++ b/doc/src/snippets/code/doc_src_qtdbus.cpp
@@ -41,8 +41,3 @@
//! [0]
#include <QtDBus>
//! [0]
-
-
-//! [1]
-QT += dbus
-//! [1]
diff --git a/doc/src/snippets/code/doc_src_qtdbus.pro b/doc/src/snippets/code/doc_src_qtdbus.pro
new file mode 100644
index 0000000..6607d7d
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtdbus.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QT += dbus
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qtdesigner.qdoc b/doc/src/snippets/code/doc_src_qtdesigner.cpp
index a37b77f..562002e 100644
--- a/doc/src/snippets/code/doc_src_qtdesigner.qdoc
+++ b/doc/src/snippets/code/doc_src_qtdesigner.cpp
@@ -43,11 +43,6 @@
//! [0]
-//! [1]
-CONFIG += designer
-//! [1]
-
-
//! [2]
QDesignerMemberSheetExtension *memberSheet = 0;
QExtensionManager manager = formEditor->extensionManager();
diff --git a/doc/src/snippets/code/doc_src_qtdesigner.pro b/doc/src/snippets/code/doc_src_qtdesigner.pro
new file mode 100644
index 0000000..dc962ef
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtdesigner.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+CONFIG += designer
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qtestevent.qdoc b/doc/src/snippets/code/doc_src_qtestevent.cpp
index fd1c819..fd1c819 100644
--- a/doc/src/snippets/code/doc_src_qtestevent.qdoc
+++ b/doc/src/snippets/code/doc_src_qtestevent.cpp
diff --git a/doc/src/snippets/code/doc_src_qtestlib.cpp b/doc/src/snippets/code/doc_src_qtestlib.cpp
new file mode 100644
index 0000000..bd98807
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtestlib.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 MyFirstTest: public QObject
+{
+ Q_OBJECT
+private slots:
+ void initTestCase()
+ { qDebug("called before everything else"); }
+ void myFirstTest()
+ { QVERIFY(1 == 1); }
+ void mySecondTest()
+ { QVERIFY(1 != 2); }
+ void cleanupTestCase()
+ { qDebug("called after myFirstTest and mySecondTest"); }
+};
+//! [0]
+
+
+//! [8]
+void TestQString::toUpper()
+{
+ QString str = "Hello";
+ QVERIFY(str.toUpper() == "HELLO");
+}
+//! [8]
+
+
+//! [11]
+QCOMPARE(QString("hello").toUpper(), QString("HELLO"));
+QCOMPARE(QString("Hello").toUpper(), QString("HELLO"));
+QCOMPARE(QString("HellO").toUpper(), QString("HELLO"));
+QCOMPARE(QString("HELLO").toUpper(), QString("HELLO"));
+//! [11]
+
+//! [12]
+class MyFirstBenchmark: public QObject
+{
+ Q_OBJECT
+private slots:
+ void myFirstBenchmark()
+ {
+ QString string1;
+ QString string2;
+ QBENCHMARK {
+ string1.localeAwareCompare(string2);
+ }
+ }
+};
+//! [12]
diff --git a/doc/src/snippets/code/doc_src_qtestlib.pro b/doc/src/snippets/code/doc_src_qtestlib.pro
new file mode 100644
index 0000000..a8fc56a
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtestlib.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QT += testlib
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qtestlib.qdoc b/doc/src/snippets/code/doc_src_qtestlib.qdoc
index 80b7d92..92d528e 100644
--- a/doc/src/snippets/code/doc_src_qtestlib.qdoc
+++ b/doc/src/snippets/code/doc_src_qtestlib.qdoc
@@ -38,28 +38,6 @@
**
****************************************************************************/
-//! [0]
-class MyFirstTest: public QObject
-{
- Q_OBJECT
-private slots:
- void initTestCase()
- { qDebug("called before everything else"); }
- void myFirstTest()
- { QVERIFY(1 == 1); }
- void mySecondTest()
- { QVERIFY(1 != 2); }
- void cleanupTestCase()
- { qDebug("called after myFirstTest and mySecondTest"); }
-};
-//! [0]
-
-
-//! [1]
-QT += testlib
-//! [1]
-
-
//! [2]
testname [options] [testfunctions[:testdata]]...
//! [2]
@@ -91,15 +69,6 @@ set LIB=C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SD
//! [7]
-//! [8]
-void TestQString::toUpper()
-{
- QString str = "Hello";
- QVERIFY(str.toUpper() == "HELLO");
-}
-//! [8]
-
-
//! [9]
/myTestDirectory$ qmake -project "CONFIG += qtestlib"
/myTestDirectory$ qmake
@@ -116,27 +85,3 @@ PASS : TestQString::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of TestQString *********
//! [10]
-
-
-//! [11]
-QCOMPARE(QString("hello").toUpper(), QString("HELLO"));
-QCOMPARE(QString("Hello").toUpper(), QString("HELLO"));
-QCOMPARE(QString("HellO").toUpper(), QString("HELLO"));
-QCOMPARE(QString("HELLO").toUpper(), QString("HELLO"));
-//! [11]
-
-//! [12]
-class MyFirstBenchmark: public QObject
-{
- Q_OBJECT
-private slots:
- void myFirstBenchmark()
- {
- QString string1;
- QString string2;
- QBENCHMARK {
- string1.localeAwareCompare(string2);
- }
- }
-};
-//! [12]
diff --git a/doc/src/snippets/code/doc_src_qtgui.qdoc b/doc/src/snippets/code/doc_src_qtgui.pro
index 370529a..dd3405c 100644
--- a/doc/src/snippets/code/doc_src_qtgui.qdoc
+++ b/doc/src/snippets/code/doc_src_qtgui.pro
@@ -38,6 +38,6 @@
**
****************************************************************************/
-//! [0]
+#! [0]
#include <QtGui>
-//! [0]
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_qthelp.cpp b/doc/src/snippets/code/doc_src_qthelp.cpp
new file mode 100644
index 0000000..2825738
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qthelp.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+#include <QtHelp>
+//! [0]
+
+//! [6]
+QHelpEngineCore helpEngine("mycollection.qhc");
+...
+
+// get all file references for the identifier
+QMap<QString, QUrl> links =
+ helpEngine.linksForIdentifier(QLatin1String("MyDialog::ChangeButton"));
+
+// If help is available for this keyword, get the help data
+// of the first file reference.
+if (links.count()) {
+ QByteArray helpData = helpEngine->fileData(links.constBegin().value());
+ // show the documentation to the user
+ if (!helpData.isEmpty())
+ displayHelp(helpData);
+}
+//! [6]
+
+
diff --git a/doc/src/snippets/code/doc_src_qthelp.qdoc b/doc/src/snippets/code/doc_src_qthelp.qdoc
index 4ad2100..ff25d19 100644
--- a/doc/src/snippets/code/doc_src_qthelp.qdoc
+++ b/doc/src/snippets/code/doc_src_qthelp.qdoc
@@ -38,11 +38,6 @@
**
****************************************************************************/
-//! [0]
-#include <QtHelp>
-//! [0]
-
-
//! [1]
CONFIG += help
//! [1]
@@ -87,25 +82,6 @@ qcollectiongenerator mycollection.qhcp -o mycollection.qhc
//! [5]
-//! [6]
-QHelpEngineCore helpEngine("mycollection.qhc");
-...
-
-// get all file references for the identifier
-QMap<QString, QUrl> links =
- helpEngine.linksForIdentifier(QLatin1String("MyDialog::ChangeButton"));
-
-// If help is available for this keyword, get the help data
-// of the first file reference.
-if (links.count()) {
- QByteArray helpData = helpEngine->fileData(links.constBegin().value());
- // show the documentation to the user
- if (!helpData.isEmpty())
- displayHelp(helpData);
-}
-//! [6]
-
-
//! [7]
<?xml version="1.0" encoding="UTF-8"?>
<QtHelpProject version="1.0">
diff --git a/doc/src/snippets/code/doc_src_qtmultimedia.qdoc b/doc/src/snippets/code/doc_src_qtmultimedia.cpp
index 76fb9cd..3f25c11 100644
--- a/doc/src/snippets/code/doc_src_qtmultimedia.qdoc
+++ b/doc/src/snippets/code/doc_src_qtmultimedia.cpp
@@ -38,11 +38,6 @@
**
****************************************************************************/
-//! [0]
-QT += multimedia
-//! [0]
-
-
//! [1]
#include <QtMultimedia>
//! [1]
diff --git a/doc/src/snippets/code/doc_src_qtmultimedia.pro b/doc/src/snippets/code/doc_src_qtmultimedia.pro
new file mode 100644
index 0000000..b23c994
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtmultimedia.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 += multimedia
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_qtnetwork.qdoc b/doc/src/snippets/code/doc_src_qtnetwork.cpp
index 42d1808..7100f1a 100644
--- a/doc/src/snippets/code/doc_src_qtnetwork.qdoc
+++ b/doc/src/snippets/code/doc_src_qtnetwork.cpp
@@ -38,11 +38,6 @@
**
****************************************************************************/
-//! [0]
-QT += network
-//! [0]
-
-
//! [1]
#include <QtNetwork>
//! [1]
diff --git a/doc/src/snippets/code/doc_src_qtnetwork.pro b/doc/src/snippets/code/doc_src_qtnetwork.pro
new file mode 100644
index 0000000..f6c3a5a
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtnetwork.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 += network
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_qtopengl.qdoc b/doc/src/snippets/code/doc_src_qtopengl.cpp
index 555d571..088b31b 100644
--- a/doc/src/snippets/code/doc_src_qtopengl.qdoc
+++ b/doc/src/snippets/code/doc_src_qtopengl.cpp
@@ -41,8 +41,3 @@
//! [0]
#include <QtOpenGL>
//! [0]
-
-
-//! [1]
-QT += opengl
-//! [1]
diff --git a/doc/src/snippets/code/doc_src_qtopengl.pro b/doc/src/snippets/code/doc_src_qtopengl.pro
new file mode 100644
index 0000000..97fbf28
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtopengl.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QT += opengl
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qtscript.cpp b/doc/src/snippets/code/doc_src_qtscript.cpp
new file mode 100644
index 0000000..de82029
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtscript.cpp
@@ -0,0 +1,568 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+#include <QtScript>
+//! [0]
+
+//! [13]
+Q_PROPERTY(bool enabled READ enabled WRITE setEnabled)
+//! [13]
+
+//! [18]
+QScriptValue myQObjectConstructor(QScriptContext *context, QScriptEngine *engine)
+{
+ // let the engine manage the new object's lifetime.
+ return engine->newQObject(new MyQObject(), QScriptEngine::ScriptOwnership);
+}
+//! [18]
+
+
+//! [19]
+class MyObject : public QObject
+{
+ Q_OBJECT
+
+public:
+ MyObject( ... );
+
+ void aNonScriptableFunction();
+
+public slots: // these functions (slots) will be available in QtScript
+ void calculate( ... );
+ void setEnabled( bool enabled );
+ bool isEnabled() const;
+
+private:
+ ....
+
+};
+//! [19]
+
+
+//! [20]
+class MyObject : public QObject
+{
+ Q_OBJECT
+
+ public:
+ Q_INVOKABLE void thisMethodIsInvokableInQtScript();
+ void thisMethodIsNotInvokableInQtScript();
+
+ ...
+};
+//! [20]
+
+
+//! [23]
+class MyObject : public QObject
+{
+ Q_OBJECT
+ // define the enabled property
+ Q_PROPERTY( bool enabled WRITE setEnabled READ isEnabled )
+
+public:
+ MyObject( ... );
+
+ void aNonScriptableFunction();
+
+public slots: // these functions (slots) will be available in QtScript
+ void calculate( ... );
+ void setEnabled( bool enabled );
+ bool isEnabled() const;
+
+private:
+ ....
+
+};
+//! [23]
+
+
+//! [24]
+Q_PROPERTY(int nonScriptableProperty READ foo WRITE bar SCRIPTABLE false)
+//! [24]
+
+
+//! [25]
+class MyObject : public QObject
+{
+ Q_OBJECT
+ // define the enabled property
+ Q_PROPERTY( bool enabled WRITE setEnabled READ isEnabled )
+
+public:
+ MyObject( ... );
+
+ void aNonScriptableFunction();
+
+public slots: // these functions (slots) will be available in QtScript
+ void calculate( ... );
+ void setEnabled( bool enabled );
+ bool isEnabled() const;
+
+signals: // the signals
+ void enabledChanged( bool newState );
+
+private:
+ ....
+
+};
+//! [25]
+
+
+//! [34]
+QScriptValue Person_ctor(QScriptContext *context, QScriptEngine *engine)
+{
+ QString name = context->argument(0).toString();
+ context->thisObject().setProperty("name", name);
+ return engine->undefinedValue();
+}
+//! [34]
+
+
+//! [35]
+QScriptValue Person_prototype_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QString name = context->thisObject().property("name").toString();
+ QString result = QString::fromLatin1("Person(name: %0)").arg(name);
+ return result;
+}
+//! [35]
+
+
+//! [36]
+QScriptEngine engine;
+QScriptValue ctor = engine.newFunction(Person_ctor);
+ctor.property("prototype").setProperty("toString", engine.newFunction(Person_prototype_toString));
+QScriptValue global = engine.globalObject();
+global.setProperty("Person", ctor);
+//! [36]
+
+
+//! [37]
+QScriptValue Employee_ctor(QScriptContext *context, QScriptEngine *engine)
+{
+ QScriptValue super = context->callee().property("prototype").property("constructor");
+ super.call(context->thisObject(), QScriptValueList() << context->argument(0));
+ context->thisObject().setProperty("salary", context->argument(1));
+ return engine->undefinedValue();
+}
+//! [37]
+
+
+//! [38]
+QScriptValue empCtor = engine.newFunction(Employee_ctor);
+empCtor.setProperty("prototype", global.property("Person").construct());
+global.setProperty("Employee", empCtor);
+//! [38]
+
+
+//! [39]
+Q_DECLARE_METATYPE(QPointF)
+Q_DECLARE_METATYPE(QPointF*)
+
+QScriptValue QPointF_prototype_x(QScriptContext *context, QScriptEngine *engine)
+{
+ // Since the point is not to be modified, it's OK to cast to a value here
+ QPointF point = qscriptvalue_cast<QPointF>(context->thisObject());
+ return point.x();
+}
+
+QScriptValue QPointF_prototype_setX(QScriptContext *context, QScriptEngine *engine)
+{
+ // Cast to a pointer to be able to modify the underlying C++ value
+ QPointF *point = qscriptvalue_cast<QPointF*>(context->thisObject());
+ if (!point)
+ return context->throwError(QScriptContext::TypeError, "QPointF.prototype.setX: this object is not a QPointF");
+ point->setX(context->argument(0).toNumber());
+ return engine->undefinedValue();
+}
+//! [39]
+
+
+//! [43]
+class MyObject : public QObject
+{
+ Q_OBJECT
+ ...
+};
+
+Q_DECLARE_METATYPE(MyObject*)
+
+QScriptValue myObjectToScriptValue(QScriptEngine *engine, MyObject* const &in)
+{ return engine->newQObject(in); }
+
+void myObjectFromScriptValue(const QScriptValue &object, MyObject* &out)
+{ out = qobject_cast<MyObject*>(object.toQObject()); }
+
+...
+
+qScriptRegisterMetaType(&engine, myObjectToScriptValue, myObjectFromScriptValue);
+//! [43]
+
+//! [44]
+QScriptValue QPoint_ctor(QScriptContext *context, QScriptEngine *engine)
+{
+ int x = context->argument(0).toInt32();
+ int y = context->argument(1).toInt32();
+ return engine->toScriptValue(QPoint(x, y));
+}
+
+...
+
+engine.globalObject().setProperty("QPoint", engine.newFunction(QPoint_ctor));
+//! [44]
+
+//! [45]
+QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine)
+{
+ QString result;
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ if (i > 0)
+ result.append(" ");
+ result.append(context->argument(i).toString());
+ }
+
+ QScriptValue calleeData = context->callee().data();
+ QPlainTextEdit *edit = qobject_cast<QPlainTextEdit*>(calleeData.toQObject());
+ edit->appendPlainText(result);
+
+ return engine->undefinedValue();
+}
+//! [45]
+
+//! [46]
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QScriptEngine eng;
+ QPlainTextEdit edit;
+
+ QScriptValue fun = eng.newFunction(myPrintFunction);
+ fun.setData(eng.newQObject(&edit));
+ eng.globalObject().setProperty("print", fun);
+
+ eng.evaluate("print('hello', 'world')");
+
+ edit.show();
+ return app.exec();
+}
+//! [46]
+
+
+//! [47]
+QScriptEngine eng;
+QLineEdit *edit = new QLineEdit(...);
+QScriptValue handler = eng.evaluate("(function(text) { print('text was changed to', text); })");
+qScriptConnect(edit, SIGNAL(textChanged(const QString &)), QScriptValue(), handler);
+//! [47]
+
+//! [48]
+QLineEdit *edit1 = new QLineEdit(...);
+QLineEdit *edit2 = new QLineEdit(...);
+
+QScriptValue handler = eng.evaluate("(function() { print('I am', this.name); })");
+QScriptValue obj1 = eng.newObject();
+obj1.setProperty("name", "the walrus");
+QScriptValue obj2 = eng.newObject();
+obj2.setProperty("name", "Sam");
+
+qScriptConnect(edit1, SIGNAL(returnPressed()), obj1, handler);
+qScriptConnect(edit2, SIGNAL(returnPressed()), obj2, handler);
+//! [48]
+
+//! [52]
+QScriptValue getProperty(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QString name = ctx->argument(0).toString();
+ return ctx->thisObject().property(name);
+}
+//! [52]
+
+//! [53]
+QScriptValue myCompare(QScriptContext *ctx, QScriptEngine *eng)
+{
+ double first = ctx->argument(0).toNumber();
+ double second = ctx->argument(1).toNumber();
+ int result;
+ if (first == second)
+ result = 0;
+ else if (first < second)
+ result = -1;
+ else
+ result = 1;
+ return result;
+}
+//! [53]
+
+//! [54]
+QScriptEngine eng;
+QScriptValue comparefn = eng.newFunction(myCompare);
+QScriptValue array = eng.evaluate("new Array(10, 5, 20, 15, 30)");
+array.property("sort").call(array, QScriptValueList() << comparefn);
+
+// prints "5,10,15,20,30"
+qDebug() << array.toString();
+//! [54]
+
+//! [55]
+QScriptValue rectifier(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QRectF magicRect = qscriptvalue_cast<QRectF>(ctx->callee().data());
+ QRectF sourceRect = qscriptvalue_cast<QRectF>(ctx->argument(0));
+ return eng->toScriptValue(sourceRect.intersected(magicRect));
+}
+
+...
+
+QScriptValue fun = eng.newFunction(rectifier);
+QRectF magicRect = QRectF(10, 20, 30, 40);
+fun.setData(eng.toScriptValue(magicRect));
+eng.globalObject().setProperty("rectifier", fun);
+//! [55]
+
+//! [58]
+QScriptValue add(QScriptContext *ctx, QScriptEngine *eng)
+{
+ double a = ctx->argument(0).toNumber();
+ double b = ctx->argument(1).toNumber();
+ return a + b;
+}
+//! [58]
+
+//! [62]
+QScriptValue add(QScriptContext *ctx, QScriptEngine *eng)
+{
+ if (ctx->argumentCount() != 2)
+ return ctx->throwError("add() takes exactly two arguments");
+ double a = ctx->argument(0).toNumber();
+ double b = ctx->argument(1).toNumber();
+ return a + b;
+}
+//! [62]
+
+//! [63]
+QScriptValue add(QScriptContext *ctx, QScriptEngine *eng)
+{
+ if (ctx->argumentCount() != 2)
+ return ctx->throwError("add() takes exactly two arguments");
+ if (!ctx->argument(0).isNumber())
+ return ctx->throwError(QScriptContext::TypeError, "add(): first argument is not a number");
+ if (!ctx->argument(1).isNumber())
+ return ctx->throwError(QScriptContext::TypeError, "add(): second argument is not a number");
+ double a = ctx->argument(0).toNumber();
+ double b = ctx->argument(1).toNumber();
+ return a + b;
+}
+//! [63]
+
+//! [65]
+QScriptValue concat(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QString result = "";
+ for (int i = 0; i < ctx->argumentCount(); ++i)
+ result += ctx->argument(i).toString();
+ return result;
+}
+//! [65]
+
+//! [67]
+QScriptValue sort(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QScriptValue comparefn = ctx->argument(0);
+ if (comparefn.isUndefined())
+ comparefn = /* the built-in comparison function */;
+ else if (!comparefn.isFunction())
+ return ctx->throwError(QScriptContext::TypeError, "sort(): argument is not a function");
+ ...
+}
+//! [67]
+
+//! [69]
+QScriptValue foo(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QScriptValue bar = eng->globalObject().property("bar");
+ QScriptValue arguments = ctx->argumentsObject();
+ qDebug() << "calling bar() with" << arguments.property("length").toInt32() << "arguments";
+ QScriptValue result = bar.apply(ctx->thisObject(), arguments);
+ qDebug() << "bar() returned" << result.toString();
+ return result;
+}
+//! [69]
+
+//! [72]
+QScriptValue counter(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QScriptValue act = ctx->activationObject();
+ act.setProperty("count", 0);
+ QScriptValue result = eng->newFunction(counter_inner);
+ result.setScope(act);
+ return result;
+}
+//! [72]
+
+//! [73]
+QScriptValue counter_inner(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QScriptValue outerAct = ctx->callee().scope();
+ double count = outerAct.property("count").toNumber();
+ outerAct.setProperty("count", count+1);
+ return count;
+}
+//! [73]
+
+//! [74]
+QScriptValue counter_hybrid(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QScriptValue act = ctx->activationObject();
+ act.setProperty("count", 0);
+ return eng->evaluate("(function() { return count++; })");
+}
+//! [74]
+
+//! [76]
+QScriptValue Person_ctor(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QScriptValue object;
+ if (ctx->isCalledAsConstructor()) {
+ object = ctx->thisObject();
+ } else {
+ object = eng->newObject();
+ object.setPrototype(ctx->callee().property("prototype"));
+ }
+ object.setProperty("name", ctx->argument(0));
+ return object;
+}
+//! [76]
+
+//! [77]
+QScriptContext *ctx = eng.pushContext();
+QScriptValue act = ctx->activationObject();
+act.setProperty("digit", 7);
+
+qDebug() << eng.evaluate("digit + 1").toNumber(); // 8
+
+eng.popContext();
+//! [77]
+
+//! [78]
+QScriptValue getSet(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QScriptValue obj = ctx->thisObject();
+ QScriptValue data = obj.data();
+ if (!data.isValid()) {
+ data = eng->newObject();
+ obj.setData(data);
+ }
+ QScriptValue result;
+ if (ctx->argumentCount() == 1) {
+ QString str = ctx->argument(0).toString();
+ str.replace("Roberta", "Ken");
+ result = str;
+ data.setProperty("x", result);
+ } else {
+ result = data.property("x");
+ }
+ return result;
+}
+//! [78]
+
+//! [79]
+QScriptEngine eng;
+QScriptValue obj = eng.newObject();
+obj.setProperty("x", eng.newFunction(getSet),
+ QScriptValue::PropertyGetter|QScriptValue::PropertySetter);
+//! [79]
+
+//! [91]
+QScriptValue object = engine.evaluate("({ unitName: 'Celsius', toKelvin: function(x) { return x + 273; } })");
+QScriptValue toKelvin = object.property("toKelvin");
+QScriptValue result = toKelvin.call(object, QScriptValueList() << 100);
+qDebug() << result.toNumber(); // 373
+//! [91]
+
+//! [92]
+QScriptValue add = engine.globalObject().property("add");
+qDebug() << add.call(QScriptValue(), QScriptValueList() << 1 << 2).toNumber(); // 3
+//! [92]
+
+//! [93]
+typedef QSharedPointer<QXmlStreamReader> XmlStreamReaderPointer;
+
+Q_DECLARE_METATYPE(XmlStreamReaderPointer)
+
+QScriptValue constructXmlStreamReader(QScriptContext *context, QScriptEngine *engine)
+{
+ if (!context->isCalledAsConstructor())
+ return context->throwError(QScriptContext::SyntaxError, "please use the 'new' operator");
+
+ QIODevice *device = qobject_cast<QIODevice*>(context->argument(0).toQObject());
+ if (!device)
+ return context->throwError(QScriptContext::TypeError, "please supply a QIODevice as first argument");
+
+ // Create the C++ object
+ QXmlStreamReader *reader = new QXmlStreamReader(device);
+
+ XmlStreamReaderPointer pointer(reader);
+
+ // store the shared pointer in the script object that we are constructing
+ return engine->newVariant(context->thisObject(), QVariant::fromValue(pointer));
+}
+//! [93]
+
+//! [94]
+QScriptValue xmlStreamReader_atEnd(QScriptContext *context, QScriptEngine *)
+{
+ XmlStreamReaderPointer reader = qscriptvalue_cast<XmlStreamReaderPointer>(context->thisObject());
+ if (!reader)
+ return context->throwError(QScriptContext::TypeError, "this object is not an XmlStreamReader");
+ return reader->atEnd();
+}
+//! [94]
+
+//! [95]
+ QScriptEngine engine;
+ QScriptValue xmlStreamReaderProto = engine.newObject();
+ xmlStreamReaderProto.setProperty("atEnd", engine.newFunction(xmlStreamReader_atEnd));
+
+ QScriptValue xmlStreamReaderCtor = engine.newFunction(constructXmlStreamReader, xmlStreamReaderProto);
+ engine.globalObject().setProperty("XmlStreamReader", xmlStreamReaderCtor);
+//! [95]
diff --git a/doc/src/snippets/code/doc_src_qtscript.js b/doc/src/snippets/code/doc_src_qtscript.js
new file mode 100644
index 0000000..fe1f9b9
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtscript.js
@@ -0,0 +1,444 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [2]
+function myInterestingScriptFunction() {
+ // ...
+}
+// ...
+myQObject.somethingChanged.connect(myInterestingScriptFunction);
+//! [2]
+
+
+//! [3]
+myQObject.somethingChanged.connect(myOtherQObject.doSomething);
+//! [3]
+
+
+//! [4]
+myQObject.somethingChanged.disconnect(myInterestingFunction);
+myQObject.somethingChanged.disconnect(myOtherQObject.doSomething);
+//! [4]
+
+
+//! [5]
+var obj = { x: 123 };
+var fun = function() { print(this.x); };
+myQObject.somethingChanged.connect(obj, fun);
+//! [5]
+
+
+//! [6]
+myQObject.somethingChanged.disconnect(obj, fun);
+//! [6]
+
+
+//! [7]
+var obj = { x: 123, fun: function() { print(this.x); } };
+myQObject.somethingChanged.connect(obj, "fun");
+//! [7]
+
+
+//! [8]
+myQObject.somethingChanged.disconnect(obj, "fun");
+//! [8]
+
+
+//! [9]
+try {
+ myQObject.somethingChanged.connect(myQObject, "slotThatDoesntExist");
+} catch (e) {
+ print(e);
+}
+//! [9]
+
+
+//! [10]
+myQObject.somethingChanged("hello");
+//! [10]
+
+
+//! [11]
+myQObject.myOverloadedSlot(10); // will call the int overload
+myQObject.myOverloadedSlot("10"); // will call the QString overload
+//! [11]
+
+
+//! [12]
+myQObject['myOverloadedSlot(int)']("10"); // call int overload; the argument is converted to an int
+myQObject['myOverloadedSlot(QString)'](10); // call QString overload; the argument is converted to a string
+//! [12]
+
+
+//! [14]
+myQObject.enabled = true;
+
+// ...
+
+myQObject.enabled = !myQObject.enabled;
+//! [14]
+
+
+//! [15]
+myDialog.okButton
+//! [15]
+
+
+//! [16]
+myDialog.okButton.objectName = "cancelButton";
+// from now on, myDialog.cancelButton references the button
+//! [16]
+
+
+//! [17]
+var okButton = myDialog.findChild("okButton");
+if (okButton != null) {
+ // do something with the OK button
+}
+
+var buttons = myDialog.findChildren(RegExp("button[0-9]+"));
+for (var i = 0; i < buttons.length; ++i) {
+ // do something with buttons[i]
+}
+//! [17]
+
+
+//! [21]
+var obj = new MyObject;
+obj.setEnabled( true );
+print( "obj is enabled: " + obj.isEnabled() );
+//! [21]
+
+
+//! [22]
+var obj = new MyObject;
+obj.enabled = true;
+print( "obj is enabled: " + obj.enabled );
+//! [22]
+
+
+//! [26]
+function enabledChangedHandler( b )
+{
+ print( "state changed to: " + b );
+}
+
+function init()
+{
+ var obj = new MyObject();
+ // connect a script function to the signal
+ obj["enabledChanged(bool)"].connect(enabledChangedHandler);
+ obj.enabled = true;
+ print( "obj is enabled: " + obj.enabled );
+}
+//! [26]
+
+
+//! [27]
+var o = new Object();
+o.foo = 123;
+print(o.hasOwnProperty('foo')); // true
+print(o.hasOwnProperty('bar')); // false
+print(o); // calls o.toString(), which returns "[object Object]"
+//! [27]
+
+
+//! [28]
+function Person(name)
+{
+ this.name = name;
+}
+//! [28]
+
+
+//! [29]
+Person.prototype.toString = function() { return "Person(name: " + this.name + ")"; }
+//! [29]
+
+
+//! [30]
+var p1 = new Person("John Doe");
+var p2 = new Person("G.I. Jane");
+print(p1); // "Person(name: John Doe)"
+print(p2); // "Person(name: G.I. Jane)"
+//! [30]
+
+
+//! [31]
+print(p1.hasOwnProperty('name')); // 'name' is an instance variable, so this returns true
+print(p1.hasOwnProperty('toString')); // returns false; inherited from prototype
+print(p1 instanceof Person); // true
+print(p1 instanceof Object); // true
+//! [31]
+
+
+//! [32]
+function Employee(name, salary)
+{
+ Person.call(this, name); // call base constructor
+
+ this.salary = salary;
+}
+
+// set the prototype to be an instance of the base class
+Employee.prototype = new Person();
+
+// initialize prototype
+Employee.prototype.toString = function() {
+ // ...
+}
+//! [32]
+
+
+//! [33]
+var e = new Employee("Johnny Bravo", 5000000);
+print(e instanceof Employee); // true
+print(e instanceof Person); // true
+print(e instanceof Object); // true
+print(e instanceof Array); // false
+//! [33]
+
+
+//! [40]
+var o = new Object();
+(o.__proto__ === Object.prototype); // this evaluates to true
+//! [40]
+
+
+//! [41]
+var o = new Object();
+o.__defineGetter__("x", function() { return 123; });
+var y = o.x; // 123
+//! [41]
+
+
+//! [42]
+var o = new Object();
+o.__defineSetter__("x", function(v) { print("and the value is:", v); });
+o.x = 123; // will print "and the value is: 123"
+//! [42]
+
+
+//! [49]
+var getProperty = function(name) { return this[name]; };
+
+name = "Global Object"; // creates a global variable
+print(getProperty("name")); // "Global Object"
+
+var myObject = { name: 'My Object' };
+print(getProperty.call(myObject, "name")); // "My Object"
+
+myObject.getProperty = getProperty;
+print(myObject.getProperty("name")); // "My Object"
+
+getProperty.name = "The getProperty() function";
+getProperty.getProperty = getProperty;
+getProperty.getProperty("name"); // "The getProperty() function"
+//! [49]
+
+//! [50]
+var o = { a: 1, b: 2, sum: function() { return a + b; } };
+print(o.sum()); // reference error, or sum of global variables a and b!!
+//! [50]
+
+//! [51]
+var o = { a: 1, b: 2, sum: function() { return this.a + this.b; } };
+print(o.sum()); // 3
+//! [51]
+
+//! [56]
+function add(a, b) {
+ return a + b;
+}
+//! [56]
+
+//! [57]
+function add() {
+ return arguments[0] + arguments[1];
+}
+//! [57]
+
+//! [59]
+function add() {
+ if (arguments.length != 2)
+ throw Error("add() takes exactly two arguments");
+ return arguments[0] + arguments[1];
+}
+//! [59]
+
+//! [60]
+function add() {
+ if (arguments.length != 2)
+ throw Error("add() takes exactly two arguments");
+ if (typeof arguments[0] != "number")
+ throw TypeError("add(): first argument is not a number");
+ if (typeof arguments[1] != "number")
+ throw TypeError("add(): second argument is not a number");
+ return arguments[0] + arguments[1];
+}
+//! [60]
+
+//! [61]
+function add() {
+ if (arguments.length != 2)
+ throw Error("add() takes exactly two arguments");
+ return Number(arguments[0]) + Number(arguments[1]);
+}
+//! [61]
+
+//! [64]
+function concat() {
+ var result = "";
+ for (var i = 0; i < arguments.length; ++i)
+ result += String(arguments[i]);
+ return result;
+}
+//! [64]
+
+//! [66]
+function sort(comparefn) {
+ if (comparefn == undefined)
+ comparefn = fn; /* replace fn with the built-in comparison function */
+ else if (typeof comparefn != "function")
+ throw TypeError("sort(): argument must be a function");
+ // ...
+}
+//! [66]
+
+//! [68]
+function foo() {
+ // Let bar() take care of this.
+ print("calling bar() with " + arguments.length + "arguments");
+ var result = bar.apply(this, arguments);
+ print("bar() returned" + result);
+ return result;
+}
+//! [68]
+
+//! [70]
+function counter() {
+ var count = 0;
+ return function() {
+ return count++;
+ }
+}
+//! [70]
+
+//! [71]
+var c1 = counter(); // create a new counter function
+var c2 = counter(); // create a new counter function
+print(c1()); // 0
+print(c1()); // 1
+print(c2()); // 0
+print(c2()); // 1
+//! [71]
+
+//! [75]
+function Book(isbn) {
+ this.isbn = isbn;
+}
+
+var coolBook1 = new Book("978-0131872493");
+var coolBook2 = new Book("978-1593271473");
+//! [75]
+
+//! [80]
+obj.x = "Roberta sent me";
+print(obj.x); // "Ken sent me"
+obj.x = "I sent the bill to Roberta";
+print(obj.x); // "I sent the bill to Ken"
+//! [80]
+
+//! [81]
+obj = {};
+obj.__defineGetter__("x", function() { return this._x; });
+obj.__defineSetter__("x", function(v) { print("setting x to", v); this._x = v; });
+obj.x = 123;
+//! [81]
+
+//! [82]
+myButton.text = qsTr("Hello world!");
+//! [82]
+
+//! [83]
+myButton.text = qsTranslate("MyAwesomeScript", "Hello world!");
+//! [83]
+
+//! [84]
+FriendlyConversation.prototype.greeting = function(type)
+{
+ if (FriendlyConversation['greeting_strings'] == undefined) {
+ FriendlyConversation['greeting_strings'] = [
+ QT_TR_NOOP("Hello"),
+ QT_TR_NOOP("Goodbye")
+ ];
+ }
+ return qsTr(FriendlyConversation.greeting_strings[type]);
+}
+//! [84]
+
+//! [85]
+FriendlyConversation.prototype.greeting = function(type)
+{
+ if (FriendlyConversation['greeting_strings'] == undefined) {
+ FriendlyConversation['greeting_strings'] = [
+ QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"),
+ QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye")
+ ];
+ }
+ return qsTranslate("FriendlyConversation", FriendlyConversation.greeting_strings[type]);
+}
+//! [85]
+
+//! [86]
+FileCopier.prototype.showProgress = function(done, total, currentFileName)
+{
+ this.label.text = qsTr("%1 of %2 files copied.\nCopying: %3")
+ .arg(done)
+ .arg(total)
+ .arg(currentFileName);
+}
+//! [86]
+
+//! [90]
+({ unitName: "Celsius",
+ toKelvin: function(x) { return x + 273; }
+ })
+//! [90]
diff --git a/doc/src/snippets/code/doc_src_qtscript.pro b/doc/src/snippets/code/doc_src_qtscript.pro
new file mode 100644
index 0000000..ce687d7
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtscript.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QT += script
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qtscript.qdoc b/doc/src/snippets/code/doc_src_qtscript.qdoc
index 1ba097a..b65311f 100644
--- a/doc/src/snippets/code/doc_src_qtscript.qdoc
+++ b/doc/src/snippets/code/doc_src_qtscript.qdoc
@@ -38,882 +38,6 @@
**
****************************************************************************/
-//! [0]
-#include <QtScript>
-//! [0]
-
-
-//! [1]
-QT += script
-//! [1]
-
-
-//! [2]
-function myInterestingScriptFunction() { ... }
-...
-myQObject.somethingChanged.connect(myInterestingScriptFunction);
-//! [2]
-
-
-//! [3]
-myQObject.somethingChanged.connect(myOtherQObject.doSomething);
-//! [3]
-
-
-//! [4]
-myQObject.somethingChanged.disconnect(myInterestingFunction);
-myQObject.somethingChanged.disconnect(myOtherQObject.doSomething);
-//! [4]
-
-
-//! [5]
-var obj = { x: 123 };
-var fun = function() { print(this.x); };
-myQObject.somethingChanged.connect(obj, fun);
-//! [5]
-
-
-//! [6]
-myQObject.somethingChanged.disconnect(obj, fun);
-//! [6]
-
-
-//! [7]
-var obj = { x: 123, fun: function() { print(this.x); } };
-myQObject.somethingChanged.connect(obj, "fun");
-//! [7]
-
-
-//! [8]
-myQObject.somethingChanged.disconnect(obj, "fun");
-//! [8]
-
-
-//! [9]
-try {
- myQObject.somethingChanged.connect(myQObject, "slotThatDoesntExist");
-} catch (e) {
- print(e);
-}
-//! [9]
-
-
-//! [10]
-myQObject.somethingChanged("hello");
-//! [10]
-
-
-//! [11]
-myQObject.myOverloadedSlot(10); // will call the int overload
-myQObject.myOverloadedSlot("10"); // will call the QString overload
-//! [11]
-
-
-//! [12]
-myQObject['myOverloadedSlot(int)']("10"); // call int overload; the argument is converted to an int
-myQObject['myOverloadedSlot(QString)'](10); // call QString overload; the argument is converted to a string
-//! [12]
-
-
-//! [13]
-Q_PROPERTY(bool enabled READ enabled WRITE setEnabled)
-//! [13]
-
-
-//! [14]
-myQObject.enabled = true;
-
-...
-
-myQObject.enabled = !myQObject.enabled;
-//! [14]
-
-
-//! [15]
-myDialog.okButton
-//! [15]
-
-
-//! [16]
-myDialog.okButton.objectName = "cancelButton";
-// from now on, myDialog.cancelButton references the button
-//! [16]
-
-
-//! [17]
-var okButton = myDialog.findChild("okButton");
-if (okButton != null) {
- // do something with the OK button
-}
-
-var buttons = myDialog.findChildren(RegExp("button[0-9]+"));
-for (var i = 0; i < buttons.length; ++i) {
- // do something with buttons[i]
-}
-//! [17]
-
-
-//! [18]
-QScriptValue myQObjectConstructor(QScriptContext *context, QScriptEngine *engine)
-{
- // let the engine manage the new object's lifetime.
- return engine->newQObject(new MyQObject(), QScriptEngine::ScriptOwnership);
-}
-//! [18]
-
-
-//! [19]
-class MyObject : public QObject
-{
- Q_OBJECT
-
-public:
- MyObject( ... );
-
- void aNonScriptableFunction();
-
-public slots: // these functions (slots) will be available in QtScript
- void calculate( ... );
- void setEnabled( bool enabled );
- bool isEnabled() const;
-
-private:
- ....
-
-};
-//! [19]
-
-
-//! [20]
-class MyObject : public QObject
-{
- Q_OBJECT
-
- public:
- Q_INVOKABLE void thisMethodIsInvokableInQtScript();
- void thisMethodIsNotInvokableInQtScript();
-
- ...
-};
-//! [20]
-
-
-//! [21]
-var obj = new MyObject;
-obj.setEnabled( true );
-print( "obj is enabled: " + obj.isEnabled() );
-//! [21]
-
-
-//! [22]
-var obj = new MyObject;
-obj.enabled = true;
-print( "obj is enabled: " + obj.enabled );
-//! [22]
-
-
-//! [23]
-class MyObject : public QObject
-{
- Q_OBJECT
- // define the enabled property
- Q_PROPERTY( bool enabled WRITE setEnabled READ isEnabled )
-
-public:
- MyObject( ... );
-
- void aNonScriptableFunction();
-
-public slots: // these functions (slots) will be available in QtScript
- void calculate( ... );
- void setEnabled( bool enabled );
- bool isEnabled() const;
-
-private:
- ....
-
-};
-//! [23]
-
-
-//! [24]
-Q_PROPERTY(int nonScriptableProperty READ foo WRITE bar SCRIPTABLE false)
-//! [24]
-
-
-//! [25]
-class MyObject : public QObject
-{
- Q_OBJECT
- // define the enabled property
- Q_PROPERTY( bool enabled WRITE setEnabled READ isEnabled )
-
-public:
- MyObject( ... );
-
- void aNonScriptableFunction();
-
-public slots: // these functions (slots) will be available in QtScript
- void calculate( ... );
- void setEnabled( bool enabled );
- bool isEnabled() const;
-
-signals: // the signals
- void enabledChanged( bool newState );
-
-private:
- ....
-
-};
-//! [25]
-
-
-//! [26]
-function enabledChangedHandler( b )
-{
- print( "state changed to: " + b );
-}
-
-function init()
-{
- var obj = new MyObject();
- // connect a script function to the signal
- obj["enabledChanged(bool)"].connect(enabledChangedHandler);
- obj.enabled = true;
- print( "obj is enabled: " + obj.enabled );
-}
-//! [26]
-
-
-//! [27]
-var o = new Object();
-o.foo = 123;
-print(o.hasOwnProperty('foo')); // true
-print(o.hasOwnProperty('bar')); // false
-print(o); // calls o.toString(), which returns "[object Object]"
-//! [27]
-
-
-//! [28]
-function Person(name)
-{
- this.name = name;
-}
-//! [28]
-
-
-//! [29]
-Person.prototype.toString = function() { return "Person(name: " + this.name + ")"; }
-//! [29]
-
-
-//! [30]
-var p1 = new Person("John Doe");
-var p2 = new Person("G.I. Jane");
-print(p1); // "Person(name: John Doe)"
-print(p2); // "Person(name: G.I. Jane)"
-//! [30]
-
-
-//! [31]
-print(p1.hasOwnProperty('name')); // 'name' is an instance variable, so this returns true
-print(p1.hasOwnProperty('toString')); // returns false; inherited from prototype
-print(p1 instanceof Person); // true
-print(p1 instanceof Object); // true
-//! [31]
-
-
-//! [32]
-function Employee(name, salary)
-{
- Person.call(this, name); // call base constructor
-
- this.salary = salary;
-}
-
-// set the prototype to be an instance of the base class
-Employee.prototype = new Person();
-
-// initialize prototype
-Employee.prototype.toString = function() { ... }
-//! [32]
-
-
-//! [33]
-var e = new Employee("Johnny Bravo", 5000000);
-print(e instanceof Employee); // true
-print(e instanceof Person); // true
-print(e instanceof Object); // true
-print(e instanceof Array); // false
-//! [33]
-
-
-//! [34]
-QScriptValue Person_ctor(QScriptContext *context, QScriptEngine *engine)
-{
- QString name = context->argument(0).toString();
- context->thisObject().setProperty("name", name);
- return engine->undefinedValue();
-}
-//! [34]
-
-
-//! [35]
-QScriptValue Person_prototype_toString(QScriptContext *context, QScriptEngine *engine)
-{
- QString name = context->thisObject().property("name").toString();
- QString result = QString::fromLatin1("Person(name: %0)").arg(name);
- return result;
-}
-//! [35]
-
-
-//! [36]
-QScriptEngine engine;
-QScriptValue ctor = engine.newFunction(Person_ctor);
-ctor.property("prototype").setProperty("toString", engine.newFunction(Person_prototype_toString));
-QScriptValue global = engine.globalObject();
-global.setProperty("Person", ctor);
-//! [36]
-
-
-//! [37]
-QScriptValue Employee_ctor(QScriptContext *context, QScriptEngine *engine)
-{
- QScriptValue super = context->callee().property("prototype").property("constructor");
- super.call(context->thisObject(), QScriptValueList() << context->argument(0));
- context->thisObject().setProperty("salary", context->argument(1));
- return engine->undefinedValue();
-}
-//! [37]
-
-
-//! [38]
-QScriptValue empCtor = engine.newFunction(Employee_ctor);
-empCtor.setProperty("prototype", global.property("Person").construct());
-global.setProperty("Employee", empCtor);
-//! [38]
-
-
-//! [39]
-Q_DECLARE_METATYPE(QPointF)
-Q_DECLARE_METATYPE(QPointF*)
-
-QScriptValue QPointF_prototype_x(QScriptContext *context, QScriptEngine *engine)
-{
- // Since the point is not to be modified, it's OK to cast to a value here
- QPointF point = qscriptvalue_cast<QPointF>(context->thisObject());
- return point.x();
-}
-
-QScriptValue QPointF_prototype_setX(QScriptContext *context, QScriptEngine *engine)
-{
- // Cast to a pointer to be able to modify the underlying C++ value
- QPointF *point = qscriptvalue_cast<QPointF*>(context->thisObject());
- if (!point)
- return context->throwError(QScriptContext::TypeError, "QPointF.prototype.setX: this object is not a QPointF");
- point->setX(context->argument(0).toNumber());
- return engine->undefinedValue();
-}
-//! [39]
-
-
-//! [40]
-var o = new Object();
-(o.__proto__ === Object.prototype); // this evaluates to true
-//! [40]
-
-
-//! [41]
-var o = new Object();
-o.__defineGetter__("x", function() { return 123; });
-var y = o.x; // 123
-//! [41]
-
-
-//! [42]
-var o = new Object();
-o.__defineSetter__("x", function(v) { print("and the value is:", v); });
-o.x = 123; // will print "and the value is: 123"
-//! [42]
-
-
-//! [43]
-class MyObject : public QObject
-{
- Q_OBJECT
- ...
-};
-
-Q_DECLARE_METATYPE(MyObject*)
-
-QScriptValue myObjectToScriptValue(QScriptEngine *engine, MyObject* const &in)
-{ return engine->newQObject(in); }
-
-void myObjectFromScriptValue(const QScriptValue &object, MyObject* &out)
-{ out = qobject_cast<MyObject*>(object.toQObject()); }
-
-...
-
-qScriptRegisterMetaType(&engine, myObjectToScriptValue, myObjectFromScriptValue);
-//! [43]
-
-//! [44]
-QScriptValue QPoint_ctor(QScriptContext *context, QScriptEngine *engine)
-{
- int x = context->argument(0).toInt32();
- int y = context->argument(1).toInt32();
- return engine->toScriptValue(QPoint(x, y));
-}
-
-...
-
-engine.globalObject().setProperty("QPoint", engine.newFunction(QPoint_ctor));
-//! [44]
-
-//! [45]
-QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine)
-{
- QString result;
- for (int i = 0; i < context->argumentCount(); ++i) {
- if (i > 0)
- result.append(" ");
- result.append(context->argument(i).toString());
- }
-
- QScriptValue calleeData = context->callee().data();
- QPlainTextEdit *edit = qobject_cast<QPlainTextEdit*>(calleeData.toQObject());
- edit->appendPlainText(result);
-
- return engine->undefinedValue();
-}
-//! [45]
-
-//! [46]
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- QScriptEngine eng;
- QPlainTextEdit edit;
-
- QScriptValue fun = eng.newFunction(myPrintFunction);
- fun.setData(eng.newQObject(&edit));
- eng.globalObject().setProperty("print", fun);
-
- eng.evaluate("print('hello', 'world')");
-
- edit.show();
- return app.exec();
-}
-//! [46]
-
-
-//! [47]
-QScriptEngine eng;
-QLineEdit *edit = new QLineEdit(...);
-QScriptValue handler = eng.evaluate("(function(text) { print('text was changed to', text); })");
-qScriptConnect(edit, SIGNAL(textChanged(const QString &)), QScriptValue(), handler);
-//! [47]
-
-//! [48]
-QLineEdit *edit1 = new QLineEdit(...);
-QLineEdit *edit2 = new QLineEdit(...);
-
-QScriptValue handler = eng.evaluate("(function() { print('I am', this.name); })");
-QScriptValue obj1 = eng.newObject();
-obj1.setProperty("name", "the walrus");
-QScriptValue obj2 = eng.newObject();
-obj2.setProperty("name", "Sam");
-
-qScriptConnect(edit1, SIGNAL(returnPressed()), obj1, handler);
-qScriptConnect(edit2, SIGNAL(returnPressed()), obj2, handler);
-//! [48]
-
-//! [49]
-var getProperty = function(name) { return this[name]; };
-
-name = "Global Object"; // creates a global variable
-print(getProperty("name")); // "Global Object"
-
-var myObject = { name: 'My Object' };
-print(getProperty.call(myObject, "name")); // "My Object"
-
-myObject.getProperty = getProperty;
-print(myObject.getProperty("name")); // "My Object"
-
-getProperty.name = "The getProperty() function";
-getProperty.getProperty = getProperty;
-getProperty.getProperty("name"); // "The getProperty() function"
-//! [49]
-
-//! [50]
-var o = { a: 1, b: 2, sum: function() { return a + b; } };
-print(o.sum()); // reference error, or sum of global variables a and b!!
-//! [50]
-
-//! [51]
-var o = { a: 1, b: 2, sum: function() { return this.a + this.b; } };
-print(o.sum()); // 3
-//! [51]
-
-//! [52]
-QScriptValue getProperty(QScriptContext *ctx, QScriptEngine *eng)
-{
- QString name = ctx->argument(0).toString();
- return ctx->thisObject().property(name);
-}
-//! [52]
-
-//! [53]
-QScriptValue myCompare(QScriptContext *ctx, QScriptEngine *eng)
-{
- double first = ctx->argument(0).toNumber();
- double second = ctx->argument(1).toNumber();
- int result;
- if (first == second)
- result = 0;
- else if (first < second)
- result = -1;
- else
- result = 1;
- return result;
-}
-//! [53]
-
-//! [54]
-QScriptEngine eng;
-QScriptValue comparefn = eng.newFunction(myCompare);
-QScriptValue array = eng.evaluate("new Array(10, 5, 20, 15, 30)");
-array.property("sort").call(array, QScriptValueList() << comparefn);
-
-// prints "5,10,15,20,30"
-qDebug() << array.toString();
-//! [54]
-
-//! [55]
-QScriptValue rectifier(QScriptContext *ctx, QScriptEngine *eng)
-{
- QRectF magicRect = qscriptvalue_cast<QRectF>(ctx->callee().data());
- QRectF sourceRect = qscriptvalue_cast<QRectF>(ctx->argument(0));
- return eng->toScriptValue(sourceRect.intersected(magicRect));
-}
-
-...
-
-QScriptValue fun = eng.newFunction(rectifier);
-QRectF magicRect = QRectF(10, 20, 30, 40);
-fun.setData(eng.toScriptValue(magicRect));
-eng.globalObject().setProperty("rectifier", fun);
-//! [55]
-
-//! [56]
-function add(a, b) {
- return a + b;
-}
-//! [56]
-
-//! [57]
-function add() {
- return arguments[0] + arguments[1];
-}
-//! [57]
-
-//! [58]
-QScriptValue add(QScriptContext *ctx, QScriptEngine *eng)
-{
- double a = ctx->argument(0).toNumber();
- double b = ctx->argument(1).toNumber();
- return a + b;
-}
-//! [58]
-
-//! [59]
-function add() {
- if (arguments.length != 2)
- throw Error("add() takes exactly two arguments");
- return arguments[0] + arguments[1];
-}
-//! [59]
-
-//! [60]
-function add() {
- if (arguments.length != 2)
- throw Error("add() takes exactly two arguments");
- if (typeof arguments[0] != "number")
- throw TypeError("add(): first argument is not a number");
- if (typeof arguments[1] != "number")
- throw TypeError("add(): second argument is not a number");
- return arguments[0] + arguments[1];
-}
-//! [60]
-
-//! [61]
-function add() {
- if (arguments.length != 2)
- throw Error("add() takes exactly two arguments");
- return Number(arguments[0]) + Number(arguments[1]);
-}
-//! [61]
-
-//! [62]
-QScriptValue add(QScriptContext *ctx, QScriptEngine *eng)
-{
- if (ctx->argumentCount() != 2)
- return ctx->throwError("add() takes exactly two arguments");
- double a = ctx->argument(0).toNumber();
- double b = ctx->argument(1).toNumber();
- return a + b;
-}
-//! [62]
-
-//! [63]
-QScriptValue add(QScriptContext *ctx, QScriptEngine *eng)
-{
- if (ctx->argumentCount() != 2)
- return ctx->throwError("add() takes exactly two arguments");
- if (!ctx->argument(0).isNumber())
- return ctx->throwError(QScriptContext::TypeError, "add(): first argument is not a number");
- if (!ctx->argument(1).isNumber())
- return ctx->throwError(QScriptContext::TypeError, "add(): second argument is not a number");
- double a = ctx->argument(0).toNumber();
- double b = ctx->argument(1).toNumber();
- return a + b;
-}
-//! [63]
-
-//! [64]
-function concat() {
- var result = "";
- for (var i = 0; i < arguments.length; ++i)
- result += String(arguments[i]);
- return result;
-}
-//! [64]
-
-//! [65]
-QScriptValue concat(QScriptContext *ctx, QScriptEngine *eng)
-{
- QString result = "";
- for (int i = 0; i < ctx->argumentCount(); ++i)
- result += ctx->argument(i).toString();
- return result;
-}
-//! [65]
-
-//! [66]
-function sort(comparefn) {
- if (comparefn == undefined)
- comparefn = /* the built-in comparison function */;
- else if (typeof comparefn != "function")
- throw TypeError("sort(): argument must be a function");
- ...
-}
-//! [66]
-
-//! [67]
-QScriptValue sort(QScriptContext *ctx, QScriptEngine *eng)
-{
- QScriptValue comparefn = ctx->argument(0);
- if (comparefn.isUndefined())
- comparefn = /* the built-in comparison function */;
- else if (!comparefn.isFunction())
- return ctx->throwError(QScriptContext::TypeError, "sort(): argument is not a function");
- ...
-}
-//! [67]
-
-//! [68]
-function foo() {
- // Let bar() take care of this.
- print("calling bar() with " + arguments.length + "arguments");
- var result = return bar.apply(this, arguments);
- print("bar() returned" + result);
- return result;
-}
-//! [68]
-
-//! [69]
-QScriptValue foo(QScriptContext *ctx, QScriptEngine *eng)
-{
- QScriptValue bar = eng->globalObject().property("bar");
- QScriptValue arguments = ctx->argumentsObject();
- qDebug() << "calling bar() with" << arguments.property("length").toInt32() << "arguments";
- QScriptValue result = bar.apply(ctx->thisObject(), arguments);
- qDebug() << "bar() returned" << result.toString();
- return result;
-}
-//! [69]
-
-//! [70]
-function counter() {
- var count = 0;
- return function() {
- return count++;
- }
-}
-//! [70]
-
-//! [71]
-var c1 = counter(); // create a new counter function
-var c2 = counter(); // create a new counter function
-print(c1()); // 0
-print(c1()); // 1
-print(c2()); // 0
-print(c2()); // 1
-//! [71]
-
-//! [72]
-QScriptValue counter(QScriptContext *ctx, QScriptEngine *eng)
-{
- QScriptValue act = ctx->activationObject();
- act.setProperty("count", 0);
- QScriptValue result = eng->newFunction(counter_inner);
- result.setScope(act);
- return result;
-}
-//! [72]
-
-//! [73]
-QScriptValue counter_inner(QScriptContext *ctx, QScriptEngine *eng)
-{
- QScriptValue outerAct = ctx->callee().scope();
- double count = outerAct.property("count").toNumber();
- outerAct.setProperty("count", count+1);
- return count;
-}
-//! [73]
-
-//! [74]
-QScriptValue counter_hybrid(QScriptContext *ctx, QScriptEngine *eng)
-{
- QScriptValue act = ctx->activationObject();
- act.setProperty("count", 0);
- return eng->evaluate("(function() { return count++; })");
-}
-//! [74]
-
-//! [75]
-function Book(isbn) {
- this.isbn = isbn;
-}
-
-var coolBook1 = new Book("978-0131872493");
-var coolBook2 = new Book("978-1593271473");
-//! [75]
-
-//! [76]
-QScriptValue Person_ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- QScriptValue object;
- if (ctx->isCalledAsConstructor()) {
- object = ctx->thisObject();
- } else {
- object = eng->newObject();
- object.setPrototype(ctx->callee().property("prototype"));
- }
- object.setProperty("name", ctx->argument(0));
- return object;
-}
-//! [76]
-
-//! [77]
-QScriptContext *ctx = eng.pushContext();
-QScriptValue act = ctx->activationObject();
-act.setProperty("digit", 7);
-
-qDebug() << eng.evaluate("digit + 1").toNumber(); // 8
-
-eng.popContext();
-//! [77]
-
-//! [78]
-QScriptValue getSet(QScriptContext *ctx, QScriptEngine *eng)
-{
- QScriptValue obj = ctx->thisObject();
- QScriptValue data = obj.data();
- if (!data.isValid()) {
- data = eng->newObject();
- obj.setData(data);
- }
- QScriptValue result;
- if (ctx->argumentCount() == 1) {
- QString str = ctx->argument(0).toString();
- str.replace("Roberta", "Ken");
- result = str;
- data.setProperty("x", result);
- } else {
- result = data.property("x");
- }
- return result;
-}
-//! [78]
-
-//! [79]
-QScriptEngine eng;
-QScriptValue obj = eng.newObject();
-obj.setProperty("x", eng.newFunction(getSet),
- QScriptValue::PropertyGetter|QScriptValue::PropertySetter);
-//! [79]
-
-//! [80]
-obj.x = "Roberta sent me";
-print(obj.x); // "Ken sent me"
-obj.x = "I sent the bill to Roberta";
-print(obj.x); // "I sent the bill to Ken"
-//! [80]
-
-//! [81]
-obj = {};
-obj.__defineGetter__("x", function() { return this._x; });
-obj.__defineSetter__("x", function(v) { print("setting x to", v); this._x = v; });
-obj.x = 123;
-//! [81]
-
-//! [82]
-myButton.text = qsTr("Hello world!");
-//! [82]
-
-//! [83]
-myButton.text = qsTranslate("MyAwesomeScript", "Hello world!");
-//! [83]
-
-//! [84]
-FriendlyConversation.prototype.greeting = function(type)
-{
- if (FriendlyConversation['greeting_strings'] == undefined) {
- FriendlyConversation['greeting_strings'] = [
- QT_TR_NOOP("Hello"),
- QT_TR_NOOP("Goodbye")
- ];
- }
- return qsTr(FriendlyConversation.greeting_strings[type]);
-}
-//! [84]
-
-//! [85]
-FriendlyConversation.prototype.greeting = function(type)
-{
- if (FriendlyConversation['greeting_strings'] == undefined) {
- FriendlyConversation['greeting_strings'] = [
- QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"),
- QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye")
- ];
- }
- return qsTranslate("FriendlyConversation", FriendlyConversation.greeting_strings[type]);
-}
-//! [85]
-
-//! [86]
-FileCopier.prototype.showProgress = function(done, total, currentFileName)
-{
- this.label.text = qsTr("%1 of %2 files copied.\nCopying: %3")
- .arg(done)
- .arg(total)
- .arg(currentFileName));
-}
-//! [86]
-
//! [87]
lupdate myscript.qs -ts myscript_la.ts
//! [87]
@@ -925,64 +49,3 @@ lupdate -extensions qs scripts/ -ts scripts_la.ts
//! [89]
lrelease myscript_la.ts
//! [89]
-
-//! [90]
-({ unitName: "Celsius",
- toKelvin: function(x) { return x + 273; }
- })
-//! [90]
-
-//! [91]
-QScriptValue object = engine.evaluate("({ unitName: 'Celsius', toKelvin: function(x) { return x + 273; } })");
-QScriptValue toKelvin = object.property("toKelvin");
-QScriptValue result = toKelvin.call(object, QScriptValueList() << 100);
-qDebug() << result.toNumber(); // 373
-//! [91]
-
-//! [92]
-QScriptValue add = engine.globalObject().property("add");
-qDebug() << add.call(QScriptValue(), QScriptValueList() << 1 << 2).toNumber(); // 3
-//! [92]
-
-//! [93]
-typedef QSharedPointer<QXmlStreamReader> XmlStreamReaderPointer;
-
-Q_DECLARE_METATYPE(XmlStreamReaderPointer)
-
-QScriptValue constructXmlStreamReader(QScriptContext *context, QScriptEngine *engine)
-{
- if (!context->isCalledAsConstructor())
- return context->throwError(QScriptContext::SyntaxError, "please use the 'new' operator");
-
- QIODevice *device = qobject_cast<QIODevice*>(context->argument(0).toQObject());
- if (!device)
- return context->throwError(QScriptContext::TypeError, "please supply a QIODevice as first argument");
-
- // Create the C++ object
- QXmlStreamReader *reader = new QXmlStreamReader(device);
-
- XmlStreamReaderPointer pointer(reader);
-
- // store the shared pointer in the script object that we are constructing
- return engine->newVariant(context->thisObject(), QVariant::fromValue(pointer));
-}
-//! [93]
-
-//! [94]
-QScriptValue xmlStreamReader_atEnd(QScriptContext *context, QScriptEngine *)
-{
- XmlStreamReaderPointer reader = qscriptvalue_cast<XmlStreamReaderPointer>(context->thisObject());
- if (!reader)
- return context->throwError(QScriptContext::TypeError, "this object is not an XmlStreamReader");
- return reader->atEnd();
-}
-//! [94]
-
-//! [95]
- QScriptEngine engine;
- QScriptValue xmlStreamReaderProto = engine.newObject();
- xmlStreamReaderProto.setProperty("atEnd", engine.newFunction(xmlStreamReader_atEnd));
-
- QScriptValue xmlStreamReaderCtor = engine.newFunction(constructXmlStreamReader, xmlStreamReaderProto);
- engine.globalObject().setProperty("XmlStreamReader", xmlStreamReaderCtor);
-//! [95]
diff --git a/doc/src/snippets/code/doc_src_qtscriptextensions.qdoc b/doc/src/snippets/code/doc_src_qtscriptextensions.js
index 456077d..456077d 100644
--- a/doc/src/snippets/code/doc_src_qtscriptextensions.qdoc
+++ b/doc/src/snippets/code/doc_src_qtscriptextensions.js
diff --git a/doc/src/snippets/code/doc_src_qtscripttools.cpp b/doc/src/snippets/code/doc_src_qtscripttools.cpp
new file mode 100644
index 0000000..258c7df
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtscripttools.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+#include <QtScriptTools>
+//! [0]
diff --git a/doc/src/snippets/code/doc_src_qtscripttools.pro b/doc/src/snippets/code/doc_src_qtscripttools.pro
new file mode 100644
index 0000000..e87644d
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtscripttools.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QT += scripttools
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qtsql.qdoc b/doc/src/snippets/code/doc_src_qtsql.cpp
index 1bc7518..9c0c16e 100644
--- a/doc/src/snippets/code/doc_src_qtsql.qdoc
+++ b/doc/src/snippets/code/doc_src_qtsql.cpp
@@ -41,8 +41,3 @@
//! [0]
#include <QtSql>
//! [0]
-
-
-//! [1]
-QT += sql
-//! [1]
diff --git a/doc/src/snippets/code/doc_src_qtsql.pro b/doc/src/snippets/code/doc_src_qtsql.pro
new file mode 100644
index 0000000..4e31846
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtsql.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QT += sql
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qtsvg.qdoc b/doc/src/snippets/code/doc_src_qtsvg.cpp
index 57db6de..c66b4da 100644
--- a/doc/src/snippets/code/doc_src_qtsvg.qdoc
+++ b/doc/src/snippets/code/doc_src_qtsvg.cpp
@@ -41,8 +41,3 @@
//! [0]
#include <QtSvg>
//! [0]
-
-
-//! [1]
-QT += svg
-//! [1]
diff --git a/doc/src/snippets/code/doc_src_qtsvg.pro b/doc/src/snippets/code/doc_src_qtsvg.pro
new file mode 100644
index 0000000..1a75d03
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtsvg.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QT += svg
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qttest.qdoc b/doc/src/snippets/code/doc_src_qttest.cpp
index 354d188..5b21c9e 100644
--- a/doc/src/snippets/code/doc_src_qttest.qdoc
+++ b/doc/src/snippets/code/doc_src_qttest.cpp
@@ -41,8 +41,3 @@
//! [0]
#include <QtTest>
//! [0]
-
-
-//! [1]
-CONFIG += qtestlib
-//! [1]
diff --git a/doc/src/snippets/code/doc_src_qttest.pro b/doc/src/snippets/code/doc_src_qttest.pro
new file mode 100644
index 0000000..73d210e
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qttest.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+CONFIG += qtestlib
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qtuiloader.qdoc b/doc/src/snippets/code/doc_src_qtuiloader.cpp
index b8d8019..de35e78 100644
--- a/doc/src/snippets/code/doc_src_qtuiloader.qdoc
+++ b/doc/src/snippets/code/doc_src_qtuiloader.cpp
@@ -38,11 +38,6 @@
**
****************************************************************************/
-//! [0]
-CONFIG += uitools
-//! [0]
-
-
//! [1]
#include <QtUiTools>
//! [1]
diff --git a/doc/src/snippets/code/doc_src_qtuiloader.pro b/doc/src/snippets/code/doc_src_qtuiloader.pro
new file mode 100644
index 0000000..a050213
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtuiloader.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+CONFIG += uitools
+#! [0]
diff --git a/doc/src/snippets/code/doc_src_qtxml.cpp b/doc/src/snippets/code/doc_src_qtxml.cpp
new file mode 100644
index 0000000..5413fd2
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtxml.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+#include <QtXml>
+//! [0]
diff --git a/doc/src/snippets/code/doc_src_qtxml.pro b/doc/src/snippets/code/doc_src_qtxml.pro
new file mode 100644
index 0000000..d69b2ce
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtxml.pro
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QT += xml
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qtxml.qdoc b/doc/src/snippets/code/doc_src_qtxml.qdoc
index 6576815..1e864ea 100644
--- a/doc/src/snippets/code/doc_src_qtxml.qdoc
+++ b/doc/src/snippets/code/doc_src_qtxml.qdoc
@@ -38,21 +38,6 @@
**
****************************************************************************/
-//! [0]
-#include <QtXml>
-//! [0]
-
-
-//! [1]
-QT += xml
-//! [1]
-
-
-//! [2]
-QT += xml
-//! [2]
-
-
//! [3]
<quote>A quotation.</quote>
//! [3]
diff --git a/doc/src/snippets/code/doc_src_qtxmlpatterns.cpp b/doc/src/snippets/code/doc_src_qtxmlpatterns.cpp
new file mode 100644
index 0000000..2c3235c
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtxmlpatterns.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+#include <QtXmlPatterns>
+//! [0]
diff --git a/doc/src/snippets/code/doc_src_qtxmlpatterns.pro b/doc/src/snippets/code/doc_src_qtxmlpatterns.pro
new file mode 100644
index 0000000..61ee910
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_qtxmlpatterns.pro
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QT += xmlpatterns
+#! [1]
diff --git a/doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc b/doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc
index 560cc53..22e2dde 100644
--- a/doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc
+++ b/doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc
@@ -42,15 +42,6 @@
void wrapInFunction()
{
-//! [0]
-#include <QtXmlPatterns>
-//! [0]
-
-
-//! [1]
-QT += xmlpatterns
-//! [1]
-
//! [2]
xmlpatterns myQuery.xq
//! [2]
diff --git a/doc/src/snippets/code/doc_src_qvarlengtharray.qdoc b/doc/src/snippets/code/doc_src_qvarlengtharray.cpp
index a938330..a938330 100644
--- a/doc/src/snippets/code/doc_src_qvarlengtharray.qdoc
+++ b/doc/src/snippets/code/doc_src_qvarlengtharray.cpp
diff --git a/doc/src/snippets/declarative/qml-intro/hello-world1.qml b/doc/src/snippets/code/doc_src_resources.cpp
index 81ad333..b965cbe 100644
--- a/doc/src/snippets/declarative/qml-intro/hello-world1.qml
+++ b/doc/src/snippets/code/doc_src_resources.cpp
@@ -38,16 +38,17 @@
**
****************************************************************************/
-//! [document]
-import QtQuick 1.0
+//! [4]
+QResource::registerResource("/path/to/myresource.rcc");
+//! [4]
-Rectangle {
- id: myRectangle
- width: 500
- height: 400
- Text { text: "Hello World!" }
-
- color: "lightgray"
+//! [5]
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Q_INIT_RESOURCE(graphlib);
+ ...
+ return app.exec();
}
-//! [document]
+//! [5]
diff --git a/doc/src/snippets/code/doc_src_resources.qdoc b/doc/src/snippets/code/doc_src_resources.qdoc
index c524ae7..0b727da 100644
--- a/doc/src/snippets/code/doc_src_resources.qdoc
+++ b/doc/src/snippets/code/doc_src_resources.qdoc
@@ -63,19 +63,3 @@
//! [3]
rcc -binary myresource.qrc -o myresource.rcc
//! [3]
-
-
-//! [4]
-QResource::registerResource("/path/to/myresource.rcc");
-//! [4]
-
-
-//! [5]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Q_INIT_RESOURCE(graphlib);
- ...
- return app.exec();
-}
-//! [5]
diff --git a/doc/src/snippets/code/doc_src_richtext.cpp b/doc/src/snippets/code/doc_src_richtext.cpp
new file mode 100644
index 0000000..8de5f4c
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_richtext.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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]
+QTextDocument *newDocument = new QTextDocument;
+//! [0]
+
+
+//! [1]
+QTextEdit *editor = new QTextEdit;
+QTextDocument *editorDocument = editor->document();
+//! [1]
+
+
+//! [2]
+QTextEdit *editor = new QTextEdit(parent);
+editor->setHtml(aStringContainingHTMLtext);
+editor->show();
+//! [2]
+
+
+//! [3]
+QTextDocument *document = editor->document();
+//! [3]
+
+
+//! [4]
+QTextCursor cursor = editor->textCursor();
+//! [4]
+
+
+//! [5]
+editor->setTextCursor(cursor);
+//! [5]
+
+
+//! [6]
+textEdit.show();
+
+textCursor.beginEditBlock();
+
+for (int i = 0; i < 1000; ++i) {
+ textCursor.insertBlock();
+ textCursor.insertText(paragraphText.at(i));
+}
+
+textCursor.endEditBlock();
+//! [6]
diff --git a/doc/src/snippets/code/doc_src_richtext.qdoc b/doc/src/snippets/code/doc_src_richtext.qdoc
index e031d77..2b79fdb 100644
--- a/doc/src/snippets/code/doc_src_richtext.qdoc
+++ b/doc/src/snippets/code/doc_src_richtext.qdoc
@@ -38,53 +38,6 @@
**
****************************************************************************/
-//! [0]
-QTextDocument *newDocument = new QTextDocument;
-//! [0]
-
-
-//! [1]
-QTextEdit *editor = new QTextEdit;
-QTextDocument *editorDocument = editor->document();
-//! [1]
-
-
-//! [2]
-QTextEdit *editor = new QTextEdit(parent);
-editor->setHtml(aStringContainingHTMLtext);
-editor->show();
-//! [2]
-
-
-//! [3]
-QTextDocument *document = editor->document();
-//! [3]
-
-
-//! [4]
-QTextCursor cursor = editor->textCursor();
-//! [4]
-
-
-//! [5]
-editor->setTextCursor(cursor);
-//! [5]
-
-
-//! [6]
-textEdit.show();
-
-textCursor.beginEditBlock();
-
-for (int i = 0; i < 1000; ++i) {
- textCursor.insertBlock();
- textCursor.insertText(paragraphText.at(i));
-}
-
-textCursor.endEditBlock();
-//! [6]
-
-
//! [7]
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
//! [7]
diff --git a/doc/src/snippets/code/doc_src_sql-driver.cpp b/doc/src/snippets/code/doc_src_sql-driver.cpp
new file mode 100644
index 0000000..56e4f9b
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_sql-driver.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [2]
+QSqlQuery q;
+q.exec("call qtestproc (@outval1, @outval2)");
+q.exec("select @outval1, @outval2");
+q.next();
+qDebug() << q.value(0) << q.value(1); // outputs "42" and "43"
+//! [2]
+
+
+//! [10]
+// STORED_PROC uses the return statement or returns multiple result sets
+QSqlQuery query;
+query.setForwardOnly(true);
+query.exec("{call STORED_PROC}");
+//! [10]
+
+
+//! [24]
+db.setHostName("MyServer");
+db.setDatabaseName("C:\\test.gdb");
+//! [24]
+
+
+//! [25]
+// connect to database using the Latin-1 character set
+db.setConnectOptions("ISC_DPB_LC_CTYPE=Latin1");
+db.open();
+//! [25]
+
+
+//! [26]
+QSqlQuery q;
+q.exec("execute procedure my_procedure");
+q.next();
+qDebug() << q.value(0); // outputs the first RETURN/OUT value
+//! [26]
+
+
+//! [31]
+QSqlDatabase: QMYSQL driver not loaded
+QSqlDatabase: available drivers: QMYSQL
+//! [31]
diff --git a/doc/src/snippets/code/doc_src_sql-driver.qdoc b/doc/src/snippets/code/doc_src_sql-driver.qdoc
index 482e38c..46cd1b3 100644
--- a/doc/src/snippets/code/doc_src_sql-driver.qdoc
+++ b/doc/src/snippets/code/doc_src_sql-driver.qdoc
@@ -59,15 +59,6 @@ END
//! [1]
-//! [2]
-QSqlQuery q;
-q.exec("call qtestproc (@outval1, @outval2)");
-q.exec("select @outval1, @outval2");
-q.next();
-qDebug() << q.value(0) << q.value(1); // outputs "42" and "43"
-//! [2]
-
-
//! [3]
cd $QTDIR/src/plugins/sqldrivers/mysql
qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
@@ -116,14 +107,6 @@ set PATH=%PATH%;c:\oracle\bin
//! [9]
-//! [10]
-\\ STORED_PROC uses the return statement or returns multiple result sets
-QSqlQuery query;
-query.setForwardOnly(true);
-query.exec("{call STORED_PROC}");
-//! [10]
-
-
//! [11]
cd $QTDIR/src/plugins/sqldrivers/odbc
qmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc"
@@ -212,27 +195,6 @@ nmake
//! [23]
-//! [24]
-db.setHostName("MyServer");
-db.setDatabaseName("C:\\test.gdb");
-//! [24]
-
-
-//! [25]
-// connect to database using the Latin-1 character set
-db.setConnectOptions("ISC_DPB_LC_CTYPE=Latin1");
-db.open();
-//! [25]
-
-
-//! [26]
-QSqlQuery q;
-q.exec("execute procedure my_procedure");
-q.next();
-qDebug() << q.value(0); // outputs the first RETURN/OUT value
-//! [26]
-
-
//! [27]
cd $QTDIR/src/plugins/sqldrivers/ibase
qmake "INCLUDEPATH+=/opt/interbase/include" "LIBS+=-L/opt/interbase/lib" ibase.pro
@@ -261,11 +223,6 @@ nmake
//! [30]
-//! [31]
-QSqlDatabase: QMYSQL driver not loaded
-QSqlDatabase: available drivers: QMYSQL
-//! [31]
-
//! [32]
configure -I /usr/include/oracle/10.1.0.3/client -L /usr/lib/oracle/10.1.0.3/client/lib -R /usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lnnz10
make
@@ -276,4 +233,3 @@ cd $QTDIR/src/plugins/sqldrivers/oci
qmake "INCLUDEPATH+=/usr/include/oracle/10.1.0.3/client" "LIBS+=-L/usr/lib/oracle/10.1.0.3/client/lib -Wl,-rpath,/usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lnnz10" oci.pro
make
//! [33]
-
diff --git a/doc/src/snippets/code/doc_src_styles.qdoc b/doc/src/snippets/code/doc_src_styles.cpp
index a2a6fa9..a2a6fa9 100644
--- a/doc/src/snippets/code/doc_src_styles.qdoc
+++ b/doc/src/snippets/code/doc_src_styles.cpp
diff --git a/doc/src/snippets/code/doc_src_stylesheet.cpp b/doc/src/snippets/code/doc_src_stylesheet.cpp
new file mode 100644
index 0000000..3faaf2d
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_stylesheet.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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/doc/src/snippets/code/doc_src_stylesheet.qdoc b/doc/src/snippets/code/doc_src_stylesheet.qdoc
index 9b8a3b5..99b31c9 100644
--- a/doc/src/snippets/code/doc_src_stylesheet.qdoc
+++ b/doc/src/snippets/code/doc_src_stylesheet.qdoc
@@ -170,53 +170,6 @@ LI.red.level {} /* a=0 b=2 c=1 -> specificity = 21 */
//! [20]
-//! [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]
-
-
//! [28]
MyLabel { qproperty-pixmap: url(pixmap.png); }
MyGroupBox { qproperty-titleColor: rgb(100, 200, 100); }
@@ -234,17 +187,6 @@ QToolButton { background-color: red; border: none; }
//! [31]
-//! [32]
-void CustomWidget::paintEvent(QPaintEvent *)
-{
- QStyleOption opt;
- opt.init(this);
- QPainter p(this);
- style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
-}
-//! [32]
-
-
//! [33]
QTreeView {
alternate-background-color: blue;
@@ -617,56 +559,11 @@ QPushButton { color: palette(dark); }
//! [87]
-//! [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]
-
-
//! [94]
*[mandatoryField="true"] { background-color: yellow }
//! [94]
-//! [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]
-
-
//! [96]
QPushButton#evilButton { background-color: red }
//! [96]
diff --git a/doc/src/snippets/code/doc_src_unicode.qdoc b/doc/src/snippets/code/doc_src_unicode.cpp
index 4415cf2..4415cf2 100644
--- a/doc/src/snippets/code/doc_src_unicode.qdoc
+++ b/doc/src/snippets/code/doc_src_unicode.cpp
diff --git a/doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc b/doc/src/snippets/code/doc_src_unix-signal-handlers.cpp
index fd5f386..fd5f386 100644
--- a/doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc
+++ b/doc/src/snippets/code/doc_src_unix-signal-handlers.cpp
diff --git a/doc/src/snippets/declarative/animation-signalhandler.qml b/doc/src/snippets/code/doc_src_wince-customization.cpp
index 416417f..90c2207 100644
--- a/doc/src/snippets/declarative/animation-signalhandler.qml
+++ b/doc/src/snippets/code/doc_src_wince-customization.cpp
@@ -37,19 +37,22 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-//![0]
-import QtQuick 1.0
-Rectangle {
- id: rect
- width: 100; height: 100
- color: "red"
+//! [9]
+wchar_t* libraries[] = {
+ L"QtCore4.dll",
+ L"QtGui4.dll",
+ 0
+};
- MouseArea {
- anchors.fill: parent
- onClicked: PropertyAnimation { target: rect; properties: "x,y"; to: 50; duration: 1000 }
+for (int i = 0; libraries[i] != 0; ++i) {
+ HINSTANCE instance = LoadLibraryW(libraries[i]);
+ OutputDebugStringW(libraries[i]);
+ if (instance != NULL) {
+ OutputDebugStringW(L" : Successfully instantiated\n");
+ FreeLibrary(instance);
+ } else {
+ OutputDebugStringW(L" : Could not be loaded\n");
}
}
-
-//![0]
-
+//! [9]
diff --git a/doc/src/snippets/code/doc_src_wince-customization.qdoc b/doc/src/snippets/code/doc_src_wince-customization.qdoc
index 657786f..ab09222 100644
--- a/doc/src/snippets/code/doc_src_wince-customization.qdoc
+++ b/doc/src/snippets/code/doc_src_wince-customization.qdoc
@@ -89,22 +89,3 @@ if(equals(TEMPLATE_PREFIX, "vc") | equals(TEMPLATE, "vc*")) {
DEFINES -= _M_ARM
}
//! [8]
-
-//! [9]
-wchar_t* libraries[] = {
- L"QtCore4.dll",
- L"QtGui4.dll",
- 0
-};
-
-for (int i = 0; libraries[i] != 0; ++i) {
- HINSTANCE instance = LoadLibraryW(libraries[i]);
- OutputDebugStringW(libraries[i]);
- if (instance != NULL) {
- OutputDebugStringW(L" : Successfully instantiated\n");
- FreeLibrary(instance);
- } else {
- OutputDebugStringW(L" : Could not be loaded\n");
- }
-}
-//! [9]
diff --git a/doc/src/snippets/code/src_corelib_global_qglobal.cpp b/doc/src/snippets/code/src_corelib_global_qglobal.cpp
index 0b54cef..c79a714 100644
--- a/doc/src/snippets/code/src_corelib_global_qglobal.cpp
+++ b/doc/src/snippets/code/src_corelib_global_qglobal.cpp
@@ -531,3 +531,27 @@ class MyClass : public QObject
//! [47]
CApaApplication *myApplicationFactory();
//! [47]
+
+//! [qlikely]
+ // the condition inside the "if" will be successful most of the times
+ for (int i = 1; i <= 365; i++) {
+ if (Q_LIKELY(isWorkingDay(i))) {
+ ...
+ }
+ ...
+ }
+//! [qlikely]
+
+//! [qunlikely]
+bool readConfiguration(const QFile &file)
+{
+ // We expect to be asked to read an existing file
+ if (Q_UNLIKELY(!file.exists())) {
+ qWarning() << "File not found";
+ return false;
+ }
+
+ ...
+ return true;
+}
+//! [qunlikely]
diff --git a/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp
index 7a752b1..86bad5e 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp
@@ -43,7 +43,7 @@ void wrapInFunction()
{
//! [0]
-class MyClass
+class MyClass : public QObject
{
Q_OBJECT
Q_CLASSINFO("author", "Sabrina Schweinsteiger")
diff --git a/doc/src/snippets/code/src_gui_painting_qpen.cpp b/doc/src/snippets/code/src_gui_painting_qpen.cpp
index 6973e0c..8674516 100644
--- a/doc/src/snippets/code/src_gui_painting_qpen.cpp
+++ b/doc/src/snippets/code/src_gui_painting_qpen.cpp
@@ -47,7 +47,7 @@ painter.setPen(pen);
//! [1]
QPainter painter(this);
-QPen pen(); // creates a default pen
+QPen pen; // creates a default pen
pen.setStyle(Qt::DashDotLine);
pen.setWidth(3);
diff --git a/doc/src/snippets/declarative/qml-intro/anchors2.qml b/doc/src/snippets/declarative/Button.qml
index 2c4ce11..214dfea 100644
--- a/doc/src/snippets/declarative/qml-intro/anchors2.qml
+++ b/doc/src/snippets/declarative/Button.qml
@@ -41,18 +41,27 @@
//! [document]
import QtQuick 1.0
+//! [parent begin]
Rectangle {
- id: myWin
- width: 500
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.svg"
- width: 150; height: 150
- anchors.bottom: myWin.bottom
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 10
- }
+//! [parent begin]
+
+//! [property alias]
+property alias buttonLabel: label.text
+Text {
+ id: label
+ text: "empty label"
+}
+ //! [property alias]
+
+//! [id alias]
+ property alias buttonImage: image
+
+ Image {id: image}
+//! [id alias]
+//! [parent end]
}
+//! [parent end]
+
//! [document]
+
+
diff --git a/doc/src/snippets/declarative/animation-elements.qml b/doc/src/snippets/declarative/animation-elements.qml
deleted file mode 100644
index d9bfc28..0000000
--- a/doc/src/snippets/declarative/animation-elements.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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]
-import QtQuick 1.0
-
-Row {
-
-//![color]
-Rectangle {
- width: 100; height: 100
-
- ColorAnimation on color { from: "red"; to: "yellow"; duration: 1000 }
-}
-//![color]
-
-//![rotation]
-Item {
- width: 300; height: 300
-
- Rectangle {
- width: 100; height: 100; anchors.centerIn: parent
- color: "red"
-
- RotationAnimation on rotation { to: 90; direction: RotationAnimation.Clockwise }
- }
-}
-//![rotation]
-
-}
diff --git a/doc/src/snippets/declarative/animation-groups.qml b/doc/src/snippets/declarative/animation-groups.qml
deleted file mode 100644
index f29ea48..0000000
--- a/doc/src/snippets/declarative/animation-groups.qml
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-import QtQuick 1.0
-
-Row {
-
-//![0]
-Rectangle {
- id: rect
- width: 120; height: 200
-
- Image {
- id: img
- source: "pics/qt.png"
- anchors.horizontalCenter: parent.horizontalCenter
- y: 0
-
- SequentialAnimation on y {
- loops: Animation.Infinite
- NumberAnimation { to: rect.height - img.height; easing.type: Easing.OutBounce; duration: 2000 }
- PauseAnimation { duration: 1000 }
- NumberAnimation { to: 0; easing.type: Easing.OutQuad; duration: 1000 }
- }
- }
-}
-//![0]
-
-//![1]
-Rectangle {
- id: redRect
- width: 100; height: 100
- color: "red"
-
- MouseArea { id: mouseArea; anchors.fill: parent }
-
- states: State {
- name: "pressed"; when: mouseArea.pressed
- PropertyChanges { target: redRect; color: "blue"; y: mouseArea.mouseY; width: mouseArea.mouseX }
- }
-
- transitions: Transition {
-
- SequentialAnimation {
- ColorAnimation { duration: 200 }
- PauseAnimation { duration: 100 }
-
- ParallelAnimation {
- NumberAnimation {
- duration: 500
- easing.type: Easing.OutBounce
- targets: redRect
- properties: "y"
- }
-
- NumberAnimation {
- duration: 800
- easing.type: Easing.InOutQuad
- targets: redRect
- properties: "width"
- }
- }
- }
- }
-}
-//![1]
-
-}
diff --git a/doc/src/snippets/declarative/animation-propertyvaluesource.qml b/doc/src/snippets/declarative/animation-propertyvaluesource.qml
deleted file mode 100644
index 6f93967..0000000
--- a/doc/src/snippets/declarative/animation-propertyvaluesource.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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]
-import QtQuick 1.0
-
-Rectangle {
- width: 100; height: 100
- color: "red"
-
- PropertyAnimation on x { to: 50; duration: 1000; loops: Animation.Infinite }
- PropertyAnimation on y { to: 50; duration: 1000; loops: Animation.Infinite }
-}
-//![0]
-
diff --git a/doc/src/snippets/declarative/animation.qml b/doc/src/snippets/declarative/animation.qml
new file mode 100644
index 0000000..ae6142d
--- /dev/null
+++ b/doc/src/snippets/declarative/animation.qml
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+//! [document]
+import QtQuick 1.0
+
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ width: 200; height: 600
+ id: screen
+
+Column {
+ spacing: 12
+//! [direct property change]
+Rectangle {
+ id: blob
+ width: 75; height: 75
+ color: "blue"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: blob.color = "green"
+ }
+}
+//! [direct property change]
+
+//! [property animation]
+Rectangle {
+ id: flashingblob
+ width: 75; height: 75
+ color: "blue"
+ opacity: 1.0
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ animateColor.start()
+ animateOpacity.start()
+ }
+ }
+
+ PropertyAnimation {id: animateColor; target: flashingblob; properties: "color"; to: "green"; duration: 100}
+
+ NumberAnimation {
+ id: animateOpacity
+ target: flashingblob
+ properties: "opacity"
+ from: 0.99
+ to: 1.0
+ loops: Animation.Infinite
+ easing {type: Easing.OutBack; overshoot: 500}
+ }
+}
+//! [property animation]
+
+//! [transition animation]
+Rectangle {
+ width: 75; height: 75
+ id: button
+ state: "RELEASED"
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: button.state = "PRESSED"
+ onReleased: button.state = "RELEASED"
+ }
+
+ states: [
+ State {
+ name: "PRESSED"
+ PropertyChanges { target: button; color: "lightblue"}
+ },
+ State {
+ name: "RELEASED"
+ PropertyChanges { target: button; color: "lightsteelblue"}
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "PRESSED"
+ to: "RELEASED"
+ ColorAnimation { target: button; duration: 100}
+ },
+ Transition {
+ from: "RELEASED"
+ to: "PRESSED"
+ ColorAnimation { target: button; duration: 100}
+ }
+ ]
+}
+//! [transition animation]
+
+Rectangle {
+ width: 75; height: 75
+ id: wildcard
+ color: "green"
+//! [wildcard animation]
+ transitions:
+ Transition {
+ to: "*"
+ ColorAnimation { target: button; duration: 100}
+ }
+//! [wildcard animation]
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: {
+ ball.x = 10
+ ball.color = "red"
+ }
+ onReleased: {
+ ball.x = screen.width / 2
+ ball.color = "salmon"
+ }
+ }
+}
+
+//! [behavior animation]
+Rectangle {
+ width: 75; height: 75; radius: width
+ id: ball
+ color: "salmon"
+
+ Behavior on x {
+ NumberAnimation {
+ id: bouncebehavior
+ easing {
+ type: Easing.OutElastic
+ amplitude: 1.0
+ period: 0.5
+ }
+ }
+ }
+ Behavior on y {
+ animation: bouncebehavior
+ }
+ Behavior {
+ ColorAnimation { target: ball; duration: 100 }
+ }
+}
+//! [behavior animation]
+
+//! [sequential animation]
+Rectangle {
+ id: banner
+ width: 150; height: 100; border.color: "black"
+
+ Column {
+ anchors.centerIn: parent
+ Text {
+ id: code
+ text: "Code less."
+ opacity: 0.01
+ }
+ Text {
+ id: create
+ text: "Create more."
+ opacity: 0.01
+ }
+ Text {
+ id: deploy
+ text: "Deploy everywhere."
+ opacity: 0.01
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: playbanner.start()
+ }
+
+ SequentialAnimation {
+ id: playbanner
+ running: false
+ NumberAnimation { target: code; property: "opacity"; to: 1.0; duration: 200}
+ NumberAnimation { target: create; property: "opacity"; to: 1.0; duration: 200}
+ NumberAnimation { target: deploy; property: "opacity"; to: 1.0; duration: 200}
+ }
+}
+//! [sequential animation]
+
+}//end of col
+//! [parent end]
+}
+//! [parent end]
+
+//! [document]
diff --git a/doc/src/snippets/declarative/animation-easing.qml b/doc/src/snippets/declarative/bestpractices/group.qml
index 64ba44c..8a2b398 100644
--- a/doc/src/snippets/declarative/animation-easing.qml
+++ b/doc/src/snippets/declarative/bestpractices/group.qml
@@ -37,15 +37,40 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-//![0]
+
+
+//! [document]
import QtQuick 1.0
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ width: 175; height: 175; color: "white"
+
+Rectangle{
+width: 170; height: 170
+//! [not grouped]
+border.width: 1
+border.color: "red"
+anchors.bottom: parent.bottom
+anchors.left: parent.left
+//! [not grouped]
+}
Rectangle {
width: 100; height: 100
+
+//! [grouped]
+border {
+ width: 1;
color: "red"
-
- PropertyAnimation on x { to: 50; duration: 1000; easing.type: Easing.OutBounce }
- PropertyAnimation on y { to: 50; duration: 1000; easing.type: Easing.OutBounce }
}
-//![0]
-
+anchors {
+ bottom: parent.bottom;
+ left: parent.left
+}
+//! [grouped]
+}
+//! [parent end]
+}
+//! [parent end]
+//! [document]
diff --git a/doc/src/snippets/declarative/events.qml b/doc/src/snippets/declarative/events.qml
new file mode 100644
index 0000000..3dc44f2
--- /dev/null
+++ b/doc/src/snippets/declarative/events.qml
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+//![document]
+import QtQuick 1.0
+
+//![parent begin]
+Rectangle {
+//![parent begin]
+
+ id: screen
+ width: 400; height: 500
+
+//! [signal declaration]
+ signal trigger
+ signal send (string notice)
+ signal perform (string task, variant object)
+//! [signal declaration]
+
+//! [signal handler declaration]
+onTrigger: console.log("trigger signal emitted")
+
+onSend: {
+ console.log("send signal emitted with notice: " + notice)
+}
+
+onPerform: console.log("perform signal emitted")
+//! [signal handler declaration]
+
+//! [automatic signals]
+Rectangle {
+ id: sprite
+ width: 25; height: 25
+ x: 50; y: 15
+
+ onXChanged: console.log("x property changed, emitted xChanged signal")
+ onYChanged: console.log("y property changed, emitted yChanged signal")
+}
+//! [automatic signals]
+
+//! [signal emit]
+Rectangle {
+ id: messenger
+
+ signal send( string person, string notice)
+
+ onSend: {
+ console.log("For " + person + ", the notice is: " + notice)
+ }
+
+ Component.onCompleted: messenger.send("Tom", "the door is ajar.")
+}
+//! [signal emit]
+
+//! [connect method]
+Rectangle {
+ id: relay
+
+ signal send( string person, string notice)
+ onSend: console.log("Send signal to: " + person + ", " + notice)
+
+ Component.onCompleted: {
+ relay.send.connect(sendToPost)
+ relay.send.connect(sendToTelegraph)
+ relay.send.connect(sendToEmail)
+ relay.send("Tom", "Happy Birthday")
+ }
+
+ function sendToPost(person, notice) {
+ console.log("Sending to post: " + person + ", " + notice)
+ }
+ function sendToTelegraph(person, notice) {
+ console.log("Sending to telegraph: " + person + ", " + notice)
+ }
+ function sendToEmail(person, notice) {
+ console.log("Sending to email: " + person + ", " + notice)
+ }
+}
+//! [connect method]
+
+//! [forward signal]
+Rectangle {
+ id: forwarder
+ width: 100; height: 100
+
+ signal send()
+ onSend: console.log("Send clicked")
+
+ MouseArea {
+ id: mousearea
+ anchors.fill: parent
+ onClicked: console.log("MouseArea clicked")
+ }
+ Component.onCompleted: {
+ mousearea.clicked.connect(send)
+ }
+}
+//! [forward signal]
+
+//! [connect method]
+//![parent end]
+}
+//![parent end]
+
+//![document]
diff --git a/doc/src/snippets/declarative/focus/advancedFocus.qml b/doc/src/snippets/declarative/focus/advancedFocus.qml
index fda37c1..409663b 100644
--- a/doc/src/snippets/declarative/focus/advancedFocus.qml
+++ b/doc/src/snippets/declarative/focus/advancedFocus.qml
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the FOO module of the Qt Toolkit.
+** 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:
diff --git a/doc/src/snippets/declarative/focus/basicwidget.qml b/doc/src/snippets/declarative/focus/basicwidget.qml
index b74c1cd..bf834b4 100644
--- a/doc/src/snippets/declarative/focus/basicwidget.qml
+++ b/doc/src/snippets/declarative/focus/basicwidget.qml
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the FOO module of the Qt Toolkit.
+** 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:
diff --git a/doc/src/snippets/declarative/focus/focusscopewidget.qml b/doc/src/snippets/declarative/focus/focusscopewidget.qml
index 7421a63..6a97512 100644
--- a/doc/src/snippets/declarative/focus/focusscopewidget.qml
+++ b/doc/src/snippets/declarative/focus/focusscopewidget.qml
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the FOO module of the Qt Toolkit.
+** 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:
@@ -37,6 +37,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+//! [document]
import QtQuick 1.0
//! [focusscope window]
@@ -59,3 +60,4 @@ Rectangle {
}
//! [focusscope window]
+//! [document]
diff --git a/doc/src/snippets/declarative/focus/myclickablewidget.qml b/doc/src/snippets/declarative/focus/myclickablewidget.qml
index 4777dd1..30b1c69 100644
--- a/doc/src/snippets/declarative/focus/myclickablewidget.qml
+++ b/doc/src/snippets/declarative/focus/myclickablewidget.qml
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the FOO module of the Qt Toolkit.
+** 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:
diff --git a/doc/src/snippets/declarative/focus/myfocusscopewidget.qml b/doc/src/snippets/declarative/focus/myfocusscopewidget.qml
index c87a47e..6462301 100644
--- a/doc/src/snippets/declarative/focus/myfocusscopewidget.qml
+++ b/doc/src/snippets/declarative/focus/myfocusscopewidget.qml
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the FOO module of the Qt Toolkit.
+** 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:
@@ -37,12 +37,13 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+//! [document]
import QtQuick 1.0
//! [widget in focusscope]
FocusScope {
- //FocusScope needs to bind to visual properties of the children
+ //FocusScope needs to bind to visual properties of the Rectangle
property alias color: rectangle.color
x: rectangle.x; y: rectangle.y
width: rectangle.width; height: rectangle.height
@@ -64,3 +65,4 @@ FocusScope {
}
}
//! [widget in focusscope]
+//! [document]
diff --git a/doc/src/snippets/declarative/focus/mywidget.qml b/doc/src/snippets/declarative/focus/mywidget.qml
index 86d2d0f..0cca747 100644
--- a/doc/src/snippets/declarative/focus/mywidget.qml
+++ b/doc/src/snippets/declarative/focus/mywidget.qml
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the FOO module of the Qt Toolkit.
+** 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:
@@ -37,10 +37,10 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+//! [document]
import QtQuick 1.0
//! [mywidget]
-//MyWidget code
Rectangle {
id: widget
color: "lightsteelblue"; width: 175; height: 25; radius: 10; smooth: true
diff --git a/doc/src/snippets/declarative/focus/widget.qml b/doc/src/snippets/declarative/focus/widget.qml
index a5053d9..a3a726e 100644
--- a/doc/src/snippets/declarative/focus/widget.qml
+++ b/doc/src/snippets/declarative/focus/widget.qml
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the FOO module of the Qt Toolkit.
+** 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:
diff --git a/doc/src/snippets/declarative/grid/grid-spacing.qml b/doc/src/snippets/declarative/grid-spacing.qml
index 8914ce3..8914ce3 100644
--- a/doc/src/snippets/declarative/grid/grid-spacing.qml
+++ b/doc/src/snippets/declarative/grid-spacing.qml
diff --git a/doc/src/snippets/declarative/grid/grid-items.qml b/doc/src/snippets/declarative/grid/grid-items.qml
deleted file mode 100644
index 3c60d12..0000000
--- a/doc/src/snippets/declarative/grid/grid-items.qml
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Rectangle {
- width: 112; height: 112
- color: "#303030"
-
- Grid {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- columns: 2
- spacing: 6
-
- Rectangle { color: "#aa6666"; width: 50; height: 50 }
- Rectangle { color: "#aaaa66"; width: 50; height: 50 }
- Rectangle { color: "#9999aa"; width: 50; height: 50 }
- Rectangle { color: "#6666aa"; width: 50; height: 50 }
- }
-}
diff --git a/doc/src/snippets/declarative/grid/grid-no-spacing.qml b/doc/src/snippets/declarative/grid/grid-no-spacing.qml
deleted file mode 100644
index 7c8b0f8..0000000
--- a/doc/src/snippets/declarative/grid/grid-no-spacing.qml
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Rectangle {
- width: 112; height: 112
- color: "#303030"
-
- Grid {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- columns: 2
-
- Rectangle { color: "#aa6666"; width: 50; height: 50 }
- Rectangle { color: "#aaaa66"; width: 50; height: 50 }
- Rectangle { color: "#9999aa"; width: 50; height: 50 }
- Rectangle { color: "#6666aa"; width: 50; height: 50 }
- }
-}
diff --git a/doc/src/snippets/code/doc_src_phonon.qdoc b/doc/src/snippets/declarative/imports/best-practices.qml
index 61ee189..17e5b7a 100644
--- a/doc/src/snippets/code/doc_src_phonon.qdoc
+++ b/doc/src/snippets/declarative/imports/best-practices.qml
@@ -38,16 +38,12 @@
**
****************************************************************************/
-//! [0]
-QT += phonon
-//! [0]
+//! [imports]
+import QtQuick 1.0
+import QtWebKit 1.0
+import "subdirectory"
+import "script.js"
+//! [imports]
-
-//! [1]
-QT += phonon
-//! [1]
-
-
-//! [2]
-#include <Phonon/MediaObject>
-//! [2]
+Item {
+}
diff --git a/doc/src/snippets/declarative/imports/chart.qml b/doc/src/snippets/declarative/imports/chart.qml
new file mode 100644
index 0000000..6de02c1
--- /dev/null
+++ b/doc/src/snippets/declarative/imports/chart.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [import]
+import Charts 1.0
+//! [import]
+
+Item {
+}
diff --git a/doc/src/snippets/declarative/imports/installed-module.qml b/doc/src/snippets/declarative/imports/installed-module.qml
new file mode 100644
index 0000000..288bdd3
--- /dev/null
+++ b/doc/src/snippets/declarative/imports/installed-module.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [imports]
+import QtQuick 1.0
+import com.nokia.qml.mymodule 1.0
+//! [imports]
+
+Item {
+}
diff --git a/doc/src/snippets/code/doc.src.qtscripttools.qdoc b/doc/src/snippets/declarative/imports/merged-named-imports.qml
index 76840b3..366e76e 100644
--- a/doc/src/snippets/code/doc.src.qtscripttools.qdoc
+++ b/doc/src/snippets/declarative/imports/merged-named-imports.qml
@@ -38,11 +38,10 @@
**
****************************************************************************/
-//! [0]
- #include <QtScriptTools>
-//! [0]
+//! [imports]
+import QtQuick 1.0 as Nokia
+import Ovi 1.0 as Nokia
+//! [imports]
-
-//! [1]
- QT += scripttools
-//! [1]
+Item {
+}
diff --git a/doc/src/snippets/declarative/qml-intro/hello-world4.qml b/doc/src/snippets/declarative/imports/named-imports.qml
index 832e37d..a8fa743 100644
--- a/doc/src/snippets/declarative/qml-intro/hello-world4.qml
+++ b/doc/src/snippets/declarative/imports/named-imports.qml
@@ -38,24 +38,24 @@
**
****************************************************************************/
-import QtQuick 1.0
+//! [imports]
+import QtQuick 1.0 as QtLibrary
+import "../MyComponents" as MyComponents
+import com.nokia.qml.mymodule 1.0 as MyModule
+//! [imports]
-Rectangle {
- id: myRectangle
- width: 500
- height: 400
-
- Text {
- text: "<h1>Hello world again</h1>"
- color: "#002288"
- x: 100; y: 100
+Item {
+ //! [imported items]
+ QtLibrary.Rectangle {
+ // ...
}
-//! [added an image]
- Image {
- source: "images/qt-logo.svg"
+ MyComponents.Slider {
+ // ...
}
-//! [added an image]
- color: "lightgray"
+ MyModule.SomeComponent {
+ // ...
+ }
+ //! [imported items]
}
diff --git a/doc/src/snippets/declarative/imports/network-imports.qml b/doc/src/snippets/declarative/imports/network-imports.qml
new file mode 100644
index 0000000..54e177a
--- /dev/null
+++ b/doc/src/snippets/declarative/imports/network-imports.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [imports]
+import "http://www.my-server.com/MyQMLProject/MyComponents"
+import "http://www.my-server.com/MyQMLProject/MyComponents" 1.0
+//! [imports]
+
+Item {
+}
diff --git a/doc/src/snippets/declarative/imports/qtquick-1.0.qml b/doc/src/snippets/declarative/imports/qtquick-1.0.qml
new file mode 100644
index 0000000..e2a642d
--- /dev/null
+++ b/doc/src/snippets/declarative/imports/qtquick-1.0.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [import]
+import QtQuick 1.0
+//! [import]
+
+Item {
+}
diff --git a/doc/src/snippets/declarative/imports/timeexample.qml b/doc/src/snippets/declarative/imports/timeexample.qml
new file mode 100644
index 0000000..24eafd7
--- /dev/null
+++ b/doc/src/snippets/declarative/imports/timeexample.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [import]
+import com.nokia.TimeExample 1.0
+//! [import]
+
+Item {
+}
diff --git a/doc/src/snippets/declarative/qml-intro/transformations1.qml b/doc/src/snippets/declarative/listview-decorations.qml
index 7be79c8..9ba9b70 100644
--- a/doc/src/snippets/declarative/qml-intro/transformations1.qml
+++ b/doc/src/snippets/declarative/listview-decorations.qml
@@ -41,40 +41,71 @@
//! [document]
import QtQuick 1.0
+//! [parent begin]
Rectangle {
- id: myWin
- width: 500
- height: 400
+//! [parent begin]
+ width: 550; height: 220; color: "white"
- Image {
- id: image1
- source: "images/qt-logo.svg"
- width: 150; height: 150
- anchors.bottom: myWin.bottom
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 10
-
- transform: Rotation {
- origin.x: 75; origin.y: 75
- axis{ x: 0; y: 0; z:1 } angle: -90
- }
-
- }
+//! [model]
+ListModel {
+ id: nameModel
+ ListElement { name: "Alice" }
+ ListElement { name: "Bob" }
+ ListElement { name: "Jane" }
+ ListElement { name: "Harry" }
+ ListElement { name: "Wendy" }
+}
+//! [model]
+//! [delegate]
+Component {
+ id: nameDelegate
Text {
- text: "<h2>The Qt Logo -- taking it easy</h2>"
- anchors.bottom: image1.top
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 15
+ text: name;
+ font.pixelSize: 24
+ }
+}
+//! [delegate]
- transform: [
- Scale { xScale: 1.5; yScale: 1.2 } ,
+//! [decorations]
+ListView {
+ anchors.fill: parent
+ clip: true
+ model: nameModel
+ delegate: nameDelegate
+ header: bannercomponent
+ footer: Rectangle {
+ width: parent.width; height: 30;
+ gradient: clubcolors
+ }
+ highlight: Rectangle {
+ width: parent.width
+ color: "lightgray"
+ }
+}
- Rotation {
- origin.x: 75; origin.y: 75
- axis{ x: 0; y: 0; z:1 } angle: -45
- }
- ]
+Component { //instantiated when header is processed
+ id: bannercomponent
+ Rectangle {
+ id: banner
+ width: parent.width; height: 50
+ gradient: clubcolors
+ border {color: "#9EDDF2"; width: 2}
+ Text {
+ anchors.centerIn: parent
+ text: "Club Members"
+ font.pixelSize: 32
+ }
}
}
+Gradient {
+ id: clubcolors
+ GradientStop { position: 0.0; color: "#8EE2FE"}
+ GradientStop { position: 0.66; color: "#7ED2EE"}
+}
+//! [decorations]
+
+//! [parent end]
+}
+//! [parent end]
//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/states1.qml b/doc/src/snippets/declarative/listview-sections.qml
index 270d6c3..74c96dd 100644
--- a/doc/src/snippets/declarative/qml-intro/states1.qml
+++ b/doc/src/snippets/declarative/listview-sections.qml
@@ -37,58 +37,65 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
//! [document]
import QtQuick 1.0
+//! [parent begin]
Rectangle {
- id: mainRectangle
- width: 600
- height: 400
- color: "black"
+//! [parent begin]
+ width: 150; height: 300; color: "white"
- Rectangle {
- id: sky
- width: 600
- height: 200
- y: 0
- color: "lightblue"
- }
+//! [model]
+ListModel {
+ id: nameModel
+ ListElement { name: "Alice"; team: "Crypto" }
+ ListElement { name: "Bob"; team: "Crypto" }
+ ListElement { name: "Jane"; team: "QA" }
+ ListElement { name: "Victor"; team: "QA" }
+ ListElement { name: "Wendy"; team: "Graphics" }
+}
+//! [model]
- Rectangle {
- id: ground
- width: 600; height: 200
- y: 200
- color: "green"
+//! [delegate]
+Component {
+ id: nameDelegate
+ Text {
+ text: name;
+ font.pixelSize: 24
+ anchors.left: parent.left
+ anchors.leftMargin: 2
}
+}
+//! [delegate]
- MouseArea {
- id: mousearea
- anchors.fill: mainRectangle
+//! [section]
+ListView {
+ anchors.fill: parent
+ model: nameModel
+ delegate: nameDelegate
+ focus: true
+ highlight: Rectangle {
+ color: "lightblue"
+ width: parent.width
}
-
- states: [ State {
- name: "night"
- when: mousearea.pressed == true
- PropertyChanges { target: sky; color: "darkblue" }
- PropertyChanges { target: ground; color: "black" }
- },
- State {
- name: "daylight"
- when: mousearea.pressed == false
- PropertyChanges { target: sky; color: "lightblue" }
- PropertyChanges { target: ground; color: "green" }
+ section {
+ property: "team"
+ criteria: ViewSection.FullString
+ delegate: Rectangle {
+ color: "#b0dfb0"
+ width: parent.width
+ height: childrenRect.height + 4
+ Text { anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 16
+ font.bold: true
+ text: section
+ }
}
- ]
+ }
+}
+//! [section]
- transitions: [ Transition {
- from: "daylight"; to: "night"
- ColorAnimation { duration: 1000 }
- },
- Transition {
- from: "night"; to: "daylight"
- ColorAnimation { duration: 500 }
- }
- ]
+//! [parent end]
}
+//! [parent end]
//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/number-animation1.qml b/doc/src/snippets/declarative/listview.qml
index ccf2d36..081d2b0 100644
--- a/doc/src/snippets/declarative/qml-intro/number-animation1.qml
+++ b/doc/src/snippets/declarative/listview.qml
@@ -41,24 +41,47 @@
//! [document]
import QtQuick 1.0
+//! [parent begin]
Rectangle {
- id: mainRec
- width: 600
- height: 400
+//! [parent begin]
+ width: 175; height: 175; color: "white"
- Image {
- id: image1
- source: "images/qt-logo.svg"
- x: 200; y: 100
- width: 100; height: 100
+//! [model]
+ListModel {
+ id: petlist
+ ListElement { type: "Cat" }
+ ListElement { type: "Dog" }
+ ListElement { type: "Mouse" }
+ ListElement { type: "Rabbit" }
+ ListElement { type: "Horse" }
+}
+//! [model]
- // Animate a rotation
- transformOrigin: Item.Center
- NumberAnimation on rotation {
- from: 0; to: 360
- duration: 2000
- loops: Animation.Infinite
- }
+//! [delegate]
+Component {
+ id: petdelegate
+ Text {
+ id: label
+ font.pixelSize: 24
+ text: if (index == 0)
+ label.text = type + " (default)"
+ else
+ text: type
}
}
+//! [delegate]
+
+//! [view]
+ListView {
+ id: view
+ anchors.fill: parent
+
+ model: petlist
+ delegate: petdelegate
+}
+//! [view]
+
+//! [parent end]
+}
+//! [parent end]
//! [document]
diff --git a/doc/src/snippets/declarative/listview/listview-snippet.qml b/doc/src/snippets/declarative/listview/listview-snippet.qml
deleted file mode 100644
index f73dec9..0000000
--- a/doc/src/snippets/declarative/listview/listview-snippet.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-
-//! [document]
-import QtQuick 1.0
-
-ListView {
- width: 50; height: 200
- model: 4
- delegate: Text {
- text: index;
- font.pixelSize: 40
- }
-}
-//! [document]
diff --git a/doc/src/snippets/declarative/animation-behavioral.qml b/doc/src/snippets/declarative/models/views-models-delegates.qml
index 93cf2fa..2f76856 100644
--- a/doc/src/snippets/declarative/animation-behavioral.qml
+++ b/doc/src/snippets/declarative/models/views-models-delegates.qml
@@ -37,25 +37,42 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-//![0]
-import QtQuick 1.0
-Item {
- width: 100; height: 100
+//! [rectangle]
+Rectangle {
+ width: 200; height: 200
- Rectangle {
- id: rect
- width: 100; height: 100
- color: "red"
-
- Behavior on x { PropertyAnimation { duration: 500 } }
- Behavior on y { PropertyAnimation { duration: 500 } }
+ ListModel {
+ id: fruitModel
+ property string language: "en"
+ ListElement {
+ name: "Apple"
+ cost: 2.45
+ }
+ ListElement {
+ name: "Orange"
+ cost: 3.25
+ }
+ ListElement {
+ name: "Banana"
+ cost: 1.95
+ }
}
- MouseArea {
+ Component {
+ id: fruitDelegate
+ Row {
+ Text { text: " Fruit: " + name; color: ListView.view.fruit_color }
+ Text { text: " Cost: $" + cost }
+ Text { text: " Language: " + ListView.view.model.language }
+ }
+ }
+
+ ListView {
+ property color fruit_color: "green"
+ model: fruitModel
+ delegate: fruitDelegate
anchors.fill: parent
- onClicked: { rect.x = mouse.x; rect.y = mouse.y }
}
}
-//![0]
-
+//! [rectangle]
diff --git a/doc/src/snippets/declarative/animation-transitions.qml b/doc/src/snippets/declarative/models/visual-model-and-view.qml
index 62bef23..4d42b65 100644
--- a/doc/src/snippets/declarative/animation-transitions.qml
+++ b/doc/src/snippets/declarative/models/visual-model-and-view.qml
@@ -37,26 +37,21 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-//![0]
-import QtQuick 1.0
Rectangle {
- id: rect
- width: 100; height: 100
- color: "red"
-
- MouseArea {
- anchors.fill: parent
- onClicked: rect.state = "moved"
- }
-
- states: State {
- name: "moved"
- PropertyChanges { target: rect; x: 50; y: 50 }
+ width: 200; height: 200
+
+ //! [visual model and view]
+ VisualItemModel {
+ id: itemModel
+ Rectangle { height: 30; width: 80; color: "red" }
+ Rectangle { height: 30; width: 80; color: "green" }
+ Rectangle { height: 30; width: 80; color: "blue" }
}
-
- transitions: Transition {
- PropertyAnimation { properties: "x,y"; duration: 1000 }
+
+ ListView {
+ anchors.fill: parent
+ model: itemModel
}
+ //! [visual model and view]
}
-//![0]
diff --git a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml
index 3c2e143..03473ba 100644
--- a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml
+++ b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml
@@ -41,13 +41,60 @@
//! [document]
import QtQuick 1.0
-Rectangle {
- width: 100; height: 100
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ width: 500; height: 500
color: "green"
- MouseArea {
+Column {
+//! [anchor fill]
+Rectangle {
+ id: button
+ width: 100; height: 100
+
+ MouseArea {
anchors.fill: parent
- onClicked: { parent.color = 'red' }
+ onClicked: console.log("button clicked")
+ }
+ MouseArea {
+ width:150; height: 75
+ onClicked: console.log("irregular area clicked")
+ }
+}
+//! [anchor fill]
+
+Rectangle {
+ id: button
+ width: 100; height: 100
+
+//! [enable handlers]
+ MouseArea {
+ hoverEnabled: true
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onEntered: console.log("mouse entered the area")
+ onExited: console.log("mouse left the area")
}
+//! [enable handlers]
+}
+
+Rectangle {
+ id: button
+ width: 100; height: 100
+
+//! [mouse handlers]
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log("area clicked")
+ onDoubleClicked: console.log("area double clicked")
+ onEntered: console.log("mouse entered the area")
+ onExited: console.log("mouse left the area")
+ }
+//! [mouse handlers]
+}
+
+} //end of column
+//! [parent end]
}
+//! [parent end]
//! [document]
diff --git a/doc/src/snippets/declarative/pics/qt.png b/doc/src/snippets/declarative/pics/qt.png
index cbed1a9..4f68e16 100644
--- a/doc/src/snippets/declarative/pics/qt.png
+++ b/doc/src/snippets/declarative/pics/qt.png
Binary files differ
diff --git a/doc/src/snippets/declarative/properties.qml b/doc/src/snippets/declarative/properties.qml
new file mode 100644
index 0000000..330d1cf
--- /dev/null
+++ b/doc/src/snippets/declarative/properties.qml
@@ -0,0 +1,315 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+//! [document]
+import QtQuick 1.0
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+
+ //! [inherited properties]
+ width: 320; height: 240
+ color: "lightblue"
+ focus: true
+ //! [inherited properties]
+
+ //! [custom properties]
+ property int counter
+ property real area: 100.45
+ //! [custom properties]
+
+ //! [property types]
+ property int number
+ property real volume: 100.45
+ property date today: "2011-01-01"
+ property color background: "yellow"
+ //! [property types]
+
+
+//! [grouped properties]
+Text {
+ //dot notation
+ font.pixelSize: 12
+ font.bold: true
+}
+
+Text {
+ //group notation
+ font {pixelSize: 12; bold: true}
+}
+//! [grouped properties]
+
+
+//! [property binding]
+Rectangle {
+ width: parent.width
+}
+//! [property binding]
+
+//! [property assignment]
+Rectangle {
+ Component.onCompleted: {
+ width = 150
+ }
+}
+//! [property assignment]
+
+Rectangle {
+ //placeholder slider
+ id: slider
+ property real value
+}
+Rectangle {
+ //placeholder system
+ id: system
+ property real brightness
+}
+//! [binding element]
+Binding {
+ target: system
+ property: "brightness"
+ value: slider.value
+}
+//! [binding element]
+
+Rectangle {
+ //placeholder warning
+ id: warning
+ color: "red"
+}
+//! [PropertyChanges element]
+Rectangle {
+ id: rectangle
+
+ states: State {
+ name: "WARNING"
+ PropertyChanges {
+ target: rectangle
+ color: warning.color
+ }
+ }
+}
+//! [PropertyChanges element]
+
+//! [list property]
+Item {
+ id: multistate
+ states: [
+ State {name: "FETCH"},
+ State {name: "DECODE"},
+ State {name: "EXECUTE"}
+ ]
+}
+//! [list property]
+//! [single property]
+Item {
+ id: monostate
+ states: State {name: "RUNNING"}
+}
+//! [single property]
+
+Item {
+ id: printstate
+//! [print list property]
+ Component.onCompleted: console.log (multistate.states[0].name)
+//! [print list property]
+}
+
+//! [JavaScript sample]
+function calculateArea(width, height) {
+ return (width * height) * 0.5
+}
+
+Rectangle {
+ width: 150; height: 75
+ property real area: calculateArea(width, height)
+ property real parentArea: calculateArea(parent.width,parent.height)
+ color: { if (area > parentArea) "blue"; else "red" }
+}
+//! [JavaScript sample]
+
+//! [id property]
+Rectangle {
+ id: container
+ width: 100; height: 100
+ Rectangle {
+ width: parent.width; height: parent.height
+ }
+}
+Rectangle {
+ width: container.width; height: container.height
+}
+//! [id property]
+
+//! [default property]
+Item {
+ Text {}
+ Rectangle {}
+ Timer {}
+}
+
+Item {
+ //without default property
+ children: [
+ Text {},
+ Rectangle {}
+ ]
+ resources: [
+ Timer {}
+ ]
+}
+//! [default property]
+
+//! [state default]
+State {
+ changes: [
+ PropertyChanges {},
+ PropertyChanges {}
+ ]
+}
+
+State {
+ PropertyChanges {}
+ PropertyChanges {}
+}
+//! [state default]
+
+//! [object binding]
+Rectangle {
+
+ id: parentrectangle
+ gradient:
+ Gradient { //not a child of parentrectangle
+
+ //generates a TypeError
+ //Component.onCompleted: console.log(parent.width)
+ }
+
+ //child of parentrectangle
+ Rectangle {property string name: "childrectangle"}
+
+ //prints "childrectangle"
+ Component.onCompleted: console.log(children[0].name)
+}
+//! [object binding]
+
+//! [list attached property]
+Component {
+ id: listdelegate
+ Text {
+ text: "Hello"
+ color: ListView.isCurrentItem ? "red" : "blue"
+ }
+}
+ListView {
+ delegate: listdelegate
+}
+//! [list attached property]
+
+//! [attached signal handler]
+Item {
+ Keys.onPressed: console.log("Key Press Detected")
+ Component.onCompleted: console.log("Completed initialization")
+}
+//! [attached signal handler]
+
+//! [alias usage]
+Button {
+ id: textbutton
+ buttonLabel: "Click Me!"
+}
+//! [alias usage]
+
+//! [image alias]
+Button {
+ id: imagebutton
+ buttonImage.source: "http://qt.nokia.com/logo.png"
+ buttonLabel: buttonImage.source
+}
+//! [image alias]
+
+Item {
+id: widget
+
+//! [alias complete]
+property alias widgetLabel: label
+
+//will generate an error
+//widgetLabel.text: "Initial text"
+
+//will generate an error
+//property alias widgetLabelText: widgetLabel.text
+
+Component.onCompleted: widgetLabel.text = "Alias completed Initialization"
+//! [alias complete]
+
+ Text {id: label}
+}
+
+//![alias overwrite]
+Rectangle {
+ id: coloredrectangle
+ property alias color: bluerectangle.color
+ color: "red"
+
+ Rectangle {
+ id: bluerectangle
+ color: "#1234ff"
+ }
+
+ Component.onCompleted: {
+ console.log (coloredrectangle.color) //prints "#1234ff"
+ setInternalColor()
+ console.log (coloredrectangle.color) //prints "#111111"
+ coloredrectangle.color = "#884646"
+ console.log (coloredrectangle.color) //prints #884646
+ }
+
+ //internal function that has access to internal properties
+ function setInternalColor() {
+ color = "#111111"
+ }
+}
+//![alias overwrite]
+//! [parent end]
+}
+//! [parent end]
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/anchors3.qml b/doc/src/snippets/declarative/qml-intro/anchors3.qml
deleted file mode 100644
index 24851af..0000000
--- a/doc/src/snippets/declarative/qml-intro/anchors3.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Rectangle {
- id: myWin
- width: 500
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.svg"
- width: 150; height: 150
- anchors.bottom: myWin.bottom
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 10
- }
-
-//! [adding some text]
- Text {
- text: "<h2>The Qt Logo</h2>"
- anchors.bottom: image1.top
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 15
- }
-//! [adding some text]
-}
diff --git a/doc/src/snippets/declarative/qml-intro/hello-world2.qml b/doc/src/snippets/declarative/qml-intro/hello-world2.qml
deleted file mode 100644
index 2564e25..0000000
--- a/doc/src/snippets/declarative/qml-intro/hello-world2.qml
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Rectangle {
- id: myRectangle
- width: 500
- height: 400
-
-//! [updated text]
- Text {
- text: "<h2>Hello World</h2>"; color: "darkgreen"
- x: 100; y:100
- }
-//! [updated text]
-
- color: "lightgray"
-}
diff --git a/doc/src/snippets/declarative/qml-intro/hello-world3.qml b/doc/src/snippets/declarative/qml-intro/hello-world3.qml
deleted file mode 100644
index 03358d0..0000000
--- a/doc/src/snippets/declarative/qml-intro/hello-world3.qml
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Rectangle {
- id: myRectangle
- width: 500
- height: 400
-
-//! [updated text]
- Text {
- text: "<h1>Hello world again</h1>"
- color: "#002288"
- x: 100; y: 100
- }
-//! [updated text]
-
- color: "lightgray"
-}
diff --git a/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg b/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg
deleted file mode 100644
index 8c018be..0000000
--- a/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- clip-rule="evenodd"
- stroke-miterlimit="10"
- viewBox="0 0 174.35 209.78"
- id="svg2"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- width="744.09186"
- height="895.29858"
- sodipodi:docname="qt-logo.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape"
- version="1.0"
- style="stroke-miterlimit:10">
- <metadata
- id="metadata29">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <sodipodi:namedview
- inkscape:window-height="668"
- inkscape:window-width="722"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- guidetolerance="10.0"
- gridtolerance="10.0"
- objecttolerance="10.0"
- borderopacity="1.0"
- bordercolor="#666666"
- pagecolor="#ffffff"
- id="base"
- showgrid="false"
- inkscape:zoom="0.12195802"
- inkscape:cx="525.6108"
- inkscape:cy="-287.87189"
- inkscape:window-x="476"
- inkscape:window-y="228"
- inkscape:current-layer="svg2" />
- <desc
- id="desc4">SVG generated by Lineform</desc>
- <defs
- id="defs6">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 526.18109 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective31" />
- </defs>
- <g
- id="g8"
- transform="translate(-1.5304326e-4,-3.775985e-4)">
- <path
- d="M 43.08,0.36 C 40.94,0 38.84,-0.08 36.81,0.08 L 36.8,0.08 C 36.8,0.08 22.92,1.02 22.29,1.07 C 9.62,2.08 0,12.5 0,26.89 L 0,196.55 L 14.19,209.78 L 156.79,185.81 C 166.6,184.11 174.35,172.54 174.35,160.04 L 174.35,21.88 L 43.08,0.36"
- id="path10"
- style="fill:#0c481e" />
- <path
- d="M 174.35,160.04 C 174.35,172.54 166.6,184.11 156.79,185.82 L 14.19,209.78 L 14.19,25.99 C 14.19,9.27 27.53,-2.21 43.08,0.36 L 174.35,21.88 L 174.35,160.04"
- id="path12"
- style="fill:#66b036" />
- <path
- d="M 130.42,45.91 L 141.94,47.15 L 141.94,67.36 L 154.9,68.28 L 154.9,80.96 L 141.94,80.36 L 141.94,126.69 C 141.94,130.72 142.38,133.31 143.28,134.48 C 144.08,135.55 145.32,136.07 146.99,136.07 C 147.15,136.07 147.32,136.07 147.48,136.06 C 150.03,135.91 152.81,135.13 155.83,133.75 L 155.83,145.4 C 150.69,147.65 145.65,149 140.7,149.42 C 139.99,149.47 139.29,149.5 138.62,149.5 C 134.14,149.5 130.72,148.2 128.38,145.57 C 125.65,142.52 124.29,137.62 124.29,130.9 L 124.29,79.54 L 118.06,79.26 L 118.06,65.67 L 125.65,66.22 L 130.42,45.91"
- id="path14"
- style="fill:#ffffff" />
- <path
- d="M 154.9,80.96 L 141.94,80.36 L 141.94,80.64 L 148.88,80.96 L 154.9,80.96"
- id="path16"
- style="fill:#0c481e" />
- <path
- d="M 144.64,135.6 C 145.3,135.92 146.07,136.07 146.99,136.07 C 147.15,136.07 147.32,136.07 147.48,136.06 C 150.03,135.91 152.81,135.13 155.83,133.75 L 149.81,133.75 C 147.99,134.58 146.28,135.21 144.64,135.6"
- id="path18"
- style="fill:#0c481e" />
- <path
- d="M 128.38,145.57 C 125.65,142.52 124.29,137.62 124.29,130.9 L 124.29,79.54 L 118.06,79.26 L 118.06,65.67 L 112.05,65.67 L 112.05,68.71 C 112.92,71.98 113.6,75.53 114.11,79.35 L 118.28,79.54 L 118.28,130.9 C 118.28,137.62 119.64,142.52 122.37,145.57 C 124.71,148.2 128.13,149.5 132.61,149.5 L 138.62,149.5 C 134.14,149.5 130.72,148.2 128.38,145.57 z M 130.42,45.91 L 124.41,45.91 L 119.74,65.79 L 125.65,66.22 L 130.42,45.91"
- id="path20"
- style="fill:#0c481e" />
- <path
- d="M 91.15,132.4 C 93.5,126.36 94.66,114.49 94.66,96.79 C 94.66,80.9 93.51,69.97 91.18,63.98 C 88.84,57.95 85.35,54.69 80.66,54.28 C 80.3,54.25 79.95,54.23 79.6,54.23 C 75.26,54.23 71.92,56.77 69.59,61.86 C 67.07,67.4 65.8,78.9 65.8,96.3 C 65.8,113.11 67.04,125.05 69.54,132.05 C 71.89,138.72 75.41,142.03 80.04,142.03 C 80.25,142.03 80.45,142.02 80.66,142.01 C 85.29,141.71 88.78,138.51 91.15,132.4 M 109.13,136.15 C 105.01,145.86 98.73,152.21 90.14,155.15 C 91.01,159.6 92.32,162.6 94.06,164.17 C 95.41,165.39 97.49,165.99 100.28,165.99 C 101.09,165.99 101.96,165.94 102.87,165.84 L 102.87,178.96 L 96.91,179.75 C 95.16,179.97 93.49,180.09 91.91,180.09 C 86.69,180.09 82.47,178.82 79.29,176.26 C 75.08,172.89 71.98,166.37 69.99,156.73 C 60.86,154.78 53.73,148.97 48.8,139.23 C 43.8,129.32 41.25,114.83 41.25,95.89 C 41.25,75.46 44.74,60.38 51.6,50.81 C 57.38,42.75 65.46,38.78 75.62,38.78 C 77.24,38.78 78.93,38.88 80.66,39.08 C 92.61,40.46 101.28,46.1 106.92,55.87 C 112.46,65.43 115.17,79.14 115.17,97.13 C 115.17,113.62 113.17,126.58 109.13,136.15"
- id="path22"
- style="fill:#ffffff" />
- <path
- d="M 100.28,165.99 C 101.09,165.99 101.95,165.94 102.87,165.84 L 98.04,165.84 C 98.71,165.94 99.49,165.99 100.28,165.99"
- id="path24"
- style="fill:#0c481e" />
- <path
- d="M 84.85,63.98 C 87.19,69.97 88.34,80.9 88.34,96.79 C 88.34,114.49 87.18,126.36 84.82,132.4 C 82.93,137.28 80.3,140.31 76.96,141.48 C 77.93,141.84 78.96,142.03 80.04,142.03 C 80.25,142.03 80.45,142.02 80.66,142.01 C 85.29,141.71 88.78,138.51 91.15,132.4 C 93.5,126.36 94.66,114.49 94.66,96.79 C 94.66,80.9 93.51,69.97 91.18,63.98 C 88.84,57.95 85.35,54.69 80.66,54.28 C 80.3,54.25 79.95,54.23 79.6,54.23 C 78.51,54.23 77.48,54.39 76.52,54.72 L 76.52,54.72 C 80.12,55.83 82.89,58.93 84.85,63.98 z M 82.51,178.25 C 82.4,178.2 82.28,178.15 82.17,178.09 C 82.16,178.09 82.15,178.08 82.14,178.08 C 82.03,178.03 81.93,177.97 81.83,177.92 C 81.81,177.91 81.79,177.9 81.77,177.89 C 81.68,177.84 81.59,177.79 81.49,177.74 C 81.46,177.72 81.44,177.71 81.41,177.69 C 81.33,177.65 81.24,177.6 81.16,177.55 C 81.12,177.53 81.09,177.51 81.05,177.48 C 80.98,177.44 80.91,177.4 80.84,177.36 C 80.79,177.33 80.74,177.3 80.7,177.27 C 80.64,177.23 80.58,177.19 80.52,177.15 C 80.46,177.12 80.41,177.08 80.35,177.04 C 80.3,177.01 80.25,176.98 80.2,176.94 C 80.14,176.9 80.07,176.85 80.01,176.81 C 79.97,176.78 79.93,176.75 79.89,176.72 C 79.82,176.67 79.74,176.61 79.67,176.55 C 79.64,176.54 79.61,176.52 79.59,176.5 C 79.49,176.42 79.39,176.34 79.29,176.26 C 75.08,172.89 71.98,166.37 69.99,156.73 C 60.86,154.78 53.73,148.97 48.8,139.23 C 43.8,129.32 41.25,114.83 41.25,95.89 C 41.25,75.46 44.74,60.38 51.6,50.81 C 57.38,42.75 65.46,38.78 75.62,38.78 C 75.65,38.78 69.27,38.77 69.27,38.77 L 69.27,38.78 C 59.12,38.78 51.05,42.75 45.27,50.81 C 38.41,60.38 34.92,75.46 34.92,95.89 C 34.92,114.83 37.47,129.32 42.47,139.23 C 47.41,148.97 54.53,154.78 63.67,156.73 C 65.65,166.37 68.76,172.89 72.96,176.26 C 76.14,178.82 80.36,180.09 85.58,180.09 C 85.68,180.09 85.78,180.09 85.88,180.09 L 91.42,180.09 C 88.01,180.03 85.04,179.43 82.52,178.26 C 82.51,178.26 82.51,178.26 82.51,178.25"
- id="path26"
- style="fill:#0c481e" />
- </g>
-</svg>
diff --git a/doc/src/snippets/declarative/qml-intro/number-animation2.qml b/doc/src/snippets/declarative/qml-intro/number-animation2.qml
deleted file mode 100644
index 7be22b5..0000000
--- a/doc/src/snippets/declarative/qml-intro/number-animation2.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-
-//! [document]
-import QtQuick 1.0
-
-Rectangle {
- id: mainRec
- width: 600
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.svg"
- x: 200; y: 100
- width: 100; height: 100
-
- // Animate a rotation
- transform: Rotation {
- origin.x: 50; origin.y: 50; axis {x:0; y:1; z:0} angle:0
- NumberAnimation on angle {
- from: 0; to: 360;
- duration: 3000;
- loops: Animation.Infinite
- }
- }
- }
-}
-//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/rectangle.qml b/doc/src/snippets/declarative/qml-intro/rectangle.qml
deleted file mode 100644
index b25accc..0000000
--- a/doc/src/snippets/declarative/qml-intro/rectangle.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-
-//! [document]
-import QtQuick 1.0
-
-// This is a comment. And below myRectangle is defined.
-Rectangle {
- id: myRectangle
- width: 500
- height: 400
-}
-//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml
deleted file mode 100644
index c789bbe..0000000
--- a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-
-//! [document]
-import QtQuick 1.0
-
-Rectangle {
- id: mainRec
- width: 600
- height: 400
- z: 0
-
- Image {
- id: image1
- source: "images/qt-logo.svg"
- x: 20; y: 20 ; z: 1
- width: 100; height: 100
- }
-
- Image {
- id: image2
- source: "images/qt-logo.svg"
- width: 100; height: 100
- x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2
- z: 2
- }
-}
-//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml
deleted file mode 100644
index b2b1a57..0000000
--- a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Rectangle {
- id: mainRec
- width: 600
- height: 400
- z: 0
-
-//! [adding a sequential animation]
- Image {
- id: image1
- source: "images/qt-logo.svg"
- width: 100; height: 100
-
- SequentialAnimation on x {
- loops: Animation.Infinite
- NumberAnimation {
- from: 20; to: 450; easing.type: "InOutQuad";
- duration: 2000
- }
- PauseAnimation { duration: 500 }
- }
- }
-//! [adding a sequential animation]
-
- Image {
- id: image2
- source: "images/qt-logo.svg"
- width: 100; height: 100
- x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2
- z: 2
- }
-}
diff --git a/doc/src/snippets/declarative/reusablecomponents/Button.qml b/doc/src/snippets/declarative/reusablecomponents/Button.qml
new file mode 100644
index 0000000..3b97e00
--- /dev/null
+++ b/doc/src/snippets/declarative/reusablecomponents/Button.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+//! [document]
+//contents of Button.qml
+import QtQuick 1.0
+
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ id: button
+//! [properties]
+ width: 145; height: 60
+ color: "blue"
+ smooth: true; radius: 9
+ property alias text: label.text
+//! [properties]
+ border {color: "#B9C5D0"; width: 1}
+
+ gradient: Gradient {
+ GradientStop {color: "#CFF7FF"; position: 0.0}
+ GradientStop {color: "#99C0E5"; position: 0.57}
+ GradientStop {color: "#719FCB"; position: 0.9}
+ }
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+ text: "Click Me!"
+ font.pointSize: 12
+ color: "blue"
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log(text + " clicked")
+ }
+//! [parent end]
+}
+//! [parent end]
+
+//! [document]
+
+//! [ellipses]
+ //...
+//! [ellipses]
+
+
diff --git a/doc/src/snippets/declarative/qml-intro/anchors1.qml b/doc/src/snippets/declarative/reusablecomponents/application.qml
index b958138..a09b276 100644
--- a/doc/src/snippets/declarative/qml-intro/anchors1.qml
+++ b/doc/src/snippets/declarative/reusablecomponents/application.qml
@@ -37,20 +37,19 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
//! [document]
import QtQuick 1.0
Rectangle {
- id: myWin
- width: 500
- height: 400
+ width: 175; height: 350
+ color: "lightgrey"
- Image {
- id: image1
- source: "images/qt-logo.svg"
- width: 150; height: 150
- anchors.bottom: myWin.bottom
+ Column {
+ anchors.centerIn: parent
+ spacing: 15
+ Button {}
+ Button {text: "Me Too!"}
+ Button {text: "Me Three!"}
}
}
//! [document]
diff --git a/doc/src/snippets/declarative/animation-standalone.qml b/doc/src/snippets/declarative/reusablecomponents/component.qml
index 0bf3020..8660c50 100644
--- a/doc/src/snippets/declarative/animation-standalone.qml
+++ b/doc/src/snippets/declarative/reusablecomponents/component.qml
@@ -37,27 +37,41 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-//![0]
+//! [document]
import QtQuick 1.0
+//! [parent begin]
Rectangle {
- id: rect
- width: 100; height: 100
- color: "red"
-
- PropertyAnimation {
- id: animation
- target: rect
- properties: "x,y"
- duration: 1000
+//! [parent begin]
+ id: screen
+ width: 175; height: 175
+ color: "lightgrey"
+
+//! [define inline component]
+ Component {
+ id: inlinecomponent
+ Rectangle {
+ id: display
+ width: 50; height: 50
+ color: "blue"
+ }
}
-
+//! [define inline component]
+//! [create inline component]
MouseArea {
anchors.fill: parent
onClicked: {
- animation.to = 50;
- animation.running = true;
+ inlinecomponent.createObject(parent)
+
+ var second = inlinecomponent.createObject(parent)
+
+ var third = inlinecomponent.createObject(parent)
+ third.x = second.width + 10
+ third.color = "red"
}
- }
+ }
+//! [create inline component]
+//! [parent end]
}
-//![0]
+//! [parent end]
+//! [document]
diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml b/doc/src/snippets/declarative/reusablecomponents/focusbutton.qml
index d840575..2522a98 100644
--- a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml
+++ b/doc/src/snippets/declarative/reusablecomponents/focusbutton.qml
@@ -37,56 +37,62 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-import QtQuick 1.0
-
//! [document]
+//contents of focusbutton.qml
import QtQuick 1.0
-Rectangle {
- id: mainRec
- width: 600
- height: 400
- z: 0
+//! [parent begin]
+FocusScope {
+//! [parent begin]
- Image {
- id: image2
- source: "images/qt-logo.svg"
- width: 100; height: 100
- x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2
- z: 2
- }
+ //! [expose visuals]
+ //FocusScope needs to bind to visual properties of the children
+ property alias color: button.color
+ x: button.x; y: button.y
+ width: button.width; height: button.height
+ //! [expose visuals]
- Image {
- id: image1
- source: "images/qt-logo.svg"
- x: 20; y: 20 ; z: 1
- width: 100; height: 100
+ //! [rectangle begin]
+ Rectangle {
+ //! [rectangle begin]
+ id: button
+ //! [properties]
+ width: 145; height: 60
+ color: "blue"
+ smooth: true; radius: 9
+ property alias text: label.text
+ //! [properties]
+ border {color: "#B9C5D0"; width: 1}
- SequentialAnimation on x {
- loops: Animation.Infinite
- NumberAnimation {
- from: 20; to: 450
- easing.type: "InOutQuad"; duration: 2000
- }
- PauseAnimation { duration: 500 }
+ gradient: Gradient {
+ GradientStop {color: "#CFF7FF"; position: 0.0}
+ GradientStop {color: "#99C0E5"; position: 0.57}
+ GradientStop {color: "#719FCB"; position: 0.9}
}
- SequentialAnimation on y {
- loops: Animation.Infinite
- NumberAnimation {
- from: 20; to: 250
- easing.type: "InOutQuad"; duration: 2000
- }
- PauseAnimation { duration: 500 }
+ Text {
+ id: label
+ anchors.centerIn: parent
+ text: "Click Me!"
+ font.pointSize: 12
+ color: "blue"
}
- SequentialAnimation on scale {
- loops: Animation.Infinite
- NumberAnimation { from: 1; to: 0.5; duration: 1000 }
- NumberAnimation { from: 0.5; to: 1; duration: 1000 }
- PauseAnimation { duration: 500 }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log(text + " clicked")
}
+ //! [rectangle end]
}
+ //! [rectangle end]
+//! [parent end]
}
+//! [parent end]
+
//! [document]
+
+//! [ellipses]
+ //...
+//! [ellipses]
+
+
diff --git a/doc/src/snippets/declarative/reusablecomponents/qmldir b/doc/src/snippets/declarative/reusablecomponents/qmldir
new file mode 100644
index 0000000..253732d
--- /dev/null
+++ b/doc/src/snippets/declarative/reusablecomponents/qmldir
@@ -0,0 +1,4 @@
+//! [document]
+Button ./Button.qml
+FocusButton ./focusbutton.qml
+//! [document]
diff --git a/doc/src/snippets/declarative/states.qml b/doc/src/snippets/declarative/states.qml
index c3b7197..ab6b8d0 100644
--- a/doc/src/snippets/declarative/states.qml
+++ b/doc/src/snippets/declarative/states.qml
@@ -37,24 +37,85 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-//![0]
+//![document]
import QtQuick 1.0
-
+
+//![parent begin]
Rectangle {
- id: myRect
- width: 200; height: 200
- color: "red"
+//![parent begin]
+
+ id: screen
+ width: 400; height: 500
- MouseArea {
- anchors.fill: parent
- onClicked: myRect.state = 'moved'
- }
+
+Rectangle {
+ id: flag
+}
+Column {
+ spacing: 15
+//![signal states]
+Rectangle {
+ id: signal
+ width: 200; height: 200
+ state: "NORMAL"
states: [
State {
- name: "moved"
- PropertyChanges { target: myRect; x: 50; y: 50 }
+ name: "NORMAL"
+ PropertyChanges { target: signal; color: "green"}
+ PropertyChanges { target: flag; state: "FLAG_DOWN"}
+ },
+ State {
+ name: "CRITICAL"
+ PropertyChanges { target: signal; color: "red"}
+ PropertyChanges { target: flag; state: "FLAG_UP"}
}
]
}
-//![0]
+//![signal states]
+
+//![switch states]
+Rectangle {
+ id: signalswitch
+ width: 75; height: 75
+ color: "blue"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (signal.state == "NORMAL")
+ signal.state = "CRITICAL"
+ else
+ signal.state = "NORMAL"
+ }
+ }
+}
+//![switch states]
+
+//![when property]
+Rectangle {
+ id: bell
+ width: 75; height: 75
+ color: "yellow"
+
+ states: State {
+ name: "RINGING"
+ when: (signal.state == "CRITICAL")
+ PropertyChanges {target: speaker; play: "RING!"}
+ }
+}
+//![when property]
+
+Text {
+ id: speaker
+ property alias play: speaker.text
+ text: "NORMAL"
+}
+
+} // end of row
+
+//![parent end]
+}
+//![parent end]
+
+//![document]
diff --git a/doc/src/snippets/declarative/qml-intro/hello-world5.qml b/doc/src/snippets/declarative/texthandling.qml
index 7357282..377bb8b 100644
--- a/doc/src/snippets/declarative/qml-intro/hello-world5.qml
+++ b/doc/src/snippets/declarative/texthandling.qml
@@ -37,29 +37,53 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
//! [document]
import QtQuick 1.0
+
+//! [parent begin]
Rectangle {
- id: myRectangle
- width: 500
- height: 400
+//! [parent begin]
+ width: 300; height: 300
+ id: screen
+
+Column {
+ anchors.centerIn:parent
+
+//! [int validator]
+Column {
+ spacing: 10
Text {
- text: "<h1>Hello world again</h1>"
- color: "#002288"
- x: 100; y: 100
+ text: "Enter a value from 0 to 2000"
}
+ TextInput {
+ focus: true
+ validator: IntValidator { bottom:0; top: 2000}
+ }
+}
+//! [int validator]
+
+//! [regexp validator]
+Column {
+ spacing: 10
-//! [positioning the image]
- Image {
- source: "images/qt-logo.svg"
- x: 100; y: 150
- width: 150; height: 150
+ Text {
+ text: "Which basket?"
+ }
+ TextInput {
+ focus: true
+ validator: RegExpValidator { regExp: /fruit basket/ }
}
-//! [positioning the image]
+}
+//! [regexp validator]
- color: "lightgray"
+//end of column
}
+
+//! [parent end]
+}
+//! [parent end]
+
//! [document]
+
diff --git a/doc/src/snippets/declarative/webview/webview.qml b/doc/src/snippets/declarative/webview/webview.qml
index dac8010..f652369 100644
--- a/doc/src/snippets/declarative/webview/webview.qml
+++ b/doc/src/snippets/declarative/webview/webview.qml
@@ -39,7 +39,9 @@
****************************************************************************/
//! [document]
+//! [import]
import QtWebKit 1.0
+//! [import]
WebView {
url: "http://www.nokia.com"
diff --git a/doc/src/snippets/qtreeview-dnd/dragdropmodel.h b/doc/src/snippets/qtreeview-dnd/dragdropmodel.h
index ed01540..a20b1bb 100644
--- a/doc/src/snippets/qtreeview-dnd/dragdropmodel.h
+++ b/doc/src/snippets/qtreeview-dnd/dragdropmodel.h
@@ -38,17 +38,6 @@
**
****************************************************************************/
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of an example program for Qt.
-** EDITIONS: NOLIMITS
-**
-****************************************************************************/
-
#ifndef DRAGDROPMODEL_H
#define DRAGDROPMODEL_H
diff --git a/doc/src/snippets/qtscript/evaluation/main.cpp b/doc/src/snippets/qtscript/evaluation/main.cpp
index e7efd8e..01e06b6 100644
--- a/doc/src/snippets/qtscript/evaluation/main.cpp
+++ b/doc/src/snippets/qtscript/evaluation/main.cpp
@@ -42,9 +42,9 @@
int main(int argc, char *argv[])
{
-//! [0]
+ //! [0]
QScriptEngine engine;
qDebug() << "the magic number is:" << engine.evaluate("1 + 2").toNumber();
-//! [0]
+ //! [0]
return 0;
}
diff --git a/doc/src/snippets/qtscript/registeringobjects/main.cpp b/doc/src/snippets/qtscript/registeringobjects/main.cpp
index 1911442..9dab25a 100644
--- a/doc/src/snippets/qtscript/registeringobjects/main.cpp
+++ b/doc/src/snippets/qtscript/registeringobjects/main.cpp
@@ -44,12 +44,12 @@
int main(int argc, char *argv[])
{
-//! [0]
+ //! [0]
QScriptEngine engine;
QObject *someObject = new MyObject;
QScriptValue objectValue = engine.newQObject(someObject);
engine.globalObject().setProperty("myObject", objectValue);
-//! [0]
+ //! [0]
qDebug() << "myObject's calculate() function returns"
<< engine.evaluate("myObject.calculate(10)").toNumber();
return 0;
diff --git a/doc/src/snippets/qtscript/registeringvalues/main.cpp b/doc/src/snippets/qtscript/registeringvalues/main.cpp
index 3defc1f..6dc5b7c 100644
--- a/doc/src/snippets/qtscript/registeringvalues/main.cpp
+++ b/doc/src/snippets/qtscript/registeringvalues/main.cpp
@@ -43,10 +43,10 @@
int main(int argc, char *argv[])
{
QScriptEngine engine;
-//! [0]
+ //! [0]
engine.globalObject().setProperty("foo", 123);
qDebug() << "foo times two is:" << engine.evaluate("foo * 2").toNumber();
-//! [0]
+ //! [0]
return 0;
}
diff --git a/doc/src/snippets/textblock-fragments/xmlwriter.cpp b/doc/src/snippets/textblock-fragments/xmlwriter.cpp
index 9f66d9a..252720b 100644
--- a/doc/src/snippets/textblock-fragments/xmlwriter.cpp
+++ b/doc/src/snippets/textblock-fragments/xmlwriter.cpp
@@ -102,11 +102,10 @@ void XmlWriter::readFragment(const QTextBlock &currentBlock,
QDomText fragmentText = document->createTextNode(currentFragment.text());
fragmentElement.appendChild(fragmentText);
-//! [6]
}
-//! [7]
- }
//! [6] //! [7]
+ }
+//! [7] //! [6]
}
void XmlWriter::processBlock(const QTextBlock &currentBlock)
diff --git a/doc/src/snippets/textdocument-frames/xmlwriter.cpp b/doc/src/snippets/textdocument-frames/xmlwriter.cpp
index 31f08f3..8988100 100644
--- a/doc/src/snippets/textdocument-frames/xmlwriter.cpp
+++ b/doc/src/snippets/textdocument-frames/xmlwriter.cpp
@@ -100,6 +100,8 @@ void XmlWriter::processFrame(QDomElement &parent, QTextFrame *frame)
parent.appendChild(frameElement);
//! [1]
+ QDomElement frameElement = ...
+
QTextFrame::iterator it;
for (it = frame->begin(); !(it.atEnd()); ++it) {
diff --git a/doc/src/snippets/textdocument-tables/xmlwriter.cpp b/doc/src/snippets/textdocument-tables/xmlwriter.cpp
index d1d6798..8f98295 100644
--- a/doc/src/snippets/textdocument-tables/xmlwriter.cpp
+++ b/doc/src/snippets/textdocument-tables/xmlwriter.cpp
@@ -98,6 +98,8 @@ void XmlWriter::processFrame(QDomElement &parent, QTextFrame *frame)
parent.appendChild(frameElement);
//! [0]
+ QDomElement frameElement = ...
+
QTextFrame::iterator it;
for (it = frame->begin(); !(it.atEnd()); ++it) {