summaryrefslogtreecommitdiffstats
path: root/doc/src
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-02-08 14:45:11 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-02-08 14:45:11 (GMT)
commite442cb8e772eeebbe66ebc89a4d6a429d12f86cb (patch)
treef706685c49bbdfb13eb3fa4ce3a95cf4d4e4b472 /doc/src
parentc39b3d42dda26b1f9576906cd001236c9d96e06a (diff)
downloadQt-e442cb8e772eeebbe66ebc89a4d6a429d12f86cb.zip
Qt-e442cb8e772eeebbe66ebc89a4d6a429d12f86cb.tar.gz
Qt-e442cb8e772eeebbe66ebc89a4d6a429d12f86cb.tar.bz2
Doc: Ensured that code snippets have appropriate file names.
This helps them to be marked up correctly in cases where code markers are available.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/classes/phonon-api.qdoc42
-rw-r--r--doc/src/deployment/deployment-plugins.qdoc2
-rw-r--r--doc/src/deployment/deployment.qdoc24
-rw-r--r--doc/src/development/activeqt-dumpcpp.qdoc10
-rw-r--r--doc/src/development/assistant-manual.qdoc6
-rw-r--r--doc/src/development/debug.qdoc6
-rw-r--r--doc/src/development/designer-manual.qdoc18
-rw-r--r--doc/src/development/moc.qdoc18
-rw-r--r--doc/src/development/qmake-manual.qdoc316
-rw-r--r--doc/src/development/qtestlib.qdoc10
-rw-r--r--doc/src/examples/arrowpad.qdoc2
-rw-r--r--doc/src/examples/containerextension.qdoc2
-rw-r--r--doc/src/examples/customwidgetplugin.qdoc2
-rw-r--r--doc/src/examples/editabletreemodel.qdoc4
-rw-r--r--doc/src/examples/fancybrowser.qdoc4
-rw-r--r--doc/src/examples/icons.qdoc2
-rw-r--r--doc/src/examples/imageviewer.qdoc6
-rw-r--r--doc/src/examples/qtscriptcustomclass.qdoc12
-rw-r--r--doc/src/examples/simpledommodel.qdoc2
-rw-r--r--doc/src/examples/taskmenuextension.qdoc2
-rw-r--r--doc/src/examples/textfinder.qdoc2
-rw-r--r--doc/src/examples/trollprint.qdoc8
-rw-r--r--doc/src/examples/worldtimeclockplugin.qdoc2
-rw-r--r--doc/src/files-and-resources/resources.qdoc4
-rw-r--r--doc/src/frameworks-technologies/accessible.qdoc2
-rw-r--r--doc/src/frameworks-technologies/activeqt-container.qdoc4
-rw-r--r--doc/src/frameworks-technologies/activeqt-server.qdoc36
-rw-r--r--doc/src/frameworks-technologies/containers.qdoc48
-rw-r--r--doc/src/frameworks-technologies/dbus-adaptors.qdoc26
-rw-r--r--doc/src/frameworks-technologies/graphicsview.qdoc14
-rw-r--r--doc/src/frameworks-technologies/implicit-sharing.qdoc4
-rw-r--r--doc/src/frameworks-technologies/model-view-programming.qdoc16
-rw-r--r--doc/src/frameworks-technologies/phonon.qdoc2
-rw-r--r--doc/src/frameworks-technologies/plugins-howto.qdoc10
-rw-r--r--doc/src/frameworks-technologies/qthelp.qdoc2
-rw-r--r--doc/src/frameworks-technologies/richtext.qdoc14
-rw-r--r--doc/src/frameworks-technologies/unicode.qdoc8
-rw-r--r--doc/src/howtos/appicon.qdoc6
-rw-r--r--doc/src/howtos/unix-signal-handlers.qdoc10
-rw-r--r--doc/src/internationalization/i18n.qdoc24
-rw-r--r--doc/src/internationalization/linguist-manual.qdoc36
-rw-r--r--doc/src/ja_JP/development/qmake-manual.qdoc30
-rw-r--r--doc/src/ja_JP/development/qtestlib.qdoc4
-rw-r--r--doc/src/ja_JP/examples/arrowpad.qdoc2
-rw-r--r--doc/src/ja_JP/examples/trollprint.qdoc8
-rw-r--r--doc/src/modules.qdoc66
-rw-r--r--doc/src/objectmodel/objecttrees.qdoc4
-rw-r--r--doc/src/objectmodel/properties.qdoc16
-rw-r--r--doc/src/objectmodel/signalsandslots.qdoc2
-rw-r--r--doc/src/painting-and-printing/coordsys.qdoc12
-rw-r--r--doc/src/platforms/emb-performance.qdoc2
-rw-r--r--doc/src/platforms/emb-pointer.qdoc2
-rw-r--r--doc/src/platforms/mac-differences.qdoc4
-rw-r--r--doc/src/platforms/wince-customization.qdoc2
-rw-r--r--doc/src/porting/porting-qsa.qdoc28
-rw-r--r--doc/src/porting/porting4-canvas.qdoc20
-rw-r--r--doc/src/porting/porting4-designer.qdoc14
-rw-r--r--doc/src/porting/porting4-dnd.qdoc6
-rw-r--r--doc/src/porting/porting4.qdoc140
-rw-r--r--doc/src/porting/qt3to4.qdoc2
-rw-r--r--doc/src/porting/qt4-accessibility.qdoc8
-rw-r--r--doc/src/porting/qt4-arthur.qdoc22
-rw-r--r--doc/src/porting/qt4-mainwindow.qdoc20
-rw-r--r--doc/src/porting/qt4-sql.qdoc4
-rw-r--r--doc/src/porting/qt4-styles.qdoc8
-rw-r--r--doc/src/porting/qt4-tulip.qdoc22
-rw-r--r--doc/src/qt4-intro.qdoc34
-rw-r--r--doc/src/scripting/qtscriptextensions.qdoc2
-rw-r--r--doc/src/scripting/scripting.qdoc174
-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.pro (renamed from doc/src/snippets/code/doc.src.qtscripttools.qdoc)17
-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.qdoc25
-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.cpp (renamed from doc/src/snippets/code/doc_src_phonon.qdoc)11
-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.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)0
-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)0
-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)642
-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_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.cpp54
-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.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.cpp58
-rw-r--r--doc/src/snippets/code/doc_src_wince-customization.qdoc19
-rw-r--r--doc/src/snippets/qtreeview-dnd/dragdropmodel.h11
-rw-r--r--doc/src/sql-programming/sql-driver.qdoc12
-rw-r--r--doc/src/widgets-and-layouts/layout.qdoc16
-rw-r--r--doc/src/widgets-and-layouts/styles.qdoc14
-rw-r--r--doc/src/widgets-and-layouts/stylesheet.qdoc30
-rw-r--r--doc/src/windows-and-dialogs/mainwindow.qdoc8
223 files changed, 5492 insertions, 3626 deletions
diff --git a/doc/src/classes/phonon-api.qdoc b/doc/src/classes/phonon-api.qdoc
index c9f7a66..95e20dd 100644
--- a/doc/src/classes/phonon-api.qdoc
+++ b/doc/src/classes/phonon-api.qdoc
@@ -691,11 +691,11 @@
Example where data is written repeatedly.
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 0
Example where data is written once:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 1
\sa Phonon::MediaSource, Phonon::MediaObject
@@ -811,7 +811,7 @@
The function is necessary for the case where a non-seekable MediaStream is
played more than once. For a seekable stream the implementation can simply call
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 2
\sa writeData(), needData()
*/
@@ -1003,7 +1003,7 @@
send an URL or filename directly to the constructors of the
\l{Phonon::}{MediaObject}.
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 3
A MediaSource object cannot be reused for another multimedia
source. It is possible to play the same source again, and also
@@ -1382,7 +1382,7 @@
immediately after you call the play() function.
A play and forget code example:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 4
\sa {Phonon Module}, MediaObject
*/
@@ -1471,7 +1471,7 @@
If you need low latency between calling play() and the sound actually
starting to play on your output device you need to use MediaObject
and be able to set the URL before calling play(). Note that
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 5
doesn't make a difference: the application should be idle between the
load and play calls so that the backend can start preloading the
media and fill audio buffers.
@@ -1612,13 +1612,13 @@
queue; the new source is then removed from the queue. The
queue can be altered at any time.
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 7
You can also make use of the
\l{Phonon::MediaObject::}{aboutToFinish()} signal, which is
guaranteed to be emitted in time for altering the queue.
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 8
When playback is finishing, i.e., when a media source has been
played to the end and the queue is empty, several signals are
@@ -1715,9 +1715,9 @@
\warning The back-end is free to choose a different tick interval close
to what you asked for. This means that the following code \c may fail:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 9
On the other hand the following is guaranteed:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 10
\sa tick()
*/
@@ -1745,7 +1745,7 @@
media object gets a new source. Listen to the hasVideoChanged()
signal instead.
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 11
Returns \c true if the media contains video data; otherwise,
returns \c false.
@@ -1763,7 +1763,7 @@
media object gets a new media source. The hasVideoChanged() signal
is emitted after this information is available.
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 12
Returns \c true if the current media may be seeked; otherwise,
returns \c false.
@@ -1786,7 +1786,7 @@
A typical usage looks like this:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 13
*/
/*!
@@ -1867,7 +1867,7 @@
We show an example:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 14
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 14
\sa currentSource(), MediaSource
*/
@@ -2126,7 +2126,7 @@
You can use this signal to show a progress bar to the user when
in BufferingState:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 15
Note that the \l{Phonon::}{BufferingState} is commonly used when
waiting for data over a network connection, but this might not be
@@ -2270,7 +2270,7 @@
happen if the user has requested a backend change.
To connect to this signal do the following:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 16
\sa Notifier::capabilitiesChanged()
*/
@@ -2362,10 +2362,10 @@
An example use case would be to give the user a QComboBox to select
the output device:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 17
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 17
And to retrieve the selected AudioOutputDevice:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 18
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 18
*/
@@ -2565,7 +2565,7 @@
In order to use an effect, insert it into the path as follows:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 19
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 19
The effect will immediately begin applying it's transformations on
the path. To stop it, remove the Effect from the path.
@@ -3108,7 +3108,7 @@
The following code example shows how to create a path between two
media nodes and insert an effect on that path.
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 20
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 20
\sa Phonon::MediaNode, Phonon::MediaObject, Phonon::AudioOutput,
Phonon::VideoWidget, {Phonon Module}
@@ -4085,7 +4085,7 @@
A typical example of usage follows below:
- \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 21
+ \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 21
\sa {Phonon Module}
*/
diff --git a/doc/src/deployment/deployment-plugins.qdoc b/doc/src/deployment/deployment-plugins.qdoc
index 12a3b0c..03685e5 100644
--- a/doc/src/deployment/deployment-plugins.qdoc
+++ b/doc/src/deployment/deployment-plugins.qdoc
@@ -104,7 +104,7 @@
plugins to be built in release mode, add the following line to the plugin's
project file:
- \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_plugins-howto.pro 3
This will ensure that the plugin is compatible with the version of the library
used in the application.
diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc
index bc80ed3..50f873f 100644
--- a/doc/src/deployment/deployment.qdoc
+++ b/doc/src/deployment/deployment.qdoc
@@ -336,7 +336,7 @@
are many ways to solve this:
\list
-
+
\o You can install the Qt libraries in one of the system
library paths (e.g. \c /usr/lib on most systems).
@@ -345,7 +345,7 @@
linker to look in this directory when starting your application.
\o You can write a startup script for your application, where you
- modify the dynamic linker configuration (e.g. adding your
+ modify the dynamic linker configuration (e.g., adding your
application's directory to the \c LD_LIBRARY_PATH environment
variable. \note If your application will be running with "Set
user ID on execution," and if it will be owned by root, then
@@ -375,7 +375,7 @@
\c plugins directory, or you can set the \c DESTDIR in the
plugins' project files:
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_deployment.pro 8
An archive distributing all the Qt libraries, and all the plugins,
required to run the \l {tools/plugandpaint}{Plug & Paint}
@@ -422,7 +422,7 @@
application using QApplication::addLibraryPath() or
QApplication::setLibraryPaths().
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_deployment.cpp 9
\section1 Application Dependencies
@@ -718,7 +718,7 @@
using QApplication::addLibraryPath() or
QApplication::setLibraryPaths().
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 19
+ \snippet doc/src/snippets/code/doc_src_deployment.cpp 19
One benefit of using plugins is that they can easily be made
available to a whole family of applications.
@@ -753,7 +753,7 @@
To use the options, add
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 21
+ \snippet doc/src/snippets/code/doc_src_deployment.pro 21
to your .pro file. The \c embed_manifest_dll option is enabled by default.
The \c embed_manifest_exe option is NOT enabled by default.
@@ -965,7 +965,7 @@
command line application on Unix and Windows. You probably don't
want to run it in a bundle: Add this to your application's .pro:
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 26
+ \snippet doc/src/snippets/code/doc_src_deployment.pro 26
This will tell \c qmake not to put the executable inside a
bundle. Please refer to the \l{Deploying an Application on
@@ -1249,7 +1249,7 @@
to look for the new plugins. After constructing the
QApplication, we add the following code:
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 49
+ \snippet doc/src/snippets/code/doc_src_deployment.cpp 49
First, we tell the application to only look for plugins in this
directory. In our case, this is what we want since we only want to
@@ -1366,7 +1366,7 @@
variable to get \e{weak linking} to work for your application. You
can add:
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 51
+ \snippet doc/src/snippets/code/doc_src_deployment.pro 51
to your .pro file, and qmake will take care of this for you.
@@ -1416,7 +1416,7 @@
add both to the \c CONFIG line. PowerPC users also need an
SDK. For example:
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 53
+ \snippet doc/src/snippets/code/doc_src_deployment.pro 53
Besides \c lipo, you can also check your binaries with the \c file(1)
command line tool or the Finder.
@@ -1513,12 +1513,12 @@
First, we will change the vendor statement to something more meaningful. The application
vendor is visible to end-user during the installation.
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 56
+ \snippet doc/src/snippets/code/doc_src_deployment.pro 56
Second we will tell the Symbian application installer that this application supports
only S60 5.0 based devices:
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 57
+ \snippet doc/src/snippets/code/doc_src_deployment.pro 57
You can find a list of platform and device indentification codes from
\l {http://wiki.forum.nokia.com/index.php/S60_Platform_and_device_identification_codes}{Forum Nokia Wiki}.
diff --git a/doc/src/development/activeqt-dumpcpp.qdoc b/doc/src/development/activeqt-dumpcpp.qdoc
index 504b3b4..54581e1 100644
--- a/doc/src/development/activeqt-dumpcpp.qdoc
+++ b/doc/src/development/activeqt-dumpcpp.qdoc
@@ -83,24 +83,24 @@
as \c noncreatable) have a default constructor; this is typically a single class
of type \c Application.
- \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp 0
All other classes can only be created by passing an IDispatch interface pointer
to the constructor; those classes should however not be created explicitly.
Instead, use the appropriate API of already created objects.
- \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp 1
All coclass wrappers also have one constructors taking an interface wrapper class
for each interface implemented.
- \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp 2
You have to create coclasses to be able to connect to signals of the subobject.
Note that the constructor deletes the interface object, so the following will
cause a segmentation fault:
- \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp 3
If the return type is of a coclass or interface type declared in another type
library you have to include the namespace header for that other type library
@@ -115,7 +115,7 @@
In this case, create the correct wrapper class explicitly:
- \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp 4
You can of course use the IDispatch* returned directly, in which case you have to
call \c Release() when finished with the interface.
diff --git a/doc/src/development/assistant-manual.qdoc b/doc/src/development/assistant-manual.qdoc
index 8d3c667..1ed99db 100644
--- a/doc/src/development/assistant-manual.qdoc
+++ b/doc/src/development/assistant-manual.qdoc
@@ -676,13 +676,13 @@
The following example shows how this can be done:
- \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_assistant-manual.cpp 2
Once \QA is running, you can send commands by using the stdin channel of
the process. The code snippet below shows how to tell \QA to show a certain
page in the documentation.
- \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_assistant-manual.cpp 3
Note that the trailing newline character is required to mark the end
of the input.
@@ -745,7 +745,7 @@
instead of one line for every command. The commands have to be separated by
a semicolon, as shown in the following example:
- \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_assistant-manual.cpp 4
\section1 Compatibility with Old Formats
diff --git a/doc/src/development/debug.qdoc b/doc/src/development/debug.qdoc
index 044ad0d..1669b00 100644
--- a/doc/src/development/debug.qdoc
+++ b/doc/src/development/debug.qdoc
@@ -142,7 +142,7 @@
If you include the <QtDebug> header file, the \c qDebug() function
can also be used as an output stream. For example:
- \snippet doc/src/snippets/code/doc_src_debug.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_debug.cpp 0
The Qt implementation of these functions prints the text to the
\c stderr output under Unix/X11 and Mac OS X. With Windows, if it
@@ -199,14 +199,14 @@
These macros are useful for detecting program errors, e.g. like this:
- \snippet doc/src/snippets/code/doc_src_debug.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_debug.cpp 1
Q_ASSERT(), Q_ASSERT_X(), and Q_CHECK_PTR() expand to nothing if
\c QT_NO_DEBUG is defined during compilation. For this reason,
the arguments to these macro should not have any side-effects.
Here is an incorrect usage of Q_CHECK_PTR():
- \snippet doc/src/snippets/code/doc_src_debug.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_debug.cpp 2
If this code is compiled with \c QT_NO_DEBUG defined, the code in
the Q_CHECK_PTR() expression is not executed and \e alloc returns
diff --git a/doc/src/development/designer-manual.qdoc b/doc/src/development/designer-manual.qdoc
index 9a6220f..d347c0f 100644
--- a/doc/src/development/designer-manual.qdoc
+++ b/doc/src/development/designer-manual.qdoc
@@ -2044,7 +2044,7 @@ pixmap property in the property editor.
project file, ensuring that the application is compiled and linked
appropriately.
- \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_designer-manual.pro 0
The QUiLoader class provides a form loader object to construct the user
interface. This user interface can be retrieved from any QIODevice, e.g.,
@@ -2054,7 +2054,7 @@ pixmap property in the property editor.
The QtUiTools module classes can be included using the following directive:
- \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 1
The QUiLoader::load() function is invoked as shown in this code from the
\l{Text Finder Example}{Text Finder} example:
@@ -2126,7 +2126,7 @@ pixmap property in the property editor.
\c setupUi() function to do this, so we only need to declare and
implement a slot with a name that follows a standard convention:
- \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 2
Using this convention, we can define and implement a slot that responds to
mouse clicks on the \gui OK button:
@@ -2588,7 +2588,7 @@ pixmap property in the property editor.
plugins are also built in release mode. To do this, include the following
declaration in the plugin's \c{.pro} file:
- \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_designer-manual.pro 3
If plugins are built in a mode that is incompatible with \QD, they will
not be loaded and installed. For more information about plugins, see the
@@ -2597,7 +2597,7 @@ pixmap property in the property editor.
It is also necessary to ensure that the plugin is installed together with
other \QD widget plugins:
- \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_designer-manual.pro 4
The \c $[QT_INSTALL_PLUGINS] variable is a placeholder to the location of
the installed Qt plugins. You can configure \QD to look for plugins in
@@ -2756,7 +2756,7 @@ pixmap property in the property editor.
using the Q_INTERFACES() macro in the extension class's definition. For
example:
- \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 7
This enables \QD to use the qobject_cast() function to query for supported
interfaces using a QObject pointer only.
@@ -2791,13 +2791,13 @@ pixmap property in the property editor.
You can either create a new QExtensionFactory and reimplement the
QExtensionFactory::createExtension() function:
- \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 8
or you can use an existing factory, expanding the
QExtensionFactory::createExtension() function to enable the factory to
create your custom extension as well:
- \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 9
\section2 Accessing Qt Designer's Extension Manager
@@ -2809,7 +2809,7 @@ pixmap property in the property editor.
an extension factory is typically made in the
QDesignerCustomWidgetInterface::initialize() function:
- \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 10
The \c formEditor parameter in the
QDesignerCustomWidgetInterface::initialize() function is a pointer to \QD's
diff --git a/doc/src/development/moc.qdoc b/doc/src/development/moc.qdoc
index fc0165b..5d524b2 100644
--- a/doc/src/development/moc.qdoc
+++ b/doc/src/development/moc.qdoc
@@ -136,7 +136,7 @@
This guarantees that make will run the moc before it compiles
\c foo.cpp. You can then put
- \snippet doc/src/snippets/code/doc_src_moc.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_moc.cpp 3
at the end of \c foo.cpp, where all the classes declared in that
file are fully known.
@@ -223,7 +223,7 @@
file. \c moc defines the preprocessor symbol \c Q_MOC_RUN. Any
code surrounded by
- \snippet doc/src/snippets/code/doc_src_moc.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_moc.cpp 4
is skipped by the \c moc.
@@ -245,7 +245,7 @@
\c moc does not handle all of C++. The main problem is that class
templates cannot have signals or slots. Here is an example:
- \snippet doc/src/snippets/code/doc_src_moc.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_moc.cpp 5
Another limitation is that moc does not expand macros, so you
for example cannot use a macro to declare a signal/slot
@@ -261,7 +261,7 @@
first inherited class is a subclass of QObject. Also, be sure
that only the first inherited class is a QObject.
- \snippet doc/src/snippets/code/doc_src_moc.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_moc.cpp 6
Virtual inheritance with QObject is \e not supported.
@@ -271,11 +271,11 @@
signal or slot parameters, we think inheritance is a better
alternative. Here is an example of illegal syntax:
- \snippet doc/src/snippets/code/doc_src_moc.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_moc.cpp 7
You can work around this restriction like this:
- \snippet doc/src/snippets/code/doc_src_moc.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_moc.cpp 8
It may sometimes be even better to replace the function pointer
with inheritance and virtual functions.
@@ -289,7 +289,7 @@
fully qualify the data types when declaring signals and slots,
and when establishing connections. For example:
- \snippet doc/src/snippets/code/doc_src_moc.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_moc.cpp 9
\section2 Type Macros Cannot Be Used for Signal and Slot Parameters
@@ -297,7 +297,7 @@
an argument will not work in signals and slots. Here is an
illegal example:
- \snippet doc/src/snippets/code/doc_src_moc.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_moc.cpp 10
A macro without parameters will work.
@@ -305,7 +305,7 @@
Here's an example of the offending construct:
- \snippet doc/src/snippets/code/doc_src_moc.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_moc.cpp 11
\section2 Signal/Slot return types cannot be references
diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc
index 9a46ea8..da105e6 100644
--- a/doc/src/development/qmake-manual.qdoc
+++ b/doc/src/development/qmake-manual.qdoc
@@ -383,7 +383,7 @@
\l {qmake}{ \c qmake} generates includes a rule that builds both versions, and this can be
invoked in the following way:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 0
Adding the \c build_all option to the \c CONFIG variable makes this rule
the default when building the project, and installation targets will be
@@ -426,7 +426,7 @@
build it as a multi-threaded application in \c debug mode, your project
file will contain the following line:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 1
Note, that you must use "+=", not "=", or \l {qmake}{ \c qmake} will not be able to
use Qt's configuration to determine the settings needed for your project.
@@ -439,21 +439,21 @@
variable which can be used to declare the required extension modules.
For example, we can enable the XML and network modules in the following way:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 2
Note that \c QT includes the \c core and \c gui modules by default, so the
above declaration \e adds the network and XML modules to this default list.
The following assignment \e omits the default modules, and will lead to
errors when the application's source code is being compiled:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 3
If you want to build a project \e without the \c gui module, you need to
exclude it with the "-=" operator. By default, \c QT contains both
\c core and \c gui, so the following line will result in a minimal
Qt project being built:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 4
The table below shows the options that can be used with the \c QT variable
and the features that are associated with each of them:
@@ -489,7 +489,7 @@
\l{http://www.freedesktop.org/wiki/Software_2fpkgconfig}{pkg-config},
such as the D-Bus and ogg libraries, with the following lines:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 5
More information about features can be found in the
\l{qmake Advanced Usage#Adding New Configuration Features}
@@ -509,7 +509,7 @@
For example, the following lines show how a library can be specified:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 6
The paths containing header files can also be specified in a similar way
using the \l{qmake Variable Reference#INCLUDEPATH}{INCLUDEPATH} variable.
@@ -517,7 +517,7 @@
For example, it is possible to add several paths to be searched for header
files:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 7
*/
/*!
@@ -542,7 +542,7 @@
The syntax used to run \l {qmake}{ \c qmake} takes the following simple form:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 8
\l {qmake}{ \c qmake} supports two different modes of operation: In the default mode,
\l {qmake}{ \c qmake} will use the description in a project file to generate a Makefile,
@@ -641,7 +641,7 @@
\target MakefileMode
\section2 Makefile Mode Options
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 9
In Makefile mode, \l {qmake}{ \c qmake} will generate a Makefile that is used to build the
project. Additionally, the following options may be used in this mode to
@@ -666,13 +666,13 @@
You may also pass \l {qmake}{ \c qmake} assignments on the command line;
they will be processed before all of the files specified. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 10
This will generate a Makefile, from test.pro with Unix pathnames. However
many of the specified options aren't necessary as they are the default.
Therefore, the line can be simplified on Unix to:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 11
If you are certain you want your variables processed after the
files specified, then you may pass the \c -after option. When this
@@ -682,7 +682,7 @@
\target ProjectMode
\section2 Project Mode Options
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 12
In project mode, \l {qmake}{ \c qmake} will generate a project file. Additionally, you
may supply the following options in this mode:
@@ -740,7 +740,7 @@
create a Makefile in a project directory with the following command line
invocation:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 13
\section2 Using Frameworks
@@ -753,13 +753,13 @@
\l{qmake Variable Reference#QMAKE_LFLAGS}{QMAKE_LFLAGS} variable, as shown
in the following example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 14
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 14
The framework itself is linked in by appending the \c{-framework} options and
the name of the framework to the \l{qmake Variable Reference#LIBS}{LIBS}
variable:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 15
\section2 Creating Frameworks
@@ -771,7 +771,7 @@
\c lib_bundle option to the
\l{qmake Variable Reference#CONFIG}{CONFIG} variable:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 16
The data associated with the library is specified using the
\l{qmake Variable Reference#QMAKE_BUNDLE_DATA}{QMAKE_BUNDLE_DATA}
@@ -779,7 +779,7 @@
bundle, and is often used to specify a collection of header files,
as in the following example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 17
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 17
Here, the \c FRAMEWORK_HEADERS variable is a user-defined variable that
is used to define the headers required to use a particular framework.
@@ -807,7 +807,7 @@
following assignment causes \l {qmake}{ \c qmake} to generate build rules to create
a universal binary for both PowerPC and x86 architectures:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 18
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 18
Additionally, developers using a PowerPC-based platform need to set the
\l{qmake Variable Reference#QMAKE_MAC_SDK}{QMAKE_MAC_SDK} variable.
@@ -822,7 +822,7 @@
by running \l {qmake}{ \c qmake} to generate an Xcode project from an existing \l {qmake}{ \c qmake}
project files. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 19
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 19
Note that, if a project is later moved on the disk, \l {qmake}{ \c qmake} must be run
again to process the project file and create a new Xcode project file.
@@ -872,12 +872,12 @@
This can also be set using a command line option, for example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 20
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 20
It is possible to recursively generate \c{.vcproj} files in subdirectories
and a \c{.sln} file in the main directory, by typing:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 21
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 21
Each time you update the project file, you need to run \l {qmake}{ \c qmake} to generate
an updated Visual Studio project.
@@ -896,12 +896,12 @@
the following assignment to the \l{qmake Variable Reference#CONFIG}
{CONFIG} variable:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 22
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 22
Also, the manifest embedding for DLLs can be removed with the following
assignment to the \l{qmake Variable Reference#CONFIG}{CONFIG} variable:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 23
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 23
This is discussed in more detail in the
\l{Deploying an Application on Windows#Visual Studio 2005 Onwards}
@@ -922,7 +922,7 @@
To specify that static data support is desired, add this to the project file:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 129
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 129
The default value is zero.
@@ -938,7 +938,7 @@
prevents the application from starting if that amount of memory is not available. The
minimum and maximum values are separated by a space. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 130
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 130
The default values depend on the version of the Symbian SDK you're using,
however, the Qt toolchain sets this to the maximum possible value and this
@@ -954,7 +954,7 @@
Here is an example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 131
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 131
\section2 Unique identifiers
@@ -964,7 +964,7 @@
There are four available types of IDs supported: \c UID2, \c UID3, \c SID, and \c VID. They
are specified like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 132
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 132
If \c SID is not specified, it defaults to the same value as \c UID3.
If \c UID3 is not specified, qmake will automatically generate a \c UID3
@@ -988,13 +988,13 @@
ability to list all files on the file system. Capabilities are defined
in the project file like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 133
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 133
It is also possible to specify which capabilities \e not to have,
by first specifying \c ALL and then list the unwanted capabilities
with a minus in front of them, like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 134
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 134
For more information about capabilities, please refer to the Symbian SDK documentation.
*/
@@ -1098,7 +1098,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 152
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 152
This will add the specified statements to the \c prj_exports section of the
generated \c bld.inf file.
@@ -1108,7 +1108,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 143
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 143
Any rules you define will be added after automatically generated
rules in each section.
@@ -1157,7 +1157,7 @@
\l {qmake}{ \c qmake} generates includes a rule that builds both versions, and this can
be invoked in the following way:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 24
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 24
When linking a library, \l {qmake}{ \c qmake} relies on the underlying platform to know
what other libraries this library links against. However, if linking
@@ -1192,7 +1192,7 @@
will be set for each of these mode, and you can test for this to perform
build-specific tasks. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 25
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 25
As a result, it may be useful to define mode-specific variables, such as
\l{#QMAKE_LFLAGS_RELEASE}{QMAKE_LFLAGS_RELEASE}, instead of general
@@ -1319,7 +1319,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 26
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 26
\target DEFINES
\section1 DEFINES
@@ -1329,7 +1329,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 27
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 27
\target DEF_FILE
\section1 DEF_FILE
@@ -1363,7 +1363,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 28
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 28
This will upload all PNG images in \c path to the same directory your
build target will be deployed to.
@@ -1379,7 +1379,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 29
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 29
\note In Windows CE all linked Qt libraries will be deployed to the path
specified by \c{myFiles.path}. On Symbian platform all libraries and executables
@@ -1398,7 +1398,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 128
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 128
On the Symbian platform, generic PKG file content can also be specified with this
variable. You can use either \c pkg_prerules or \c pkg_postrules to
@@ -1414,7 +1414,7 @@
For example, to deploy DLL and add a new dependency:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 140
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 140
Please note that \c pkg_prerules can also replace default statements in
pkg file. If no pkg_prerules is defined, qmake makes sure that PKG file
@@ -1448,7 +1448,7 @@
targeted to only one of above files by appending listed rules suffix
to the variable name:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 153
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 153
On the Symbian platform, the \c default_deployment item specifies
default platform and package dependencies. Those dependencies can be
@@ -1465,7 +1465,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 141
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 141
On the Symbian platform, a default deployment is generated for all
application projects. You can modify the autogenerated default
@@ -1479,7 +1479,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 154
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 154
This will entirely remove the default application deployment.
@@ -1489,7 +1489,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 155
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 155
This will show a message box that gives user an option to cancel the
installation and then automatically runs the application after
@@ -1505,19 +1505,19 @@
Often the default is not optimal for displaying to end user. To set a better
display name for these purposes, use \c{DEPLOYMENT.display_name} variable:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 156
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 156
On the Symbian platform, you can use \c{DEPLOYMENT.installer_header}
variable to generate smart installer wrapper for your application.
If you specify just UID of the installer package as the value, then
installer package name and version will be autogenerated:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 146
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 146
If autogenerated values are not suitable, you can also specify the sis
header yourself using this variable:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 147
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 147
\target DEPLOYMENT_PLUGIN
\section1 DEPLOYMENT_PLUGIN
@@ -1538,7 +1538,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 142
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 142
This will upload the jpeg imageformat plugin to the plugins directory
on the Windows CE device.
@@ -1550,7 +1550,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 30
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 30
\target DESTDIR_TARGET
\section1 DESTDIR_TARGET
@@ -1573,7 +1573,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 31
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 31
\target DSP_TEMPLATE
\section1 DSP_TEMPLATE
@@ -1593,7 +1593,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 32
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 32
If FORMS3 is defined in your project, then this variable must contain
forms for uic, and not uic3. If CONFIG contains uic3, and FORMS3 is not
@@ -1609,7 +1609,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 33
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 33
\target GUID
\section1 GUID
@@ -1635,7 +1635,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 34
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 34
See also \l{#SOURCES}{SOURCES}.
@@ -1655,7 +1655,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 35
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 35
To specify a path containing spaces, quote the path using the technique
mentioned in the \l{qmake Project Files#Whitespace}{qmake Project Files}
@@ -1677,7 +1677,7 @@
build target will be installed, and the \c INSTALLS assignment adds the
build target to the list of existing resources to be installed:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 36
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 36
Note that \l {qmake}{ \c qmake} will skip files that are executable. If you need to install
executable files, you can unset the files' executable flags.
@@ -1705,7 +1705,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 37
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 37
\target LIBS
\section1 LIBS
@@ -1719,7 +1719,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 38
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 38
To specify a path containing spaces, quote the path using the technique
mentioned in the \l{qmake Project Files#Whitespace}{qmake Project Files}
@@ -1749,7 +1749,7 @@
unique names before it is used. To change this behavior, add the
\c no_lflags_merge option to the \c CONFIG variable:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 39
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 39
\target LITERAL_HASH
\section1 LITERAL_HASH
@@ -1791,7 +1791,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 137
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 137
This will add the specified statement to the end of the generated MMP file.
@@ -1800,20 +1800,20 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 138
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 138
If you need to include a hash (\c{#}) character inside the
\c MMP_RULES statement, it can be done with the variable
\c LITERAL_HASH as follows:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 139
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 139
There is also a convenience function for adding conditional rules
called \c{addMMPRules}. Suppose you need certain functionality
to require different library depending on architecture. This
can be specified with \c{addMMPRules} as follows:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 148
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 148
\note You should not use this variable to add MMP statements that are
explicitly supported by their own variables, such as
@@ -1828,7 +1828,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 40
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 40
\target OBJECTS
\section1 OBJECTS
@@ -1847,7 +1847,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 41
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 41
\target OBJMOC
\section1 OBJMOC
@@ -1937,7 +1937,7 @@
variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
modified. Use the following instead:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 42
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 42
\target QMAKE_APP_OR_DLL
\section1 QMAKE_APP_OR_DLL
@@ -1967,7 +1967,7 @@
and \c path/to/header_two.h to a group containing information about the
headers supplied with the framework:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 43
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 43
The last line adds the information about the headers to the collection of
resources that will be installed with the library bundle.
@@ -1989,7 +1989,7 @@
For example, the following definition will result in a framework with the
\c{.myframework} extension:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 44
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 44
\e{This is used on Mac OS X only.}
@@ -2116,7 +2116,7 @@
architecture specific options to each compiler in the Symbian build system.
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 131
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 131
For more information, see
\l{qmake Platform Notes#Compiler specific options}{qmake Platform Notes}.
@@ -2795,7 +2795,7 @@
\c{-compress} options are used with particular values each time that
\c rcc is invoked:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 45
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 45
\section1 QMAKE_RPATH
@@ -2850,7 +2850,7 @@
It can be used to specify arguments to uic as well, such as additional plugin
paths. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 46
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 46
\section1 QT
@@ -2881,7 +2881,7 @@
exclude the \c gui value with the "-=" operator; the following line will
result in a minimal Qt project being built:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 47
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 47
Note that adding the \c opengl option to the \c QT variable automatically
causes the equivalent option to be added to the \c CONFIG variable.
@@ -2928,7 +2928,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 48
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 48
\target REQUIRES
\section1 REQUIRES
@@ -2963,7 +2963,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 144
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 144
This will add the specified statement to the end of the \c APP_REGISTRATION_INFO
resource struct in the generated registration resource file.
@@ -2974,7 +2974,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 145
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 145
This example will install the application to MyFolder in the Symbian
platform application shell. In addition it will make the application to
@@ -3006,7 +3006,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 151
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 151
This example will define service information for a fictional service that requires
an icon to be supplied via the \c opaque_data of the service information.
@@ -3035,7 +3035,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 49
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 49
See also \l{#HEADERS}{HEADERS}
@@ -3057,7 +3057,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 50
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 50
It is essential that the project file in each subdirectory has the same
name as the subdirectory itself, so that \l {qmake}{ \c qmake}can find it.
@@ -3068,7 +3068,7 @@
which they are specified, update the \l{#CONFIG}{CONFIG} variable to
include the \c ordered option:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 51
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 51
It is possible to modify this default behavior of \c SUBDIRS by giving
additional modifiers to \c SUBDIRS elements. Supported modifiers are:
@@ -3092,11 +3092,11 @@
For example, define two subdirectories, both of which reside in a different directory
than the \c SUBDIRS value, and one of the subdirectories must be built before the other:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 149
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 149
For example, define a subdirectory that is only build for emulator builds in Qt for Symbian:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 150
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 150
\target SYMBIAN_VERSION
\section1 SYMBIAN_VERSION
@@ -3112,7 +3112,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 52
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 52
The project file above would produce an executable named \c myapp on
unix and 'myapp.exe' on windows.
@@ -3142,7 +3142,7 @@
will refuse to run if the minimum size is not available when it starts. For
example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 135
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 135
\target TARGET.EPOCSTACKSIZE
\section1 TARGET.EPOCSTACKSIZE
@@ -3151,7 +3151,7 @@
Specifies the maximum stack size of the application. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 136
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 136
\target TARGET.SID
\section1 TARGET.SID
@@ -3232,7 +3232,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 53
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 53
The template can be overridden by specifying a new template type with the
\c -t command line option. This overrides the template type \e after the .pro
@@ -3271,7 +3271,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 54
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 54
\target UI_HEADERS_DIR
\section1 UI_HEADERS_DIR
@@ -3281,7 +3281,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 55
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 55
\target UI_SOURCES_DIR
\section1 UI_SOURCES_DIR
@@ -3291,7 +3291,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 56
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 56
\target VERSION
\section1 VERSION
@@ -3302,7 +3302,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 57
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 57
\section1 VER_MAJ
@@ -3350,7 +3350,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 58
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 58
\section1 _PRO_FILE_
@@ -3394,7 +3394,7 @@
Returns the basename of the file specified. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 59
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 59
\section1 CONFIG(config)
[Conditional]
@@ -3407,7 +3407,7 @@
mutually exclusive values) a second parameter can be used to specify a set
of values to consider. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 60
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 60
Because release is considered the active setting (for feature parsing)
it will be the CONFIG used to generate the build file. In the common
@@ -3423,7 +3423,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 61
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 61
The contents of the scope are only processed if the \c drivers
variable contains the value, \c network. If this is the case, the
@@ -3456,7 +3456,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 62
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 62
\section1 eval(string)
[Conditional]
@@ -3481,7 +3481,7 @@
succeeds if any file matches the regular expression specified.
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 63
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 63
Note that "/" can be used as a directory separator, regardless of the
platform in use.
@@ -3491,7 +3491,7 @@
Places all the values in \e variablename that match \e substr. \e
substr may be a regular expression, and will be matched accordingly.
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 64
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 64
MY_VAR2 will contain '-Lone -Ltwo -Lthree -Lfour -Lfive', and MY_VAR3 will
contains 'three two three'.
@@ -3508,7 +3508,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 65
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 65
\section1 include(filename)
[Conditional]
@@ -3521,7 +3521,7 @@
You can check whether the file was included by using this function as
the condition for a scope; for example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 66
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 66
\section1 infile(filename, var, val)
[Conditional]
@@ -3539,7 +3539,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 67
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 67
\section1 join(variablename, glue, before, after)
@@ -3563,7 +3563,7 @@
This function simply writes a message to the console. Unlike the
\c error() function, this function allows processing to continue.
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 68
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 68
The above line causes "This is a message" to be written to the console.
The use of quotation marks is optional.
@@ -3574,7 +3574,7 @@
\l{qmake Advanced Usage}{in conjunction with a scope} to filter out
messages during builds; for example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 69
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 69
\section1 prompt(question)
@@ -3598,7 +3598,7 @@
prints the message:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 70
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 70
\section1 sprintf(string, arguments...)
@@ -3614,13 +3614,13 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 71
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 71
Alternatively, you can use this function to obtain stdout and stderr
from the command, and assign it to a variable. For example, you can
use this to interrogate information about the platform:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 72
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 72
\target unique
\section1 unique(variablename)
@@ -3628,7 +3628,7 @@
This will return a list of values in variable that are unique (that is
with repetitive entries removed). For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 73
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 73
\section1 warning(string)
@@ -3652,14 +3652,14 @@
\c set a variable in qmake once, and each time qmake is invoked this
value can be queried. Use the following to set a property in qmake:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 74
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 74
The appropriate variable and value should be substituted for
\c VARIABLE and \c VALUE.
To retrieve this information back from qmake you can do:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 75
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 75
\note \c{qmake -query} will only list variables that you have
previously set with \c{qmake -set VARIABLE VALUE}.
@@ -3673,13 +3673,13 @@
variable if you prefix that version of \l {qmake}{ \c qmake}to \c VARIABLE, as in
the following example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 76
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 76
\l {qmake}{ \c qmake}also has the notion of \c builtin properties, for example you can
query the installation of Qt for this version of \l {qmake}{ \c qmake}with the
\c QT_INSTALL_PREFIX property:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 77
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 77
These built-in properties cannot have a version prefixed to them as
they are not versioned, and each version of \l {qmake}{ \c qmake}will have its own
@@ -3695,7 +3695,7 @@
Finally, these values can be queried in a project file with a special
notation such as:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 78
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 78
\target QMAKESPEC
\section1 QMAKESPEC
@@ -3731,7 +3731,7 @@
For example, a collection of documentation files can be described in the
following way:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 79
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 79
The \c path member informs \l {qmake}{ \c qmake}that the files should be installed in
\c /usr/local/program/doc (the path member), and the \c files member
@@ -3742,7 +3742,7 @@
Once an install set has been fully described, you can append it to the
install list with a line like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 80
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 80
\l {qmake}{ \c qmake}will ensure that the specified files are copied to the installation
directory. If you require greater control over this process, you can also
@@ -3750,7 +3750,7 @@
the following line tells \l {qmake}{ \c qmake}to execute a series of commands for this
install set:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 81
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 81
The \c unix scope
(see \l{qmake Advanced Usage#Scopes and Conditions}{Scopes and Conditions})
@@ -3766,7 +3766,7 @@
be copied for you. Currently, the only supported built-in install set is
\c target:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 82
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 82
In the above lines, \l {qmake}{ \c qmake}knows what needs to be copied, and will handle
the installation process automatically.
@@ -3800,7 +3800,7 @@
The first step is to enable dependency tracking in the library itself.
To do this you must tell \l {qmake}{ \c qmake}to save information about the library:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 83
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 83
This is only relevant to the \c lib template, and will be ignored for
all others. When this option is enabled, \l {qmake}{ \c qmake}will create a file
@@ -3816,7 +3816,7 @@
The second step in this process is to enable reading of this meta
information in the applications that use the static library:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 84
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 84
When this is enabled, \l {qmake}{ \c qmake}will process all libraries linked to
by the application and find their meta-information. \l {qmake}{ \c qmake}will use
@@ -3843,7 +3843,7 @@
used for \l moc files can be redefined with the following assignment in a project
file:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 85
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 85
The following variables can be used to redefine common file extensions recognized
by \c qmake:
@@ -3882,7 +3882,7 @@
API as found in other places in \c qmake. Objects are defined automatically
by specifying their members; for example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 86
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 86
The definitions above define a \l {qmake}{ \c qmake}target called \c mytarget, containing
a Makefile target called \c{.buildfile} which in turn is generated with
@@ -3893,7 +3893,7 @@
The final step is to instruct \l {qmake}{ \c qmake}that this object is a target to be built:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 87
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 87
This is all you need to do to actually build custom targets. Of course, you may
want to tie one of these targets to the
@@ -3947,7 +3947,7 @@
For convenience, there is also a method of customizing projects
for new compilers or preprocessors:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 88
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 88
With the above definitions, you can use a drop-in replacement for moc if one
is available. The commands is executed on all arguments given to the
@@ -4099,21 +4099,21 @@
The \c = operator assigns a value to a variable:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 89
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 89
The above line sets the \c TARGET variable to \c myapp. This will overwrite any
values previously set for \c TARGET with \c myapp.
The \c += operator appends a new value to the list of values in a variable:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 90
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 90
The above line appends \c QT_DLL to the list of pre-processor defines to be put
in the generated Makefile.
The \c -= operator removes a value from the list of values in a variable:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 91
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 91
The above line removes \c QT_DLL from the list of pre-processor defines to be
put in the generated Makefile.
@@ -4122,7 +4122,7 @@
if it is not already present. This prevents values from being included many
times in a variable. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 92
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 92
In the above line, \c QT_DLL will only be added to the list of pre-processor
defines if it is not already defined. Note that the
@@ -4133,7 +4133,7 @@
The \c ~= operator replaces any values that match a regular expression with
the specified value:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 93
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 93
In the above line, any values in the list that start with \c QT_D or \c QT_T are
replaced with \c QT.
@@ -4141,7 +4141,7 @@
The \c $$ operator is used to extract the contents of a variable, and can be
used to pass values between variables or supply them to functions:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 94
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 94
\target Scopes
\section1 Scopes
@@ -4195,7 +4195,7 @@
You may also use the \c : operator to perform single line conditional
assignments; for example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 95
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 95
The above line adds \c QT_DLL to the \c DEFINES variable only on the
Windows platform.
@@ -4213,7 +4213,7 @@
This allows you to write complex tests when combined with other scopes
(separated by the \c : operator as above). For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 96
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 96
\section2 Configuration and Scopes
@@ -4269,7 +4269,7 @@
use; \l {qmake}{ \c qmake}creates new variables with a given name when it encounters
an assignment to that name. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 97
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 97
There are no restricitions on what you do to your own variables, as \c
qmake will ignore them unless it needs to evaluate them when processing
@@ -4278,19 +4278,19 @@
You can also assign the value of a current variable to another
variable by prefixing $$ to the variable name. For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 98
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 98
Now the MY_DEFINES variable contains what is in the DEFINES variable at
this point in the project file. This is also equivalent to:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 99
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 99
The second notation allows you to append the contents of the variable to
another value without separating the two with a space. For example, the
following will ensure that the final executable will be given a name
that includes the project template being used:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 100
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 100
Variables can be used to store the contents of environment variables.
These can be evaluated at the time that \l {qmake}{ \c qmake}is run, or included
@@ -4325,7 +4325,7 @@
For example, a \QD plugin can be installed alongside \QD's built-in
plugins if the following declaration is made in its project file:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 101
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 101
\target VariableProcessingFunctions
\section1 Variable Processing Functions
@@ -4346,7 +4346,7 @@
contents of variables. These functions can be defined in the following
way:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 102
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 102
The following example function takes a variable name as its only
argument, extracts a list of values from the variable with the
@@ -4415,7 +4415,7 @@
For example, consider the following assignment in a project file:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 103
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 103
With this addition to the \c CONFIG variable, \l {qmake}{ \c qmake}will search the
locations listed above for the \c myfeatures.prf file after it has
@@ -4492,7 +4492,7 @@
\section3 Example: \c stable.h
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 104
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.cpp 104
Note that a precompiled header file needs to separate C includes from
C++ includes, since the precompiled header file for C files may not
@@ -4504,7 +4504,7 @@
To make your project use PCH, you only need to define the
\c PRECOMPILED_HEADER variable in your project file:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 105
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 105
\l {qmake}{ \c qmake}will handle the rest, to ensure the creation and use of the
precompiled header file. You do not need to include the precompiled
@@ -4516,7 +4516,7 @@
conditional blocks in your project file to add settings when using PCH.
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 106
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 106
\section1 Notes on Possible Issues
@@ -4525,7 +4525,7 @@
declarations may cause two different object files with the same name to
be generated:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 107
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 107
To avoid potential conflicts like these, it is good practice to ensure
that header files that will be precompiled are given distinctive names.
@@ -4600,17 +4600,17 @@
Just start a new line with \c {SOURCES +=} and put hello.cpp after it.
You should have something like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 108
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 108
We repeat this for each source file in the project, until we end up
with the following:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 109
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 109
If you prefer to use a Make-like syntax, with all the files listed in
one go you can use the newline escaping like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 110
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 110
Now that the source files are listed in the project file, the header
files must be added. These are added in exactly the same way as source
@@ -4620,7 +4620,7 @@
Once you have done this, your project file should look something like
this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 111
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 111
The target name is set automatically; it is the same as the project
file, but with the suffix appropriate to the platform. For example, if
@@ -4628,7 +4628,7 @@
on Windows and \c hello on Unix. If you want to use a different name
you can set it in the project file:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 112
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 112
The final step is to set the \l{qmake Variable Reference#CONFIG}{CONFIG}
variable. Since this is a Qt application, we need to put \c qt on the
@@ -4638,19 +4638,19 @@
The finished project file should look like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 113
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 113
You can now use \l {qmake}{ \c qmake}to generate a Makefile for your application.
On the command line, in your project's directory, type the following:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 114
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 114
Then type \c make or \c nmake depending on the compiler you use.
For Visual Studio users, \l {qmake}{ \c qmake}can also generate \c .dsp or
\c .vcproj files, for example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 115
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 115
\section1 Making an Application Debuggable
@@ -4662,7 +4662,7 @@
For example:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 116
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 116
Use \l {qmake}{ \c qmake}as before to generate a Makefile and you will be able to
obtain useful information about your application when running it in
@@ -4682,7 +4682,7 @@
A simple scope that will add in the platform-dependent file for
Windows looks like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 117
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 117
So if \l {qmake}{ \c qmake}is run on Windows, it will add \c hellowin.cpp to the
list of source files. If \l {qmake}{ \c qmake}is run on any other platform, it
@@ -4692,7 +4692,7 @@
When you have done that, your project file should now look
something like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 118
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 118
Use \l {qmake}{ \c qmake}as before to generate a Makefile.
@@ -4704,13 +4704,13 @@
works in the same way as scopes do. Simply replace the scope condition
with the function. A check for a \c main.cpp file looks like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 119
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 119
The \c{!} symbol is used to negate the test; i.e. \c{exists( main.cpp )}
is true if the file exists, and \c{!exists( main.cpp )} is true if the
file doesn't exist.
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 120
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 120
Use \l {qmake}{ \c qmake}as before to generate a makefile. If you rename \c
main.cpp temporarily, you will see the message and \l {qmake}{ \c qmake}will stop
@@ -4729,12 +4729,12 @@
the other inside it. Put the settings to be processed inside the last
scope, like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 121
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 121
Nested scopes can be joined together using colons, so the final
project file looks like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 122
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 122
That's it! You have now completed the tutorial for \c qmake, and are
ready to write project files for your development projects.
@@ -4806,7 +4806,7 @@
need to specify any, \l {qmake}{ \c qmake}will add in the default ones needed.
For instance, an example project file might look like this:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 123
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 123
For items that are single valued, e.g. the template or the destination
directory, we use "="; but for multi-valued items we use "+=" to \e
@@ -4892,7 +4892,7 @@
to allow the project to be built in both modes. This can be invoked in the
following way:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 124
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 124
The \c build_all option can be added to the \c CONFIG variable in the
project file to ensure that the project is built in both modes by default:
@@ -4901,14 +4901,14 @@
This allows the Makefile to be processed using the default rule:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 125
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 125
\section2 Installing in Both Modes
The \c build_all option also ensures that both versions of the target
will be installed when the installation rule is invoked:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 126
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 126
It is possible to customize the names of the build targets depending on
the target platform. For example, a library or plugin may be named using a
@@ -4918,7 +4918,7 @@
Note: This was originally used in the customwidgetplugin.pro file, but is
no longer needed there.
\endomit
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 127
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 127
The default behavior in the above snippet is to modify the name used for
the build target when building in debug mode. An \c else clause could be
diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc
index 8924bdb..44b682a 100644
--- a/doc/src/development/qtestlib.qdoc
+++ b/doc/src/development/qtestlib.qdoc
@@ -119,7 +119,7 @@
testfunction.
Example:
- \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 0
For more examples, refer to the \l{QTestLib Tutorial}.
@@ -128,7 +128,7 @@
If you are using \c qmake as your build tool, just add the
following to your project file:
- \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtestlib.pro 1
If you are using other build tools, make sure that you add the location
of the QTestLib header files to your include path (usually \c{include/QtTest}
@@ -217,7 +217,7 @@
To create a benchmark, follow the instructions for creating a test and then add a
QBENCHMARK macro to the test function that you want to benchmark.
- \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 12
The code inside the QBENCHMARK macro will be measured, and possibly also repeated
several times in order to get an accurate measurement. This depends on the selected
@@ -410,7 +410,7 @@
Then you need to implement the test function itself. The
implementation could look like this:
- \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 8
The \l QVERIFY() macro evaluates the expression passed as its
argument. If the expression evaluates to true, the execution of
@@ -475,7 +475,7 @@
test function. If we add more test data, the function might look like
this:
- \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 11
To prevent that the function ends up being cluttered by repetitive
code, QTestLib supports adding test data to a test function. All
diff --git a/doc/src/examples/arrowpad.qdoc b/doc/src/examples/arrowpad.qdoc
index bb22f83..5e9cc9a 100644
--- a/doc/src/examples/arrowpad.qdoc
+++ b/doc/src/examples/arrowpad.qdoc
@@ -66,7 +66,7 @@
context: it is the context of the texts in the \c ArrowPad class.
The \c Q_OBJECT macro defines \c tr(x) in \c ArrowPad like this:
- \snippet doc/src/snippets/code/doc_src_examples_arrowpad.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_arrowpad.cpp 0
Knowing which class each source text appears in enables \e {Qt
Linguist} to group texts that are logically related together, e.g.
diff --git a/doc/src/examples/containerextension.qdoc b/doc/src/examples/containerextension.qdoc
index 818547c..57295de 100644
--- a/doc/src/examples/containerextension.qdoc
+++ b/doc/src/examples/containerextension.qdoc
@@ -138,7 +138,7 @@
target path for the project and adding it to the list of items to
install:
- \snippet doc/src/snippets/code/doc_src_examples_containerextension.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_containerextension.pro 0
The container extension is created as a library, and will be
installed alongside the other \QD plugins when the project is
diff --git a/doc/src/examples/customwidgetplugin.qdoc b/doc/src/examples/customwidgetplugin.qdoc
index f972500..5b6aab6 100644
--- a/doc/src/examples/customwidgetplugin.qdoc
+++ b/doc/src/examples/customwidgetplugin.qdoc
@@ -89,7 +89,7 @@
target path for the project and adding it to the list of items to
install:
- \snippet doc/src/snippets/code/doc_src_examples_customwidgetplugin.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_customwidgetplugin.pro 0
The custom widget is created as a library, and will be installed
alongside the other \QD plugins when the project is installed
diff --git a/doc/src/examples/editabletreemodel.qdoc b/doc/src/examples/editabletreemodel.qdoc
index 042b745..5edc91b 100644
--- a/doc/src/examples/editabletreemodel.qdoc
+++ b/doc/src/examples/editabletreemodel.qdoc
@@ -131,14 +131,14 @@
In the case shown in the diagram, the piece of information represented
by \bold{a} can be obtained using the standard model/view API:
- \snippet doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp 0
Since each items holds pieces of data for each column in a given row,
there can be many model indexes that map to the same \c TreeItem object.
For example, the information represented by \bold{b} can be obtained
using the following code:
- \snippet doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp 1
The same underlying \c TreeItem would be accessed to obtain information
for the other model indexes in the same row as \bold{b}.
diff --git a/doc/src/examples/fancybrowser.qdoc b/doc/src/examples/fancybrowser.qdoc
index b46903d..bc30988 100644
--- a/doc/src/examples/fancybrowser.qdoc
+++ b/doc/src/examples/fancybrowser.qdoc
@@ -26,8 +26,8 @@
****************************************************************************/
/*!
- \example webkit/fancybrowser
- \title Fancy Browser Example
+ \example webkit/fancybrowser
+ \title Fancy Browser Example
The Fancy Browser example shows how to use jQuery with QtWebKit to
create a web browser with special effects and content
diff --git a/doc/src/examples/icons.qdoc b/doc/src/examples/icons.qdoc
index 4210859..1f959f9 100644
--- a/doc/src/examples/icons.qdoc
+++ b/doc/src/examples/icons.qdoc
@@ -278,7 +278,7 @@
If the application is built in debug mode, the \c Q_ASSERT()
macro will expand to
- \snippet doc/src/snippets/code/doc_src_examples_icons.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_icons.cpp 0
In release mode, the macro simply disappear. The mode can be set
in the application's \c .pro file. One way to do so is to add an
diff --git a/doc/src/examples/imageviewer.qdoc b/doc/src/examples/imageviewer.qdoc
index 70f71c8..f1d02c3 100644
--- a/doc/src/examples/imageviewer.qdoc
+++ b/doc/src/examples/imageviewer.qdoc
@@ -149,7 +149,7 @@
\{QWidget::adjustSize()}{adjustSize()} to achieve this, which is
essentially the same as
- \snippet doc/src/snippets/code/doc_src_examples_imageviewer.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_imageviewer.cpp 0
In the \c print() slot, we first make sure that an image has been
loaded into the application:
@@ -160,7 +160,7 @@
If the application is built in debug mode, the \c Q_ASSERT() macro
will expand to
- \snippet doc/src/snippets/code/doc_src_examples_imageviewer.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_examples_imageviewer.cpp 1
In release mode, the macro simply disappear. The mode can be set
in the application's \c .pro file. One way to do so is to add an
@@ -318,7 +318,7 @@
Whenever we zoom in or out, we need to adjust the scroll bars in
consequence. It would have been tempting to simply call
- \snippet doc/src/snippets/code/doc_src_examples_imageviewer.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_examples_imageviewer.cpp 4
but this would make the top-left corner the focal point, not the
center. Therefore we need to take into account the scroll bar
diff --git a/doc/src/examples/qtscriptcustomclass.qdoc b/doc/src/examples/qtscriptcustomclass.qdoc
index f2b4f36..3ee6c95 100644
--- a/doc/src/examples/qtscriptcustomclass.qdoc
+++ b/doc/src/examples/qtscriptcustomclass.qdoc
@@ -46,7 +46,7 @@
scripting environment, \c{ByteArray} objects can be constructed like
so:
- \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 0
\c{ByteArray} objects behave similar to normal \c{Array} objects. Every \c{ByteArray} object has
a \c{length} property, that holds the length of the array. If a new value is assigned to the \c{length}
@@ -55,22 +55,22 @@
Use normal array operations to read or write bytes in the array. The following code sets all the
bytes of an array to a certain value:
- \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 1
When assigning a value to an array element, the value is truncated to eight bits:
- \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 2
Like normal \c{Array} objects, if the array index is greater than the current length
of the array, the array is resized accordingly:
- \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 3
Property names that aren't valid array indexes are treated
like normal object properties (again, the same is the case for normal \c{Array} objects);
in other words, it's perfectly fine to do something like this:
- \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 4
The above assignment won't affect the contents of the array, but will rather assign a value
to the object property named "foo".
@@ -78,7 +78,7 @@
\c{ByteArray} objects have a set of methods: chop(), equals(), left(), mid(), toBase64() and so on.
These map directly onto the corresponding methods in QByteArray.
- \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 5
\section1 ByteArray Class Implementation
diff --git a/doc/src/examples/simpledommodel.qdoc b/doc/src/examples/simpledommodel.qdoc
index ea380bd..9b4d80e 100644
--- a/doc/src/examples/simpledommodel.qdoc
+++ b/doc/src/examples/simpledommodel.qdoc
@@ -53,7 +53,7 @@
snippet reads the contents of a file into a QDomDocument object and traverses the
document, reading all the plain text that can be found:
- \snippet doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_simpledommodel.cpp 0
In principle, the functions provided by QDomNode can be used to navigate from any
given starting point in a document to the piece of data requested by another component.
diff --git a/doc/src/examples/taskmenuextension.qdoc b/doc/src/examples/taskmenuextension.qdoc
index 0200c2f..b557b8b 100644
--- a/doc/src/examples/taskmenuextension.qdoc
+++ b/doc/src/examples/taskmenuextension.qdoc
@@ -139,7 +139,7 @@
target path for the project and adding it to the list of items to
install:
- \snippet doc/src/snippets/code/doc_src_examples_taskmenuextension.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_taskmenuextension.pro 0
The task menu extension is created as a library, and will be
installed alongside the other \QD plugins when the project is
diff --git a/doc/src/examples/textfinder.qdoc b/doc/src/examples/textfinder.qdoc
index e92bb98..f5f41d7 100644
--- a/doc/src/examples/textfinder.qdoc
+++ b/doc/src/examples/textfinder.qdoc
@@ -70,7 +70,7 @@
QtUiTools module library. This is done in the \c{textfinder.pro} file
that contains the following lines:
- \snippet doc/src/snippets/code/doc_src_examples_textfinder.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_textfinder.pro 0
\section1 TextFinder Class Definition
diff --git a/doc/src/examples/trollprint.qdoc b/doc/src/examples/trollprint.qdoc
index 3a77a71..a93811e 100644
--- a/doc/src/examples/trollprint.qdoc
+++ b/doc/src/examples/trollprint.qdoc
@@ -132,12 +132,12 @@
second argument "two-sided" in the appropriate \c tr() calls to the
first pair of radio buttons:
- \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 0
and add the second argument "colors" in the appropriate \c tr() calls
for the second pair of radio buttons:
- \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 1
Now run \c lupdate and open \c trollprint_pt.ts with \e {Qt Linguist}. You
should now see two changes.
@@ -177,7 +177,7 @@
the translations. This can be achieved by using a \c TRANSLATOR comment
in the source code:
- \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 2
Try adding these comments to some source files, particularly to
dialog classes, describing the navigation necessary to reach the
@@ -192,7 +192,7 @@
correct. Comments that provide good navigation information can save
them time:
- \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 3
\section1 Troll Print 1.1
diff --git a/doc/src/examples/worldtimeclockplugin.qdoc b/doc/src/examples/worldtimeclockplugin.qdoc
index 61a214c..8a17004 100644
--- a/doc/src/examples/worldtimeclockplugin.qdoc
+++ b/doc/src/examples/worldtimeclockplugin.qdoc
@@ -176,7 +176,7 @@
is searched by \QD. We do this by specifying a target path for the project
and adding it to the list of items to install:
- \snippet doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.pro 0
The custom widget is created as a library, and will be installed
alongside the other \QD plugins when the project is installed
diff --git a/doc/src/files-and-resources/resources.qdoc b/doc/src/files-and-resources/resources.qdoc
index ecf343d..35e6a90 100644
--- a/doc/src/files-and-resources/resources.qdoc
+++ b/doc/src/files-and-resources/resources.qdoc
@@ -130,7 +130,7 @@
In the application, this resource would be registered with code like this:
- \snippet doc/src/snippets/code/doc_src_resources.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_resources.cpp 4
\section2 Compiled-In Resources
@@ -205,7 +205,7 @@
Q_INIT_RESOURCE() with the base name of the \c .qrc file. For
example:
- \snippet doc/src/snippets/code/doc_src_resources.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_resources.cpp 5
Similarly, if you must unload a set of resources explicitly
(because a plugin is being unloaded or the resources are not valid
diff --git a/doc/src/frameworks-technologies/accessible.qdoc b/doc/src/frameworks-technologies/accessible.qdoc
index 1d15dbd..e7bf171 100644
--- a/doc/src/frameworks-technologies/accessible.qdoc
+++ b/doc/src/frameworks-technologies/accessible.qdoc
@@ -256,7 +256,7 @@
variable set to 1. For example, this is set in the following way with
the bash shell:
- \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc environment
+ \snippet doc/src/snippets/code/doc_src_qt4-accessibility.cpp environment
Accessibility features are built into Qt by default when the libraries
are configured and built.
diff --git a/doc/src/frameworks-technologies/activeqt-container.qdoc b/doc/src/frameworks-technologies/activeqt-container.qdoc
index 436f375..862408b 100644
--- a/doc/src/frameworks-technologies/activeqt-container.qdoc
+++ b/doc/src/frameworks-technologies/activeqt-container.qdoc
@@ -67,7 +67,7 @@
To build Qt applications that can host COM objects and ActiveX controls
link the application against the QAxContainer module by adding
- \snippet doc/src/snippets/code/doc_src_qaxcontainer.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qaxcontainer.pro 0
to your application's \c .pro file.
@@ -128,7 +128,7 @@
want to use, or integrate it into the build system by adding the type
libraries to the \c TYPELIBS variable in your application's \c .pro file:
- \snippet doc/src/snippets/code/doc_src_qaxcontainer.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qaxcontainer.pro 1
Note that \l dumpcpp might not be able to expose all APIs in the type
library.
diff --git a/doc/src/frameworks-technologies/activeqt-server.qdoc b/doc/src/frameworks-technologies/activeqt-server.qdoc
index 9af2b65..77cacf8 100644
--- a/doc/src/frameworks-technologies/activeqt-server.qdoc
+++ b/doc/src/frameworks-technologies/activeqt-server.qdoc
@@ -60,10 +60,10 @@
An out-of-process executable server is generated from a \c .pro
file like this:
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qaxserver.pro 0
To build an in-process server, use a \c .pro file like this:
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qaxserver.pro 1
The files \c qaxserver.rc and \c qaxserver.def are part of the
framework and can be used from their usual location (specify a
@@ -91,7 +91,7 @@
Additionally you can specify a version number using the \c VERSION
variable, e.g.
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qaxserver.pro 2
The version number specified will be used as the version of the type
library and of the server when registering.
@@ -186,12 +186,12 @@
or any existing QObject subclass. If the class is a subclass of QWidget,
the COM object will be an ActiveX control.
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 3
The Q_OBJECT macro is required to provide the meta object information
about the widget to the ActiveQt framework.
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 4
Use the Q_CLASSINFO() macro to specify the COM identifiers for the COM
object. \c ClassID and \c InterfaceID are required, while \c EventsID is
@@ -201,7 +201,7 @@
You can specify additional attributes for each of your classes; see
\l{Class Information and Tuning} for details.
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 5
Use the Q_PROPERTY() macro to declare properties for the ActiveX control.
@@ -216,7 +216,7 @@
your implementation of QAxFactory::create.
\endfootnote
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 6
The ActiveQt framework will expose properties and public slots as ActiveX
properties and methods, and signals as ActiveX events, and convert between
@@ -428,7 +428,7 @@
To make the properties bindable for the ActiveX client, use multiple
inheritance from the QAxBindable class:
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 7
When implementing the property write functions, use the
QAxBindable class's requestPropertyChange() and propertyChanged()
@@ -453,7 +453,7 @@
an implementation of a QAxFactory. The easist way to do this is to use a set
of macros:
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 8
This will export \c MyWidget and \c MyWidget2 as COM objects that can be
created by COM clients, and will register \c MySubType as a type that can
@@ -470,7 +470,7 @@
server. Use QAxFactory::isServer() to create and run a standard
application interface, or to prevent a stand-alone execution:
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 9
This is however not necessary as ActiveQt provides a default implementation
of a main function. The default implemenation calls QAxFactory::startServer(),
@@ -512,7 +512,7 @@
macro, the QAxFactory subclass had no appropriate constructor.
Provide a public class constructor like
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 10
for your factory class.
@@ -560,7 +560,7 @@
your installer process, resolve the \c DllRegisterServer symbol and
call the function:
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 11
\section3 Distributing Servers over the Internet
@@ -766,7 +766,7 @@
own API, and is available in the "Insert Objects" dialog of Microsoft
Office applications.
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 15
\section2 Developing Licensed Components
@@ -782,7 +782,7 @@
To mark a Qt class as licensed specify a "LicenseKey" using the
Q_CLASSINFO() macro.
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 16
The key is required to be able to create an instance of \c MyLicensedControl
on a machine that is not licensed itself. The licensed developer can now
@@ -805,12 +805,12 @@
Create a new subclass of QAxAggregated and use multiple inheritance
to subclass additional COM interface classes.
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 17
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 17
Reimplement the QAxAggregated::queryInterface() function to
support the additional COM interfaces.
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 18
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 18
Since \c ISomeCOMInterface is a subclass of \c IUnknown you will
have to implement the \c QueryInterface(), \c AddRef(), and \c
@@ -820,7 +820,7 @@
returned by the QAxAggregated::controllingUnknown() function,
e.g.
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 19
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 19
Do not support the \c IUnknown interface itself in your
\l{QAxAggregated::queryInterface()}{queryInterface()}
@@ -833,5 +833,5 @@
QAxBindable::createAggregate() to return a new object of the
QAxAggregated subclass.
- \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 20
+ \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 20
*/
diff --git a/doc/src/frameworks-technologies/containers.qdoc b/doc/src/frameworks-technologies/containers.qdoc
index 991588e..f28e5dc 100644
--- a/doc/src/frameworks-technologies/containers.qdoc
+++ b/doc/src/frameworks-technologies/containers.qdoc
@@ -205,7 +205,7 @@
Here's an example custom data type that meets the requirement of
an assignable data type:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 0
If we don't provide a copy constructor or an assignment operator,
C++ provides a default implementation that performs a
@@ -306,7 +306,7 @@
Here's a typical loop for iterating through all the elements of a
QList<QString> in order and printing them to the console:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 1
It works as follows: The QList to iterate over is passed to the
QListIterator constructor. At that point, the iterator is located
@@ -319,7 +319,7 @@
Here's how to iterate backward in a QList:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 2
The code is symmetric with iterating forward, except that we
start by calling \l{QListIterator::toBack()}{toBack()}
@@ -358,7 +358,7 @@
QMutableListIterator. Here's an example where we remove all
odd numbers from a QList<int> using QMutableListIterator:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 3
The next() call in the loop is made every time. It jumps over the
next item in the list. The
@@ -368,13 +368,13 @@
the iterator, so it is safe to continue using it. This works just
as well when iterating backward:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 4
If we just want to modify the value of an existing item, we can
use \l{QMutableListIterator::setValue()}{setValue()}. In the code
below, we replace any value larger than 128 with 128:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 5
Just like \l{QMutableListIterator::remove()}{remove()},
\l{QMutableListIterator::setValue()}{setValue()} operates on the
@@ -387,7 +387,7 @@
operations, we don't even need
\l{QMutableListIterator::setValue()}{setValue()}:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 6
As mentioned above, QLinkedList's, QVector's, and QSet's iterator
classes have exactly the same API as QList's. We will now turn to
@@ -410,7 +410,7 @@
The following example removes all (capital, country) pairs where
the capital's name ends with "City":
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 7
QMapIterator also provides a key() and a value() function that
operate directly on the iterator and that return the key and
@@ -418,7 +418,7 @@
example, the following code copies the contents of a QMap into a
QHash:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 8
If we want to iterate through all the items with the same
value, we can use \l{QMapIterator::findNext()}{findNext()}
@@ -426,7 +426,7 @@
Here's an example where we remove all the items with a particular
value:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 9
\section2 STL-Style Iterators
@@ -473,7 +473,7 @@
Here's a typical loop for iterating through all the elements of a
QList<QString> in order and converting them to lowercase:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 10
Unlike \l{Java-style iterators}, STL-style iterators point
directly at items. The begin() function of a container returns an
@@ -493,7 +493,7 @@
decrement the iterator \e before we access the item. This
requires a \c while loop:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 11
In the code snippets so far, we used the unary \c * operator to
retrieve the item (of type QString) stored at a certain iterator
@@ -504,7 +504,7 @@
For read-only access, you can use const_iterator, constBegin(),
and constEnd(). For example:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 12
The following table summarizes the STL-style iterators' API:
@@ -536,7 +536,7 @@
value() function to retrieve the value. For example, here's how
we would print all items in a QMap to the console:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 13
Thanks to \l{implicit sharing}, it is very inexpensive for a
function to return a container per value. The Qt API contains
@@ -545,7 +545,7 @@
using an STL iterator, you should always take a copy of the
container and iterate over the copy. For example:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 14
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 14
This problem doesn't occur with functions that return a const or
non-const reference to a container.
@@ -567,35 +567,35 @@
statement. For example, here's how to use \c foreach to iterate
over a QLinkedList<QString>:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 15
The \c foreach code is significantly shorter than the equivalent
code that uses iterators:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 16
Unless the data type contains a comma (e.g., \c{QPair<int,
int>}), the variable used for iteration can be defined within the
\c foreach statement:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 17
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 17
And like any other C++ loop construct, you can use braces around
the body of a \c foreach loop, and you can use \c break to leave
the loop:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 18
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 18
With QMap and QHash, \c foreach accesses the value component of
the (key, value) pairs. If you want to iterate over both the keys
and the values, you can use iterators (which are fastest), or you
can write code like this:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 19
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 19
For a multi-valued map:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 20
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 20
Qt automatically takes a copy of the container when it enters a
\c foreach loop. If you modify the container as you are
@@ -611,12 +611,12 @@
In addition to \c foreach, Qt also provides a \c forever
pseudo-keyword for infinite loops:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 21
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 21
If you're worried about namespace pollution, you can disable
these macros by adding the following line to your \c .pro file:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 22
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 22
\section1 Other Container-Like Classes
@@ -736,7 +736,7 @@
Consider the following code, which builds a QString from another
QString:
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 23
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 23
We build the string \c out dynamically by appending one character
to it at a time. Let's assume that we append 15000 characters to
diff --git a/doc/src/frameworks-technologies/dbus-adaptors.qdoc b/doc/src/frameworks-technologies/dbus-adaptors.qdoc
index 7494f2d..82545db 100644
--- a/doc/src/frameworks-technologies/dbus-adaptors.qdoc
+++ b/doc/src/frameworks-technologies/dbus-adaptors.qdoc
@@ -85,14 +85,14 @@
using an adaptor.
A sample usage of QDBusAbstractAdaptor is as follows:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 0
The code above would create an interface that could be represented more or less in the following
canonical representation:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 1
This adaptor could be used in the application's main function as follows
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 2
Break-down analysis:
\tableofcontents
@@ -100,7 +100,7 @@
\section1 The header
The header of the example is:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 3
The code does the following:
\list
@@ -112,10 +112,10 @@
\section1 The properties
The properties are declared as follows:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 4
And are implemented as follows:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 5
The code declares three properties: one of them is a read-write property called "caption" of
string type. The other two are read-only, also of the string type.
@@ -129,7 +129,7 @@
\section1 The constructor
The constructor:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 6
The constructor does the following:
\list
@@ -149,7 +149,7 @@
\section1 Slots/methods
The public slots in the example (which will be exported as D-Bus methods) are the following:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 7
This snippet of code defines 4 methods with different properties each:
\list 1
@@ -176,7 +176,7 @@
\section1 Signals
The signals in this example are defined as follows:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 8
However, signal definition isn't enough: signals have to be emitted. One simple way of emitting
signals is to connect another signal to them, so that Qt's signal handling system chains them
@@ -187,7 +187,7 @@
When simple signal-to-signal connection isn't enough, one can use a private slot do do some
work. This is what was done for the mainWindowHasFocus signal:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 9
This private slot (which will not be exported as a method via D-Bus) was connected to the
\c focusChanged signal in the adaptor's constructor. It is therefore able to shape the
@@ -291,7 +291,7 @@
\l{QDBusMessage::setDelayedReply()}{QDBusMessage::setDelayedReply(true)}
that the response will be sent later.
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 10
The use of
\l{QDBusConnection::send()}{QDBusConnection::sessionBus().send(data->reply)}
@@ -303,7 +303,7 @@
using the \c QDBusMessage object that was obtained. In our example, the
reply code could be something as follows:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 11
As can be seen in the example, when a delayed reply is in place,
the return value(s) from the slot will be ignored by QtDBus. They
@@ -473,7 +473,7 @@
You can use this macro in your own adaptors by placing it before your method's return value
(which must be "void") in the class declaration, as shown in the example:
- \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 12
Its presence in the method implementation (outside the class declaration) is optional.
diff --git a/doc/src/frameworks-technologies/graphicsview.qdoc b/doc/src/frameworks-technologies/graphicsview.qdoc
index f689446..1903df5 100644
--- a/doc/src/frameworks-technologies/graphicsview.qdoc
+++ b/doc/src/frameworks-technologies/graphicsview.qdoc
@@ -95,7 +95,7 @@
descending stacking order (i.e., the first returned item is topmost,
and the last item is bottom-most).
- \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 0
QGraphicsScene's event propagation architecture schedules scene events
for delivery to items, and also manages propagation between items. If
@@ -126,7 +126,7 @@
enable OpenGL support, you can set a QGLWidget as the viewport by
calling QGraphicsView::setViewport().
- \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 1
The view receives input events from the keyboard and mouse, and
translates these to scene events (converting the coordinates used
@@ -333,7 +333,7 @@
Here is an example of how to implement zoom and rotate slots in a
subclass of QGraphicsView:
- \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 2
The slots could be connected to \l{QToolButton}{QToolButtons} with
\l{QAbstractButton::autoRepeat}{autoRepeat} enabled.
@@ -353,7 +353,7 @@
a QPainter to either of the rendering functions. This example shows
how to print the whole scene into a full page, using QPrinter.
- \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 3
The difference between the scene and view rendering functions is that
one operates in scene coordinates, and the other in view coordinates.
@@ -364,7 +364,7 @@
is to render the exact contents of the viewport using the provided
painter.
- \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 4
When the source and target areas' sizes do not match, the source
contents are stretched to fit into the target area. By passing a
@@ -390,7 +390,7 @@
so in mousePressEvent() or mouseMoveEvent(), you can get the
originating widget pointer from the event. For example:
- \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 5
To intercept drag and drop events for the scene, you reimplement
QGraphicsScene::dragEnterEvent() and whichever event handlers your
@@ -449,7 +449,7 @@
Example:
- \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 6
\section2 Item Groups
diff --git a/doc/src/frameworks-technologies/implicit-sharing.qdoc b/doc/src/frameworks-technologies/implicit-sharing.qdoc
index 8938d9e..46567e9 100644
--- a/doc/src/frameworks-technologies/implicit-sharing.qdoc
+++ b/doc/src/frameworks-technologies/implicit-sharing.qdoc
@@ -109,7 +109,7 @@
data in all member functions that change the internal data.
Code fragment:
- \snippet doc/src/snippets/code/doc_src_groups.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_groups.cpp 0
\section1 List of Classes
@@ -124,7 +124,7 @@
concern for the copying overhead.
Example:
- \snippet doc/src/snippets/code/doc_src_groups.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_groups.cpp 1
In this example, \c p1 and \c p2 share data until QPainter::begin()
is called for \c p2, because painting a pixmap will modify it.
diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc
index 92067b9..58b51e5 100644
--- a/doc/src/frameworks-technologies/model-view-programming.qdoc
+++ b/doc/src/frameworks-technologies/model-view-programming.qdoc
@@ -32,7 +32,7 @@
/*!
\page model-view-programming.html
- \ingroup qt-basic-concepts
+ \ingroup qt-basic-concepts
\title Model/View Programming
\brief A guide to Qt's extensible model/view architecture.
@@ -328,7 +328,7 @@
contain a pointer to the model that created them, and this prevents
confusion when working with more than one model.
- \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 0
Model indexes provide \e temporary references to pieces of information, and
can be used to retrieve or modify data via the model. Since models may
@@ -355,7 +355,7 @@
item by specifying its row and column numbers to the model, and we receive
an index that represents the item:
- \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 1
Models that provide interfaces to simple, single level data structures like
lists and tables do not need any other information to be provided but, as
@@ -371,7 +371,7 @@
index that refers to an item of data by passing the relevant row and
column numbers to the model.
- \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 2
Top level items in a model are always referenced by specifying
\c QModelIndex() as their parent item. This is discussed in the next
@@ -392,7 +392,7 @@
about the item's parent. Outside the model, the only way to refer to an
item is through a model index, so a parent model index must also be given:
- \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 3
\table
\row \i \inlineimage modelview-treemodel.png
@@ -403,12 +403,12 @@
Items "A" and "C" are represented as top-level siblings in the model:
- \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 4
Item "A" has a number of children. A model index for item "B" is
obtained with the following code:
- \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 5
\endtable
\section3 Item roles
@@ -423,7 +423,7 @@
corresponding to the item, and by specifying a role to obtain the type
of data we want:
- \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 6
\table
\row \i \inlineimage modelview-roles.png
diff --git a/doc/src/frameworks-technologies/phonon.qdoc b/doc/src/frameworks-technologies/phonon.qdoc
index 1456eae6..9eb56ea 100644
--- a/doc/src/frameworks-technologies/phonon.qdoc
+++ b/doc/src/frameworks-technologies/phonon.qdoc
@@ -165,7 +165,7 @@
The \c .pro file for a project needs the following line to be added:
- \snippet doc/src/snippets/code/doc_src_phonon.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_phonon.pro 0
Phonon comes with several widgets that provide functionality
commonly associated with multimedia players - notably SeekSlider
diff --git a/doc/src/frameworks-technologies/plugins-howto.qdoc b/doc/src/frameworks-technologies/plugins-howto.qdoc
index b332d57..15b1547 100644
--- a/doc/src/frameworks-technologies/plugins-howto.qdoc
+++ b/doc/src/frameworks-technologies/plugins-howto.qdoc
@@ -109,12 +109,12 @@
straightforward, here is the class definition (\c
mystyleplugin.h):
- \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_plugins-howto.cpp 0
Ensure that the class implementation is located in a \c .cpp file
(including the class definition):
- \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_plugins-howto.cpp 1
(Note that QStylePlugin is case insensitive, and the lower-case
version of the key is used in our
@@ -127,7 +127,7 @@
you might want to set a style explicitly in code. To apply a
style, use code like this:
- \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_plugins-howto.cpp 2
Some plugin classes require additional functions to be
implemented. See the class documentation for details of the
@@ -284,12 +284,12 @@
the required plugins to your build using \c QTPLUGIN.
For example, in your \c main.cpp:
- \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_plugins-howto.cpp 4
In the \c .pro file for your application, you need the following
entry:
- \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_plugins-howto.pro 5
It is also possible to create your own static plugins, by
following these steps:
diff --git a/doc/src/frameworks-technologies/qthelp.qdoc b/doc/src/frameworks-technologies/qthelp.qdoc
index 42bc482..f4d75b6 100644
--- a/doc/src/frameworks-technologies/qthelp.qdoc
+++ b/doc/src/frameworks-technologies/qthelp.qdoc
@@ -218,7 +218,7 @@
we get the actual help contents by calling fileData() and display
the document to the user.
- \snippet doc/src/snippets/code/doc_src_qthelp.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qthelp.cpp 6
For further information on how to use the API, have a look at
the QHelpEngine class reference.
diff --git a/doc/src/frameworks-technologies/richtext.qdoc b/doc/src/frameworks-technologies/richtext.qdoc
index 089f84d..313cf46 100644
--- a/doc/src/frameworks-technologies/richtext.qdoc
+++ b/doc/src/frameworks-technologies/richtext.qdoc
@@ -145,11 +145,11 @@
Although QTextEdit makes it easy to display and edit rich text, documents
can also be used independently of any editor widget, for example:
- \snippet doc/src/snippets/code/doc_src_richtext.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_richtext.cpp 0
Alternatively, they can be extracted from an existing editor:
- \snippet doc/src/snippets/code/doc_src_richtext.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_richtext.cpp 1
This flexibility enables applications to handle multiple rich text
documents without the overhead of multiple editor widgets, or requiring
@@ -728,24 +728,24 @@
A text editor widget can be constructed and used to display HTML in the
following way:
- \snippet doc/src/snippets/code/doc_src_richtext.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_richtext.cpp 2
By default, the text editor contains a document with a root frame, inside
which is an empty text block. This document can be obtained so that it can
be modified directly by the application:
- \snippet doc/src/snippets/code/doc_src_richtext.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_richtext.cpp 3
The text editor's cursor may also be used to edit a document:
- \snippet doc/src/snippets/code/doc_src_richtext.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_richtext.cpp 4
Although a document can be edited using many cursors at once, a QTextEdit
only displays a single cursor at a time. Therefore, if we want to update the
editor to display a particular cursor or its selection, we need to set the
editor's cursor after we have modified the document:
- \snippet doc/src/snippets/code/doc_src_richtext.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_richtext.cpp 5
\section1 Selecting Text
@@ -833,7 +833,7 @@
We give an example of the latter technique from the list. We assume that
the text edit is visible.
- \snippet doc/src/snippets/code/doc_src_richtext.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_richtext.cpp 6
\omit
Ideas for other sections:
diff --git a/doc/src/frameworks-technologies/unicode.qdoc b/doc/src/frameworks-technologies/unicode.qdoc
index b4a9347..d2a6500 100644
--- a/doc/src/frameworks-technologies/unicode.qdoc
+++ b/doc/src/frameworks-technologies/unicode.qdoc
@@ -125,12 +125,12 @@
QString provides implicit casting from \c{const char *}
so that things like
- \snippet doc/src/snippets/code/doc_src_unicode.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_unicode.cpp 0
will work. There is also a function, QObject::tr(), that provides
translation support, like this:
- \snippet doc/src/snippets/code/doc_src_unicode.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_unicode.cpp 1
QObject::tr() maps from \c{const char *} to a Unicode string, and
uses installable QTranslator objects to do the mapping.
@@ -151,11 +151,11 @@
fast functions for mapping to and from them. For example, to open an
application's icon one might do this:
- \snippet doc/src/snippets/code/doc_src_unicode.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_unicode.cpp 2
or
- \snippet doc/src/snippets/code/doc_src_unicode.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_unicode.cpp 3
Regarding output, Qt will do a best-effort conversion from
Unicode to whatever encoding the system and fonts provide.
diff --git a/doc/src/howtos/appicon.qdoc b/doc/src/howtos/appicon.qdoc
index 86934bc..6d86b22 100644
--- a/doc/src/howtos/appicon.qdoc
+++ b/doc/src/howtos/appicon.qdoc
@@ -62,7 +62,7 @@
Finally, assuming you are using \c qmake to generate your
makefiles, add this line to your \c myapp.pro file:
- \snippet doc/src/snippets/code/doc_src_appicon.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_appicon.pro 1
Regenerate your makefile and your application. The \c .exe file
will now be represented with your icon in Explorer.
@@ -96,7 +96,7 @@
if the name of your icon file is \c{myapp.icns}, and your project
file is \c{myapp.pro}, add this line to \c{myapp.pro}:
- \snippet doc/src/snippets/code/doc_src_appicon.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_appicon.pro 2
This will ensure that \c qmake puts your icons in the proper
place and creates an \c{Info.plist} entry for the icon.
@@ -213,6 +213,6 @@
icon file is \c{myapp.svg}, and your project file is \c{myapp.pro},
add this line to \c{myapp.pro}:
- \snippet doc/src/snippets/code/doc_src_appicon.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_appicon.pro 5
*/
diff --git a/doc/src/howtos/unix-signal-handlers.qdoc b/doc/src/howtos/unix-signal-handlers.qdoc
index 2fa558e..20beb38 100644
--- a/doc/src/howtos/unix-signal-handlers.qdoc
+++ b/doc/src/howtos/unix-signal-handlers.qdoc
@@ -59,7 +59,7 @@
sigaction(2) man pages before plowing through the following code
snippets.
- \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.cpp 0
In the MyDaemon constructor, use the socketpair(2) function to
initialize each file descriptor pair, and then create the
@@ -68,24 +68,24 @@
appropriate slot function, which effectively converts the Unix
signal to the QSocketNotifier::activated() signal.
- \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.cpp 1
Somewhere else in your startup code, you install your Unix signal
handlers with sigaction(2).
- \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.cpp 2
In your Unix signal handlers, you write a byte to the \e write end
of a socket pair and return. This will cause the corresponding
QSocketNotifier to emit its activated() signal, which will in turn
cause the appropriate Qt slot function to run.
- \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.cpp 3
In the slot functions connected to the
QSocketNotifier::activated() signals, you \e read the byte. Now
you are safely back in Qt with your signal, and you can do all the
Qt stuff you weren'tr allowed to do in the Unix signal handler.
- \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.cpp 4
*/
diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc
index e22f953..aa8c9c5 100644
--- a/doc/src/internationalization/i18n.qdoc
+++ b/doc/src/internationalization/i18n.qdoc
@@ -192,7 +192,7 @@
to achieve this is to use QObject::tr(). For example, assuming the
\c LoginWidget is a subclass of QWidget:
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 0
This accounts for 99% of the user-visible strings you're likely to
write.
@@ -202,7 +202,7 @@
appropriate class, or the QCoreApplication::translate() function
directly:
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 1
If you need to have translatable text completely
outside a function, there are two macros to help: QT_TR_NOOP()
@@ -212,11 +212,11 @@
Example of QT_TR_NOOP():
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 2
Example of QT_TRANSLATE_NOOP():
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 3
If you disable the \c{const char *} to QString automatic
conversion by compiling your software with the macro \c
@@ -244,13 +244,13 @@
The QString::arg() functions offer a simple means for substituting
arguments:
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 4
In some languages the order of arguments may need to change, and this
can easily be achieved by changing the order of the % arguments. For
example:
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 5
produces the correct output in English and Norwegian:
\snippet doc/src/snippets/code/doc_src_i18n.qdoc 6
@@ -325,7 +325,7 @@
Typically, your application's \c main() function will look like
this:
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 8
Note the use of QLibraryInfo::location() to locate the Qt translations.
Developers should request the path to the translations at run-time by
@@ -346,7 +346,7 @@
need to output Cyrillic in the ISO 8859-5 encoding. Code for this
would be:
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 9
For converting Unicode to local 8-bit encodings, a shortcut is
available: the QString::toLocal8Bit() function returns such 8-bit
@@ -360,7 +360,7 @@
demonstrated by this conversion from ISO 8859-5 Cyrillic to Unicode
conversion:
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 10
Ideally Unicode I/O should be used as this maximizes the portability
of documents between users around the world, but in reality it is
@@ -392,7 +392,7 @@
formats. Such localizations can be accomplished using appropriate tr()
strings.
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 11
In the example, for the US we would leave the translation of
"AMPM" as it is and thereby use the 12-hour clock branch; but in
@@ -417,7 +417,7 @@
the text displayed by widgets using the \l{QObject::tr()}{tr()} function
in the usual way. For example:
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 12
All other change events should be passed on by calling the default
implementation of the function.
@@ -708,7 +708,7 @@
Typically, your application's \c main() function will look like
this:
- \snippet doc/src/snippets/code/doc_src_i18n.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_i18n.cpp 8
Note the use of QLibraryInfo::location() to locate the Qt translations.
Developers should request the path to the translations at run-time by
diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc
index 1f413f9..460e10c 100644
--- a/doc/src/internationalization/linguist-manual.qdoc
+++ b/doc/src/internationalization/linguist-manual.qdoc
@@ -173,8 +173,8 @@
An example of a complete \c .pro file with four translation source
files:
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 0
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.pro 0
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.pro 1
QTextCodec::setCodecForTr() makes it possible to choose a 8-bit
encoding for literal strings that appear within \c tr() calls.
@@ -186,14 +186,14 @@
application, \QL needs you to set the \c CODECFORTR
entry in the \c .pro file as well. For example:
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.pro 1
Also, if your compiler uses a different encoding for its runtime
system as for its source code and you want to use non-ASCII
characters in string literals, you will need to set the \c
CODECFORSRC. For example:
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.pro 2
Microsoft Visual Studio 2005 .NET appears to be the only compiler
for which this is necessary. However, if you want to write
@@ -201,7 +201,7 @@
in your source files. You can still specify non-ASCII characters
portably using escape sequences, for example:
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 3
\target lupdate manual
\section1 lupdate
@@ -1333,11 +1333,11 @@
User-visible strings are marked as translation targets by wrapping them
in a \c tr() call, for example:
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 6
would become
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 7
All QObject subclasses that use the \c Q_OBJECT macro implement
the \c tr() function.
@@ -1346,11 +1346,11 @@
usually called as a member function of a QObject subclass, in
other cases an explicit class name can be supplied, for example:
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 8
or
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 9
\section2 Distinguishing Between Identical Translatable Strings
@@ -1364,11 +1364,11 @@
differ between the two. This is easily achieved using the
two argument form of the \c tr() call, e.g.
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 10
and
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 11
Ctrl key accelerators are also translatable:
@@ -1385,7 +1385,7 @@
solved by adding a comment using the keyword \e TRANSLATOR which
describes the navigation steps to reach the text in question; e.g.
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 12
These comments are particularly useful for widget classes.
@@ -1395,13 +1395,13 @@
write "plural-aware" internationalized applications. This overload
has the following signature:
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 17
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 17
Depending on the value of \c n, the \c tr() function will return a different
translation, with the correct grammatical number for the target language.
Also, any occurrence of \c %n is replaced with \c{n}'s value. For example:
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 18
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 18
If a French translation is loaded, this will expand to "0 item
remplac\unicode{233}", "1 item remplac\unicode{233}", "2 items
@@ -1430,7 +1430,7 @@
comment at the beginning of the source files that use \c
MyClass::tr():
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 13
After the comment, all references to \c MyClass::tr() will be
understood as meaning \c MyNamespace::MyClass::tr().
@@ -1443,7 +1443,7 @@
use either the tr() function of an appropriate class, or the
QCoreApplication::translate() function directly:
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 14
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 14
\section3 Using QT_TR_NOOP() and QT_TRANSLATE_NOOP()
@@ -1453,10 +1453,10 @@
The macros expand to just the text (without the context).
Example of QT_TR_NOOP():
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 15
Example of QT_TRANSLATE_NOOP():
- \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 16
\section1 Tutorials
diff --git a/doc/src/ja_JP/development/qmake-manual.qdoc b/doc/src/ja_JP/development/qmake-manual.qdoc
index a6cfe3d..3b908f7 100644
--- a/doc/src/ja_JP/development/qmake-manual.qdoc
+++ b/doc/src/ja_JP/development/qmake-manual.qdoc
@@ -58,16 +58,16 @@
新しい行を作り、\c{SOURCES +=}、続いて hello.cpp を入力します。
つまり、以下のようになります:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 108
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 108
これを以下のようになるまでプロジェクトの各ソースファイルに対して行います:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 109
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 109
make に似たシンタックスを使いたい場合は、
以下のように改行をエスケープしてすべてのファイルを 1 行に書きます:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 110
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 110
ソースファイルの一覧をプロジェクトファイルに追加しました。
次にヘッダファイルを追加します。
@@ -77,7 +77,7 @@
これを終えると、プロジェクトファイルは以下のようになるでしょう:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 111
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 111
ターゲットの名前は自動的に設定され、
プロジェクトファイルと同じ名前になります。
@@ -86,7 +86,7 @@
ターゲットは Windows では \c hello.exe 、Unix では \c hello になります。
プロジェクトファイルで別の名前を指定することもできます:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 112
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 112
最後に \l{qmake Variable Reference#CONFIG}{CONFIG} 変数を設定します。
このアプリケーションは Qt アプリケーションなので \c CONFIG に
@@ -96,19 +96,19 @@
最終的なプロジェクトファイルは以下のようになります:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 113
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 113
\c qmake を使って、このアプリケーションのための Makefile を生成します。
プロジェクトのディレクトリでコマンドラインに次のように入力します:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 114
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 114
そして、使用するコンパイラによって \c make または \c nmake を入力します。
Visual Studio ユーザの場合、\c qmake は、以下のように
\c .dsp ファイルまたは \c .vcproj ファイルも作成できます:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 115
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 115
\section1 アプリケーションをデバッグできるようにする
@@ -119,7 +119,7 @@
たとえば:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 116
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 116
直前の例と同様に、Makefile を生成するには \c qmake を使います。
アプリケーションをデバッグ環境で実行する際に役に立つ情報を得られるようになります。
@@ -137,7 +137,7 @@
Windows 用のファイルを追加するシンプルなスコープは以下のようになります:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 117
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 117
\c qmake が Windows 上で実行されると、ソースファイルのリストに
\c hellowin.cpp が追加されます。
@@ -146,7 +146,7 @@
これを終えると、プロジェクトファイルは以下のようになります:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 118
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 118
これまでと同様に、Makefile を生成するには \c qmake を使います。
@@ -159,13 +159,13 @@
使い方はスコープの条件をこれらの関数で置き換えるだけです。
\c main.cpp ファイルの確認は以下のようになります :
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 119
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 119
記号 \c{!} はテストを否定します。
つまり \c{exists( main.cpp )} はファイルが存在する場合に真になり、
\c{!exists( main.cpp )} はファイルが存在しない場合に真になります。
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 120
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 120
前と同様に、\c qmake を実行して Makefile を生成します。
仮に \c main.cpp の名前を変更すると、上記のメッセージが表示され、
@@ -185,12 +185,12 @@
まず 1 つのスコープを作成し、その中にもう 1 つスコープを作成します。
そして 2 つのスコープの中に設定を書きます。例えば:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 121
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 121
ネストされたスコープはコロンを使ってつなぐことができます。
最終的なプロジェクトファイルは以下のようになります:
- \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 122
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 122
以上です。\c qmake のチュートリアルが終了しました。
それでは、あなたの開発プロジェクトのプロジェクトファイルを作成してみましょう。
diff --git a/doc/src/ja_JP/development/qtestlib.qdoc b/doc/src/ja_JP/development/qtestlib.qdoc
index c1001dc..3ff1f36 100644
--- a/doc/src/ja_JP/development/qtestlib.qdoc
+++ b/doc/src/ja_JP/development/qtestlib.qdoc
@@ -71,7 +71,7 @@
次に、テスト関数を実装します。実装は以下のようになります:
- \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 8
\l QVERIFY() マクロは、引数として渡される式を評価します。
式が真と評価されるとテスト関数の実行が継続されます。
@@ -131,7 +131,7 @@
これまでは、テストデータをテスト関数にハードコードしていました。
この場合、テストデータを追加した関数は以下のようになります:
- \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 11
関数が繰り返しを行うコードによって分散するのを防ぐために、
QTestLib はテストデータのテスト関数への追加をサポートします。
diff --git a/doc/src/ja_JP/examples/arrowpad.qdoc b/doc/src/ja_JP/examples/arrowpad.qdoc
index 9085654..56f14a1 100644
--- a/doc/src/ja_JP/examples/arrowpad.qdoc
+++ b/doc/src/ja_JP/examples/arrowpad.qdoc
@@ -71,7 +71,7 @@
\c Q_OBJECT のマクロは、以下の内容で
\c ArrowPad に \c tr(x) を定義します:
- \snippet doc/src/snippets/code/doc_src_examples_arrowpad.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_arrowpad.cpp 0
各ソーステキストが表示されるクラスを把握しておくと、
\e {Qt Linguist} で論理的に関連のある文字列をグループ化することが出来ます。
diff --git a/doc/src/ja_JP/examples/trollprint.qdoc b/doc/src/ja_JP/examples/trollprint.qdoc
index dfe7eaa..ddc6880 100644
--- a/doc/src/ja_JP/examples/trollprint.qdoc
+++ b/doc/src/ja_JP/examples/trollprint.qdoc
@@ -136,12 +136,12 @@
変更すべき行は4行あります。
ラジオボタンの最初のペアの \c tr() 呼び出しに、2つ目の引数 "two-sided"(両面) をに追加します:
- \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 0
そして、ラジオボタンの2番目のペアの \c tr() 呼び出しに、
2つ目の引数 "colors"(色) を追加します。
- \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 1
ここで、\c lupdate を実行し、\e {Qt Linguist} で
\c trollprint_pt.ts を開きます。2 つの変更個所がわかるはずです。
@@ -184,7 +184,7 @@
これは、ソースコードで \c TRANSLATOR
コメントを使用して行います:
- \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 2
一部のソースファイル、特にダイアログクラスのコメントに
ダイアログに到達するまでに必要な操作を記述します。
@@ -201,7 +201,7 @@
コメントは役立つナビゲーション情報を提供するため、
翻訳に要する時間を節約できます:
- \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 3
\section1 Troll Print 1.1
diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc
index 38a7a8b..30b0f16 100644
--- a/doc/src/modules.qdoc
+++ b/doc/src/modules.qdoc
@@ -70,7 +70,7 @@
modules are included by default. To link only against QtCore, add
the following line to your \c .pro file:
- \snippet doc/src/snippets/code/doc_src_modules.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_modules.pro 0
On Windows, if you do not use \l qmake
or other build tools such as CMake, you also need to link against
@@ -91,7 +91,7 @@
All other Qt modules rely on this module. To include the
definitions of the module's classes, use the following directive:
- \snippet doc/src/snippets/code/doc_src_qtcore.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtcore.cpp 0
*/
@@ -105,7 +105,7 @@
To include the definitions of both modules' classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qtgui.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtgui.pro 0
*/
/*!
@@ -118,12 +118,12 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qtmultimedia.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtmultimedia.cpp 1
To link against the module, add this line to your \l qmake \c
.pro file:
- \snippet doc/src/snippets/code/doc_src_qtmultimedia.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtmultimedia.pro 0
The functionality provided by the \l{Phonon Module} is on a higher level
and in many cases more suitable for application developers.
@@ -140,12 +140,12 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qtnetwork.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtnetwork.cpp 1
To link against the module, add this line to your \l qmake \c
.pro file:
- \snippet doc/src/snippets/code/doc_src_qtnetwork.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtnetwork.pro 0
*/
/*!
@@ -175,12 +175,12 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qtopengl.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtopengl.cpp 0
To link against the module, add this line to your \l qmake \c
.pro file:
- \snippet doc/src/snippets/code/doc_src_qtopengl.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtopengl.pro 1
The Qt OpenGL module is implemented as a platform-independent Qt/C++
wrapper around the platform-dependent GLX (version 1.3 or later),
@@ -266,11 +266,11 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 0
To link against the module, add this line to your \l qmake \c .pro file:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtscript.pro 1
For detailed information on how to make your application
scriptable with QtScript, see \l{Making Applications
@@ -323,11 +323,11 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc.src.qtscripttools.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtscripttools.cpp 0
To link against the module, add this line to your \l qmake \c .pro file:
- \snippet doc/src/snippets/code/doc.src.qtscripttools.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtscripttools.pro 1
*/
/*!
@@ -338,12 +338,12 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qtsql.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtsql.cpp 0
To link against the module, add this line to your \l qmake \c
.pro file:
- \snippet doc/src/snippets/code/doc_src_qtsql.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtsql.pro 1
See the \l{SQL Programming} guide for information about using this
module in your applications.
@@ -362,12 +362,12 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtsvg.cpp 0
To link against the module, add this line to your \l qmake \c
.pro file:
- \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtsvg.pro 1
\section1 License Information
@@ -412,12 +412,12 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qtxml.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtxml.cpp 0
To link against the module, add this line to your \l qmake \c
.pro file:
- \snippet doc/src/snippets/code/doc_src_qtxml.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtxml.pro 1
Further XML support is provided by the \l{Qt Solutions} group who
provide, for example, classes that support SOAP and MML with the
@@ -437,12 +437,12 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtxmlpatterns.cpp 0
To link against the module, add this line to your \l qmake \c
.pro file:
- \snippet doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtxmlpatterns.pro 1
\section1 Further Reading
@@ -523,7 +523,7 @@
The following declaration in a \c qmake project file ensures that
an application is compiled and linked appropriately:
- \snippet doc/src/snippets/code/doc_src_phonon.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_phonon.pro 0
\section1 Qt Backends
@@ -586,12 +586,12 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qt3support.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qt3support.cpp 0
To link against the module, add this line to your \l qmake \c
.pro file:
- \snippet doc/src/snippets/code/doc_src_qt3support.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qt3support.pro 1
\note Since this module provides compatibility classes for
diverse parts of the Qt 3 API, it has dependencies on the QtCore,
@@ -615,12 +615,12 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 0
To link against the module, add this line to your \c qmake .pro
file:
- \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtdesigner.pro 1
*/
/*!
@@ -640,7 +640,7 @@
in a \c qmake project file to ensure that the application is compiled
and linked appropriately.
- \snippet doc/src/snippets/code/doc_src_qtuiloader.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtuiloader.pro 0
A form loader object, provided by the QUiLoader class, is used to
construct the user interface. This user interface can
@@ -652,7 +652,7 @@
To include the definitions of the module's classes, use the following
directive:
- \snippet doc/src/snippets/code/doc_src_qtuiloader.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtuiloader.cpp 1
\sa{Calculator Builder Example}, {World Time Clock Builder Example}
*/
@@ -672,7 +672,7 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qthelp.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qthelp.cpp 0
To link against the module, add this line to your \l qmake \c
.pro file:
@@ -731,12 +731,12 @@
To include the definitions of the module's classes, use the
following directive:
- \snippet doc/src/snippets/code/doc_src_qttest.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qttest.cpp 0
To link against the module, add this line to your \l qmake \c
.pro file:
- \snippet doc/src/snippets/code/doc_src_qttest.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qttest.pro 1
See the \l{QTestLib Manual} for a detailed introduction on how to use
Qt's unit testing features with your applications.
@@ -865,13 +865,13 @@
To use this module, use the following code in your application:
- \snippet doc/src/snippets/code/doc_src_qtdbus.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtdbus.cpp 0
If you're using qmake to build your application, you can add this
line to your .pro file to make it link against the QtDBus
libraries:
- \snippet doc/src/snippets/code/doc_src_qtdbus.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtdbus.pro 1
\note The source code for this module is located in the \c{src/qdbus}
directory. When installing Qt from source, this module is built when Qt's
diff --git a/doc/src/objectmodel/objecttrees.qdoc b/doc/src/objectmodel/objecttrees.qdoc
index ba677b9..cb63c17 100644
--- a/doc/src/objectmodel/objecttrees.qdoc
+++ b/doc/src/objectmodel/objecttrees.qdoc
@@ -77,7 +77,7 @@
behavior applies. Normally, the order of destruction still doesn't
present a problem. Consider the following snippet:
- \snippet doc/src/snippets/code/doc_src_objecttrees.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_objecttrees.cpp 0
The parent, \c window, and the child, \c quit, are both \l {QObject}
{QObjects} because QPushButton inherits QWidget, and QWidget inherits
@@ -91,7 +91,7 @@
But now consider what happens if we swap the order of construction, as
shown in this second snippet:
- \snippet doc/src/snippets/code/doc_src_objecttrees.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_objecttrees.cpp 1
In this case, the order of destruction causes a problem. The parent's
destructor is called first because it was created last. It then calls
diff --git a/doc/src/objectmodel/properties.qdoc b/doc/src/objectmodel/properties.qdoc
index 7d1ecec..77421c5 100644
--- a/doc/src/objectmodel/properties.qdoc
+++ b/doc/src/objectmodel/properties.qdoc
@@ -46,12 +46,12 @@
To declare a property, use the \l {Q_PROPERTY()} {Q_PROPERTY()}
macro in a class that inherits QObject.
- \snippet doc/src/snippets/code/doc_src_properties.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_properties.cpp 0
Here are some typical examples of property declarations taken from
class QWidget.
- \snippet doc/src/snippets/code/doc_src_properties.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_properties.cpp 1
A property behaves like a class data member, but it has additional
features accessible through the \l {Meta-Object System}.
@@ -131,7 +131,7 @@
be a user-defined type. In this example, class QDate is considered
to be a user-defined type.
- \snippet doc/src/snippets/code/doc_src_properties.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_properties.cpp 2
Because QDate is user-defined, you must include the \c{<QDate>}
header file with the property declaration.
@@ -152,7 +152,7 @@
the code snippet below, the call to QAbstractButton::setDown() and
the call to QObject::setProperty() both set property "down".
- \snippet doc/src/snippets/code/doc_src_properties.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_properties.cpp 3
Accessing a property through its \c WRITE accessor is the better
of the two, because it is faster and gives better diagnostics at
@@ -162,7 +162,7 @@
can \e discover a class's properties at run time by querying its
QObject, QMetaObject, and \l {QMetaProperty} {QMetaProperties}.
- \snippet doc/src/snippets/code/doc_src_properties.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_properties.cpp 4
In the above snippet, QMetaObject::property() is used to get \l
{QMetaProperty} {metadata} about each property defined in some
@@ -189,7 +189,7 @@
for the \c READ and \c WRITE functions. The declaration of MyClass
then might look like this:
- \snippet doc/src/snippets/code/doc_src_properties.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_properties.cpp 5
The \c READ function is const and returns the property type. The
\c WRITE function returns void and has exactly one parameter of
@@ -200,7 +200,7 @@
QObject that is an instance of MyClass, we have two ways to set
its priority property:
- \snippet doc/src/snippets/code/doc_src_properties.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_properties.cpp 6
In the example, the enumeration type that is the property type is
declared in MyClass and registered with the \l{Meta-Object System}
@@ -262,7 +262,7 @@
Q_CLASSINFO(), that can be used to attach additional
\e{name}--\e{value} pairs to a class's meta-object, for example:
- \snippet doc/src/snippets/code/doc_src_properties.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_properties.cpp 7
Like other meta-data, class information is accessible at run-time
through the meta-object; see QMetaObject::classInfo() for details.
diff --git a/doc/src/objectmodel/signalsandslots.qdoc b/doc/src/objectmodel/signalsandslots.qdoc
index 4c018b5..8b52df5 100644
--- a/doc/src/objectmodel/signalsandslots.qdoc
+++ b/doc/src/objectmodel/signalsandslots.qdoc
@@ -440,7 +440,7 @@
You can even use both mechanisms in the same project. Just add the
following line to your qmake project (.pro) file.
- \snippet doc/src/snippets/code/doc_src_containers.qdoc 22
+ \snippet doc/src/snippets/code/doc_src_containers.cpp 22
It tells Qt not to define the moc keywords \c{signals}, \c{slots},
and \c{emit}, because these names will be used by a 3rd party
diff --git a/doc/src/painting-and-printing/coordsys.qdoc b/doc/src/painting-and-printing/coordsys.qdoc
index 252159e..d0906d8 100644
--- a/doc/src/painting-and-printing/coordsys.qdoc
+++ b/doc/src/painting-and-printing/coordsys.qdoc
@@ -97,10 +97,10 @@
\row
\o
- \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_coordsys.cpp 0
\o
- \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_coordsys.cpp 1
\endtable
When rendering with a pen with an even number of pixels, the
@@ -163,10 +163,10 @@
\row
\o
- \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_coordsys.cpp 2
\o
- \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_coordsys.cpp 3
\endtable
\section1 Transformations
@@ -319,7 +319,7 @@
-50) to (50, 50) with (0, 0) in the center by calling the
QPainter::setWindow() function:
- \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_coordsys.cpp 4
Now, the logical coordinates (-50,-50) correspond to the paint
device's physical coordinates (0, 0). Independent of the paint
@@ -333,7 +333,7 @@
viewport and "window" maintain the same aspect ratio to prevent
deformation:
- \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_coordsys.cpp 5
If we make the logical coordinate system a square, we should also
make the viewport a square using the QPainter::setViewport()
diff --git a/doc/src/platforms/emb-performance.qdoc b/doc/src/platforms/emb-performance.qdoc
index 1ae35bc..6c96921 100644
--- a/doc/src/platforms/emb-performance.qdoc
+++ b/doc/src/platforms/emb-performance.qdoc
@@ -103,7 +103,7 @@
operators. Improved memory allocation and performance may be
gained by re-implementing these functions:
- \snippet doc/src/snippets/code/doc_src_emb-performance.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_emb-performance.cpp 1
The example above shows the necessary code to switch to the plain
C memory allocators.
diff --git a/doc/src/platforms/emb-pointer.qdoc b/doc/src/platforms/emb-pointer.qdoc
index b580077..941cba2 100644
--- a/doc/src/platforms/emb-pointer.qdoc
+++ b/doc/src/platforms/emb-pointer.qdoc
@@ -144,7 +144,7 @@
its headers using -L and -I options in the \c qmake.conf file in
your \c mkspec. Also it can be helpful to add a -rpath-link:
- \snippet doc/src/snippets/code/doc_src_emb-pointer.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_emb-pointer.pro 7
In order to use this mouse driver, tslib must also be correctly
installed on the target machine. This includes providing a \c
diff --git a/doc/src/platforms/mac-differences.qdoc b/doc/src/platforms/mac-differences.qdoc
index 251e900..1f71270 100644
--- a/doc/src/platforms/mac-differences.qdoc
+++ b/doc/src/platforms/mac-differences.qdoc
@@ -99,7 +99,7 @@
If you use \c qmake and Makefiles, use the \c QMAKE_LFLAGS_SONAME setting:
- \snippet doc/src/snippets/code/doc_src_mac-differences.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_mac-differences.pro 0
Alternatively, you can modify the install name using the
install_name_tool(1) on the command line. See its manpage for more
@@ -165,7 +165,7 @@
the bundle resides on the disk. The following code returns the
path of the application bundle:
- \snippet doc/src/snippets/code/doc_src_mac-differences.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_mac-differences.cpp 1
Note: When OS X is set to use Japanese, a bug causes this sequence
to fail and return an empty string. Therefore, always test the
diff --git a/doc/src/platforms/wince-customization.qdoc b/doc/src/platforms/wince-customization.qdoc
index a59dd6f..49ba852 100644
--- a/doc/src/platforms/wince-customization.qdoc
+++ b/doc/src/platforms/wince-customization.qdoc
@@ -146,7 +146,7 @@
application that attempts to dynamically load the Qt for Windows CE
libraries using \c LoadLibrary. The following code can be used for this:
- \snippet doc/src/snippets/code/doc_src_wince-customization.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_wince-customization.cpp 9
Once you have compiled and deployed the application as well as the Qt
libraries, start a remote debugger. The debugger will then print the
diff --git a/doc/src/porting/porting-qsa.qdoc b/doc/src/porting/porting-qsa.qdoc
index ea83e97..e831583 100644
--- a/doc/src/porting/porting-qsa.qdoc
+++ b/doc/src/porting/porting-qsa.qdoc
@@ -64,7 +64,7 @@
can have named properties. For instance to create an point object with
the properties x and y one would write the following Qt Script code:
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.js 0
The object \c point in this case is constructed as a plain object and
we assign two properties, \c x and \c y, to it with the values 12 and
@@ -73,17 +73,17 @@
global namespace of the script engine. Similarly, global functions are
named properties of the global object; for example:
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.js 1
An equivalent construction that illustrates that the function is a
property of the global object is the following assignment:
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.js 2
Since functions are objects, they can be assigned to objects as
properties, becoming member functions:
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.js 3
In the code above, we see the first subtle difference between
QSA and Qt Script. In QSA one would write the point class like this:
@@ -99,7 +99,7 @@
All the code above runs with QSA except the assignment of a function
to \c{point.manhattanLength}, which we repeat here for clarity:
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.js 5
This is because, in QSA, the value of \c this is decided based on
the location of the declaration of the function it is used in. In the
@@ -129,7 +129,7 @@
function with the newly created object as the \c this pointer.
So, in a sense, it is equivalent to:
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.js 8
This is similar to the manhattenLength() example above. Again, the
main difference between QSA and Qt Script is that one has to
@@ -149,7 +149,7 @@
one could write this in Qt Script as:
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.js 10
In QSA, the member functions were part of the class declaration,
and were therefore shared between all instances of a given class.
@@ -173,7 +173,7 @@
To make the \c toString() function part of the prototype, we write
code like this:
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.js 11
Here, we made the \c toString() function part of the prototype so
that, when we call \c{car.toString()} it will be resolved via the
@@ -195,7 +195,7 @@
without any special members, but it is possible to replace this
object with another prototype object.
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.js 13
In the code above, we have a constructor, \c{GasolineCar}, which
calls the "base class" implementation of the constructor to
@@ -223,7 +223,7 @@
as static members as properties of the constructor function. For
example:
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.js 15
Note that in QSA, static member variables were also accessible in
instances of the given class. In Qt Script, with the approach
@@ -374,7 +374,7 @@
the interpreter using their object names as the names of the
variables.
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.cpp 16
The code above adds the button to the global namespace under the name
"button". One obvious limitation here is that there is potential for
@@ -382,7 +382,7 @@
provides a more flexible way of adding QObjects to the scripting
environment.
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 17
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.cpp 17
In the code above we create a QPushButton and wrap it in a script
value using the function, QScriptEngine::newQObject(). This gives us
@@ -404,14 +404,14 @@
Below is listed some code from the filter example in the QSA
package.
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 18
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.cpp 18
The equivalent in Qt Script is written in much the same way as
constructors are written in scripts. We register a callback C++
function under the name "ImageSource" in the global namespace and
return the QObject from this function:
- \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 19
+ \snippet doc/src/snippets/code/doc_src_porting-qsa.cpp 19
In the Qt Script case we use the same approach that we use to expose
a QObject, namely via QScriptEngine::newQObject(). This function also
diff --git a/doc/src/porting/porting4-canvas.qdoc b/doc/src/porting/porting4-canvas.qdoc
index 445f66d..1e20384 100644
--- a/doc/src/porting/porting4-canvas.qdoc
+++ b/doc/src/porting/porting4-canvas.qdoc
@@ -152,7 +152,7 @@
\row \o Q3Canvas::onCanvas() \o The is no equivalent to this
function in Graphics View. However, you can combine
QGraphicsScene::sceneRect() and QRectF::intersects():
- \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 0
\row \o Q3Canvas::rect() \o The equivalent,
QGraphicsScene::sceneRect(), returns a QRectF (double
@@ -251,7 +251,7 @@
out the public tile API can then be declared as new members of
this class. Here is one example of how to implement tile support:
- \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 1
Depending on how your scene uses tiles, you may be able to
simplify this approach. In this example, we will try to mimic the behavior
@@ -264,30 +264,30 @@
two-dimensional vector of ints to keep track of what tiles should
be used at what parts of the scene.
- \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 2
In setTiles(), we store the pixmap and tile properties as
members of the class. Then we resize the tiles vector
to match the width and height of our tile grid.
- \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 3
The setTile() function updates the tiles index, and then
updates the corresponding rect in the scene by calling
tileRect().
- \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 4
The first tileRect() function returns a QRect for the tile at
position (x, y).
- \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 5
The second tileRect() function returns a QRect for a tile number.
With these functions in place, we can implement the drawBackground()
function.
- \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 6
In drawBackground(), we redraw all tiles that have been
exposed by intersecting each tile rect with the exposed background
@@ -522,7 +522,7 @@
For compatibility, you may want to shift the ellipse up and to the
left to keep the ellipse centered. Example:
- \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 7
Note: QGraphicsEllipseItem uses QAbstractGraphicsShapeItem::pen()
for outlines, whereas Q3CanvasEllipse did not use
@@ -588,7 +588,7 @@
QPainterPath::moveTo() and QPainterPath::cubicTo(). Here is how
you can convert a bezier curve Q3PointArray to a QPainterPath:
- \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 8
Note: QGraphicsPathItem uses QAbstractGraphicsShapeItem::pen() for
outlines, whereas Q3CanvasSpline did not use
@@ -653,7 +653,7 @@
functionality using Graphics View, you can load the images by
using QDir:
- \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 9
\section2 Q3CanvasText
diff --git a/doc/src/porting/porting4-designer.qdoc b/doc/src/porting/porting4-designer.qdoc
index d84af3f..ef3e746 100644
--- a/doc/src/porting/porting4-designer.qdoc
+++ b/doc/src/porting/porting4-designer.qdoc
@@ -104,7 +104,7 @@
For example, here's the \c uic output for a simple \c
helloworld.ui form (some details were removed for simplicity):
- \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 0
In this case, the main container was specified to be a QWidget
(or any subclass of QWidget). Had we started with a QMainWindow
@@ -116,7 +116,7 @@
an instance of the main container (a plain QWidget), and call \c
setupUi():
- \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 1
The second approach is to inherit from both the \c Ui::HelloWorld
class and the main container, and to call \c setupUi() in the
@@ -124,7 +124,7 @@
its subclasses, e.g. QDialog) must appear first in the base class
list so that \l{moc} picks it up correctly. For example:
- \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 2
This second method is useful when porting Qt 3 forms to Qt 4. \c
HelloWorldWidget is a class whose instance is the actual form
@@ -212,7 +212,7 @@
them to the widgets in the form after calling \c setupUi(). For
example:
- \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 5
A quick and dirty way to port forms containing custom signals and
slots is to generate the code using \c uic3, rather than \c uic. Since
@@ -233,7 +233,7 @@
\tt{\e{signalName}}, then this signal will be connected to the
main container's slot. For example:
- \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 6
Because of the naming convention, \c setupUi() automatically
connects \c pushButton's \c clicked() signal to \c
@@ -257,14 +257,14 @@
Next, we add the resource file to our \c .pro file:
- \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_porting4-designer.pro 8
When \c qmake is run, it will create the appropriate Makefile
rules to call \c rcc on the resource file, and compile and link
the result into the application. The icons may be accessed as
follows:
- \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 9
In each case, the leading colon tells Qt to look for the file in
the virtual file tree defined by the set of resource files
diff --git a/doc/src/porting/porting4-dnd.qdoc b/doc/src/porting/porting4-dnd.qdoc
index 92b9fc1..993b8d2 100644
--- a/doc/src/porting/porting4-dnd.qdoc
+++ b/doc/src/porting/porting4-dnd.qdoc
@@ -54,7 +54,7 @@
\l{Q3DragObject::}{drag()} function is called, and it receives no information
about how the operation ended.
- \snippet doc/src/snippets/code/doc_src_dnd.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_dnd.cpp 0
Similarly, in Qt 4, drag operations are also initiated when a QDrag object
is constructed and its \l{QDrag::}{exec()} function is called. In contrast,
@@ -94,7 +94,7 @@
indicating success or failure of these checks via the event's
\l{QDragEnterEvent::}{accept()} function, as shown in this simple example:
- \snippet doc/src/snippets/code/doc_src_dnd.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_dnd.cpp 1
In Qt 4, you can examine the MIME type describing the data to determine
whether the widget should accept the event or, for common data types, you
@@ -113,7 +113,7 @@
accept dropped data in the form of text or images might provide an
implementation of \l{QWidget::}{dropEvent()} that looks like the following:
- \snippet doc/src/snippets/code/doc_src_dnd.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_dnd.cpp 2
In Qt 4, the event is handled in a similar way:
diff --git a/doc/src/porting/porting4.qdoc b/doc/src/porting/porting4.qdoc
index 862d22b..ec2886b6 100644
--- a/doc/src/porting/porting4.qdoc
+++ b/doc/src/porting/porting4.qdoc
@@ -760,7 +760,7 @@
function. The solution is to reimplement QWidget::paintEvent() in
your QAbstractButton subclass as follows:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 0
\table
\header \o Q3Button function \o QAbstractButton equivalent
@@ -860,11 +860,11 @@
\o QMemArray::at() returned a non-const reference, whereas the
new QByteArray::at() returns a const value. Code like
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 1
will no longer compile. Instead, use QByteArray::operator[]:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 2
\o The QMemArray::contains(char) function has been renamed
QByteArray::count(char). In addition, there now exists a
@@ -935,11 +935,11 @@
function returns \c void and either adds it to the cache or
deletes it right away. Old code like
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 3
becomes
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 4
\o The new QCache class \e always takes ownership of the items
it stores (i.e. auto-delete is always on). If you use Q3Cache
@@ -950,11 +950,11 @@
pointers, not the objects that the pointers refer to. For
example,
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 5
becomes
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 6
An alternative is to stick to using Q3Cache.
\endlist
@@ -1051,7 +1051,7 @@
you can simply replace colorGroup() with palette():
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 7
\section1 QColorDrag
@@ -1089,7 +1089,7 @@
'\\0' issue is handled by having QByteArray allocate one extra
byte that it always sets to '\\0'. For example:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 8
The Qt3Support library contains a class called
Q3CString that inherits from the new QByteArray class and that
@@ -1416,26 +1416,26 @@
\header \o Q3Dict idiom \o QMultiHash idiom
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 9
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 10
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 11
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 12
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 13
(also called from Q3Dict's destructor)
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 14
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 14
In 99% of cases, the following idiom also works:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 15
However, it may lead to crashes if \c hash is referenced from
the value type's destructor, because \c hash contains
@@ -1471,11 +1471,11 @@
Be aware that QHashIterator has a different way of iterating than
Q3DictIterator. A typical loop with Q3DictIterator looks like this:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 16
Here's the equivalent QHashIterator loop:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 17
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 17
See \l{Java-style iterators} for details.
@@ -2377,7 +2377,7 @@
Use QObject::findChildren() (or qFindChildren() if you need MSVC 6
compatibility) instead of QObject::queryList(). For example:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 18
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 18
QObject::killTimers() has been removed because it was unsafe to
use in subclass. (A subclass normally doesn't know whether the
@@ -2712,48 +2712,48 @@
\header \o QPtrList idiom \o QList idiom
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 19
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 19
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 20
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 20
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 21
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 21
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 22
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 22
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 23
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 23
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 24
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 24
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 25
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 25
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 26
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 26
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 27
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 27
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 28
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 28
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 29
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 29
(removes the current item)
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 30
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 30
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 31
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 31
(also called from QPtrList's destructor)
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 32
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 32
In 99% of cases, the following idiom also works:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 33
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 33
However, it may lead to crashes if \c list is referenced from
the value type's destructor, because \c list contains
@@ -2790,11 +2790,11 @@
Be aware that QListIterator has a different way of iterating than
QPtrList. A typical loop with QPtrList looks like this:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 34
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 34
Here's the equivalent QListIterator loop:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 35
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 35
Finally, QPtrListIterator<T> must also be ported. There are no
fewer than four iterator classes that can be used as a
@@ -2821,11 +2821,11 @@
iterating than QPtrList. A typical loop with QPtrList looks like
this:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 36
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 36
Here's the equivalent QListIterator loop:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 37
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 37
Finally, QPtrListStdIterator<T> must also be ported. This is
easy, because QList also provides STL-style iterators
@@ -2864,26 +2864,26 @@
\header \o QPtrQueue idiom \o QQueue idiom
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 38
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 38
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 39
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 39
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 40
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 40
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 41
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 41
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 42
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 42
(also called from QPtrQueue's destructor)
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 43
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 43
In 99% of cases, the following idiom also works:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 44
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 44
However, it may lead to crashes if \c queue is referenced
from the value type's destructor, because \c queue contains
@@ -2923,26 +2923,26 @@
\header \o QPtrStack idiom \o QStack idiom
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 45
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 45
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 46
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 46
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 47
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 47
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 48
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 48
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 49
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 49
(also called from QPtrStack's destructor)
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 50
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 50
In 99% of cases, the following idiom also works:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 51
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 51
However, it may lead to crashes if \c stack is referenced
from the value type's destructor, because \c stack contains
@@ -3024,36 +3024,36 @@
\header \o QPtrVector idiom \o QVector idiom
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 52
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 52
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 53
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 53
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 54
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 54
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 55
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 55
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 56
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 56
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 57
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 57
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 58
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 58
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 59
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 59
\row
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 60
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 60
(also called from QPtrVector's destructor)
\o
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 61
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 61
In 99% of cases, the following idiom also works:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 62
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 62
However, it may lead to crashes if \c vect is referenced from
the value type's destructor, because \c vect contains
@@ -3193,7 +3193,7 @@
An easy way of porting to Qt 4 is to include this class into your
project and to use it instead of \c QShared:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 63
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 63
If possible, we recommend that you use QSharedData and
QSharedDataPointer instead. They provide thread-safe reference
@@ -3217,11 +3217,11 @@
Previously, you would do the following with Q3SimpleRichText:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 63a
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 63a
However, with QTextDocument, you use the following code instead:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 63b
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 63b
See \l{Rich Text Processing} for an overview of the Qt 4 rich
text classes.
@@ -3233,7 +3233,7 @@
The slider's rect can now be retrieved using the code snippet below:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 63c
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 63c
In addition, the direction of a vertical QSlider has changed,
i.e. the bottom is now the minimum, and the top the maximum. You
@@ -3454,7 +3454,7 @@
byte array; you should avoid taking a pointer to the data
contained in temporary objects.
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 64
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 64
In the above example, the \c goodData pointer is valid for the lifetime
of the \c asciiData byte array. If you need to keep a copy of the data
@@ -3464,11 +3464,11 @@
\o QString::at() returned a non-const reference, whereas the
new QString::at() returns a const value. Code like
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 65
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 65
will no longer compile. Instead, use QString::operator[]:
- \snippet doc/src/snippets/code/doc_src_porting4.qdoc 66
+ \snippet doc/src/snippets/code/doc_src_porting4.cpp 66
\o The QString::contains(\e x) function (where \e x is a
character or a string) has been renamed QString::count(\e x).
diff --git a/doc/src/porting/qt3to4.qdoc b/doc/src/porting/qt3to4.qdoc
index 336601f..3c95b4c 100644
--- a/doc/src/porting/qt3to4.qdoc
+++ b/doc/src/porting/qt3to4.qdoc
@@ -122,7 +122,7 @@
In some cases, you might get compiler errors because of identifiers
in the global namespace (e.g., \c CTRL). Adding
- \snippet doc/src/snippets/code/doc_src_qt3to4.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qt3to4.cpp 2
at the beginning of the source file that contains
the indentifier solves the problem.
diff --git a/doc/src/porting/qt4-accessibility.qdoc b/doc/src/porting/qt4-accessibility.qdoc
index 6e56942..2d9e8c3 100644
--- a/doc/src/porting/qt4-accessibility.qdoc
+++ b/doc/src/porting/qt4-accessibility.qdoc
@@ -68,7 +68,7 @@
variable set to 1. For example, this is set in the following way with
the bash shell:
- \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc environment
+ \snippet doc/src/snippets/code/doc_src_qt4-accessibility.cpp environment
Accessibility features are built into Qt by default when the libraries
are configured and built.
@@ -132,17 +132,17 @@
information for a custom widget. We can use QAccessibleWidget as
a base class and reimplement various functions:
- \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qt4-accessibility.cpp 0
Here's how we would implement the
\l{QAccessibleInterface::doAction()}{doAction()} function to call
a function named click() on the wrapped MyWidget object when the
user invokes the object's default action or "presses" it.
- \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qt4-accessibility.cpp 1
To export the widget interface as a plugin, we must subclass
QAccessibleFactory:
- \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qt4-accessibility.cpp 2
*/
diff --git a/doc/src/porting/qt4-arthur.qdoc b/doc/src/porting/qt4-arthur.qdoc
index 434aa29..460a048 100644
--- a/doc/src/porting/qt4-arthur.qdoc
+++ b/doc/src/porting/qt4-arthur.qdoc
@@ -119,7 +119,7 @@
Setting a linear gradient brush is done by creating a QLinearGradient
object and setting it as a brush.
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 0
The code shown above produces a pattern as show in the following
pixmap:
@@ -130,7 +130,7 @@
focal point. Setting a radial brush is done by creating a QRadialGradient
object and setting it as a brush.
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 1
The code shown above produces a pattern as shown in the following
pixmap:
@@ -141,7 +141,7 @@
angle. Setting a conical brush is done by creating a
QConicalGradient object and setting it as a brush.
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 2
The code shown above produces a pattern as shown in the following
pixmap:
@@ -156,7 +156,7 @@
transparent color, while 255 represents a fully opaque color. For
example:
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 3
The code shown above produces the following output:
@@ -180,7 +180,7 @@
provide the option of turning on anti-aliased edges when drawing
graphics primitives.
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 4
This produces the following output:
@@ -221,7 +221,7 @@
first add a rectangle, which becomes a closed subpath. We then add
two bezier curves, and finally draw the entire path.
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 5
The code above produces the following output:
@@ -236,18 +236,18 @@
painting to an off-screen pixmap then copying the pixmap to the
screen. For example:
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 6
Since the double-buffering is handled by QWidget internally this
now becomes:
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 7
Double-buffering is turned on by default, but can be turned off for
individual widgets by setting the widget attribute
Qt::WA_PaintOnScreen.
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 8
\section2 Pen and Brush Transformation
@@ -270,7 +270,7 @@
possible to specify both texture and gradient fills for both
text and outlines.
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 9
The code above produces the following output:
@@ -290,7 +290,7 @@
Painting on an image is as simple as drawing on any other paint device.
- \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 10
\section2 SVG Rendering Support
diff --git a/doc/src/porting/qt4-mainwindow.qdoc b/doc/src/porting/qt4-mainwindow.qdoc
index 1eff2c2..ebfbc8d 100644
--- a/doc/src/porting/qt4-mainwindow.qdoc
+++ b/doc/src/porting/qt4-mainwindow.qdoc
@@ -86,7 +86,7 @@
the first time it is called. You can also call
QMainWindow::setMenuBar() to use a custom menu bar in the main window.
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 0
\dots
\snippet examples/mainwindows/menus/mainwindow.cpp 5
\dots
@@ -110,7 +110,7 @@
\snippet examples/mainwindows/sdi/mainwindow.cpp 0
\dots
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 1
In this example, the toolbar is restricted to the top and bottom
toolbar areas of the main window, and is initially placed in the
@@ -132,7 +132,7 @@
required, the default can be changed with the
QMainWindow::setCorner() function:
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 2
The following diagram shows the configuration produced by the above code.
Note that the left and right dock widgets will occupy the top and bottom
@@ -143,7 +143,7 @@
Once all of the main window components have been set up, the central widget
is created and installed by using code similar to the following:
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 3
The central widget can be any subclass of QWidget.
@@ -217,17 +217,17 @@
constructed using the general QMenu class.
Qt 3:
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 4
Qt 4:
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 5
Toolbars follow the same pattern as menus, with the new, more
consistent behavior:
Qt 3:
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 6
Qt 4:
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 7
The behavior of dock widgets is now configured through the member
functions of QDockWidget. For example, compare the old and new ways
@@ -235,7 +235,7 @@
main window.
In Qt 3:
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 8
In Qt 4:
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 9
*/
diff --git a/doc/src/porting/qt4-sql.qdoc b/doc/src/porting/qt4-sql.qdoc
index bafaacb..2a5a206 100644
--- a/doc/src/porting/qt4-sql.qdoc
+++ b/doc/src/porting/qt4-sql.qdoc
@@ -104,12 +104,12 @@
The simplest way to present data from a database is to simply
combine a QSqlQueryModel with a QTableView:
- \snippet doc/src/snippets/code/doc_src_qt4-sql.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qt4-sql.cpp 0
To present the contents of a single table, we can use
QSqlTableModel instead:
- \snippet doc/src/snippets/code/doc_src_qt4-sql.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qt4-sql.cpp 1
In practice, it's common that we need to customize the rendering
of a field in the database. In that case, we can create our own
diff --git a/doc/src/porting/qt4-styles.qdoc b/doc/src/porting/qt4-styles.qdoc
index 76b0b1c..7422f06 100644
--- a/doc/src/porting/qt4-styles.qdoc
+++ b/doc/src/porting/qt4-styles.qdoc
@@ -90,7 +90,7 @@
pointer type is correct. If the object isn't of the right type,
qstyleoption_cast() returns 0. For example:
- \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 0
For performance reasons, there are few member functions and the
access to the variables is direct. This "low-level" feel makes
@@ -108,7 +108,7 @@
The following code snippet illustrates how to use QStyle to
draw the focus rectangle from a custom widget's paintEvent():
- \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 1
The next example shows how to derive from an existing style to
customize the look of a graphical element:
@@ -130,11 +130,11 @@
For example, here's the signature of the QStyle::drawControl()
function in Qt 3:
- \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 2
Here's the signature of the same function in Qt 4:
- \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 3
In Qt 3, some of the information required to draw a graphical
element was stored in a QStyleOption parameter, while the rest
diff --git a/doc/src/porting/qt4-tulip.qdoc b/doc/src/porting/qt4-tulip.qdoc
index 161c373..c78ff96 100644
--- a/doc/src/porting/qt4-tulip.qdoc
+++ b/doc/src/porting/qt4-tulip.qdoc
@@ -80,16 +80,16 @@
addition to the C++ language that is implemented using the standard
C++ preprocessor. The syntax is:
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 0
Example:
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 1
The iterator variable can also be defined outside the loop. For
example:
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 2
Just like standard \c for loops, foreach supports braces, \c
break, \c continue, and nested loops. Qt makes a copy of the
@@ -124,25 +124,25 @@
Traversing a container using a Java-style iterator:
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 3
Modifying items using a Java-style iterator:
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 4
Removing items using a Java-style iterator:
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 5
Iterating over items with a particular value using STL-style vs.
Java-style iterators:
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 6
Modifying and removing items using STL-style vs. Java-style
iterators:
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 7
The next group of examples show the API of the container classes
themselves. The API is similar to the QTL classes of Qt 3, but is nicer
@@ -151,16 +151,16 @@
Iterating over a QList using an index (which is fast even for large
lists, because QList is implemented as an array-list):
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 8
Retrieving a value from a map, using a default value if the key
doesn't exist:
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 9
Getting all the values for a particular key in a QMultiMap or QMultiHash:
- \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 10
\section1 Comparison with Qt 3
diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc
index 3cabb1c..70a5167 100644
--- a/doc/src/qt4-intro.qdoc
+++ b/doc/src/qt4-intro.qdoc
@@ -276,11 +276,11 @@
link your application against QtCore and QtGui. To remove the
dependency upon QtGui, add the line
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 0
to your .pro file. To enable the other libraries, add the line
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 1
Another change to the build system is that moc now understands
preprocessor directives. qmake automatically passes the defines set
@@ -290,21 +290,21 @@
To compile code that uses UI files, you will also need this line in
the .pro file:
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 2
\section1 Include Syntax
The syntax for including Qt class definitions has become
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 3
For example:
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 4
This is guaranteed to work for any public Qt class. The old syntax,
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 5
still works, but we encourage you to switch to the new syntax.
@@ -318,7 +318,7 @@
To include the definitions for all the classes in a library, simply
specify the name of that library. For example:
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 6
\section1 Namespaces
@@ -330,7 +330,7 @@
to access a constant that is part of the Qt namespace, prefix it
with \c{Qt::} (e.g., \c{Qt::yellow}), or add the directive
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 7
at the top of your source files, after your \c #include
directives. If you use the \c{using namespace} syntax you don't
@@ -360,7 +360,7 @@
\list
\o Code that used it looked confusing, for example:
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 8
\c label1 is a QLabel that displays the text "Hello"; \c
label2 is a QLabel with no text, with the object name
@@ -370,7 +370,7 @@
they blindly followed Qt's convention and provided a "const
char *name" in their subclasses's constructors. For example:
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 9
\o The name parameter was in Qt since version 1, and it always
was documented as: "It is not very useful in the current
@@ -405,12 +405,12 @@
Here's the Qt 3 idiom to cast a type to a subtype:
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 10
The Qt 4 idiom is both cleaner and safer, because typos will always
result in compiler errors:
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 11
\section1 QPointer<T>
@@ -421,7 +421,7 @@
Example:
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 12
QPointer<T> is more or less the same as the old QGuardedPtr<T> class,
except that it is now implemented in a much more lightweight manner
@@ -461,7 +461,7 @@
To enable the Qt 3 support classes and functions, add the line
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 13
to your \c .pro file.
@@ -469,18 +469,18 @@
in a compiler warning (e.g., "'find' is deprecated"). If you want to turn
off that warning, add the line
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 14
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 14
to your \c .pro file.
If you want to use compatibility functions but don't want to link
against the Qt3Support library, add the line
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 15
or
- \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 16
to your \c .pro file, depending on whether you want compatibility
function calls to generate compiler warnings or not.
diff --git a/doc/src/scripting/qtscriptextensions.qdoc b/doc/src/scripting/qtscriptextensions.qdoc
index 888cf73..431adb0 100644
--- a/doc/src/scripting/qtscriptextensions.qdoc
+++ b/doc/src/scripting/qtscriptextensions.qdoc
@@ -68,7 +68,7 @@
An example of a simple \c{__init__.js}:
- \snippet doc/src/snippets/code/doc_src_qtscriptextensions.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtscriptextensions.js 0
QScriptEngine will look for a QScriptExtensionPlugin that provides
the relevant extension by querying each plugin for its keys()
diff --git a/doc/src/scripting/scripting.qdoc b/doc/src/scripting/scripting.qdoc
index 79fed97..112af5c 100644
--- a/doc/src/scripting/scripting.qdoc
+++ b/doc/src/scripting/scripting.qdoc
@@ -144,7 +144,7 @@
script function. In the following example a script signal handler is
defined that will handle the QLineEdit::textChanged() signal:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 47
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 47
The first two arguments to qScriptConnect() are the same
as you would pass to QObject::connect() to establish a normal C++
@@ -155,7 +155,7 @@
("slot") itself. The following example shows how the \c this argument
can be put to use:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 48
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 48
We create two QLineEdit objects and define a single signal handler
function. The connections use the same handler function, but the
@@ -179,13 +179,13 @@
In this form of connection, the argument to \c{connect()} is the
function to connect to the signal.
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 2
The argument can be a Qt Script function, as in the above
example, or it can be a QObject slot, as in
the following example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 3
When the argument is a QObject slot, the argument types of the
signal and slot do not necessarily have to be compatible;
@@ -196,7 +196,7 @@
\c{disconnect()} function, passing the function to disconnect
as argument:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 4
When a script function is invoked in response to a signal, the
\c this object will be the Global Object.
@@ -214,11 +214,11 @@
\c{clicked} signal; passing the form as the \c this object
makes sense in such a case.
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 5
To disconnect from the signal, pass the same arguments to \c{disconnect()}:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 6
\section3 Signal to Named Member Function Connections
@@ -234,11 +234,11 @@
Note that the function is resolved when the connection is made, not
when the signal is emitted.
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 7
To disconnect from the signal, pass the same arguments to \c{disconnect()}:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 8
\section3 Error Handling
@@ -247,14 +247,14 @@
You can obtain an error message from the resulting \c{Error} object.
Example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 9
\section3 Emitting Signals from Scripts
To emit a signal from script code, you simply invoke the signal
function, passing the relevant arguments:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 10
It is currently not possible to define a new signal in a script;
i.e., all signals must be defined by C++ classes.
@@ -267,13 +267,13 @@
\c{myOverloadedSlot(int)} and \c{myOverloadedSlot(QString)}, the following
script code will behave reasonably:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 11
You can specify a particular overload by using array-style property access
with the \l{QMetaObject::normalizedSignature()}{normalized signature} of
the C++ function as the property name:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 12
If the overloads have different number of arguments, QtScript will
pick the overload with the argument count that best matches the
@@ -291,11 +291,11 @@
property will automatically be invoked. For example, if your
C++ class has a property declared as follows:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 13
then script code can do things like the following:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 14
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 14
\section2 Accessing Child QObjects
@@ -306,12 +306,12 @@
\c{"okButton"}, you can access this object in script code through
the expression
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 15
Since \c{objectName} is itself a Q_PROPERTY, you can manipulate
the name in script code to, for example, rename an object:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 16
You can also use the functions \c{findChild()} and \c{findChildren()}
to find children. These two functions behave identically to
@@ -320,7 +320,7 @@
For example, we can use these functions to find objects using strings
and regular expressions:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 17
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 17
You typically want to use \c{findChild()} when manipulating a form
that uses nested layouts; that way the script is isolated from the
@@ -367,7 +367,7 @@
For example, a constructor function that constructs QObjects
only to be used in the script environment is a good candidate:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 18
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 18
\section3 Auto-Ownership
@@ -638,7 +638,7 @@
For example, the following class definition enables scripting only for
certain functions:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 19
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 19
In the example above, aNonScriptableFunction() is not declared as a
slot, so it will not be available in QtScript. The other three
@@ -649,7 +649,7 @@
It is possible to make any function script-invokable by specifying
the \c{Q_INVOKABLE} modifier when declaring the function:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 20
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 20
Once declared with \c{Q_INVOKABLE}, the method can be invoked from
QtScript code just as if it were a slot. Although such a method is
@@ -662,14 +662,14 @@
In the previous example, if we wanted to get or set a property using
QtScript we would have to write code like the following:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 21
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 21
Scripting languages often provide a property syntax to modify and
retrieve properties (in our case the enabled state) of an
object. Many script programmers would want to write the above code
like this:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 22
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 22
To make this possible, you must define properties in the C++ QObject
subclass. For example, the following \c MyObject class declaration
@@ -677,7 +677,7 @@
\c{setEnabled(bool)} as its setter function and \c{isEnabled()} as its
getter function:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 23
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 23
The only difference from the original code is the use of the macro
\c{Q_PROPERTY}, which takes the type and name of the property, and
@@ -688,7 +688,7 @@
declaring the property; by default, the \c{SCRIPTABLE} attribute is
\c true. For example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 24
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 24
\section2 Reacting to C++ Objects Signals in Scripts
@@ -703,14 +703,14 @@
regardless of whether the signal will be connected to a slot in C++
or in QtScript.
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 25
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 25
The only change we have made to the code in the previous section is
to declare a signals section with the relevant signal. Now, the
script writer can define a function and connect to the object like
this:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 26
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 26
\section2 Design of Application Objects
@@ -752,7 +752,7 @@
still allowing pointers to your custom objects to flow seamlessly
between C++ and scripts. Example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 43
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 43
\section1 Function Objects and Native Functions
@@ -778,23 +778,23 @@
result. The following script defines a Qt Script object that has a
toKelvin() function:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 90
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 90
The toKelvin() function takes a temperature in Kelvin as argument, and
returns the temperature converted to Celsius. The following snippet shows
how the toKelvin() function might be obtained and called from C++:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 91
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 91
If a script defines a global function, you can access the function as a
property of QScriptEngine::globalObject(). For example, the following script
defines a global function add():
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 56
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 56
C++ code might call the add() function as follows:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 92
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 92
As already mentioned, functions are just values in Qt Script; a function by
itself is not "tied to" a particular object. This is why you have to specify
@@ -816,7 +816,7 @@
is invoked determines the \c this object when the function body is executed,
as the following script example illustrates:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 49
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 49
An important thing to note is that in Qt Script, unlike C++ and Java, the
\c this object is not part of the execution scope. This means that
@@ -824,14 +824,14 @@
use the \c this keyword to access the object's properties. For example,
the following script probably doesn't do what you want:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 50
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 50
You will get a reference error saying that 'a is not defined' or, worse,
two totally unrelated global variables \c a and \c b will be used to
perform the computation, if they exist. Instead, the script should look
like this:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 51
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 51
Accidentally omitting the \c this keyword is a typical source of
error for programmers who are used to the scoping rules of C++ and Java.
@@ -844,7 +844,7 @@
your function as if it were a "normal" script function. Here is how the
previous \c{getProperty()} function can be written in C++:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 52
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 52
Call QScriptEngine::newFunction() to wrap the function. This will
produce a special type of function object that carries a pointer to
@@ -905,7 +905,7 @@
script would normally define an \c{add()} function that takes two
arguments, adds them together and returns the result:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 56
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 56
When a script function is defined with formal parameters, their
names can be viewed as mere aliases of properties of the \c
@@ -914,12 +914,12 @@
variable. This means that the \c{add()} function can equivalently be
written like this:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 57
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 57
This latter form closely matches what a native implementation
typically looks like:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 58
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 58
\section3 Checking the Number of Arguments
@@ -930,13 +930,13 @@
really needs two arguments in order to do something useful. This
can be expressed by the script definition as follows:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 59
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 59
This would result in an error being thrown if a script invokes
\c{add()} with anything other than two arguments. The native
function can be modified to perform the same check:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 62
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 62
\section3 Checking the Types of Arguments
@@ -954,7 +954,7 @@
stricter semantics (namely, that it should only add numeric
operands), the argument types can be tested:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 60
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 60
Then an invocation like \c{add("foo", new Array())} will
cause an error to be thrown.
@@ -962,12 +962,12 @@
The C++ version can call QScriptValue::isNumber() to perform similar
tests:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 63
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 63
A less strict script implementation might settle for performing an
explicit to-number conversion before applying the \c{+} operator:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 61
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 61
In a native implementation, this is equivalent to calling
QScriptValue::toNumber() without performing any type test first,
@@ -1000,21 +1000,21 @@
\c{concat("Qt", " ", "Script ", 101)} would return "Qt Script 101".
A script definition of \c{concat()} might look like this:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 64
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 64
Here is an equivalent native implementation:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 65
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 65
A second use case for a variable number of arguments is to implement
optional arguments. Here's how a script definition typically does
it:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 66
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 66
And here's the native equivalent:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 67
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 67
A third use case for a variable number of arguments is to simulate
C++ overloads. This involves checking the number of arguments and/or
@@ -1043,7 +1043,7 @@
call to another function. In script code, this is what it
typically looks like:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 68
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 68
For example, \c{foo(10, 20, 30)} would result in the \c{foo()} function
executing the equivalent of \c{bar(10, 20, 30)}. This is useful if
@@ -1054,7 +1054,7 @@
function that has the exact same "signature". In C++, the forwarding
function might look like this:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 69
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 69
\o The arguments object can serve as input to a QScriptValueIterator,
providing a generic way to iterate over the arguments. A debugger
@@ -1072,7 +1072,7 @@
Some script functions are constructors; they are expected to initialize
new objects. The following snippet is a small example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 75
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 75
There is nothing special about constructor functions. In fact, any
script function can act as a constructor function (i.e., any function
@@ -1118,7 +1118,7 @@
The following example implements a constructor function that always
creates and initializes a new object:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 76
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 76
Given this constructor, scripts would be able to use either the
expression \c{new Person("Bob")} or \c{Person("Bob")} to create a
@@ -1154,7 +1154,7 @@
returns the function object being invoked. The following example
shows how this might be used:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 55
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 55
\section2 Native Functions as Arguments to Functions
@@ -1163,13 +1163,13 @@
naturally. As an example, here's a native comparison function
that compares its two arguments numerically:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 53
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 53
The above function can be passed as argument to the standard
\c{Array.prototype.sort} function to sort an array numerically,
as the following C++ code illustrates:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 54
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 54
Note that, in this case, we are truly treating the native function
object as a value \mdash i.e., we don't store it as a property of the
@@ -1204,7 +1204,7 @@
itself. This technique is typically used in conjunction with
QScriptEngine::pushContext(), as in the following example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 77
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 77
We create a temporary execution context, create a local variable
for it, evaluate the script, and finally restore the old context.
@@ -1227,7 +1227,7 @@
define a native combined getter/setter that transforms the value
slightly:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 78
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 78
The example uses the internal data of the object to store and
retrieve the transformed value. Alternatively, the property
@@ -1240,12 +1240,12 @@
The following C++ code shows how an object property can be defined
in terms of the native getter/setter:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 79
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 79
When the property is accessed, like in the following script, the
getter/setter does its job behind the scenes:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 80
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 80
\note It is important that the setter function, not just the getter,
returns the value of the property; i.e., the setter should \e{not}
@@ -1266,7 +1266,7 @@
Property getters and setters can be defined and installed by script
code as well, as in the following example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 81
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 81
Getters and setters can only be used to implement "a priori
properties"; i.e., the technique can't be used to react to an access
@@ -1342,7 +1342,7 @@
including the \c{hasOwnProperty()} function and \c{toString()}
function:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 27
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 27
The \c{toString()} function itself is not defined in \c{o} (since we
did not assign anything to \c{o.toString}), so instead the
@@ -1382,7 +1382,7 @@
The following code defines a simple constructor function for a class
called \c{Person}:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 28
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 28
Next, you want to set up \c{Person.prototype} as your prototype
object; i.e., define the interface that should be common to all
@@ -1397,19 +1397,19 @@
\c{Object.prototype}, to give your \c{Person} objects a more
appropriate string representation:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 29
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 29
This resembles the process of reimplementing a virtual function
in C++. Henceforth, when the property named \c{toString} is
looked up in a \c{Person} object, it will be resolved in
\c{Person.prototype}, not in \c{Object.prototype} as before:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 30
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 30
There are also some other interesting things we can learn about a
\c{Person} object:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 31
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 31
The \c{hasOwnProperty()} function is not inherited from
\c{Person.prototype}, but rather from \c{Object.prototype}, which is
@@ -1426,13 +1426,13 @@
following example shows how one can create a subclass of \c{Person}
called \c{Employee}:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 32
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 32
Again, you can use the \c{instanceof} to verify that the
class relationship between \c{Employee} and \c{Person} has been
correctly established:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 33
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 33
This shows that the prototype chain of \c{Employee} objects is the
same as that of \c{Person} objects, but with \c{Employee.prototype}
@@ -1477,25 +1477,25 @@
preceding section can be implemented in terms of the Qt Script API.
We begin with the native constructor function:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 34
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 34
Here's the native equivalent of the \c{Person.prototype.toString}
function we saw before:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 35
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 35
The \c{Person} class can then be initialized as follows:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 36
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 36
The implementation of the \c{Employee} subclass is similar. We
use QScriptValue::call() to call the super-class (Person) constructor:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 37
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 37
The \c{Employee} class can then be initialized as follows:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 38
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 38
When implementing the prototype object of a class, you may want to use
the QScriptable class, as it enables you to define the API of your
@@ -1521,7 +1521,7 @@
modify the underlying C++ value, lets you modify the actual value
contained in the script value (and not a copy of it).
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 39
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 39
\section2 Implementing Constructors for Value-based Types
@@ -1529,7 +1529,7 @@
by wrapping a native factory function. For example, the following
function implements a simple constructor for QPoint:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 44
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 44
In the above code we simplified things a bit, e.g. we didn't check
the argument count to decide which QPoint C++ constructor to use.
@@ -1564,16 +1564,16 @@
The following snippet shows a constructor function that constructs
QXmlStreamReader objects that are stored using QSharedPointer:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 93
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 93
Prototype functions can use qscriptvalue_cast() to cast the \c this object
to the proper type:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 94
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 94
The prototype and constructor objects are set up in the usual way:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 95
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 95
Scripts can now construct QXmlStreamReader objects by calling the \c
XmlStreamReader constructor, and when the Qt Script object is
@@ -1643,12 +1643,12 @@
somewhere else. The following code shows a custom print() that adds
text to a QPlainTextEdit.
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 45
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 45
The following code shows how the custom print() function may be
initialized and used.
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 46
+ \snippet doc/src/snippets/code/doc_src_qtscript.cpp 46
A pointer to the QPlainTextEdit is stored as an internal property
of the script function itself, so that it can be retrieved when
@@ -1680,7 +1680,7 @@
function. Essentially all that is necessary to achieve this is to use
the qsTr() script function. Example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 82
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 82
This accounts for 99% of the user-visible strings you're likely to write.
@@ -1689,7 +1689,7 @@
unique in your project, you should use the qsTranslate() function and pass a
suitable context as the first argument. Example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 83
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 83
If you need to have translatable text completely outside a function, there
are two functions to help: QT_TR_NOOP() and QT_TRANSLATE_NOOP(). They merely
@@ -1698,18 +1698,18 @@
Example of QT_TR_NOOP():
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 84
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 84
Example of QT_TRANSLATE_NOOP():
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 85
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 85
\section2 Use String.prototype.arg() for Dynamic Text
The String.prototype.arg() function (which is modeled after QString::arg())
offers a simple means for substituting arguments:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 86
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 86
\section2 Produce Translations
@@ -1804,7 +1804,7 @@
This property has the QScriptValue::Undeletable flag set.
For example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 40
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 40
\i \c{Object.prototype.__defineGetter__} \br
This function installs a
@@ -1814,7 +1814,7 @@
\c this object will be the object whose property is accessed.
For example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 41
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 41
\i \c{Object.prototype.__defineSetter__} \br
This function installs a
@@ -1824,7 +1824,7 @@
\c this object will be the object whose property is accessed.
For example:
- \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 42
+ \snippet doc/src/snippets/code/doc_src_qtscript.js 42
\i \c{Function.prototype.connect} \br
This function connects
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.qtscripttools.qdoc b/doc/src/snippets/code/doc_src_appicon.pro
index 76840b3..176b458 100644
--- a/doc/src/snippets/code/doc.src.qtscripttools.qdoc
+++ b/doc/src/snippets/code/doc_src_appicon.pro
@@ -38,11 +38,16 @@
**
****************************************************************************/
-//! [0]
- #include <QtScriptTools>
-//! [0]
+#! [1]
+RC_FILE = myapp.rc
+#! [1]
-//! [1]
- QT += scripttools
-//! [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..523a36d 100644
--- a/doc/src/snippets/code/doc_src_deployment.qdoc
+++ b/doc/src/snippets/code/doc_src_deployment.qdoc
@@ -100,16 +100,6 @@ $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_phonon.qdoc b/doc/src/snippets/code/doc_src_examples_imageviewer.cpp
index 61ee189..c86f8ac 100644
--- a/doc/src/snippets/code/doc_src_phonon.qdoc
+++ b/doc/src/snippets/code/doc_src_examples_imageviewer.cpp
@@ -39,15 +39,16 @@
****************************************************************************/
//! [0]
-QT += phonon
+imageLabel->resize(imageLabel->pixmap()->size());
//! [0]
//! [1]
-QT += phonon
+if (!imageLabel->pixmap())
+ qFatal("ASSERT: "imageLabel->pixmap()" in file ...");
//! [1]
-//! [2]
-#include <Phonon/MediaObject>
-//! [2]
+//! [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.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 730f71f..730f71f 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..1238bc5 100644
--- a/doc/src/snippets/code/doc_src_properties.qdoc
+++ b/doc/src/snippets/code/doc_src_properties.cpp
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..abb31a1 100644
--- a/doc/src/snippets/code/doc_src_qdbusadaptors.qdoc
+++ b/doc/src/snippets/code/doc_src_qdbusadaptors.cpp
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 fb71e39..e5b749e 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.sources = path\*.png
DEPLOYMENT += myFiles
-//! [28]
+#! [28]
-//! [29]
+#! [29]
myFiles.sources = path\file1.ext1 path2\file2.ext1 path3\*
myFiles.path = \some\path\on\device
someother.sources = 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.sources = customimageplugin.dll
customplugin.sources += c:\myplugins\othercustomimageplugin.dll
customplugin.path = imageformats
@@ -857,50 +839,50 @@ dynamiclibrary.path = \sys\bin
globalplugin.sources = 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.sources = 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,50 +964,50 @@ 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.sources = install_note.txt
dep_note.flags = FILETEXT TEXTEXIT
DEPLOYMENT += dep_note
-//! [155]
+#! [155]
-//! [156]
+#! [156]
DEPLOYMENT.display_name = My Qt App
-//! [156]
+#! [156]
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..822e6fa
--- /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(), qVariantFromValue(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 a168d5b..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(), qVariantFromValue(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_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/code/doc_src_resources.cpp b/doc/src/snippets/code/doc_src_resources.cpp
new file mode 100644
index 0000000..b965cbe
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_resources.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$
+**
+****************************************************************************/
+
+//! [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_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.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/code/doc_src_wince-customization.cpp b/doc/src/snippets/code/doc_src_wince-customization.cpp
new file mode 100644
index 0000000..90c2207
--- /dev/null
+++ b/doc/src/snippets/code/doc_src_wince-customization.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$
+**
+****************************************************************************/
+
+//! [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/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/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/sql-programming/sql-driver.qdoc b/doc/src/sql-programming/sql-driver.qdoc
index 1476491..42cfefd 100644
--- a/doc/src/sql-programming/sql-driver.qdoc
+++ b/doc/src/sql-programming/sql-driver.qdoc
@@ -121,7 +121,7 @@
Source code to access the OUT values:
- \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 2
\bold{Note:} \c{@outval1} and \c{@outval2} are variables local to the current
connection and will not be affected by queries sent from another host
@@ -392,7 +392,7 @@
sets, will be accessible only if you set the query's forward only
mode to \e forward using \l QSqlQuery::setForwardOnly().
- \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 10
\bold{Note:} The value returned by the stored procedure's return statement
is discarded.
@@ -679,7 +679,7 @@
database file, no matter whether it is stored locally or on another
server.
- \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 24
+ \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 24
You need the InterBase/Firebird development headers and libraries
to build this plugin.
@@ -694,7 +694,7 @@
be overridden by setting the ISC_DPB_LC_CTYPE parameter with
QSqlDatabase::setConnectOptions() before opening the connection.
- \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 25
+ \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 25
If Qt doesn't support the given text encoding the driver will issue a
warning message and connect to the database using UNICODE_FSS.
@@ -708,7 +708,7 @@
procedure, only IN values need to be bound via QSqlQuery::bindValue(). The
RETURN/OUT values can be retrieved via QSqlQuery::value(). Example:
- \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 26
+ \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 26
\section3 How to Build the QIBASE Plugin on Unix and Mac OS X
@@ -775,7 +775,7 @@
Make sure you have followed the guide to \l{Deploying Plugins}.
If you experience plugin load problems and see output like this:
- \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 31
+ \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 31
the problem is usually that the plugin had the wrong \l{Deploying
Plugins#The Build Key}{build key}. This might require removing an
diff --git a/doc/src/widgets-and-layouts/layout.qdoc b/doc/src/widgets-and-layouts/layout.qdoc
index c3db5fa..1d8214b 100644
--- a/doc/src/widgets-and-layouts/layout.qdoc
+++ b/doc/src/widgets-and-layouts/layout.qdoc
@@ -319,16 +319,16 @@
\section2 The Header File (\c card.h)
- \snippet doc/src/snippets/code/doc_src_layout.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_layout.cpp 0
\section2 The Implementation File (\c card.cpp)
- \snippet doc/src/snippets/code/doc_src_layout.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_layout.cpp 1
First we define \c{count()} to fetch the number of items in the list.
- \snippet doc/src/snippets/code/doc_src_layout.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_layout.cpp 2
Then we define two functions that iterate over the layout: \c{itemAt()}
and \c{takeAt()}. These functions are used internally by the layout system
@@ -341,7 +341,7 @@
structure, we may have to spend more effort defining a linear order for the
items.
- \snippet doc/src/snippets/code/doc_src_layout.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_layout.cpp 3
\c{addItem()} implements the default placement strategy for layout items.
This function must be implemented. It is used by QLayout::add(), by the
@@ -351,26 +351,26 @@
QGridLayout::addItem(), QGridLayout::addWidget(), and
QGridLayout::addLayout().
- \snippet doc/src/snippets/code/doc_src_layout.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_layout.cpp 4
The layout takes over responsibility of the items added. Since QLayoutItem
does not inherit QObject, we must delete the items manually. In the
destructor, we remove each item from the list using \c{takeAt()}, and
then delete it.
- \snippet doc/src/snippets/code/doc_src_layout.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_layout.cpp 5
The \c{setGeometry()} function actually performs the layout. The rectangle
supplied as an argument does not include \c{margin()}. If relevant, use
\c{spacing()} as the distance between items.
- \snippet doc/src/snippets/code/doc_src_layout.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_layout.cpp 6
\c{sizeHint()} and \c{minimumSize()} are normally very similar in
implementation. The sizes returned by both functions should include
\c{spacing()}, but not \c{margin()}.
- \snippet doc/src/snippets/code/doc_src_layout.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_layout.cpp 7
\section2 Further Notes
diff --git a/doc/src/widgets-and-layouts/styles.qdoc b/doc/src/widgets-and-layouts/styles.qdoc
index 8231fcb..9e9dd64 100644
--- a/doc/src/widgets-and-layouts/styles.qdoc
+++ b/doc/src/widgets-and-layouts/styles.qdoc
@@ -283,12 +283,12 @@
pointer type is correct. If the object isn't of the right type,
qstyleoption_cast() returns 0. For example:
- \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 0
The following code snippet illustrates how to use QStyle to
draw the focus rectangle from a custom widget's paintEvent():
- \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 1
The next example shows how to derive from an existing style to
customize the look of a graphical element:
@@ -542,7 +542,7 @@
We start with a look at how QCheckBox builds it style option,
which is QStyleOptionButton for checkboxes:
- \snippet doc/src/snippets/code/doc_src_styles.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_styles.cpp 0
First we let QStyleOption set up the option with the information
that is common for all widgets with \c initFrom(). We will look at
@@ -561,7 +561,7 @@
attributes that are common for all widgets. We print its
implementation here:
- \snippet doc/src/snippets/code/doc_src_styles.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_styles.cpp 1
The State_Enabled is set when the widget is enabled. When the
widget has focus the State_HasFocus flag is set. Equally, the
@@ -625,7 +625,7 @@
notably, it wraps the methods in QStyle used for painting. The
QCheckBox draws itself as follows:
- \snippet doc/src/snippets/code/doc_src_styles.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_styles.cpp 2
QCommonStyle handles the CE_CheckBox element. The QCheckBox
has two sub elements: SE_CheckBoxIndicator (the checked indicator)
@@ -633,7 +633,7 @@
checkbox label). QCommonStyle also implements these sub element
bounding rectangles. We have a look at the QCommonStyle code:
- \snippet doc/src/snippets/code/doc_src_styles.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_styles.cpp 3
As can be seen from the code extract, the common style gets
the bounding rectangles of the two sub elements of
@@ -644,7 +644,7 @@
handles CE_CheckboxLabel. We will examine each implementation and
start with CE_CheckBoxLabel:
- \snippet doc/src/snippets/code/doc_src_styles.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_styles.cpp 4
\l{QStyle::}{visualAlignment()} adjusts the alignment of text
according to the layout direction. We then draw an icon if it
diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc
index be845c4..8cfa2b4 100644
--- a/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -469,11 +469,11 @@
sheet. Consider the following example. First, we set a style
sheet on the QApplication:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 21
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 21
Then we set a style sheet on a QPushButton object:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 22
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 22
The style sheet on the QPushButton forces the QPushButton (and
any child widget) to have blue text, in spite of the more
@@ -481,7 +481,7 @@
The result would have been the same if we had written
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 23
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 23
except that if the QPushButton had children (which is unlikely),
the style sheet would have no impact on them.
@@ -500,14 +500,14 @@
For example, consider a QPushButton inside a QGroupBox:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 24
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 24
The QPushButton does not have an explicit color set. Hence, instead
of inheriting color of its parent QGroupBox, it has the system color.
If we want to set the color on a QGroupBox and its children,
we can write:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 25
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 25
In contrast, setting a font and propagate using QWidget::setFont() and
QWidget::setPalette() propagates to child widgets.
@@ -517,7 +517,7 @@
The Type Selector can be used to style widgets of a particular type. For
example,
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 26
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 26
Qt Style Sheet uses QObject::className() of the widget to determine
when to apply the Type Selector. When custom widgets are inside namespaces,
@@ -526,7 +526,7 @@
when using the Type Selector for widgets inside namespaces, we must
replace the "::" with "--". For example,
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 27
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 27
\section1 Setting QObject properties
@@ -1328,7 +1328,7 @@
If you subclass from QWidget, you need to provide a paintEvent for your
custom QWidget as below:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 32
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 32
The above code is a no-operation if there is no stylesheet set.
@@ -3373,35 +3373,35 @@
\l{QLineEdit}s in an application. This could be achieved like
this:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 88
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 88
If we want the property to apply only to the \l{QLineEdit}s that are
children (or grandchildren or grand-grandchildren) of a specific dialog,
we would rather do this:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 89
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 89
If we want the property to apply only to one specific QLineEdit,
we can give it a name using QObject::setObjectName() and use an
ID Selector to refer to it:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 90
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 90
Alternatively, we can set the
\l{Qt Style Sheets Reference#background-prop}{background-color} property directly on the
QLineEdit, omitting the selector:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 91
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 91
To ensure a good contrast, we should also specify a suitable
color for the text:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 92
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 92
It might be a good idea to change the colors used for selected
text as well:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 93
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 93
\section2 Customizing Using Dynamic Properties
@@ -3422,7 +3422,7 @@
\c mandatoryField property on the fly and set it to true. For
example:
- \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 95
+ \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 95
\section2 Customizing a QPushButton Using the Box Model
diff --git a/doc/src/windows-and-dialogs/mainwindow.qdoc b/doc/src/windows-and-dialogs/mainwindow.qdoc
index 0bf4909..e7df502 100644
--- a/doc/src/windows-and-dialogs/mainwindow.qdoc
+++ b/doc/src/windows-and-dialogs/mainwindow.qdoc
@@ -198,7 +198,7 @@
the first time it is called. You can also call
QMainWindow::setMenuBar() to use a custom menu bar in the main window.
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 0
\dots
\snippet examples/mainwindows/menus/mainwindow.cpp 5
\dots
@@ -222,7 +222,7 @@
\snippet examples/mainwindows/sdi/mainwindow.cpp 0
\dots
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 1
In this example, the toolbar is restricted to the top and bottom
toolbar areas of the main window, and is initially placed in the
@@ -244,7 +244,7 @@
required, the default can be changed with the
QMainWindow::setCorner() function:
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 2
The following diagram shows the configuration produced by the above code.
Note that the left and right dock widgets will occupy the top and bottom
@@ -255,7 +255,7 @@
Once all of the main window components have been set up, the central widget
is created and installed by using code similar to the following:
- \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 3
The central widget can be any subclass of QWidget.
*/