summaryrefslogtreecommitdiffstats
path: root/tests/auto/q3dict
Commit message (Expand)AuthorAgeFilesLines
* Update copyright year to 2010Jason McDonald2010-01-061-1/+1
* Update license headers again.Jason McDonald2009-09-091-4/+4
* Update tech preview license header.Jason McDonald2009-08-311-13/+13
* Update license headers.Jason McDonald2009-08-111-1/+1
* Update license headers as requested by the marketing department.Jason McDonald2009-06-161-2/+2
* Fixes qt3support unit tests generating compile failures when Qt is notRohan McGovern2009-05-111-0/+1
* Long live Qt 4.5!Lars Knoll2009-03-233-0/+177
tive/animation.qdoc4
-rw-r--r--doc/src/declarative/elements.qdoc2
-rw-r--r--doc/src/declarative/extending-tutorial.qdoc328
-rw-r--r--doc/src/declarative/pics/extending-tutorial-chapter1.pngbin0 -> 6687 bytes-rw-r--r--doc/src/declarative/pics/extending-tutorial-chapter2.pngbin0 -> 7318 bytes-rw-r--r--doc/src/declarative/pics/extending-tutorial-chapter3.pngbin0 -> 8145 bytes-rw-r--r--doc/src/declarative/pics/extending-tutorial-chapter5.pngbin0 -> 5557 bytes-rw-r--r--doc/src/declarative/qdeclarativeintro.qdoc2
-rw-r--r--doc/src/declarative/qdeclarativemodels.qdoc89
-rw-r--r--doc/src/examples/movie.qdoc4
-rw-r--r--doc/src/examples/trafficinfo.qdoc2
-rw-r--r--doc/src/frameworks-technologies/dnd.qdoc2
-rw-r--r--doc/src/frameworks-technologies/model-view-programming.qdoc20
-rw-r--r--doc/src/frameworks-technologies/phonon.qdoc1
-rw-r--r--doc/src/getting-started/examples.qdoc4
-rw-r--r--doc/src/getting-started/tutorials.qdoc12
-rwxr-xr-xdoc/src/images/clock.pngbin0 -> 16514 bytes-rw-r--r--doc/src/images/columnview.pngbin0 -> 3480 bytes-rwxr-xr-xdoc/src/images/combobox.pngbin0 -> 5022 bytes-rwxr-xr-xdoc/src/images/dummy_tree.pngbin0 -> 20189 bytes-rwxr-xr-xdoc/src/images/edit.pngbin0 -> 19636 bytes-rwxr-xr-xdoc/src/images/example_model.pngbin0 -> 16577 bytes-rwxr-xr-xdoc/src/images/header.pngbin0 -> 30302 bytes-rwxr-xr-xdoc/src/images/lineedit.pngbin0 -> 2613 bytes-rwxr-xr-xdoc/src/images/list_table_tree.pngbin0 -> 85530 bytes-rwxr-xr-xdoc/src/images/listview.pngbin0 -> 9695 bytes-rwxr-xr-xdoc/src/images/lotto.pngbin0 -> 17015 bytes-rwxr-xr-xdoc/src/images/modelview.pngbin0 -> 2887 bytes-rwxr-xr-xdoc/src/images/path.pngbin0 -> 31015 bytes-rwxr-xr-xdoc/src/images/qcompleter.pngbin0 -> 17017 bytes-rwxr-xr-xdoc/src/images/readonlytable.pngbin0 -> 28971 bytes-rwxr-xr-xdoc/src/images/readonlytable_role.pngbin0 -> 27467 bytes-rwxr-xr-xdoc/src/images/selection2.pngbin0 -> 23784 bytes-rwxr-xr-xdoc/src/images/standardwidget.pngbin0 -> 1466 bytes-rwxr-xr-xdoc/src/images/tableview.pngbin0 -> 10102 bytes-rwxr-xr-xdoc/src/images/tree.pngbin0 -> 27074 bytes-rwxr-xr-xdoc/src/images/tree_2.pngbin0 -> 14084 bytes-rwxr-xr-xdoc/src/images/tree_2_with_algorithm.pngbin0 -> 16921 bytes-rwxr-xr-xdoc/src/images/tree_city.pngbin0 -> 30398 bytes-rwxr-xr-xdoc/src/images/treeview.pngbin0 -> 17173 bytes-rwxr-xr-xdoc/src/images/treeview_sml.pngbin0 -> 17419 bytes-rwxr-xr-xdoc/src/images/widgetmapper.pngbin0 -> 20145 bytes-rw-r--r--doc/src/index.qdoc35
-rw-r--r--doc/src/legal/3rdparty.qdoc234
-rw-r--r--doc/src/legal/licenses.qdoc49
-rw-r--r--doc/src/platforms/symbian-introduction.qdoc17
-rw-r--r--doc/src/snippets/declarative/coloranimation.qml52
-rw-r--r--doc/src/snippets/declarative/numberanimation.qml52
-rw-r--r--doc/src/snippets/declarative/propertyanimation.qml101
-rw-r--r--doc/src/snippets/declarative/smoothedanimation.qml69
-rw-r--r--doc/src/snippets/declarative/springanimation.qml65
-rw-r--r--doc/src/snippets/declarative/state.qml23
-rw-r--r--doc/src/snippets/declarative/transition-from-to.qml62
-rw-r--r--doc/src/snippets/declarative/transition-reversible.qml65
-rw-r--r--doc/src/snippets/declarative/transition.qml59
-rw-r--r--doc/src/template/style/OfflineStyle.css595
-rwxr-xr-xdoc/src/template/style/style.css1193
-rwxr-xr-xdoc/src/tutorials/modelview.qdoc938
-rw-r--r--examples/declarative/modelviews/abstractitemmodel/model.cpp2
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/app.qml18
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro4
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/main.cpp4
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp81
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/piechart.h (renamed from examples/declarative/tutorials/extending/chapter1-basics/musician.h)21
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/app.qml24
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro4
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/main.cpp4
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp87
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/piechart.h (renamed from examples/declarative/tutorials/extending/chapter3-bindings/musician.h)26
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/app.qml42
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro4
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/main.cpp4
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp89
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/piechart.h84
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml18
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro8
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp8
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp (renamed from examples/declarative/tutorials/extending/chapter2-methods/musician.cpp)30
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h (renamed from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/musician.h)20
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp68
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h66
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/app.qml70
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro7
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp (renamed from examples/declarative/tutorials/extending/chapter1-basics/musician.cpp)34
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/piechart.cpp (renamed from examples/declarative/tutorials/extending/chapter3-bindings/musician.cpp)32
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/piechart.h (renamed from examples/declarative/tutorials/extending/chapter2-methods/musician.h)34
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp88
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h76
-rw-r--r--examples/declarative/tutorials/extending/chapter5-plugins/musician.cpp67
-rw-r--r--examples/declarative/tutorials/extending/chapter5-plugins/qmldir1
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/app.qml68
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro (renamed from examples/declarative/tutorials/extending/chapter5-plugins/chapter5-plugins.pro)12
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp (renamed from examples/declarative/tutorials/extending/chapter5-plugins/musicplugin.cpp)14
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.h (renamed from examples/declarative/tutorials/extending/chapter5-plugins/musicplugin.h)6
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/piechart.cpp (renamed from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/musician.cpp)24
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/piechart.h (renamed from examples/declarative/tutorials/extending/chapter5-plugins/musician.h)21
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp88
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h74
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/qmldir1
-rw-r--r--examples/declarative/tutorials/extending/extending.pro3
-rw-r--r--examples/declarative/tutorials/samegame/samegame1/samegame.qml2
-rw-r--r--examples/itemviews/addressbook/addresswidget.cpp2
-rw-r--r--examples/itemviews/addressbook/tablemodel.cpp48
-rw-r--r--examples/network/bearermonitor/sessionwidget.h2
-rw-r--r--examples/network/bearermonitor/sessionwidget_maemo.ui48
-rwxr-xr-xexamples/tutorials/modelview/1_readonly/1_readonly.pro10
-rwxr-xr-xexamples/tutorials/modelview/1_readonly/main.cpp53
-rwxr-xr-xexamples/tutorials/modelview/1_readonly/modelview.cpp54
-rwxr-xr-x[-rw-r--r--]examples/tutorials/modelview/1_readonly/modelview.h (renamed from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/instrument.h)32
-rwxr-xr-xexamples/tutorials/modelview/1_readonly/mymodel.cpp70
-rwxr-xr-xexamples/tutorials/modelview/1_readonly/mymodel.h59
-rwxr-xr-xexamples/tutorials/modelview/2_formatting/2_formatting.pro10
-rwxr-xr-x[-rw-r--r--]examples/tutorials/modelview/2_formatting/main.cpp (renamed from examples/declarative/tutorials/extending/chapter5-plugins/instrument.cpp)22
-rwxr-xr-xexamples/tutorials/modelview/2_formatting/modelview.cpp52
-rwxr-xr-xexamples/tutorials/modelview/2_formatting/modelview.h57
-rwxr-xr-xexamples/tutorials/modelview/2_formatting/mymodel.cpp112
-rwxr-xr-xexamples/tutorials/modelview/2_formatting/mymodel.h56
-rwxr-xr-xexamples/tutorials/modelview/3_changingmodel/3_changingmodel.pro10
-rwxr-xr-x[-rw-r--r--]examples/tutorials/modelview/3_changingmodel/main.cpp (renamed from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/instrument.cpp)22
-rwxr-xr-xexamples/tutorials/modelview/3_changingmodel/modelview.cpp52
-rwxr-xr-xexamples/tutorials/modelview/3_changingmodel/modelview.h57
-rwxr-xr-xexamples/tutorials/modelview/3_changingmodel/mymodel.cpp95
-rwxr-xr-xexamples/tutorials/modelview/3_changingmodel/mymodel.h63
-rwxr-xr-xexamples/tutorials/modelview/4_headers/4_headers.pro10
-rwxr-xr-x[-rw-r--r--]examples/tutorials/modelview/4_headers/main.cpp (renamed from examples/declarative/tutorials/extending/chapter5-plugins/app.qml)21
-rwxr-xr-xexamples/tutorials/modelview/4_headers/modelview.cpp54
-rwxr-xr-xexamples/tutorials/modelview/4_headers/modelview.h58
-rwxr-xr-xexamples/tutorials/modelview/4_headers/mymodel.cpp91
-rwxr-xr-xexamples/tutorials/modelview/4_headers/mymodel.h57
-rwxr-xr-xexamples/tutorials/modelview/5_edit/5_edit.pro10
-rwxr-xr-xexamples/tutorials/modelview/5_edit/main.cpp50
-rwxr-xr-xexamples/tutorials/modelview/5_edit/modelview.cpp60
-rwxr-xr-x[-rw-r--r--]examples/tutorials/modelview/5_edit/modelview.h (renamed from examples/declarative/tutorials/extending/chapter5-plugins/instrument.h)30
-rwxr-xr-xexamples/tutorials/modelview/5_edit/mymodel.cpp99
-rwxr-xr-xexamples/tutorials/modelview/5_edit/mymodel.h67
-rwxr-xr-xexamples/tutorials/modelview/6_treeview/6_treeview.pro5
-rwxr-xr-xexamples/tutorials/modelview/6_treeview/main.cpp50
-rwxr-xr-xexamples/tutorials/modelview/6_treeview/modelview.cpp82
-rwxr-xr-xexamples/tutorials/modelview/6_treeview/modelview.h64
-rwxr-xr-xexamples/tutorials/modelview/7_selections/7_selections.pro5
-rwxr-xr-xexamples/tutorials/modelview/7_selections/main.cpp50
-rwxr-xr-xexamples/tutorials/modelview/7_selections/modelview.cpp107
-rwxr-xr-xexamples/tutorials/modelview/7_selections/modelview.h63
-rwxr-xr-xexamples/tutorials/modelview/modelview.pro10
-rw-r--r--examples/tutorials/tutorials.pro4
-rw-r--r--mkspecs/features/uic.prf12
-rw-r--r--mkspecs/linux-g++-maemo/qmake.conf3
-rw-r--r--qmake/generators/makefile.cpp8
-rw-r--r--src/3rdparty/phonon/phonon/mediasource.cpp2
-rw-r--r--src/3rdparty/sqlite.pri4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp2
-rw-r--r--src/corelib/global/qnamespace.qdoc5
-rw-r--r--src/corelib/io/qiodevice_p.h2
-rw-r--r--src/corelib/io/qprocess.cpp4
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp16
-rw-r--r--src/corelib/tools/qlocale.cpp1
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/declarative/debugger/qdeclarativedebugtrace.cpp12
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp62
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp7
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp20
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp5
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp10
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp2
-rw-r--r--src/declarative/qml/qdeclarativelist.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp166
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp44
-rw-r--r--src/declarative/util/qdeclarativespringanimation.cpp32
-rw-r--r--src/declarative/util/qdeclarativestate.cpp24
-rw-r--r--src/declarative/util/qdeclarativetransition.cpp96
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp2
-rw-r--r--src/gui/dialogs/qwizard_win.cpp42
-rw-r--r--src/gui/dialogs/qwizard_win_p.h21
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp3
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp2
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp71
-rw-r--r--src/gui/kernel/qapplication.cpp2
-rw-r--r--src/gui/kernel/qapplication.h3
-rw-r--r--src/gui/kernel/qapplication_win.cpp2
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac.mm1
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h4
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm38
-rw-r--r--src/gui/kernel/qcocoaview_mac_p.h1
-rw-r--r--src/gui/kernel/qgesture.cpp29
-rw-r--r--src/gui/kernel/qgesture.h3
-rw-r--r--src/gui/kernel/qgesture_p.h1
-rw-r--r--src/gui/kernel/qgesturemanager.cpp4
-rw-r--r--src/gui/kernel/qguifunctions_wince.cpp28
-rw-r--r--src/gui/kernel/qstandardgestures.cpp7
-rw-r--r--src/gui/kernel/qwidget.cpp4
-rw-r--r--src/gui/kernel/qwidget_mac.mm7
-rw-r--r--src/gui/kernel/qwidget_win.cpp1
-rw-r--r--src/gui/kernel/qwidget_wince.cpp1
-rw-r--r--src/gui/text/qtextcursor.cpp6
-rw-r--r--src/gui/text/qtextlayout.cpp2
-rw-r--r--src/gui/text/qtextoption.cpp7
-rw-r--r--src/gui/text/qtexttable.cpp28
-rw-r--r--src/multimedia/video/qabstractvideobuffer.cpp1
-rw-r--r--src/multimedia/video/qabstractvideobuffer.h1
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp9
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp8
-rw-r--r--src/network/access/qnetworkrequest.cpp8
-rw-r--r--src/network/access/qnetworkrequest.h2
-rw-r--r--src/network/kernel/qauthenticator.cpp408
-rw-r--r--src/network/kernel/qauthenticator.h5
-rw-r--r--src/network/kernel/qauthenticator_p.h6
-rw-r--r--src/network/kernel/qnetworkproxy_mac.cpp5
-rw-r--r--src/network/socket/qtcpserver.cpp2
-rw-r--r--src/network/ssl/qsslsocket.cpp4
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp75
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp2
-rw-r--r--src/opengl/qgl.cpp14
-rw-r--r--src/plugins/bearer/bearer.pro3
-rw-r--r--src/plugins/bearer/connman/connman.pro19
-rw-r--r--src/plugins/bearer/connman/main.cpp93
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp787
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h179
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp1072
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux_p.h381
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp3
-rw-r--r--src/plugins/sqldrivers/db2/db2.pro10
-rw-r--r--src/plugins/sqldrivers/ibase/ibase.pro14
-rw-r--r--src/plugins/sqldrivers/mysql/mysql.pro23
-rw-r--r--src/plugins/sqldrivers/oci/oci.pro13
-rw-r--r--src/plugins/sqldrivers/odbc/odbc.pro19
-rw-r--r--src/plugins/sqldrivers/psql/psql.pro18
-rw-r--r--src/plugins/sqldrivers/sqlite/sqlite.pro17
-rw-r--r--src/plugins/sqldrivers/sqlite2/sqlite2.pro9
-rw-r--r--src/plugins/sqldrivers/tds/tds.pro15
-rw-r--r--src/s60installs/bwins/QtNetworku.def3
-rw-r--r--src/s60installs/eabi/QtNetworku.def3
-rw-r--r--src/script/api/qscriptvalue.cpp6
-rw-r--r--src/sql/drivers/db2/qsql_db2.pri8
-rw-r--r--src/sql/drivers/drivers.pri130
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.pri11
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.pri16
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp2
-rw-r--r--src/sql/drivers/oci/qsql_oci.pri9
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.pri13
-rw-r--r--src/sql/drivers/psql/qsql_psql.pri13
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.pri9
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.pri4
-rw-r--r--src/sql/drivers/tds/qsql_tds.pri10
-rw-r--r--tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp24
-rw-r--r--tests/auto/gui.pro1
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp27
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result13
-rw-r--r--tests/auto/mediaobject/tst_mediaobject.cpp3
-rw-r--r--tests/auto/network.pro2
-rw-r--r--tests/auto/qauthenticator/qauthenticator.pro5
-rw-r--r--tests/auto/qauthenticator/tst_qauthenticator.cpp155
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp2
-rw-r--r--tests/auto/qmake/testdata/simple_app/build/README1
-rw-r--r--tests/auto/qmake/testdata/simple_app/simple_app.pro1
-rw-r--r--tests/auto/qmake/testdata/simple_app/test.qrc5
-rw-r--r--tests/auto/qmake/tst_qmake.cpp16
-rw-r--r--tests/auto/qmimedata/qmimedata.pro4
-rw-r--r--tests/auto/qmimedata/tst_qmimedata.cpp343
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp29
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp4
-rw-r--r--tests/auto/qscrollbar/tst_qscrollbar.cpp2
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp24
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp4
-rw-r--r--tests/auto/qtexttable/tst_qtexttable.cpp57
-rw-r--r--tests/auto/quuid/quuid.pro9
-rw-r--r--tests/auto/quuid/test/test.pro29
-rw-r--r--tests/auto/quuid/testProcessUniqueness/main.cpp62
-rw-r--r--tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro8
-rw-r--r--tests/auto/quuid/tst_quuid.cpp29
-rw-r--r--tools/assistant/lib/qhelpprojectdata.cpp6
-rw-r--r--tools/assistant/tools/assistant/assistant.pro2
-rw-r--r--tools/assistant/translations/qt_help.pro53
-rw-r--r--tools/assistant/translations/translations.pro54
-rw-r--r--tools/configure/configureapp.cpp16
-rw-r--r--tools/designer/src/components/lib/lib.pro10
-rw-r--r--tools/designer/src/components/objectinspector/objectinspector.pri2
-rw-r--r--tools/designer/src/components/propertyeditor/propertyeditor.pri4
-rw-r--r--tools/designer/src/designer/designer.pro5
-rw-r--r--tools/designer/src/lib/shared/shared.pri10
-rw-r--r--tools/designer/translations/translations.pro141
-rw-r--r--tools/linguist/linguist/linguist.pro12
-rw-r--r--tools/linguist/lupdate/cpp.cpp7
-rw-r--r--tools/qdoc3/codemarker.cpp8
-rw-r--r--tools/qdoc3/codemarker.h9
-rw-r--r--tools/qdoc3/config.h1
-rw-r--r--tools/qdoc3/cppcodemarker.cpp15
-rw-r--r--tools/qdoc3/cppcodemarker.h7
-rw-r--r--tools/qdoc3/cppcodeparser.cpp15
-rw-r--r--tools/qdoc3/htmlgenerator.cpp381
-rw-r--r--tools/qdoc3/htmlgenerator.h15
-rw-r--r--tools/qdoc3/javacodemarker.cpp6
-rw-r--r--tools/qdoc3/javacodemarker.h5
-rw-r--r--tools/qdoc3/node.cpp2
-rw-r--r--tools/qdoc3/plaincodemarker.cpp7
-rw-r--r--tools/qdoc3/plaincodemarker.h1
-rw-r--r--tools/qdoc3/qscodemarker.cpp7
-rw-r--r--tools/qdoc3/qscodemarker.h1
-rw-r--r--tools/qdoc3/test/assistant.qdocconf24
-rw-r--r--tools/qdoc3/test/qt-api-only.qdocconf7
-rw-r--r--tools/qdoc3/test/qt-api-only_ja_JP.qdocconf7
-rw-r--r--tools/qdoc3/test/qt-api-only_zh_CN.qdocconf7
-rw-r--r--tools/qdoc3/test/qt-build-docs.qdocconf12
-rw-r--r--tools/qdoc3/test/qt-cpp-ignore.qdocconf3
-rw-r--r--tools/qdoc3/test/qt-html-templates.qdocconf8
-rw-r--r--tools/qdoc3/test/qt.qdocconf82
-rw-r--r--tools/qdoc3/tree.cpp14
-rw-r--r--tools/qdoc3/tree.h20
-rw-r--r--tools/qml/qml.pri10
-rw-r--r--tools/qtconfig/translations/translations.pro16
-rw-r--r--tools/qvfb/qvfb.pro2
-rw-r--r--tools/qvfb/translations/translations.pro35
-rwxr-xr-xtranslations/check-ts.pl13
-rw-r--r--translations/qt_de.ts46
-rw-r--r--translations/translations.pri144
323 files changed, 10957 insertions, 3084 deletions
diff --git a/.gitignore b/.gitignore
index fdb6843..4d5aa9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -114,6 +114,7 @@ tools/qtestlib/chart/chart*
tools/qtestlib/updater/updater*
tools/activeqt/testcon/testcon.tlb
translations/*.qm
+translations/*_untranslated.ts
qrc_*.cpp
# xemacs temporary files
diff --git a/bin/syncqt b/bin/syncqt
index 12c431d..eda36d5 100755
--- a/bin/syncqt
+++ b/bin/syncqt
@@ -691,6 +691,7 @@ my @ignore_for_qt_begin_header_check = ( "qiconset.h", "qconfig.h", "qconfig-dis
my @ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h" );
my @ignore_for_qt_module_check = ( "$modules{QtCore}/arch", "$modules{QtCore}/global", "$modules{QtSql}/drivers", "$modules{QtTest}", "$modules{QtDesigner}", "$modules{QtUiTools}", "$modules{QtDBus}", "$modules{phonon}" );
my %colliding_headers = ();
+my %inject_headers = ( "$basedir/src/corelib/global" => ( "*qconfig.h" ) );
foreach (@modules_to_sync) {
#iteration info
@@ -800,8 +801,10 @@ foreach (@modules_to_sync) {
foreach (@subdirs) {
my $subdir = "$_";
my @headers = findFiles("$subdir", "^[-a-z0-9_]*\\.h\$" , 0);
+ push @headers, $inject_headers{$subdir} if (defined $inject_headers{$subdir});
foreach (@headers) {
my $header = "$_";
+ my $shadow = ($header =~ s/^\*//);
$header = 0 if("$header" =~ /^ui_.*.h/);
foreach (@ignore_headers) {
$header = 0 if("$header" eq "$_");
@@ -819,6 +822,7 @@ foreach (@modules_to_sync) {
}
my $iheader = $subdir . "/" . $header;
+ $iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
my @classes = $public_header ? classNames($iheader) : ();
if($showonly) {
print "$header [$lib]\n";
@@ -843,7 +847,7 @@ foreach (@modules_to_sync) {
my $warning_msg = 'Inclusion of header files from include/Qt is deprecated.';
$header_content = "#ifndef QT_NO_QT_INCLUDE_WARN\n" .
" #if defined(__GNUC__)\n" .
- " #pragma warning \"$warning_msg\"\n" .
+ " #warning \"$warning_msg\"\n" .
" #elif defined(_MSC_VER)\n" .
" #pragma message \"WARNING: $warning_msg\"\n" .
" #endif\n".
diff --git a/configure b/configure
index 166f201..fb544bd 100755
--- a/configure
+++ b/configure
@@ -4481,11 +4481,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
fi
mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H"
- for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do
- if [ '!' -f "$conf" ]; then
- ln -s "$QCONFIG_H" "$conf"
- fi
- done
#mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
rm -f mkspecs/default
@@ -7751,7 +7746,7 @@ EOF
# Ensure we can link to uninistalled libraries
if [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
- echo "QMAKE_LFLAGS += -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib" >> "$CACHEFILE.tmp"
+ echo "QMAKE_LFLAGS = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$CACHEFILE.tmp"
fi
if [ -n "$QT_CFLAGS_PSQL" ]; then
diff --git a/configure.exe b/configure.exe
index 6817331..0863ecc 100755
--- a/configure.exe
+++ b/configure.exe
Binary files differ
diff --git a/doc/src/classes/phonon-api.qdoc b/doc/src/classes/phonon-api.qdoc
index 641b936..6fe0223 100644
--- a/doc/src/classes/phonon-api.qdoc
+++ b/doc/src/classes/phonon-api.qdoc
@@ -1577,7 +1577,6 @@
\since 4.4
\brief The MediaObject class provides an interface for media playback.
-
The media object manages a \l{Phonon::}{MediaSource}, which
supplies the media object with multimedia content, e.g., from a
file. A playback in Phonon is always started by calling the
@@ -1651,17 +1650,8 @@
playback of the current source, but it is possible to try with a
different one. A user readable error message is given by
errorString().
- \section1 Symbian Platform Security Requirements
-
- On Symbian, processes which access media via the network must
- have the \c NetworkServices platform security capability. If the client
- process lacks this capability, operations will result in errors.
- This failure is indicated by a state() of Phonon::ErrorState.
-
- Platform security capabilities are added via the
- \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY}
- qmake variable.
+ \sa {Symbian Platform Security Requirements}
\sa Phonon::MediaSource, Phonon::AudioOutput, VideoWidget,
{Music Player Example}, {Phonon Overview}, Phonon::VideoPlayer,
Phonon::createPlayer(), {Phonon Module}
diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc
index afedb44..1341bbb 100644
--- a/doc/src/declarative/advtutorial.qdoc
+++ b/doc/src/declarative/advtutorial.qdoc
@@ -164,14 +164,22 @@ The \c createBlock() function creates a block from the \c Block.qml file
and moves the new block to its position on the game canvas. This involves several steps:
\list
-\o \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml.
- If the component is ready, we can call \c createObject() to create an instance of the \c Block item.
-\o If \c createObject() returned null (i.e. if there was an error while
- loading the object), print the error information.
-\o Place the block in its position on the board and set its width and height.
- Also, store it in the blocks array for future reference.
-\o Finally, print error information to the console if the component could not be
- loaded for some reason (for example, if the file is missing).
+
+\o \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to
+ generate an element from \c Block.qml. If the component is ready,
+ we can call \c createObject() to create an instance of the \c Block
+ item.
+
+\o If \c createObject() returned null (i.e. if there was an error
+ while loading the object), print the error information.
+
+\o Place the block in its position on the board and set its width and
+ height. Also, store it in the blocks array for future reference.
+
+\o Finally, print error information to the console if the component
+ could not be loaded for some reason (for example, if the file is
+ missing).
+
\endlist
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index c5333df..401cf16 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -67,7 +67,9 @@ A property animation can also be specified as a resource that is manipulated fro
\snippet doc/src/snippets/declarative/animation.qml property-anim-3
As can be seen, when an animation is used like this (as opposed to as a value source) you will need
-to explicitly set the \c target and \c property to animate.
+to explicitly set the \c target and \c property to animate. This also the only case where
+an animation needs to be started explictly by either setting the \c running property to
+true or calling the \c start() method.
Animations can be joined into a group using SequentialAnimation and ParallelAnimation.
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 0edd242..c2930b3 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -113,7 +113,7 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt
\row \o \l {Connections} \o Explicitly connects signals and signal handlers
\row \o \l {Component} \o Encapsulate QML items as a component
\row \o \l {Timer} \o Provides timed triggers
-\row \o \l {QtObject} \o Basic element containing only the objectName property
+\row \o \l {QML:QtObject} {QtObject} \o Basic element containing only the objectName property
\row \o \l {WorkerScript} \o Enables the use of threads in QML
\row \o \l {Loader} \o Controls the loading of items or components
\row \o \l {Repeater} \o Uses a model to create multiples of components
diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc
index 2cf00b9..cc93e86 100644
--- a/doc/src/declarative/extending-tutorial.qdoc
+++ b/doc/src/declarative/extending-tutorial.qdoc
@@ -48,8 +48,9 @@ Tutorial chapters:
\o \l{declarative/tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals}
\o \l{declarative/tutorials/extending/chapter3-bindings}{Adding Property Bindings}
\o \l{declarative/tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types}
-\o \l{declarative/tutorials/extending/chapter5-plugins}{Writing an Extension Plugin}
-\o \l{qml-extending-tutorial6.html}{In Summary}
+\o \l{declarative/tutorials/extending/chapter5-listproperties}{Using List Property Types}
+\o \l{declarative/tutorials/extending/chapter6-plugins}{Writing an Extension Plugin}
+\o \l{qml-extending-tutorial7.html}{In Summary}
\endlist
*/
@@ -59,61 +60,94 @@ Tutorial chapters:
\example declarative/tutorials/extending/chapter1-basics
-Let's create a new QML type called "Musician" that has two properties: a name
-and an instrument. We will make it available in a \l {Modules}{module} called "Music", with
+A common task when extending QML is to provide a new QML type that supports some
+ custom functionality beyond what is provided by the built-in \l {QML Elements}.
+For example, this could be done to implement particular data models, or provide
+elements with custom painting and drawing capabilities, or access system features
+like network programming that are not accessible through built-in QML features.
+
+In this tutorial, we will show how to use the C++ classes in the QtDeclarative
+module to extend QML. The end result will be a simple Pie Chart display implemented by
+several custom QML types connected together through QML features like bindings and
+signals, and made available to the QML runtime through a plugin.
+
+To begin with, let's create a new QML type called "PieChart" that has two properties: a name
+and a color. We will make it available in a \l {Modules}{module} called "Charts", with
a module version of 1.0.
-We want this \c Musician type to be usable from QML like this:
+
+We want this \c PieChart type to be usable from QML like this:
\code
- import Music 1.0
+ import Charts 1.0
- Musician {
- name: "Reddy the Rocker"
- instrument: "Guitar"
+ PieChart {
+ width: 100; height: 100
+ name: "A simple pie chart"
+ color: "red"
}
\endcode
-To do this, we need a C++ class that encapsulates this \c Musician type and its two
-properties. Since QML relies heavily on Qt's \l{Meta-Object System}{meta object system},
+To do this, we need a C++ class that encapsulates this \c PieChart type and its two
+properties. Since QML makes extensive use of Qt's \l{Meta-Object System}{meta object system},
this new class must:
\list
-\o inherit from QObject
-\o declare its properties using the Q_PROPERTY() macro
+\o Inherit from QObject
+\o Declare its properties using the Q_PROPERTY macro
\endlist
-Here is our \c Musician class, defined in \c musician.h:
+Here is our \c PieChart class, defined in \c piechart.h:
-\snippet declarative/tutorials/extending/chapter1-basics/musician.h 0
+\snippet declarative/tutorials/extending/chapter1-basics/piechart.h 0
-It defines the two properties, \c name and \c instrument, with the Q_PROPERTY() macro.
-The class implementation in \c musician.cpp simply sets and returns the \c m_name and
-\c m_instrument values as appropriate.
+The class inherits from QDeclarativeItem because we want to override
+QDeclarativeItem::paint() in order to draw. If the class just represented some
+data type and was not an item that actually needed to be displayed, it could simply inherit
+from QObject. Or, if we want to extend the functionality of an existing QObject-based
+class, it could inherit from that class instead.
-Our QML file, \c app.qml, creates a \c Musician item and display the musician's details
+The \c PieChart class defines the two properties, \c name and \c color, with the Q_PROPERTY macro,
+and overrides QDeclarativeItem::paint(). The class implementation in \c piechart.cpp
+simply sets and returns the \c m_name and \c m_color values as appropriate, and
+implements \c paint() to draw a simple pie chart. It also turns off the
+QGraphicsItem::ItemHasNoContents flag to enable painting:
+
+\snippet declarative/tutorials/extending/chapter1-basics/piechart.cpp 0
+\dots 0
+\snippet declarative/tutorials/extending/chapter1-basics/piechart.cpp 1
+
+Now that we have defined the \c PieChart type, we will use it from QML. The \c app.qml
+file creates a \c PieChart item and display the pie chart's details
using a standard QML \l Text item:
\snippet declarative/tutorials/extending/chapter1-basics/app.qml 0
+Notice that although the color is specified as a string in QML, it is automatically
+converted to a QColor object for the PieChart \c color property. Automatic conversions are
+provided for various other \l {QML Basic Types}{basic types}; for example, a string
+like "640x480" can be automatically converted to a QSize value.
+
We'll also create a C++ application that uses a QDeclarativeView to run and
-display \c app.qml. The application must register the \c Musician type
+display \c app.qml. The application must register the \c PieChart type
using the qmlRegisterType() function, to allow it to be used from QML. If
-you don't register the type, \c app.qml won't be able to create a \c Musician.
+you don't register the type, \c app.qml won't be able to create a \c PieChart.
Here is the application \c main.cpp:
\snippet declarative/tutorials/extending/chapter1-basics/main.cpp 0
-This call to qmlRegisterType() registers the \c Musician type as a type called "Musician", in a module named "Music",
+This call to qmlRegisterType() registers the \c PieChart type as a type called "PieChart", in a module named "Charts",
with a module version of 1.0.
Lastly, we write a \c .pro project file that includes the files and the \c declarative library:
\quotefile declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro
-Now we can build and run the application. Try it yourself with the code in Qt's \c examples/tutorials/extending/chapter1-basics directory.
+Now we can build and run the application:
-\example declarative/tutorials/extending/chapter1-basics
+\image extending-tutorial-chapter1.png
+
+Try it yourself with the code in Qt's \c examples/tutorials/extending/chapter1-basics directory.
At the moment, the \c app.qml is run from within a C++ application.
This may seem odd if you're used to running QML files with the \l {QML Viewer}.
@@ -128,39 +162,40 @@ Later on, we'll show how to create a plugin so that you can run \c app.qml using
\example declarative/tutorials/extending/chapter2-methods
-Suppose we want \c Musician to have a "perform" method that prints a message
-to the console and then emits a "performanceEnded" signal.
-Other elements would be able to call \c perform() and receive
-\c performanceEnded() signals like this:
+Suppose we want \c PieChart to have a "clearChart()" method that erases the
+chart and then emits a "chartCleared" signal. Our \c app.qml would be able
+to call \c clearChart() and receive \c chartCleared() signals like this:
\snippet declarative/tutorials/extending/chapter2-methods/app.qml 0
-To do this, we add a \c perform() method and a \c performanceEnded() signal
+\image extending-tutorial-chapter2.png
+
+To do this, we add a \c clearChart() method and a \c chartCleared() signal
to our C++ class:
-\snippet declarative/tutorials/extending/chapter2-methods/musician.h 0
+\snippet declarative/tutorials/extending/chapter2-methods/piechart.h 0
\dots
-\snippet declarative/tutorials/extending/chapter2-methods/musician.h 1
+\snippet declarative/tutorials/extending/chapter2-methods/piechart.h 1
\dots
-\snippet declarative/tutorials/extending/chapter2-methods/musician.h 2
+\snippet declarative/tutorials/extending/chapter2-methods/piechart.h 2
\dots
-\snippet declarative/tutorials/extending/chapter2-methods/musician.h 3
+\snippet declarative/tutorials/extending/chapter2-methods/piechart.h 3
-The use of Q_INVOKABLE makes the \c perform() method available to the
+The use of Q_INVOKABLE makes the \c clearChart() method available to the
Qt Meta-Object system, and in turn, to QML. Note that it could have
been declared as as a Qt slot instead of using Q_INVOKABLE, as
slots are also callable from QML. Both of these approaches are valid.
-The \c perform() method simply prints a message to the console and
-then emits \c performanceEnded():
+The \c clearChart() method simply changes the color to Qt::transparent,
+repaints the chart, then emits the \c chartCleared() signal:
-\snippet declarative/tutorials/extending/chapter2-methods/musician.cpp 0
+\snippet declarative/tutorials/extending/chapter2-methods/piechart.cpp 0
-Now when we run the application and click the window, the application outputs:
+Now when we run the application and click the window, the pie chart
+disappears, and the application outputs:
\code
- "Reddy the Rocker" is playing the "Guitar"
- The performance has now ended
+ The chart has been cleared
\endcode
Try out the example yourself with the updated code in Qt's \c examples/tutorials/extending/chapter2-methods directory.
@@ -174,45 +209,49 @@ Try out the example yourself with the updated code in Qt's \c examples/tutorials
Property bindings is a powerful feature of QML that allows values of different
elements to be synchronized automatically. It uses signals to notify and update
-other elements' values when property values change.
+other elements' values when property values are changed.
-Let's enable property bindings for the \c instrument property. That means
+Let's enable property bindings for the \c color property. That means
if we have code like this:
\snippet declarative/tutorials/extending/chapter3-bindings/app.qml 0
-The "instrument: reddy.instrument" statement binds the \c instrument value of
-\c craig to the \c instrument of \c reddy.
-Whenever \c reddy's \c instrument value changes, \c craig's \c instrument value
-updates to the same value. When the window is clicked, the application outputs:
+\image extending-tutorial-chapter3.png
-\code
- "Reddy the Rocker" is playing the "Guitar"
- "Craig the Copycat" is playing the "Guitar"
- "Reddy the Rocker" is playing the "Drums"
- "Craig the Copycat" is playing the "Drums"
-\endcode
+The "color: chartA.color" statement binds the \c color value of
+\c chartB to the \c color of \c chartA.
+Whenever \c chartA's \c color value changes, \c chartB's \c color value
+updates to the same value. When the window is clicked, the \c onClicked
+handler in the MouseArea changes the color of \c chartA, thereby changing
+both charts to the color blue.
-It's easy to enable property binding for the \c instrument property.
-We add a \l{Qt's Property System}{NOTIFY} feature to its Q_PROPERTY() declaration to indicate that a "instrumentChanged" signal
+It's easy to enable property binding for the \c color property.
+We add a \l{Qt's Property System}{NOTIFY} feature to its Q_PROPERTY() declaration to indicate that a "colorChanged" signal
is emitted whenever the value changes.
-\snippet declarative/tutorials/extending/chapter3-bindings/musician.h 0
+\snippet declarative/tutorials/extending/chapter3-bindings/piechart.h 0
\dots
-\snippet declarative/tutorials/extending/chapter3-bindings/musician.h 1
+\snippet declarative/tutorials/extending/chapter3-bindings/piechart.h 1
\dots
-\snippet declarative/tutorials/extending/chapter3-bindings/musician.h 2
+\snippet declarative/tutorials/extending/chapter3-bindings/piechart.h 2
\dots
-\snippet declarative/tutorials/extending/chapter3-bindings/musician.h 3
+\snippet declarative/tutorials/extending/chapter3-bindings/piechart.h 3
-Then, we emit this signal in \c setInstrument():
+Then, we emit this signal in \c setPieSlice():
-\snippet declarative/tutorials/extending/chapter3-bindings/musician.cpp 0
+\snippet declarative/tutorials/extending/chapter3-bindings/piechart.cpp 0
-It's important for \c setInstrument() to check that the instrument value has actually changed
-before emitting \c instrumentChanged(). This ensures the signal is not emitted unnecessarily and
+It's important for \c setColor() to check that the color value has actually changed
+before emitting \c colorChanged(). This ensures the signal is not emitted unnecessarily and
also prevents loops when other elements respond to the value change.
+The use of bindings is essential to QML. You should always add NOTIFY
+signals for properties if they are able to be implemented, so that your
+properties can be used in bindings. Properties that cannot be bound cannot be
+automatically updated and cannot be used as flexibly in QML. Also, since
+bindings are invoked so often and relied upon in QML usage, users of your
+custom QML types may see unexpected behavior if bindings are not implemented.
+
*/
/*!
@@ -220,19 +259,19 @@ also prevents loops when other elements respond to the value change.
\example declarative/tutorials/extending/chapter4-customPropertyTypes
-The \c Musician type currently has two properties that are both strings.
-It could have all sorts of other properties. For example, we could add an
-integer-type property to store the age of each musician:
+The \c PieChart type currently has a string-type property and a color-type property.
+It could have many other types of properties. For example, we could add an
+integer-type property to store an identifier for each pie chart:
\code
- class Musician : public QObject
+ class PieChart : public QDeclarativeItem
{
...
- Q_PROPERTY(int age READ age WRITE setAge)
+ Q_PROPERTY(int id READ id WRITE setId)
public:
...
- int age() const;
- void setAge(int age);
+ int id() const;
+ void setId(int id);
...
};
\endcode
@@ -257,31 +296,39 @@ types:
If we want to create a property whose type is not supported by QML by default,
we need to register the type with QML.
-For example, let's change the type of the \c instrument property from a string to a
-new type called "Instrument". Instead of assigning a string value to \c instrument,
-we assign an \c Instrument value:
+For example, let's replace the use of the \c property with a type called
+"PieSlice" that has a \c color property. Instead of assigning a color,
+we assign an \c PieSlice value which itself contains a \c color:
\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml 0
-Like \c Musician, this new \c Instrument type has to inherit from QObject and declare
+Like \c PieChart, this new \c PieSlice type inherits from QDeclarativeItem and declares
its properties with Q_PROPERTY():
-\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/instrument.h 0
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0
-To use it from \c Musician, we modify the \c instrument property declaration
+To use it in \c PieChart, we modify the \c color property declaration
and associated method signatures:
-\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/musician.h 0
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h 0
\dots
-\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/musician.h 1
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h 1
\dots
-\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/musician.h 2
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h 2
\dots
-\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/musician.h 3
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h 3
+
+There is one thing to be aware of when implementing \c setPieSlice(). The \c PieSlice
+is a visual item, so it must be set as a child of the \c PieChart using
+QDeclarativeItem::setParentItem() so that the \c PieChart knows to paint this child
+item when its contents are drawn:
+
+\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0
-Like the \c Musician type, the \c Instrument type has to be registered
-using qmlRegisterType() to be used from QML. As with \c Musician, we'll add the
-type to the "Music" module, version 1.0:
+
+Like the \c PieChart type, the \c PieSlice type has to be registered
+using qmlRegisterType() to be used from QML. As with \c PieChart, we'll add the
+type to the "Charts" module, version 1.0:
\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp 0
\dots
@@ -293,15 +340,65 @@ Try it out with the code in Qt's \c examples/tutorials/extending/chapter4-custom
*/
+
/*!
-\title Chapter 5: Writing an Extension Plugin
+\title Chapter 5: Using List Property Types
-\example declarative/tutorials/extending/chapter5-plugins
+\example declarative/tutorials/extending/chapter5-listproperties
-Currently the \c Musician and \c Instrument types are used by \c app.qml,
+Right now, a \c PieChart can only have one \c PieSlice. Ideally a chart would
+have multiple slices, with different colors and sizes. To do this, we could
+have a \c slices property that accepts a list of \c PieSlice items:
+
+\snippet declarative/tutorials/extending/chapter5-listproperties/app.qml 0
+
+\image extending-tutorial-chapter5.png
+
+To do this, we replace the \c pieSlice property in \c PieChart with a \c slices property,
+declared as a QDeclarativeListProperty type. The QDeclarativeListProperty class enables the
+creation of list properties in QML extensions. We replace the \c pieSlice()
+function with a \c slices() function that returns a list of slices, and add
+an internal \c append_slice() function (discussed below). We also use a QList to
+store the internal list of slices as \c m_slices:
+
+\snippet declarative/tutorials/extending/chapter5-listproperties/piechart.h 0
+\dots
+\snippet declarative/tutorials/extending/chapter5-listproperties/piechart.h 1
+\dots
+\snippet declarative/tutorials/extending/chapter5-listproperties/piechart.h 2
+
+Although the \c slices property does not have an associated \c WRITE function,
+it is still modifiable because of the way QDeclarativeListProperty works.
+In the \c PieChart implementation, we implement \c PieChart::slices() to
+return a QDeclarativeListProperty value and indicate that the internal
+\c PieChart::append_slice() function is to be called whenever a request is made from QML
+to add items to the list:
+
+\snippet declarative/tutorials/extending/chapter5-listproperties/piechart.cpp 0
+
+The \c append_slice() function simply sets the parent item as before,
+and adds the new item to the \c m_slices list. As you can see, the append function for a
+QDeclarativeListProperty is called with two arguments: the list property, and
+the item that is to be appended.
+
+The \c PieSlice class has also been modified to include \c fromAngle and \c angleSpan
+properties and to draw the slice according to these values. This is a straightforward
+modification if you have read the previous pages in this tutorial, so the code is not shown here.
+
+The complete code can be seen in the updated \c examples/tutorials/extending/chapter5-listproperties directory.
+
+*/
+
+
+/*!
+\title Chapter 6: Writing an Extension Plugin
+
+\example declarative/tutorials/extending/chapter6-plugins
+
+Currently the \c PieChart and \c PieSlice types are used by \c app.qml,
which is displayed using a QDeclarativeView in a C++ application. An alternative
way to use our QML extension is to create a plugin library to make it available
-to the QML engine. This means we could load \c app.qml using the \l {QML Viewer}
+to the QML engine. This allows \c app.qml to be loaded with the \l {QML Viewer}
(or some other QML \l{Qt Declarative UI Runtime}{runtime} application) instead of writing a \c main.cpp file and
loading our own C++ application.
@@ -313,28 +410,28 @@ To create a plugin library, we need:
\o A "qmldir" file that tells the QML engine to load the plugin
\endlist
-First, we create a plugin class named \c MusicPlugin. It subclasses QDeclarativeExtensionPlugin
+First, we create a plugin class named \c ChartsPlugin. It subclasses QDeclarativeExtensionPlugin
and registers our QML types in the inherited \l{QDeclarativeExtensionPlugin::}{registerTypes()} method. It also calls
Q_EXPORT_PLUGIN2 for Qt's \l{How to Create Qt Plugins}{plugin system}.
-Here is the \c MusicPlugin definition in \c musicplugin.h:
+Here is the \c ChartsPlugin definition in \c chartsplugin.h:
-\snippet declarative/tutorials/extending/chapter5-plugins/musicplugin.h 0
+\snippet declarative/tutorials/extending/chapter6-plugins/chartsplugin.h 0
-And its implementation in \c musicplugin.cpp:
+And its implementation in \c chartsplugin.cpp:
-\snippet declarative/tutorials/extending/chapter5-plugins/musicplugin.cpp 0
+\snippet declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp 0
Then, we write a \c .pro project file that defines the project as a plugin library
and specifies with DESTDIR that library files should be built into a "lib" subdirectory:
-\quotefile declarative/tutorials/extending/chapter5-plugins/chapter5-plugins.pro
+\quotefile declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
Finally, we add a \c qmldir file that is automatically parsed by the QML engine.
-Here, we specify that a plugin named "chapter5-plugin" (the name
+Here, we specify that a plugin named "chapter6-plugin" (the name
of the example project) can be found in the "lib" subdirectory:
-\quotefile declarative/tutorials/extending/chapter5-plugins/qmldir
+\quotefile declarative/tutorials/extending/chapter6-plugins/qmldir
Now we have a plugin, and instead of having a main.cpp and an executable, we can build
the project and then load the QML file in the \l {QML Viewer}:
@@ -345,15 +442,16 @@ the project and then load the QML file in the \l {QML Viewer}:
(On Mac OS X, you can launch the "QMLViewer" application instead.)
-Notice the "import Music 1.0" statement has disappeared from \c app.qml. This is
+Notice the "import Charts 1.0" statement has disappeared from \c app.qml. This is
because the \c qmldir file is in the same directory as \c app.qml: this is equivalent to
-having Musician.qml and Instrument.qml files inside the project directory, which could both
+having PieChart.qml and PieSlice.qml files inside the project directory, which could both
be used by \c app.qml without import statements.
*/
+
/*!
-\page qml-extending-tutorial6.html
-\title Chapter 6: In Summary
+\page qml-extending-tutorial7.html
+\title Chapter 7: In Summary
In this tutorial, we've shown the basic steps for creating a QML extension:
@@ -362,47 +460,33 @@ In this tutorial, we've shown the basic steps for creating a QML extension:
\o Add callable methods using Q_INVOKABLE or Qt slots, and connect to Qt signals with an \c onSignal syntax
\o Add property bindings by defining \l{Qt's Property System}{NOTIFY} signals
\o Define custom property types if the built-in types are not sufficient
+\o Define list property types using QDeclarativeListProperty
\o Create a plugin library by defining a Qt plugin and writing a \c qmldir file
\endlist
The \l {Extending QML in C++} reference documentation shows other useful features that can be added to
-QML extensions. For example, we could use \l{Object and List Property Types}{list properties} to allow multiple instruments for a \c Musician:
-
-\code
- Musician {
- instruments: [
- Instrument { type: "Guitar" }
- Instrument { type: "Drums" }
- Instrument { type: "Keyboard" }
- ]
- }
-\endcode
-
-Or use \l{Default Property}{default properties} and avoid an
-\c instruments property altogether:
+QML extensions. For example, we could use \l{Default Property}{default properties} to allow
+slices to be added without using the \c slices property:
\code
- Musician {
- Instrument { type: "Guitar" }
- Instrument { type: "Drums" }
- Instrument { type: "Keyboard" }
+ PieChart {
+ PieSlice { ... }
+ PieSlice { ... }
+ PieSlice { ... }
}
\endcode
-Or even change the \c instrument of a \c Musician from time to time using \l{Property Value Sources}{property value sources}:
+Or randomly add and remove slices from time to time using \l{Property Value Sources}{property value sources}:
\code
- Musician {
- InstrumentRandomizer on instrument {}
+ PieChart {
+ PieSliceRandomizer on slices {}
}
\endcode
See the \l{Extending QML in C++}{reference documentation} for more information.
-Additionally, \l {Integrating QML with existing Qt UI code} shows how to create
-and integrate with QML extensions that have drawing and graphical capabilities (through QGraphicsWidget).
-
*/
diff --git a/doc/src/declarative/pics/extending-tutorial-chapter1.png b/doc/src/declarative/pics/extending-tutorial-chapter1.png
new file mode 100644
index 0000000..9f5836b
--- /dev/null
+++ b/doc/src/declarative/pics/extending-tutorial-chapter1.png
Binary files differ
diff --git a/doc/src/declarative/pics/extending-tutorial-chapter2.png b/doc/src/declarative/pics/extending-tutorial-chapter2.png
new file mode 100644
index 0000000..5c8f222
--- /dev/null
+++ b/doc/src/declarative/pics/extending-tutorial-chapter2.png
Binary files differ
diff --git a/doc/src/declarative/pics/extending-tutorial-chapter3.png b/doc/src/declarative/pics/extending-tutorial-chapter3.png
new file mode 100644
index 0000000..825553f
--- /dev/null
+++ b/doc/src/declarative/pics/extending-tutorial-chapter3.png
Binary files differ
diff --git a/doc/src/declarative/pics/extending-tutorial-chapter5.png b/doc/src/declarative/pics/extending-tutorial-chapter5.png
new file mode 100644
index 0000000..0c2e69e
--- /dev/null
+++ b/doc/src/declarative/pics/extending-tutorial-chapter5.png
Binary files differ
diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc
index 9126a79..3f1b184 100644
--- a/doc/src/declarative/qdeclarativeintro.qdoc
+++ b/doc/src/declarative/qdeclarativeintro.qdoc
@@ -314,7 +314,7 @@ Item {
\section2 Signal Handlers
-Signal handlers allow actions to be taken in reponse to an event. For instance,
+Signal handlers allow actions to be taken in response to an event. For instance,
the \l MouseArea element has signal handlers to handle mouse press, release
and click:
diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc
index b44e6f2..173002a 100644
--- a/doc/src/declarative/qdeclarativemodels.qdoc
+++ b/doc/src/declarative/qdeclarativemodels.qdoc
@@ -208,7 +208,10 @@ Models can be defined in C++ and then made available to QML. This is useful
for exposing existing C++ data models or otherwise complex datasets to QML.
A C++ model class can be defined as a QStringList, a QList<QObject*> or a
-QAbstractItemModel.
+QAbstractItemModel. The first two are useful for exposing simpler datasets,
+while QAbstractItemModel provides a more flexible solution for more complex
+models.
+
\section2 QStringList
@@ -268,7 +271,10 @@ the model by calling QDeclarativeContext::setContextProperty() again.
\section2 QAbstractItemModel
-A model can be defined by subclassing QAbstractItemModel.
+A model can be defined by subclassing QAbstractItemModel. This is the
+best approach if you have a more complex model that cannot be supported
+by the other approaches. A QAbstractItemModel can also automatically
+notify a QML view when the model data has changed.
The roles of a QAbstractItemModel subclass can be exposed to QML by calling
QAbstractItemModel::setRoleNames(). The default role names set by Qt are:
@@ -305,6 +311,12 @@ roles:
\snippet examples/declarative/modelviews/abstractitemmodel/view.qml 0
+QML views are automatically updated when the model changes. Remember the model
+must follow the standard rules for model changes and notify the view when
+the model has changed by using QAbstractItemModel::dataChanged(),
+QAbstractItemModel::beginInsertRows(), etc. See the \l {Model subclassing reference} for
+more information.
+
The complete example is available in Qt's \l {declarative/modelviews/abstractitemmodel}{examples/declarative/modelviews/abstractitemmodel} directory.
QAbstractItemModel presents a hierarchy of tables, but the views currently provided by QML
@@ -429,4 +441,77 @@ Rectangle {
}
\endcode
+\section1 Accessing Views and Models from Delegates
+
+You can access the view for which a delegate is used, and its
+properties, by using ListView.view in a delegate on a ListView, or
+GridView.view in a delegate on a GridView, etc. In particular, you can
+access the model and its properties by using ListView.view.model.
+
+This is useful when you want to use the same delegate for a number of
+views, for example, but you want decorations or other features to be
+different for each view, and you would like these different settings to
+be properties of each of the views. Similarly, it might be of interest
+to access or show some properties of the model.
+
+In the following example, the delegate shows the property \e{language}
+of the model, and the color of one of the fields depends on the
+property \e{fruit_color} of the view.
+
+\code
+Rectangle {
+ width: 200; height: 200
+
+ ListModel {
+ id: fruitModel
+ property string language: "en"
+ ListElement {
+ name: "Apple"
+ cost: 2.45
+ }
+ ListElement {
+ name: "Orange"
+ cost: 3.25
+ }
+ ListElement {
+ name: "Banana"
+ cost: 1.95
+ }
+ }
+
+ Component {
+ id: fruitDelegate
+ Row {
+ Text { text: " Fruit: " + name; color: ListView.view.fruit_color }
+ Text { text: " Cost: $" + cost }
+ Text { text: " Language: " + ListView.view.model.language }
+ }
+ }
+
+ ListView {
+ property color fruit_color: "green"
+ model: fruitModel
+ delegate: fruitDelegate
+ anchors.fill: parent
+ }
+}
+\endcode
+
+Another important case is when some action (e.g. mouse click) in the
+delegate should update data in the model. In this case you can define
+a function in the model, e.g.:
+
+\code
+ setData(int row, const QString & field_name, QVariant new_value),
+\endcode
+
+...and call it from the delegate using:
+
+\code
+ ListView.view.model.setData(index, field, value)
+\endcode
+
+...assuming that \e{field} holds the name of the field which should be
+updated, and that \e{value} holds the new value.
+
*/
diff --git a/doc/src/examples/movie.qdoc b/doc/src/examples/movie.qdoc
index 733f52d..4d7b3e0 100644
--- a/doc/src/examples/movie.qdoc
+++ b/doc/src/examples/movie.qdoc
@@ -30,8 +30,8 @@
\title Movie Example
The Movie example demonstrates how to use QMovie and QLabel to
- display animations. Now that Qt comes with \l{Phonon
- Overview}{Phonon} (the multimedia framework), QMovie is mostly
+ display animations. Now that Qt comes with the \l{Phonon multimedia
+ framework} {Phonon multimedia framework}, QMovie is mostly
useful if one wants to play a simple animation without the added
complexity of a multimedia framework to install and deploy.
diff --git a/doc/src/examples/trafficinfo.qdoc b/doc/src/examples/trafficinfo.qdoc
index fe69d52..bc06178 100644
--- a/doc/src/examples/trafficinfo.qdoc
+++ b/doc/src/examples/trafficinfo.qdoc
@@ -145,5 +145,5 @@
The rest of the code in this example is just for representing the time and
station information to the user, and uses techniques described in the
- \l{Widgets Examples}.
+ \l{Widget Examples}.
*/
diff --git a/doc/src/frameworks-technologies/dnd.qdoc b/doc/src/frameworks-technologies/dnd.qdoc
index 4a1b631..c5dd27c 100644
--- a/doc/src/frameworks-technologies/dnd.qdoc
+++ b/doc/src/frameworks-technologies/dnd.qdoc
@@ -45,7 +45,7 @@
outlines the approach used to enable it in custom widgets. Drag
and drop operations are also supported by Qt's item views and by
the graphics view framework. More information is available in
- \l{Using Drag and Drop with Item Views} and \l{Graphics View
+ \l{Using drag & drop with item views} and \l{Graphics View
Framework}.
\section1 Drag and Drop Classes
diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc
index 94b9f0d..131f063 100644
--- a/doc/src/frameworks-technologies/model-view-programming.qdoc
+++ b/doc/src/frameworks-technologies/model-view-programming.qdoc
@@ -900,7 +900,7 @@
after its application through the use of certain types of selection
commands. These are discussed later in this section.
- \section3 Current item &amp selected items
+ \section3 Current item and selected items
In a view, there is always a current item and a selected item - two
independent states. An item can be the current item and selected at the
@@ -1257,7 +1257,7 @@
reimplement the \l{QAbstractItemModel::columnCount()}{columnCount()}
function.
- \section3 Model headers &amp data
+ \section3 Model headers and data
For items in the view, we want to return the strings in the string list.
The \l{QAbstractItemModel::data()}{data()} function is responsible for
@@ -1350,7 +1350,7 @@
\snippet doc/src/snippets/stringlistmodel/model.cpp 1
- \section3 Inserting &amp removing rows
+ \section3 Inserting and removing rows
It is possible to change the number of rows and columns in a model. In the
string list model it only makes sense to change the number of rows, so we
@@ -1634,7 +1634,7 @@
contain the text given in the search string. This pattern can also be
used in the list and table widgets.
- \section1 Using drag &amp drop with item views
+ \section1 Using drag & drop with item views
Qt's drag and drop infrastructure is fully supported by the model/view framework.
Items in lists, tables, and trees can be dragged within the views, and data can be
@@ -1714,7 +1714,7 @@
of QAbstractItemModel::removeRows(), either directly or by inheriting the
implementation from its base class.
- \section3 Enabling drag &amp drop for items
+ \section3 Enabling drag & drop for items
Models indicate to views which items can be dragged, and which will accept drops,
by reimplementing the QAbstractItemModel::flags() function to provide suitable
@@ -2124,12 +2124,12 @@
children may be displayed incorrectly in some views until the user
attempts to view the non-existent child items.
- \section2 Navigation &amp model index creation
+ \section2 Navigation and model index creation
Hierarchical models need to provide functions that views can call to navigate the
tree-like structures they expose, and obtain model indexes for items.
- \section3 Parents &amp children
+ \section3 Parents and children
Since the structure exposed to views is determined by the underlying data
structure, it is up to each model subclass to create its own model indexes
@@ -2153,7 +2153,7 @@
models to supply some unique identifier to this function to ensure that
the model index can be re-associated with its corresponding item later on.
- \section2 Drag &amp drop support and MIME type handling
+ \section2 Drag & drop support and MIME type handling
The model/view classes support drag and drop operations, providing default behavior
that is sufficient for many applications. However, it is also possible to customize
@@ -2282,7 +2282,7 @@
\endlist
For more information about drag and drop with item views, refer to
- \l{Using Drag and Drop with Item Views}.
+ \l{Using drag & drop with item views}.
\section3 Convenience views
@@ -2293,7 +2293,7 @@
the existing contents with the data being transferred, the underlying model
will set the data of the target items rather than insert new rows and columns
into the model. For more information on drag and drop in convenience views,
- you can see \l{Using Drag and Drop with Item Views}.
+ you can see \l{Using drag & drop with item views}.
\section2 Performance optimization for large amounts of data
diff --git a/doc/src/frameworks-technologies/phonon.qdoc b/doc/src/frameworks-technologies/phonon.qdoc
index 023b4ce..5119638 100644
--- a/doc/src/frameworks-technologies/phonon.qdoc
+++ b/doc/src/frameworks-technologies/phonon.qdoc
@@ -34,6 +34,7 @@
\tableofcontents
+ \target Phonon Overview
\section1 Introduction
Qt uses the Phonon multimedia framework to provide functionality
diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc
index b6766d5..a32d120 100644
--- a/doc/src/getting-started/examples.qdoc
+++ b/doc/src/getting-started/examples.qdoc
@@ -343,8 +343,8 @@
/*!
\page examples-draganddrop.html
\ingroup all-examples
- \title Drag &amp Drop Examples
- \brief How to access your platform's native darg &amp drop functionality
+ \title Drag &amp; Drop Examples
+ \brief How to access your platform's native darg &amp; drop functionality
\image draganddrop-examples.png
diff --git a/doc/src/getting-started/tutorials.qdoc b/doc/src/getting-started/tutorials.qdoc
index 6e1cee8..0a83170 100644
--- a/doc/src/getting-started/tutorials.qdoc
+++ b/doc/src/getting-started/tutorials.qdoc
@@ -71,6 +71,18 @@
A guided tour through the translations process, explaining the
tools provided for developers, translators and release managers.
+
+ \row
+ \o{2,1} \l{modelview.html}{\bold{ModelView}}
+ \o{2,1}
+
+ \row
+ \o \image treeview_sml.png ModelView
+ \o This tutorial gives an introduction to ModelView programming using the Qt cross-platform framework
+
+ \o
+ \o
+
\row
\o{2,1} \l{QTestLib Tutorial}{\bold QTestLib}
\o{2,1} \l{qmake Tutorial}{\bold qmake}
diff --git a/doc/src/images/clock.png b/doc/src/images/clock.png
new file mode 100755
index 0000000..c7f6a1b
--- /dev/null
+++ b/doc/src/images/clock.png
Binary files differ
diff --git a/doc/src/images/columnview.png b/doc/src/images/columnview.png
new file mode 100644
index 0000000..127b795
--- /dev/null
+++ b/doc/src/images/columnview.png
Binary files differ
diff --git a/doc/src/images/combobox.png b/doc/src/images/combobox.png
new file mode 100755
index 0000000..d172b41
--- /dev/null
+++ b/doc/src/images/combobox.png
Binary files differ
diff --git a/doc/src/images/dummy_tree.png b/doc/src/images/dummy_tree.png
new file mode 100755
index 0000000..7373ea6
--- /dev/null
+++ b/doc/src/images/dummy_tree.png
Binary files differ
diff --git a/doc/src/images/edit.png b/doc/src/images/edit.png
new file mode 100755
index 0000000..161b06f
--- /dev/null
+++ b/doc/src/images/edit.png
Binary files differ
diff --git a/doc/src/images/example_model.png b/doc/src/images/example_model.png
new file mode 100755
index 0000000..4261261
--- /dev/null
+++ b/doc/src/images/example_model.png
Binary files differ
diff --git a/doc/src/images/header.png b/doc/src/images/header.png
new file mode 100755
index 0000000..2597635
--- /dev/null
+++ b/doc/src/images/header.png
Binary files differ
diff --git a/doc/src/images/lineedit.png b/doc/src/images/lineedit.png
new file mode 100755
index 0000000..83d1c47
--- /dev/null
+++ b/doc/src/images/lineedit.png
Binary files differ
diff --git a/doc/src/images/list_table_tree.png b/doc/src/images/list_table_tree.png
new file mode 100755
index 0000000..b2daf1f
--- /dev/null
+++ b/doc/src/images/list_table_tree.png
Binary files differ
diff --git a/doc/src/images/listview.png b/doc/src/images/listview.png
new file mode 100755
index 0000000..fa49c52
--- /dev/null
+++ b/doc/src/images/listview.png
Binary files differ
diff --git a/doc/src/images/lotto.png b/doc/src/images/lotto.png
new file mode 100755
index 0000000..dd751cf
--- /dev/null
+++ b/doc/src/images/lotto.png
Binary files differ
diff --git a/doc/src/images/modelview.png b/doc/src/images/modelview.png
new file mode 100755
index 0000000..7b042af
--- /dev/null
+++ b/doc/src/images/modelview.png
Binary files differ
diff --git a/doc/src/images/path.png b/doc/src/images/path.png
new file mode 100755
index 0000000..73107ff
--- /dev/null
+++ b/doc/src/images/path.png
Binary files differ
diff --git a/doc/src/images/qcompleter.png b/doc/src/images/qcompleter.png
new file mode 100755
index 0000000..d25caac
--- /dev/null
+++ b/doc/src/images/qcompleter.png
Binary files differ
diff --git a/doc/src/images/readonlytable.png b/doc/src/images/readonlytable.png
new file mode 100755
index 0000000..90bcba4
--- /dev/null
+++ b/doc/src/images/readonlytable.png
Binary files differ
diff --git a/doc/src/images/readonlytable_role.png b/doc/src/images/readonlytable_role.png
new file mode 100755
index 0000000..7d2d416
--- /dev/null
+++ b/doc/src/images/readonlytable_role.png
Binary files differ
diff --git a/doc/src/images/selection2.png b/doc/src/images/selection2.png
new file mode 100755
index 0000000..66c757f
--- /dev/null
+++ b/doc/src/images/selection2.png
Binary files differ
diff --git a/doc/src/images/standardwidget.png b/doc/src/images/standardwidget.png
new file mode 100755
index 0000000..3ccccf1
--- /dev/null
+++ b/doc/src/images/standardwidget.png
Binary files differ
diff --git a/doc/src/images/tableview.png b/doc/src/images/tableview.png
new file mode 100755
index 0000000..8be1b6c
--- /dev/null
+++ b/doc/src/images/tableview.png
Binary files differ
diff --git a/doc/src/images/tree.png b/doc/src/images/tree.png
new file mode 100755
index 0000000..3f046c9
--- /dev/null
+++ b/doc/src/images/tree.png
Binary files differ
diff --git a/doc/src/images/tree_2.png b/doc/src/images/tree_2.png
new file mode 100755
index 0000000..6ee1f4a
--- /dev/null
+++ b/doc/src/images/tree_2.png
Binary files differ
diff --git a/doc/src/images/tree_2_with_algorithm.png b/doc/src/images/tree_2_with_algorithm.png
new file mode 100755
index 0000000..ecf9101
--- /dev/null
+++ b/doc/src/images/tree_2_with_algorithm.png
Binary files differ
diff --git a/doc/src/images/tree_city.png b/doc/src/images/tree_city.png
new file mode 100755
index 0000000..57f03d9
--- /dev/null
+++ b/doc/src/images/tree_city.png
Binary files differ
diff --git a/doc/src/images/treeview.png b/doc/src/images/treeview.png
new file mode 100755
index 0000000..af31fe9
--- /dev/null
+++ b/doc/src/images/treeview.png
Binary files differ
diff --git a/doc/src/images/treeview_sml.png b/doc/src/images/treeview_sml.png
new file mode 100755
index 0000000..fb6de1d
--- /dev/null
+++ b/doc/src/images/treeview_sml.png
Binary files differ
diff --git a/doc/src/images/widgetmapper.png b/doc/src/images/widgetmapper.png
new file mode 100755
index 0000000..9627088
--- /dev/null
+++ b/doc/src/images/widgetmapper.png
Binary files differ
diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc
index 18a1746..b5e73ed 100644
--- a/doc/src/index.qdoc
+++ b/doc/src/index.qdoc
@@ -44,7 +44,7 @@
<li><a href="installation.html">Installation &amp; first steps</a></li>
<li><a href="how-to-learn-qt.html">How to learn Qt</a></li>
<li><a href="tutorials.html">Tutorials</a></li>
- <li><a href="examples.html">Examples</a></li>
+ <li><a href="all-examples.html">Examples</a></li>
<li><a href="qt4-7-intro.html">Whats new in Qt 4.7</a></li>
</ul>
</div>
@@ -56,30 +56,29 @@
<div class="indexboxcont indexboxbar ">
<div class="sectionlist tricol">
<ul>
- <li><a href="classes.html">Class index</a></li>
- <li><a href="functions.html">Function index</a></li>
- <li><a href="modules.html">Modules</a></li>
- <li><a href="namespaces.html">Namespaces</a></li>
- <li><a href="qtglobal.html">Global stuff</a></li>
- <li><a href="qdeclarativeelements.html">QML elements</a></li>
+ <li><a href="classes.html">Class index</a></li>
+ <li><a href="functions.html">Function index</a></li>
+ <li><a href="modules.html">Modules</a></li>
+ <li><a href="namespaces.html">Namespaces</a></li>
+ <li><a href="qtglobal.html">Global Declarations</a></li>
</ul>
</div>
<div class="sectionlist tricol">
<ul>
- <li><a href="qt-basic-concepts.html">Basic Qt Architecture</a></li>
- <li><a href="declarativeui.html">Device UI's &amp; Qt Quick</a></li>
- <li><a href="qt-gui-concepts.html">Desktop UI components</a></li>
- <li><a href="platform-specific.html">Platform-specific info</a></li>
- <li><a href="qt-graphics.html">Graphics, Painting &amp; Printing</a></li>
- <li><a href="qt-network.html">Input/Output &amp; networking</a></li>
+ <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>
+ <li><a href="qt-basic-concepts.html">Qt Architecture</a></li>
+ <li><a href="developing-with-qt.html">Cross-platform &amp; Platform-specific Development</a></li>
+ <li><a href="technology-apis.html">Qt &amp; standard technologies </a></li>
+ <li><a href="best-practices.html">Qt How-to's &amp; best practices</a></li>
</ul>
</div>
<div class="sectionlist">
<ul>
- <li><a href="model-view-programming.html">Model/View programming</a></li>
- <li><a href="technology-apis.html">Qt API's for other technologies</a></li>
- <li><a href="best-practices.html">Qt How-to's &amp; best practices</a></li>
- <li><a href="developing-with-qt.html">Cross-platform development</a></li>
+ <li><a href="declarativeui.html">Qt Quick</a></li>
+ <li><a href="qdeclarativeintroduction.html">Introduction to QML</a></li>
+ <li><a href="qdeclarativeelements.html">QML Elements</a></li>
+ <li><a href="qt-gui-concepts.html">UI components</a></li>
+ <li><a href="declarativeui.html">Qt & GUI design</a></li>
</ul>
</div>
</div>
@@ -104,7 +103,7 @@
</ul>
</div>
</div>
- </div>
+ </div>
\endraw
*/
diff --git a/doc/src/legal/3rdparty.qdoc b/doc/src/legal/3rdparty.qdoc
index 110dac7..e7133e3 100644
--- a/doc/src/legal/3rdparty.qdoc
+++ b/doc/src/legal/3rdparty.qdoc
@@ -194,16 +194,16 @@
\hr
copyright (C) 1999 by Willem van Schaik <willem@schaik.com>
-
+
version 1.0 - 1999.10.15 - First version.
-
+
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear in
supporting documentation. This software is provided "as is" without
express or implied warranty.
-
+
\hr
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
@@ -293,7 +293,7 @@
Copyright (c) 1987, 1993, 1994\br
The Regents of the University of California. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:\br
@@ -305,7 +305,7 @@
3. Neither the name of the University 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 REGENTS 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
@@ -336,7 +336,7 @@
Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\br
Copyright (c( 1996 USAF Phillips Laboratory\br
Additions (c) Richard Nolde 2006-2009
-
+
Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee, provided
that (i) the above copyright notices and this permission notice appear in
@@ -344,11 +344,11 @@
Sam Leffler and Silicon Graphics may not be used in any advertising or
publicity relating to the software without the specific, prior written
permission of Sam Leffler and Silicon Graphics.
-
+
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
+
IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
@@ -360,11 +360,11 @@
Copyright (c) 1985, 1986 The Regents of the University of California.\br
All rights reserved.
-
+
This code is derived from software contributed to Berkeley by
James A. Woods, derived from original work by Spencer Thomas
and Joseph Orost.
-
+
Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all such forms and that any documentation,
@@ -381,7 +381,7 @@
Copyright (c) 1996-1997 Sam Leffler\br
Copyright (c) 1996 Pixar
-
+
Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee, provided
that (i) the above copyright notices and this permission notice appear in
@@ -389,11 +389,11 @@
Pixar, Sam Leffler and Silicon Graphics may not be used in any advertising or
publicity relating to the software without the specific, prior written
permission of Pixar, Sam Leffler and Silicon Graphics.
-
+
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
+
IN NO EVENT SHALL PIXAR, SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
@@ -423,8 +423,6 @@
\section1 JavaScriptCore
- \hr
-
Copyright (c) 1991, 2000, 2001 by Lucent Technologies.\br
Copyright (C) 2002, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
@@ -441,6 +439,60 @@
See \c src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp for license details.
+ \hr
+
+ Copyright (C) 2009 Company 100, Inc. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:\br
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.\br
+ 2. 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.
+
+ THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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.
+
+ \hr
+
+ Copyright (C) 2009 Apple Inc. All rights reserved.\br
+ Copyright (C) 2009 University of Szeged\br
+ All rights reserved.\br
+ Copyright (C) 2010 MIPS Technologies, Inc. All rights reserved.\br
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:\br
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.\br
+ 2. 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.
+
+ THIS SOFTWARE IS PROVIDED BY MIPS TECHNOLOGIES, INC. ``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 MIPS TECHNOLOGIES, INC. 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.
+
+
\section1 Pixman (\c pixman) version 0.17.11
\e{pixman is a library that provides low-level pixel manipulation
@@ -479,4 +531,156 @@
See \c src/3rdparty/pixman/pixman-arm-neon-asm.h and
\c src/3rdparty/pixman/pixman-arm-neon-asm.S
+
+ \section1 WebCore (WebKit)
+
+ Copyright (C) 2009 Ericsson AB\br
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.\br
+ 2. 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.\br
+ 3. Neither the name of Ericsson 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.
+
+ \hr
+
+ Copyright (C) 2004, Apple Computer, Inc. and The Mozilla Foundation.\br
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.\br
+ 2. 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.\br
+ 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla
+ Foundation ("Mozilla") nor the names of their contributors may be used
+ to endorse or promote products derived from this software without
+ specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR 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 APPLE, MOZILLA OR
+ THEIR 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.
+
+ \hr
+
+ Copyright (C) 2009 Igalia S.L.\br
+ Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org>\br
+ Copyright (C) 2008 Christian Dywan <christian@imendio.com>\br
+ Copyright (C) 2007 Nicholas Shanks <contact@nickshanks.com>\br
+ Copyright (C) 2006 Charles Samuels <charles@kde.org>\br
+ Copyright (C) 2009 Dominik Röttsches <dominik.roettsches@access-company.com>\br
+ Copyright (C) 2009 Brent Fulgham\br
+ Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>\br
+ Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>\br
+ Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>\br
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:\br
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.\br
+ 2. 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.
+
+ THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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.
+
+ \hr
+
+ Copyright (C) 2007, 2008 Apple Inc. All rights reserved.\br
+ Copyright (C) IBM Corp. 2009 All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.\br
+ 2. 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.\br
+ 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ its contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.\br
+
+ THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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.
+
+ \hr
+
+ Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved.\br
+ Copyright (C) 2010 François Sausset (sausset@gmail.com). All rights reserved\br
+ Copyright (C) 2007 Marius Renn <damarvy@gmail.com> All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:\br
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.\br
+ 2. 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.
+
+ 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.
*/
diff --git a/doc/src/legal/licenses.qdoc b/doc/src/legal/licenses.qdoc
index 96d5d29..a04a256 100644
--- a/doc/src/legal/licenses.qdoc
+++ b/doc/src/legal/licenses.qdoc
@@ -328,7 +328,7 @@
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.
-
+
\list
\o Parts of WebKit used by the QtWebKit module
\endlist
@@ -716,6 +716,53 @@
\list
\o Parts of WebKit used by the QtWebKit module
\endlist
+
+ \hr
+
+ Copyright (c) 1991-2009 Unicode, Inc. All rights reserved.
+ Distributed under the Terms of Use in
+ http://www.unicode.org/copyright.html.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of the Unicode data files and any associated
+ documentation (the "Data Files") or Unicode software and any
+ associated documentation (the "Software") to deal in the Data
+ Files or Software without restriction, including without
+ limitation the rights to use, copy, modify, merge, publish,
+ distribute, and/or sell copies of the Data Files or Software,
+ and to permit persons to whom the Data Files or Software are
+ furnished to do so, provided that (a) the above copyright
+ notice(s) and this permission notice appear with all copies
+ of the Data Files or Software, (b) both the above copyright
+ notice(s) and this permission notice appear in associated
+ documentation, and (c) there is clear notice in each modified
+ Data File or in the Software as well as in the documentation
+ associated with the Data File(s) or Software that the data or
+ software has been modified.
+
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT
+ WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED
+ IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
+ OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES
+ OR SOFTWARE.
+
+ Except as contained in this notice, the name of a copyright
+ holder shall not be used in advertising or otherwise to promote
+ the sale, use or other dealings in these Data Files or Software
+ without prior written authorization of the copyright holder.
+
+ \list
+ \o Included in \c{util/unicode/data},
+ \c{tests/auto/qtextboundaryfinder/data} and
+ \c{tests/auto/qchar}
+ \o Parts of the \l makeqpf tool
+ \endlist
*/
/*!
diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc
index 22d858f..afb17c4 100644
--- a/doc/src/platforms/symbian-introduction.qdoc
+++ b/doc/src/platforms/symbian-introduction.qdoc
@@ -51,6 +51,7 @@
\o \l {Exception Safety with Symbian}
\o \l {Platform Notes - Symbian} {Qt for the Symbian platform - state of support}
\o \l {qmake Platform Notes#Symbian platform} {Qt for Symbian extensions for qmake}
+ \o \l {Symbian Platform Security Requirements} {Symbian Platform Security Requirements}
\endlist
\o
\list
@@ -60,6 +61,22 @@
*/
/*!
+ \page symbian-platform-security-requirements.html
+
+ \title Symbian Platform Security Requirements
+ \ingroup qtsymbian
+
+ On Symbian, processes that access media via the network must
+ have the \c NetworkServices platform security capability. If the client
+ process lacks this capability, operations will result in errors.
+ This failure is indicated by a state() of Phonon::ErrorState.
+
+ Platform security capabilities are added via the
+ \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY}
+ qmake variable.
+*/
+
+/*!
\page symbian-with-qt-introduction.html
\title The Symbian platform - Introduction to Qt
diff --git a/doc/src/snippets/declarative/coloranimation.qml b/doc/src/snippets/declarative/coloranimation.qml
new file mode 100644
index 0000000..4e35f22
--- /dev/null
+++ b/doc/src/snippets/declarative/coloranimation.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import Qt 4.7
+
+Rectangle {
+ width: 100; height: 100
+ color: "red"
+
+ ColorAnimation on color { to: "yellow"; duration: 1000 }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/numberanimation.qml b/doc/src/snippets/declarative/numberanimation.qml
new file mode 100644
index 0000000..57d23b1
--- /dev/null
+++ b/doc/src/snippets/declarative/numberanimation.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import Qt 4.7
+
+Rectangle {
+ width: 100; height: 100
+ color: "red"
+
+ NumberAnimation on x { to: 50; duration: 1000 }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/propertyanimation.qml b/doc/src/snippets/declarative/propertyanimation.qml
new file mode 100644
index 0000000..059cde5
--- /dev/null
+++ b/doc/src/snippets/declarative/propertyanimation.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Row {
+
+//![transition]
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ states: State {
+ name: "moved"
+ PropertyChanges { target: rect; x: 50 }
+ }
+
+ transitions: Transition {
+ PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }
+ }
+}
+//![transition]
+
+//![behavior]
+Rectangle {
+ width: 100; height: 100
+ color: "red"
+
+ Behavior on x { PropertyAnimation {} }
+
+ MouseArea { anchors.fill: parent; onClicked: parent.x = 50 }
+}
+//![behavior]
+
+//![propertyvaluesource]
+Rectangle {
+ width: 100; height: 100
+ color: "red"
+
+ SequentialAnimation on x {
+ loops: Animation.Infinite
+ PropertyAnimation { to: 50 }
+ PropertyAnimation { to: 0 }
+ }
+}
+//![propertyvaluesource]
+
+//![standalone]
+Rectangle {
+ id: theRect
+ width: 100; height: 100
+ color: "red"
+
+ // this is a standalone animation, it's not running by default
+ PropertyAnimation { id: animation; target: theRect; property: "width"; to: 30; duration: 500 }
+
+ MouseArea { anchors.fill: parent; onClicked: animation.running = true }
+}
+//![standalone]
+
+
+}
diff --git a/doc/src/snippets/declarative/smoothedanimation.qml b/doc/src/snippets/declarative/smoothedanimation.qml
new file mode 100644
index 0000000..20c90b5
--- /dev/null
+++ b/doc/src/snippets/declarative/smoothedanimation.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import Qt 4.7
+
+Rectangle {
+ width: 800; height: 600
+ color: "blue"
+
+ Rectangle {
+ width: 60; height: 60
+ x: rect1.x - 5; y: rect1.y - 5
+ color: "green"
+
+ Behavior on x { SmoothedAnimation { velocity: 200 } }
+ Behavior on y { SmoothedAnimation { velocity: 200 } }
+ }
+
+ Rectangle {
+ id: rect1
+ width: 50; height: 50
+ color: "red"
+ }
+
+ focus: true
+ Keys.onRightPressed: rect1.x = rect1.x + 100
+ Keys.onLeftPressed: rect1.x = rect1.x - 100
+ Keys.onUpPressed: rect1.y = rect1.y - 100
+ Keys.onDownPressed: rect1.y = rect1.y + 100
+}
+//![0]
diff --git a/doc/src/snippets/declarative/springanimation.qml b/doc/src/snippets/declarative/springanimation.qml
new file mode 100644
index 0000000..b73a9d2
--- /dev/null
+++ b/doc/src/snippets/declarative/springanimation.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import Qt 4.7
+
+Rectangle {
+ width: 300; height: 300
+
+ Rectangle {
+ id: rect
+ width: 50; height: 50
+ color: "red"
+
+ Behavior on x { SpringAnimation { spring: 2; damping: 0.2 } }
+ Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ rect.x = mouse.x
+ rect.y = mouse.y
+ }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/state.qml b/doc/src/snippets/declarative/state.qml
index a99c2e2..af6b103 100644
--- a/doc/src/snippets/declarative/state.qml
+++ b/doc/src/snippets/declarative/state.qml
@@ -44,26 +44,13 @@ import Qt 4.7
Rectangle {
id: myRect
width: 100; height: 100
- color: "black"
+ color: "red"
- states: [
- State {
- name: "clicked"
- PropertyChanges {
- target: myRect
- color: "red"
- }
- }
- ]
+ MouseArea { id: mouseArea; anchors.fill: parent }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (myRect.state == "") // i.e. the default state
- myRect.state = "clicked";
- else
- myRect.state = "";
- }
+ states: State {
+ name: "hidden"; when: mouseArea.pressed
+ PropertyChanges { target: myRect; opacity: 0 }
}
}
//![0]
diff --git a/doc/src/snippets/declarative/transition-from-to.qml b/doc/src/snippets/declarative/transition-from-to.qml
new file mode 100644
index 0000000..615de17
--- /dev/null
+++ b/doc/src/snippets/declarative/transition-from-to.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import Qt 4.7
+
+//![0]
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea { id: mouseArea; anchors.fill: parent }
+
+ states: State {
+ name: "brighter"; when: mouseArea.pressed
+ PropertyChanges { target: rect; color: "yellow" }
+ }
+
+ transitions: Transition {
+ ColorAnimation { duration: 1000 }
+ }
+}
+//![0]
+
+
diff --git a/doc/src/snippets/declarative/transition-reversible.qml b/doc/src/snippets/declarative/transition-reversible.qml
new file mode 100644
index 0000000..8a7b69a
--- /dev/null
+++ b/doc/src/snippets/declarative/transition-reversible.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import Qt 4.7
+
+//![0]
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea { id: mouseArea; anchors.fill: parent }
+
+ states: State {
+ name: "brighter"
+ when: mouseArea.pressed
+ PropertyChanges { target: rect; color: "yellow"; x: 50 }
+ }
+
+ transitions: Transition {
+ SequentialAnimation {
+ PropertyAnimation { property: "x"; duration: 1000 }
+ ColorAnimation { duration: 1000 }
+ }
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/transition.qml b/doc/src/snippets/declarative/transition.qml
new file mode 100644
index 0000000..b884750
--- /dev/null
+++ b/doc/src/snippets/declarative/transition.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ states: State {
+ name: "moved"
+ PropertyChanges { target: rect; x: 50; y: 50 }
+ }
+
+ transitions: Transition {
+ PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }
+ }
+}
+//![0]
+
diff --git a/doc/src/template/style/OfflineStyle.css b/doc/src/template/style/OfflineStyle.css
index afa7de0..9f5d28b 100644
--- a/doc/src/template/style/OfflineStyle.css
+++ b/doc/src/template/style/OfflineStyle.css
@@ -1,588 +1,26 @@
@media screen
{
- html
- {
- color: #000000;
- background: #FFFFFF;
- }
- body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td
- {
- margin: 0;
- padding: 0;
- }
- table
- {
- border-collapse: collapse;
- border-spacing: 0;
- }
- fieldset, img
- {
- border: 0;
- }
- address, caption, cite, code, dfn, em, strong, th, var, optgroup
- {
- font-style: inherit;
- font-weight: inherit;
- }
- del, ins
- {
- text-decoration: none;
- }
- li
- {
- list-style: none;
- }
- caption, th
- {
- text-align: left;
- }
- h1, h2, h3, h4, h5, h6
- {
- font-size: 100%;
- }
- q:before, q:after
- {
- content: '';
- }
- abbr, acronym
- {
- border: 0;
- font-variant: normal;
- }
- sup
- {
- vertical-align: baseline;
- }
- sub
- {
- vertical-align: baseline;
- }
- tt, .qmlreadonly span, .qmldefault span
- {
- word-spacing:5px;
- }
- .heading
- {
- font: normal 600 16px/1.0 Arial;
- }
- .subtitle
- {
- font-size: 13px;
- }
- .small-subtitle
- {
- font-size: 13px;
- }
- legend
- {
- color: #000000;
- }
- input, button, textarea, select, optgroup, option
- {
- font-family: inherit;
- font-size: inherit;
- font-style: inherit;
- font-weight: inherit;
- }
- input, button, textarea, select
- {
- font-size: 100%;
- }
- body
- {
- font: normal 13px/1.2 Verdana;
- color: #363534;
- }
- strong
- {
- font-weight: bold;
- }
- em
- {
- font-style: italic;
- }
- a
- {
- color: #00732f;
- text-decoration: none;
- }
- .header, .footer, .wrapper
- {
- /*min-width: 600px;*/
- max-width: 1500px;
- margin: 0 5px;
- }
+
.wrapper
{
- position:relative;
top:50px;
+ background: none;
+
}
.wrapper .bd
{
+ background: none;
position: relative;
}
- .header, .footer
- {
- display: block;
- clear: both;
- overflow: hidden;
- }
- .header
- {
- height: 115px;
- position: relative;
- }
-
-
- .header .qtref
- {
- position: absolute;
- top: 28px;
- left: 88px;
- width: 302px;
- height: 22px;
- }
- .header .qtref span
- {
- display: block;
- height: 22px;
- }
- .wrap .content h1
- {
- font: 600 18px/1.2 Arial;
- }
- .wrap .content h2
- {
- font: 600 16px/1.2 Arial;
- }
- .wrap .content h3
- {
- font: 600 14px/1.2 Arial;
- }
- .wrap .content h4
- {
- font: 600 12px/1.2 Arial;
- }
-
- .wrap .content p
- {
- line-height: 20px;
- padding: 5px;
- }
- .wrap .content table p
- {
- line-height: 20px;
- padding: 0px;
- }
- .wrap .content ul
- {
- padding-left: 25px;
- padding-top: 10px;
- }
- a:hover
- {
- color: #4c0033;
- text-decoration: underline;
- }
- .content a:visited
- {
- color: #4c0033;
- text-decoration: none;
- }
- .content a:visited:hover
- {
- color: #4c0033;
- text-decoration: underline;
- }
-
- pre
- {
- border: 1px solid #DDDDDD;
- margin: 0 20px 10px 10px;
- padding: 20px 15px 20px 20px;
- overflow-x: auto;
- }
- table, pre
- {
- -moz-border-radius: 7px 7px 7px 7px;
- background-color: #F6F6F6;
- border: 1px solid #E6E6E6;
- border-collapse: separate;
- font-size: 11px;
- /*min-width: 395px;*/
- margin-bottom: 25px;
- display: inline-block;
- }
- thead
- {
- margin-top: 5px;
- font:600 12px/1.2 Arial;
- }
- th
- {
- padding: 5px 15px 5px 15px;
- background-color: #E1E1E1;
- /* border-bottom: 1px solid #E6E6E6;*/
- border-left: 1px solid #E6E6E6;
- /* border-right: 1px solid #E6E6E6;*/
- }
- td
- {
- padding: 3px 15px 3px 20px;
- /* border-left: 1px solid #E6E6E6;
- border-right: 1px solid #E6E6E6;*/
- }
- tr.odd td:hover, tr.even td:hover
- {
- /* border-right: 1px solid #C3C3C3;
- border-left: 1px solid #C3C3C3;*/
- }
-
- td.rightAlign
- {
- padding: 3px 15px 3px 10px;
- }
- table tr.odd
- {
- border-left: 1px solid #E6E6E6;
- background-color: #F6F6F6;
- color: #66666E;
- }
- table tr.even
- {
- border-left: 1px solid #E6E6E6;
- background-color: #ffffff;
- color: #66666E;
- }
- table tr.odd td:hover, table tr.even td:hover
- {
- background-color: #E6E6E6;
- }
-
- span.comment
- {
- color: #8B0000;
- font-style: italic;
- }
- span.string, span.char
- {
- color: #254117;
- }
-
- .qmltype
- {
- text-align: center;
- font-size: 160%;
- }
- .qmlreadonly
- {
- float: right;
- color: #254117;
- }
-
- .qmldefault
- {
- float: right;
- color: red;
- }
-
- .footer
- {
- border-top:1px solid #E5E5E5;
- min-height: 100px;
- color: #797775;
- font: normal 9px/1 Verdana;
- text-align: center;
- padding-top: 40px;
- margin: 0;
- }
- .wrap
- {
- margin: 0 5px 0 5px;
- }
- .wrap .toolbar
- {
- display:block;
- }
-
- .wrap .breadcrumb ul li
- {
- float: left;
- background: url(../images/breadcrumb.png) no-repeat 0 5px;
- padding-left: 15px;
- margin-left: 15px;
- font-weight: bold;
- }
- .wrap .breadcrumb ul li.last
- {
- font-weight: normal;
- }
- .wrap .breadcrumb ul li a
- {
- /* color: #363534;*/
- color: #00732F;
- }
- .wrap .breadcrumb ul li.first
- {
- background-image: none;
- padding-left: 0;
- margin-left: 0;
- }
- .wrap .content
- {
- word-wrap:break-word;
- }
- .wrap .content li
- {
- /*padding-left: 12px;*/
- background: url(../images/bullet_sq.png) no-repeat 0 5px;
- font: normal 400 10pt/1 Verdana;
- /* color: #44a51c;*/
- margin-bottom: 10px;
- }
-
- .offline .wrap .content
- {
- padding-top: 15px;
- }
-
- .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after
- {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
- }
-
- hr
- {
- background-color: #E6E6E6;
- border: 1px solid #E6E6E6;
- height: 1px;
- width: 100%;
- text-align: left;
- margin: 5px 0px 5px 0px;
- }
-
- .content .alignedsummary
- {
- margin: 5px;
- width:100%;
- }
-
-
- .toc
- {
- float: right;
- -moz-border-radius: 7px 7px 7px 7px;
- background-color: #F6F6F6;
- border: 1px solid #DDDDDD;
- margin: 0 20px 10px 10px;
- padding: 20px 15px 20px 20px;
- height: auto;
- width: 200px;
- }
-
- .toc h3, .generic a
- {
- font: 600 12px/1.2 Arial;
- }
-
- .wrap .content .toc ul
- {
- padding-left: 0px;
- }
-
-
- .wrap .content .toc .level2
- {
- margin-left: 15px;
- }
-
- .wrap .content .toc .level3
- {
- margin-left: 30px;
- }
-
- .content .toc li
- {
- font: normal 10px/1.2 Verdana;
- background: url(../images/bullet_dn.png) no-repeat 0 5px;
- }
-
-
- .generic{
- max-width:75%;
- }
- .generic td{
- padding:0;
- }
-
- .generic .odd .alphaChar{
- background-color: #F6F6F6;
- }
-
- .generic .even .alphaChar{
- background-color: #FFFFFF;
- }
-
- .highlightedCode
- {
- margin:10px;
- }
-
- .flowList{
- vertical-align:top;
- }
- .alphaChar{
- width:100%;
- background-color:#F6F6F6;
- border:1px solid #E6E6E6;
- font-size:12pt;
- padding-left:10px;
- margin-top:10px;
- margin-bottom:10px;
- }
-
- .flowList dl{
- }
- .flowList dd{
- display:inline-block;
- margin-left:10px;
- width:250px;
- }
- .wrap .content .flowList p{
- padding:0px;
- }
-
- .relpage
- {
- -moz-border-radius: 7px 7px 7px 7px;
- border: 1px solid #DDDDDD;
- padding: 25px 25px;
- clear: both;
- }
- .relpage ul
- {
- float: none;
- padding: 15px;
- }
- .content .relpage li
- {
- font: normal 11px/1.2 Verdana;
- }
- h3.fn, span.fn
- {
- background-color: #F6F6F6;
- border-width: 1px;
- border-style: solid;
- border-color: #E6E6E6;
- font-weight: bold;
- word-spacing:3px;
- }
-
- .functionIndex {
- font-size:12pt;
- word-spacing:10px;
- margin-bottom:10px;
- background-color: #F6F6F6;
- border-width: 1px;
- border-style: solid;
- border-color: #E6E6E6;
- width:100%;
- }
-
- .centerAlign { text-align:center;}
- .rightAlign {text-align:right;}
- .leftAlign {text-align:left;}
- .topAlign{vertical-align:top }
- .functionIndex a{display:inline-block;}
-
- /* start index box */
- .indexbox
- {
- width: 100%;
- display:inline-block;
- }
-
- .indexboxcont { display: block; }
-
- .indexboxbar
- {
- border-bottom:1px solid #E5E5E5;
- margin-bottom: 25px;
- }
-
- .indexboxcont .section
- {
- display: inline-block;
- padding:0 2% 0 1%;
- vertical-align:top;
- }
-
- .indexboxcont .section {
- float: left;
- }
-
- .indexboxcont .section p
- {
- padding-top: 20px;
- padding-bottom: 20px;
- }
- .indexboxcont .sectionlist
- {
- display: inline-block;
- vertical-align:top;
- padding: 0;
- }
- .indexboxcont .sectionlist ul
- {
- margin-bottom: 20px;
- }
-
- .indexboxcont .sectionlist ul li
- {
- line-height: 12px;
- }
-
- .content .indexboxcont li
- {
- font: normal 600 13px/1 Verdana;
- }
-
- .indexbox a:hover, .indexbox a:visited:hover
- {
- color: #4c0033;
- text-decoration: underline;
- }
-
- .indexbox a:visited
- {
- color: #00732f;
- text-decoration: none;
- }
-
- .indexbox .indexIcon {
- width: 11%;
- }
-
-
- .indexboxcont:after
- {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
- }
-
+
body.offline
{
background-image: none;
+ background-color: #FFFFFF;
+
}
.offline .footer {
@@ -811,22 +249,3 @@ ul.sf-menu li li li.sfHover ul {
}
/* end of screen media */
-/* start of print media */
-
-@media print
-{
- input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft
- {
- display: none;
- background: none;
- }
- .content
- {
- position: absolute;
- top: 0px;
- left: 0px;
- background: none;
- display: block;
- }
-}
-/* end of print media */
diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css
index 184a832..9f80921 100755
--- a/doc/src/template/style/style.css
+++ b/doc/src/template/style/style.css
@@ -1,6 +1,8 @@
@media screen
{
- html
+
+/* basic elements */
+ html
{
color: #000000;
background: #FFFFFF;
@@ -18,8 +20,7 @@
fieldset, img
{
border: 0;
- height:100%;
- width:100%
+ max-width:100%;
}
address, caption, cite, code, dfn, em, strong, th, var, optgroup
{
@@ -41,7 +42,6 @@
h1, h2, h3, h4, h5, h6
{
font-size: 100%;
-/* font-weight: normal; */
}
q:before, q:after
{
@@ -52,11 +52,7 @@
border: 0;
font-variant: normal;
}
- sup
- {
- vertical-align: baseline;
- }
- sub
+ sup, sub
{
vertical-align: baseline;
}
@@ -64,19 +60,6 @@
{
word-spacing:5px;
}
- .heading
- {
- font: normal 600 16px/1.0 Arial;
- padding-bottom: 15px;
- }
- .subtitle
- {
- font-size: 13px;
- }
- .small-subtitle
- {
- font-size: 13px;
- }
legend
{
color: #000000;
@@ -92,9 +75,19 @@
{
font-size: 100%;
}
+ strong
+ {
+ font-weight: bold;
+ }
+ em
+ {
+ font-style: italic;
+ }
+
+ /* adding Qt theme */
html
{
- background-color: #e5e5e5;
+ /* background-color: #e5e5e5;*/
}
body
{
@@ -102,73 +95,115 @@
font: normal 13px/1.2 Verdana;
color: #363534;
}
- strong
+ a
{
- font-weight: bold;
+ color: #00732f;
+ text-decoration: none;
}
- em
+ hr
{
- font-style: italic;
+ background-color: #E6E6E6;
+ border: 1px solid #E6E6E6;
+ height: 1px;
+ width: 100%;
+ text-align: left;
+ margin: 15px 0px 15px 0px;
}
- a
+
+ pre
{
- color: #00732f;
- text-decoration: none;
+ border: 1px solid #DDDDDD;
+ -moz-border-radius: 7px 7px 7px 7px;
+ margin: 0 20px 10px 10px;
+ padding: 20px 15px 20px 20px;
+ overflow-x: auto;
}
- .header, .footer, .wrapper
+ table, pre
{
- min-width: 600px;
- max-width: 1500px;
- margin: 0 30px;
+ -moz-border-radius: 7px 7px 7px 7px;
+ background-color: #F6F6F6;
+ border: 1px solid #E6E6E6;
+ border-collapse: separate;
+ font-size: 11px;
+ margin-bottom: 25px;
}
- .wrapper
+ pre.highlightedCode {
+ display: block;
+ overflow:hidden;
+ }
+ thead
{
- background: url(../images/bg_r.png) repeat-y 100% 0;
+ margin-top: 5px;
+ font:600 12px/1.2 Arial;
}
- .wrapper .hd
+ th
{
- padding-left: 216px;
- height: 15px;
- background: url(../images/page.png) no-repeat 0 0;
- overflow: hidden;
+ padding: 5px 15px 5px 15px;
+ background-color: #E1E1E1;
+ border-left: 1px solid #E6E6E6;
}
- .offline .wrapper .hd
+ td
{
- background: url(../images/page.png) no-repeat 0 -15px;
+ padding: 3px 15px 3px 20px;
}
- .wrapper .hd span
+ tr.odd td:hover, tr.even td:hover {}
+
+ td.rightAlign
+ {
+ padding: 3px 5px 3px 10px;
+ }
+ table tr.odd
{
- height: 15px;
- display: block;
- overflow: hidden;
- background: url(../images/page.png) no-repeat 100% -30px;
+ border-left: 1px solid #E6E6E6;
+ background-color: #F6F6F6;
+ color: #66666E;
}
- .wrapper .bd
+ table tr.even
{
- background: url(../images/bg_l.png) repeat-y 0 0;
- position: relative;
+ border-left: 1px solid #E6E6E6;
+ background-color: #ffffff;
+ color: #66666E;
}
- .offline .wrapper .bd
+ table tr.odd td:hover, table tr.even td:hover
{
- background: url(../images/bg_l_blank.png) repeat-y 0 0;
+ /* background-color: #E6E6E6;*/ /* disabled until further notice */
}
- .wrapper .ft
+
+ span.comment
{
- padding-left: 216px;
- height: 15px;
- background: url(../images/page.png) no-repeat 0 -75px;
- overflow: hidden;
+ color: #8B0000;
+ font-style: italic;
}
- .offline .wrapper .ft
+ span.string, span.char
{
- background: url(../images/page.png) no-repeat 0 -90px;
+ color: #254117;
}
- .wrapper .ft span
+
+
+/* end basic elements */
+
+/* font style elements */
+ .heading
{
- height: 15px;
- display: block;
- background: url(../images/page.png) no-repeat 100% -60px;
- overflow: hidden;
+ font: normal bold 16px/1.0 Arial;
+ padding-bottom: 15px;
+ }
+ .subtitle
+ {
+ font-size: 13px;
+ }
+ .small-subtitle
+ {
+ font-size: 13px;
+ }
+/* end font style elements */
+
+/* global settings*/
+ .header, .footer, .wrapper
+ {
+ min-width: 600px;
+ max-width: 1500px;
+ margin: 0 30px;
}
.header, .footer
{
@@ -176,6 +211,17 @@
clear: both;
overflow: hidden;
}
+ .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after
+ {
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+ }
+
+/* end global settings*/
+/* header elements */
.header
{
height: 115px;
@@ -203,7 +249,247 @@
text-indent: -999em;
background: url(../images/sprites-combined.png) no-repeat -78px -235px;
}
+ .content a:visited
+ {
+ color: #4c0033;
+ text-decoration: none;
+ }
+ .content a:visited:hover
+ {
+ color: #4c0033;
+ text-decoration: underline;
+ }
+
+ #nav-topright
+ {
+ height: 70px;
+ }
+
+ #nav-topright ul
+ {
+ list-style-type: none;
+ float: right;
+ width: 370px;
+ margin-top: 11px;
+ }
+
+ #nav-topright li
+ {
+ display: inline-block;
+ margin-right: 20px;
+ float: left;
+ }
+
+ #nav-topright li.nav-topright-last
+ {
+ margin-right: 0;
+ }
+
+ #nav-topright li a
+ {
+ background: transparent url(../images/sprites-combined.png) no-repeat;
+ height: 18px;
+ display: block;
+ overflow: hidden;
+ text-indent: -9999px;
+ }
+
+ #nav-topright li.nav-topright-home a
+ {
+ width: 65px;
+ background-position: -2px -91px;
+ }
+
+ #nav-topright li.nav-topright-home a:hover
+ {
+ background-position: -2px -117px;
+ }
+
+
+ #nav-topright li.nav-topright-dev a
+ {
+ width: 30px;
+ background-position: -76px -91px;
+ }
+
+ #nav-topright li.nav-topright-dev a:hover
+ {
+ background-position: -76px -117px;
+ }
+
+
+ #nav-topright li.nav-topright-labs a
+ {
+ width: 40px;
+ background-position: -114px -91px;
+ }
+
+ #nav-topright li.nav-topright-labs a:hover
+ {
+ background-position: -114px -117px;
+ }
+
+ #nav-topright li.nav-topright-doc a
+ {
+ width: 32px;
+ background-position: -162px -91px;
+ }
+
+ #nav-topright li.nav-topright-doc a:hover, #nav-topright li.nav-topright-doc-active a
+ {
+ background-position: -162px -117px;
+ }
+
+ #nav-topright li.nav-topright-blog a
+ {
+ width: 40px;
+ background-position: -203px -91px;
+ }
+
+ #nav-topright li.nav-topright-blog a:hover, #nav-topright li.nav-topright-blog-active a
+ {
+ background-position: -203px -117px;
+ }
+
+ #nav-topright li.nav-topright-shop a
+ {
+ width: 40px;
+ background-position: -252px -91px;
+ }
+
+ #nav-topright li.nav-topright-shop a:hover, #nav-topright li.nav-topright-shop-active a
+ {
+ background-position: -252px -117px;
+ }
+
+ #nav-logo
+ {
+ background: transparent url(../images/sprites-combined.png ) no-repeat 0 -225px;
+ left: -3px;
+ position: absolute;
+ width: 75px;
+ height: 75px;
+ top: 13px;
+ }
+ #nav-logo a
+ {
+ width: 75px;
+ height: 75px;
+ display: block;
+ text-indent: -9999px;
+ overflow: hidden;
+ }
+
+
+ .shortCut-topleft-inactive
+ {
+ padding-left: 3px;
+ background: transparent url( ../images/sprites-combined.png) no-repeat 0px -58px;
+ height: 20px;
+ width: 47px;
+ }
+ .shortCut-topleft-inactive span
+ {
+ font-variant: normal;
+ }
+ .shortCut-topleft-inactive span a:hover, .shortCut-topleft-active a:hover
+ {
+ text-decoration:none;
+ }
+ #shortCut
+ {
+ padding-top: 10px;
+ font-weight: bolder;
+ color: #b0adab;
+ }
+ #shortCut ul
+ {
+ list-style-type: none;
+ float: left;
+ width: 347px;
+ margin-left: 100px;
+ }
+ #shortCut li
+ {
+ display: inline-block;
+ margin-right: 25px;
+ float: left;
+ white-space: nowrap;
+ }
+ #shortCut li a
+ {
+ color: #b0adab;
+ }
+ #shortCut li a:hover
+ {
+ color: #44a51c;
+ }
+
+
+
+/* end header elements */
+/* content and sidebar elements */
+ .wrapper
+ {
+ background: url(../images/bg_r.png) repeat-y 100% 0;
+ }
+ .wrapper .hd
+ {
+ padding-left: 216px;
+ height: 15px;
+ background: url(../images/page.png) no-repeat 0 0;
+ overflow: hidden;
+ }
+
+
+
+
+ .wrapper .hd span
+ {
+ height: 15px;
+ display: block;
+ overflow: hidden;
+ background: url(../images/page.png) no-repeat 100% -30px;
+ }
+ .wrapper .bd
+ {
+ background: url(../images/bg_l.png) repeat-y 0 0;
+ position: relative;
+ }
+
+
+
+
+ .wrapper .ft
+ {
+ padding-left: 216px;
+ height: 15px;
+ background: url(../images/page.png) no-repeat 0 -75px;
+ overflow: hidden;
+ }
+
+
+
+
+ .wrapper .ft span
+ {
+ height: 15px;
+ display: block;
+ background: url(../images/page.png) no-repeat 100% -60px;
+ overflow: hidden;
+ }
+ .navTop{
+ float:right;
+ display:block;
+ padding-right:15px;
+
+ }
+
+
+
+/* end content and sidebar elements */
+/* sidebar elements */
.sidebar
{
float: left;
@@ -212,10 +498,10 @@
font-size: 11px;
}
- .offline .sidebar, .offline .feedback, .offline .t_button
- {
- display: none;
- }
+
+
+
+
.sidebar .searchlabel
{
@@ -258,9 +544,8 @@
.sidebar .box h2
{
- font: 600 16px/1.2 Arial;
+ font: bold 16px/1.2 Arial;
padding: 0;
-/* min-height: 32px;*/
}
.sidebar .box h2 span
{
@@ -273,10 +558,6 @@
}
.sidebar #lookup.box h2 span
{
-/* background: url(../images/sprites-combined.png) no-repeat -6px -311px;
- width: 27px;
- height: 35px;
- margin-right: 13px;*/
}
.sidebar .box#topics h2
{
@@ -284,10 +565,6 @@
}
.sidebar #topics.box h2 span
{
- /* background: url(../images/sprites-combined.png) no-repeat -94px -311px;
- width: 27px;
- height: 32px;
- margin-right: 13px;*/
}
.sidebar .box#examples h2
{
@@ -295,10 +572,6 @@
}
.sidebar #examples.box h2 span
{
- /* background: url(../images/sprites-combined.png) no-repeat -48px -311px;
- width: 30px;
- height: 31px;
- margin-right: 9px;*/
}
.sidebar .box .list
@@ -315,7 +588,6 @@
}
.sidebar .box ul
{
- /*padding:10px;*/
padding-bottom:5px;
padding-left:10px;
padding-top:5px;
@@ -342,16 +614,40 @@
color:#AAD2F0;
font-style:italic;
}
+ .sidebar .search form input.loading
+ {
+ background:url("../images/spinner.gif") no-repeat scroll right center transparent;
+ }
+.floatingResult{
+ z-index:1;
+ position:relative;
+ padding-top:0px;
+ background-color:white;
+ border:solid 1px black;
+ height:250px;
+ width:600px;
+ overflow-x:hidden;
+ overflow-y:auto;
+}
+
+ .floatingResult:hover{
+ display:block;
+ }
+ .floatingResult:hover{
+ }
+
+/* end sidebar elements */
+/* content elements */
.wrap
{
margin: 0 5px 0 208px;
overflow: visible;
}
- .offline .wrap
- {
- margin: 0 5px 0 5px;
- }
+
+
+
+
.wrap .toolbar
{
background-color: #fafafa;
@@ -437,8 +733,11 @@
color: #00732F;
}
- .offline .wrap .breadcrumb
+
+ .wrap .content
{
+ padding: 30px;
+ word-wrap:break-word;
}
.wrap .breadcrumb ul
@@ -466,48 +765,51 @@
padding-left: 0;
margin-left: 0;
}
- .wrap .content
- {
- padding: 30px;
- word-wrap:break-word;
- }
+
+
+
+ .wrap .content ol li {
+ background:none;
+ font:normal 10pt/1 Verdana;
+
+ margin-bottom:10px;
+ margin-left:12px;
+ /*list-style-type:disc;*/
+ }
+
.wrap .content li
{
- /*padding-left: 12px;*/
background: url(../images/bullet_sq.png) no-repeat 0 5px;
font: normal 400 10pt/1 Verdana;
- /* color: #44a51c;*/
margin-bottom: 10px;
padding-left:12px;
}
- .content li:hover
- {
- /* text-decoration: underline;*/
- }
- .offline .wrap .content
- {
- padding-top: 15px;
- }
+
+
+
+
+
+
+
+
+ .content li:hover {}
.wrap .content h1
{
- font: 600 18px/1.2 Arial;
+ font: bold 18px/1.2 Arial;
}
.wrap .content h2
{
-
border-bottom:1px solid #DDDDDD;
font:600 16px/1.2 Arial;
margin-top:15px;
- width:100%;
-
+ width:100%;
}
.wrap .content h3
{
- font: 600 14px/1.2 Arial;
- /*border-bottom:1px solid #DDDDDD;*/
+ font: bold 14px/1.2 Arial;
font:600 16px/1.2 Arial;
margin-top:15px;
width:100%;
@@ -516,7 +818,6 @@
{
line-height: 20px;
padding: 5px;
- /* text-align:justify;*/
}
.wrap .content table p
{
@@ -533,25 +834,6 @@
color: #4c0033;
text-decoration: underline;
}
- .content a:visited
- {
- color: #4c0033;
- text-decoration: none;
- }
- .content a:visited:hover
- {
- color: #4c0033;
- text-decoration: underline;
- } .footer
- {
- min-height: 100px;
- color: #797775;
- font: normal 9px/1 Verdana;
- text-align: center;
- padding-top: 40px;
- background-color: #E6E7E8;
- margin: 0;
- }
.feedback
{
float: none;
@@ -568,267 +850,36 @@
color: #00732F;
text-decoration: underline;
}
- .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after
- {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
- }
- #nav-topright
- {
- height: 70px;
- }
-
- #nav-topright ul
- {
- list-style-type: none;
- float: right;
- width: 370px;
- margin-top: 11px;
- }
-
- #nav-topright li
- {
- display: inline-block;
- margin-right: 20px;
- float: left;
- }
-
- #nav-topright li.nav-topright-last
- {
- margin-right: 0;
- }
-
- #nav-topright li a
- {
- background: transparent url(../images/sprites-combined.png) no-repeat;
- height: 18px;
- display: block;
- overflow: hidden;
- text-indent: -9999px;
- }
-
- #nav-topright li.nav-topright-home a
- {
- width: 65px;
- background-position: -2px -91px;
- }
-
- #nav-topright li.nav-topright-home a:hover
- {
- background-position: -2px -117px;
- }
-
-
- #nav-topright li.nav-topright-dev a
- {
- width: 30px;
- background-position: -76px -91px;
- }
-
- #nav-topright li.nav-topright-dev a:hover
- {
- background-position: -76px -117px;
- }
-
-
- #nav-topright li.nav-topright-labs a
- {
- width: 40px;
- background-position: -114px -91px;
- }
-
- #nav-topright li.nav-topright-labs a:hover
- {
- background-position: -114px -117px;
- }
-
- #nav-topright li.nav-topright-doc a
- {
- width: 32px;
- background-position: -162px -91px;
- }
-
- #nav-topright li.nav-topright-doc a:hover, #nav-topright li.nav-topright-doc-active a
- {
- background-position: -162px -117px;
- }
-
- #nav-topright li.nav-topright-blog a
- {
- width: 40px;
- background-position: -203px -91px;
- }
-
- #nav-topright li.nav-topright-blog a:hover, #nav-topright li.nav-topright-blog-active a
- {
- background-position: -203px -117px;
- }
-
- #nav-topright li.nav-topright-shop a
- {
- width: 40px;
- background-position: -252px -91px;
- }
-
- #nav-topright li.nav-topright-shop a:hover, #nav-topright li.nav-topright-shop-active a
- {
- background-position: -252px -117px;
- }
-
- #nav-logo
- {
- background: transparent url(../images/sprites-combined.png ) no-repeat 0 -225px;
- left: -3px;
- position: absolute;
- width: 75px;
- height: 75px;
- top: 13px;
- }
- #nav-logo a
- {
- width: 75px;
- height: 75px;
- display: block;
- text-indent: -9999px;
- overflow: hidden;
- }
-
-
- .shortCut-topleft-inactive
- {
- padding-left: 3px;
- background: transparent url( ../images/sprites-combined.png) no-repeat 0px -58px;
- height: 20px;
- width: 47px;
- }
- .shortCut-topleft-inactive span
- {
- font-variant: normal;
- }
- .shortCut-topleft-inactive span a:hover, .shortCut-topleft-active a:hover
- {
- text-decoration:none;
+ .alphaChar{
+ width:100%;
+ background-color:#F6F6F6;
+ border:1px solid #E6E6E6;
+ -moz-border-radius: 7px 7px 7px 7px;
+ font-size:12pt;
+ padding-left:10px;
+ margin-top:10px;
+ margin-bottom:10px;
}
- #shortCut
- {
- padding-top: 10px;
- font-weight: bolder;
- color: #b0adab;
- }
- #shortCut ul
- {
- list-style-type: none;
- float: left;
- width: 347px;
- margin-left: 100px;
- }
- #shortCut li
- {
- display: inline-block;
- margin-right: 25px;
- float: left;
- white-space: nowrap;
- }
- #shortCut li a
- {
- color: #b0adab;
- }
- #shortCut li a:hover
- {
- color: #44a51c;
- }
+ .flowList{
+ vertical-align:top;
+ }
- hr
- {
- background-color: #E6E6E6;
- border: 1px solid #E6E6E6;
- height: 1px;
- width: 100%;
- text-align: left;
- margin: 15px 0px 15px 0px;
- }
+ .flowList dl{
+ }
+ .flowList dd{
+ display:inline-block;
+ margin-left:10px;
+ width:250px;
+ }
+ .wrap .content .flowList p{
+ padding:0px;
+ }
.content .alignedsummary
{
margin: 15px;
}
- pre
- {
- border: 1px solid #DDDDDD;
- -moz-border-radius: 7px 7px 7px 7px;
- margin: 0 20px 10px 10px;
- padding: 20px 15px 20px 20px;
- overflow-x: auto;
- }
- table, pre
- {
- -moz-border-radius: 7px 7px 7px 7px;
- background-color: #F6F6F6;
- border: 1px solid #E6E6E6;
- border-collapse: separate;
- font-size: 11px;
- /*min-width: 395px;*/
- margin-bottom: 25px;
- /* display: inline-block;*/
- }
- thead
- {
- margin-top: 5px;
- font:600 12px/1.2 Arial;
- }
- th
- {
- padding: 5px 15px 5px 15px;
- background-color: #E1E1E1;
- /* border-bottom: 1px solid #E6E6E6;*/
- border-left: 1px solid #E6E6E6;
- /* border-right: 1px solid #E6E6E6;*/
- }
- td
- {
- padding: 3px 15px 3px 20px;
- /* border-left: 1px solid #E6E6E6;
- border-right: 1px solid #E6E6E6;*/
- }
- tr.odd td:hover, tr.even td:hover
- {
- /* border-right: 1px solid #C3C3C3;
- border-left: 1px solid #C3C3C3;*/
- }
-
- td.rightAlign
- {
- padding: 3px 5px 3px 10px;
- }
- table tr.odd
- {
- border-left: 1px solid #E6E6E6;
- background-color: #F6F6F6;
- color: #66666E;
- }
- table tr.even
- {
- border-left: 1px solid #E6E6E6;
- background-color: #ffffff;
- color: #66666E;
- }
- table tr.odd td:hover, table tr.even td:hover
- {
- background-color: #E6E6E6;
- }
-
- span.comment
- {
- color: #8B0000;
- font-style: italic;
- }
- span.string, span.char
- {
- color: #254117;
- }
+
.qmltype
{
@@ -856,7 +907,6 @@
*.qmlitem p
{
}
-
#feedbackBox
{
display: none;
@@ -934,16 +984,14 @@
.toc h3, .generic a
{
- font: 600 12px/1.2 Arial;
+ font: bold 12px/1.2 Arial;
}
.generic{
- /*max-width:75%;*/
}
.generic td{
padding:5px;
}
-
.generic .alphaChar{
margin-top:5px;
}
@@ -991,6 +1039,16 @@
padding-left: 0px;
}
+ .wrap .content .toc h3{
+ border-bottom:0px;
+ margin-top:0px;
+ }
+
+ .wrap .content .toc h3 a:hover{
+ color:#00732F;
+ text-decoration:none;
+ }
+
.wrap .content .toc .level2
{
@@ -1007,7 +1065,6 @@
font: normal 10px/1.2 Verdana;
background: url(../images/bullet_dn.png) no-repeat 0 5px;
}
-
.relpage
{
-moz-border-radius: 7px 7px 7px 7px;
@@ -1071,6 +1128,24 @@
.functionIndex a{
display:inline-block;
}
+
+/* end content elements */
+/* footer elements */
+
+ .footer
+ {
+ min-height: 100px;
+ color: #797775;
+ font: normal 9px/1 Verdana;
+ text-align: center;
+ padding-top: 40px;
+ background-color: #E6E7E8;
+ margin: 0;
+ }
+/* end footer elements */
+
+
+
/* start index box */
.indexbox
@@ -1082,15 +1157,15 @@
.indexboxcont
{
display: block;
- /* overflow: hidden;*/
+
}
.indexboxbar
{
background: transparent url(../images/horBar.png ) repeat-x left bottom;
margin-bottom: 25px;
- /* background-image: none;
- border-bottom: 1px solid #e2e2e2;*/
+
+
}
.indexboxcont .section
@@ -1141,7 +1216,7 @@
.content .indexboxcont li
{
- font: normal 600 13px/1 Verdana;
+ font: normal bold 13px/1 Verdana;
}
.indexbox a:hover, .indexbox a:visited:hover
@@ -1190,87 +1265,285 @@
visibility: hidden;
}
-.sidebar .search form input.loading
-{
- background:url("../images/spinner.gif") no-repeat scroll right center transparent;
-}
- /* end of screen media */
-
-.flowList{
-vertical-align:top;
-}
-.alphaChar{
-width:100%;
-background-color:#F6F6F6;
-border:1px solid #E6E6E6;
--moz-border-radius: 7px 7px 7px 7px;
-font-size:12pt;
-padding-left:10px;
-margin-top:10px;
-margin-bottom:10px;
-}
-.flowList dl{
-}
-.flowList dd{
-display:inline-block;
-margin-left:10px;
-width:250px;
-}
-.wrap .content .flowList p{
-padding:0px;
-}
-pre.highlightedCode {
- display: block;
- overflow:hidden;
-}
-.floatingResult{
- z-index:1;
- position:relative;
- padding-top:0px;
- background-color:white;
- border:solid 1px black;
- height:250px;
- width:600px;
- overflow-x:hidden;
- overflow-y:auto;
-}
+/* start of offline spec*/
+ .offline .wrapper .hd
+ {
+ background: url(../images/page.png) no-repeat 0 -15px;
+ }
+ .offline .wrapper .bd
+ {
+ background: url(../images/bg_l_blank.png) repeat-y 0 0;
+ }
+ .offline .wrapper .ft
+ {
+ background: url(../images/page.png) no-repeat 0 -90px;
+ }
+ .offline .sidebar,
+ .offline .feedback,
+ .offline .t_button,
+ .offline #narrowsearch,
+ .offline #narrowmenu
+ {
+ display: none;
+ }
+ .offline .wrap
+ {
+ margin: 0 5px 0 5px;
+ }
+ .offline .wrap .breadcrumb
+ {
+ }
- .floatingResult:hover{
- display:block;
- }
- .floatingResult:hover{
- /*display:none;*/
- }
+ .offline .wrap .content
+ {
+ padding-top: 15px;
+ }
- .wrap .content ol li {
- background:none;
- font:400 10pt/1 Verdana;
- margin-bottom:10px;
- margin-left:12px;
+
+/* end of offline spec*/
+
+/* start of creator spec*/
+ .creator
+ {
+ margin-left:0px;
+ margin-right:0px;
+ padding-left:0px;
+ padding-right:0px;
}
- .wrap .content ol li {
+ .creator .wrap .content ol li {
list-style-type:decimal;
}
- .navTop{
- float:right;
- display:block;
- padding-right:15px;
- /*margin-top:10px;*/
+ .creator .header .icon,
+ .creator .feedback,
+ .creator .t_button,
+ .creator .feedback,
+ .creator #feedbackBox,
+ .creator #feedback,
+ .creator #blurpage,
+ .creator .indexbox .indexIcon span,
+ .creator .wrapper .hd,
+ .creator .indexbox .indexIcon,
+ .creator .header #nav-logo,
+ .creator #offlinemenu,
+ .creator #offlinesearch,
+ .creator .header #nav-topright,
+ .creator .header #shortCut ,
+ .creator .wrapper .hd,
+ .creator .wrapper .ft,
+ .creator .sidebar,
+ .creator .wrap .feedback
+ {
+ display:none;
+ }
+
+ body.creator
+ {
+ background: none;
+
+ font: normal 13px/1.2 Verdana;
+ color: #363534;
+ background-color: #FFFFFF;
+ }
+
+
+
+ .creator .header, .footer, .wrapper
+ {
+ max-width: 1500px;
+ margin: 0px;
+ }
+
+ .creator .wrapper
+ {
+ position:relative;
+ top:50px;
+ }
+ .creator .wrapper .bd
+ {
+
+ background:#FFFFFF;
}
+
+
+ .creator .header, .footer
+ {
+ display: block;
+ clear: both;
+ overflow: hidden;
+ }
+ .creator .wrap .content p
+
+ {
+ line-height: 20px;
+ padding: 5px;
+ }
+
+ .creator .header .qtref span
+ {
+ background:none;
+ }
+
+
- .wrap .content .toc h3{
- border-bottom:0px;
- margin-top:0px;
+ .creator .footer
+ {
+ border-top:1px solid #E5E5E5;
+ min-height: 100px;
+ margin:0px;
+ }
+
+ .creator .wrap
+ {
+
+ padding:0 5px 0 5px;
+ margin: 0px;
+ }
+ .creator .wrap .toolbar
+ {
+
+
+ border-bottom:1px solid #E5E5E5;
+ width:100%,
+ }
+ .creator .wrap .breadcrumb ul li a
+ {
+ /* color: #363534;*/
+ color: #00732F;
+ }
+
+ .creator .wrap .content
+ {
+ padding: 0px;
+ word-wrap:break-word;
+ }
+
+ .creator .wrap .content ol li {
+ background:none;
+ font: inherit;
+ padding-left: 0px;
+ }
+
+ .creator .wrap .content .descr ol li {
+ margin-left: 45px;
+
+ }
+ .creator .content .alignedsummary
+ {
+ margin: 5px;
+ width:100%;
+ }
+ .creator .generic{
+ max-width:75%;
+ }
+ .creator .generic td{
+ padding:0;
}
+ .creator .indexboxbar
+ {
+ border-bottom:1px solid #E5E5E5;
+ margin-bottom: 25px;
+ background: none;
+ }
- .wrap .content .toc h3 a:hover{
- color:#00732F;
- text-decoration:none;
+
+
+ .creator .header
+ {
+ width: 100%;
+ margin: 0;
+ height: auto;
+ background-color: #ffffff;
+ padding: 10px 0 5px 0;
+ overflow: visible;
+ border-bottom: solid #E5E5E5 1px;
+ z-index:1;
+
+
+
+
+
+
+
+
+ position:fixed;
+ }
+
+
+ .creator .header .content
+ {
+ }
+ .creator .header .qtref
+ {
+ color: #00732F;
+ position: static;
+ float: left;
+ margin-left: 5px;
+ font: bold 18px/1 Arial;
+ }
+
+ .creator .header .qtref:visited
+ {
+ color: #00732F;
+ }
+ .creator .header .qtref:hover
+ {
+ color: #00732F;
+ text-decoration:none;
+ }
+ .creator .header .qtref span
+ {
+ background-image: none;
+ text-indent: 0;
+ text-decoration:none;
+ }
+
+
+
+
+
+
+ .creator .wrap .toolbar
+ {
+ display:block;
+ padding-top:0px;
+ }
+
+
+
+ .creator .wrap .breadcrumb ul li {
+ font-weight: normal;
+ }
+
+ .creator .wrap .breadcrumb ul li a {
+ /*color: #44a51c;*/
+ }
+
+ .creator .wrap .breadcrumb ul li.last a {
+ /*color: #363534;*/
+ }
+
+ .creator #narrowmenu ul
+ {
+ border-bottom:solid 1px #E5E5E5;
+ border-left:solid 1px #E5E5E5;
+ border-right:solid 1px #E5E5E5;
}
+
+ .creator #narrowmenu li ul {
+ margin-top:-15px;
+ }
+
+
+ .creator .toc {
+ margin:10px 20px 10px 10px;
+ }
+/* end of creator spec*/
+}
+
/* end of screen media */
/* start of print media */
diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc
new file mode 100755
index 0000000..98096a0
--- /dev/null
+++ b/doc/src/tutorials/modelview.qdoc
@@ -0,0 +1,938 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page modelview.html
+
+ \startpage {index.html}{Qt Reference Documentation}
+ \nextpage {modelview-part1.html}{Introduction}
+
+ \title Model/View Contents
+ \brief An introduction to ModelView programming
+
+ This tutorial gives an introduction to ModelView programming using the Qt
+ cross-platform framework.
+
+ \image treeview.png
+
+ \omit
+ It doesn't cover everything; the emphasis is on teaching the programming
+ philosophy of Model/View programming, and Qt's features are introduced as
+ needed. Some commonly used features are never used in this tutorial.
+ \endomit
+
+ In the process, we will learn about some basic technologies provided by Qt,
+ such as:
+
+ \list
+ \o The difference between standard and model/view widgets
+ \o Adapters betweeen forms and models
+ \o Developing a simple model/view application
+ \o Intermediate topics such as:
+ \list
+ \o Tree views
+ \o Selection
+ \o Predefined models
+ \o Delegates
+ \o Debugging with model test
+ \endlist
+ \endlist
+
+ If you are completely new to Qt, please read \l{How to Learn Qt} if you
+ have not already done so.
+
+ The tutorial's source code is located in Qt's \c examples/tutorials/modelview
+ directory.
+
+ \list 1
+ \o \l{modelview-part1.html}{Introduction}
+ \o \l{modelview-part2.html}{Developing a Simple Model/View Application}
+ \o \l{modelview-part3.html}{Intermediate Topics}
+ \o \l{modelview-part4.html}{Good Sources of Additional Information}
+ \endlist
+
+
+*/
+
+/*!
+ \page modelview-part1.html
+ \contentspage {modelview-index.html}{Model/View Contents}
+ \previouspage {modelview-index.html}{Model/View Contents}
+ \nextpage {modelview-part2.html}{Developing a Simple Model/View Application}
+ \title An Introduction to Model/View Programming
+
+ \section1 1. Introduction
+
+ Model/View is a technology used to separate data from views in widgets that
+ handle data sets. Standard widgets are not designed for separating data
+ from views and this is why Qt 4 has two different types of widgets. Both
+ types of widgets look the same, but they interact with data differently.
+
+ \table
+ \row
+ \o Standard widgets use data that is part of the widget.
+ \o \image standardwidget.png
+ \row
+ \o View classes operate on external data (the model)
+ \o \image modelview.png
+ \endtable
+
+ \section2 1.1 Standard Widgets
+
+ Let's have a closer look at a standard table widget. A table widget is a 2D
+ array of the data elements that the user can change. The table widget can
+ be integrated into a program flow by reading and writing the data elements
+ that the table widget provides. This method is very intuitive and useful in
+ many applications.
+
+ Displaying and editing a database table with a standard table widget can be
+ problematic. Two copies of the data have to be coordinated: one outside the
+ widget; one inside the widget. The developer needs to know where up-to-date
+ data is so the both copies contain the most recent data. The tight coupling
+ of presentation and data makes it harder to write unit tests.
+
+ \section2 1.2 Model/View to the Rescue
+
+ Model/view stepped up to provide a solution that uses a more versatile
+ architecture. Model/view eliminates the data consistency problems that may
+ occur with standard widgets. Model/view also makes it easier to use more
+ than one view of the same data because one model can be passed on to many
+ views. The most important difference is that model/view widgets do not
+ store data behind the table cells. In fact, they operate directly from your
+ data. Since view classes do not know your data's structure, you need to
+ provide a wrapper to make your data conform to the QAbstractItemModel
+ interface. A view uses this interface to read from and write to your data
+ and any class that implements QAbstractItemModel is a model. Once the view
+ receives a pointer to a model, it will read and display its content and be
+ its editor.
+
+ \section2 1.3 Overview of the Model/View Widgets
+
+ Here is an overview of the model/view widgets and their corresponding
+ standard widgets.
+
+ \table
+ \header
+ \o Widget
+ \o Standard Widget (a convenience class with data in
+ the widget)
+ \o Model/View View Class (for use with external data)
+ \row
+ \o \inlineimage listview.png
+ \o \l QListWidget
+ \o \l QListView
+ \row
+ \o \inlineimage tableview.png
+ \o \l QTableWidget
+ \o \l QTableView
+ \row
+ \o \inlineimage treeview.png
+ \o \l QTreeWidget
+ \o \l QTreeView
+ \row
+ \o \inlineimage columnview.png
+ \o
+ \o \l QColumnView shows a tree as a hierarchy of lists
+ \row
+ \o \inlineimage combobox.png
+ \o {2, 1} \l QComboBox can work as both a view class and also
+ as a traditional widget
+ \endtable
+
+ \section2 1.4 Using Adapters between Forms and Models
+
+ Having adapters between forms and models can come in handy.
+
+ We often prefer editing data stored in tables (e.g. in database tables) in
+ forms rather than in tables. There is no direct model/view counterpart for
+ separating data and views for widgets that operate on one value instead of
+ a dataset, so we need an adapter in order to connect the form to the source
+ of data.
+
+ \l QDataWidgetMapper is a great solution because it maps form widgets to a
+ table row and it makes it very easy to build forms for database tables.
+
+ \image widgetmapper.png
+
+ Another example of an adapter is QCompleter. Qt has QCompleter for
+ providing auto-completions in Qt widgets such as QComboBox and, as shown
+ below, QLineEdit. QCompleter uses a model as its data source, so QCompleter,
+ in itself, is a very handy adapter.
+
+ \image qcompleter.png
+*/
+
+/*!
+ \page modelview-part2-main-cpp.html
+ \title main.cpp
+ \quotefile tutorials/modelview/1_readonly/main.cpp
+*/
+
+/*!
+ \page modelview-part2.html
+ \contentspage {modelview-index.html}{Model/View Contents}
+ \previouspage {modelview-part1.html}{Introduction}
+ \nextpage {modelview-part3.html}{Intermediate Topics}
+ \title Model/View Chapter 2 - A Simple Model/View Application
+
+ \section1 2. A Simple Model/View Application
+
+ If you want to develop a model/view application, where should you start? We
+ recommend starting with a simple example and extending it step-by-step.
+ This makes understanding the architecture a lot easier. Trying to
+ understand the model/view architecture in detail before invoking the IDE
+ has proven to be less convenient for many developers. It is substantially
+ easier to start with a simple model/view application that has demo data.
+ Give it a try! Simply replace the data in the examples below with your own.
+
+ Below are 7 very simple and independent applications that show different
+ sides of model/view programming. The source code can be found inside the
+ \c{examples/tutorials/modelview} directory.
+
+ \section2 2.1 A Read Only Table
+
+ We start with an application that uses a QTableView to show data. We will
+ add editing capabilities later.
+
+ \snippet examples/tutorials/modelview/1_readonly/main.cpp Quoting ModelView Tutorial
+
+ We have the usual \l {modelview-part2-main-cpp.html}{main()} function:
+
+ \snippet examples/tutorials/modelview/1_readonly/modelview.h Quoting ModelView Tutorial
+
+ The application is a \l QMainWindow that holds a \l QTableView.
+
+ \snippet examples/tutorials/modelview/1_readonly/modelview.cpp Quoting ModelView Tutorial
+
+ Here is the interesting part: We use
+ \l{QTableView::setModel()}{tableView->setModel(new MyModel(this));} to
+ instantiate the Model and pass its pointer to \l {QTableView}{tableView()}.
+ \l{QTableView}{tableView} will invoke the methods of the pointer it has
+ received to find out two things:
+
+ \list
+ \o How many rows and columns should be displayed
+ \o What content should be printed into each cell.
+ \endlist
+
+ The model needs some code to respond to this.
+
+ We have a table data set, so let's start with QAbstractTableModel since it
+ is easier to use.
+
+ \snippet examples/tutorials/modelview/1_readonly/mymodel.h Quoting ModelView Tutorial
+
+ QAbstractTableModel requires the implementation of three abstract methods.
+
+ \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp Quoting ModelView Tutorial
+
+ The number of rows and columns is set by
+ \l{QAbstractItemModel::rowCount()}{MyModel::rowCount()} and
+ \l{QAbstractItemModel::columnCount()}{MyModel::columnCount()}.
+ When the view has to know what the cell's text is, it calls the method.
+ Row and column information is specified with parameter \c index and the
+ role is set to \l{Qt::ItemDataRole}{Qt::DisplayRole}. Other roles are
+ covered in the next section. In our example, the data that should be
+ displayed is generated. In a real application, \c MyModel would have a
+ member called \c MyData, which serves as the target for all reading and
+ writing operations.
+
+ This small example demonstrates the passive nature of a model. The model
+ does not know when it will be used or which data is needed. It simply
+ provides data each time the view requests it.
+
+ What happens when the model 's data needs to be changed? How does the view
+ know when data changes and needs to be read again? The model has to emit a
+ signal that indicates what range of cells has changed. This will be
+ demonstrated in section 2.3.
+
+ \section2 2.2 Extending the Read Only Example with Roles
+
+ In addition to controlling what text the view displays, the model also
+ controls the text's appearance. When we slightly change the model, we get
+ the following result: \image readonlytable_role.png
+
+ In fact, nothing except for the \l{QAbstractItemModel::}{data()}
+ method needs to be changed to set fonts, background colour, alignment and a
+ checkbox.
+ Here is the \l{QAbstractItemModel::data()}{data()} method that produces the
+ result shown above:
+
+ \snippet examples/tutorials/modelview/2_formatting/mymodel.cpp Quoting ModelView Tutorial
+
+ Each formatting property will be requested from the model with a separate
+ call to the \l{QAbstractItemModel::data()}{data()} method. The \c role
+ parameter is used to let the model know which property is being requested:
+
+ \table
+ \header
+ \o Role (enum Qt::ItemDataRole )
+ \o Meaning
+ \o Type
+ \row
+ \o \l{Qt::ItemDataRole}{Qt::DisplayRole}
+ \o text
+ \o QString
+ \row
+ \o Qt::FontRole
+ \o font
+ \o QFont
+ \row
+ \o Qt::BackgroundRole
+ \o brush for the background of the cell
+ \o QBrush
+ \row
+ \o Qt::TextAlignmentRole
+ \o text alignment
+ \o enum Qt::AlignmentFlag
+ \row
+ \o {1, 3} Qt::CheckStateRole
+ \o {1, 3} suppresses checkboxes with \l{QVariant}{QVariant()},
+ sets checkboxes with Qt::Checked or Qt::Unchecked
+ \o {1, 3} \l{Qt::ItemDataRole}{enum Qt::ItemDataRole}
+ \endtable
+
+ Refer to the Qt namespace documentation to learn more about the
+ Qt::ItemDataRole enum's capabilities.
+
+ Now we need to determine how using a seperated model impacts the
+ application's performance, so let's trace how often the view calls the
+ \l{QAbstractItemModel::}{data()} method. In order to track how often
+ the view calls the model, we have put a debug statement in the
+ \l{QAbstractItemModel::}{data()} method, which logs onto stdio. In
+ our small example, \l{QAbstractItemModel::}{data()} will be called 42
+ times.
+ Each time you hover the cursor over the field,
+ \l{QAbstractItemModel::}{data()} will be called again \mdash 7 times for
+ each cell. That's why it is important to make sure that your data is
+ available when \l{QAbstractItemModel::}{data()} is invoked and expensive
+ lookup operations are cached.
+
+ \section2 2.3 A Clock inside a Table Cell
+
+ \image clock.png
+
+ We still have a read only table, but this time the content changes every
+ second because we are showing the current time.
+
+ \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_QVariant
+
+ Something is missing to make the clock tick. We need to tell the view every
+ second that the time has changed and that it needs to be read again. We do
+ this with a timer. In the constructor, we set its interval to 1 second and
+ connect its timeout signal.
+
+ \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_a
+
+ Here is the corresponding slot:
+
+ \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_b
+
+ We ask the view to read the data in the top left cell again by emitting the
+ \l{QAbstractItemModel::}{dataChanged()} signal. Note that we did not
+ explicitly connect the \l{QAbstractItemModel::}{dataChanged()} signal to
+ the view. This happened automatically when we called
+ \l{QTableView::}{setModel()}.
+
+ \section2 2.4 Setting up Headers for Columns and Rows
+
+ Headers can be hidden via a view method: \c{tableView->verticalHeader()->hide();}
+ \image header.png
+
+ The header content, however, is set via the model, so we reimplement the
+ \l{QAbstractItemModel::headerData()}{headerData()} method:
+
+ \snippet examples/tutorials/modelview/4_headers/mymodel.cpp quoting mymodel_c
+
+
+ \section2 2.5 The Minimal Editing Example
+
+ In this example, we are going to build an application that automatically
+ populates a window title with content by repeating values entered into
+ table cells.
+
+ The model decides whether editing capabilities are available . We only have
+ to modify the model in order for the available editing capabilities to be
+ enabled. This is done by reimplementing the following virtual methods:
+ \l{QAbstractItemModel::}{setData()} and \l{QAbstractItemModel::}{flags()}.
+
+ \snippet examples/tutorials/modelview/5_edit/mymodel.h Quoting ModelView Tutorial
+
+ We use \c QStringList m_gridData to store our data. This makes
+ \c m_gridData the core of MyModel. The rest of \c MyModel acts like a
+ wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We
+ have also introduced the \c editCompleted() signal,
+ which makes it possible to transfer the modified text to the window title.
+
+ \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_d
+
+ In the constructor, we fill \c QStringList gridData with 6 items (one item
+ for every field in the table):
+
+ \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_e
+
+ \l{QAbstractItemModel::setData()}{setData()} will be called each time the
+ user edits a cell. The \c index parameter tells us which field has been
+ edited and \c value provides the result of the editing process. The role
+ will always be set to \c Qt::EditRole because our cells only contain text.
+ If a checkbox were present and user permissions are set to allow the
+ checkbox to be selected, calls would also be made with the role set to
+ \c Qt::CheckStateRole.
+
+ \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_f
+
+ Various properties of a cell can be adjusted with
+ \l{QAbstractItemModel::flags()}{flags()}. Returning
+ \c Qt::ItemIsEditable | \c Qt::ItemIsEnabled is enough to show an editor
+ that a cell has been selected. If editing one cell modifies more data than
+ the data in that particular cell, the model must emit a
+ \l{QAbstractItemModel::}{dataChanged()} signal in order for the data that
+ has been changed to be read.
+*/
+
+/*!
+ \page modelview-part3.html
+ \contentspage {modelview-index.html}{Model/View Contents}
+ \previouspage {modelview-part2.html}{Developing a Simple Model/View Application}
+ \nextpage {modelview-part4.html}{Good Sources of Additional Information}
+ \title Model/View Chapter 3 - Intermediate Topics
+
+ \section1 3. Intermediate Topics
+
+ \section2 3.1 TreeView
+
+ You can convert the example above into an application with a tree view.
+ Simply replace QTableView with QTreeView, which results in a read/write
+ tree. No changes have to be made to the model. The tree won't have any
+ hierarchies because there aren't any hierarchies in the model itself.
+ \image dummy_tree.png
+
+
+ QListView, QTableView and QTreeView all use a model abstraction, which is a
+ merged list, table and tree. This makes it possible to use several different
+ types of view classes from the same model.
+ \image list_table_tree.png
+
+
+ This is how our example model looks so far:
+ \image example_model.png
+
+
+ We want to present a real tree. We have wrapped our data in the examples
+ above in order to make a model. This time we use QStandardItemModel, which
+ is a container for hierarchical data that also implements
+ QAbstractItemModel. To show a tree, QStandardItemModel must be populated
+ with \l{QStandardItem}{QStandardItems}, which are able to hold all the
+ standard properties of items like text, fonts, checkboxes or brushes.
+ \image tree_2_with_algorithm.png
+
+ \snippet examples/tutorials/modelview/6_treeview/modelview.cpp Quoting ModelView Tutorial
+
+ We simply instantiate a QStandardItemModel and add a couple of
+ \l{QStandardItem}{QStandardItems} to the constructor. We can then make a
+ hierarchical data structure because a QStandardItem can hold other
+ \l{QStandardItem}{QStandardItems}. Nodes are collapsed and expanded within
+ the view.
+
+ \section2 3.2 Working with Selections
+
+ We want to access a selected item's content in order to output it into the
+ window title together with the hierarchy level.
+ \image selection2.png
+
+ So let's create a couple of items:
+
+ \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_a
+
+ Views manage selections within a separate selection model, which can be
+ retrieved with the \l{QAbstractItemView::}{selectionModel()}
+ method. We retrieve the selection Model in order to connect a slot to its
+ \l{QAbstractItemView::}{selectionChanged()} signal.
+
+ \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_b
+
+ We get the model index that corresponds to the selection by calling
+ \l{QItemSelectionModel::currentIndex()}{treeView->selectionModel()->currentIndex()}
+ and we get the the field's string by using the model index. Then we just
+ calculate the item's \c hierarchyLevel. Top level items do not have
+ parents and the \l{QAbstractItemModel::}{parent()} method will return a
+ default constructed \l{QModelIndex}{QModelIndex()}. This is why we use the
+ \l{QAbstractItemModel::}{parent()} method to iterate to the top level while
+ counting the steps performed during iteration.
+
+ The selection model (as shown above) can be retrieved, but it can also be
+ set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This
+ is how it's possible to have 3 view classes with synchronised selections
+ because only one instance of a selection model is used. The instance of a
+ selection model is retrieved from the first view class with
+ \l{QAbstractItemView::}{selectionModel()} and the result is assigned to the
+ second and third view class with \l{QAbstractItemView::}{setSelectionModel()}.
+
+ \section2 3.3 Predefined Models
+
+ The typical way to use model/view is to wrap specific data to make it
+ usable with view classes. Qt, however, also provides predefined models for
+ common underlying data structures. If one of the available data structures
+ is suitable for your application, a predefined model can be a good choice.
+
+ \table
+ \row
+ \o QStringListModel
+ \o Stores a list of strings
+ \row
+ \o QStandardItemModel
+ \o Stores arbitrary hierarchical items
+ \row
+ \o QFileSystemModel\br
+ QDirModel
+ \o Encapsulate the local file system
+ \row
+ \o QSqlQueryModel
+ \o Encapsulate an SQL result set
+ \row
+ \o QSqlTableModel
+ \o Encapsulates an SQL table
+ \row
+ \o QSqlRelationalTableModel
+ \o Encapsulates an SQL table with foreign keys
+ \row
+ \o QSortFilterProxyModel
+ \o Sorts and/or filters another model
+
+ \endtable
+
+ \section2 3.4 Delegates
+
+ In all examples so far, data is presented as text or a checkbox in a cell
+ and is edited as text or a checkbox. The component that provides these
+ presentation and editing services is called a \e delegate. We are only just
+ beginning to work with the delegate because the view uses a default
+ delegate. But imagine that we want to have a different editor.(e.g. a
+ slider or a drop down list) Or imagine that we want to present data as
+ graphics. Let's take a look at an example called
+ \l{Star Delegate Example}{Star Delegate}, in which stars are used to show
+ a rating:
+ \image stardelegate.png
+
+ The view has a method that replaces the default delegate and installs a
+ custom delegate. This method is called
+ \l{QAbstractItemView::}{setItemDelegate()}. A new delegate can be written
+ by creating a class that inherits from QStyledItemDelegate. In order to
+ write a delegate that displays stars and has no input capabilities, we only
+ need to overwrite 2 methods.
+
+ \code
+ class StarDelegate : public QStyledItemDelegate
+ {
+ Q_OBJECT
+ public:
+ StarDelegate(QWidget *parent = 0);
+ void paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const;
+ QSize sizeHint(const QStyleOptionViewItem &option,
+ const QModelIndex &index) const;
+ };
+ \endcode
+
+ \l{QStyledItemDelegate::}{paint()} draws stars depending on the content
+ of the underlying data. The data can be looked up with parameter
+ \l{QModelIndex::data()}{index.data()}.
+ \l{QAbstractItemDelegate::}{sizeHint()} specifies each star's dimensions
+ so the the cell will provide enough height and width to accommodate the
+ stars.
+
+ Writing custom delegates is the right choice if you want to show your data
+ with a custom graphical representation inside the grid of the view class.
+ If you want to leave the grid, you can write a custom view class.
+
+ \section2 3.5 Debugging with ModelTest
+
+ The passive nature of models provides new challenges for programmers.
+ Inconsistencies in the model can cause the application to crash. Since the
+ model is hit by numerous calls from the view, it is hard to find out which
+ call has crashed the application and which operation has introduced the
+ problem.
+
+ Qt provides software called
+ \l{http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest}{ModelTest},
+ which checks models while your programming is running. Every time the model
+ is changed, ModelTest scans the model and reports errors with an assert.
+ This is especially important for tree models, since their hierarchical
+ nature leaves many possibilities for subtle inconsistencies.
+
+ Unlike view classes, ModelTest uses out of range indexes to test the model.
+ This means your application may crash with ModelTest even if it runs
+ perfectly without it. So you also need to handle all of the indexes that
+ are out of range when using ModelTest.
+
+
+ \section2 3.6 Model/View NG
+
+ \raw HTML
+ <table style="background-color:white;border:none;font: normal 13px/1.2 Verdana;">
+ <tr><td align="left" valign="top" style="background-color:white;border:none;padding:5px;">
+ \endraw
+
+ \raw HTML
+ <!-- wrap content table p has 0 padding and the padding for p outside of the table is 5px-->
+ \endraw
+
+ Model/View was introduced in Qt 4.0 and is a frequently used technology.
+ Feedback from developers and new development trends have shown that there
+ is a need to further develop the model/view technology. Therefore a
+ research project originated at Nokia is looking into ways to go beyond the
+ current implementation.
+
+ One limitation of model/view is that view classes are basically all fixed
+ grids. It is possible, but really hard to make a list view with icons
+ placed on a curve; or cells expanding on mouse over events to show
+ additional information.
+ In order to achieve graphically rich view experiences, Model/View NG will
+ use QGraphicsView to render elements. Nodel/View NG also aims to make
+ model/view programming more intuitive. One way to achieve this is to have
+ separate models for lists, tables and trees. The current model abstraction
+ is complex because it is capable of representing a list, a table or a tree.
+
+ Model/View NG is a research project. You are welcome to checkout the source
+ code, monitor progress and take part in discussions at the following
+ address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG}
+
+ \raw HTML
+ </td><td align="right" valign="top">
+ \endraw
+
+ \inlineimage path.png
+
+ \raw HTML
+ </td></tr></table>
+ \endraw
+*/
+
+/*!
+ \page modelview-part4.html
+ \contentspage {modelview-index.html}{Model/View Contents}
+ \previouspage {modelview-part3.html}{Intermediate Topics}
+ \title Model/View Chapter 4 - Good Sources of Additional Information
+
+ \section1 4. Good Sources of Additional Information
+
+ \section2 4.1 Books
+
+ Model/View programming is covered quite extensively in the documentation of
+ Qt but also in several good books.
+
+ \list 1
+ \o \bold{C++ GUI Programming with Qt 4} / Jasmin Blanchette, Mark Summerfield,
+ \e{Prentice Hall, 2nd edition}, ISBN 0-13-235416-0. Also available in
+ German: C++ GUI Programmierung mit Qt 4: Die offizielle Einführung,
+ \e{Addison-Wesley}, ISBN 3-827327-29-6
+ \o \bold{The Book of Qt4, The Art of Building Qt Applications} / Daniel Molkentin,
+ \e{Open Source Press}, ISBN 1-59327-147-6.
+ Translated from \bold{Qt 4, Einführung in die Applikationsentwicklung},
+ \e{Open Source Press}, ISBN 3-937514-12-0.
+ \o \bold{Foundations of Qt Development} / Johan Thelin, \e{Apress}, ISBN 1-59059-831-8.
+ \endlist
+
+ More information about these books is available on the
+ \l{Books about Qt Programming}{Qt Web site}.
+
+ The following list provides an overview of example programs contained in the
+ books above. Some of them make very good templates for developing similar
+ applications.
+
+ \table
+ \header
+ \o example name
+ \o view class used
+ \o model used
+ \o aspects touched
+ \o
+ \row
+ \o Team Leaders
+ \o QListview
+ \o QStringListModel
+ \o
+ \o Book 1, Chapter 10, Figure 10.6
+ \row
+ \o Directory Viewer
+ \o QTreeView
+ \o QDirModel
+ \o
+ \o Book 1, Chapter 10, Figure 10.7
+ \row
+ \o Color Names
+ \o QListView
+ \o QSortFilterProxyModel
+ applied to QStringListModel
+ \o
+ \o Book 1, Chapter 10, Figure 10.8
+ \row
+ \o Currencies
+ \o QTableView
+ \o custom model based on
+ QAbstractTableModel
+ \o read only
+ \o Book 1, Chapter 10, Figure 10.10
+ \row
+ \o Cities
+ \o QTableView
+ \o custom model based on
+ QAbstractTableModel
+ \o read / write
+ \o Book 1, Chapter 10, Figure 10.12
+ \row
+ \o Boolean Parser
+ \o QTreeView
+ \o custom model based on
+ QAbstractItemModel
+ \o read only
+ \o Book 1, Chapter 10, Figure 10.14
+ \row
+ \o Track Editor
+ \o {2, 1} QTableWidget
+ \o custom delegate providing a custom editor
+ \o Book 1, Chapter 10, Figure 10.15
+
+ \row
+ \o Four directory views
+ \o QListView
+ QTableView
+ QTreeView
+ \o QDirModel
+ \o demonstrates the use of multiple views
+ \o Book2, Chapter 8.2
+ \row
+ \o Address Book
+ \o QListView
+ QTableView
+ QTreeView
+ \o custom model based on
+ QAbstractTableModel
+ \o read / write
+ \o Book2, Chapter 8.4
+ \row
+ \o Address Book with sorting
+ \o
+ \o QProxyModel
+ \o introducing sort and filter capabilities
+ \o Book2, Chapter 8.5
+ \row
+ \o Address Book
+ with checkboxes
+ \o
+ \o
+ \o introducing checkboxes in model/view
+ \o Book2, Chapter 8.6
+ \row
+ \o Address Book with transposed grid
+ \o
+ \o custom proxy Model based on QAbstractProxyModel
+ \o introducing a custom model
+ \o Book2, Chapter 8.7
+ \row
+ \o Address Book with drag and drop
+ \o
+ \o
+ \o introducing drag and drop support
+ \o Book2, Chapter 8.8
+ \row
+ \o Address Book with custom editor
+ \o
+ \o
+ \o introducing custom delegates
+ \o Book2, Chapter 8.9
+ \row
+ \o Views
+ \o QListView
+ QTableView
+ QTreeView
+ \o QStandardItemModel
+ \o read only
+ \o Book 3, Chapter 5, figure 5-3
+ \row
+ \o Bardelegate
+ \o QTableView
+ \o
+ \o custom delegate for presentation based on QAbstractItemDelegate
+ \o Book 3, Chapter 5, figure 5-5
+ \row
+ \o Editdelegate
+ \o QTableView
+ \o
+ \o custom delegate for editing based on QAbstractItemDelegate
+ \o Book 3, Chapter 5, figure 5-6
+ \row
+ \o Singleitemview
+ \o custom view based on QAbstractItemView
+ \o
+ \o custom view
+ \o Book 3,
+ Chapter 5,
+ figure 5-7
+ \row
+ \o listmodel
+ \o QTableView
+ \o custom Model based on QAbstractTableModel
+ \o read only
+ \o Book 3, Chapter 5, Figure 5-8
+ \row
+ \o treemodel
+ \o QTreeView
+ \o custom Model based on QAbstractItemModel
+ \o read only
+ \o Book 3, Chapter 5, Figure 5-10
+ \row
+ \o edit integers
+ \o QListView
+ \o custom Model based on QAbstractListModel
+ \o read / write
+ \o Book 3, Chapter 5, Listing 5-37, Figure 5-11
+ \row
+ \o sorting
+ \o QTableView
+ \o QSortFilterProxyModel applied to QStringListModel
+ \o demonstrates sorting
+ \o Book 3, Chapter 5, Figure 5-12
+ \endtable
+
+
+ \section2 4.2 Qt Documentation
+
+ Qt 4.7 comes with 17 examples and 2 Demonstrations for model/view.
+ The examples can be found here: \l{Item Views Examples}
+ \table
+ \header
+ \o Example name
+ \o View class used
+ \o Model used
+ \o Aspects touched
+ \row
+ \o Address Book
+ \o QTableView
+ \o QAbstractTableModel
+ QSortFilterProxyModel
+ \o usage of QSortFilterProxyModel to generate different
+ subsets from one data pool
+ \row
+ \o Basic Sort/Filter Model
+ \o QTreeView
+ \o QStandardItemModel
+ QSortFilterProxyModel
+ \o
+ \row
+ \o Chart
+ \o custom view
+ \o QStandardItemModel
+ \o designing custom views that cooperate with selection models
+ \row
+ \o Color Editor Factory
+ \o {2, 1} QTableWidget
+ \o enhancing the standard delegate with a new custom editor to choose colours
+ \row
+ \o Combo Widget Mapper
+ \o QDataWidgetMapper to map QLineEdit, QTextEdit and QComboBox
+ \o QStandardItemModel
+ \o shows how a QComboBox can serve as a view class
+ \row
+ \o Custom Sort/Filter Model
+ \o QTreeView
+ \o QStandardItemModel
+ QSortFilterProxyModel
+ \o subclass QSortFilterProxyModel for advanced sorting and filtering
+ \row
+ \o Dir View
+ \o QTreeView
+ \o QDirModel
+ \o very small example to demonstrate how to assign a model to a view
+ \row
+ \o Editable Tree Model
+ \o QTreeView
+ \o custom tree model
+ \o comprehensive example for working with trees, demonstrates
+ editing cells and tree structure with an underlying custom
+ model
+ \row
+ \o Fetch More
+ \o QListView
+ \o custom list model
+ \o dynamically changing model
+ \row
+ \o Frozen Column
+ \o QTableView
+ \o QStandardItemModel
+ \o
+ \row
+ \o Pixelator
+ \o QTableView
+ \o custom table model
+ \o implementation of a custom delegate
+ \row
+ \o Puzzle
+ \o QListView
+ \o custom list model
+ \o model/view with drag and drop
+ \row
+ \o Simple DOM Model
+ \o QTreeView
+ \o custom tree model
+ \o read only example for a custom tree model
+ \row
+ \o Simple Tree Model
+ \o QTreeView
+ \o custom tree model
+ \o read only example for a custom tree model
+ \row
+ \o Simple Widget Mapper
+ \o QDataWidgetMapper to map QLineEdit, QTextEdit and QSpinBox
+ \o QStandardItemModel
+ \o basic QDataWidgetMapper usage
+ \row
+ \o Spin Box Delegate
+ \o QTableView
+ \o QStandardItemModel
+ \o custom delegate that uses a spin box as a cell editor
+ \row
+ \o Star Delegate
+ \o {2, 1} QTableWidget
+ \o comprehensive custom delegate example.
+ \endtable
+
+ \l{Qt Demonstrations}{Demonstrations} are similar to examples except
+ that no walkthrough is provided for the code. Demonstrations are also
+ sometimes more feature rich.
+
+ \list
+ \o The \bold Interview demonstration shows the same model and
+ selection being shared between three different views.
+ \o Demonstration \bold Spreadsheet demonstrates the use of a
+ table view as a spreadsheet, using custom delegates to render
+ each item according to the type of data it contains.
+ \endlist
+
+ A \l{Model/View Programming}{reference document} for model/view technology
+ is also available.
+*/
diff --git a/examples/declarative/modelviews/abstractitemmodel/model.cpp b/examples/declarative/modelviews/abstractitemmodel/model.cpp
index d0e0971..940a44d 100644
--- a/examples/declarative/modelviews/abstractitemmodel/model.cpp
+++ b/examples/declarative/modelviews/abstractitemmodel/model.cpp
@@ -67,7 +67,9 @@ AnimalModel::AnimalModel(QObject *parent)
void AnimalModel::addAnimal(const Animal &animal)
{
+ beginInsertRows(QModelIndex(), rowCount(), rowCount());
m_animals << animal;
+ endInsertRows();
}
int AnimalModel::rowCount(const QModelIndex & parent) const {
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/app.qml b/examples/declarative/tutorials/extending/chapter1-basics/app.qml
index 9af155c..ada088d 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/app.qml
+++ b/examples/declarative/tutorials/extending/chapter1-basics/app.qml
@@ -38,21 +38,23 @@
**
****************************************************************************/
//![0]
-import Music 1.0
+import Charts 1.0
import Qt 4.7
-Rectangle {
+Item {
width: 300; height: 200
- Musician {
- id: aMusician
- name: "Reddy the Rocker"
- instrument: "Guitar"
+ PieChart {
+ id: aPieChart
+ anchors.centerIn: parent
+ width: 100; height: 100
+ name: "A simple pie chart"
+ color: "red"
}
Text {
- anchors.fill: parent
- text: aMusician.name + " plays the " + aMusician.instrument
+ anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 }
+ text: aPieChart.name
}
}
//![0]
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro b/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro
index bd05ebe..0f04167 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro
+++ b/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro
@@ -1,5 +1,5 @@
QT += declarative
-HEADERS += musician.h
-SOURCES += musician.cpp \
+HEADERS += piechart.h
+SOURCES += piechart.cpp \
main.cpp
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/main.cpp b/examples/declarative/tutorials/extending/chapter1-basics/main.cpp
index 8ef6965..a5dbab3 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/main.cpp
+++ b/examples/declarative/tutorials/extending/chapter1-basics/main.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
//![0]
-#include "musician.h"
+#include "piechart.h"
#include <qdeclarative.h>
#include <QDeclarativeView>
#include <QApplication>
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- qmlRegisterType<Musician>("Music", 1, 0, "Musician");
+ qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
QDeclarativeView view;
view.setSource(QUrl::fromLocalFile("app.qml"));
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp b/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp
new file mode 100644
index 0000000..3b9ef71
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include <QPainter>
+
+//![0]
+PieChart::PieChart(QDeclarativeItem *parent)
+ : QDeclarativeItem(parent)
+{
+ // need to disable this flag to draw inside a QDeclarativeItem
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
+}
+//![0]
+
+QString PieChart::name() const
+{
+ return m_name;
+}
+
+void PieChart::setName(const QString &name)
+{
+ m_name = name;
+}
+
+QColor PieChart::color() const
+{
+ return m_color;
+}
+
+void PieChart::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+//![1]
+void PieChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
+}
+//![1]
+
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/musician.h b/examples/declarative/tutorials/extending/chapter1-basics/piechart.h
index f9a0537..aae7b26 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/musician.h
+++ b/examples/declarative/tutorials/extending/chapter1-basics/piechart.h
@@ -37,30 +37,33 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef MUSICIAN_H
-#define MUSICIAN_H
+#ifndef PIECHART_H
+#define PIECHART_H
//![0]
-#include <QObject>
+#include <QDeclarativeItem>
+#include <QColor>
-class Musician : public QObject
+class PieChart : public QDeclarativeItem
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QString instrument READ instrument WRITE setInstrument)
+ Q_PROPERTY(QColor color READ color WRITE setColor)
public:
- Musician(QObject *parent = 0);
+ PieChart(QDeclarativeItem *parent = 0);
QString name() const;
void setName(const QString &name);
- QString instrument() const;
- void setInstrument(const QString &instrument);
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
private:
QString m_name;
- QString m_instrument;
+ QColor m_color;
};
//![0]
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/app.qml b/examples/declarative/tutorials/extending/chapter2-methods/app.qml
index 02d33c2..0b55f7c 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/app.qml
+++ b/examples/declarative/tutorials/extending/chapter2-methods/app.qml
@@ -38,23 +38,29 @@
**
****************************************************************************/
//![0]
-import Music 1.0
+import Charts 1.0
import Qt 4.7
-Rectangle {
- width: 200; height: 200
+Item {
+ width: 300; height: 200
- Musician {
- id: aMusician
- name: "Reddy the Rocker"
- instrument: "Guitar"
+ PieChart {
+ id: aPieChart
+ anchors.centerIn: parent
+ width: 100; height: 100
+ color: "red"
- onPerformanceEnded: console.log("The performance has now ended")
+ onChartCleared: console.log("The chart has been cleared")
}
MouseArea {
anchors.fill: parent
- onClicked: aMusician.perform()
+ onClicked: aPieChart.clearChart()
+ }
+
+ Text {
+ anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 }
+ text: "Click anywhere to clear the chart"
}
}
//![0]
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro b/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro
index bd05ebe..0f04167 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro
+++ b/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro
@@ -1,5 +1,5 @@
QT += declarative
-HEADERS += musician.h
-SOURCES += musician.cpp \
+HEADERS += piechart.h
+SOURCES += piechart.cpp \
main.cpp
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/main.cpp b/examples/declarative/tutorials/extending/chapter2-methods/main.cpp
index 8ef6965..a5dbab3 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/main.cpp
+++ b/examples/declarative/tutorials/extending/chapter2-methods/main.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
//![0]
-#include "musician.h"
+#include "piechart.h"
#include <qdeclarative.h>
#include <QDeclarativeView>
#include <QApplication>
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- qmlRegisterType<Musician>("Music", 1, 0, "Musician");
+ qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
QDeclarativeView view;
view.setSource(QUrl::fromLocalFile("app.qml"));
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp b/examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp
new file mode 100644
index 0000000..11ff7c8
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include <QPainter>
+#include <QDebug>
+
+PieChart::PieChart(QDeclarativeItem *parent)
+ : QDeclarativeItem(parent)
+{
+ // need to disable this flag to draw inside a QDeclarativeItem
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
+}
+
+QString PieChart::name() const
+{
+ return m_name;
+}
+
+void PieChart::setName(const QString &name)
+{
+ m_name = name;
+}
+
+QColor PieChart::color() const
+{
+ return m_color;
+}
+
+void PieChart::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+void PieChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
+}
+
+//![0]
+void PieChart::clearChart()
+{
+ setColor(QColor(Qt::transparent));
+ update();
+
+ emit chartCleared();
+}
+//![0]
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/musician.h b/examples/declarative/tutorials/extending/chapter2-methods/piechart.h
index 0b0addb..246fd9f 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/musician.h
+++ b/examples/declarative/tutorials/extending/chapter2-methods/piechart.h
@@ -37,42 +37,44 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef MUSICIAN_H
-#define MUSICIAN_H
+#ifndef PIECHART_H
+#define PIECHART_H
-#include <QObject>
+#include <QDeclarativeItem>
+#include <QColor>
//![0]
-class Musician : public QObject
+class PieChart : public QDeclarativeItem
{
//![0]
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QString instrument READ instrument WRITE setInstrument)
+ Q_PROPERTY(QColor color READ color WRITE setColor)
//![1]
- Q_PROPERTY(QString instrument READ instrument WRITE setInstrument NOTIFY instrumentChanged)
public:
//![1]
- Musician(QObject *parent = 0);
+ PieChart(QDeclarativeItem *parent = 0);
QString name() const;
void setName(const QString &name);
- QString instrument() const;
- void setInstrument(const QString &instrument);
+ QColor color() const;
+ void setColor(const QColor &color);
- Q_INVOKABLE void perform();
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
//![2]
+ Q_INVOKABLE void clearChart();
+
signals:
- void instrumentChanged();
+ void chartCleared();
//![2]
private:
QString m_name;
- QString m_instrument;
+ QColor m_color;
//![3]
};
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml b/examples/declarative/tutorials/extending/chapter3-bindings/app.qml
index 8bf6ecf..2ff6ae1 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/app.qml
@@ -38,35 +38,37 @@
**
****************************************************************************/
//![0]
-import Music 1.0
+import Charts 1.0
import Qt 4.7
-Rectangle {
- width: 200; height: 200
+Item {
+ width: 300; height: 200
- Musician {
- id: reddy
- name: "Reddy the Rocker"
- instrument: "Guitar"
- }
+ Row {
+ anchors.centerIn: parent
+ spacing: 20
+
+ PieChart {
+ id: chartA
+ width: 100; height: 100
+ color: "red"
+ }
- Musician {
- id: craig
- name: "Craig the Copycat"
- instrument: reddy.instrument
+ PieChart {
+ id: chartB
+ width: 100; height: 100
+ color: chartA.color
+ }
}
MouseArea {
anchors.fill: parent
- onClicked: {
- reddy.perform()
- craig.perform()
-
- reddy.instrument = "Drums"
+ onClicked: { chartA.color = "blue" }
+ }
- reddy.perform()
- craig.perform()
- }
+ Text {
+ anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 }
+ text: "Click anywhere to change the chart color"
}
}
//![0]
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro b/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
index bd05ebe..0f04167 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
@@ -1,5 +1,5 @@
QT += declarative
-HEADERS += musician.h
-SOURCES += musician.cpp \
+HEADERS += piechart.h
+SOURCES += piechart.cpp \
main.cpp
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/main.cpp b/examples/declarative/tutorials/extending/chapter3-bindings/main.cpp
index 8ef6965..a5dbab3 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/main.cpp
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/main.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
//![0]
-#include "musician.h"
+#include "piechart.h"
#include <qdeclarative.h>
#include <QDeclarativeView>
#include <QApplication>
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- qmlRegisterType<Musician>("Music", 1, 0, "Musician");
+ qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
QDeclarativeView view;
view.setSource(QUrl::fromLocalFile("app.qml"));
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp b/examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp
new file mode 100644
index 0000000..85a9762
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include <QPainter>
+#include <QDebug>
+
+PieChart::PieChart(QDeclarativeItem *parent)
+ : QDeclarativeItem(parent)
+{
+ // need to disable this flag to draw inside a QDeclarativeItem
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
+}
+
+QString PieChart::name() const
+{
+ return m_name;
+}
+
+void PieChart::setName(const QString &name)
+{
+ m_name = name;
+}
+
+QColor PieChart::color() const
+{
+ return m_color;
+}
+
+//![0]
+void PieChart::setColor(const QColor &color)
+{
+ if (color != m_color) {
+ m_color = color;
+ update(); // repaint with the new color
+ emit colorChanged();
+ }
+}
+//![0]
+
+void PieChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
+}
+
+void PieChart::clearChart()
+{
+ setColor(QColor(Qt::transparent));
+ update();
+}
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/piechart.h b/examples/declarative/tutorials/extending/chapter3-bindings/piechart.h
new file mode 100644
index 0000000..164cebb
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/piechart.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIECHART_H
+#define PIECHART_H
+
+#include <QDeclarativeItem>
+#include <QColor>
+
+//![0]
+class PieChart : public QDeclarativeItem
+{
+//![0]
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName)
+
+//![1]
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+public:
+//![1]
+
+ PieChart(QDeclarativeItem *parent = 0);
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+
+ Q_INVOKABLE void clearChart();
+
+//![2]
+signals:
+ void colorChanged();
+//![2]
+
+private:
+ QString m_name;
+ QColor m_color;
+
+//![3]
+};
+//![3]
+
+#endif
+
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml
index d76f801..fcd3806 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml
@@ -38,17 +38,23 @@
**
****************************************************************************/
//![0]
-import Music 1.0
+import Charts 1.0
import Qt 4.7
Item {
+ width: 300; height: 200
- Musician {
- id: reddy
- name: "Reddy the Rocker"
- instrument: Instrument { type: "Guitar" }
+ PieChart {
+ id: chart
+ anchors.centerIn: parent
+ width: 100; height: 100
+
+ pieSlice: PieSlice {
+ anchors.fill: parent
+ color: "red"
+ }
}
- Component.onCompleted: console.log("Reddy plays the " + reddy.instrument.type)
+ Component.onCompleted: console.log("The pie is colored " + chart.pieSlice.color)
}
//![0]
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
index aea07a0..c3f5402 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
@@ -1,7 +1,7 @@
QT += declarative
-HEADERS += musician.h \
- instrument.h
-SOURCES += musician.cpp \
- instrument.cpp \
+HEADERS += piechart.h \
+ pieslice.h
+SOURCES += piechart.cpp \
+ pieslice.cpp \
main.cpp
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp
index d94cb03..fd518a2 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp
@@ -37,8 +37,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "musician.h"
-#include "instrument.h"
+#include "piechart.h"
+#include "pieslice.h"
#include <qdeclarative.h>
#include <QDeclarativeView>
@@ -50,10 +50,10 @@ int main(int argc, char *argv[])
//![0]
QApplication app(argc, argv);
- qmlRegisterType<Musician>("Music", 1, 0, "Musician");
+ qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
//![1]
- qmlRegisterType<Instrument>("Music", 1, 0, "Instrument");
+ qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice");
//![1]
QDeclarativeView view;
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/musician.cpp b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp
index 0ce0022..7098854 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/musician.cpp
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp
@@ -37,38 +37,36 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "musician.h"
-#include <QDebug>
+#include "piechart.h"
+#include "pieslice.h"
-Musician::Musician(QObject *parent)
- : QObject(parent)
+PieChart::PieChart(QDeclarativeItem *parent)
+ : QDeclarativeItem(parent)
{
+ // this doesn't need to disable QGraphicsItem::ItemHasNoContents
+ // anymore since the drawing is now done in PieSlice
}
-QString Musician::name() const
+QString PieChart::name() const
{
return m_name;
}
-void Musician::setName(const QString &name)
+void PieChart::setName(const QString &name)
{
m_name = name;
}
-QString Musician::instrument() const
+PieSlice *PieChart::pieSlice() const
{
- return m_instrument;
-}
-
-void Musician::setInstrument(const QString &instrument)
-{
- m_instrument = instrument;
+ return m_pieSlice;
}
//![0]
-void Musician::perform()
+void PieChart::setPieSlice(PieSlice *pieSlice)
{
- qWarning() << m_name << "is playing the" << m_instrument;
- emit performanceEnded();
+ m_pieSlice = pieSlice;
+ pieSlice->setParentItem(this);
}
//![0]
+
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/musician.h b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h
index 8f67f61..448ca7b 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/musician.h
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h
@@ -37,18 +37,18 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef MUSICIAN_H
-#define MUSICIAN_H
+#ifndef PIECHART_H
+#define PIECHART_H
-#include <QObject>
+#include <QDeclarativeItem>
-class Instrument;
+class PieSlice;
//![0]
-class Musician : public QObject
+class PieChart : public QDeclarativeItem
{
Q_OBJECT
- Q_PROPERTY(Instrument* instrument READ instrument WRITE setInstrument)
+ Q_PROPERTY(PieSlice* pieSlice READ pieSlice WRITE setPieSlice)
//![0]
Q_PROPERTY(QString name READ name WRITE setName)
@@ -56,19 +56,19 @@ class Musician : public QObject
public:
//![1]
- Musician(QObject *parent = 0);
+ PieChart(QDeclarativeItem *parent = 0);
QString name() const;
void setName(const QString &name);
//![2]
- Instrument *instrument() const;
- void setInstrument(Instrument *instrument);
+ PieSlice *pieSlice() const;
+ void setPieSlice(PieSlice *pieSlice);
//![2]
private:
QString m_name;
- Instrument *m_instrument;
+ PieSlice *m_pieSlice;
//![3]
};
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp
new file mode 100644
index 0000000..7a420fd
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "pieslice.h"
+
+#include <QPainter>
+
+PieSlice::PieSlice(QDeclarativeItem *parent)
+ : QDeclarativeItem(parent)
+{
+ // need to disable this flag to draw inside a QDeclarativeItem
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
+}
+
+QColor PieSlice::color() const
+{
+ return m_color;
+}
+
+void PieSlice::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+void PieSlice::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
+}
+
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h
new file mode 100644
index 0000000..085a9b8
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIESLICE_H
+#define PIESLICE_H
+
+#include <QDeclarativeItem>
+#include <QColor>
+
+//![0]
+class PieSlice : public QDeclarativeItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+
+public:
+ PieSlice(QDeclarativeItem *parent = 0);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+
+private:
+ QColor m_color;
+};
+//![0]
+
+#endif
+
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml b/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml
new file mode 100644
index 0000000..f759bc9
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Charts 1.0
+import Qt 4.7
+
+Item {
+ width: 300; height: 200
+
+ PieChart {
+ anchors.centerIn: parent
+ width: 100; height: 100
+
+ slices: [
+ PieSlice {
+ anchors.fill: parent
+ color: "red"
+ fromAngle: 0; angleSpan: 110
+ },
+ PieSlice {
+ anchors.fill: parent
+ color: "black"
+ fromAngle: 110; angleSpan: 50
+ },
+ PieSlice {
+ anchors.fill: parent
+ color: "blue"
+ fromAngle: 160; angleSpan: 100
+ }
+ ]
+ }
+}
+//![0]
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro b/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro
new file mode 100644
index 0000000..c3f5402
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro
@@ -0,0 +1,7 @@
+QT += declarative
+
+HEADERS += piechart.h \
+ pieslice.h
+SOURCES += piechart.cpp \
+ pieslice.cpp \
+ main.cpp
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/musician.cpp b/examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp
index 6c42f31..f73c49f 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/musician.cpp
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp
@@ -37,30 +37,22 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "musician.h"
+#include "piechart.h"
+#include "pieslice.h"
-Musician::Musician(QObject *parent)
- : QObject(parent)
-{
-}
-
-QString Musician::name() const
-{
- return m_name;
-}
+#include <qdeclarative.h>
+#include <QDeclarativeView>
+#include <QApplication>
-void Musician::setName(const QString &name)
+int main(int argc, char *argv[])
{
- m_name = name;
-}
+ QApplication app(argc, argv);
-QString Musician::instrument() const
-{
- return m_instrument;
-}
+ qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
+ qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice");
-void Musician::setInstrument(const QString &instrument)
-{
- m_instrument = instrument;
+ QDeclarativeView view;
+ view.setSource(QUrl::fromLocalFile("app.qml"));
+ view.show();
+ return app.exec();
}
-
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/musician.cpp b/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.cpp
index 5f9ead4..2515b64 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/musician.cpp
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.cpp
@@ -37,40 +37,36 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "musician.h"
-#include <QDebug>
+#include "piechart.h"
+#include "pieslice.h"
-Musician::Musician(QObject *parent)
- : QObject(parent)
+PieChart::PieChart(QDeclarativeItem *parent)
+ : QDeclarativeItem(parent)
{
}
-QString Musician::name() const
+QString PieChart::name() const
{
return m_name;
}
-void Musician::setName(const QString &name)
+void PieChart::setName(const QString &name)
{
m_name = name;
}
-QString Musician::instrument() const
+//![0]
+QDeclarativeListProperty<PieSlice> PieChart::slices()
{
- return m_instrument;
+ return QDeclarativeListProperty<PieSlice>(this, 0, &PieChart::append_slice);
}
-//![0]
-void Musician::setInstrument(const QString &instrument)
+void PieChart::append_slice(QDeclarativeListProperty<PieSlice> *list, PieSlice *slice)
{
- if (instrument != m_instrument) {
- m_instrument = instrument;
- emit instrumentChanged();
+ PieChart *chart = qobject_cast<PieChart *>(list->object);
+ if (chart) {
+ slice->setParentItem(chart);
+ chart->m_slices.append(slice);
}
}
//![0]
-
-void Musician::perform()
-{
- qWarning() << m_name << "is playing the" << m_instrument;
-}
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/musician.h b/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.h
index 86849ba..4424251 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/musician.h
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.h
@@ -37,45 +37,39 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef MUSICIAN_H
-#define MUSICIAN_H
+#ifndef PIECHART_H
+#define PIECHART_H
-#include <QObject>
+#include <QDeclarativeItem>
+
+class PieSlice;
//![0]
-class Musician : public QObject
+class PieChart : public QDeclarativeItem
{
-//![0]
Q_OBJECT
+ Q_PROPERTY(QDeclarativeListProperty<PieSlice> slices READ slices)
+//![0]
Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QString instrument READ instrument WRITE setInstrument)
//![1]
public:
//![1]
-
- Musician(QObject *parent = 0);
+ PieChart(QDeclarativeItem *parent = 0);
QString name() const;
void setName(const QString &name);
- QString instrument() const;
- void setInstrument(const QString &instrument);
-
-//![2]
- Q_INVOKABLE void perform();
-
-signals:
- void performanceEnded();
//![2]
+ QDeclarativeListProperty<PieSlice> slices();
private:
- QString m_name;
- QString m_instrument;
+ static void append_slice(QDeclarativeListProperty<PieSlice> *list, PieSlice *slice);
-//![3]
+ QString m_name;
+ QList<PieSlice *> m_slices;
};
-//![3]
+//![2]
#endif
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp b/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp
new file mode 100644
index 0000000..65120f5
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "pieslice.h"
+
+#include <QPainter>
+
+PieSlice::PieSlice(QDeclarativeItem *parent)
+ : QDeclarativeItem(parent)
+{
+ // need to disable this flag to draw inside a QDeclarativeItem
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
+}
+
+QColor PieSlice::color() const
+{
+ return m_color;
+}
+
+void PieSlice::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+int PieSlice::fromAngle() const
+{
+ return m_fromAngle;
+}
+
+void PieSlice::setFromAngle(int angle)
+{
+ m_fromAngle = angle;
+}
+
+int PieSlice::angleSpan() const
+{
+ return m_angleSpan;
+}
+
+void PieSlice::setAngleSpan(int angle)
+{
+ m_angleSpan = angle;
+}
+
+void PieSlice::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->drawPie(boundingRect(), m_fromAngle * 16, m_angleSpan * 16);
+}
+
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h b/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h
new file mode 100644
index 0000000..7cd0c74
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIESLICE_H
+#define PIESLICE_H
+
+#include <QDeclarativeItem>
+#include <QColor>
+
+//![0]
+class PieSlice : public QDeclarativeItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle)
+ Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan)
+//![0]
+
+public:
+ PieSlice(QDeclarativeItem *parent = 0);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ int fromAngle() const;
+ void setFromAngle(int angle);
+
+ int angleSpan() const;
+ void setAngleSpan(int span);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+
+private:
+ QColor m_color;
+ int m_fromAngle;
+ int m_angleSpan;
+};
+
+#endif
+
diff --git a/examples/declarative/tutorials/extending/chapter5-plugins/musician.cpp b/examples/declarative/tutorials/extending/chapter5-plugins/musician.cpp
deleted file mode 100644
index e62efb1..0000000
--- a/examples/declarative/tutorials/extending/chapter5-plugins/musician.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "musician.h"
-#include "instrument.h"
-
-Musician::Musician(QObject *parent)
- : QObject(parent)
-{
-}
-
-QString Musician::name() const
-{
- return m_name;
-}
-
-void Musician::setName(const QString &name)
-{
- m_name = name;
-}
-
-Instrument *Musician::instrument() const
-{
- return m_instrument;
-}
-
-void Musician::setInstrument(Instrument *instrument)
-{
- m_instrument = instrument;
-}
-
diff --git a/examples/declarative/tutorials/extending/chapter5-plugins/qmldir b/examples/declarative/tutorials/extending/chapter5-plugins/qmldir
deleted file mode 100644
index c3afd6b..0000000
--- a/examples/declarative/tutorials/extending/chapter5-plugins/qmldir
+++ /dev/null
@@ -1 +0,0 @@
-plugin chapter5-plugins lib
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/app.qml b/examples/declarative/tutorials/extending/chapter6-plugins/app.qml
new file mode 100644
index 0000000..38ceefa
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/app.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import Qt 4.7
+
+Item {
+ width: 300; height: 200
+
+ PieChart {
+ anchors.centerIn: parent
+ width: 100; height: 100
+
+ slices: [
+ PieSlice {
+ anchors.fill: parent
+ color: "red"
+ fromAngle: 0; angleSpan: 110
+ },
+ PieSlice {
+ anchors.fill: parent
+ color: "black"
+ fromAngle: 110; angleSpan: 50
+ },
+ PieSlice {
+ anchors.fill: parent
+ color: "blue"
+ fromAngle: 160; angleSpan: 100
+ }
+ ]
+ }
+}
+
diff --git a/examples/declarative/tutorials/extending/chapter5-plugins/chapter5-plugins.pro b/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
index 483da8f..1ffbf29 100644
--- a/examples/declarative/tutorials/extending/chapter5-plugins/chapter5-plugins.pro
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
@@ -6,13 +6,13 @@ DESTDIR = lib
OBJECTS_DIR = tmp
MOC_DIR = tmp
-HEADERS += musician.h \
- instrument.h \
- musicplugin.h
+HEADERS += piechart.h \
+ pieslice.h \
+ chartsplugin.h
-SOURCES += musician.cpp \
- instrument.cpp \
- musicplugin.cpp
+SOURCES += piechart.cpp \
+ pieslice.cpp \
+ chartsplugin.cpp
symbian {
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/declarative/tutorials/extending/chapter5-plugins/musicplugin.cpp b/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp
index 76acf01..5aa2a4b 100644
--- a/examples/declarative/tutorials/extending/chapter5-plugins/musicplugin.cpp
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp
@@ -37,18 +37,18 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "musicplugin.h"
+#include "chartsplugin.h"
//![0]
-#include "musician.h"
-#include "instrument.h"
+#include "piechart.h"
+#include "pieslice.h"
#include <QtDeclarative/qdeclarative.h>
-void MusicPlugin::registerTypes(const char *uri)
+void ChartsPlugin::registerTypes(const char *uri)
{
- qmlRegisterType<Musician>(uri, 1, 0, "Musician");
- qmlRegisterType<Instrument>(uri, 1, 0, "Instrument");
+ qmlRegisterType<PieChart>(uri, 1, 0, "PieChart");
+ qmlRegisterType<PieSlice>(uri, 1, 0, "PieSlice");
}
-Q_EXPORT_PLUGIN2(musicplugin, MusicPlugin);
+Q_EXPORT_PLUGIN2(chartsplugin, ChartsPlugin);
//![0]
diff --git a/examples/declarative/tutorials/extending/chapter5-plugins/musicplugin.h b/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.h
index d6a5392..797d1e7 100644
--- a/examples/declarative/tutorials/extending/chapter5-plugins/musicplugin.h
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.h
@@ -37,13 +37,13 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef MUSICPLUGIN_H
-#define MUSICPLUGIN_H
+#ifndef CHARTSPLUGIN_H
+#define CHARTSPLUGIN_H
//![0]
#include <QtDeclarative/QDeclarativeExtensionPlugin>
-class MusicPlugin : public QDeclarativeExtensionPlugin
+class ChartsPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
public:
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/musician.cpp b/examples/declarative/tutorials/extending/chapter6-plugins/piechart.cpp
index e62efb1..4e6ee5c 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/musician.cpp
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/piechart.cpp
@@ -37,31 +37,35 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "musician.h"
-#include "instrument.h"
+#include "piechart.h"
+#include "pieslice.h"
-Musician::Musician(QObject *parent)
- : QObject(parent)
+PieChart::PieChart(QDeclarativeItem *parent)
+ : QDeclarativeItem(parent)
{
}
-QString Musician::name() const
+QString PieChart::name() const
{
return m_name;
}
-void Musician::setName(const QString &name)
+void PieChart::setName(const QString &name)
{
m_name = name;
}
-Instrument *Musician::instrument() const
+QDeclarativeListProperty<PieSlice> PieChart::slices()
{
- return m_instrument;
+ return QDeclarativeListProperty<PieSlice>(this, 0, &PieChart::append_slice);
}
-void Musician::setInstrument(Instrument *instrument)
+void PieChart::append_slice(QDeclarativeListProperty<PieSlice> *list, PieSlice *slice)
{
- m_instrument = instrument;
+ PieChart *chart = qobject_cast<PieChart *>(list->object);
+ if (chart) {
+ slice->setParentItem(chart);
+ chart->m_slices.append(slice);
+ }
}
diff --git a/examples/declarative/tutorials/extending/chapter5-plugins/musician.h b/examples/declarative/tutorials/extending/chapter6-plugins/piechart.h
index b920631..d6e4439 100644
--- a/examples/declarative/tutorials/extending/chapter5-plugins/musician.h
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/piechart.h
@@ -37,31 +37,32 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef MUSICIAN_H
-#define MUSICIAN_H
+#ifndef PIECHART_H
+#define PIECHART_H
-#include <QObject>
+#include <QDeclarativeItem>
-class Instrument;
+class PieSlice;
-class Musician : public QObject
+class PieChart : public QDeclarativeItem
{
Q_OBJECT
+ Q_PROPERTY(QDeclarativeListProperty<PieSlice> slices READ slices)
Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(Instrument* instrument READ instrument WRITE setInstrument)
public:
- Musician(QObject *parent = 0);
+ PieChart(QDeclarativeItem *parent = 0);
QString name() const;
void setName(const QString &name);
- Instrument *instrument() const;
- void setInstrument(Instrument *instrument);
+ QDeclarativeListProperty<PieSlice> slices();
private:
+ static void append_slice(QDeclarativeListProperty<PieSlice> *list, PieSlice *slice);
+
QString m_name;
- Instrument *m_instrument;
+ QList<PieSlice *> m_slices;
};
#endif
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp b/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp
new file mode 100644
index 0000000..65120f5
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "pieslice.h"
+
+#include <QPainter>
+
+PieSlice::PieSlice(QDeclarativeItem *parent)
+ : QDeclarativeItem(parent)
+{
+ // need to disable this flag to draw inside a QDeclarativeItem
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
+}
+
+QColor PieSlice::color() const
+{
+ return m_color;
+}
+
+void PieSlice::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+int PieSlice::fromAngle() const
+{
+ return m_fromAngle;
+}
+
+void PieSlice::setFromAngle(int angle)
+{
+ m_fromAngle = angle;
+}
+
+int PieSlice::angleSpan() const
+{
+ return m_angleSpan;
+}
+
+void PieSlice::setAngleSpan(int angle)
+{
+ m_angleSpan = angle;
+}
+
+void PieSlice::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->drawPie(boundingRect(), m_fromAngle * 16, m_angleSpan * 16);
+}
+
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h b/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h
new file mode 100644
index 0000000..a3afd25
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIESLICE_H
+#define PIESLICE_H
+
+#include <QDeclarativeItem>
+#include <QColor>
+
+class PieSlice : public QDeclarativeItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle)
+ Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan)
+
+public:
+ PieSlice(QDeclarativeItem *parent = 0);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ int fromAngle() const;
+ void setFromAngle(int angle);
+
+ int angleSpan() const;
+ void setAngleSpan(int span);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+
+private:
+ QColor m_color;
+ int m_fromAngle;
+ int m_angleSpan;
+};
+
+#endif
+
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/qmldir b/examples/declarative/tutorials/extending/chapter6-plugins/qmldir
new file mode 100644
index 0000000..a83bf85
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/qmldir
@@ -0,0 +1 @@
+plugin chapter6-plugins lib
diff --git a/examples/declarative/tutorials/extending/extending.pro b/examples/declarative/tutorials/extending/extending.pro
index 0c86fed..967473f 100644
--- a/examples/declarative/tutorials/extending/extending.pro
+++ b/examples/declarative/tutorials/extending/extending.pro
@@ -5,5 +5,6 @@ SUBDIRS += \
chapter2-methods \
chapter3-bindings \
chapter4-customPropertyTypes \
- chapter5-plugins
+ chapter5-listproperties \
+ chapter6-plugins
diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml
index 68f8712..80567ef 100644
--- a/examples/declarative/tutorials/samegame/samegame1/samegame.qml
+++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml
@@ -55,7 +55,7 @@ Rectangle {
Image {
id: background
anchors.fill: parent
- source: "../shared/pics/background.jpg"
+ source: "../shared/pics/background.png"
fillMode: Image.PreserveAspectCrop
}
}
diff --git a/examples/itemviews/addressbook/addresswidget.cpp b/examples/itemviews/addressbook/addresswidget.cpp
index e226643..22dfae3 100644
--- a/examples/itemviews/addressbook/addresswidget.cpp
+++ b/examples/itemviews/addressbook/addresswidget.cpp
@@ -230,7 +230,7 @@ void AddressWidget::writeToFile(QString fileName)
return;
}
- QList< QPair<QString, QString> > pairs = table->getList();
+ QList< QPair<QString, QString> > pairs = table->getList();
QDataStream out(&file);
out << pairs;
}
diff --git a/examples/itemviews/addressbook/tablemodel.cpp b/examples/itemviews/addressbook/tablemodel.cpp
index 603c926..e9a08f0 100644
--- a/examples/itemviews/addressbook/tablemodel.cpp
+++ b/examples/itemviews/addressbook/tablemodel.cpp
@@ -72,13 +72,13 @@ QVariant TableModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
-
+
if (index.row() >= listOfPairs.size() || index.row() < 0)
return QVariant();
-
+
if (role == Qt::DisplayRole) {
QPair<QString, QString> pair = listOfPairs.at(index.row());
-
+
if (index.column() == 0)
return pair.first;
else if (index.column() == 1)
@@ -93,15 +93,15 @@ QVariant TableModel::headerData(int section, Qt::Orientation orientation, int ro
{
if (role != Qt::DisplayRole)
return QVariant();
-
+
if (orientation == Qt::Horizontal) {
switch (section) {
case 0:
return tr("Name");
-
+
case 1:
return tr("Address");
-
+
default:
return QVariant();
}
@@ -115,7 +115,7 @@ bool TableModel::insertRows(int position, int rows, const QModelIndex &index)
{
Q_UNUSED(index);
beginInsertRows(QModelIndex(), position, position+rows-1);
-
+
for (int row=0; row < rows; row++) {
QPair<QString, QString> pair(" ", " ");
listOfPairs.insert(position, pair);
@@ -129,9 +129,9 @@ bool TableModel::insertRows(int position, int rows, const QModelIndex &index)
//! [5]
bool TableModel::removeRows(int position, int rows, const QModelIndex &index)
{
- Q_UNUSED(index);
+ Q_UNUSED(index);
beginRemoveRows(QModelIndex(), position, position+rows-1);
-
+
for (int row=0; row < rows; ++row) {
listOfPairs.removeAt(position);
}
@@ -144,25 +144,25 @@ bool TableModel::removeRows(int position, int rows, const QModelIndex &index)
//! [6]
bool TableModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
- if (index.isValid() && role == Qt::EditRole) {
- int row = index.row();
-
- QPair<QString, QString> p = listOfPairs.value(row);
-
- if (index.column() == 0)
- p.first = value.toString();
- else if (index.column() == 1)
- p.second = value.toString();
+ if (index.isValid() && role == Qt::EditRole) {
+ int row = index.row();
+
+ QPair<QString, QString> p = listOfPairs.value(row);
+
+ if (index.column() == 0)
+ p.first = value.toString();
+ else if (index.column() == 1)
+ p.second = value.toString();
else
return false;
-
+
listOfPairs.replace(row, p);
- emit(dataChanged(index, index));
-
+ emit(dataChanged(index, index));
+
return true;
- }
+ }
- return false;
+ return false;
}
//! [6]
@@ -171,7 +171,7 @@ Qt::ItemFlags TableModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::ItemIsEnabled;
-
+
return QAbstractTableModel::flags(index) | Qt::ItemIsEditable;
}
//! [7]
diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h
index 5b5827b..c92db44 100644
--- a/examples/network/bearermonitor/sessionwidget.h
+++ b/examples/network/bearermonitor/sessionwidget.h
@@ -41,12 +41,12 @@
#ifndef SESSIONWIDGET_H
#define SESSIONWIDGET_H
+#include <qnetworksession.h>
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
#include "ui_sessionwidget_maemo.h"
#else
#include "ui_sessionwidget.h"
#endif
-#include <qnetworksession.h>
QT_USE_NAMESPACE
diff --git a/examples/network/bearermonitor/sessionwidget_maemo.ui b/examples/network/bearermonitor/sessionwidget_maemo.ui
index ca68246..8867509 100644
--- a/examples/network/bearermonitor/sessionwidget_maemo.ui
+++ b/examples/network/bearermonitor/sessionwidget_maemo.ui
@@ -214,6 +214,54 @@
</item>
</layout>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="errorStringLayout_2">
+ <item>
+ <widget class="QLabel" name="rxData">
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="txData">
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="errorStringLayout_3">
+ <item>
+ <widget class="QLabel" name="errorStringLabel_2">
+ <property name="text">
+ <string>Active Time:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="activeTime">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>0 seconds</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</item>
<item>
diff --git a/examples/tutorials/modelview/1_readonly/1_readonly.pro b/examples/tutorials/modelview/1_readonly/1_readonly.pro
new file mode 100755
index 0000000..1162d5a
--- /dev/null
+++ b/examples/tutorials/modelview/1_readonly/1_readonly.pro
@@ -0,0 +1,10 @@
+TARGET = mv_readonly
+
+TEMPLATE = app
+
+SOURCES += main.cpp \
+ modelview.cpp \
+ mymodel.cpp
+
+HEADERS += modelview.h \
+ mymodel.h
diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp
new file mode 100755
index 0000000..fb4726a
--- /dev/null
+++ b/examples/tutorials/modelview/1_readonly/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+//! [Quoting ModelView Tutorial]
+// main.cpp
+#include <QtGui/QApplication>
+#include "modelview.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ ModelView w;
+ w.show();
+ return a.exec();
+}
+//! [Quoting ModelView Tutorial]
diff --git a/examples/tutorials/modelview/1_readonly/modelview.cpp b/examples/tutorials/modelview/1_readonly/modelview.cpp
new file mode 100755
index 0000000..91a97bf
--- /dev/null
+++ b/examples/tutorials/modelview/1_readonly/modelview.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+//! [Quoting ModelView Tutorial]
+// modelview.cpp
+#include <QTableView>
+#include "modelview.h"
+#include "mymodel.h"
+
+ModelView::ModelView(QWidget *parent)
+ : QMainWindow(parent)
+{
+ tableView = new QTableView(this);
+ setCentralWidget(tableView);
+ tableView->setModel(new MyModel(this));
+}
+//! [Quoting ModelView Tutorial]
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/instrument.h b/examples/tutorials/modelview/1_readonly/modelview.h
index 9971207..9307083 100644..100755
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/instrument.h
+++ b/examples/tutorials/modelview/1_readonly/modelview.h
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -37,27 +37,25 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef INSTRUMENT_H
-#define INSTRUMENT_H
-#include <QObject>
+#ifndef MODELVIEW_H
+#define MODELVIEW_H
-//![0]
-class Instrument : public QObject
+//! [Quoting ModelView Tutorial]
+// modelview.h
+#include <QtGui/QMainWindow>
+
+class QTableView; //forward declaration
+
+class ModelView : public QMainWindow
{
Q_OBJECT
- Q_PROPERTY(QString type READ type WRITE setType)
-
+private:
+ QTableView *tableView;
public:
- Instrument(QObject *parent = 0);
+ ModelView(QWidget *parent = 0);
- QString type() const;
- void setType(const QString &type);
-
-private:
- QString m_type;
};
-//![0]
-
-#endif
+//! [Quoting ModelView Tutorial]
+#endif // MODELVIEW_H
diff --git a/examples/tutorials/modelview/1_readonly/mymodel.cpp b/examples/tutorials/modelview/1_readonly/mymodel.cpp
new file mode 100755
index 0000000..394605a
--- /dev/null
+++ b/examples/tutorials/modelview/1_readonly/mymodel.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+//! [Quoting ModelView Tutorial]
+// mymodel.cpp
+#include "mymodel.h"
+
+MyModel::MyModel(QObject *parent)
+ :QAbstractTableModel(parent)
+{
+}
+
+int MyModel::rowCount(const QModelIndex & /*parent*/) const
+{
+ return 2;
+}
+
+int MyModel::columnCount(const QModelIndex & /*parent*/) const
+{
+ return 3;
+}
+
+QVariant MyModel::data(const QModelIndex &index, int role) const
+{
+ if (role == Qt::DisplayRole)
+ {
+ return QString("Row%1, Column%2")
+ .arg(index.row() + 1)
+ .arg(index.column() +1);
+ }
+ return QVariant();
+}
+//! [Quoting ModelView Tutorial]
diff --git a/examples/tutorials/modelview/1_readonly/mymodel.h b/examples/tutorials/modelview/1_readonly/mymodel.h
new file mode 100755
index 0000000..6065f6e
--- /dev/null
+++ b/examples/tutorials/modelview/1_readonly/mymodel.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MYMODEL_H
+#define MYMODEL_H
+
+//! [Quoting ModelView Tutorial]
+// mymodel.h
+#include <QAbstractTableModel>
+
+class MyModel : public QAbstractTableModel
+{
+ Q_OBJECT
+public:
+ MyModel(QObject *parent);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const ;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+};
+//! [Quoting ModelView Tutorial]
+
+#endif // MYMODEL_H
diff --git a/examples/tutorials/modelview/2_formatting/2_formatting.pro b/examples/tutorials/modelview/2_formatting/2_formatting.pro
new file mode 100755
index 0000000..7e70d81
--- /dev/null
+++ b/examples/tutorials/modelview/2_formatting/2_formatting.pro
@@ -0,0 +1,10 @@
+TARGET = mv_formatting
+
+TEMPLATE = app
+
+SOURCES += main.cpp \
+ modelview.cpp \
+ mymodel.cpp
+
+HEADERS += modelview.h \
+ mymodel.h
diff --git a/examples/declarative/tutorials/extending/chapter5-plugins/instrument.cpp b/examples/tutorials/modelview/2_formatting/main.cpp
index 9ca96f6..7be212e 100644..100755
--- a/examples/declarative/tutorials/extending/chapter5-plugins/instrument.cpp
+++ b/examples/tutorials/modelview/2_formatting/main.cpp
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -37,20 +37,14 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "instrument.h"
-Instrument::Instrument(QObject *parent)
- : QObject(parent)
-{
-}
-
-QString Instrument::type() const
-{
- return m_type;
-}
+#include <QtGui/QApplication>
+#include "modelview.h"
-void Instrument::setType(const QString &type)
+int main(int argc, char *argv[])
{
- m_type = type;
+ QApplication a(argc, argv);
+ ModelView w;
+ w.show();
+ return a.exec();
}
-
diff --git a/examples/tutorials/modelview/2_formatting/modelview.cpp b/examples/tutorials/modelview/2_formatting/modelview.cpp
new file mode 100755
index 0000000..9a5ce64
--- /dev/null
+++ b/examples/tutorials/modelview/2_formatting/modelview.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QTableView>
+#include "modelview.h"
+#include "mymodel.h"
+
+ModelView::ModelView(QWidget *parent)
+ : QMainWindow(parent)
+{
+ tableView = new QTableView(this);
+ setCentralWidget(tableView);
+ tableView->setModel(new MyModel(this));
+}
+
diff --git a/examples/tutorials/modelview/2_formatting/modelview.h b/examples/tutorials/modelview/2_formatting/modelview.h
new file mode 100755
index 0000000..7291487
--- /dev/null
+++ b/examples/tutorials/modelview/2_formatting/modelview.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MODELVIEW_H
+#define MODELVIEW_H
+
+#include <QtGui/QMainWindow>
+
+class QTableView; //forward declaration
+
+class ModelView : public QMainWindow
+{
+ Q_OBJECT
+private:
+ QTableView *tableView;
+public:
+ ModelView(QWidget *parent = 0);
+};
+
+#endif // MODELVIEW_H
diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp
new file mode 100755
index 0000000..e34e014
--- /dev/null
+++ b/examples/tutorials/modelview/2_formatting/mymodel.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QFont>
+#include <QBrush>
+#include "mymodel.h"
+#include <QDebug>
+
+//! [Quoting ModelView Tutorial]
+// mymodel.cpp
+MyModel::MyModel(QObject *parent)
+ :QAbstractTableModel(parent)
+{
+}
+
+int MyModel::rowCount(const QModelIndex & /*parent */) const
+{
+ return 2;
+}
+
+int MyModel::columnCount(const QModelIndex & /*parent */) const
+{
+ return 3;
+}
+
+QVariant MyModel::data(const QModelIndex &index, int role) const
+{
+ int row = index.row();
+ int col = index.column();
+ // generate a log message when this method gets called
+ qDebug() << QString("row %1, col%2, role %3")
+ .arg(row).arg(col).arg(role);
+
+ switch(role){
+ case Qt::DisplayRole:
+ if (row == 0 && col == 1) return QString("<--left");
+ if (row == 1 && col == 1) return QString("right-->");
+
+ return QString("Row%1, Column%2")
+ .arg(row + 1)
+ .arg(col +1);
+ break;
+ case Qt::FontRole:
+ if (row == 0 && col == 0) //change font only for cell(0,0)
+ {
+ QFont boldFont;
+ boldFont.setBold(true);
+ return boldFont;
+ }
+ break;
+ case Qt::BackgroundRole:
+
+ if (row == 1 && col == 2) //change background only for cell(1,2)
+ {
+ QBrush redBackground(QColor(Qt::red));
+ return redBackground;
+ }
+ break;
+ case Qt::TextAlignmentRole:
+
+ if (row == 1 && col == 1) //change text alignment only for cell(1,1)
+ {
+ return Qt::AlignRight + Qt::AlignVCenter;
+ }
+ break;
+ case Qt::CheckStateRole:
+
+ if (row == 1 && col == 0) //add a checkbox to cell(1,0)
+ {
+ return Qt::Checked;
+ }
+ }
+ return QVariant();
+}
+//! [Quoting ModelView Tutorial]
diff --git a/examples/tutorials/modelview/2_formatting/mymodel.h b/examples/tutorials/modelview/2_formatting/mymodel.h
new file mode 100755
index 0000000..4dc405a
--- /dev/null
+++ b/examples/tutorials/modelview/2_formatting/mymodel.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MYMODEL_H
+#define MYMODEL_H
+
+#include <QAbstractTableModel>
+
+class MyModel : public QAbstractTableModel
+{
+ Q_OBJECT
+public:
+ MyModel(QObject *parent);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const ;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+};
+
+#endif // MYMODEL_H
diff --git a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro
new file mode 100755
index 0000000..d61ee4c
--- /dev/null
+++ b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro
@@ -0,0 +1,10 @@
+TARGET = mv_changingmodel
+
+TEMPLATE = app
+
+SOURCES += main.cpp \
+ modelview.cpp \
+ mymodel.cpp
+
+HEADERS += modelview.h \
+ mymodel.h
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/instrument.cpp b/examples/tutorials/modelview/3_changingmodel/main.cpp
index 9ca96f6..7be212e 100644..100755
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/instrument.cpp
+++ b/examples/tutorials/modelview/3_changingmodel/main.cpp
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -37,20 +37,14 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "instrument.h"
-Instrument::Instrument(QObject *parent)
- : QObject(parent)
-{
-}
-
-QString Instrument::type() const
-{
- return m_type;
-}
+#include <QtGui/QApplication>
+#include "modelview.h"
-void Instrument::setType(const QString &type)
+int main(int argc, char *argv[])
{
- m_type = type;
+ QApplication a(argc, argv);
+ ModelView w;
+ w.show();
+ return a.exec();
}
-
diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.cpp b/examples/tutorials/modelview/3_changingmodel/modelview.cpp
new file mode 100755
index 0000000..9a5ce64
--- /dev/null
+++ b/examples/tutorials/modelview/3_changingmodel/modelview.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QTableView>
+#include "modelview.h"
+#include "mymodel.h"
+
+ModelView::ModelView(QWidget *parent)
+ : QMainWindow(parent)
+{
+ tableView = new QTableView(this);
+ setCentralWidget(tableView);
+ tableView->setModel(new MyModel(this));
+}
+
diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.h b/examples/tutorials/modelview/3_changingmodel/modelview.h
new file mode 100755
index 0000000..7291487
--- /dev/null
+++ b/examples/tutorials/modelview/3_changingmodel/modelview.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MODELVIEW_H
+#define MODELVIEW_H
+
+#include <QtGui/QMainWindow>
+
+class QTableView; //forward declaration
+
+class ModelView : public QMainWindow
+{
+ Q_OBJECT
+private:
+ QTableView *tableView;
+public:
+ ModelView(QWidget *parent = 0);
+};
+
+#endif // MODELVIEW_H
diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp
new file mode 100755
index 0000000..42915b0
--- /dev/null
+++ b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QTimer>
+#include <QTime>
+#include <QBrush>
+#include "mymodel.h"
+
+//! [quoting mymodel_a]
+MyModel::MyModel(QObject *parent)
+ :QAbstractTableModel(parent)
+{
+// selectedCell = 0;
+ timer = new QTimer(this);
+ timer->setInterval(1000);
+ connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit()));
+ timer->start();
+}
+//! [quoting mymodel_a]
+//-------------------------------------------------------
+int MyModel::rowCount(const QModelIndex & /*parent */) const
+{
+ return 2;
+}
+
+//-------------------------------------------------------
+int MyModel::columnCount(const QModelIndex & /*parent */) const
+{
+ return 3;
+}
+
+//-------------------------------------------------------
+//! [quoting mymodel_QVariant ]
+QVariant MyModel::data(const QModelIndex &index, int role) const
+{
+ int row = index.row();
+ int col = index.column();
+
+ if (role == Qt::DisplayRole)
+ {
+ if (row == 0 && col == 0)
+ {
+ return QTime::currentTime().toString();
+ }
+ }
+ return QVariant();
+}
+//! [quoting mymodel_QVariant ]
+//-------------------------------------------------------
+//! [quoting mymodel_b ]
+void MyModel::timerHit()
+{
+ //we identify the top left cell
+ QModelIndex topLeft = createIndex(0,0);
+ //emit a signal to make the view reread identified data
+ emit dataChanged(topLeft, topLeft);
+}
+//! [quoting mymodel_b ]
diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.h b/examples/tutorials/modelview/3_changingmodel/mymodel.h
new file mode 100755
index 0000000..47b026e
--- /dev/null
+++ b/examples/tutorials/modelview/3_changingmodel/mymodel.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MYMODEL_H
+#define MYMODEL_H
+
+#include <QAbstractTableModel>
+
+class QTimer; // forward declaration
+
+class MyModel : public QAbstractTableModel
+{
+ Q_OBJECT
+public:
+ MyModel(QObject *parent);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const ;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QTimer *timer;
+private:
+ int selectedCell;
+private slots:
+ void timerHit();
+};
+
+#endif // MYMODEL_H
diff --git a/examples/tutorials/modelview/4_headers/4_headers.pro b/examples/tutorials/modelview/4_headers/4_headers.pro
new file mode 100755
index 0000000..d6f8d23
--- /dev/null
+++ b/examples/tutorials/modelview/4_headers/4_headers.pro
@@ -0,0 +1,10 @@
+TARGET = mv_headers
+
+TEMPLATE = app
+
+SOURCES += main.cpp \
+ modelview.cpp \
+ mymodel.cpp
+
+HEADERS += modelview.h \
+ mymodel.h
diff --git a/examples/declarative/tutorials/extending/chapter5-plugins/app.qml b/examples/tutorials/modelview/4_headers/main.cpp
index 9c050b8..7be212e 100644..100755
--- a/examples/declarative/tutorials/extending/chapter5-plugins/app.qml
+++ b/examples/tutorials/modelview/4_headers/main.cpp
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -38,16 +38,13 @@
**
****************************************************************************/
-import Qt 4.7
+#include <QtGui/QApplication>
+#include "modelview.h"
-Item {
-
- Musician {
- id: reddy
- name: "Reddy the Rocker"
- instrument: Instrument { type: "Guitar" }
- }
-
- Component.onCompleted: console.log("Reddy plays the " + reddy.instrument.type)
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ ModelView w;
+ w.show();
+ return a.exec();
}
-
diff --git a/examples/tutorials/modelview/4_headers/modelview.cpp b/examples/tutorials/modelview/4_headers/modelview.cpp
new file mode 100755
index 0000000..449dbbc
--- /dev/null
+++ b/examples/tutorials/modelview/4_headers/modelview.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QTableView>
+#include <QHeaderView>
+#include "modelview.h"
+#include "mymodel.h"
+
+ModelView::ModelView(QWidget *parent)
+ : QMainWindow(parent)
+{
+ tableView = new QTableView(this);
+ setCentralWidget(tableView);
+ tableView->setModel(new MyModel(this));
+ tableView->verticalHeader()->hide();
+}
+
diff --git a/examples/tutorials/modelview/4_headers/modelview.h b/examples/tutorials/modelview/4_headers/modelview.h
new file mode 100755
index 0000000..7669e35
--- /dev/null
+++ b/examples/tutorials/modelview/4_headers/modelview.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MODELVIEW_H
+#define MODELVIEW_H
+
+#include <QtGui/QMainWindow>
+
+class QTableView; //forward declaration
+
+class ModelView : public QMainWindow
+{
+ Q_OBJECT
+private:
+ QTableView *tableView;
+public:
+ ModelView(QWidget *parent = 0);
+
+};
+
+#endif // MODELVIEW_H
diff --git a/examples/tutorials/modelview/4_headers/mymodel.cpp b/examples/tutorials/modelview/4_headers/mymodel.cpp
new file mode 100755
index 0000000..e6f977d
--- /dev/null
+++ b/examples/tutorials/modelview/4_headers/mymodel.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mymodel.h"
+
+MyModel::MyModel(QObject *parent)
+ :QAbstractTableModel(parent)
+{
+}
+
+//-------------------------------------------------------
+int MyModel::rowCount(const QModelIndex & /*parent*/) const
+{
+ return 2;
+}
+
+//-------------------------------------------------------
+int MyModel::columnCount(const QModelIndex & /*parent*/) const
+{
+ return 3;
+}
+
+//-------------------------------------------------------
+QVariant MyModel::data(const QModelIndex &index, int role) const
+{
+ if (role == Qt::DisplayRole)
+ {
+ return QString("Row%1, Column%2")
+ .arg(index.row() + 1)
+ .arg(index.column() +1);
+ }
+ return QVariant();
+}
+
+//! [quoting mymodel_c]
+QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (role == Qt::DisplayRole)
+ {
+ if (orientation == Qt::Horizontal) {
+ switch (section)
+ {
+ case 0:
+ return QString("first");
+ case 1:
+ return QString("second");
+ case 2:
+ return QString("third");
+ }
+ }
+ }
+ return QVariant();
+}
+//! [quoting mymodel_c]
diff --git a/examples/tutorials/modelview/4_headers/mymodel.h b/examples/tutorials/modelview/4_headers/mymodel.h
new file mode 100755
index 0000000..ada3169
--- /dev/null
+++ b/examples/tutorials/modelview/4_headers/mymodel.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MYMODEL_H
+#define MYMODEL_H
+
+#include <QAbstractTableModel>
+
+class MyModel : public QAbstractTableModel
+{
+ Q_OBJECT
+public:
+ MyModel(QObject *parent);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const ;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+};
+
+#endif // MYMODEL_H
diff --git a/examples/tutorials/modelview/5_edit/5_edit.pro b/examples/tutorials/modelview/5_edit/5_edit.pro
new file mode 100755
index 0000000..e18c596
--- /dev/null
+++ b/examples/tutorials/modelview/5_edit/5_edit.pro
@@ -0,0 +1,10 @@
+TARGET = mv_edit
+
+TEMPLATE = app
+
+SOURCES += main.cpp \
+ modelview.cpp \
+ mymodel.cpp
+
+HEADERS += modelview.h \
+ mymodel.h
diff --git a/examples/tutorials/modelview/5_edit/main.cpp b/examples/tutorials/modelview/5_edit/main.cpp
new file mode 100755
index 0000000..7be212e
--- /dev/null
+++ b/examples/tutorials/modelview/5_edit/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include "modelview.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ ModelView w;
+ w.show();
+ return a.exec();
+}
diff --git a/examples/tutorials/modelview/5_edit/modelview.cpp b/examples/tutorials/modelview/5_edit/modelview.cpp
new file mode 100755
index 0000000..a6c6ef5
--- /dev/null
+++ b/examples/tutorials/modelview/5_edit/modelview.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QTableView>
+#include "modelview.h"
+#include "mymodel.h"
+
+ModelView::ModelView(QWidget *parent)
+ : QMainWindow(parent)
+{
+ tableView = new QTableView(this);
+ setCentralWidget(tableView);
+ QAbstractTableModel *myModel = new MyModel(this);
+ tableView->setModel(myModel);
+
+ //transfer changes to the model to the window title
+ connect(myModel, SIGNAL(editCompleted(const QString &)), this, SLOT(setWindowTitle(const QString &)));
+}
+
+void ModelView::showWindowTitle(const QString & title)
+{
+setWindowTitle(title);
+}
diff --git a/examples/declarative/tutorials/extending/chapter5-plugins/instrument.h b/examples/tutorials/modelview/5_edit/modelview.h
index ce1e7ce..97c840c 100644..100755
--- a/examples/declarative/tutorials/extending/chapter5-plugins/instrument.h
+++ b/examples/tutorials/modelview/5_edit/modelview.h
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -37,25 +37,23 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef INSTRUMENT_H
-#define INSTRUMENT_H
-#include <QObject>
+#ifndef MODELVIEW_H
+#define MODELVIEW_H
-class Instrument : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString type READ type WRITE setType)
-
-public:
- Instrument(QObject *parent = 0);
+#include <QtGui/QMainWindow>
- QString type() const;
- void setType(const QString &type);
+class QTableView; //forward declaration
+class ModelView : public QMainWindow
+{
+ Q_OBJECT
private:
- QString m_type;
+ QTableView *tableView;
+public:
+ ModelView(QWidget *parent = 0);
+public slots:
+ void showWindowTitle(const QString & title);
};
-#endif
-
+#endif // MODELVIEW_H
diff --git a/examples/tutorials/modelview/5_edit/mymodel.cpp b/examples/tutorials/modelview/5_edit/mymodel.cpp
new file mode 100755
index 0000000..67181ca
--- /dev/null
+++ b/examples/tutorials/modelview/5_edit/mymodel.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+//! [quoting mymodel_d]
+#include "mymodel.h"
+
+const int COLS= 3;
+const int ROWS= 2;
+
+MyModel::MyModel(QObject *parent)
+ :QAbstractTableModel(parent)
+{
+ //gridData needs to have 6 element, one for each table cell
+ m_gridData << "1/1" << "1/2" << "1/3" << "2/1" << "2/2" << "2/3" ;
+}
+//! [quoting mymodel_d]
+
+//! [quoting mymodel_e]
+int MyModel::rowCount(const QModelIndex & /*parent*/) const
+{
+ return ROWS;
+}
+
+int MyModel::columnCount(const QModelIndex & /*parent*/) const
+{
+ return COLS;
+}
+
+QVariant MyModel::data(const QModelIndex &index, int role) const
+{
+ if (role == Qt::DisplayRole)
+ {
+ return m_gridData[modelIndexToOffset(index)];
+ }
+ return QVariant();
+}
+//! [quoting mymodel_e]
+
+//-----------------------------------------------------------------
+
+//! [quoting mymodel_f]
+bool MyModel::setData(const QModelIndex & index, const QVariant & value, int role)
+{
+ if (role == Qt::EditRole)
+ {
+ m_gridData[modelIndexToOffset(index)] = value.toString();
+ emit editCompleted(m_gridData.join(" | "));
+ }
+ return true;
+}
+
+Qt::ItemFlags MyModel::flags(const QModelIndex & /*index*/) const
+{
+ return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled ;
+}
+
+//convert row and column information to array offset
+int MyModel::modelIndexToOffset(const QModelIndex & index) const
+{
+ return index.row()*COLS + index.column();
+}
+//! [quoting mymodel_f]
diff --git a/examples/tutorials/modelview/5_edit/mymodel.h b/examples/tutorials/modelview/5_edit/mymodel.h
new file mode 100755
index 0000000..0d2a1b8
--- /dev/null
+++ b/examples/tutorials/modelview/5_edit/mymodel.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MYMODEL_H
+#define MYMODEL_H
+
+//! [Quoting ModelView Tutorial]
+// mymodel.h
+#include <QAbstractTableModel>
+#include <QStringList>
+
+class MyModel : public QAbstractTableModel
+{
+ Q_OBJECT
+public:
+ MyModel(QObject *parent);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const ;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
+ Qt::ItemFlags flags(const QModelIndex & index) const ;
+private:
+ QStringList m_gridData; //holds text entered into QTableView
+ int modelIndexToOffset(const QModelIndex & index) const;
+signals:
+ void editCompleted(const QString &);
+};
+//! [Quoting ModelView Tutorial]
+
+#endif // MYMODEL_H
diff --git a/examples/tutorials/modelview/6_treeview/6_treeview.pro b/examples/tutorials/modelview/6_treeview/6_treeview.pro
new file mode 100755
index 0000000..6d078be
--- /dev/null
+++ b/examples/tutorials/modelview/6_treeview/6_treeview.pro
@@ -0,0 +1,5 @@
+TARGET = mv_tree
+TEMPLATE = app
+SOURCES += main.cpp \
+ modelview.cpp
+HEADERS += modelview.h
diff --git a/examples/tutorials/modelview/6_treeview/main.cpp b/examples/tutorials/modelview/6_treeview/main.cpp
new file mode 100755
index 0000000..7be212e
--- /dev/null
+++ b/examples/tutorials/modelview/6_treeview/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include "modelview.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ ModelView w;
+ w.show();
+ return a.exec();
+}
diff --git a/examples/tutorials/modelview/6_treeview/modelview.cpp b/examples/tutorials/modelview/6_treeview/modelview.cpp
new file mode 100755
index 0000000..772dbdd
--- /dev/null
+++ b/examples/tutorials/modelview/6_treeview/modelview.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+//! [Quoting ModelView Tutorial]
+// modelview.cpp
+#include <QTreeView>
+#include <QStandardItemModel>
+#include <QStandardItem>
+#include "modelview.h"
+
+
+const int ROWS = 2;
+const int COLUMNS = 3;
+
+ModelView::ModelView(QWidget *parent)
+ : QMainWindow(parent)
+{
+ treeView = new QTreeView(this);
+ setCentralWidget(treeView);
+ standardModel = new QStandardItemModel ;
+
+ QList<QStandardItem *> preparedColumn =prepareColumn("first", "second", "third");
+ QStandardItem *item = standardModel->invisibleRootItem();
+ // adding a row to the invisible root item produces a root element
+ item->appendRow(preparedColumn);
+
+ QList<QStandardItem *> secondRow =prepareColumn("111", "222", "333");
+ // adding a row to an item starts a subtree
+ preparedColumn.first()->appendRow(secondRow);
+
+ treeView->setModel(standardModel);
+ treeView->expandAll();
+}
+
+QList<QStandardItem *> ModelView::prepareColumn(const QString &first,
+ const QString &second,
+ const QString &third)
+{
+ QList<QStandardItem *> colItems;
+ colItems << new QStandardItem(first);
+ colItems << new QStandardItem(second);
+ colItems << new QStandardItem(third);
+ return colItems;
+}
+//! [Quoting ModelView Tutorial]
diff --git a/examples/tutorials/modelview/6_treeview/modelview.h b/examples/tutorials/modelview/6_treeview/modelview.h
new file mode 100755
index 0000000..a47111c
--- /dev/null
+++ b/examples/tutorials/modelview/6_treeview/modelview.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MODELVIEW_H
+#define MODELVIEW_H
+
+#include <QtGui/QMainWindow>
+
+class QTreeView; //forward declaration
+class QStandardItemModel;
+class QStandardItem;
+
+
+class ModelView : public QMainWindow
+{
+ Q_OBJECT
+private:
+ QTreeView *treeView;
+ QStandardItemModel *standardModel;
+ QList<QStandardItem *> prepareColumn(const QString &first,
+ const QString &second,
+ const QString &third);
+public:
+ ModelView(QWidget *parent = 0);
+};
+
+#endif // MODELVIEW_H
diff --git a/examples/tutorials/modelview/7_selections/7_selections.pro b/examples/tutorials/modelview/7_selections/7_selections.pro
new file mode 100755
index 0000000..952641c6
--- /dev/null
+++ b/examples/tutorials/modelview/7_selections/7_selections.pro
@@ -0,0 +1,5 @@
+TARGET = mv_selections
+TEMPLATE = app
+SOURCES += main.cpp \
+ modelview.cpp
+HEADERS += modelview.h
diff --git a/examples/tutorials/modelview/7_selections/main.cpp b/examples/tutorials/modelview/7_selections/main.cpp
new file mode 100755
index 0000000..7be212e
--- /dev/null
+++ b/examples/tutorials/modelview/7_selections/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include "modelview.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ ModelView w;
+ w.show();
+ return a.exec();
+}
diff --git a/examples/tutorials/modelview/7_selections/modelview.cpp b/examples/tutorials/modelview/7_selections/modelview.cpp
new file mode 100755
index 0000000..3b373c6
--- /dev/null
+++ b/examples/tutorials/modelview/7_selections/modelview.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+//! [quoting modelview_a]
+#include <QTreeView>
+#include <QStandardItemModel>
+#include <QItemSelectionModel>
+#include "modelview.h"
+
+ModelView::ModelView(QWidget *parent)
+ : QMainWindow(parent)
+{
+ treeView = new QTreeView(this);
+ setCentralWidget(treeView);
+ standardModel = new QStandardItemModel ;
+ QStandardItem *rootNode = standardModel->invisibleRootItem();
+
+
+ //defining a couple of items
+ QStandardItem *americaItem = new QStandardItem("America");
+ QStandardItem *mexicoItem = new QStandardItem("Canada");
+ QStandardItem *usaItem = new QStandardItem("USA");
+ QStandardItem *bostonItem = new QStandardItem("Boston");
+ QStandardItem *europeItem = new QStandardItem("Europe");
+ QStandardItem *italyItem = new QStandardItem("Italy");
+ QStandardItem *romeItem = new QStandardItem("Rome");
+ QStandardItem *veronaItem = new QStandardItem("Verona");
+
+ //building up the hierarchy
+ rootNode-> appendRow(americaItem);
+ rootNode-> appendRow(europeItem);
+ americaItem-> appendRow(mexicoItem);
+ americaItem-> appendRow(usaItem);
+ usaItem-> appendRow(bostonItem);
+ europeItem-> appendRow(italyItem);
+ italyItem-> appendRow(romeItem);
+ italyItem-> appendRow(veronaItem);
+
+ //register the model
+ treeView->setModel(standardModel);
+ treeView->expandAll();
+
+ //selection changes shall trigger a slot
+ QItemSelectionModel *selectionModel= treeView->selectionModel();
+ connect(selectionModel, SIGNAL(selectionChanged (const QItemSelection &, const QItemSelection &)),
+ this, SLOT(selectionChangedSlot(const QItemSelection &, const QItemSelection &)));
+}
+//! [quoting modelview_a]
+
+//------------------------------------------------------------------------------------
+
+//! [quoting modelview_b]
+void ModelView::selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/)
+{
+ const QModelIndex index = treeView->selectionModel()->currentIndex();
+ QString selectedText = index.data(Qt::DisplayRole).toString();
+ int hierarchyLevel=1;
+ QModelIndex seekRoot = index;
+ while(seekRoot.parent() != QModelIndex())
+ {
+ seekRoot = seekRoot.parent();
+ hierarchyLevel++;
+ }
+ QString showString = QString("%1, Level %2").arg(selectedText)
+ .arg(hierarchyLevel);
+ setWindowTitle(showString);
+}
+//! [quoting modelview_b]
+
+
diff --git a/examples/tutorials/modelview/7_selections/modelview.h b/examples/tutorials/modelview/7_selections/modelview.h
new file mode 100755
index 0000000..5229ac3
--- /dev/null
+++ b/examples/tutorials/modelview/7_selections/modelview.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MODELVIEW_H
+#define MODELVIEW_H
+
+#include <QtGui/QMainWindow>
+
+class QTreeView; //forward declaration
+class QStandardItemModel;
+class QItemSelection;
+
+
+class ModelView : public QMainWindow
+{
+ Q_OBJECT
+private:
+ QTreeView *treeView;
+ QStandardItemModel *standardModel;
+private slots:
+ void selectionChangedSlot(const QItemSelection & newSelection, const QItemSelection & oldSelection);
+public:
+ ModelView(QWidget *parent = 0);
+};
+
+#endif // MODELVIEW_H
diff --git a/examples/tutorials/modelview/modelview.pro b/examples/tutorials/modelview/modelview.pro
new file mode 100755
index 0000000..7f684ba
--- /dev/null
+++ b/examples/tutorials/modelview/modelview.pro
@@ -0,0 +1,10 @@
+TEMPLATE = subdirs
+
+SUBDIRS = 1_readonly \
+ 2_formatting \
+ 3_changingmodel \
+ 4_headers \
+ 5_edit \
+ 6_treeview \
+ 7_selections
+
diff --git a/examples/tutorials/tutorials.pro b/examples/tutorials/tutorials.pro
index 949fdf6..34723c2 100644
--- a/examples/tutorials/tutorials.pro
+++ b/examples/tutorials/tutorials.pro
@@ -1,6 +1,8 @@
TEMPLATE = subdirs
SUBDIRS = \
- addressbook
+ addressbook \
+ modelview
+
# install
sources.files = README *.pro
diff --git a/mkspecs/features/uic.prf b/mkspecs/features/uic.prf
index 5324e65..0a18b47 100644
--- a/mkspecs/features/uic.prf
+++ b/mkspecs/features/uic.prf
@@ -86,20 +86,20 @@ defineReplace(imageCollectionCmd) {
for(image, $$list($$split(1))) {
EMBEDDED_IMAGES += $$image
count(EMBEDDED_IMAGES, 5) {
- isEmpty(RET): RET += echo $$EMBEDDED_IMAGES > images.tmp $$escape_expand(\\n\\t)
- else: RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\\n\\t)
+ isEmpty(RET): RET += echo $$EMBEDDED_IMAGES > $${UI_DIR}/images.tmp $$escape_expand(\\n\\t)
+ else: RET += echo $$EMBEDDED_IMAGES >> $${UI_DIR}/images.tmp $$escape_expand(\\n\\t)
unset(EMBEDDED_IMAGES)
}
}
- !isEmpty(EMBEDDED_IMAGES):RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\\n\\t)
+ !isEmpty(EMBEDDED_IMAGES):RET += echo $$EMBEDDED_IMAGES >> $${UI_DIR}/images.tmp $$escape_expand(\\n\\t)
!isEmpty(RET) {
- RET += $$QMAKE_UIC3 -embed $$TARGET -f images.tmp -o $$2 $$escape_expand(\\n\\t)
+ RET += $$QMAKE_UIC3 -embed $$TARGET -f $${UI_DIR}/images.tmp -o $$2 $$escape_expand(\\n\\t)
return($$RET)
}
return($$QMAKE_UIC3 -embed $$TARGET $$1 -o $$2)
}
-image_collection.output = qmake_image_collection$${first(QMAKE_EXT_CPP)}
+image_collection.output = $${UI_DIR}/qmake_image_collection$${first(QMAKE_EXT_CPP)}
image_collection.variable_out = SOURCES
image_collection.input = IMAGES
image_collection.CONFIG += combine
@@ -109,7 +109,7 @@ image_collection.name = UIC3 Image collection in ${QMAKE_FILE_OUT}
silent:image_collection.commands = @echo uic3 -embed ${QMAKE_FILE_IN} && $$image_collection.commands
} else {
image_collection.commands = ${QMAKE_FUNC_imageCollectionCmd}
- silent:image_collection.commands = @echo uic3 -embed $$TARGET -f images.tmp && $image_collection.commands
+ silent:image_collection.commands = @echo uic3 -embed $$TARGET -f $${UI_DIR}/images.tmp && $image_collection.commands
}
QMAKE_EXTRA_COMPILERS += image_collection
diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf
index cced090..a977e7a 100644
--- a/mkspecs/linux-g++-maemo/qmake.conf
+++ b/mkspecs/linux-g++-maemo/qmake.conf
@@ -27,7 +27,4 @@ QMAKE_CXXFLAGS_RELEASE += -g -fno-omit-frame-pointer -fno-optimize-sibling-call
# Work round PowerVR SGX 1.3 driver bug with glScissor & FBOs:
DEFINES += QT_GL_NO_SCISSOR_TEST
-# Work round SGX 1.4 driver bug (text corrupted), modify glyph cache width:
-DEFINES += QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024
-
load(qt_config)
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index d6b3e09..45a96f5 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -1756,6 +1756,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
}
QStringList tmp_dep = project->values((*it) + ".depends");
QString tmp_dep_cmd;
+ QString dep_cd_cmd;
if(!project->isEmpty((*it) + ".depend_command")) {
int argv0 = -1;
QStringList cmdline = project->values((*it) + ".depend_command");
@@ -1774,6 +1775,9 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
cmdline[argv0] = escapeFilePath(cmdline.at(argv0));
}
}
+ dep_cd_cmd = QLatin1String("cd ")
+ + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false))
+ + QLatin1String(" && ");
}
QStringList &vars = project->values((*it) + ".variables");
if(tmp_out.isEmpty() || tmp_cmd.isEmpty())
@@ -1875,7 +1879,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
char buff[256];
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, (*input),
tmp_out);
- dep_cmd = fixEnvVariables(dep_cmd);
+ dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
QString indeps;
while(!feof(proc)) {
@@ -1973,7 +1977,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
char buff[256];
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, (*input), out);
- dep_cmd = fixEnvVariables(dep_cmd);
+ dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
QString indeps;
while(!feof(proc)) {
diff --git a/src/3rdparty/phonon/phonon/mediasource.cpp b/src/3rdparty/phonon/phonon/mediasource.cpp
index be22dc3..11d2428 100644
--- a/src/3rdparty/phonon/phonon/mediasource.cpp
+++ b/src/3rdparty/phonon/phonon/mediasource.cpp
@@ -50,7 +50,7 @@ MediaSource::MediaSource(const QString &filename)
const QFileInfo fileInfo(filename);
if (fileInfo.exists()) {
bool localFs = QAbstractFileEngine::LocalDiskFlag & QFSFileEngine(filename).fileFlags(QAbstractFileEngine::LocalDiskFlag);
- if (localFs) {
+ if (localFs && !filename.startsWith(QLatin1String(":/")) && !filename.startsWith(QLatin1String("qrc://"))) {
d->url = QUrl::fromLocalFile(fileInfo.absoluteFilePath());
} else {
#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
diff --git a/src/3rdparty/sqlite.pri b/src/3rdparty/sqlite.pri
new file mode 100644
index 0000000..575412d
--- /dev/null
+++ b/src/3rdparty/sqlite.pri
@@ -0,0 +1,4 @@
+CONFIG(release, debug|release):DEFINES *= NDEBUG
+DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE
+INCLUDEPATH += $$PWD/sqlite
+SOURCES += $$PWD/sqlite/sqlite3.c
diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
index 0342c9f..9dcba60 100644
--- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
@@ -612,7 +612,7 @@ QAction* QDeclarativeWebView::stopAction() const
#endif // QT_NO_ACTION
/*!
- \qmlproperty real WebView::title
+ \qmlproperty string WebView::title
This property holds the title of the web page currently viewed
By default, this property contains an empty string.
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index ed2ae6e..5cd7f0e 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -470,6 +470,7 @@
\value TextIncludeTrailingSpaces Same as IncludeTrailingSpaces
\value TextJustificationForced Ensures that text lines are justified.
+ \omitvalue TextBypassShaping
\omitvalue BreakAnywhere
\omitvalue DontClip
\omitvalue DontPrint
@@ -1730,7 +1731,7 @@
\value Key_MediaLast
\value Key_unknown
- \value Key_Call A key to answer or initiate a call (see \l Key_ToggleCallHangup for a key to toggle current call state)
+ \value Key_Call A key to answer or initiate a call (see Qt::Key_ToggleCallHangup for a key to toggle current call state)
\value Key_Camera A key to activate the camera shutter
\value Key_CameraFocus A key to focus the camera
\value Key_Context1
@@ -1738,7 +1739,7 @@
\value Key_Context3
\value Key_Context4
\value Key_Flip
- \value Key_Hangup A key to end an ongoing call (see \l Key_ToggleCallHangup for a key to toggle current call state)
+ \value Key_Hangup A key to end an ongoing call (see Qt::Key_ToggleCallHangup for a key to toggle current call state)
\value Key_No
\value Key_Select
\value Key_Yes
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index 4a25562..1dd51ea 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -155,10 +155,10 @@ public:
if ((first - buf) < size) {
// underflow, the existing valid data needs to move to the end of the (potentially bigger) buffer
makeSpace(len + size, freeSpaceAtStart);
- memcpy(first - size, block, size);
}
first -= size;
len += size;
+ memcpy(first, block, size);
}
private:
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 9bc4063..739ac4d 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1399,10 +1399,10 @@ QString QProcess::nativeArguments() const
\since 4.7
\overload
- Sets additional native command line arguments for the program.
+ Sets additional native command line \a arguments for the program.
On operating systems where the system API for passing command line
- arguments to a subprocess natively uses a single string, one can
+ \a arguments to a subprocess natively uses a single string, one can
conceive command lines which cannot be passed via QProcess's portable
list-based API. In such cases this function must be used to set a
string which is \e appended to the string composed from the usual
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 8415259..e3fce18 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -1197,7 +1197,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent,
\l{QAbstractItemModel::}{endInsertRows()} must be called.
\sa {Model Classes}, {Model Subclassing Reference}, QModelIndex,
- QAbstractItemView, {Using Drag and Drop with Item Views},
+ QAbstractItemView, {Using drag & drop with item views},
{Simple DOM Model Example}, {Simple Tree Model Example},
{Editable Tree Model Example}, {Fetch More Example}
*/
@@ -1761,7 +1761,7 @@ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const
where to place the data. This can occur in a tree when data is dropped on
a parent. Models will usually append the data to the parent in this case.
- \sa supportedDropActions(), {Using Drag and Drop with Item Views}
+ \sa supportedDropActions(), {Using drag & drop with item views}
*/
bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent)
@@ -1798,8 +1798,8 @@ bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
reimplement the dropMimeData() function to handle the additional
operations.
- \sa dropMimeData(), Qt::DropActions, {Using Drag and Drop with Item
- Views}
+ \sa dropMimeData(), Qt::DropActions, {Using drag & drop with item
+ views}
*/
Qt::DropActions QAbstractItemModel::supportedDropActions() const
{
@@ -1815,7 +1815,7 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const
supportedDragActions() is used by QAbstractItemView::startDrag() as the
default values when a drag occurs.
- \sa Qt::DropActions, {Using Drag and Drop with Item Views}
+ \sa Qt::DropActions, {Using drag & drop with item views}
*/
Qt::DropActions QAbstractItemModel::supportedDragActions() const
{
@@ -1831,7 +1831,7 @@ Qt::DropActions QAbstractItemModel::supportedDragActions() const
Sets the supported drag \a actions for the items in the model.
- \sa supportedDragActions(), {Using Drag and Drop with Item Views}
+ \sa supportedDragActions(), {Using drag & drop with item views}
*/
void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions)
{
@@ -2547,7 +2547,7 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
For example, as shown in the diagram, we move three rows from
row 2 to 4 in the source, so \a sourceFirst is 2 and \a sourceLast is 4.
- We move those items to above row 2 in the destination, so \a destinationRow is 2.
+ We move those items to above row 2 in the destination, so \a destinationChild is 2.
\snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 6
@@ -2558,7 +2558,7 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
\o To append rows to another parent, move them to after the last row.
For example, as shown in the diagram, we move three rows to a
- collection of 6 existing rows (ending in row 5), so \a destinationStart is 6:
+ collection of 6 existing rows (ending in row 5), so \a destinationChild is 6:
\snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 7
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index a51ee81..6b1de5e 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -2096,6 +2096,7 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l)
\value Serbia
\value SaintBarthelemy
\value SaintMartin
+ \value LatinAmericaAndTheCaribbean
\omitvalue LastCountry
\sa country()
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 57f79a0..b2cf49b 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -6954,7 +6954,7 @@ bool QString::isRightToLeft() const
/*! \fn bool QString::isRightToLeft() const
- \internal
+ Returns true if the string is read right to left.
*/
diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp
index 5e6d5e7..b2b0c8a 100644
--- a/src/declarative/debugger/qdeclarativedebugtrace.cpp
+++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp
@@ -78,6 +78,9 @@ void QDeclarativeDebugTrace::endRange(RangeType t)
void QDeclarativeDebugTrace::addEventImpl(EventType event)
{
+ if (!isEnabled())
+ return;
+
QByteArray data;
QDataStream ds(&data, QIODevice::WriteOnly);
ds << m_timer.elapsed() << (int)Event << (int)event;
@@ -86,6 +89,9 @@ void QDeclarativeDebugTrace::addEventImpl(EventType event)
void QDeclarativeDebugTrace::startRangeImpl(RangeType range)
{
+ if (!isEnabled())
+ return;
+
QByteArray data;
QDataStream ds(&data, QIODevice::WriteOnly);
ds << m_timer.elapsed() << (int)RangeStart << (int)range;
@@ -94,6 +100,9 @@ void QDeclarativeDebugTrace::startRangeImpl(RangeType range)
void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &u)
{
+ if (!isEnabled())
+ return;
+
QByteArray data;
QDataStream ds(&data, QIODevice::WriteOnly);
ds << m_timer.elapsed() << (int)RangeData << (int)range << (QString)u.toString();
@@ -102,6 +111,9 @@ void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &u)
void QDeclarativeDebugTrace::endRangeImpl(RangeType range)
{
+ if (!isEnabled())
+ return;
+
QByteArray data;
QDataStream ds(&data, QIODevice::WriteOnly);
ds << m_timer.elapsed() << (int)RangeEnd << (int)range;
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 44c206b..4881248 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -149,6 +149,8 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage()
\endqml
The URL may be absolute, or relative to the URL of the component.
+
+ \sa QDeclarativeImageProvider
*/
void QDeclarativeBorderImage::setSource(const QUrl &url)
{
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 190b22c..b9498f1 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1388,26 +1388,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec
*/
/*!
- \property QDeclarativeItem::baseline
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::focus
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::wantsFocus
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::transformOrigin
- \internal
-*/
-
-/*!
\fn void QDeclarativeItem::childrenRectChanged(const QRectF &)
\internal
*/
@@ -1970,6 +1950,9 @@ QVariant QDeclarativeItem::inputMethodQuery(Qt::InputMethodQuery query) const
return v;
}
+/*!
+ \internal
+ */
void QDeclarativeItem::keyPressPreHandler(QKeyEvent *event)
{
Q_D(QDeclarativeItem);
@@ -1980,6 +1963,9 @@ void QDeclarativeItem::keyPressPreHandler(QKeyEvent *event)
d->doneEventPreHandler = true;
}
+/*!
+ \internal
+ */
void QDeclarativeItem::keyReleasePreHandler(QKeyEvent *event)
{
Q_D(QDeclarativeItem);
@@ -1990,6 +1976,9 @@ void QDeclarativeItem::keyReleasePreHandler(QKeyEvent *event)
d->doneEventPreHandler = true;
}
+/*!
+ \internal
+ */
void QDeclarativeItem::inputMethodPreHandler(QInputMethodEvent *event)
{
Q_D(QDeclarativeItem);
@@ -2000,7 +1989,6 @@ void QDeclarativeItem::inputMethodPreHandler(QInputMethodEvent *event)
d->doneEventPreHandler = true;
}
-
/*!
\internal
*/
@@ -2503,7 +2491,7 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transi
\qmlproperty bool Item::clip
This property holds whether clipping is enabled.
- if clipping is enabled, an item will clip its own painting, as well
+ If clipping is enabled, an item will clip its own painting, as well
as the painting of its children, to its bounding rectangle.
Non-rectangular clipping regions are not supported for performance reasons.
@@ -2543,11 +2531,6 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transi
\sa {qmlstates}{States}
*/
-/*!
- \property QDeclarativeItem::state
- \internal
-*/
-
/*! \internal */
QString QDeclarativeItemPrivate::state() const
{
@@ -2570,11 +2553,6 @@ void QDeclarativeItemPrivate::setState(const QString &state)
For more information see \l Transform.
*/
-/*!
- \property QDeclarativeItem::transform
- \internal
-*/
-
/*! \internal */
QDeclarativeListProperty<QGraphicsTransform> QDeclarativeItem::transform()
{
@@ -2863,6 +2841,26 @@ void QDeclarativeItem::setSmooth(bool smooth)
}
/*!
+ \property QDeclarativeItem::focus
+ \internal
+*/
+
+/*!
+ \property QDeclarativeItem::transform
+ \internal
+*/
+
+/*!
+ \property QDeclarativeItem::transformOrigin
+ \internal
+*/
+
+/*!
+ \property QDeclarativeItem::wantsFocus
+ \internal
+*/
+
+/*!
\internal
Return the width of the item
*/
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 110c970..fa422fd 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1732,7 +1732,7 @@ void QDeclarativeListView::setHighlight(QDeclarativeComponent *highlight)
highlight is not moved by the view, and any movement must be implemented
by the highlight.
- Here is a highlight with its motion defined by a \l {SpringAniamtion} item:
+ Here is a highlight with its motion defined by a \l {SpringAnimation} item:
\snippet doc/src/snippets/declarative/listview/listview.qml highlightFollowsCurrentItem
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index e745ca6..cc7f8e5 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -118,9 +118,9 @@ void QDeclarativeLoaderPrivate::initResize()
be instantiated may be specified directly by the \l sourceComponent
property, or loaded from a URL via the \l source property.
- Loader can be used to delay the creation of a component until it is required.
- For example, this loads "Page1.qml" as a component into the Loader element
- when the \l MouseArea is clicked:
+ Loader can be used to delay the creation of a component until it
+ is required. For example, this loads "Page1.qml" as a component
+ into the Loader element, when the \l MouseArea is clicked:
\code
import Qt 4.7
@@ -165,7 +165,6 @@ void QDeclarativeLoaderPrivate::initResize()
/*!
\internal
\class QDeclarativeLoader
- \qmlclass Loader
*/
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 9a281e5..ba4fa21 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -1127,6 +1127,15 @@ int QDeclarativeText::resourcesLoading() const
return d->doc ? d->doc->resourcesLoading() : 0;
}
+/*!
+ \qmlproperty bool Text::clip
+ This property holds whether the text is clipped.
+
+ Note that if the text does not fit in the bounding rectangle it will be abruptly chopped.
+
+ If you want to display potentially long text in a limited space, you probably want to use \c elide instead.
+*/
+
void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
Q_D(QDeclarativeText);
@@ -1146,13 +1155,10 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid
bool needClip = clip() && (d->imgCache.width() > width() ||
d->imgCache.height() > height());
- if (needClip) {
- p->save();
- p->setClipRect(boundingRect(), Qt::IntersectClip);
- }
- p->drawPixmap(br.x(), br.y(), d->imgCache);
if (needClip)
- p->restore();
+ p->drawPixmap(0, 0, width(), height(), d->imgCache, -br.x(), -br.y(), width(), height());
+ else
+ p->drawPixmap(br.x(), br.y(), d->imgCache);
if (d->smooth) {
p->setRenderHint(QPainter::Antialiasing, oldAA);
@@ -1166,7 +1172,7 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid
if (needClip) {
p->save();
- p->setClipRect(boundingRect(), Qt::IntersectClip);
+ p->setClipRect(0, 0, width(), height(), Qt::IntersectClip);
}
if (d->richText) {
QAbstractTextDocumentLayout::PaintContext context;
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp