summaryrefslogtreecommitdiffstats
path: root/doc/Tcl_Main.3
Commit message (Expand)AuthorAgeFilesLines
* * doc/NRE.3: Formatting errors found by `make html`dgp2008-12-191-2/+2
* TIP #338 IMPLEMENTATIONdgp2008-12-151-19/+63
* Improve clarity of formatting.dkf2008-10-171-1/+3
* Prepare Tcl's docs for life as 8.6 (remove out of date change bars, fixdkf2008-06-291-8/+6
* merge stable branch onto HEADdgp2007-12-131-1/+1
* GOOBE the docs some more.dkf2007-10-291-3/+3
* First stage of doing GOOBE improvements to documentation now that the html ge...dkf2007-10-281-4/+7
* * changes: Updated for 8.5b2 release.core_8_5_b2dgp2007-10-261-7/+5
* Lots of improvements to look and feel of manual pagesdkf2007-10-241-5/+7
* Update the .AS macro definition and take advantage of it's new-found power.dkf2004-10-071-2/+2
* one more bit of TIP 137 documentation...dgp2003-09-051-6/+7
* Spell-check, fixed typos (Updates from Larry Virden).jenglish2002-07-011-2/+2
* * Documented $tcl_rcFileName and added moredgp2002-06-051-9/+29
* typo correctiondgp2002-01-141-2/+2
* * doc/Tcl_Main.3:dgp2002-01-051-15/+54
* * Several typo and formatting corrections discovereddgp2001-12-101-2/+2
* * doc/tclsh.1:andreas_kupries2001-09-101-1/+10
* doc/Tcl_Main.3: added docs for Tcl_SetMainLoophobbs2000-11-031-6/+26
* Replaced SCCS strings, fixed binary filescore_8_0_3stanton1998-09-141-1/+1
* Initial revisionrjohnson1998-03-261-0/+61
style='width: 0.0%;'/> -rw-r--r--src/3rdparty/libconninet/src/maemo_icd.cpp63
-rw-r--r--src/3rdparty/libconninet/tests/Makefile.am39
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp1
-rw-r--r--src/corelib/codecs/qtextcodec_symbian.cpp6
-rw-r--r--src/corelib/concurrent/qtconcurrentrun.cpp2
-rw-r--r--src/corelib/io/qprocess_symbian.cpp47
-rw-r--r--src/corelib/tools/qhash.h5
-rw-r--r--src/corelib/tools/qlinkedlist.h5
-rw-r--r--src/corelib/tools/qlist.h5
-rw-r--r--src/corelib/tools/qmap.h5
-rw-r--r--src/corelib/tools/qshareddata.h20
-rw-r--r--src/corelib/tools/qvector.h5
-rw-r--r--src/declarative/debugger/qdeclarativedebug.cpp6
-rw-r--r--src/declarative/debugger/qdeclarativedebug_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeevents.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp26
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativefocuspanel.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativefocusscope.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp48
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp7
-rw-r--r--src/declarative/graphicsitems/qdeclarativelayoutitem.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp108
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath_p.h5
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners.cpp119
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p.h8
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p_p.h5
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativerepeater.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp22
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp51
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h3
-rw-r--r--src/declarative/qml/parser/qdeclarativejslexer.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp11
-rw-r--r--src/declarative/qml/qdeclarativecompositetypemanager.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecontext.cpp17
-rw-r--r--src/declarative/qml/qdeclarativecontext_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp34
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp45
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug_p.h11
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp2
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp1
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp87
-rw-r--r--src/declarative/qml/qmetaobjectbuilder.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp184
-rw-r--r--src/declarative/util/qdeclarativeanimation_p.h18
-rw-r--r--src/declarative/util/qdeclarativebehavior.cpp1
-rw-r--r--src/declarative/util/qdeclarativebind.cpp1
-rw-r--r--src/declarative/util/qdeclarativeconnections.cpp1
-rw-r--r--src/declarative/util/qdeclarativefontloader.cpp2
-rw-r--r--src/declarative/util/qdeclarativefontloader_p.h1
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp8
-rw-r--r--src/declarative/util/qdeclarativelistmodelworkeragent.cpp16
-rw-r--r--src/declarative/util/qdeclarativelistmodelworkeragent_p.h4
-rw-r--r--src/declarative/util/qdeclarativepackage.cpp1
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp120
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp1
-rw-r--r--src/declarative/util/qdeclarativespringanimation.cpp1
-rw-r--r--src/declarative/util/qdeclarativestate.cpp1
-rw-r--r--src/declarative/util/qdeclarativestategroup.cpp5
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp3
-rw-r--r--src/declarative/util/qdeclarativesystempalette.cpp1
-rw-r--r--src/declarative/util/qdeclarativetimer.cpp1
-rw-r--r--src/declarative/util/qdeclarativetransition.cpp1
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp2
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm25
-rw-r--r--src/gui/egl/qegl_x11.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp4
-rw-r--r--src/gui/image/qpixmap.cpp8
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp8
-rw-r--r--src/gui/kernel/qaction_p.h8
-rw-r--r--src/gui/kernel/qapplication.cpp24
-rw-r--r--src/gui/kernel/qapplication_s60.cpp76
-rw-r--r--src/gui/kernel/qclipboard_x11.cpp3
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm5
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac_p.h1
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm12
-rw-r--r--src/gui/kernel/qgesturemanager.cpp7
-rw-r--r--src/gui/kernel/qt_s60_p.h1
-rw-r--r--src/gui/kernel/qwidget.cpp74
-rw-r--r--src/gui/kernel/qwidget_mac.mm18
-rw-r--r--src/gui/kernel/qwidget_p.h17
-rw-r--r--src/gui/kernel/qwidget_s60.cpp34
-rw-r--r--src/gui/painting/painting.pri1
-rw-r--r--src/gui/painting/qbackingstore.cpp9
-rw-r--r--src/gui/painting/qdrawhelper.cpp11
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp253
-rw-r--r--src/gui/painting/qgrayraster.c80
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp24
-rw-r--r--src/gui/painting/qpainter.cpp7
-rw-r--r--src/gui/painting/qwindowsurface_qws.cpp6
-rw-r--r--src/gui/text/qtextcontrol.cpp8
-rw-r--r--src/gui/text/qtextobject.cpp4
-rw-r--r--src/gui/util/qcompleter.cpp2
-rw-r--r--src/gui/widgets/qcocoamenu_mac.mm12
-rw-r--r--src/gui/widgets/qcocoamenu_mac_p.h1
-rw-r--r--src/gui/widgets/qdatetimeedit.h2
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp1
-rw-r--r--src/imports/gestures/qdeclarativegesturearea.cpp2
-rw-r--r--src/imports/particles/qdeclarativeparticles.cpp4
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp1
-rw-r--r--src/network/bearer/qnetworkconfiguration.cpp7
-rw-r--r--src/network/bearer/qnetworkconfiguration.h10
-rw-r--r--src/network/bearer/qnetworksession.h4
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp16
-rw-r--r--src/opengl/gl2paintengineex/qtriangulator.cpp8
-rw-r--r--src/opengl/opengl.pro30
-rw-r--r--src/opengl/qgl.cpp90
-rw-r--r--src/opengl/qgl_egl.cpp2
-rw-r--r--src/opengl/qgl_p.h12
-rw-r--r--src/opengl/qgl_symbian.cpp362
-rw-r--r--src/opengl/qpixmapdata_gl.cpp6
-rw-r--r--src/openvg/qpixmapdata_vg.cpp53
-rw-r--r--src/openvg/qpixmapdata_vg_p.h8
-rw-r--r--src/plugins/bearer/bearer.pro2
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp4
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp21
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp95
-rw-r--r--src/plugins/bearer/icd/qicdengine.h2
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp13
-rw-r--r--src/plugins/graphicssystems/opengl/opengl.pro2
-rw-r--r--src/s60installs/bwins/QtDeclarativeu.def1
-rw-r--r--src/s60installs/bwins/QtGuiu.def4
-rw-r--r--src/s60installs/eabi/QtDeclarativeu.def1
-rw-r--r--src/s60installs/eabi/QtGuiu.def1
-rw-r--r--src/s60installs/eabi/QtNetworku.def2
-rw-r--r--src/s60installs/qt.iby3
-rw-r--r--src/s60installs/s60installs.pro5
-rw-r--r--src/tools/moc/generator.cpp48
-rw-r--r--src/tools/moc/moc.cpp58
-rw-r--r--src/tools/moc/moc.h1
-rw-r--r--tests/auto/collections/tst_collections.cpp129
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/nonTransitionBug.qml30
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp31
-rw-r--r--tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h24
-rw-r--r--tests/auto/declarative/qdeclarativeflickable/data/flickableqgraphicswidget.qml7
-rw-r--r--tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp37
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart-arm.pngbin12596 -> 0 bytes-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart-mac.pngbin12621 -> 0 bytes-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart-win32.pngbin12621 -> 12457 bytes-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart.pngbin12577 -> 12424 bytes-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200-arm.pngbin8063 -> 0 bytes-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200-mac.pngbin8062 -> 0 bytes-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200-win32.pngbin8062 -> 7939 bytes-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200.pngbin8063 -> 7943 bytes-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp30
-rw-r--r--tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp109
-rw-r--r--tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativepathview/data/emptymodel.qml5
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp24
-rw-r--r--tests/auto/declarative/qdeclarativepositioners/data/verticalqgraphicswidget.qml24
-rw-r--r--tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp44
-rw-r--r--tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp48
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.html1
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.qml5
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp38
-rw-r--r--tests/auto/macnativeevents/tst_macnativeevents.cpp81
-rw-r--r--tests/auto/moc/error-on-wrong-notify.h53
-rw-r--r--tests/auto/moc/tst_moc.cpp22
-rw-r--r--tests/auto/qapplication/modal/base.cpp62
-rw-r--r--tests/auto/qapplication/modal/base.h64
-rw-r--r--tests/auto/qapplication/modal/main.cpp52
-rw-r--r--tests/auto/qapplication/modal/modal.pro8
-rw-r--r--tests/auto/qapplication/qapplication.pro1
-rw-r--r--tests/auto/qapplication/tst_qapplication.cpp18
-rw-r--r--tests/auto/qdatastream/tst_qdatastream.cpp2
-rw-r--r--tests/auto/qgl/tst_qgl.cpp3
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp26
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp40
-rw-r--r--tests/auto/qmake/testdata/substitutes/sub/test2.in1
-rw-r--r--tests/auto/qmake/testdata/substitutes/test.in2
-rw-r--r--tests/auto/qmake/testdata/substitutes/test.pro1
-rw-r--r--tests/auto/qmake/testdata/substitutes_build/README1
-rw-r--r--tests/auto/qmake/tst_qmake.cpp16
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp2
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp65
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp20
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp125
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp75
-rw-r--r--tests/benchmarks/README81
-rw-r--r--tests/benchmarks/gui/image/blendbench/main.cpp43
-rw-r--r--tools/assistant/lib/fulltextsearch/qsort_p.h8
-rw-r--r--tools/assistant/lib/qhelpcollectionhandler_p.h3
-rw-r--r--tools/assistant/lib/qhelpengine.h2
-rw-r--r--tools/assistant/lib/qhelpenginecore.cpp2
-rw-r--r--tools/assistant/lib/qhelpenginecore.h2
-rw-r--r--tools/assistant/lib/qhelpsearchengine.h3
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene.cpp4
-rw-r--r--tools/assistant/tools/assistant/bookmarkfiltermodel.cpp2
-rw-r--r--tools/assistant/tools/assistant/bookmarkitem.h2
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanagerwidget.h5
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp2
-rw-r--r--tools/assistant/tools/assistant/installdialog.h2
-rw-r--r--tools/assistant/tools/assistant/main.cpp2
-rw-r--r--tools/assistant/tools/assistant/mainwindow.h2
-rw-r--r--tools/assistant/tools/assistant/searchwidget.h2
-rw-r--r--tools/assistant/tools/qhelpconverter/inputpage.h2
-rw-r--r--tools/linguist/linguist/mainwindow.cpp3
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp10
-rw-r--r--tools/qdoc3/htmlgenerator.cpp166
-rw-r--r--tools/qdoc3/htmlgenerator.h1
-rw-r--r--tools/qdoc3/node.cpp23
-rw-r--r--tools/qdoc3/test/qt-html-templates.qdocconf10
-rw-r--r--tools/qdoc3/tree.cpp6
-rw-r--r--tools/qml/qmlruntime.cpp14
-rw-r--r--tools/qml/qmlruntime.h1
-rw-r--r--tools/qtconfig/main.cpp14
-rw-r--r--tools/qvfb/main.cpp13
-rw-r--r--tools/qvfb/qvfb.cpp54
-rw-r--r--tools/qvfb/qvfbratedlg.cpp10
-rw-r--r--tools/runonphone/ossignalconverter.h2
-rw-r--r--tools/runonphone/runonphone.pro3
-rw-r--r--translations/assistant_ja.ts576
-rw-r--r--translations/assistant_uk.ts763
-rw-r--r--translations/check-ts.xq2
-rw-r--r--translations/designer_ja.ts5360
-rw-r--r--translations/designer_pl.ts1332
-rw-r--r--translations/designer_uk.ts24
-rw-r--r--translations/linguist_ja.ts1383
-rw-r--r--translations/linguist_uk.ts450
-rw-r--r--translations/qt_help_ja.ts313
-rw-r--r--translations/qt_help_uk.ts8
-rw-r--r--translations/qt_ja.ts7282
-rw-r--r--translations/qt_pl.ts2635
-rw-r--r--translations/qt_uk.ts8377
-rw-r--r--translations/qtconfig_ja.ts919
-rw-r--r--translations/qtconfig_uk.ts8
-rw-r--r--translations/qvfb_ja.ts525
-rw-r--r--translations/qvfb_uk.ts10
341 files changed, 20360 insertions, 19213 deletions
diff --git a/configure b/configure
index 35fe2eb..bd69a0a 100755
--- a/configure
+++ b/configure
@@ -2414,10 +2414,15 @@ if [ "$OPT_SHADOW" = "yes" ]; then
# Special case for mkspecs/features directory.
# To be able to place .prf files into a shadow build directory,
# we're creating links for files only. The directory structure is reproduced.
- # A simple "cp -rs" doesn't work on Mac. :(
rm -rf "$outpath/mkspecs/features"
- find "$relpath/mkspecs/features" -type d | sed "s,^$relpath,$outpath," | xargs mkdir -p
- find "$relpath/mkspecs/features" -type f | sed "s,^$relpath/,," | xargs -n 1 -I % ln -s "$relpath/%" "$outpath/%"
+ if [ "$UNAME_SYSTEM" = "Linux" ]; then
+ # This works with GNU coreutils, and is needed for ScratchBox
+ cp -rs "$relpath/mkspecs/features" "$outpath/mkspecs/features"
+ else
+ # A simple "cp -rs" doesn't work on Mac. :(
+ find "$relpath/mkspecs/features" -type d | sed "s,^$relpath,$outpath," | xargs mkdir -p
+ find "$relpath/mkspecs/features" -type f | sed "s,^$relpath/,," | xargs -n 1 -I % ln -s "$relpath/%" "$outpath/%"
+ fi
# symlink the doc directory
rm -rf "$outpath/doc"
@@ -3677,8 +3682,8 @@ fi
-no-scripttools .... Do not build the QtScriptTools module.
+ -scripttools ....... Build the QtScriptTools module.
- + -no-declarative .....Do not build the declarative module.
- -declarative ....... Build the declarative module.
+ -no-declarative .....Do not build the declarative module.
+ + -declarative ....... Build the declarative module.
-platform target ... The operating system and compiler you are building
on ($PLATFORM).
diff --git a/demos/browser/tabwidget.cpp b/demos/browser/tabwidget.cpp
index ae0c88e..cf1cd56 100644
--- a/demos/browser/tabwidget.cpp
+++ b/demos/browser/tabwidget.cpp
@@ -67,12 +67,12 @@ TabBar::TabBar(QWidget *parent)
connect(this, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(contextMenuRequested(QPoint)));
- QString alt = QLatin1String("Alt+%1");
+ QString ctrl = QLatin1String("Ctrl+%1");
for (int i = 1; i <= 10; ++i) {
int key = i;
if (key == 10)
key = 0;
- QShortcut *shortCut = new QShortcut(alt.arg(key), this);
+ QShortcut *shortCut = new QShortcut(ctrl.arg(key), this);
m_tabShortcuts.append(shortCut);
connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction()));
}
diff --git a/demos/declarative/minehunt/MinehuntCore/qmldir b/demos/declarative/minehunt/MinehuntCore/qmldir
index 2beccf9..81980e0 100644
--- a/demos/declarative/minehunt/MinehuntCore/qmldir
+++ b/demos/declarative/minehunt/MinehuntCore/qmldir
@@ -1,3 +1,2 @@
-plugin qmlminehuntplugin
Explosion 1.0 Explosion.qml
Tile 1.0 Tile.qml
diff --git a/demos/declarative/minehunt/README b/demos/declarative/minehunt/README
index b9f1d2a..3849ca5 100644
--- a/demos/declarative/minehunt/README
+++ b/demos/declarative/minehunt/README
@@ -1,3 +1,6 @@
-To compile the C++ part, do 'qmake && make'. Minehunt will not run properly if the C++ plugin is not compiled.
+Minehunt has to be compiled to run.
+
+To compile the C++ part, do 'qmake && make'.
+To run, simply run the executable.
+To deploy on a device, do 'make sis'.
-To run, simply load the minehunt.qml file with the qml runtime.
diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp
new file mode 100644
index 0000000..fc223dd
--- /dev/null
+++ b/demos/declarative/minehunt/main.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 demonstration applications 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$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include <QtDeclarative/QDeclarativeView>
+#include <QtDeclarative/QDeclarativeContext>
+#include <QtDeclarative/QDeclarativeEngine>
+
+#include "minehunt.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QDeclarativeView canvas;
+
+ qmlRegisterType<TileData>();
+ MinehuntGame* game = new MinehuntGame();
+
+#ifdef Q_OS_SYMBIAN
+ canvas.setResizeMode(QDeclarativeView::SizeRootObjectToView);
+#endif
+ canvas.engine()->rootContext()->setContextObject(game);
+ canvas.setSource(QString("minehunt.qml"));
+
+#ifdef Q_OS_SYMBIAN
+ canvas.showFullScreen();
+#else
+ canvas.setGeometry(QRect(100, 100, 450, 450));
+ canvas.show();
+#endif
+ return app.exec();
+}
diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp
index 2a4ed10..9c82f30 100644
--- a/demos/declarative/minehunt/minehunt.cpp
+++ b/demos/declarative/minehunt/minehunt.cpp
@@ -40,99 +40,10 @@
****************************************************************************/
#include <stdlib.h>
-#include <qdeclarativeextensionplugin.h>
-#include <qdeclarativecontext.h>
-#include <qdeclarativeengine.h>
-#include <qdeclarative.h>
-
#include <QTime>
#include <QTimer>
-class TileData : public QObject
-{
- Q_OBJECT
-public:
- TileData() : _hasFlag(false), _hasMine(false), _hint(-1), _flipped(false) {}
-
- Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged)
- bool hasFlag() const { return _hasFlag; }
-
- Q_PROPERTY(bool hasMine READ hasMine NOTIFY hasMineChanged)
- bool hasMine() const { return _hasMine; }
-
- Q_PROPERTY(int hint READ hint NOTIFY hintChanged)
- int hint() const { return _hint; }
-
- Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged())
- bool flipped() const { return _flipped; }
-
- void setHasFlag(bool flag) {if(flag==_hasFlag) return; _hasFlag = flag; emit hasFlagChanged();}
- void setHasMine(bool mine) {if(mine==_hasMine) return; _hasMine = mine; emit hasMineChanged();}
- void setHint(int hint) { if(hint == _hint) return; _hint = hint; emit hintChanged(); }
- void flip() { if (_flipped) return; _flipped = true; emit flippedChanged(); }
- void unflip() { if(!_flipped) return; _flipped = false; emit flippedChanged(); }
-
-signals:
- void flippedChanged();
- void hasFlagChanged();
- void hintChanged();
- void hasMineChanged();
-
-private:
- bool _hasFlag;
- bool _hasMine;
- int _hint;
- bool _flipped;
-};
-
-class MinehuntGame : public QObject
-{
- Q_OBJECT
-public:
- MinehuntGame();
-
- Q_PROPERTY(QDeclarativeListProperty<TileData> tiles READ tiles CONSTANT)
- QDeclarativeListProperty<TileData> tiles();
-
- Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged)
- bool isPlaying() {return playing;}
-
- Q_PROPERTY(bool hasWon READ hasWon NOTIFY hasWonChanged)
- bool hasWon() {return won;}
-
- Q_PROPERTY(int numMines READ numMines NOTIFY numMinesChanged)
- int numMines() const{return nMines;}
-
- Q_PROPERTY(int numFlags READ numFlags NOTIFY numFlagsChanged)
- int numFlags() const{return nFlags;}
-
-public slots:
- Q_INVOKABLE bool flip(int row, int col);
- Q_INVOKABLE bool flag(int row, int col);
- void setBoard();
- void reset();
-
-signals:
- void isPlayingChanged();
- void hasWonChanged();
- void numMinesChanged();
- void numFlagsChanged();
-
-private:
- bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; }
- TileData *tile( int row, int col ) { return onBoard(row, col) ? _tiles[col+numRows*row] : 0; }
- int getHint(int row, int col);
- void setPlaying(bool b){if(b==playing) return; playing=b; emit isPlayingChanged();}
-
- QList<TileData *> _tiles;
- int numCols;
- int numRows;
- bool playing;
- bool won;
- int remaining;
- int nMines;
- int nFlags;
-};
+#include "minehunt.h"
void tilesPropAppend(QDeclarativeListProperty<TileData>* prop, TileData* value)
{
@@ -306,29 +217,3 @@ bool MinehuntGame::flag(int row, int col)
emit numFlagsChanged();
return true;
}
-
-class MinehuntExtensionPlugin : public QDeclarativeExtensionPlugin
-{
- Q_OBJECT
-
- public:
- void registerTypes(const char *uri) {
- Q_UNUSED(uri);
- qmlRegisterType<TileData>();
- }
-
- void initializeEngine(QDeclarativeEngine *engine, const char *uri) {
- Q_UNUSED(uri);
-
- srand(QTime(0,0,0).secsTo(QTime::currentTime()));
-
- MinehuntGame* game = new MinehuntGame();
-
- engine->rootContext()->setContextObject(game);
- }
-};
-
-#include "minehunt.moc"
-
-Q_EXPORT_PLUGIN(MinehuntExtensionPlugin);
-
diff --git a/demos/declarative/minehunt/minehunt.h b/demos/declarative/minehunt/minehunt.h
new file mode 100644
index 0000000..962cf3d
--- /dev/null
+++ b/demos/declarative/minehunt/minehunt.h
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** 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 demonstration applications 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$
+**
+****************************************************************************/
+
+
+#include <qdeclarative.h>
+
+class TileData : public QObject
+{
+ Q_OBJECT
+public:
+ TileData() : _hasFlag(false), _hasMine(false), _hint(-1), _flipped(false) {}
+
+ Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged)
+ bool hasFlag() const { return _hasFlag; }
+
+ Q_PROPERTY(bool hasMine READ hasMine NOTIFY hasMineChanged)
+ bool hasMine() const { return _hasMine; }
+
+ Q_PROPERTY(int hint READ hint NOTIFY hintChanged)
+ int hint() const { return _hint; }
+
+ Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged())
+ bool flipped() const { return _flipped; }
+
+ void setHasFlag(bool flag) {if(flag==_hasFlag) return; _hasFlag = flag; emit hasFlagChanged();}
+ void setHasMine(bool mine) {if(mine==_hasMine) return; _hasMine = mine; emit hasMineChanged();}
+ void setHint(int hint) { if(hint == _hint) return; _hint = hint; emit hintChanged(); }
+ void flip() { if (_flipped) return; _flipped = true; emit flippedChanged(); }
+ void unflip() { if(!_flipped) return; _flipped = false; emit flippedChanged(); }
+
+signals:
+ void flippedChanged();
+ void hasFlagChanged();
+ void hintChanged();
+ void hasMineChanged();
+
+private:
+ bool _hasFlag;
+ bool _hasMine;
+ int _hint;
+ bool _flipped;
+};
+
+class MinehuntGame : public QObject
+{
+ Q_OBJECT
+public:
+ MinehuntGame();
+
+ Q_PROPERTY(QDeclarativeListProperty<TileData> tiles READ tiles CONSTANT)
+ QDeclarativeListProperty<TileData> tiles();
+
+ Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged)
+ bool isPlaying() {return playing;}
+
+ Q_PROPERTY(bool hasWon READ hasWon NOTIFY hasWonChanged)
+ bool hasWon() {return won;}
+
+ Q_PROPERTY(int numMines READ numMines NOTIFY numMinesChanged)
+ int numMines() const{return nMines;}
+
+ Q_PROPERTY(int numFlags READ numFlags NOTIFY numFlagsChanged)
+ int numFlags() const{return nFlags;}
+
+public slots:
+ Q_INVOKABLE bool flip(int row, int col);
+ Q_INVOKABLE bool flag(int row, int col);
+ void setBoard();
+ void reset();
+
+signals:
+ void isPlayingChanged();
+ void hasWonChanged();
+ void numMinesChanged();
+ void numFlagsChanged();
+
+private:
+ bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; }
+ TileData *tile( int row, int col ) { return onBoard(row, col) ? _tiles[col+numRows*row] : 0; }
+ int getHint(int row, int col);
+ void setPlaying(bool b){if(b==playing) return; playing=b; emit isPlayingChanged();}
+
+ QList<TileData *> _tiles;
+ int numCols;
+ int numRows;
+ bool playing;
+ bool won;
+ int remaining;
+ int nMines;
+ int nFlags;
+};
diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro
index f85afeb..1d56013 100644
--- a/demos/declarative/minehunt/minehunt.pro
+++ b/demos/declarative/minehunt/minehunt.pro
@@ -1,38 +1,22 @@
-TEMPLATE = lib
-TARGET = qmlminehuntplugin
+TEMPLATE = app
+TARGET = minehunt
QT += declarative
CONFIG += qt plugin
-TARGET = $$qtLibraryTarget($$TARGET)
-DESTDIR = MinehuntCore
-
# Input
-SOURCES += minehunt.cpp
+HEADERS += minehunt.h
+SOURCES += main.cpp minehunt.cpp
-sources.files = minehunt.qml minehunt.pro
+sources.files = minehunt.qml minehunt.pro MinehuntCore
sources.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt
+target.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt
-target.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt/MinehuntCore
-
-MinehuntCore_sources.files = \
- MinehuntCore/Explosion.qml \
- MinehuntCore/Tile.qml \
- MinehuntCore/pics \
- MinehuntCore/qmldir
-MinehuntCore_sources.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt/MinehuntCore
-
-INSTALLS = sources MinehuntCore_sources target
+INSTALLS = sources target
symbian:{
TARGET.EPOCALLOWDLLDATA = 1
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- TARGET.CAPABILITY = NetworkServices ReadUserData
- importFiles.sources = MinehuntCore/qmlminehuntplugin.dll \
- MinehuntCore/Explosion.qml \
- MinehuntCore/pics \
- MinehuntCore/qmldir
- importFiles.path = MinehuntCore
- DEPLOYMENT = importFiles
+ qmlminehuntfiles.sources = MinehuntCore minehunt.qml
+ DEPLOYMENT = qmlminehuntfiles
}
-
-INSTALLS = sources MinehuntCore_sources target
+ \ No newline at end of file
diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js
index 0f0dbf7..fab7834 100644
--- a/demos/declarative/snake/content/snake.js
+++ b/demos/declarative/snake/content/snake.js
@@ -35,9 +35,12 @@ function startNewGame()
if (heartbeat.running) {
endGame();
startNewGameTimer.running = true;
+ state = "starting";
return;
}
+ state = "starting";
+
numRows = numRowsAvailable;
numColumns = numColumnsAvailable;
board = new Array(numRows * numColumns);
@@ -80,7 +83,6 @@ function startNewGame()
waitForCookie = 5;
score = 0;
startHeartbeatTimer.running = true;
- heartbeat.running = true;
}
function endGame()
@@ -94,6 +96,7 @@ function endGame()
}
lastScore = score;
highScores.saveScore(lastScore);
+ state = "";
}
function move() {
diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml
index b1344af..ed3bac9 100644
--- a/demos/declarative/snake/snake.qml
+++ b/demos/declarative/snake/snake.qml
@@ -94,6 +94,7 @@ Rectangle {
Timer {
id: startHeartbeatTimer;
interval: 1000 ;
+ onTriggered: { state = "running"; heartbeat.running = true; }
}
@@ -208,21 +209,6 @@ Rectangle {
Keys.onUpPressed: if (state == "starting" || direction != 2) Logic.scheduleDirection(0);
Keys.onDownPressed: if (state == "starting" || direction != 0) Logic.scheduleDirection(2);
- Connections {
- target: startHeartbeatTimer
- onRunningChanged: {
- if (startHeartbeatTimer.running)
- screen.state = "starting";
- else
- screen.state = "running"
- }
- }
- Connections {
- target: heartbeat
- onRunningChanged: if (!heartbeat.running) screen.state = "";
- }
-
-
states: [
State {
name: "starting"
diff --git a/demos/qtdemo/mainwindow.h b/demos/qtdemo/mainwindow.h
index e613268..b8cfda6 100644
--- a/demos/qtdemo/mainwindow.h
+++ b/demos/qtdemo/mainwindow.h
@@ -43,7 +43,6 @@
#define MAIN_WINDOW_H
#include <QtGui>
-#include <QtDeclarative>
#include <QPixmap>
class DemoTextItem;
diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp
index 5b851b4..4ae9ca1 100644
--- a/demos/qtdemo/menumanager.cpp
+++ b/demos/qtdemo/menumanager.cpp
@@ -356,6 +356,7 @@ void MenuManager::launchExample(const QString &name)
void MenuManager::launchQmlExample(const QString &name)
{
+#ifndef QT_NO_DECLARATIVE
if(!qmlRoot){
exampleError(QProcess::UnknownError);
return;
@@ -382,6 +383,17 @@ void MenuManager::launchQmlExample(const QString &name)
qmlRoot->setProperty("qmlFile", QVariant(""));//unload component
qmlRoot->setProperty("show", QVariant(true));
qmlRoot->setProperty("qmlFile", QUrl::fromLocalFile(file.fileName()));
+#else
+ QMessageBox::critical(0, tr("Failed to launch the example"),
+ tr("This application was built without the QtDeclarative module, and therefore declarative examples have been disabled."),
+ QMessageBox::Cancel);
+#endif
+}
+
+void MenuManager::quitQML()
+{
+ if(qmlRoot)
+ qmlRoot->setProperty("show", QVariant(false));
}
void MenuManager::exampleFinished()
@@ -427,21 +439,28 @@ void MenuManager::init(MainWindow *window)
level2MenuNode = level2MenuNode.nextSibling();
}
+ qmlRoot = 0;
+#ifndef QT_NO_DECLARATIVE
// Create QML Loader
declarativeEngine = new QDeclarativeEngine(this);
+ connect(declarativeEngine, SIGNAL(quit()),
+ this, SLOT(quitQML()));
QDeclarativeComponent component(declarativeEngine, QUrl("qrc:qml/qmlShell.qml"), this);
- qmlRoot = 0;
- if(component.isReady())
- qmlRoot = qobject_cast<QDeclarativeItem*>(component.create());
- else
+ QDeclarativeItem* qmlRootItem = 0;
+ if(component.isReady()){
+ qmlRoot = component.create();
+ qmlRootItem = qobject_cast<QDeclarativeItem*>(qmlRoot);
+ }else{
qDebug() << component.status() << component.errorString();
- if(qmlRoot){
- qmlRoot->setHeight(this->window->scene->sceneRect().height());
- qmlRoot->setWidth(this->window->scene->sceneRect().width());
- qmlRoot->setZValue(101);//Above other items
- qmlRoot->setCursor(Qt::ArrowCursor);
- window->scene->addItem(qmlRoot);
+ }
+
+ if(qmlRootItem){
+ qmlRootItem->setHeight(this->window->scene->sceneRect().height());
+ qmlRootItem->setWidth(this->window->scene->sceneRect().width());
+ qmlRootItem->setZValue(101);//Above other items
+ qmlRootItem->setCursor(Qt::ArrowCursor);
+ window->scene->addItem(qmlRootItem);
//Note that QML adds key handling to the app.
window->viewport()->setFocusPolicy(Qt::NoFocus);//Correct keyboard focus handling
@@ -451,6 +470,7 @@ void MenuManager::init(MainWindow *window)
}else{
qDebug() << "Error initializing QML subsystem, Declarative examples will not work";
}
+#endif
}
void MenuManager::readInfoAboutExample(const QDomElement &example)
diff --git a/demos/qtdemo/menumanager.h b/demos/qtdemo/menumanager.h
index 5e14204..93fb998 100644
--- a/demos/qtdemo/menumanager.h
+++ b/demos/qtdemo/menumanager.h
@@ -45,6 +45,9 @@
#include <QtGui>
#include <QtXml>
#include <QtHelp/QHelpEngineCore>
+#ifndef QT_NO_DECLARATIVE
+#include <QtDeclarative>
+#endif
#include "score.h"
#include "textbutton.h"
@@ -83,13 +86,17 @@ public:
Score *score;
int currentMenuCode;
+ QObject *qmlRoot;
+#ifndef QT_NO_DECLARATIVE
QDeclarativeEngine* declarativeEngine;
- QDeclarativeItem *qmlRoot;
+#endif
private slots:
void exampleFinished();
void exampleError(QProcess::ProcessError error);
+ void quitQML();
+
private:
// singleton pattern:
MenuManager();
diff --git a/demos/qtdemo/qmlShell.qml b/demos/qtdemo/qmlShell.qml
index b5fdf39..24c12ae 100644
--- a/demos/qtdemo/qmlShell.qml
+++ b/demos/qtdemo/qmlShell.qml
@@ -68,8 +68,6 @@ Item {
loader.item.width = 640;
if(loader.item.height > 480)
loader.item.height = 480;
- if(loader.item.inAnotherDemo != undefined)
- loader.item.inAnotherDemo = true;
}}
}
@@ -100,6 +98,30 @@ Item {
}
}
+ Rectangle{ id: closeButton
+ width: 24
+ height: 24
+ z: 11
+ border.color: "#aaaaaaaa"
+ gradient: Gradient{
+ GradientStop{ position: 0.0; color: "#34FFFFFF" }
+ GradientStop{ position: 1.0; color: "#7AFFFFFF" }
+ }
+ anchors.left: frame.right
+ anchors.bottom: frame.top
+ anchors.margins: -(2*width/3)
+ Text{
+ text: 'X'
+ font.bold: true
+ color: "white"
+ font.pixelSize: 12
+ anchors.centerIn: parent
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: main.show = false;
+ }
+ }
Text{
id: errorTxt
@@ -116,32 +138,6 @@ Item {
onLinkActivated: Qt.openUrlExternally(link);
}
}
- Rectangle{
- id: helpLabel
- property bool timedOut: false
- z: 9
- //Positioned in the top left corner
- x: 8
- y: 8
- color: "white"
- border.color: "black"
- border.width: 1
- width: helpText.width + 16
- height: helpText.height + 8
- Text{
- id: helpText
- color: "black"
- anchors.centerIn: parent
- text: "Click outside the example to exit it."
- }
- opacity: 0
- Behavior on opacity{ NumberAnimation{duration:500} }
- Timer{
- id: helpTimer
- interval: 5000
- onTriggered: {helpLabel.timedOut=true}
- }
- }
Rectangle{ id: blackout //Maybe use a colorize effect instead?
z: 8
anchors.fill: parent
@@ -154,7 +150,6 @@ Item {
hoverEnabled: main.show //To steal focus from the buttons
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
anchors.fill: parent
- onClicked: main.show=false;
}
states: [
@@ -166,10 +161,6 @@ Item {
opacity: 1
}
PropertyChanges {
- target: helpLabel
- opacity: helpLabel.timedOut?0:1
- }
- PropertyChanges {
target: blackout
opacity: 0.5
}
@@ -178,8 +169,7 @@ Item {
transitions: [//Should not be too long, because the component has already started running
Transition { from: ''; to: "show"; reversible: true
ParallelAnimation{
- ScriptAction{ script: {helpLabel.timedOut = false; helpTimer.restart();} }
- NumberAnimation{ exclude: helpLabel; properties: "opacity"; easing.type: Easing.InQuad; duration: 500}
+ NumberAnimation{ properties: "opacity"; easing.type: Easing.InQuad; duration: 500}
PropertyAction { target: loader; property: "focus"; value: true}//Might be needed to ensure the focus stays with us
}
}
diff --git a/demos/qtdemo/qtdemo.pro b/demos/qtdemo/qtdemo.pro
index 61ea376..836178b 100644
--- a/demos/qtdemo/qtdemo.pro
+++ b/demos/qtdemo/qtdemo.pro
@@ -6,13 +6,17 @@ DESTDIR = $$DEMO_DESTDIR/bin
INSTALLS += target sources
-QT += xml network declarative
+QT += xml network
contains(QT_CONFIG, opengl) {
DEFINES += QT_OPENGL_SUPPORT
QT += opengl
}
+contains(QT_CONFIG, declarative) {
+ QT += declarative
+}
+
build_all:!build_pass {
CONFIG -= build_all
CONFIG += release
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index 7416341..53a0c55 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -156,11 +156,13 @@ The \l {PropertyAnimation::}{to} property is also required to specify the new
\section2 Standalone Animations
Animations can also be created as ordinary QML objects that are not bound to
-any particular objects and properties. An example:
+any particular objects and properties. Here is an example, using a
+PropertyAnimation object. The animation is explicitly started when the
+\l Rectangle is clicked:
\snippet doc/src/snippets/declarative/animation-standalone.qml 0
-A standalone animation is not running by default and must be started explicitly
+A standalone animation object is not running by default and must be started explicitly
using the \l {Animation::}{running} property or \l {Animation::}{start()} and
\l {Animation::}{stop()} methods. Since the animation is not bound to a
particular object or property, it must define the \l
@@ -183,10 +185,13 @@ object and add it to an item's \l {Item::}{transitions} property. An example:
\snippet doc/src/snippets/declarative/animation-transitions.qml 0
-When the \l Rectangle changes to the \e moved state, its \c x and \c y property
-values are changed by the PropertyChanges object, and the PropertyAnimation
-defined within the \l Transition is triggered on these properties. The
-animation will not be applied at any time other than during the state change.
+The PropertyChanges object in the \e moved state defines that when the
+\l Rectangle is in this state, its position should be changed
+to (50, 50). When the \l Rectangle changes to the \e moved state, the
+\l Transition will be triggered, and the transition's \l PropertyAnimation will
+animate the changes in the \c x and \c y properties to their new values.
+The animation will not be applied at any time other than during the state
+change.
Notice the example does not set any \l {PropertyAnimation::}{from} and \l
{PropertyAnimation::}{to} values for the PropertyAnimation. As a convenience,
@@ -234,7 +239,7 @@ and rotation changes.
A ColorAnimation allows color values for the \l {ColorAnimation::}{from}
and \l {ColorAnimation::}{to} properties. The
-following animates the rectangle's \l {Rectangle::color} property:
+following animates the rectangle's \l {Rectangle::}{color} property:
\snippet doc/src/snippets/declarative/animation-elements.qml color
diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc
index ce35f26..e1c9473 100644
--- a/doc/src/declarative/declarativeui.qdoc
+++ b/doc/src/declarative/declarativeui.qdoc
@@ -28,12 +28,14 @@
/*!
\title Qt Quick
\page qtquick.html
+\ingroup qt-gui-concepts
+
\brief Qt Quick provides a declarative framework for building highly
dynamic, custom user interfaces.
Qt Quick provides a declarative framework for building highly dynamic,
-custom user interfaces from a rich set of \l {QML Elements}{QML elements}.
+custom user interfaces from a rich set of \l{QML Elements}{QML elements}.
Qt Quick helps programmers and designers collaborate to
build the fluid user interfaces that are becoming common in portable
consumer devices, such as mobile phones, media players, set-top boxes
@@ -41,72 +43,74 @@ and netbooks. Qt Quick consists of the QtDeclarative C++ module, QML, and
the integration of both of these into the Qt Creator IDE. Using the QtDeclarative
C++ module, you can load and interact with QML files from your Qt application.
-QML provides mechanisms to declaratively build an object tree using
-\l {QML Elements}{QML elements}. QML improves the integration between
-\l {http://www.ecma-international.org/publications/standards/Ecma-262.htm}{JavaScript}
-and Qt's existing QObject based type
-system, adds support for automatic \l {Property Binding}{property
-bindings} and provides \l {Network Transparency}{network transparency}
-at the language level.
+QML is an extension to \l{About JavaScript}{JavaScript}, that provides
+a mechanism to declaratively build an object tree of
+\l{QML Elements}{QML elements}. QML improves the integration between
+JavaScript and Qt's existing QObject-based type system, adds support for
+automatic \l{Property Binding}{property bindings} and provides
+\l{Network Transparency}{network transparency} at the language level.
-The \l {QML Elements}{QML elements} are a sophisticated set of
+The \l{QML Elements}{QML elements} are a sophisticated set of
graphical and behavioral building blocks. These different elements
-are combined together in \l {QML Documents}{QML documents} to build
+are combined together in \l{QML Documents}{QML documents} to build
components ranging in complexity from simple buttons and sliders, to
-complete internet-enabled applications like a \l
-{http://www.flickr.com}{Flickr} photo browser.
+complete Internet-enabled applications like a photo browser for the
+popular \l{http://www.flickr.com}{Flickr} photo-sharing site.
-Qt Quick builds on \l {QML for Qt programmers}{Qt's existing
-strengths}. QML can be be used to incrementally extend an existing
-application or to build completely new applications. QML is fully \l
-{Extending QML in C++}{extensible from C++} through the QtDeclarative Module.
+Qt Quick builds on \l{QML for Qt programmers}{Qt's existing strengths}.
+QML can be be used to incrementally extend an existing application or
+to build completely new applications. QML is fully
+\l{Extending QML in C++}{extensible from C++} through the QtDeclarative
+Module.
\section1 Getting Started
\list
-\o \l {Introduction to the QML language}
-\o \l {QML Tutorial}{Tutorial: 'Hello World'}
-\o \l {QML Advanced Tutorial}{Tutorial: 'Same Game'}
-\o \l {QML Examples and Demos}
-\o \l {QML for Qt programmers}
+\o \l{Introduction to the QML language}
+\o \l{QML Tutorial}{Tutorial: 'Hello World'}
+\o \l{QML Advanced Tutorial}{Tutorial: 'Same Game'}
+\o \l{QML Examples and Demos}
+\o \l{QML for Qt Programmers}
+\o \l{Getting Started Programming with QML}
+\o \l{Beginning Qt Quick}
\endlist
\section1 Core QML Features
\list
-\o \l {QML Documents}
-\o \l {Property Binding}
-\o \l {Network Transparency}
-\o \l {QML Scope}
-\o \l {Integrating JavaScript}
-\o \l {Data Models}
-\o \l {anchor-layout.html}{Anchor-based Layout}
-\o \l {qdeclarativestates.html}{States}
-\o \l {qdeclarativeanimation.html}{Animation}
-\o \l {qdeclarativefocus.html}{Keyboard Focus}
-\o \l {qdeclarativemodules.html}{Modules}
-\o \l {Extending types from QML}
-\o \l {qdeclarativedynamicobjects.html}{Dynamic Object Creation}
+\o \l{QML Documents}
+\o \l{Property Binding}
+\o \l{Network Transparency}
+\o \l{QML Scope}
+\o \l{Integrating JavaScript}
+\o \l{Data Models}
+\o \l{Anchor-based Layout in QML}
+\o \l{QML States}
+\o \l{QML Animation}
+\o \l{Keyboard Focus in QML}
+\o \l{QML Modules}
+\o \l{Extending types from QML}
+\o \l{Dynamic Object Management in QML}
\endlist
\section1 Using QML with C++
\list
-\o \l {qmlruntime.html}{The Qt Declarative Runtime}
-\o \l {Using QML in C++ Applications}
-\o \l {Integrating QML with existing Qt UI code}
-\o \l {Tutorial: Writing QML extensions with C++}
-\o \l {Extending QML in C++}
+\o \l{Qt Declarative UI Runtime}
+\o \l{Using QML in C++ Applications}
+\o \l{Integrating QML with existing Qt UI code}
+\o \l{Tutorial: Writing QML extensions with C++}
+\o \l{Extending QML in C++}
\endlist
\section1 Reference
\list
-\o \l {QML Elements}
-\o \l {QML Global Object}
-\o \l {QML Internationalization}
-\o \l {QML Security}
-\o \l {QtDeclarative Module}
-\o \l {Debugging QML}
-\o \l {QML Viewer}
-\o \l {QML Performance}
-\o \l {QML Coding Conventions}
+\o \l{QML Elements}
+\o \l{QML Global Object}
+\o \l{QML Internationalization}
+\o \l{QML Security}
+\o \l{QtDeclarative Module}
+\o \l{Debugging QML}
+\o \l{QML Viewer}
+\o \l{QML Performance}
+\o \l{QML Coding Conventions}
\endlist
*/
diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc
index 997f601..e735bce 100644
--- a/doc/src/declarative/dynamicobjects.qdoc
+++ b/doc/src/declarative/dynamicobjects.qdoc
@@ -27,7 +27,7 @@
/*!
\page qdeclarativedynamicobjects.html
-\title Dynamic Object Management
+\title Dynamic Object Management in QML
QML provides a number of ways to dynamically create and manage QML objects.
The \l{Loader}, \l{Repeater}, \l{ListView}, \l{GridView} and \l{PathView} elements
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index c008404..94abe10 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -26,113 +26,151 @@
****************************************************************************/
/*!
-\page qdeclarativeelements.html
-\target elements
-\title QML Elements
-
-The following table lists the QML elements provided by the \l {QtDeclarative}{Qt Declarative} module.
-
-\table
-\header \o {2,1} \bold {Basic Visual Items}
-\row \o \l {Item} \o Basic item element inherited by all visual items in QML
-\row \o \l {Rectangle} \o Basic visual rectangle element
-\row \o \l {Gradient} \o Defines a gradient between two or more colors
-\row \o \l {GradientStop} \o Defines a color used in a \l {Gradient}
-\row \o \l {Image} \o Allows the use of bitmaps to a scene
-\row \o \l {BorderImage} (Item-specific) \o Defines an image as a border
-\row \o \l {AnimatedImage} \o For playing animations stored as a series of frames
-\row \o \l {Text} \o Allows the use of formatted text in a scene
-\row \o \l {TextInput} \o Displays an editable line of text
-\row \o \l {IntValidator} \o Validator for integer values
-\row \o \l {DoubleValidator} \o Validator for non-integer values
-\row \o \l {RegExpValidator} \o Validator for string regular expressions
-\row \o \l {TextEdit} \o Displays multiple lines of editable formatted text
-
-\header \o {2,1} \bold {Basic Interaction Items}
-\row \o \l {MouseArea} \o Handles mouse interactions
-\row \o \l {FocusScope} \o For keyboard focus handling
-\row \o \l {Flickable} \o Provides a surface that can be "flicked"
-\row \o \l {Flipable} \o Provides a surface that produces flipping effects
-\row \o \l {GestureArea} (experimental) \o Enables simple gesture handling
-
-\header \o {2,1} \bold {States}
-\row \o \l {State} \o Defines sets of configurations of objects and properties
-\row \o \l {PropertyChanges} \o Describes property changes within a state
-\row \o \l {StateGroup} \o Contains a set of states and state transitions
-\row \o \l {StateChangeScript} \o Allows script binding in a state
-\row \o \l {ParentChange} (Item-specific) \o Re-parent an Item in a state change
-\row \o \l {AnchorChanges} \o Change the anchors of an item in a state
-
-\header \o {2,1} \bold {Animation and Transitions}
-\row \o \l {Behavior} \o Specifies a default animation for property changes
-\row \o \l {SequentialAnimation} \o Runs animations sequentially
-\row \o \l {ParallelAnimation} \o Runs animations in parallel
-\row \o \l {PropertyAnimation} \o Animates property changes
-\row \o \l {NumberAnimation} \o Animates properties of type qreal
-\row \o \l {Vector3dAnimation} \o Animates properties of type QVector3d
-\row \o \l {ColorAnimation} \o Animates color changes
-\row \o \l {RotationAnimation} \o Animates rotations
-\row \o \l {ParentAnimation} \o Animates parent changes
-\row \o \l {AnchorAnimation} \o Animates anchor changes
-\row \o \l {PauseAnimation} \o Pauses an animation
-\row \o \l {SmoothedAnimation} \o Allows a property to smoothly track a value
-\row \o \l {SpringAnimation} \o Allows a property to track a value in a spring-like motion
-\row \o \l {PropertyAction} \o Sets immediate property changes during animation
-\row \o \l {ScriptAction} \o Runs scripts during an animation
-\row \o \l {Transition} \o Animates transitions during state changes
-
-\header \o {2,1} \bold {Working with Data}
-\row \o \l {Binding} \o Binds any value to any property
-\row \o \l {ListModel} \o Defines a list of data
-\row \o \l {ListElement} \o Defines a data item in a \l {ListModel}
-\row \o \l {VisualItemModel} \o Contains items that already defines its own visual delegate
-\row \o \l {VisualDataModel} \o Encapsulates a model and a delegate
-\row \o \l {Package} \o Collection that enables sharing of items within different views
-\row \o \l {XmlListModel} \o Specifies a model using XPath expressions
-\row \o \l {XmlRole} \o Specifies a role for an \l {XmlListModel}
-
-\header \o {2,1} \bold {Views}
-\row \o \l {ListView} \o Provides a list visualization of a model
-\row \o \l {GridView} \o Provides a grid visualization of a model
-\row \o \l {PathView} \o Visualizes a model's contents along a path
-\row \o \l {Path} \o Defines a path used by \l {PathView}
-\row \o \l {PathLine} \o Defines a line in \l {Path}
-\row \o \l {PathQuad} \o Defines a quadratic Bezier curve in a \l {Path}
-\row \o \l {PathCubic} \o Defines a cubic Bezier curve in a \l {Path}
-\row \o \l {PathAttribute} \o Allows the setting of attributes along a \l {Path}
-\row \o \l {PathPercent} \o Modifies the item distribution along a \l {Path}
-\row \o \l {WebView} \o Allows the addition of web content to a canvas
-
-\header \o {2,1} \bold {Positioners}
-\row \o \l {Column} \o Arranges its children vertically
-\row \o \l {Row} \o Arranges its children horizontally
-\row \o \l {Grid} \o Positions its children in a grid
-\row \o \l {Flow} \o Positions its children with wrapping support
-
-\header \o {2,1} \bold {Utility}
-\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 {QML:QtObject} {QtObject} \o Basic element containing only the objectName property
-\row \o \l {QML:Qt} {Qt} \o The QML global Qt object provides useful enums and functions from Qt.
-\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
-\row \o \l {SystemPalette} \o Provides access to the Qt palettes
-\row \o \l {FontLoader} \o Loads fonts by name or URL
-\row \o \l {LayoutItem} \o Allows declarative UI elements inside Qt's Graphics View layouts
-
-\header \o {2,1} \bold {Transforms}
-\row \o \l {Scale} \o Assigns item scaling behaviors
-\row \o \l {Rotation} \o Assigns item rotation behaviors
-\row \o \l {Translate} \o Assigns item translation behaviors
-
-\header \o {2,1} \bold {Effects}
-\row \o \l {Particles} (experimental) \o Generates and animates particles
-\row \o \l {ParticleMotionLinear} \o Adds linear motion behavior to \l {Particles}
-\row \o \l {ParticleMotionGravity} \o Adds gravitational motion to \l {Particles}
-\row \o \l {ParticleMotionWander} \o Adds varied motions to \l {Particles}
-\endtable
+ \page qdeclarativeelements.html
+ \target elements
+ \title QML Elements
+ This is a dictionary of all the QML elements available in the \l
+ {QtDeclarative} {Qt Declarative} module.
+
+ To see the QML elements listed by
+ functional area, \l{Groups Of Related QML Elements} {look here}.
+
+ \generatelist qmlclasses
+
+*/
+
+
+/*!
+ \group qml-groups
+ \title Groups Of Related QML Elements
+
+ \brief If you know what kind of QML element you want (Basic Visual,
+ Interaction, Animation, etc), look here.
+
+ This is a list of functional groups of QML elements.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-basic-visual-elements
+ \title Basic QML Visual Elements
+ \ingroup qml-groups
+
+ \brief Elements for constructing basic visual items.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-basic-interaction-elements
+ \title Basic QML Interaction Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling basic interactions.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-state-elements
+ \title QML State Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling state changes.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-event-elements
+ \title QML Event Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling events.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-animation-transition
+ \title QML Animation and Transition Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling animations and transitions.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-working-with-data
+ \title Working With Data in QML
+ \ingroup qml-groups
+
+ \brief Elements for working with data.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-view-elements
+ \title QML View Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling views.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-positioning-elements
+ \title QML Positioning Elements
+ \ingroup qml-groups
+
+ \brief Elements for positioning items.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-utility-elements
+ \title QML Utility Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling misc operations.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-transform-elements
+ \title QML Transform Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling transformations.
+
+ \generatelist{related}
+
+*/
+
+/*!
+ \group qml-particle-elements
+ \title QML Particle Elements
+ \ingroup qml-groups
+
+ \brief Elements for handling particle effects.
+
+ \generatelist{related}
*/
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index 3acfbdf..5c4d5e7 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -434,6 +434,23 @@ NOTIFY signal in C++.
See also \l {Extending types from QML}.
+\section1 Methods
+
+Slots and methods marked Q_INVOKABLE may be called as functions in QML.
+
+\snippet examples/declarative/cppextensions/referenceexamples/methods/example.qml 0
+
+In this example an invitation is added via an \c {invite()} invokable method of
+the BirthdayParty element. This function is available in QML by marking the \c {invite()}
+method with Q_INVOKABLE in the BirthdayParty class:
+
+\snippet examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.h 0
+
+\l {Extending QML - Methods Example} shows the complete code used to
+implement the invite() method.
+
+The \c {invite()} method is similarly available if it is declared as a slot.
+
\section1 Property Value Sources
\snippet examples/declarative/cppextensions/referenceexamples/valuesource/example.qml 0
diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc
index fbab001..69dd500 100644
--- a/doc/src/declarative/qml-intro.qdoc
+++ b/doc/src/declarative/qml-intro.qdoc
@@ -28,14 +28,11 @@
/*!
-
-\page qml-intro.html
+\page qml-intro.html
\title Beginning Qt Quick
-
\section1 Overview
-
QML is a high level, scripted language. Its commands, more correctly \e elements,
leverage the power and efficiency of the Qt libraries to make easy to use
commands that perform intuitive functions. Draw a rectangle, display an image at
@@ -61,12 +58,7 @@ would be a property.
The basic syntax of an \l {QML Elements}{element} is
- \code
- SomeElement {
- id: myObject
- ... some other things here ...
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/basic-syntax.qml basic syntax
Here we are defining a new object. We specify its 'type' first as SomeElement.
Then within matching braces { ... } we specify the various parts of our
@@ -90,61 +82,38 @@ want a rectangle that is 500 pixels by 400 pixels in the x and y directions
We can implement this \l Rectangle with these properties this way
- \code
- import Qt 4.7
-
- // This is a comment. And below myRectangle is defined.
- Rectangle {
- id: myRectangle
- width: 500
- height: 400
- }
- \endcode
+\quotefile doc/src/snippets/declarative/qml-intro/rectangle.qml
This is a valid QML script. To run it, copy it and save it to a file, say
-myexample.qml, and on the command line run the command
+myexample.qml, and on the command line run the following command:
- \code
- qmlviewer myexample.qml
- \endcode
+\code
+qmlviewer myexample.qml
+\endcode
On Mac OS X, open the "QMLViewer" application instead and open the
\c myexample.qml file, or run it from the command line:
- \code
- QMLViewer.app/Contents/MacOS/QMLViewer myexample.qml
- \endcode
-
+\code
+QMLViewer.app/Contents/MacOS/QMLViewer myexample.qml
+\endcode
It will create a very boring rectangle in its own window.
-
\section1 Hello World!
We can now add some color and text to make a Hello World QML program.
-\l Rectangle has the property \l {Rectangle::color}{color} to produce a
+\l Rectangle has the property \l{Rectangle::color}{color} to produce a
background color.
Text is handled by a different element called \l Text. We need to create a
-\l Text object inside the \l Rectangle and set its \l {Text::text}{text}
-property to "Hello World!". So to set the text to 'Hello world' and the
+\l Text object inside the \l Rectangle and set its \l{Text::}{text}
+property to "Hello World!". So to set the text to "Hello world" and the
background colour to light gray,
- \code
- import Qt 4.7
-
- Rectangle {
- id: myRectangle
- width: 500
- height: 400
-
- Text { text: "Hello World!" }
-
- color: "lightgray"
- }
- \endcode
+\quotefile doc/src/snippets/declarative/qml-intro/hello-world1.qml
\section1 Hello World Again
@@ -158,12 +127,7 @@ position belongs to the \l Text element so we set the position inside its
definition. Note that we separate different QML statements on the same line
with a semi-colon, or we could have simply put each statement on a new line
- \code
- Text {
- text: "<h2>Hello World</h2>"; color: "darkgreen"
- x: 100; y:100
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/hello-world2.qml updated text
Not only did we reposition the text, but the text was altered by adding
HTML tags to change the font size. The text color was also changed from the
@@ -174,13 +138,7 @@ We could also have used a hexadecimal string for the RGB (red-green-blue, as
#rrggbb) values of the color similar to the method used in HTML. For
example, mostly blue with a green tint,
- \code
- Text {
- text: "<h1>Hello world again</h1>"
- color: "#002288"
- x: 100; y: 100
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/hello-world3.qml updated text
All of these changes occurred within the \l Text object which is the scope
of these property changes.
@@ -198,11 +156,7 @@ source of the image, the path to the file, is a URL. Therefore the file can
be local: \e {mydir/myimage1.png}. Or it can be remote:
\e {"http://www.example.com/images/myimage1.png"}.
- \code
- Image {
- source: "images/qt-logo.png"
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/hello-world4.qml added an image
This displays the image, as we would expect, at the top left of the window.
The position of the default x = 0, y = 0 coordinate. The example here uses
@@ -213,44 +167,12 @@ Let us reposition the image and enlarge it. Place it at the same 'x' offset
as the "Hello world again" text, but put it another 50 pixels below the
text, also make it 150 by 150 pixels in size,
- \code
- Image {
- source: "images/qt-logo.png"
- x: 100; y: 150
- width: 150; height: 150
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/hello-world5.qml positioning the image
Adding the Hello World example, with the text and the image example we can
write a simple piece of QML that starts to look a bit better.
- \code
- import Qt 4.7
-
- Rectangle {
- id: myRectangle
- width: 500
- height: 400
-
- // A light gray background
- color: "lightgray"
-
- // Position and color some text
- Text {
- text: "<h1>Hello world again</h1>"
- color: "darkgreen"
- x: 100; y: 100
- }
-
- // Using the opportunity to resize the image.
- Image {
- source: "images/qt-logo.png"
- x: 100; y: 150
- width: 150; height: 150
- }
-
- }
- \endcode
+\quotefile doc/src/snippets/declarative/qml-intro/hello-world5.qml
The result is still quite simple
@@ -281,22 +203,7 @@ If we want to position an image at the bottom of the rectangle it is
inside. I have to specify that the bottom of the image is also at the
bottom of the rectangle
- \code
- import Qt 4.7
-
- Rectangle {
- id: myWin
- width: 500
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- width: 150; height: 150
- anchors.bottom: myWin.bottom
- }
- }
- \endcode
+\quotefile doc/src/snippets/declarative/qml-intro/anchors1.qml
This places the logo at the bottom left of the window.
@@ -315,25 +222,7 @@ the bottomMargin property is used. So the new actions for the script are
Encoded into QML the script becomes
- \code
- import Qt 4.7
-
- Rectangle {
- id: myWin
- width: 500
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- width: 150; height: 150
- anchors.bottom: myWin.bottom
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 10
- }
- }
- \endcode
-
+\quotefile doc/src/snippets/declarative/qml-intro/anchors2.qml
Run this and resize the window. You will see that now the position of the
image adjusts during the resize.
@@ -344,14 +233,7 @@ You can also add another object say a block of descriptive text and place
it above or below the image or to the side. This code places some text just
above the image
- \code
- Text {
- text: "<h2>The Qt Logo</h2>"
- anchors.bottom: image1.top
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 15
- }
- \endcode
+\snippet doc/src/snippets/declarative/qml-intro/anchors3.qml adding some text
\image qml-intro-anchors3.png
@@ -359,17 +241,15 @@ above the image
referencing these properties from another object we use the property
directly, instead of saying:
- \code
- myRectangle.anchors.top // Wrong
- \endcode
+\qml
+myRectangle.anchors.top // Wrong
+\endqml
we use
- \code
- myRectangle.top // Correct
- \endcode
-
-
+\qml
+myRectangle.top // Correct
+\endqml
\section1 Transformations
@@ -391,9 +271,9 @@ Rotation of text was also suggested. It could also be useful to scale the
text. We can do both. The \l {Item::transform}{transform} property is a
\e list of \l Transform elements, so using the list syntax
- \code
- myList: [ listElement1, listElement2, ... } ]
- \endcode
+\qml
+myList: [ listElement1, listElement2, ... } ]
+\endqml
we can produce a list of transformations.
@@ -402,46 +282,7 @@ vertically by a factor of 1.5 and by 1.2 horizontally.
Using the example above as the basis for this we have,
- \code
- import Qt 4.7
-
- Rectangle {
- id: myWin
- width: 500
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- width: 150; height: 150
- anchors.bottom: myWin.bottom
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 10
-
- transform: Rotation {
- origin.x: 75; origin.y: 75
- axis{ x: 0; y: 0; z:1 } angle: -90
- }
-
- }
-
- Text {
- text: "<h2>The Qt Logo -- taking it easy</h2>"
- anchors.bottom: image1.top
- anchors.horizontalCenter: myWin.horizontalCenter
- anchors.bottomMargin: 15
-
- transform: [
- Scale { xScale: 1.5; yScale: 1.2 } ,
-
- Rotation {
- origin.x: 75; origin.y: 75
- axis{ x: 0; y: 0; z:1 } angle: -45
- }
- ]
- }
- }
- \endcode
+\quotefile doc/src/snippets/declarative/qml-intro/transformations1.qml
The code block in \c image1 starting with \c transform specifies that the
\l {Item::transform}{transform} property will be a Rotation through -90
@@ -479,30 +320,7 @@ from \l Item. The rotation property is a real number that specifies the
angle in a clockwise direction for the rotation of the object. Here is the
code for our animated rotating image.
- \code
- import Qt 4.7
-
- Rectangle {
- id: mainRec
- width: 600
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- x: 200; y: 100
- width: 100; height: 100
-
- // Animate a rotation
- transformOrigin: Item.Center
- NumberAnimation on rotation {
- from: 0; to: 360
- duration: 2000
- loops: Animation.Infinite
- }
- }
- }
- \endcode
+\quotefile doc/src/snippets/declarative/number-animation1.qml
The \c {transformOrigin: Item.Center} is redundant since this is the default
axis of rotation anyway. But if you change \c Center to \c BottomRight you
@@ -515,32 +333,7 @@ combination. For example, if the task had been to animate the rotation
about the y-axis passing through the center of the image then the following
code would do it.
- \code
- import Qt 4.7
-
- Rectangle {
- id: mainRec
- width: 600
- height: 400
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- x: 200; y: 100
- width: 100; height: 100
-
- // Animate a rotation
- transform: Rotation {
- origin.x: 50; origin.y: 50; axis {x:0; y:1; z:0} angle:0
- NumberAnimation on angle {
- from: 0; to: 360;
- duration: 3000;
- loops: Animation.Infinite
- }
- }
- }
- }
- \endcode
+\quotefile doc/src/snippets/declarative/number-animation2.qml
Here there is a rectangle 600 by 400 pixels. Placed within that rectangle
is an image 100 by 100 pixels. It is rotated about the center of the image
@@ -569,31 +362,7 @@ will be animating the position and the size of the image.
First create two images
- \code
- import Qt 4.7
-
- Rectangle {
- id: mainRec
- width: 600
- height: 400
- z: 0
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- x: 20; y: 20 ; z: 1
- width: 100; height: 100
- }
-
- Image {
- id: image2
- source: "images/qt-logo.png"
- width: 100; height: 100
- x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2
- z: 2
- }
- }
- \endcode
+\quotefile doc/src/snippets/declarative/sequential-animation1.qml
We will add to 'image1' a SequentialAnimation from x = 20 to the target of
x = 450. The 'from' values will be used because we will be repeating the
@@ -606,14 +375,7 @@ between the x values and over a given duration. After the NumberAnimation
there will be a PauseAnimation that will pause the animation for 500
milliseconds (half a second) simply for the visual effect.
- \code
- SequentialAnimation on x {
- loops: Animation.Infinite
- NumberAnimation { from: 20; to: 450; easing.type: "InOutQuad";
-duration: 2000 }
- PauseAnimation { duration: 500 }
- }
- \endcode
+\snippet doc/src/snippets/declarative/sequential-animation2.qml adding a sequential animation
A similar block of code is written for the animation of the 'y' value of
the position.
@@ -628,54 +390,7 @@ and image1 to 1 and image2 to 2 then image2 will be in the foreground and
image1 in the background. When image1 passes image2 it will pass behind it.
The completed code looks like
- \code
- Rectangle {
- id: mainRec
- width: 600
- height: 400
- z: 0
-
- Image {
- id: image2
- source: "images/qt-logo.png"
- width: 100; height: 100
- x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2
- z: 2
- }
-
- Image {
- id: image1
- source: "images/qt-logo.png"
- x: 20; y: 20 ; z: 1
- width: 100; height: 100
-
- SequentialAnimation on x {
- loops: Animation.Infinite
- NumberAnimation {
- from: 20; to: 450
- easing.type: "InOutQuad"; duration: 2000
- }
- PauseAnimation { duration: 500 }
- }
-
- SequentialAnimation on y {
- loops: Animation.Infinite
- NumberAnimation {
- from: 20; to: 250
- easing.type: "InOutQuad"; duration: 2000
- }
- PauseAnimation { duration: 500 }
- }
-
- SequentialAnimation on scale {
- loops: Animation.Infinite
- NumberAnimation { from: 1; to: 0.5; duration: 1000 }
- NumberAnimation { from: 0.5; to: 1; duration: 1000 }
- PauseAnimation { duration: 500 }
- }
- }
- }
- \endcode
+\quotefile doc/src/snippets/declarative/sequential-animation3.qml
The \c {easing.type} has many options, expressed as a string. It specifies the
kind of equation that describes the acceleration of the property value, not
@@ -756,60 +471,7 @@ will be the default state. We will just go to 'night' by clicking and
holding the left mouse button down, releasing the mouse button will reverse
the process
- \code
- import Qt 4.7
-
- Rectangle {
- id: mainRectangle
- width: 600
- height: 400
- color: "black"
-
- Rectangle {
- id: sky
- width: 600
- height: 200
- y: 0
- color: "lightblue"
- }
-
- Rectangle {
- id: ground
- width: 600; height: 200
- y: 200
- color: "green"
- }
-
- MouseArea {
- id: mousearea
- anchors.fill: mainRectangle
- }
-
- states: [ State {
- name: "night"
- when: mousearea.pressed == true
- PropertyChanges { target: sky; color: "darkblue" }
- PropertyChanges { target: ground; color: "black" }
- },
- State {
- name: "daylight"
- when: mousearea.pressed == false
- PropertyChanges { target: sky; color: "lightblue" }
- PropertyChanges { target: ground; color: "green" }
- }
- ]
-
- transitions: [ Transition {
- from: "daylight"; to: "night"
- ColorAnimation { duration: 1000 }
- },
- Transition {
- from: "night"; to: "daylight"
- ColorAnimation { duration: 500 }
- }
- ]
- }
- \endcode
+\quotefile doc/src/snippets/declarative/states1.qml
Several new things appear in this sample. Firstly, we use a \l MouseArea
element to detect mouse clicks in the \e mainRectangle. Secondly, we use
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index b4f4c83..f163a66 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -59,6 +59,16 @@
Equivalent to Q_DECLARE_METATYPE(TYPE) and Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>)
*/
+/*!
+ \macro QML_DECLARE_TYPEINFO(Type,Flags)
+ \relates QDeclarativeEngine
+
+ Declares additional properties of a type.
+
+ Current the only supported type info is \c QML_HAS_ATTACHED_PROPERTIES which
+ declares that the \c Type supports \l {Attached Properties}.
+*/
+
/*!
\fn int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc
index 68d56bf..c0639db 100644
--- a/doc/src/declarative/qtprogrammers.qdoc
+++ b/doc/src/declarative/qtprogrammers.qdoc
@@ -26,10 +26,9 @@
****************************************************************************/
/*!
-
\page qtprogrammers.html
\target qtprogrammers
-\title QML for Qt programmers
+\title QML for Qt Programmers
\section1 Overview
diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc
index 00771ed..f2908bd 100644
--- a/doc/src/deployment/deployment.qdoc
+++ b/doc/src/deployment/deployment.qdoc
@@ -1442,10 +1442,8 @@
\endlist
\note If you want a 3rd party library to be included in your
- application bundle, then you must add an excplicit lib entry for
- that library to your application's .pro file. Otherwise, the
- \c macdeployqt tool will not copy the 3rd party .dylib into the
- bundle.
+ application bundle, then you must copy the library into the
+ bundle manually, after the bundle is created.
\c macdeployqt supports the following options:
\list
diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc
index f28337d..0c07747 100644
--- a/doc/src/development/qtestlib.qdoc
+++ b/doc/src/development/qtestlib.qdoc
@@ -31,6 +31,8 @@
\brief An overview of Qt's unit testing framework.
\ingroup frameworks-technologies
+ \ingroup qt-basic-concepts
+
\keyword qtestlib
The QTestLib framework, provided by Nokia, is a tool for unit
diff --git a/doc/src/examples/diagramscene.qdoc b/doc/src/examples/diagramscene.qdoc
index f4d6b0d..7c643c2 100644
--- a/doc/src/examples/diagramscene.qdoc
+++ b/doc/src/examples/diagramscene.qdoc
@@ -265,7 +265,8 @@
\snippet examples/graphicsview/diagramscene/mainwindow.cpp 3
- This slot deletes the selected item, if any, from the scene. If
+ This slot deletes the selected item, if any, from the scene. It
+ deletes the arrows first in order to avoid to delete them twice. If
the item to be deleted is a \c DiagramItem, we also need to delete
arrows connected to it; we don't want arrows in the scene that
aren't connected to items in both ends.
diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc
index 0d191c9..b140562 100644
--- a/doc/src/examples/qml-examples.qdoc
+++ b/doc/src/examples/qml-examples.qdoc
@@ -137,6 +137,7 @@
\o \l {declarative/cppextensions/referenceexamples/grouped}{Grouped Properties}
\o \l {declarative/cppextensions/referenceexamples/attached}{Attached Properties}
\o \l {declarative/cppextensions/referenceexamples/signal}{Signal Support}
+ \o \l {declarative/cppextensions/referenceexamples/methods}{Methods Support}
\o \l {declarative/cppextensions/referenceexamples/valuesource}{Property Value Source}
\o \l {declarative/cppextensions/referenceexamples/binding}{Binding}
\endlist
diff --git a/doc/src/examples/qml-extending.qdoc b/doc/src/examples/qml-extending.qdoc
index b419fe4..21ec3bb 100644
--- a/doc/src/examples/qml-extending.qdoc
+++ b/doc/src/examples/qml-extending.qdoc
@@ -253,6 +253,20 @@ This example builds on:
*/
/*!
+\example declarative/cppextensions/referenceexamples/methods
+\title Extending QML - Methods Example
+
+This example builds on:
+\list
+\o \l {Extending QML - Default Property Example}
+\o \l {Extending QML - Inheritance and Coercion Example}
+\o \l {Extending QML - Object and List Property Types Example}
+\o \l {Extending QML - Adding Types Example}
+\endlist
+
+*/
+
+/*!
\example declarative/cppextensions/referenceexamples/valuesource
\title Extending QML - Property Value Source Example
diff --git a/doc/src/examples/qml-minehunt.qdoc b/doc/src/examples/qml-minehunt.qdoc
index be82302..e1ff22f 100644
--- a/doc/src/examples/qml-minehunt.qdoc
+++ b/doc/src/examples/qml-minehunt.qdoc
@@ -30,7 +30,7 @@
\example demos/declarative/minehunt
This demo shows how to create a simple Minehunt game, using QML for the
- UI and a C++ plugin for the game logic.
+ UI and C++ for the game logic.
\image qml-minehunt-demo.png
*/
diff --git a/doc/src/examples/simpletreemodel.qdoc b/doc/src/examples/simpletreemodel.qdoc
index 88aa27a..7d1f8fe 100644
--- a/doc/src/examples/simpletreemodel.qdoc
+++ b/doc/src/examples/simpletreemodel.qdoc
@@ -41,10 +41,9 @@
of the data to simplify and standardize the way it is accessed.
Simple models represent data as a table of items, and allow views
to access this data via an
- \l{Model/View Programming#model-indexes} {index-based}
- system. More generally, models can be used to represent data in
- the form of a tree structure by allowing each item to act as a
- parent to a table of child items.
+ \l{Model/View Programming#Models}{index-based} system. More generally,
+ models can be used to represent data in the form of a tree structure
+ by allowing each item to act as a parent to a table of child items.
Before attempting to implement a tree model, it is worth considering whether
the data is supplied by an external source, or whether it is going to be
diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc
index e901124c..61620f5 100644
--- a/doc/src/external-resources.qdoc
+++ b/doc/src/external-resources.qdoc
@@ -428,3 +428,18 @@
\externalpage http://developer.symbian.org/wiki/index.php/Deploying_a_Qt_Application
\title Deploying a Qt Application article
*/
+
+/*!
+ \externalpage http://www.ecma-international.org/publications/standards/Ecma-262.htm
+ \title ECMAScript Language Specification
+*/
+
+/*!
+ \externalpage https://developer.mozilla.org/en/JavaScript
+ \title JavaScript
+*/
+
+/*!
+ \externalpage https://developer.mozilla.org/en/JavaScript/About_JavaScript
+ \title About JavaScript
+*/
diff --git a/doc/src/frameworks-technologies/accessible.qdoc b/doc/src/frameworks-technologies/accessible.qdoc
index 4134cfe..cbc1558 100644
--- a/doc/src/frameworks-technologies/accessible.qdoc
+++ b/doc/src/frameworks-technologies/accessible.qdoc
@@ -36,6 +36,7 @@
\brief How to make your applications accessible to those with disabilities.
\ingroup technology-apis
+ \ingroup qt-basic-concepts
\ingroup best-practices
\tableofcontents
diff --git a/doc/src/frameworks-technologies/containers.qdoc b/doc/src/frameworks-technologies/containers.qdoc
index 797326e..cf5fe73 100644
--- a/doc/src/frameworks-technologies/containers.qdoc
+++ b/doc/src/frameworks-technologies/containers.qdoc
@@ -46,6 +46,7 @@
\title Container Classes
\ingroup technology-apis
\ingroup groups
+ \ingroup qt-basic-concepts
\keyword container class
\keyword container classes
diff --git a/doc/src/frameworks-technologies/graphicsview.qdoc b/doc/src/frameworks-technologies/graphicsview.qdoc
index 7147823..20bb750 100644
--- a/doc/src/frameworks-technologies/graphicsview.qdoc
+++ b/doc/src/frameworks-technologies/graphicsview.qdoc
@@ -34,6 +34,8 @@
\page graphicsview.html
\title Graphics View Framework
\ingroup qt-graphics
+ \ingroup qt-basic-concepts
+
\brief An overview of the Graphics View framework for interactive 2D
graphics.
diff --git a/doc/src/frameworks-technologies/ipc.qdoc b/doc/src/frameworks-technologies/ipc.qdoc
index 26a8cec..775243a 100644
--- a/doc/src/frameworks-technologies/ipc.qdoc
+++ b/doc/src/frameworks-technologies/ipc.qdoc
@@ -31,6 +31,7 @@
\brief Inter-Process communication in Qt applications.
\ingroup technology-apis
+ \ingroup qt-basic-concepts
\ingroup qt-network
Qt provides several ways to implement Inter-Process Communication
diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc
index 7167f97..7a1fb40 100644
--- a/doc/src/frameworks-technologies/model-view-programming.qdoc
+++ b/doc/src/frameworks-technologies/model-view-programming.qdoc
@@ -32,6 +32,7 @@
/*!
\page model-view-programming.html
+ \ingroup qt-basic-concepts
\title Model/View Programming
\brief A guide to Qt's extensible model/view architecture.
diff --git a/doc/src/frameworks-technologies/plugins-howto.qdoc b/doc/src/frameworks-technologies/plugins-howto.qdoc
index a66bae0..5103bdc 100644
--- a/doc/src/frameworks-technologies/plugins-howto.qdoc
+++ b/doc/src/frameworks-technologies/plugins-howto.qdoc
@@ -47,6 +47,8 @@
functionality provided by Qt.
\ingroup frameworks-technologies
+ \ingroup qt-basic-concepts
+
\keyword QT_DEBUG_PLUGINS
\keyword QT_NO_PLUGIN_CHECK
diff --git a/doc/src/frameworks-technologies/richtext.qdoc b/doc/src/frameworks-technologies/richtext.qdoc
index 42a57ec..a9ee0b2 100644
--- a/doc/src/frameworks-technologies/richtext.qdoc
+++ b/doc/src/frameworks-technologies/richtext.qdoc
@@ -36,7 +36,8 @@
\brief An overview of Qt's rich text processing, editing and display features.
\ingroup frameworks-technologies
-
+ \ingroup qt-basic-concepts
+
\nextpage Rich Text Document Structure
The Scribe framework provides a set of classes for reading and manipulating
diff --git a/doc/src/getting-started/demos.qdoc b/doc/src/getting-started/demos.qdoc
index 4003988..f52fc92 100644
--- a/doc/src/getting-started/demos.qdoc
+++ b/doc/src/getting-started/demos.qdoc
@@ -46,7 +46,7 @@
\o \inlineimage qtdemo-small.png
\o If you run the \l{Examples and Demos Launcher}, you'll see many of Qt's
widgets in action.
-
+
The \l{Qt Widget Gallery} also provides overviews of selected Qt
widgets in each of the styles used on various supported platforms.
\endtable
@@ -134,15 +134,23 @@
\section1 QtWebKit
\list
- \o \l{Web Browser} demonstrates how Qt's \l{WebKit in Qt}{WebKit module}
- can be used to implement a small Web browser.
+ \o \l{Web Browser} demonstrates how Qt's \l{QtWebKit} module can be used to
+ implement a small Web browser.
+ \endlist
+
+ \section1 Multimedia
+
+ \list
+ \o \l{demos/spectrum}{Spectrum Analyser} shows how the \l{QtMultimedia}
+ module can be used to manipulate audio as it is played.
\endlist
\section1 Phonon
\list
- \o \l{demos/qmediaplayer}{Media Player} demonstrates how the \l{Phonon Module} can be
- used to implement a basic media player application.
+ \o \l{demos/qmediaplayer}{Media Player} demonstrates how the
+ \l{Phonon Module}{Phonon module} can be used to implement a basic media player
+ application.
\endlist
\note The Phonon demos are currently not available for the MinGW platform.
diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc
index 1bf86e5..708c44e 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 and Drop Examples
+ \brief How to access your platform's native drag and drop functionality.
\image draganddrop-examples.png
diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc
index 6c85776..a19d281 100644
--- a/doc/src/getting-started/gettingstartedqml.qdoc
+++ b/doc/src/getting-started/gettingstartedqml.qdoc
@@ -26,1026 +26,1023 @@
****************************************************************************/
/*!
- \page qml-textEditor.html
-
- \title Getting Started programming with QML
- \ingroup gettingStarted
-
- Welcome to the world of QML - the declarative UI language. In this Getting
- Started guide, we create a simple text editor application using QML.
- After reading this guide, you should be ready to start developing your own
- applications using QML and Qt C++.
-
- \example tutorials/gettingStarted/gsQml
-
- \section1 QML to Build User Interfaces
-
- Here we are building is a simple text editor that con load, save,
- and perform some text manipulation. This guide consists of two parts. The
- first part involves designing the application layout and behaviors using
- declarative language in QML. For the second part, file loading and saving is
- implemented using Qt C++.
- Using \l {The Meta-Object System}{Qt's Meta-Object System}, we can expose C++
- functions as properties that QML elements can use. By utilizing QML and Qt C++,
- we can efficiently decouple the interface logic from the application logic.
-
- \image qml-texteditor5_editmenu.png
-
- To run the QML example code, we merely provide the included \l{QML Viewer}{qmlviewer}
- tool with the QML file as the argument. The C++ portion of this tutorial assumes
- that the reader possesses basic knowledge of Qt's compilation procedures.
-
- \omit
- Tutorial chapters:
- \list 1
- \o \l {Defining a Button and a Menu}{Defining a Button and a Menu}
- \o \l {Implementing a Menu Bar}{Implementing a Menu Bar}
- \o \l {Building a Text Editor}{Building a Text Editor}
- \o \l {Decorating the Text Editor}{Decorating the Text Editor}
- \o \l {Extending QML using Qt C++}{Extending QML using Qt C++}
- \endlist
- \endomit
-
- \section1 Defining a Button and a Menu
-
- \section2 Basic Component - a Button
-
- We start our text editor by building a button. Functionally, a button has a mouse
- sensitive area and a label. Buttons perform actions when a user presses the button.
-
- In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The
- \c Rectangle element has properties to control the element's appearance and location.
-
- \code
- import Qt 4.7
- Rectangle {
- id: simplebutton
- color: "grey"
- width: 150; height: 75
-
- Text{
- id: buttonLabel
- anchors.centerIn: parent
- text: "button label"
- }
- }
- \endcode
-
- First, the \c { import Qt 4.7 } allows the qmlviewer tool to import the QML elements
- we will later use. This line must exist for every QML file. Notice that the version
- of Qt modules is included in the import statement.
-
- This simple rectangle has a unique identifier, \c simplebutton, which is bound to the
- id property. The \c Rectangle element's properties are bound to values by listing the
- property, followed by a colon, then the value. In the code sample, the color \c grey
- is bound to the the Rectangle's \c color property. Similarly, we bind the \c width
- and \c height of the Rectangle.
-
- The \l {Text}{Text} element is a non-editable text field. We name this \c Text element
- \c buttonLabel. To set the string content of the Text field, we bind a value to the
- \c text property. The label is contained within the Rectangle and in order to center
- it in the middle, we assign the \c anchors of the Text element to its parent, which
- is called \c simplebutton. Anchors may bind to other items' anchors, allowing layout
- assignments simpler.
-
- We save this code as \c SimpleButton.qml. Running qmlviewer with the file as the
- argument will display the grey rectangle with a text label.
-
- \image qml-texteditor1_simplebutton.png
-
- To implement the button click functionality, we can use QML's event handling. QML's event
- handling is very similar to \l {Signals & Slots}{Qt's signal and slot} mechanism. Signals
- are emitted and the connected slot is called.
-
- \code
- Rectangle{
- id:simplebutton
- ...
-
- MouseArea{
- id: buttonMouseArea
-
- anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors
- //onClicked handles valid mouse button clicks
- onClicked: console.log(buttonLabel.text + " clicked" )
- }
- }
- \endcode
-
- We include a \l{MouseArea} element in our simplebutton. \c MouseArea elements describe
- the interactive area where mouse movements are detected. For our button, we anchor the
- whole MouseArea to its parent, which is \c simplebutton. The \c anchors.fill syntax is
- one way of accessing a specific property called \c fill inside a group of properties
- called \c anchors. QML uses \l {Anchor-based Layout in QML}{anchor based layouts} where
- items can anchor to another item, creating robust layouts.
-
- The \c MouseArea has many signal handlers that are called during mouse movements within
- the specfied \c MouseArea boundaries. One of them is \c onClicked and it is called
- whenever the acceptable mouse button is clicked, the left click being the default. We
- can bind actions to the onClicked handler. In our example, \c console.log() outputs text
- whenever the mouse area is clicked. The function \c console.log() is a useful tool for
- debugging purposes and for outputting text.
-
- The code in \c SimpleButton.qml is sufficient to display a button on the screen and
- output text whenever it is clicked with a mouse.
-
- \code
- Rectangle {
- id:Button
- ...
-
- property color buttonColor: "lightblue"
- property color onHoverColor: "gold"
- property color borderColor: "white"
-
- signal buttonClick()
- onButtonClick: {
- console.log(buttonLabel.text + " clicked" )
- }
-
- MouseArea{
- onClicked: buttonClick()
- hoverEnabled: true
- onEntered: parent.border.color = onHoverColor
- onExited: parent.border.color = borderColor
- }
-
- //determines the color of the button by using the conditional operator
- color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
- }
- \endcode
-
- A fully functioning button is in \c Button.qml. The code snippets in this article
- have some code omitted, denoted by ellipses because they were either introduced
- earlier in the previous sections or irrelevant to the current code discussion.
-
- Custom properties are declared using the \c {property type name} syntax. In the
- code, the property \c buttonColor, of type \c color, is declared and bound to
- the value \c{"lightblue"}. The \c buttonColor is later used in a conditional
- operation to determine the buttons's fill color. Note that property value
- assignment is possible using the \c= equals sign, in addition to value binding
- using the \c : colon character. Custom properties allow internal items to be
- accessible outside of the Rectangle's scope. There are basic
- \l{QML Basic Types}{QML types} such as \c int, \c string, \c real, as well as
- a type called \c variant.
-
- By binding the \c onEntered and \c onExited signal handlers to colors, the
- button's border will turn yellow when the mouse hovers above the button and
- reverts the color when the mouse exits the mouse area.
-
- A \c buttonClick() signal is declared in \c Button.qml by placing the \c signal
- keyword in front of the signal name. All signals have their handlers automatically
- created, their names starting with \c on. As a result, the \c onButtonClick is
- \c buttonClick's handler. The \c onButtonClick is then assigned an action to
- perform. In our button example, the \c onClicked mouse handler will simply call
- \c onButtonClick, which displays a text. The \c onButtonClick enables outside
- objects to access the \c {Button}'s mouse area easily. For example, items may
- have more than one \c MouseArea declarations and a \c buttonClick signal can
- make the distinction between the several \c MouseArea signal handlers better.
-
- We now have the basic knowledge to implement items in QML that can handle
- basic mouse movements. We created a \c Text label inside a \c Rectangle,
- customized its properties, and implemented behaviors that respond to mouse
- movements. This idea of creating elements within elements is repeated
- throughout the text editor application.
-
- This button is not useful unless used as a component to perform an action.
- In the next section, we will soon create a menu containing several of these
- buttons.
-
- \image qml-texteditor1_button.png
-
- \section2 Creating a Menu Page
-
- Up to this stage, we covered how to create elements and assign behaviors inside
- a single QML file. In this section, we will cover how to import QML elements and how
- to reuse some of the created components to build other components.
-
- Menus display the contents of a list, each item having the ability to perform an action.
- In QML, we can create a menu in several ways. First, we will create a menu containing
- buttons which will eventually perform different actions. The menu code is in
- \c FileMenu.qml.
-
- \code
- import Qt 4.7 \\import the main Qt QML module
- import “folderName” \\import the contents of the folder
- import “Button.qml” \\import a QML file
- import “NewButton.qml” as ButtonModule \\import a QML file and give it a name
- import “script.js” as Script \\import a Javascript file and name it as Script
- \endcode
-
- To use the \c Button element in \c FileMenu.qml, we need to import \c Button.qml.
- The syntax shown above, shows how to use the \c import keyword. However, the
- \c {import Button.qml} is not necessary; qmlviewer will import all the contents
- of the current directory. We can directly create a \c Button element by declaring
- \c Button{}, similar to a \c Rectangle{} declaration.
-
- \code
- In FileMenu.qml:
-
- Row{
- anchors.centerIn: parent
- spacing: parent.width/6
-
- Button{
- id: loadButton
- buttonColor: "lightgrey"
- label: "Load"
- }
- Button{
- buttonColor: "grey"
- id: saveButton
- label: "Save"
- }
- Button{
- id: exitButton
- label: "Exit"
- buttonColor: "darkgrey"
-
- onButtonClick: Qt.quit()
- }
- }
- \endcode
-
- In \c FileMenu.qml, we declare three \c Button elements. They are declared
- inside a \l {Row}{Row} element, a positioner that will position its children
- along a vertical row. The \c Button declaration resides in Button.qml,
- which is the same as the \c Button.qml we used in the previous section.
- New property bindings can be declared within the newly created buttons,
- effectively overwriting the properties set in \c Button.qml. The button
- called \c exitButton will quit and close the window when it is clicked.
- Note that the signal handler \c onButtonClick in \c Button.qml will be
- called in addition to the \c onButtonClick handler in \c exitButton.
-
- \image qml-texteditor1_filemenu.png
-
- The \c Row declaration is declared in a \c Rectangle, creating a rectangle
- container for the row of buttons. This additional rectangle creates an indirect
- way of organizing the row of buttons inside a menu.
-
- The declaration of the edit menu is very similar at this stage. The menu has
- buttons that have the labels: \c Copy, \c Paste, and \c {Select All}.
-
- \image qml-texteditor1_editmenu.png
-
- Armed with our knowledge of importing and customizing previously made
- components, we may now combine these menu pages to create a menu bar,
- consisting of buttons to select the menu, and look at how we may structure
- data using QML.
-
- \section1 Implementing a Menu Bar
-
- Our text editor application will need a way to display menus using a menu bar.
- The menu bar will switch the different menus and the user can choose which menu
- to display. Menu switching implies that the menus need more structure than
- merely displaying them in a row. QML uses models and views to structure data
- and display the structured data.
-
- \section2 Using Data Models and Views
-
- QML has different \l {Data Models}{data views} that display
- \l {Data Models}{data models}. Our menu bar will display the menus in a list,
- with a header that displays a row of menu names. The list of menus are declared
- inside a \c VisualItemModel. The \l{VisualItemModel}{\c VisualItemModel}
- element contains items that already have views such as \c Rectangle elements
- and imported UI elements. Other model types such as the \l {ListModel}{\c ListModel}
- element need a delegate to display their data.
-
- We declare two visual items in the \c menuListModel, the \c FileMenu and the
- \c EditMenu. We customize the two menus and display them using a
- \l {ListView}{ListView}. The \c MenuBar.qml file contains the QML declarations
- and a simple edit menu is defined in \c EditMenu.qml.
-
- \code
- VisualItemModel{
- id: menuListModel
- FileMenu{
- width: menuListView.width
- height: menuBar.height
- color: fileColor
- }
- EditMenu{
- color: editColor
- width: menuListView.width
- height: menuBar.height
- }
- }
- \endcode
-
- The \l {ListView}{ListView} element will display a model according to a delegate.
- The delegate may declare the model items to display in a \c Row element or display
- the items in a grid. Our \c menuListModel already has visible items, therefore,
- we do not need to declare a delegate.
-
- \code
- ListView{
- id: menuListView
-
- //Anchors are set to react to window anchors
- anchors.fill:parent
- anchors.bottom: parent.bottom
- width:parent.width
- height: parent.height
-
- //the model contains the data
- model: menuListModel
-
- //control the movement of the menu switching
- snapMode: ListView.SnapOneItem
- orientation: ListView.Horizontal
- boundsBehavior: Flickable.StopAtBounds
- flickDeceleration: 5000
- highlightFollowsCurrentItem: true
- highlightMoveDuration:240
- highlightRangeMode: ListView.StrictlyEnforceRange
- }
- \endcode
-
- Additionally, \c ListView inherits from \l {Flickable}{\c Flickable}, making
- the list respond to mouse drags and other gestures. The last portion of the
- code above sets \c Flickable properties to create the desired flicking movement
- to our view. In particular,the property \c highlightMoveDuration changes the
- duration of the flick transition. A higher \c highlightMoveDuration value
- results in slower menu switching.
-
- The \c ListView maintains the model items through an \c index and each visual
- item in the model is accessible through the \c index, in the order of the
- declaration. Changing the \c currentIndex effectively changes the highlighted
- item in the \c ListView. The header of our menu bar exemplify this effect.
- There are two buttons in a row, both changing the current menu when clicked.
- The \c fileButton changes the current menu to the file menu when clicked,
- the \c index being \c 0 because \c FileMenu is declared first in the
- \c menuListModel. Similarly, the \c editButton will change the current
- menu to the \c EditMenu when clicked.
-
- The \c labelList rectangle has \c z value of \c 1, denoting that it is displayed
- at the front of the menu bar. Items with higher \c z values are displayed in front
- of items with lower \c z values. The default \c z value is \c 0.
-
- \code
- Rectangle{
- id: labelList
- ...
- z: 1
- Row{
- anchors.centerIn: parent
- spacing:40
- Button{
- label: "File"
- id: fileButton
- ...
- onButtonClick: menuListView.currentIndex = 0
- }
- Button{
- id: editButton
- label: "Edit"
- ...
- onButtonClick: menuListView.currentIndex = 1
- }
- }
- }
- \endcode
-
- The menu bar we just created can be flicked to access the menus or by clicking
- on the menu names at the top. Switching menu screens feel intuitive and responsive.
-
- \image qml-texteditor2_menubar.png
-
- \section1 Building a Text Editor
-
- \section2 Declaring a TextArea
-
- Our text editor is not a text editor if it didn't contain an editable text area.
- QML's \l {TextEdit}{TextEdit} element allows the declaration of a multi-line
- editable text area. \l {TextEdit}{TextEdit} is different from a \l {Text}{Text}
- element, which doesn't allow the user to directly edit the text.
-
- \code
- TextEdit{
- id: textEditor
- anchors.fill:parent
- width:parent.width; height:parent.height
- color:"midnightblue"
- focus: true
-
- wrapMode: TextEdit.Wrap
-
- onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle)
- }
- \endcode
-
- The editor has its font color property set and set to wrap the text. The
- \c TextEdit area is inside a flickable area that will scroll the text if the
- text cursor is outside the visible area. The function \c ensureVisible() will
- check if the cursor rectangle is outside the visible boundaries and move the
- text area accordingly. QML uses Javascript syntax for its scripts, and as previously
- mentioned, Javascript files can be imported and used within a QML file.
-
- \code
- function ensureVisible(r){
- if (contentX >= r.x)
- contentX = r.x;
- else if (contentX+width <= r.x+r.width)
- contentX = r.x+r.width-width;
- if (contentY >= r.y)
- contentY = r.y;
- else if (contentY+height <= r.y+r.height)
- contentY = r.y+r.height-height;
- }
- \endcode
-
- \section1 Combining Components for the Text Editor
-
- We are now ready to create the layout of our text editor using QML. The text
- editor has two components, the menu bar we created and the text area. QML allows
- us to reuse components, therefore making our code simpler, by importing components
- and customizing when necessary. Our text editor splits the window into two;
- one-third of the screen is dedicated to the menu bar and two-thirds of the screen
- displays the text area. The menu bar is displayed in front of any other elements.
-
- \code
- Rectangle{
-
- id: screen
- width: 1000; height: 1000
-
- //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar
- property int partition: height/3
-
- MenuBar{
- id:menuBar
- height: partition
- width:parent.width
- z: 1
- }
-
- TextArea{
- id:textArea
- anchors.bottom:parent.bottom
- y: partition
- color: "white"
- height: partition*2
- width:parent.width
- }
- }
- \endcode
-
- By importing reusable components, our \c TextEditor code looks much simpler.
- We can then customize the main application, without worrying about properties
- that already have defined behaviors. Using this approach, application layouts
- and UI components can be created easily.
-
- \image qml-texteditor3_texteditor.png
-
- \section1 Decorating the Text Editor
- \section2 Implementing a Drawer Interface
-
- Our text editor looks simple and we need to decorate it. Using QML, we can declare
- transitions and animate our text editor. Our menu bar is occupying one-third of the
- screen and it would be nice to have it only appear when we want it.
-
- We can add a drawer interface, that will contract or expand the menu bar when clicked.
- In our implementation, we have a thin rectangle that responds to mouse clicks. The
- \c drawer, as well as the application, has two sates: the "drawer is open" state and
- the "drawer is closed" state. The \c drawer item is a strip of rectangle with a small
- height. There is a nested \l {Image}{Image} element declaring that an arrow icon will
- be centered inside the drawer. The drawer assigns a state to the whole application,
- with the identifier \c screen, whenever a user clicks the mouse area.
-
- \code
- Rectangle{
- id:drawer
- height:15
-
- Image{
- id: arrowIcon
- source: "images/arrow.png"
- anchors.horizontalCenter: parent.horizontalCenter
- }
-
- MouseArea{
- id: drawerMouseArea
- anchors.fill:parent
- onClicked:{
- if (screen.state == "DRAWER_CLOSED"){
- screen.state = "DRAWER_OPEN"
- }
- else if (screen.state == "DRAWER_OPEN"){
- screen.state = "DRAWER_CLOSED"
- }
- }
- ...
- }
- }
- \endcode
-
- A state is simply a collection of configurations and it is declared in a
- \l{State}{State} element. A list of states can be listed and bound to the
- \c states property. In our application, the two states are called
- \c DRAWER_CLOSED and \c DRAWER_OPEN. Item configurations are declared in
- \l {PropertyChanges}{PropertyChanges} elements. In the \c DRAWER_OPEN state,
- there are four items that will receive property changes. The first target,
- \c menuBar, will change its \c y property to \c 0. Similarly, the \c textArea
- will lower to a new position when the state is \c DRAWER_OPEN. The \c textArea,
- the \c drawer, and the drawer's icon will undergo property changes to meet the
- current state.
-
- \code
-
- states:[
- State{
- name: "DRAWER_OPEN"
- PropertyChanges { target: menuBar; y:0}
- PropertyChanges { target: textArea; y: partition + drawer.height}
- PropertyChanges { target: drawer; y: partition}
- PropertyChanges { target: arrowIcon; rotation: 180}
- },
- State{
- name: "DRAWER_CLOSED"
- PropertyChanges { target: menuBar; y:-partition}
- PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height}
- PropertyChanges { target: drawer; y: 0}
- PropertyChanges { target: arrowIcon; rotation: 0}
- }
-
- ]
-
- \endcode
-
- State changes are abrupt and needs smoother transitions. Transitions between states
- are defined using the \l {Transition}{Transition} element, which can then bind to
- the item's \c transitions property. Our text editor has a state transition whenever
- the state changes to either \c DRAWER_OPEN or \c DRAWER_CLOSED. Importantly, the
- transition needs a \c from and a \c to state but for our transitions, we can use
- the wild card \c * symbol to denote that the transition applies to all state changes.
-
- During transitions, we can assign animations to the property changes. Our
- \c menuBar switches position from \c {y:0} to \c {y:-partition} and we can animate
- this transition using the \l {NumberAnimation}{NumberAnimation} element. We declare
- that the targets' properties will animate for a certain duration of time and using
- a certain easing curve. An easing curve controls the animation rates and
- interpolation behavior during state transitions. The easing curve we chose is
- \l{PropertyAnimation::easing.type}{Easing.OutQuint}, which slows the movement near
- the end of the animation. Pleae read \l {qdeclarativeanimation.html}{QML's Animation}
- article.
-
- \code
- transitions: [
- Transition{
- to: "*"
- NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type: Easing.OutQuint }
- NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutQuint }
- NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutQuint }
- }
- ]
- \endcode
-
- Another way of animating property changes is by declaring a \l {Behavior}{Behavior}
- element. A transition only works during state changes and \c Behavior can set an
- animation for a general property change. In the text editor, the arrow has a
- \c NumberAnimation animating its \c rotation property whenever the property changes.
-
- \code
- In TextEditor.qml:
-
- Behavior{
- NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }
- }
- \endcode
-
- Going back to our components with knowledge of states and animations, we can improve
- the appearances of the components. In \c Button.qml, we can add \c color and \c scale
- property changes when the button is clicked. Color types are animated using
- \l {ColorAnimation}{ColorAnimation} and numbers are animated using
- \l {NumberAnimation}{NumberAnimation}. The \c {on propertyName} syntax displayed below
- is helpful when targeting a single property.
-
- \code
- In Button.qml:
- ...
-
- color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
- Behavior on color { ColorAnimation{ duration: 55} }
-
- scale: buttonMouseArea.pressed ? 1.1 : 1.00
- Behavior on scale { NumberAnimation{ duration: 55} }
- \endcode
-
- Additionally, we can enhance the appearances of our QML components by adding color
- effects such as gradients and opacity effects. Declaring a \l {Gradient}{Gradient}
- element will override the \c color property of the element. You may declare a color
- in the gradient using the \l {GradientStop}{GradientStop} element. The gradient is
- positioned using a scale, between \c 0.0 and \c 1.0.
-
- \code
- In MenuBar.qml
- gradient: Gradient {
- GradientStop { position: 0.0; color: "#8C8F8C" }
- GradientStop { position: 0.17; color: "#6A6D6A" }
- GradientStop { position: 0.98;color: "#3F3F3F" }
- GradientStop { position: 1.0; color: "#0e1B20" }
- }
- \endcode
-
- This gradient is used by the menu bar to display a gradient simulating depth.
- The first color starts at \c 0.0 and the last color is at \c 1.0.
-
-
- \section2 Where to Go from Here
-
- We are finished building the user interface of a very simple text editor.
- Going forward, the user interface is complete, and we can implement the
- application logic using regular Qt and C++. QML works nicely as a prototyping
- tool, separating the application logic away from the UI design.
-
- \image qml-texteditor4_texteditor.png
-
- \section1 Extending QML using Qt C++
-
- Now that we have our text editor layout, we may now implement the text editor
- functionalities in C++. Using QML with C++ enables us to create our application
- logic using Qt. We can create a QML context in a C++ application using the
- \l {Using QML in C++ Applications}{Qt's Declarative} classes and display the QML
- elements using a Graphics Scene. Alternatively, we can export our C++ code into
- a plugin that the \l {QML Viewer}{qmlviewer} tool can read. For our application,
- we shall implement the load and save functions in C++ and export it as a plugin.
- This way, we only need to load the QML file directly instead of running an executable.
-
- \section2 Exposing C++ Classes to QML
-
- We will be implementing file loading and saving using Qt and C++. C++ classes
- and functions can be used in QML by registering them. The class also needs to be
- compiled as a Qt plugin and the QML file will need to know where the plugin is located.
-
- For our application, we need to create the following items:
- \list 1
- \o \c Directory class that will handle directory related operations
- \o \c File class which is a QObject, simulating the list of files in a directory
- \o plugin class that will register the class to the QML context
- \o Qt project file that will compile the plugin
- \o A \c qmldir file telling the qmlviewer tool where to find the plugin
- \endlist
-
- \section2 Building a Qt Plugin
-
- To build a plugin, we need to set the following in a Qt project file. First,
- the necessary sources, headers, and Qt modules need to be added into our
- project file. All the C++ code and project files are in the \c filedialog
- directory.
-
- \code
- In cppPlugins.pro:
-
- TEMPLATE = lib
- CONFIG += qt plugin
- QT += declarative
-
- DESTDIR += ../plugins
- OBJECTS_DIR = tmp
- MOC_DIR = tmp
-
- TARGET = FileDialog
-
- HEADERS += directory.h \
- file.h \
- dialogPlugin.h
-
- SOURCES += directory.cpp \
- file.cpp \
- dialogPlugin.cpp
- \endcode
-
- In particular, we compile Qt with the \c declarative module and configure it as a
- \c plugin, needing a \c lib template. We shall put the compiled plugin into the
- parent's \c plugins directory.
-
-
- \section2 Registering a Class into QML
-
- \code
- In dialogPlugin.h:
-
- #include <QtDeclarative/QDeclarativeExtensionPlugin>
-
- class DialogPlugin : public QDeclarativeExtensionPlugin
- {
- Q_OBJECT
-
- public:
- void registerTypes(const char *uri);
-
- };
-
- \endcode
-
- Our plugin class, \c DialogPlugin is a subclass of \l
- {QDeclarativeExtensionPlugin}{QDeclarativeExtensionPlugin}. We
- need to implement the inherited function, \l
- {QDeclarativeExtensionPlugin::registerTypes()}{registerTypes}. The
- \c dialogPlugin.cpp file looks like this:
-
- \code
- DialogPlugin.cpp:
-
- #include "dialogPlugin.h"
- #include "directory.h"
- #include "file.h"
- #include <QtDeclarative/qdeclarative.h>
-
- void DialogPlugin::registerTypes(const char *uri){
-
- qmlRegisterType<Directory>(uri, 1, 0, "Directory");
- qmlRegisterType<File>(uri, 1, 0,"File");
- }
-
- Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin);
- \endcode
-
- The \l {QDeclarativeExtensionPlugin::registerTypes()}{registerTypes}
- function registers our File and Directory classes into QML. This function
- needs the class name for its template, a major version number, a minor version
- number, and a name for our classes.
-
- We need to export the plugin using the \l {Q_EXPORT_PLUGIN2}{Q_EXPORT_PLUGIN2}
- macro. Note that in our \c dialogPlugin.h file, we have the \l {Q_OBJECT}{Q_OBJECT}
- macro at the top of our class. As well, we need to run \c qmake on the project
- file to generate the necessary meta-object code.
-
-
- \section2 Creating QML Properties in a C++ class
-
- We can create QML elements and properties using C++ and
- \l {The Meta-Object System}{Qt's Meta-Object System}. We can implement
- properties using slots and signals, making Qt aware of these properties.
- These properties can then be used in QML.
-
- For the text editor, we need to be able to load and save files. Typically,
- these features are contained in a file dialog. Fortunately, we can use
- \l {QDir}{QDir}, \l {QFile}{QFile}, and \l {QTextStream}{QTextStream} to
- implement directory reading and input/output streams.
-
- \code
- class Directory : public QObject{
-
- Q_OBJECT
-
- Q_PROPERTY(int filesCount READ filesCount CONSTANT)
- Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
- Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged)
- Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT )
-
- ...
- \endcode
-
- The \c Directory class uses Qt's Meta-Object System to register properties it
- needs to accomplish file handling. The \c Directory class is exported as a plugin
- and is useable in QML as the \c Directory element. Each of the listed properties
- using the \l {Q_PROPERTY()}{Q_PROPERTY} macro is a QML property.
-
- The \l {Q_PROPERTY()} {Q_PROPERTY} declares a property as well as its read and
- write functions into Qt's Meta-Object System. For example, the \c filename
- property, of type \l {QString}{QString}, is readable using the \c filename()
- function and writable using the function \c setFilename(). Additionally, there
- is a signal associated to the filename property called \c filenameChanged(),
- which is emitted whenever the property changes. The read and write functions
- are declared as \c public in the header file.
-
- Similarly, we have the other properties declared according to their uses. The
- \c filesCount property indicates the number of files in a directory. The filename
- property is set to the currently selected file's name and the loaded/saved file
- content is stored in \c fileContent property.
-
- \code
- Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT )
- \endcode
-
- The \c files list property is a list of all the filtered files in a directory.
- The \c Directory class is implemented to filter out invalid text files; only
- files with a \c .txt extension are valid. Further, \l {QList}{QLists} can be
- used in QML files by declaring them as a \c QDeclarativeListProperty in C++.
- The templated object needs to inherit from a \l {QObject}{QObject}, therefore,
- the \c File class must also inherit from \c QObject. In the \c Directory class,
- the list of \c File objects is stored in a \c QList called \c m_fileList.
-
- \code
- class File : public QObject{
-
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
-
- ...
- };
- \endcode
-
- The properties can then be used in QML as part of the \c Directory element's
- properties. Note that we do not have to create an identifier \c id property
- in our C++ code.
-
- \code
- Directory{
- id: directory
-
- filesCount
- filename
- fileContent
- files
-
- files[0].name
- }
-
- \endcode
-
- Because QML uses Javascript's syntax and structure, we can iterate through
- the list of files and retrieve its properties. To retrieve the first file's
- name property, we can call \c { files[0].name }.
-
- Regular C++ functions are also accessible from QML. The file loading and saving
- functions are implemented in C++ and declared using the
- \l {Q_INVOKABLE}{Q_INVOKABLE} macro. Alternatively, we can declare the functions
- as a \c slot and the functions will be accessible from QML.
-
- \code
- In Directory.h:
-
- Q_INVOKABLE void saveFile();
- Q_INVOKABLE void loadFile();
- \endcode
-
- The \c Directory class also has to notify other objects whenever the directory
- contents change. This feature is performed using a \c signal. As previously
- mentioned, QML signals have a corresponding handler with their names prepended
- with \c on. The signal is called \c directoryChanged and it is emitted whenever
- there is a directory refresh. The refresh simply reloads the directory contents
- and updates the list of valid files in the directory. QML items can then be
- notified by attaching an action to the \c onDirectoryChanged signal handler.
-
- The \c list properties need to be explored further. This is because list
- properties use callbacks to access and modify the list contents. The list
- property is of type \c QDeclarativeListProperty<File>. Whenever the list
- is accessed, the accessor function needs to return a
- \c QDeclarativeListProperty<File>. The template type, \c File, needs to be a
- \c QObject derivative. Further, to create the
- \l {QDeclarativeListProperty}{QDeclarativeListProperty}, the list's accessor
- and modifiers need to be passed to the consructor as function pointers. The list,
- a \c QList in our case, also needs to be a list of \c File pointers.
-
- The constructor of \l {QDeclarativeListProperty}{QDeclarativeListProperty}
- constructor and the \c Directory implementation:
- \code
- QDeclarativeListProperty ( QObject * object, void * data, AppendFunction append, CountFunction count = 0, AtFunction at = 0, ClearFunction clear = 0 )
- QDeclarativeListProperty<File>( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr );
- \endcode
-
- The constructor passes pointers to functions that will append the list, count
- the list, retrieve the item using an index, and empty the list. Only the append
- function is mandatory. Note that the function pointers must match the definition
- of \l {QDeclarativeListProperty::AppendFunction}{AppendFunction},
- \l {QDeclarativeListProperty::CountFunction}{CountFunction},
- \l {QDeclarativeListProperty::AtFunction}{AtFunction}, or
- \l {QDeclarativeListProperty::ClearFunction}{ClearFunction}.
-
- \code
- void appendFiles(QDeclarativeListProperty<File> * property, File * file)
- File* fileAt(QDeclarativeListProperty<File> * property, int index)
- int filesSize(QDeclarativeListProperty<File> * property)
- void clearFilesPtr(QDeclarativeListProperty<File> *property)
- \endcode
-
- To simplify our file dialog, the \c Directory class filters out invalid text
- files, which are files that do not have a \c .txt extension. If a file name
- doesn't have the \c .txt extension, then it won't be seen in our file dialog.
- Also, the implementation makes sure that saved files have a \c .txt extension in
- the file name. \c Directory uses \l {QTextStream}{QTextStream} to read the file
- and to output the file contents to a file.
-
- With our \c Directory element, we can retrieve the files as a list, know how many
- text files is in the application directory, get the file's name and content as a
- string, and be notified whenever there are changes in the directory contents.
-
- To build the plugin, run \c qmake on the \c cppPlugins.pro project file, then run
- \c make to build and transfer the plugin to the \c plugins directory.
-
-
- \section2 Importing a Plugin in QML
-
- The qmlviewer tool imports files that are in the same directory as the
- application. We can also create a \c qmldir file containing the locations of
- QML files we wish to import. The \c qmldir file can also store locations of
- plugins and other resources.
-
- \code
- In qmldir:
-
- Button ./Button.qml
- FileDialog ./FileDialog.qml
- TextArea ./TextArea.qml
- TextEditor ./TextEditor.qml
- EditMenu ./EditMenu.qml
-
- plugin FileDialog plugins
- \endcode
-
- The plugin we just created is called \c FileDialog, as indicated by the
- \c TARGET field in the project file. The compiled plugin is in the \c plugins directory.
-
-
- \section2 Integrating a File Dialog into the File Menu
-
- Our \c FileMenu needs to display the \c FileDialog element, containing a list of
- the text files in a directory thus allowing the user to select the file by
- clicking on the list. We also need to assign the save, load, and new buttons
- to their respective actions. The FileMenu contains an editable text input to
- allow the user to type a file name using the keyboard.
-
- The \c Directory element is used in the \c FileMenu.qml file and it notifies the
- \c FileDialog element that the directory refreshed its contents. This notification
- is performed in the signal handler, \c onDirectoryChanged.
-
- \code
- In FileMenu.qml:
-
- Directory{
- id:directory
- filename: textInput.text
- onDirectoryChanged: fileDialog.notifyRefresh()
- }
- \endcode
-
- Keeping with the simplicity of our application, the file dialog will always be
- visible and will not display invalid text files, which do not have a \c .txt
- extension to their filenames.
-
- \code
- In FileDialog.qml:
-
- signal notifyRefresh()
- onNotifyRefresh: dirView.model = directory.files
- \endcode
-
- The \c FileDialog element will display the contents of a directory by reading its
- list property called \c files. The files are used as the model of a
- \l {GridView}{GridView} element, which displays data items in a grid according
- to a delegate. The delegate handles the appearance of the model and our file
- dialog will simply create a grid with text centered in the middle. Clicking on
- the file name will result in the appearance of a rectangle to highlight the file
- name. The \c FileDialog is notified whenever the \c notifyRefresh signal is emitted,
- reloading the files in the directory.
-
- \code
- In FileMenu.qml:
-
- Button{
- id: newButton
- label: "New"
- onButtonClick:{
- textArea.textContent = ""
- }
- }
- Button{
- id: loadButton
- label: "Load"
- onButtonClick:{
- directory.filename = textInput.text
- directory.loadFile()
- textArea.textContent = directory.fileContent
- }
- }
- Button{
- id: saveButton
- label: "Save"
- onButtonClick:{
- directory.fileContent = textArea.textContent
- directory.filename = textInput.text
- directory.saveFile()
- }
- }
- Button{
- id: exitButton
- label: "Exit"
- onButtonClick:{
- Qt.quit()
- }
- }
- \endcode
-
- Our \c FileMenu can now connect to their respective actions. The \c saveButton
- will transfer the text from the \c TextEdit onto the directory's \c fileContent
- property, then copy its file name from the editable text input. Finally, the button
- calls the \c saveFile() function, saving the file. The \c sloadButton has a similar
- execution. Also, the \c New action will empty the contents of the \c TextEdit.
-
- Further, the \c EditMenu buttons are connected to the \c TextEdit functions to copy,
- paste, and select all the text in the text editor.
-
- \image qml-texteditor5_filemenu.png
-
- \section1 Text Editor Completion
-
- \image qml-texteditor5_newfile.png
-
- The application can function as a simple text editor, able to accept text
- and save the text into a file. The text editor can also load from a file and
- perform text manipulation.
-
-
-*/ \ No newline at end of file
+ \page gettingstartedqml.html
+ \title Getting Started Programming with QML
+ \ingroup gettingStarted
+
+ Welcome to the world of QML, the declarative UI language. In this Getting
+ Started guide, we will create a simple text editor application using QML.
+ After reading this guide, you should be ready to develop your own applications
+ using QML and Qt C++.
+
+ \section1 QML to Build User Interfaces
+
+ The application we are building is a simple text editor that will load, save,
+ and perform some text manipulation. This guide will consist of two parts. The
+ first part will involve designing the application layout and behaviors using
+ declarative language in QML. For the second part, file loading and saving will
+ be implemented using Qt C++. Using
+ \l {The Meta-Object System}{Qt's Meta-Object System}, we can expose C++ functions
+ as properties that QML elements can use. Utilizing QML and Qt C++, we can
+ efficiently decouple the interface logic from the application logic.
+
+ \image qml-texteditor5_editmenu.png
+
+ To run the QML example code, merely provide the included \l{QML Viewer}{qmlviewer}
+ tool with the QML file as the argument. The C++ portion of this tutorial assumes
+ that the reader possesses basic knowledge of Qt's compilation procedures.
+
+ Tutorial chapters:
+ \list 1
+ \o \l {Defining a Button and a Menu}{Defining a Button and a Menu}
+ \o \l {Implementing a Menu Bar}{Implementing a Menu Bar}
+ \o \l {Building a Text Editor}{Building a Text Editor}
+ \o \l {Decorating the Text Editor}{Decorating the Text Editor}
+ \o \l {Extending QML using Qt C++}{Extending QML using Qt C++}
+ \endlist
+
+ \section1 Defining a Button and a Menu
+
+ \section2 Basic Component - a Button
+
+ We start our text editor by building a button. Functionally, a button has a mouse
+ sensitive area and a label. Buttons perform actions when a user presses the button.
+
+ In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The
+ \c Rectangle element has properties to control the element's appearance and location.
+
+ \code
+ import Qt 4.7
+ Rectangle {
+ id: simplebutton
+ color: "grey"
+ width: 150; height: 75
+
+ Text{
+ id: buttonLabel
+ anchors.centerIn: parent
+ text: "button label"
+ }
+ }
+ \endcode
+
+ First, the \c { import Qt 4.7 } allows the qmlviewer tool to import the QML elements
+ we will later use. This line must exist for every QML file. Notice that the version
+ of Qt modules is included in the import statement.
+
+ This simple rectangle has a unique identifier, \c simplebutton, which is bound to the
+ id property. The \c Rectangle element's properties are bound to values by listing the
+ property, followed by a colon, then the value. In the code sample, the color \c grey
+ is bound to the the Rectangle's \c color property. Similarly, we bind the \c width
+ and \c height of the Rectangle.
+
+ The \l {Text}{Text} element is a non-editable text field. We name this \c Text element
+ \c buttonLabel. To set the string content of the Text field, we bind a value to the
+ \c text property. The label is contained within the Rectangle and in order to center
+ it in the middle, we assign the \c anchors of the Text element to its parent, which
+ is called \c simplebutton. Anchors may bind to other items' anchors, allowing layout
+ assignments simpler.
+
+ We shall save this code as \c SimpleButton.qml. Running qmlviewer with the file as the
+ argument will display the grey rectangle with a text label.
+
+ \image qml-texteditor1_simplebutton.png
+
+ To implement the button click functionality, we can use QML's event handling. QML's event
+ handling is very similar to \l {Signals & Slots}{Qt's signal and slot} mechanism. Signals
+ are emitted and the connected slot is called.
+
+ \code
+ Rectangle{
+ id:simplebutton
+ ...
+
+ MouseArea{
+ id: buttonMouseArea
+
+ anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors
+ //onClicked handles valid mouse button clicks
+ onClicked: console.log(buttonLabel.text + " clicked" )
+ }
+ }
+ \endcode
+
+ We include a \l{MouseArea} element in our simplebutton. \c MouseArea elements describe
+ the interactive area where mouse movements are detected. For our button, we anchor the
+ whole MouseArea to its parent, which is \c simplebutton. The \c anchors.fill syntax is
+ one way of accessing a specific property called \c fill inside a group of properties
+ called \c anchors. QML uses \l {Anchor-based Layout in QML}{anchor based layouts} where
+ items can anchor to another item, creating robust layouts.
+
+ The \c MouseArea has many signal handlers that are called during mouse movements within
+ the specfied \c MouseArea boundaries. One of them is \c onClicked and it is called
+ whenever the acceptable mouse button is clicked, the left click being the default. We
+ can bind actions to the onClicked handler. In our example, \c console.log() outputs text
+ whenever the mouse area is clicked. The function \c console.log() is a useful tool for
+ debugging purposes and for outputting text.
+
+ The code in \c SimpleButton.qml is sufficient to display a button on the screen and
+ output text whenever it is clicked with a mouse.
+
+ \code
+ Rectangle {
+ id:Button
+ ...
+
+ property color buttonColor: "lightblue"
+ property color onHoverColor: "gold"
+ property color borderColor: "white"
+
+ signal buttonClick()
+ onButtonClick: {
+ console.log(buttonLabel.text + " clicked" )
+ }
+
+ MouseArea{
+ onClicked: buttonClick()
+ hoverEnabled: true
+ onEntered: parent.border.color = onHoverColor
+ onExited: parent.border.color = borderColor
+ }
+
+ //determines the color of the button by using the conditional operator
+ color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
+ }
+ \endcode
+
+ A fully functioning button is in \c Button.qml. The code snippets in this article
+ have some code omitted, denoted by ellipses because they were either introduced
+ earlier in the previous sections or irrelevant to the current code discussion.
+
+ Custom properties are declared using the \c {property type name} syntax. In the
+ code, the property \c buttonColor, of type \c color, is declared and bound to
+ the value \c{"lightblue"}. The \c buttonColor is later used in a conditional
+ operation to determine the buttons's fill color. Note that property value
+ assignment is possible using the \c= equals sign, in addition to value binding
+ using the \c : colon character. Custom properties allow internal items to be
+ accessible outside of the Rectangle's scope. There are basic
+ \l{QML Basic Types}{QML types} such as \c int, \c string, \c real, as well as
+ a type called \c variant.
+
+ By binding the \c onEntered and \c onExited signal handlers to colors, the
+ button's border will turn yellow when the mouse hovers above the button and
+ reverts the color when the mouse exits the mouse area.
+
+ A \c buttonClick() signal is declared in \c Button.qml by placing the \c signal
+ keyword in front of the signal name. All signals have their handlers automatically
+ created, their names starting with \c on. As a result, the \c onButtonClick is
+ \c buttonClick's handler. The \c onButtonClick is then assigned an action to
+ perform. In our button example, the \c onClicked mouse handler will simply call
+ \c onButtonClick, which displays a text. The \c onButtonClick enables outside
+ objects to access the \c {Button}'s mouse area easily. For example, items may
+ have more than one \c MouseArea declarations and a \c buttonClick signal can
+ make the distinction between the several \c MouseArea signal handlers better.
+
+ We now have the basic knowledge to implement items in QML that can handle
+ basic mouse movements. We created a \c Text label inside a \c Rectangle,
+ customized its properties, and implemented behaviors that respond to mouse
+ movements. This idea of creating elements within elements is repeated
+ throughout the text editor application.
+
+ This button is not useful unless used as a component to perform an action.
+ In the next section, we will soon create a menu containing several of these
+ buttons.
+
+ \image qml-texteditor1_button.png
+
+ \section2 Creating a Menu Page
+
+ Up to this stage, we covered how to create elements and assign behaviors inside
+ a single QML file. In this section, we will cover how to import QML elements and how
+ to reuse some of the created components to build other components.
+
+ Menus display the contents of a list, each item having the ability to perform an action.
+ In QML, we can create a menu in several ways. First, we will create a menu containing
+ buttons which will eventually perform different actions. The menu code is in
+ \c FileMenu.qml.
+
+ \code
+ import Qt 4.7 \\import the main Qt QML module
+ import "folderName" \\import the contents of the folder
+ import "script.js" as Script \\import a Javascript file and name it as Script
+ \endcode
+
+ The syntax shown above shows how to use the \c import keyword. This is required to
+ use JavaScript files, or QML files that are not within the same directory. Since
+ \c Button.qml is in the same directory as \c FileMenu.qml, we do not need to import
+ the \c Button.qml file to use it. We can directly create a \c Button element by declaring
+ \c Button{}, similar to a \c Rectangle{} declaration.
+
+ \code
+ In FileMenu.qml:
+
+ Row{
+ anchors.centerIn: parent
+ spacing: parent.width/6
+
+ Button{
+ id: loadButton
+ buttonColor: "lightgrey"
+ label: "Load"
+ }
+ Button{
+ buttonColor: "grey"
+ id: saveButton
+ label: "Save"
+ }
+ Button{
+ id: exitButton
+ label: "Exit"
+ buttonColor: "darkgrey"
+
+ onButtonClick: Qt.quit()
+ }
+ }
+ \endcode
+
+ In \c FileMenu.qml, we declare three \c Button elements. They are declared
+ inside a \l {Row}{Row} element, a positioner that will position its children
+ along a vertical row. The \c Button declaration resides in Button.qml,
+ which is the same as the \c Button.qml we used in the previous section.
+ New property bindings can be declared within the newly created buttons,
+ effectively overwriting the properties set in \c Button.qml. The button
+ called \c exitButton will quit and close the window when it is clicked.
+ Note that the signal handler \c onButtonClick in \c Button.qml will be
+ called in addition to the \c onButtonClick handler in \c exitButton.
+
+ \image qml-texteditor1_filemenu.png
+
+ The \c Row declaration is declared in a \c Rectangle, creating a rectangle
+ container for the row of buttons. This additional rectangle creates an indirect
+ way of organizing the row of buttons inside a menu.
+
+ The declaration of the edit menu is very similar at this stage. The menu has
+ buttons that have the labels: \c Copy, \c Paste, and \c {Select All}.
+
+ \image qml-texteditor1_editmenu.png
+
+ Armed with our knowledge of importing and customizing previously made
+ components, we may now combine these menu pages to create a menu bar,
+ consisting of buttons to select the menu, and look at how we may structure
+ data using QML.
+
+ \section1 Implementing a Menu Bar
+
+ Our text editor application will need a way to display menus using a menu bar.
+ The menu bar will switch the different menus and the user can choose which menu
+ to display. Menu switching implies that the menus need more structure than
+ merely displaying them in a row. QML uses models and views to structure data
+ and display the structured data.
+
+ \section2 Using Data Models and Views
+
+ QML has different \l {Data Models}{data views} that display
+ \l {Data Models}{data models}. Our menu bar will display the menus in a list,
+ with a header that displays a row of menu names. The list of menus are declared
+ inside a \c VisualItemModel. The \l{VisualItemModel}{\c VisualItemModel}
+ element contains items that already have views such as \c Rectangle elements
+ and imported UI elements. Other model types such as the \l{ListModel}{\c ListModel}
+ element need a delegate to display their data.
+
+ We declare two visual items in the \c menuListModel, the \c FileMenu and the
+ \c EditMenu. We customize the two menus and display them using a
+ \l {ListView}{ListView}. The \c MenuBar.qml file contains the QML declarations
+ and a simple edit menu is defined in \c EditMenu.qml.
+
+ \code
+ VisualItemModel{
+ id: menuListModel
+ FileMenu{
+ width: menuListView.width
+ height: menuBar.height
+ color: fileColor
+ }
+ EditMenu{
+ color: editColor
+ width: menuListView.width
+ height: menuBar.height
+ }
+ }
+ \endcode
+
+ The \l {ListView}{ListView} element will display a model according to a delegate.
+ The delegate may declare the model items to display in a \c Row element or display
+ the items in a grid. Our \c menuListModel already has visible items, therefore,
+ we do not need to declare a delegate.
+
+ \code
+ ListView{
+ id: menuListView
+
+ //Anchors are set to react to window anchors
+ anchors.fill:parent
+ anchors.bottom: parent.bottom
+ width:parent.width
+ height: parent.height
+
+ //the model contains the data
+ model: menuListModel
+
+ //control the movement of the menu switching
+ snapMode: ListView.SnapOneItem
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+ flickDeceleration: 5000
+ highlightFollowsCurrentItem: true
+ highlightMoveDuration:240
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ }
+ \endcode
+
+ Additionally, \c ListView inherits from \l{Flickable}{\c Flickable}, making
+ the list respond to mouse drags and other gestures. The last portion of the
+ code above sets \c Flickable properties to create the desired flicking movement
+ to our view. In particular,the property \c highlightMoveDuration changes the
+ duration of the flick transition. A higher \c highlightMoveDuration value
+ results in slower menu switching.
+
+ The \c ListView maintains the model items through an \c index and each visual
+ item in the model is accessible through the \c index, in the order of the
+ declaration. Changing the \c currentIndex effectively changes the highlighted
+ item in the \c ListView. The header of our menu bar exemplify this effect.
+ There are two buttons in a row, both changing the current menu when clicked.
+ The \c fileButton changes the current menu to the file menu when clicked,
+ the \c index being \c 0 because \c FileMenu is declared first in the
+ \c menuListModel. Similarly, the \c editButton will change the current
+ menu to the \c EditMenu when clicked.
+
+ The \c labelList rectangle has \c z value of \c 1, denoting that it is displayed
+ at the front of the menu bar. Items with higher \c z values are displayed in front
+ of items with lower \c z values. The default \c z value is \c 0.
+
+ \code
+ Rectangle{
+ id: labelList
+ ...
+ z: 1
+ Row{
+ anchors.centerIn: parent
+ spacing:40
+ Button{
+ label: "File"
+ id: fileButton
+ ...
+ onButtonClick: menuListView.currentIndex = 0
+ }
+ Button{
+ id: editButton
+ label: "Edit"
+ ...
+ onButtonClick: menuListView.currentIndex = 1
+ }
+ }
+ }
+ \endcode
+
+ The menu bar we just created can be flicked to access the menus or by clicking
+ on the menu names at the top. Switching menu screens feel intuitive and responsive.
+
+ \image qml-texteditor2_menubar.png
+
+ */
+
+ /*!
+ \page qml-textEditor3.html
+ \title Building a Text Editor
+
+ \section1 Declaring a TextArea
+
+ Our text editor is not a text editor if it didn't contain an editable text area.
+ QML's \l {TextEdit}{TextEdit} element allows the declaration of a multi-line
+ editable text area. \l {TextEdit}{TextEdit} is different from a \l {Text}{Text}
+ element, which doesn't allow the user to directly edit the text.
+
+ \code
+ TextEdit{
+ id: textEditor
+ anchors.fill:parent
+ width:parent.width; height:parent.height
+ color:"midnightblue"
+ focus: true
+
+ wrapMode: TextEdit.Wrap
+
+ onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle)
+ }
+ \endcode
+
+ The editor has its font color property set and set to wrap the text. The
+ \c TextEdit area is inside a flickable area that will scroll the text if the
+ text cursor is outside the visible area. The function \c ensureVisible() will
+ check if the cursor rectangle is outside the visible boundaries and move the
+ text area accordingly. QML uses Javascript syntax for its scripts, and as previously
+ mentioned, Javascript files can be imported and used within a QML file.
+
+ \code
+ function ensureVisible(r){
+ if (contentX >= r.x)
+ contentX = r.x;
+ else if (contentX+width <= r.x+r.width)
+ contentX = r.x+r.width-width;
+ if (contentY >= r.y)
+ contentY = r.y;
+ else if (contentY+height <= r.y+r.height)
+ contentY = r.y+r.height-height;
+ }
+ \endcode
+
+ \section1 Combining Components for the Text Editor
+
+ We are now ready to create the layout of our text editor using QML. The text
+ editor has two components, the menu bar we created and the text area. QML allows
+ us to reuse components, therefore making our code simpler, by importing components
+ and customizing when necessary. Our text editor splits the window into two;
+ one-third of the screen is dedicated to the menu bar and two-thirds of the screen
+ displays the text area. The menu bar is displayed in front of any other elements.
+
+ \code
+ Rectangle{
+
+ id: screen
+ width: 1000; height: 1000
+
+ //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar
+ property int partition: height/3
+
+ MenuBar{
+ id:menuBar
+ height: partition
+ width:parent.width
+ z: 1
+ }
+
+ TextArea{
+ id:textArea
+ anchors.bottom:parent.bottom
+ y: partition
+ color: "white"
+ height: partition*2
+ width:parent.width
+ }
+ }
+ \endcode
+
+ By importing reusable components, our \c TextEditor code looks much simpler.
+ We can then customize the main application, without worrying about properties
+ that already have defined behaviors. Using this approach, application layouts
+ and UI components can be created easily.
+
+ \image qml-texteditor3_texteditor.png
+
+ */
+
+ /*!
+ \page qml-textEditor4
+ \title Decorating the Text Editor
+ \section1 Implementing a Drawer Interface
+
+ Our text editor looks simple and we need to decorate it. Using QML, we can declare
+ transitions and animate our text editor. Our menu bar is occupying one-third of the
+ screen and it would be nice to have it only appear when we want it.
+
+ We can add a drawer interface, that will contract or expand the menu bar when clicked.
+ In our implementation, we have a thin rectangle that responds to mouse clicks. The
+ \c drawer, as well as the application, has two sates: the "drawer is open" state and
+ the "drawer is closed" state. The \c drawer item is a strip of rectangle with a small
+ height. There is a nested \l {Image}{Image} element declaring that an arrow icon will
+ be centered inside the drawer. The drawer assigns a state to the whole application,
+ with the identifier \c screen, whenever a user clicks the mouse area.
+
+ \code
+ Rectangle{
+ id:drawer
+ height:15
+
+ Image{
+ id: arrowIcon
+ source: "images/arrow.png"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ MouseArea{
+ id: drawerMouseArea
+ anchors.fill:parent
+ onClicked:{
+ if (screen.state == "DRAWER_CLOSED"){
+ screen.state = "DRAWER_OPEN"
+ }
+ else if (screen.state == "DRAWER_OPEN"){
+ screen.state = "DRAWER_CLOSED"
+ }
+ }
+ ...
+ }
+ }
+ \endcode
+
+ A state is simply a collection of configurations and it is declared in a
+ \l{State}{State} element. A list of states can be listed and bound to the
+ \c states property. In our application, the two states are called
+ \c DRAWER_CLOSED and \c DRAWER_OPEN. Item configurations are declared in
+ \l {PropertyChanges}{PropertyChanges} elements. In the \c DRAWER_OPEN state,
+ there are four items that will receive property changes. The first target,
+ \c menuBar, will change its \c y property to \c 0. Similarly, the \c textArea
+ will lower to a new position when the state is \c DRAWER_OPEN. The \c textArea,
+ the \c drawer, and the drawer's icon will undergo property changes to meet the
+ current state.
+
+ \code
+
+ states:[
+ State{
+ name: "DRAWER_OPEN"
+ PropertyChanges { target: menuBar; y:0}
+ PropertyChanges { target: textArea; y: partition + drawer.height}
+ PropertyChanges { target: drawer; y: partition}
+ PropertyChanges { target: arrowIcon; rotation: 180}
+ },
+ State{
+ name: "DRAWER_CLOSED"
+ PropertyChanges { target: menuBar; y:-partition}
+ PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height}
+ PropertyChanges { target: drawer; y: 0}
+ PropertyChanges { target: arrowIcon; rotation: 0}
+ }
+
+ ]
+
+ \endcode
+
+ State changes are abrupt and needs smoother transitions. Transitions between states
+ are defined using the \l {Transition}{Transition} element, which can then bind to
+ the item's \c transitions property. Our text editor has a state transition whenever
+ the state changes to either \c DRAWER_OPEN or \c DRAWER_CLOSED. Importantly, the
+ transition needs a \c from and a \c to state but for our transitions, we can use
+ the wild card \c * symbol to denote that the transition applies to all state changes.
+
+ During transitions, we can assign animations to the property changes. Our
+ \c menuBar switches position from \c {y:0} to \c {y:-partition} and we can animate
+ this transition using the \l {NumberAnimation}{NumberAnimation} element. We declare
+ that the targets' properties will animate for a certain duration of time and using
+ a certain easing curve. An easing curve controls the animation rates and
+ interpolation behavior during state transitions. The easing curve we chose is
+ \l{PropertyAnimation::easing.type}{Easing.OutQuint}, which slows the movement near
+ the end of the animation. Pleae read \l {qdeclarativeanimation.html}{QML's Animation}
+ article.
+
+ \code
+ transitions: [
+ Transition{
+ to: "*"
+ NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type: Easing.OutQuint }
+ NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutQuint }
+ NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutQuint }
+ }
+ ]
+ \endcode
+
+ Another way of animating property changes is by declaring a \l {Behavior}{Behavior}
+ element. A transition only works during state changes and \c Behavior can set an
+ animation for a general property change. In the text editor, the arrow has a
+ \c NumberAnimation animating its \c rotation property whenever the property changes.
+
+ \code
+ In TextEditor.qml:
+
+ Behavior{
+ NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }
+ }
+ \endcode
+
+ Going back to our components with knowledge of states and animations, we can improve
+ the appearances of the components. In \c Button.qml, we can add \c color and \c scale
+ property changes when the button is clicked. Color types are animated using
+ \l {ColorAnimation}{ColorAnimation} and numbers are animated using
+ \l {NumberAnimation}{NumberAnimation}. The \c {on propertyName} syntax displayed below
+ is helpful when targeting a single property.
+
+ \code
+ In Button.qml:
+ ...
+
+ color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
+ Behavior on color { ColorAnimation{ duration: 55} }
+
+ scale: buttonMouseArea.pressed ? 1.1 : 1.00
+ Behavior on scale { NumberAnimation{ duration: 55} }
+ \endcode
+
+ Additionally, we can enhance the appearances of our QML components by adding color
+ effects such as gradients and opacity effects. Declaring a \l {Gradient}{Gradient}
+ element will override the \c color property of the element. You may declare a color
+ in the gradient using the \l {GradientStop}{GradientStop} element. The gradient is
+ positioned using a scale, between \c 0.0 and \c 1.0.
+
+ \code
+ In MenuBar.qml
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#8C8F8C" }
+ GradientStop { position: 0.17; color: "#6A6D6A" }
+ GradientStop { position: 0.98;color: "#3F3F3F" }
+ GradientStop { position: 1.0; color: "#0e1B20" }
+ }
+ \endcode
+
+ This gradient is used by the menu bar to display a gradient simulating depth.
+ The first color starts at \c 0.0 and the last color is at \c 1.0.
+
+
+ \section2 Where to Go from Here
+
+ We are finished building the user interface of a very simple text editor.
+ Going forward, the user interface is complete, and we can implement the
+ application logic using regular Qt and C++. QML works nicely as a prototyping
+ tool, separating the application logic away from the UI design.
+
+ \image qml-texteditor4_texteditor.png
+
+ \section1 Extending QML using Qt C++
+
+ Now that we have our text editor layout, we may now implement the text editor
+ functionalities in C++. Using QML with C++ enables us to create our application
+ logic using Qt. We can create a QML context in a C++ application using the
+ \l {Using QML in C++ Applications}{Qt's Declarative} classes and display the QML
+ elements using a Graphics Scene. Alternatively, we can export our C++ code into
+ a plugin that the \l {QML Viewer}{qmlviewer} tool can read. For our application,
+ we shall implement the load and save functions in C++ and export it as a plugin.
+ This way, we only need to load the QML file directly instead of running an executable.
+
+ \section2 Exposing C++ Classes to QML
+
+ We will be implementing file loading and saving using Qt and C++. C++ classes
+ and functions can be used in QML by registering them. The class also needs to be
+ compiled as a Qt plugin and the QML file will need to know where the plugin is located.
+
+ For our application, we need to create the following items:
+ \list 1
+ \o \c Directory class that will handle directory related operations
+ \o \c File class which is a QObject, simulating the list of files in a directory
+ \o plugin class that will register the class to the QML context
+ \o Qt project file that will compile the plugin
+ \o A \c qmldir file telling the qmlviewer tool where to find the plugin
+ \endlist
+
+ \section2 Building a Qt Plugin
+
+ To build a plugin, we need to set the following in a Qt project file. First,
+ the necessary sources, headers, and Qt modules need to be added into our
+ project file. All the C++ code and project files are in the \c filedialog
+ directory.
+
+ \code
+ In cppPlugins.pro:
+
+ TEMPLATE = lib
+ CONFIG += qt plugin
+ QT += declarative
+
+ DESTDIR += ../plugins
+ OBJECTS_DIR = tmp
+ MOC_DIR = tmp
+
+ TARGET = FileDialog
+
+ HEADERS += directory.h \
+ file.h \
+ dialogPlugin.h
+
+ SOURCES += directory.cpp \
+ file.cpp \
+ dialogPlugin.cpp
+ \endcode
+
+ In particular, we compile Qt with the \c declarative module and configure it as a
+ \c plugin, needing a \c lib template. We shall put the compiled plugin into the
+ parent's \c plugins directory.
+
+
+ \section2 Registering a Class into QML
+
+ \code
+ In dialogPlugin.h:
+
+ #include <QtDeclarative/QDeclarativeExtensionPlugin>
+
+ class DialogPlugin : public QDeclarativeExtensionPlugin
+ {
+ Q_OBJECT
+
+ public:
+ void registerTypes(const char *uri);
+
+ };
+
+ \endcode
+
+ Our plugin class, \c DialogPlugin is a subclass of \l{QDeclarativeExtensionPlugin}.
+ We need to implement the inherited function, \l {QDeclarativeExtensionPlugin::}{registerTypes()}.
+ The \c dialogPlugin.cpp file looks like this:
+
+ \code
+ DialogPlugin.cpp:
+
+ #include "dialogPlugin.h"
+ #include "directory.h"
+ #include "file.h"
+ #include <QtDeclarative/qdeclarative.h>
+
+ void DialogPlugin::registerTypes(const char *uri){
+
+ qmlRegisterType<Directory>(uri, 1, 0, "Directory");
+ qmlRegisterType<File>(uri, 1, 0,"File");
+ }
+
+ Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin);
+ \endcode
+
+ The \l{QDeclarativeExtensionPlugin::}{registerTypes()} function registers
+ our File and Directory classes into QML. This function needs the class name
+ for its template, a major version number, a minor version number, and a name
+ for our classes.
+
+ We need to export the plugin using the \l {Q_EXPORT_PLUGIN2}{Q_EXPORT_PLUGIN2}
+ macro. Note that in our \c dialogPlugin.h file, we have the \l {Q_OBJECT}{Q_OBJECT}
+ macro at the top of our class. As well, we need to run \c qmake on the project
+ file to generate the necessary meta-object code.
+
+
+ \section2 Creating QML Properties in a C++ class
+
+ We can create QML elements and properties using C++ and
+ \l {The Meta-Object System}{Qt's Meta-Object System}. We can implement
+ properties using slots and signals, making Qt aware of these properties.
+ These properties can then be used in QML.
+
+ For the text editor, we need to be able to load and save files. Typically,
+ these features are contained in a file dialog. Fortunately, we can use
+ \l {QDir}{QDir}, \l {QFile}{QFile}, and \l {QTextStream}{QTextStream} to
+ implement directory reading and input/output streams.
+
+ \code
+ class Directory : public QObject{
+
+ Q_OBJECT
+
+ Q_PROPERTY(int filesCount READ filesCount CONSTANT)
+ Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
+ Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged)
+ Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT )
+
+ ...
+ \endcode
+
+ The \c Directory class uses Qt's Meta-Object System to register properties it
+ needs to accomplish file handling. The \c Directory class is exported as a plugin
+ and is useable in QML as the \c Directory element. Each of the listed properties
+ using the \l {Q_PROPERTY()}{Q_PROPERTY} macro is a QML property.
+
+ The \l {Q_PROPERTY()} {Q_PROPERTY} declares a property as well as its read and
+ write functions into Qt's Meta-Object System. For example, the \c filename
+ property, of type \l {QString}{QString}, is readable using the \c filename()
+ function and writable using the function \c setFilename(). Additionally, there
+ is a signal associated to the filename property called \c filenameChanged(),
+ which is emitted whenever the property changes. The read and write functions
+ are declared as \c public in the header file.
+
+ Similarly, we have the other properties declared according to their uses. The
+ \c filesCount property indicates the number of files in a directory. The filename
+ property is set to the currently selected file's name and the loaded/saved file
+ content is stored in \c fileContent property.
+
+ \code
+ Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT )
+ \endcode
+
+ The \c files list property is a list of all the filtered files in a directory.
+ The \c Directory class is implemented to filter out invalid text files; only
+ files with a \c .txt extension are valid. Further, \l {QLists}{QLists} can be
+ used in QML files by declaring them as a \c QDeclarativeListProperty in C++.
+ The templated object needs to inherit from a \l {QObject}{QObject}, therefore,
+ the \c File class must also inherit from \c QObject. In the \c Directory class,
+ the list of \c File objects is stored in a \c QList called \c m_fileList.
+
+ \code
+ class File : public QObject{
+
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+
+ ...
+ };
+ \endcode
+
+ The properties can then be used in QML as part of the \c Directory element's
+ properties. Note that we do not have to create an identifier \c id property
+ in our C++ code.
+
+ \code
+ Directory{
+ id: directory
+
+ filesCount
+ filename
+ fileContent
+ files
+
+ files[0].name
+ }
+
+ \endcode
+
+ Because QML uses Javascript's syntax and structure, we can iterate through
+ the list of files and retrieve its properties. To retrieve the first file's
+ name property, we can call \c { files[0].name }.
+
+ Regular C++ functions are also accessible from QML. The file loading and saving
+ functions are implemented in C++ and declared using the
+ \l {Q_INVOKABLE}{Q_INVOKABLE} macro. Alternatively, we can declare the functions
+ as a \c slot and the functions will be accessible from QML.
+
+ \code
+ In Directory.h:
+
+ Q_INVOKABLE void saveFile();
+ Q_INVOKABLE void loadFile();
+ \endcode
+
+ The \c Directory class also has to notify other objects whenever the directory
+ contents change. This feature is performed using a \c signal. As previously
+ mentioned, QML signals have a corresponding handler with their names prepended
+ with \c on. The signal is called \c directoryChanged and it is emitted whenever
+ there is a directory refresh. The refresh simply reloads the directory contents
+ and updates the list of valid files in the directory. QML items can then be
+ notified by attaching an action to the \c onDirectoryChanged signal handler.
+
+ The \c list properties need to be explored further. This is because list
+ properties use callbacks to access and modify the list contents. The list
+ property is of type \c QDeclarativeListProperty<File>. Whenever the list
+ is accessed, the accessor function needs to return a
+ \c QDeclarativeListProperty<File>. The template type, \c File, needs to be a
+ \c QObject derivative. Further, to create the
+ \l {QDeclarativeListProperty}{QDeclarativeListProperty}, the list's accessor
+ and modifiers need to be passed to the consructor as function pointers. The list,
+ a \c QList in our case, also needs to be a list of \c File pointers.
+
+ The constructor of \l {QDeclarativeListProperty}{QDeclarativeListProperty}
+ constructor and the \c Directory implementation:
+ \code
+ QDeclarativeListProperty ( QObject * object, void * data, AppendFunction append, CountFunction count = 0, AtFunction at = 0, ClearFunction clear = 0 )
+ QDeclarativeListProperty<File>( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr );
+ \endcode
+
+ The constructor passes pointers to functions that will append the list, count
+ the list, retrieve the item using an index, and empty the list. Only the append
+ function is mandatory. Note that the function pointers must match the definition
+ of \l {QDeclarativeListProperty::AppendFunction}{AppendFunction},
+ \l {QDeclarativeListProperty::CountFunction}{CountFunction},
+ \l {QDeclarativeListProperty::AtFunction}{AtFunction}, or
+ \l {QDeclarativeListProperty::ClearFunction}{ClearFunction}.
+
+ \code
+ void appendFiles(QDeclarativeListProperty<File> * property, File * file)
+ File* fileAt(QDeclarativeListProperty<File> * property, int index)
+ int filesSize(QDeclarativeListProperty<File> * property)
+ void clearFilesPtr(QDeclarativeListProperty<File> *property)
+ \endcode
+
+ To simplify our file dialog, the \c Directory class filters out invalid text
+ files, which are files that do not have a \c .txt extension. If a file name
+ doesn't have the \c .txt extension, then it won't be seen in our file dialog.
+ Also, the implementation makes sure that saved files have a \c .txt extension in
+ the file name. \c Directory uses \l {QTextStream}{QTextStream} to read the file
+ and to output the file contents to a file.
+
+ With our \c Directory element, we can retrieve the files as a list, know how many
+ text files is in the application directory, get the file's name and content as a
+ string, and be notified whenever there are changes in the directory contents.
+
+ To build the plugin, run \c qmake on the \c cppPlugins.pro project file, then run
+ \c make to build and transfer the plugin to the \c plugins directory.
+
+
+ \section2 Importing a Plugin in QML
+
+ The qmlviewer tool imports files that are in the same directory as the
+ application. We can also create a \c qmldir file containing the locations of
+ QML files we wish to import. The \c qmldir file can also store locations of
+ plugins and other resources.
+
+ \code
+ In qmldir:
+
+ Button ./Button.qml
+ FileDialog ./FileDialog.qml
+ TextArea ./TextArea.qml
+ TextEditor ./TextEditor.qml
+ EditMenu ./EditMenu.qml
+
+ plugin FileDialog plugins
+ \endcode
+
+ The plugin we just created is called \c FileDialog, as indicated by the
+ \c TARGET field in the project file. The compiled plugin is in the \c plugins directory.
+
+
+ \section2 Integrating a File Dialog into the File Menu
+
+ Our \c FileMenu needs to display the \c FileDialog element, containing a list of
+ the text files in a directory thus allowing the user to select the file by
+ clicking on the list. We also need to assign the save, load, and new buttons
+ to their respective actions. The FileMenu contains an editable text input to
+ allow the user to type a file name using the keyboard.
+
+ The \c Directory element is used in the \c FileMenu.qml file and it notifies the
+ \c FileDialog element that the directory refreshed its contents. This notification
+ is performed in the signal handler, \c onDirectoryChanged.
+
+ \code
+ In FileMenu.qml:
+
+ Directory{
+ id:directory
+ filename: textInput.text
+ onDirectoryChanged: fileDialog.notifyRefresh()
+ }
+ \endcode
+
+ Keeping with the simplicity of our application, the file dialog will always be
+ visible and will not display invalid text files, which do not have a \c .txt
+ extension to their filenames.
+
+ \code
+ In FileDialog.qml:
+
+ signal notifyRefresh()
+ onNotifyRefresh: dirView.model = directory.files
+ \endcode
+
+ The \c FileDialog element will display the contents of a directory by reading its
+ list property called \c files. The files are used as the model of a
+ \l {GridView}{GridView} element, which displays data items in a grid according
+ to a delegate. The delegate handles the appearance of the model and our file
+ dialog will simply create a grid with text centered in the middle. Clicking on
+ the file name will result in the appearance of a rectangle to highlight the file
+ name. The \c FileDialog is notified whenever the \c notifyRefresh signal is emitted,
+ reloading the files in the directory.
+
+ \code
+ In FileMenu.qml:
+
+ Button{
+ id: newButton
+ label: "New"
+ onButtonClick:{
+ textArea.textContent = ""
+ }
+ }
+ Button{
+ id: loadButton
+ label: "Load"
+ onButtonClick:{
+ directory.filename = textInput.text
+ directory.loadFile()
+ textArea.textContent = directory.fileContent
+ }
+ }
+ Button{
+ id: saveButton
+ label: "Save"
+ onButtonClick:{
+ directory.fileContent = textArea.textContent
+ directory.filename = textInput.text
+ directory.saveFile()
+ }
+ }
+ Button{
+ id: exitButton
+ label: "Exit"
+ onButtonClick:{
+ Qt.quit()
+ }
+ }
+ \endcode
+
+ Our \c FileMenu can now connect to their respective actions. The \c saveButton
+ will transfer the text from the \c TextEdit onto the directory's \c fileContent
+ property, then copy its file name from the editable text input. Finally, the button
+ calls the \c saveFile() function, saving the file. The \c sloadButton has a similar
+ execution. Also, the \c New action will empty the contents of the \c TextEdit.
+
+ Further, the \c EditMenu buttons are connected to the \c TextEdit functions to copy,
+ paste, and select all the text in the text editor.
+
+ \image qml-texteditor5_filemenu.png
+
+ \section1 Text Editor Completion
+
+ \image qml-texteditor5_newfile.png
+
+ The application can function as a simple text editor, able to accept text
+ and save the text into a file. The text editor can also load from a file and
+ perform text manipulation.
+*/
diff --git a/doc/src/getting-started/gettingstartedqt.qdoc b/doc/src/getting-started/gettingstartedqt.qdoc
index 1b3770f..25d0ccd 100644
--- a/doc/src/getting-started/gettingstartedqt.qdoc
+++ b/doc/src/getting-started/gettingstartedqt.qdoc
@@ -28,8 +28,8 @@
/*!
\page gettingstartedqt.html
- \title Getting Started programming with Qt
- \ingroup gettingStarted
+ \title Getting Started Programming with Qt
+ \ingroup gettingStarted
Welcome to the world of Qt--the cross-platform GUI toolkit. In
this getting started guide, we teach basic Qt knowledge by
@@ -85,7 +85,7 @@
other widgets), it is possible to show a single widget in its own
window. Widgets are not visible by default; the function
\l{QWidget::}{show()} makes the widget visible.
-
+
Line 11 makes the QApplication enter its event loop. When a Qt
application is running, events are generated and sent to the
widgets of the application. Examples of events are mouse presses
diff --git a/doc/src/howtos/openvg.qdoc b/doc/src/howtos/openvg.qdoc
index cabd8f7..dc7a34a 100644
--- a/doc/src/howtos/openvg.qdoc
+++ b/doc/src/howtos/openvg.qdoc
@@ -30,6 +30,8 @@
\title OpenVG Rendering in Qt
\since 4.6
\ingroup best-practices
+ \ingroup technology-apis
+
\brief Efficient rendering on embedded devices with OpenVG
diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc
index 38586ef..e45892f 100644
--- a/doc/src/index.qdoc
+++ b/doc/src/index.qdoc
@@ -52,35 +52,33 @@
</div>
<div class="indexbox api">
<div class="heading">
- Qt API Overviews</div>
+ Qt API</div>
<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="classes.html">All Classes</a></li>
+ <li><a href="functions.html">All Functions</a></li>
+ <li><a href="modules.html">All Modules</a></li>
+ <li><a href="namespaces.html">All Namespaces</a></li>
<li><a href="qtglobal.html">Global Declarations</a></li>
+ <li><a href="licensing.html">Licenses and Credits</a></li>
</ul>
</div>
<div class="sectionlist tricol">
<ul>
- <li><a href="qt-basic-concepts.html">Basic Qt Architecture</a></li>
- <li><a href="qt-gui-concepts.html">UI Components</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>
+ <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>
+ <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>
+ <li><a href="developing-with-qt.html">Cross-platform and Platform-specific</a></li>
+ <li><a href="technology-apis.html">Qt and Key Technologies</a></li>
+ <li><a href="best-practices.html">Best Practices Guides</a></li>
+ </ul>
</div>
<div class="sectionlist">
<ul>
<li><a href="qtquick.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="model-view-programming.html">Model/View Programming</a></li>
- <li><a href="qt-network.html">Network Programming</a></li>
- <li><a href="qt-graphics.html">Graphics and Printing</a></li>
+ <li><a href="qdeclarativeexamples.html">QML Examples and Demos</a></li>
</ul>
</div>
</div>
@@ -102,13 +100,12 @@
<li><a href="assistant-manual.html">Qt Assistant</a></li>
<li><a href="qmake-manual.html">Qt qmake</a></li>
<li><a href="http://doc.qt.nokia.com/qtsimulator-1.0/simulator-description.html">Qt Simulator</a></li>
- <li><a href="http://qt.nokia.com/developer/eclipse-integration">Integration</a> and <a href="http://qt.nokia.com/products/appdev">add-ins</a></li>
+ <li><a href="http://qt.nokia.com/developer/eclipse-integration">Eclipse Integration</a></li>
+ <li><a href="http://qt.nokia.com/products/appdev">Add-On Products and Services</a></li>
<li><a href="qvfb.html">Virtual Framebuffer</a></li>
</ul>
</div>
</div>
</div>
\endraw
-
-
*/
diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc
index 5d9c819..8b6e337 100644
--- a/doc/src/internationalization/i18n.qdoc
+++ b/doc/src/internationalization/i18n.qdoc
@@ -39,6 +39,8 @@
\brief Information about Qt's support for internationalization and multiple languages.
\nextpage Writing Source Code for Translation
+ \ingroup qt-basic-concepts
+
\keyword internationalization
\keyword i18n
diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc
index 8912490..d3c33d9 100644
--- a/doc/src/modules.qdoc
+++ b/doc/src/modules.qdoc
@@ -152,6 +152,7 @@
\module QtOpenGL
\title QtOpenGL Module
\ingroup modules
+ \ingroup technology-apis
\brief The QtOpenGL module offers classes that make it easy to
use OpenGL in Qt applications.
@@ -202,6 +203,7 @@
\title QtOpenVG Module
\since 4.6
\ingroup modules
+ \ingroup technology-apis
\brief The QtOpenVG module is a plugin that provides support for
OpenVG painting.
@@ -352,6 +354,8 @@
\title QtSvg Module
\since 4.1
\ingroup modules
+ \ingroup technology-apis
+ \ingroup best-practices
\brief The QtSvg module provides classes for displaying and creating SVG files.
@@ -400,6 +404,7 @@
\module QtXml
\title QtXml Module
\ingroup modules
+ \ingroup technology-apis
\brief The QtXml module provides a stream reader and writer for
XML documents, and C++ implementations of SAX and DOM.
@@ -424,6 +429,7 @@
\title QtXmlPatterns Module
\since 4.4
\ingroup modules
+ \ingroup technology-apis
\brief The QtXmlPatterns module provides support for XPath,
XQuery, XSLT and XML Schema validation.
diff --git a/doc/src/objectmodel/properties.qdoc b/doc/src/objectmodel/properties.qdoc
index dca332e..3a8e3b4 100644
--- a/doc/src/objectmodel/properties.qdoc
+++ b/doc/src/objectmodel/properties.qdoc
@@ -79,10 +79,9 @@
mean \e {reset to the context specific cursor}. The \c RESET
function must return void and take no parameters.
- \o A \c NOTIFY signal is optional. If defined, the signal will be
- emitted whenever the value of the property changes. The signal must
- take one parameter, which must be of the same type as the property; the
- parameter will take the new value of the property.
+ \o A \c NOTIFY signal is optional. If defined, it should specify one
+ existing signal in that class that is emitted whenever the value
+ of the property changes.
\o The \c DESIGNABLE attribute indicates whether the property
should be visible in the property editor of GUI design tool (e.g.,
diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc
index 1c35a63..2dd44f6 100644
--- a/doc/src/overviews.qdoc
+++ b/doc/src/overviews.qdoc
@@ -35,21 +35,21 @@
/*!
\group qt-basic-concepts
- \title Basic Qt Architecture
+ \title Programming with Qt
\brief The basic architecture of the Qt cross-platform application and UI framework.
Qt is a cross-platform application and UI framework for writing
web-enabled applications for desktop, mobile, and embedded
- operating systems. These pages explain basic architectural
- concepts of Qt:
-
+ operating systems. This page contains links to articles and overviews
+ explaining key components and techniuqes used in Qt development.
+
\generatelist {related}
*/
/*!
\group qt-gui-concepts
- \title Qt Desktop UI Components
+ \title UI Design with Qt
\brief The Qt components for constructing native look & feel desktop UI's.
@@ -62,6 +62,7 @@
/*!
\group qt-graphics
+ \ingroup qt-basic-concepts
\title Qt Graphics and Printing
\brief The Qt components for doing graphics.
@@ -71,6 +72,7 @@
/*!
\group qt-network
+ \ingroup qt-basic-concepts
\title Network programming with Qt
\brief The these pages are about Qt's support for network programming.
@@ -80,7 +82,7 @@
/*!
\group technology-apis
- \title Qt API's for other technologies
+ \title Qt and Key Technologies
These pages document Qt's API's for some widely-used standards and
technologies.
@@ -91,6 +93,7 @@
/*!
\group qt-activex
\title ActiveX in Qt
+ \ingroup qt-basic-concepts
\ingroup technology-apis
\ingroup platform-specific
@@ -108,6 +111,8 @@
\brief Qt API's for using SQL.
\ingroup technology-apis
\ingroup best-practices
+ \ingroup qt-basic-concepts
+
These pages document Qt's API's for using SQL database systems
in Qt applications.
@@ -117,7 +122,7 @@
/*!
\group best-practices
- \title How-To's and Best Practices
+ \title Best Practices Guides
\brief How-To Guides and Best Practices
@@ -128,3 +133,16 @@
\generatelist{related}
*/
+/*!
+
+ \group licensing
+ \title Qt Licenses and Credits
+
+ \brief About the licenses used for Qt, and some credits to our contributors.
+
+ This page contains information on the different licenses Qt is shipped with,
+ and credits to some of our many contributers.
+
+ \generatelist {related}
+
+*/
diff --git a/doc/src/painting-and-printing/paintsystem.qdoc b/doc/src/painting-and-printing/paintsystem.qdoc
index 4c6fd91..deb9c8b 100644
--- a/doc/src/painting-and-printing/paintsystem.qdoc
+++ b/doc/src/painting-and-printing/paintsystem.qdoc
@@ -50,6 +50,8 @@
\brief A system for painting on the screen or on print devices using the same API
\ingroup qt-graphics
\ingroup frameworks-technologies
+ \ingroup qt-basic-concepts
+
Qt's paint system enables painting on screen and print devices
using the same API, and is primarily based on the QPainter,
diff --git a/doc/src/porting/qt4-mainwindow.qdoc b/doc/src/porting/qt4-mainwindow.qdoc
index 7d2a400..b160d63 100644
--- a/doc/src/porting/qt4-mainwindow.qdoc
+++ b/doc/src/porting/qt4-mainwindow.qdoc
@@ -28,7 +28,12 @@
/*!
\page qt4-mainwindow.html
\title The Qt 4 Main Window Classes
+ \ingroup qt-basic-concepts
+
+ \brief Overview of the Main Window concept and Classes
+
+
\contentspage {What's New in Qt 4}{Home}
\previouspage The Scribe Classes
\nextpage The New Qt Designer
diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc
index 88ef2a8..a88b326 100644
--- a/doc/src/qt4-intro.qdoc
+++ b/doc/src/qt4-intro.qdoc
@@ -455,10 +455,10 @@
\image quick_screens.png
- Qt 4.7 introduces Quick, the Qt UI Creation Kit. that enables the creation
- of dynamic user interfaces, easier and more effective than possible
- with existing UI technologies. This UI Creation Kit consist of three
- technologies:
+ Qt 4.7 introduces \l{Qt Quick}, the Qt UI Creation Kit. that enables
+ the creation of dynamic user interfaces, easier and more effective
+ than possible with existing UI technologies. This UI Creation Kit
+ consists of three technologies:
\list
\i QML is a declarative language oriented on JavaScript that utilizes
diff --git a/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp b/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp
index 8f74461..cea6553 100644
--- a/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp
+++ b/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp
@@ -73,16 +73,14 @@ QFuture<QString> future = QtConcurrent::run(someFunction, bytearray);
QString result = future.result();
//! [3]
-
//! [4]
-// call 'QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const' in a separate thread
-QString string = ...;
-QFuture<QStringList> future = QtConcurrent::run(string, &QString::split, QString(", "), QString::KeepEmptyParts, Qt::CaseSensitive);
+// call 'QList<QByteArray> QByteArray::split(char sep) const' in a separate thread
+QByteArray bytearray = "hello world;
+QFuture<QList<QByteArray> > future = QtConcurrent::run(bytearray, &QByteArray::split), ',');
...
-QStringList result = future.result();
+QList<QByteArray> result = future.result();
//! [4]
-
//! [5]
// call 'void QImage::invertPixels(InvertMode mode)' in a separate thread
QImage image = ...;
diff --git a/doc/src/snippets/declarative/loader/KeyReader.qml b/doc/src/snippets/declarative/loader/KeyReader.qml
new file mode 100644
index 0000000..4423ac6
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/KeyReader.qml
@@ -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 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
+
+Item {
+ Item {
+ focus: true
+ Keys.onPressed: {
+ console.log("Loaded item captured:", event.text);
+ event.accepted = true;
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/loader/MyItem.qml b/doc/src/snippets/declarative/loader/MyItem.qml
new file mode 100644
index 0000000..cc69661
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/MyItem.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** 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: myItem
+ signal message(string msg)
+
+ width: 100; height: 100
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myItem.message("clicked!")
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/loader/connections.qml b/doc/src/snippets/declarative/loader/connections.qml
new file mode 100644
index 0000000..babac4e
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/connections.qml
@@ -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 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
+
+Item {
+ width: 100; height: 100
+
+ Loader {
+ id: myLoader
+ source: "MyItem.qml"
+ }
+
+ Connections {
+ target: myLoader.item
+ onMessage: console.log(msg)
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/loader/focus.qml b/doc/src/snippets/declarative/loader/focus.qml
new file mode 100644
index 0000000..464d986
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/focus.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$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Rectangle {
+ width: 200; height: 200
+
+ Loader {
+ id: loader
+ focus: true
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: loader.source = "KeyReader.qml"
+ }
+
+ Keys.onPressed: {
+ console.log("Captured:", event.text);
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/loader/simple.qml b/doc/src/snippets/declarative/loader/simple.qml
new file mode 100644
index 0000000..e0dc6b3
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/simple.qml
@@ -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 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
+
+Item {
+ width: 200; height: 200
+
+ Loader { id: pageLoader }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: pageLoader.source = "Page1.qml"
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/propertyaction.qml b/doc/src/snippets/declarative/propertyaction.qml
new file mode 100644
index 0000000..1a15469
--- /dev/null
+++ b/doc/src/snippets/declarative/propertyaction.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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]
+Item {
+ width: 400; height: 400
+
+ Rectangle {
+ id: rect
+ width: 200; height: 100
+ color: "red"
+
+ states: State {
+ name: "rotated"
+ PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight }
+ }
+
+ transitions: Transition {
+ RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: rect.state = "rotated"
+ }
+ }
+}
+//![transition]
+
+Item {
+ width: 300; height: 300
+
+ Image { id: img; source: "pics/qt.png" }
+
+//![standalone]
+SequentialAnimation {
+ PropertyAction { target: img; property: "smooth"; value: "true" }
+ NumberAnimation { target: img; property: "width"; to: 300; duration: 1000 }
+ PropertyAction { target: img; property: "smooth"; value: "false" }
+}
+//![standalone]
+}
+
+}
+
diff --git a/doc/src/snippets/declarative/propertychanges.qml b/doc/src/snippets/declarative/propertychanges.qml
new file mode 100644
index 0000000..9f119bf
--- /dev/null
+++ b/doc/src/snippets/declarative/propertychanges.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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]
+import Qt 4.7
+//![import]
+
+Column {
+
+//![0]
+Item {
+ id: container
+ width: 300; height: 300
+
+ Rectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ states: State {
+ name: "resized"; when: mouseArea.pressed
+ PropertyChanges { target: rect; color: "blue"; height: container.height }
+ }
+ }
+}
+//![0]
+
+//![reset]
+Rectangle {
+ width: 300; height: 200
+
+ Text {
+ id: myText
+ width: 50
+ wrapMode: Text.WordWrap
+ text: "a text string that is longer than 50 pixels"
+
+ states: State {
+ name: "widerText"
+ PropertyChanges { target: myText; width: undefined }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myText.state = "widerText"
+ }
+}
+//![reset]
+}
diff --git a/doc/src/snippets/declarative/rotationanimation.qml b/doc/src/snippets/declarative/rotationanimation.qml
index c81395a..b56cb3f 100644
--- a/doc/src/snippets/declarative/rotationanimation.qml
+++ b/doc/src/snippets/declarative/rotationanimation.qml
@@ -52,7 +52,8 @@ Item {
smooth: true
states: State {
- name: "rotated"; PropertyChanges { target: rect; rotation: 180 }
+ name: "rotated"
+ PropertyChanges { target: rect; rotation: 180 }
}
transitions: Transition {
diff --git a/doc/src/template/style/narrow.css b/doc/src/template/style/narrow.css
index e4ad135..de5b0a0 100644
--- a/doc/src/template/style/narrow.css
+++ b/doc/src/template/style/narrow.css
@@ -54,7 +54,7 @@
.narrow .header .qtref a
{
- color: #363534;
+ color: #00732F;
}
.narrow .header .qtref span
@@ -103,7 +103,7 @@
}
.narrow .header #shortCut ul li a
{
- color: #44a51c;
+ color: #00732F;
}
.narrow .wrapper .hd
@@ -203,6 +203,9 @@
*border: 1px solid #fff;
*height: 17px;
_height: 18px;
+ /* to be fixed */
+ display: none;
+ /* to be fixed */
}
.narrow .indexbox .indexIcon {
diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css
index 6a32e53..9afff03 100755
--- a/doc/src/template/style/style.css
+++ b/doc/src/template/style/style.css
@@ -388,9 +388,9 @@
.shortCut-topleft-inactive
{
padding-left: 3px;
+ padding-right: 3px;
background: transparent url( ../images/sprites-combined.png) no-repeat 0px -58px;
height: 20px;
- width: 47px;
}
.shortCut-topleft-inactive span
{
@@ -1283,43 +1283,6 @@
-/* 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
- {
- }
-
- .offline .wrap .content
- {
- padding-top: 15px;
- }
-
-
-/* end of offline spec*/
-
/* start of creator spec*/
.creator
{
@@ -1339,9 +1302,9 @@
.creator #feedbackBox,
.creator #feedback,
.creator #blurpage,
- .creator .indexbox .indexIcon span,
+ /*.creator .indexbox .indexIcon span,*/
.creator .wrapper .hd,
- .creator .indexbox .indexIcon,
+/* .creator .indexbox .indexIcon,*/
.creator .header #nav-logo,
.creator #offlinemenu,
.creator #offlinesearch,
@@ -1558,6 +1521,10 @@
.creator .toc {
margin:10px 20px 10px 10px;
}
+
+ .creator #narrowsearch, .creator #narrowmenu{
+ display:none;
+ }
/* end of creator spec*/
}
diff --git a/doc/src/widgets-and-layouts/layout.qdoc b/doc/src/widgets-and-layouts/layout.qdoc
index d2687ea..32dddd7 100644
--- a/doc/src/widgets-and-layouts/layout.qdoc
+++ b/doc/src/widgets-and-layouts/layout.qdoc
@@ -33,6 +33,7 @@
/*!
\page layout.html
\title Layout Management
+ \ingroup qt-basic-concepts
\ingroup qt-gui-concepts
\brief A tour of the standard layout managers and an introduction to custom
layouts.
diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc
index 5c72570..cc36fa2 100644
--- a/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -31,6 +31,7 @@
\brief How to use style sheets to customize the appearance of widgets.
\ingroup frameworks-technologies
+ \ingroup qt-basic-concepts
\previouspage {Styles and Style Aware Widgets}{Styles}
\contentspage Widgets and Layouts
diff --git a/doc/src/xml-processing/xquery-introduction.qdoc b/doc/src/xml-processing/xquery-introduction.qdoc
index b79c205..b5356f7 100644
--- a/doc/src/xml-processing/xquery-introduction.qdoc
+++ b/doc/src/xml-processing/xquery-introduction.qdoc
@@ -29,6 +29,7 @@
\page xquery-introduction.html
\title A Short Path to XQuery
+\pagekeywords XPath XQuery
\startpage XQuery
\target XQuery-introduction
diff --git a/doc/src/zh_CN/bughowto.qdoc b/doc/src/zh_CN/bughowto.qdoc
new file mode 100644
index 0000000..05c8403
--- /dev/null
+++ b/doc/src/zh_CN/bughowto.qdoc
@@ -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 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 bughowto.html
+ \title 如何报告 Bug
+ \brief 关于报告 Qt 中 bug 方法的信æ¯ã€‚
+
+ 如果您认为您已ç»å‘现了 Qt 的一个 bug,我们éžå¸¸é«˜å…´å¬åˆ°è¿™ä¸ªæ¶ˆæ¯ï¼Œå› ä¸ºåœ¨æ­¤ä¹‹åŽæˆ‘们å¯ä»¥ä¿®å¤å®ƒã€‚
+
+ 在报告 bug 之å‰ï¼Œè¯·æ£€æŸ¥ Qt 网站中的 \l{FAQs}{FAQ}ã€\l{Platform Notes}{å¹³å°å¤‡æ³¨}å’Œ \l{Qt Bug Tracker}{Qt Bug 跟踪器}确认这个问题是å¦å·²çŸ¥ã€‚
+
+ 如果您还没有 \l{Qt Bug Tracker}{Qt Bug 跟踪器}çš„å¸å·ï¼Œæ‚¨è¦åšçš„第一件事情就是注册一个。一旦您完æˆäº†è¿™ä¸€æ­¥ï¼Œæ‚¨å°±å¯ä»¥æ交并且跟踪您的 bug 报告,而且在您æ交之åŽï¼Œå…¬ä¼—å°±å¯ä»¥çœ‹åˆ°å®ƒä»¬ã€‚
+
+ 请在您的 bug 报告中包å«ä»¥ä¸‹ä¿¡æ¯ï¼š
+
+ \list 1
+ \o 您的编译器的å称和版本å·
+ \o 您的æ“作系统的å称和版本å·
+ \o 您所使用的 Qt 的版本å·ï¼Œä»¥åŠå®ƒåœ¨è¢«ç¼–译的时候所使用的é…置选项
+ \o 关于如何é‡å¤è¿™ä¸ªé—®é¢˜çš„å¯é å¹¶ä¸”清晰的æè¿°
+ \endlist
+
+ 如果å¯èƒ½ï¼Œè¯·æ供一个使用 QtTest 模å—编写的测试程åºï¼Œå› ä¸ºè¿™æ ·åšå¯ä»¥åŠ å¿«æˆ‘们é‡çŽ°æ‚¨çš„这个问题的进程,并且å¯ä»¥è®©å¼€å‘人员更有效率的确认这个问题。
+
+ å¦å¤–,如果您的问题åªæ˜¯åœ¨è¿è¡Œæ—¶å¯è§ï¼Œè¯·å°½é‡åˆ›å»ºä¸€ä¸ªå¯ä»¥è¿è¡Œå¹¶ä¸”显示这个问题的å°æµ‹è¯•ç¨‹åºã€‚通常,您å¯ä»¥åœ¨ä¼—多 Qt 实例中选择一个进行少é‡ä¿®æ”¹å°±å¯ä»¥å®žçŽ°è¿™ä¸€ç›®çš„。
+
+ 如果您已ç»å®žçŽ°äº†ä¸€ä¸ª bug ä¿®å¤å¹¶ä¸”希望直接贡献这个修å¤ï¼Œé‚£ä¹ˆæ‚¨éœ€è¦é€šè¿‡\l{Public Qt Repository}{公共 Qt 代ç ä»“库}æ¥å®žçŽ°ã€‚
+*/
diff --git a/examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.cpp b/examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.cpp
new file mode 100644
index 0000000..801c7ba
--- /dev/null
+++ b/examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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 "birthdayparty.h"
+
+BirthdayParty::BirthdayParty(QObject *parent)
+: QObject(parent), m_host(0)
+{
+}
+
+// ![0]
+Person *BirthdayParty::host() const
+{
+ return m_host;
+}
+
+void BirthdayParty::setHost(Person *c)
+{
+ m_host = c;
+}
+
+QDeclarativeListProperty<Person> BirthdayParty::guests()
+{
+ return QDeclarativeListProperty<Person>(this, m_guests);
+}
+
+int BirthdayParty::guestCount() const
+{
+ return m_guests.count();
+}
+
+Person *BirthdayParty::guest(int index) const
+{
+ return m_guests.at(index);
+}
+
+void BirthdayParty::invite(const QString &name)
+{
+ Person *person = new Person(this);
+ person->setName(name);
+ m_guests.append(person);
+}
+// ![0]
+
diff --git a/examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.h b/examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.h
new file mode 100644
index 0000000..b89a30e
--- /dev/null
+++ b/examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** 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 BIRTHDAYPARTY_H
+#define BIRTHDAYPARTY_H
+
+#include <QObject>
+#include <QDeclarativeListProperty>
+#include "person.h"
+
+class BirthdayParty : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(Person *host READ host WRITE setHost)
+ Q_PROPERTY(QDeclarativeListProperty<Person> guests READ guests)
+public:
+ BirthdayParty(QObject *parent = 0);
+
+ Person *host() const;
+ void setHost(Person *);
+
+ QDeclarativeListProperty<Person> guests();
+ int guestCount() const;
+ Person *guest(int) const;
+
+// ![0]
+ Q_INVOKABLE void invite(const QString &name);
+// ![0]
+
+private:
+ Person *m_host;
+ QList<Person *> m_guests;
+};
+
+#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/cppextensions/referenceexamples/methods/example.qml b/examples/declarative/cppextensions/referenceexamples/methods/example.qml
new file mode 100644
index 0000000..c4698a2
--- /dev/null
+++ b/examples/declarative/cppextensions/referenceexamples/methods/example.qml
@@ -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 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
+import People 1.0
+
+// ![0]
+BirthdayParty {
+ host: Person {
+ name: "Bob Jones"
+ shoeSize: 12
+ }
+ guests: [
+ Person { name: "Leo Hodges" },
+ Person { name: "Jack Smith" },
+ Person { name: "Anne Brown" }
+ ]
+
+ Component.onCompleted: invite("William Green")
+}
+// ![0]
diff --git a/examples/declarative/cppextensions/referenceexamples/methods/main.cpp b/examples/declarative/cppextensions/referenceexamples/methods/main.cpp
new file mode 100644
index 0000000..d974647
--- /dev/null
+++ b/examples/declarative/cppextensions/referenceexamples/methods/main.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 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 <QCoreApplication>
+#include <QDeclarativeEngine>
+#include <QDeclarativeComponent>
+#include <QDebug>
+#include "birthdayparty.h"
+#include "person.h"
+
+int main(int argc, char ** argv)
+{
+ QCoreApplication app(argc, argv);
+
+ qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty");
+ qmlRegisterType<Person>("People", 1,0, "Person");
+
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
+ BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
+
+ if (party && party->host()) {
+ qWarning() << party->host()->name() << "is having a birthday!";
+ qWarning() << "They are inviting:";
+ for (int ii = 0; ii < party->guestCount(); ++ii)
+ qWarning() << " " << party->guest(ii)->name();
+ } else {
+ qWarning() << component.errors();
+ }
+
+ return 0;
+}
diff --git a/examples/declarative/cppextensions/referenceexamples/methods/methods.pro b/examples/declarative/cppextensions/referenceexamples/methods/methods.pro
new file mode 100644
index 0000000..a62927e
--- /dev/null
+++ b/examples/declarative/cppextensions/referenceexamples/methods/methods.pro
@@ -0,0 +1,18 @@
+TEMPLATE = app
+TARGET = methods
+DEPENDPATH += .
+INCLUDEPATH += .
+QT += declarative
+
+# Input
+SOURCES += main.cpp \
+ person.cpp \
+ birthdayparty.cpp
+HEADERS += person.h \
+ birthdayparty.h
+RESOURCES += methods.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/declarative/extending/methods
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS methods.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/extending/methods
+INSTALLS += target sources
diff --git a/examples/declarative/cppextensions/referenceexamples/methods/methods.qrc b/examples/declarative/cppextensions/referenceexamples/methods/methods.qrc
new file mode 100644
index 0000000..e2fa01d
--- /dev/null
+++ b/examples/declarative/cppextensions/referenceexamples/methods/methods.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>example.qml</file>
+</qresource>
+</RCC>
diff --git a/examples/declarative/cppextensions/referenceexamples/methods/person.cpp b/examples/declarative/cppextensions/referenceexamples/methods/person.cpp
new file mode 100644
index 0000000..beffe78
--- /dev/null
+++ b/examples/declarative/cppextensions/referenceexamples/methods/person.cpp
@@ -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 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 "person.h"
+
+Person::Person(QObject *parent)
+: QObject(parent), m_shoeSize(0)
+{
+}
+
+QString Person::name() const
+{
+ return m_name;
+}
+
+void Person::setName(const QString &n)
+{
+ m_name = n;
+}
+
+int Person::shoeSize() const
+{
+ return m_shoeSize;
+}
+
+void Person::setShoeSize(int s)
+{
+ m_shoeSize = s;
+}
+
diff --git a/examples/declarative/cppextensions/referenceexamples/methods/person.h b/examples/declarative/cppextensions/referenceexamples/methods/person.h
new file mode 100644
index 0000000..8c950da
--- /dev/null
+++ b/examples/declarative/cppextensions/referenceexamples/methods/person.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 PERSON_H
+#define PERSON_H
+
+#include <QObject>
+
+class Person : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize)
+public:
+ Person(QObject *parent = 0);
+
+ QString name() const;
+ void setName(const QString &);
+
+ int shoeSize() const;
+ void setShoeSize(int);
+private:
+ QString m_name;
+ int m_shoeSize;
+};
+
+#endif // PERSON_H
diff --git a/examples/declarative/cppextensions/referenceexamples/referenceexamples.pro b/examples/declarative/cppextensions/referenceexamples/referenceexamples.pro
index 169c7ab..505cefd 100644
--- a/examples/declarative/cppextensions/referenceexamples/referenceexamples.pro
+++ b/examples/declarative/cppextensions/referenceexamples/referenceexamples.pro
@@ -10,4 +10,5 @@ SUBDIRS += \
grouped \
properties \
signal \
- valuesource
+ valuesource \
+ methods
diff --git a/examples/declarative/modelviews/package/view.qml b/examples/declarative/modelviews/package/view.qml
index 152881a..26230ef 100644
--- a/examples/declarative/modelviews/package/view.qml
+++ b/examples/declarative/modelviews/package/view.qml
@@ -40,7 +40,8 @@
import Qt 4.7
-Item {
+Rectangle {
+ color: "white"
width: 400
height: 200
diff --git a/examples/declarative/sqllocalstorage/hello.qml b/examples/declarative/sqllocalstorage/hello.qml
index 421a74c..19b7378 100644
--- a/examples/declarative/sqllocalstorage/hello.qml
+++ b/examples/declarative/sqllocalstorage/hello.qml
@@ -40,32 +40,38 @@
//![0]
import Qt 4.7
-Text {
- text: "?"
+Rectangle {
+ color: "white"
+ width: 200
+ height: 100
+
+ Text {
+ text: "?"
+ anchors.horizontalCenter: parent.horizontalCenter
+ function findGreetings() {
+ var db = openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000);
- function findGreetings() {
- var db = openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000);
+ db.transaction(
+ function(tx) {
+ // Create the database if it doesn't already exist
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
- db.transaction(
- function(tx) {
- // Create the database if it doesn't already exist
- tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
+ // Add (another) greeting row
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
- // Add (another) greeting row
- tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ // Show all added greetings
+ var rs = tx.executeSql('SELECT * FROM Greeting');
- // Show all added greetings
- var rs = tx.executeSql('SELECT * FROM Greeting');
-
- var r = ""
- for(var i = 0; i < rs.rows.length; i++) {
- r += rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee + "\n"
+ var r = ""
+ for(var i = 0; i < rs.rows.length; i++) {
+ r += rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee + "\n"
+ }
+ text = r
}
- text = r
- }
- )
- }
+ )
+ }
- Component.onCompleted: findGreetings()
+ Component.onCompleted: findGreetings()
+ }
}
//![0]
diff --git a/examples/declarative/threading/threadedlistmodel/timedisplay.qml b/examples/declarative/threading/threadedlistmodel/timedisplay.qml
index 997f7a0..d807955 100644
--- a/examples/declarative/threading/threadedlistmodel/timedisplay.qml
+++ b/examples/declarative/threading/threadedlistmodel/timedisplay.qml
@@ -41,31 +41,35 @@
// ![0]
import Qt 4.7
-ListView {
+Rectangle {
+ color: "white"
width: 200
height: 300
- model: listModel
- delegate: Component {
- Text { text: time }
- }
+ ListView {
+ anchors.fill: parent
+ model: listModel
+ delegate: Component {
+ Text { text: time }
+ }
- ListModel { id: listModel }
+ ListModel { id: listModel }
- WorkerScript {
- id: worker
- source: "dataloader.js"
- }
+ WorkerScript {
+ id: worker
+ source: "dataloader.js"
+ }
- Timer {
- id: timer
- interval: 2000; repeat: true
- running: true
- triggeredOnStart: true
+ Timer {
+ id: timer
+ interval: 2000; repeat: true
+ running: true
+ triggeredOnStart: true
- onTriggered: {
- var msg = {'action': 'appendCurrentTime', 'model': listModel};
- worker.sendMessage(msg);
+ onTriggered: {
+ var msg = {'action': 'appendCurrentTime', 'model': listModel};
+ worker.sendMessage(msg);
+ }
}
}
}
diff --git a/examples/declarative/toys/clocks/content/Clock.qml b/examples/declarative/toys/clocks/content/Clock.qml
index eaa14c6..765e8b8 100644
--- a/examples/declarative/toys/clocks/content/Clock.qml
+++ b/examples/declarative/toys/clocks/content/Clock.qml
@@ -77,7 +77,7 @@ Item {
origin.x: 7.5; origin.y: 73;
angle: (clock.hours * 30) + (clock.minutes * 0.5)
Behavior on angle {
- RotationAnimation{ direction: RotationAnimation.Clockwise }
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
}
}
}
@@ -91,7 +91,7 @@ Item {
origin.x: 6.5; origin.y: 83;
angle: clock.minutes * 6
Behavior on angle {
- RotationAnimation{ direction: RotationAnimation.Clockwise }
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
}
}
}
@@ -105,7 +105,7 @@ Item {
origin.x: 2.5; origin.y: 80;
angle: clock.seconds * 6
Behavior on angle {
- RotationAnimation{ direction: RotationAnimation.Clockwise }
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
}
}
}
diff --git a/examples/declarative/toys/tvtennis/tvtennis.qml b/examples/declarative/toys/tvtennis/tvtennis.qml
index 2e144ed..4080c87 100644
--- a/examples/declarative/toys/tvtennis/tvtennis.qml
+++ b/examples/declarative/toys/tvtennis/tvtennis.qml
@@ -87,14 +87,14 @@ Rectangle {
color: "Lime"
x: 2; width: 20; height: 90
y: ball.direction == 'left' ? ball.y - 45 : page.height/2 -45;
- Behavior on y { SpringAnimation{ spring: 1; damping: .1; } }
+ Behavior on y { SpringAnimation{ velocity: 300 } }
}
Rectangle {
id: rightBat
color: "Lime"
x: page.width - 22; width: 20; height: 90
y: ball.direction == 'right' ? ball.y - 45 : page.height/2 -45;
- Behavior on y { SpringAnimation{ spring: 1; damping: .1; } }
+ Behavior on y { SpringAnimation{ velocity: 300 } }
}
// The rest, to make it look realistic, if neither ever scores...
diff --git a/examples/declarative/ui-components/dialcontrol/content/Dial.qml b/examples/declarative/ui-components/dialcontrol/content/Dial.qml
index b5074a64..3ffa09a 100644
--- a/examples/declarative/ui-components/dialcontrol/content/Dial.qml
+++ b/examples/declarative/ui-components/dialcontrol/content/Dial.qml
@@ -68,6 +68,7 @@ Item {
transform: Rotation {
id: needleRotation
origin.x: 5; origin.y: 65
+ //! [needle angle]
angle: Math.min(Math.max(-130, root.value*2.6 - 130), 133)
Behavior on angle {
SpringAnimation {
@@ -75,6 +76,7 @@ Item {
damping: .15
}
}
+ //! [needle angle]
}
}
//! [needle]
diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml
index 95df68c..46cc3e6 100644
--- a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml
+++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml
@@ -38,8 +38,10 @@
**
****************************************************************************/
+//! [imports]
import Qt 4.7
import "content"
+//! [imports]
//! [0]
Rectangle {
@@ -87,4 +89,4 @@ Rectangle {
}
}
}
-//! [0] \ No newline at end of file
+//! [0]
diff --git a/examples/declarative/ui-components/searchbox/SearchBox.qml b/examples/declarative/ui-components/searchbox/SearchBox.qml
index 6d87837..8ef21b3 100644
--- a/examples/declarative/ui-components/searchbox/SearchBox.qml
+++ b/examples/declarative/ui-components/searchbox/SearchBox.qml
@@ -75,6 +75,7 @@ FocusScope {
id: textInput
anchors { left: parent.left; leftMargin: 8; right: clear.left; rightMargin: 8; verticalCenter: parent.verticalCenter }
focus: true
+ selectByMouse: true
}
Image {
diff --git a/examples/graphicsview/diagramscene/mainwindow.cpp b/examples/graphicsview/diagramscene/mainwindow.cpp
index e4fe633..03e821d 100644
--- a/examples/graphicsview/diagramscene/mainwindow.cpp
+++ b/examples/graphicsview/diagramscene/mainwindow.cpp
@@ -45,6 +45,7 @@
#include "diagramitem.h"
#include "diagramscene.h"
#include "diagramtextitem.h"
+#include "arrow.h"
const int InsertTextButton = 10;
@@ -55,7 +56,7 @@ MainWindow::MainWindow()
createToolBox();
createMenus();
- scene = new DiagramScene(itemMenu);
+ scene = new DiagramScene(itemMenu, this);
scene->setSceneRect(QRectF(0, 0, 5000, 5000));
connect(scene, SIGNAL(itemInserted(DiagramItem*)),
this, SLOT(itemInserted(DiagramItem*)));
@@ -123,11 +124,22 @@ void MainWindow::buttonGroupClicked(int id)
void MainWindow::deleteItem()
{
foreach (QGraphicsItem *item, scene->selectedItems()) {
- if (item->type() == DiagramItem::Type) {
- qgraphicsitem_cast<DiagramItem *>(item)->removeArrows();
+ if (item->type() == Arrow::Type) {
+ scene->removeItem(item);
+ Arrow *arrow = qgraphicsitem_cast<Arrow *>(item);
+ arrow->startItem()->removeArrow(arrow);
+ arrow->endItem()->removeArrow(arrow);
+ delete item;
}
- scene->removeItem(item);
}
+
+ foreach (QGraphicsItem *item, scene->selectedItems()) {
+ if (item->type() == DiagramItem::Type) {
+ qgraphicsitem_cast<DiagramItem *>(item)->removeArrows();
+ }
+ scene->removeItem(item);
+ delete item;
+ }
}
//! [3]
@@ -313,7 +325,7 @@ void MainWindow::about()
//! [21]
void MainWindow::createToolBox()
{
- buttonGroup = new QButtonGroup;
+ buttonGroup = new QButtonGroup(this);
buttonGroup->setExclusive(false);
connect(buttonGroup, SIGNAL(buttonClicked(int)),
this, SLOT(buttonGroupClicked(int)));
@@ -345,7 +357,7 @@ void MainWindow::createToolBox()
QWidget *itemWidget = new QWidget;
itemWidget->setLayout(layout);
- backgroundButtonGroup = new QButtonGroup;
+ backgroundButtonGroup = new QButtonGroup(this);
connect(backgroundButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)),
this, SLOT(backgroundButtonGroupClicked(QAbstractButton*)));
@@ -460,7 +472,6 @@ void MainWindow::createToolbars()
editToolBar->addAction(sendBackAction);
fontCombo = new QFontComboBox();
- fontSizeCombo = new QComboBox();
connect(fontCombo, SIGNAL(currentFontChanged(QFont)),
this, SLOT(currentFontChanged(QFont)));
@@ -526,7 +537,7 @@ void MainWindow::createToolbars()
linePointerButton->setCheckable(true);
linePointerButton->setIcon(QIcon(":/images/linepointer.png"));
- pointerTypeGroup = new QButtonGroup;
+ pointerTypeGroup = new QButtonGroup(this);
pointerTypeGroup->addButton(pointerButton, int(DiagramScene::MoveItem));
pointerTypeGroup->addButton(linePointerButton,
int(DiagramScene::InsertLine));
@@ -605,7 +616,7 @@ QMenu *MainWindow::createColorMenu(const char *slot, QColor defaultColor)
names << tr("black") << tr("white") << tr("red") << tr("blue")
<< tr("yellow");
- QMenu *colorMenu = new QMenu;
+ QMenu *colorMenu = new QMenu(this);
for (int i = 0; i < colors.count(); ++i) {
QAction *action = new QAction(names.at(i), this);
action->setData(colors.at(i));
diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf
index 6d96b01..04b81b0 100644
--- a/mkspecs/common/symbian/symbian.conf
+++ b/mkspecs/common/symbian/symbian.conf
@@ -70,7 +70,12 @@ QMAKE_LIBS_CORE = $$QMAKE_LIBS -lefsrv -lhal -lbafl
QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -lapparc -lcentralrepository
QMAKE_LIBS_NETWORK =
QMAKE_LIBS_EGL = -llibEGL
-QMAKE_LIBS_OPENGL =
+QMAKE_LIBS_OPENGL = -llibglesv2
+QMAKE_LIBS_OPENGL_ES1 = -llibGLESv1_CM
+QMAKE_LIBS_OPENGL_ES2 = -llibglesv2
+QMAKE_LIBS_OPENGL_QT = -llibglesv2 -lcone -lws32
+QMAKE_LIBS_OPENGL_ES1_QT = -llibGLESv1_CM -lcone -lws32
+QMAKE_LIBS_OPENGL_ES2_QT = -llibglesv2 -lcone -lws32
QMAKE_LIBS_OPENVG = -llibOpenVG -lfbscli -lbitgdi -lgdi
QMAKE_LIBS_THREAD = -llibpthread
QMAKE_LIBS_COMPAT =
diff --git a/mkspecs/features/sis_targets.prf b/mkspecs/features/sis_targets.prf
index 99f5910..abdf2d4 100644
--- a/mkspecs/features/sis_targets.prf
+++ b/mkspecs/features/sis_targets.prf
@@ -11,7 +11,6 @@ else:!equals(DEPLOYMENT, default_deployment) {
equals(GENERATE_SIS_TARGETS, true) {
symbian-abld|symbian-sbsv2 {
- sis_destdir =
make_cache_name = .make.cache
sis_target.target = sis
sis_target.commands = $(if $(wildcard $$basename(TARGET)_template.pkg), \
@@ -50,7 +49,7 @@ equals(GENERATE_SIS_TARGETS, true) {
ok_unsigned_sis_target.target = ok_unsigned_sis
ok_unsigned_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) -o $$basename(TARGET)_template.pkg $(QT_SIS_TARGET)
- target_sis_target.target = $${sis_destdir}$${TARGET}.sis
+ target_sis_target.target = $$basename(TARGET).sis
target_sis_target.commands = $(MAKE) -f $(MAKEFILE) sis
installer_sis_target.target = installer_sis
@@ -59,7 +58,7 @@ equals(GENERATE_SIS_TARGETS, true) {
, \
$(MAKE) -f $(MAKEFILE) fail_sis_nopkg \
)
- installer_sis_target.depends = $${sis_destdir}$${TARGET}.sis
+ installer_sis_target.depends = $$basename(TARGET).sis
ok_installer_sis_target.target = ok_installer_sis
ok_installer_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) $$basename(TARGET)_installer.pkg - \
diff --git a/mkspecs/features/symbian/opengl.prf b/mkspecs/features/symbian/opengl.prf
new file mode 100644
index 0000000..9a8ab18
--- /dev/null
+++ b/mkspecs/features/symbian/opengl.prf
@@ -0,0 +1,21 @@
+contains(QT_CONFIG, opengles1) {
+ INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1
+ !isEmpty(QMAKE_LIBDIR_OPENGL_ES1):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES1
+ target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1_QT
+ else:LIBS += $$QMAKE_LIBS_OPENGL_ES1
+} else:contains(QT_CONFIG, opengles2) {
+ INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
+ !isEmpty(QMAKE_LIBDIR_OPENGL_ES2):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2
+ target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES2_QT
+ else:LIBS += $$QMAKE_LIBS_OPENGL_ES2
+} else {
+ INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
+ !isEmpty(QMAKE_LIBDIR_OPENGL):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL
+ target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_QT
+ else:LIBS += $$QMAKE_LIBS_OPENGL
+}
+
+contains(QT_CONFIG, egl) {
+ !isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
+}
+
diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf
index 3ae18b6..2dd796d 100644
--- a/mkspecs/win32-icc/qmake.conf
+++ b/mkspecs/win32-icc/qmake.conf
@@ -50,7 +50,7 @@ QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$obj $src
QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $<
QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<<
-QMAKE_LINK = link
+QMAKE_LINK = xilink
QMAKE_LFLAGS = /NOLOGO
QMAKE_LFLAGS_RELEASE =
QMAKE_LFLAGS_DEBUG = /DEBUG
@@ -72,7 +72,7 @@ QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe
QMAKE_IDL = midl
-QMAKE_LIB = lib /NOLOGO
+QMAKE_LIB = xilib /NOLOGO
QMAKE_RC = rc
QMAKE_ZIP = zip -r -9
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 74c7977..49fc3e7 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -471,9 +471,9 @@ MakefileGenerator::init()
subs.at(i).toLatin1().constData());
continue;
}
- QFile in(fileFixify(subs.at(i))), out(fileInfo(subs.at(i)).fileName());
- if(out.fileName().endsWith(".in"))
- out.setFileName(out.fileName().left(out.fileName().length()-3));
+ QFile in(fileFixify(subs.at(i)));
+ QFile out(fileFixify(subs.at(i).left(subs.at(i).length()-3),
+ qmake_getpwd(), Option::output_dir));
if(in.open(QFile::ReadOnly)) {
QString contents;
QStack<int> state;
@@ -538,6 +538,7 @@ MakefileGenerator::init()
continue;
}
}
+ mkdir(QFileInfo(out).absolutePath());
if(out.open(QFile::WriteOnly)) {
v["QMAKE_INTERNAL_INCLUDED_FILES"].append(subs.at(i));
out.write(contents.toUtf8());
diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp
index 382e012..776a646 100644
--- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp
+++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp
@@ -353,7 +353,11 @@ void initProjectDeploySymbian(QMakeProject* project,
CopyItem &item = i.next();
QFileInfo fromItem(item.from);
QFileInfo toItem(item.to);
- if (fromItem == toItem)
+#if defined(Q_OS_WIN)
+ if (0 == fromItem.absoluteFilePath().compare(toItem.absoluteFilePath(), Qt::CaseInsensitive))
+#else
+ if (0 == fromItem.absoluteFilePath().compare(toItem.absoluteFilePath()))
+#endif
i.remove();
}
}
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 5685d6b..4717542 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -191,10 +191,7 @@ void createArObjectScriptFile(const QString &fileName, const QString &target, co
QTextStream t(&file);
t << "CREATE " << target << endl;
for (QStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
- if (QDir::isRelativePath(*it))
- t << "ADDMOD " << *it << endl;
- else
- t << *it << endl;
+ t << "ADDMOD " << *it << endl;
}
t << "SAVE" << endl;
t.flush();
diff --git a/src/3rdparty/libconninet/Makefile.am b/src/3rdparty/libconninet/Makefile.am
deleted file mode 100644
index 250637a..0000000
--- a/src/3rdparty/libconninet/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-SUBDIRS = src tests
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = conninet.pc
-
-MAINTAINERCLEANFILES = \
- Makefile.in config.h.in configure \
- install-sh ltmain.sh missing mkinstalldirs \
- config.log config.status config.guess config.sub \
- build-stamp compile depcomp acinclude.m4 aclocal.m4 \
- debian/files \
- debian/libconninet0.postinst.debhelper \
- debian/libconninet0.postrm.debhelper \
- debian/libconninet0.substvars
-
-EXTRA_DIST = \
- debian/changelog \
- debian/compat \
- debian/control \
- debian/copyright \
- debian/libconninet0-dev.dirs \
- debian/libconninet0-dev.files \
- debian/libconninet0.dirs \
- debian/libconninet0.files \
- debian/rules
-
-# get rid of debian build dirs
-maintainer-clean-local:
- -rm -rf debian/build debian/tmp \
- debian/libconninet0 \
- debian/libconninet0-dev \
- debian/libconninet0-dbg
-
-if DOXYGEN_DOCS_ENABLED
- DOXYGEN_LINE = $(DOXYGEN) doxygen.cfg
-else
- DOXYGEN_LINE =
-endif
-
-.PHONY : doc
-
-doc:
- $(DOXYGEN_LINE)
-
-deb: dist
- -mkdir $(top_builddir)/debian-build
- cd $(top_builddir)/debian-build && tar zxf ../$(top_builddir)/$(PACKAGE)-$(VERSION).tar.gz
- cd $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot -sa -D
- -rm -rf $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION)
diff --git a/src/3rdparty/libconninet/debian/changelog b/src/3rdparty/libconninet/debian/changelog
index 436d318..4063317 100644
--- a/src/3rdparty/libconninet/debian/changelog
+++ b/src/3rdparty/libconninet/debian/changelog
@@ -1,9 +1,17 @@
-libconninet (0.41+0m6) unstable; urgency=low
+libconninet (0.42+0m6) unstable; urgency=low
* This entry has been added by BIFH queue processor
- version has been changed to 0.41+0m6
+ version has been changed to 0.42+0m6
- -- Qing Jin <ext-qing.1.jin@nokia.com> Thu, 15 Jul 2010 15:56:38 +0300
+ -- Qing Jin <ext-qing.1.jin@nokia.com> Thu, 22 Jul 2010 14:04:58 +0300
+
+libconninet (0.42) unstable; urgency=low
+
+ * Fixes: NB#180536 - Uploads to online services are not working.
+ This is a regression caused by fix to bug 175098, the timeout was never
+ expiring when waiting reply from icd.
+
+ -- Jukka Rissanen <jukka.rissanen@nokia.com> Mon, 19 Jul 2010 12:23:30 +0300
libconninet (0.41) unstable; urgency=low
diff --git a/src/3rdparty/libconninet/src/Makefile.am b/src/3rdparty/libconninet/src/Makefile.am
deleted file mode 100644
index be7a1e5..0000000
--- a/src/3rdparty/libconninet/src/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-DEFS = -DDBUS_API_SUBJECT_TO_CHANGE -DGCONF_DISABLE_DEPRECATED
-INCLUDES = @GLIB_CFLAGS@ @DBUS_CFLAGS@ @GCONF_CFLAGS@ @OSSO_IC_CFLAGS@ @ICD_DEV_CFLAGS@ @QTCORE_CFLAGS@ @QTNETWORK_CFLAGS@ @QTDBUS_CFLAGS@ @QGCONF_CFLAGS@ @CONNSETTINGS_CFLAGS@
-LIBS = @GLIB_LIBS@ @DBUS_LIBS@ @GCONF_LIBS@ @OSSO_IC_LIBS@ @ICD_DEV_LIBS@ @QTCORE_LIBS@ @QTDBUS_LIBS@ @QTNETWORK_CFLAGS@ @QGCONF_LIBS@ @CONNSETTINGS_LIBS@
-
-AM_CFLAGS = $(CONCFLAGS)
-
-lib_LTLIBRARIES = libconninet.la
-libconninet_la_SOURCES = \
- maemo_icd.cpp \
- dbusdispatcher.cpp \
- iapconf.cpp \
- iapmonitor.cpp \
- proxyconf.cpp
-
-#libconninet_la_LDFLAGS = -version-info 0:0:0
-
-conninetincludedir = $(includedir)/conninet
-conninetinclude_HEADERS = \
- maemo_icd.h \
- dbusdispatcher.h \
- iapconf.h \
- iapmonitor.h \
- proxyconf.h
-
-nodist_libconninet_la_SOURCES = \
- moc_maemo_icd.cpp \
- moc_dbusdispatcher.cpp
-
-MAINTAINERCLEANFILES = Makefile.in
-
-# This rule lets GNU make create any moc_*.cpp from the equivalent *.h
-moc_%.cpp: %.h
- moc $< -o $@
-
-# This line ensures that generated moc files are deleted when we make clean.
-CLEANFILES = *_moc.cpp *.loT
diff --git a/src/3rdparty/libconninet/src/dbusdispatcher.cpp b/src/3rdparty/libconninet/src/dbusdispatcher.cpp
index f5b830a..7581982 100644
--- a/src/3rdparty/libconninet/src/dbusdispatcher.cpp
+++ b/src/3rdparty/libconninet/src/dbusdispatcher.cpp
@@ -31,7 +31,7 @@
namespace Maemo {
/*!
- \class Maemo::DBusDispatcher
+ \class DBusDispatcher
\brief DBusDispatcher is a class, which is able to send DBUS method call
messages and receive unicast signals from DBUS object.
diff --git a/src/3rdparty/libconninet/src/maemo_icd.cpp b/src/3rdparty/libconninet/src/maemo_icd.cpp
index bc84fbc..026241c 100644
--- a/src/3rdparty/libconninet/src/maemo_icd.cpp
+++ b/src/3rdparty/libconninet/src/maemo_icd.cpp
@@ -30,9 +30,30 @@
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
namespace Maemo {
+#undef PRINT_DEBUGINFO
+#ifdef PRINT_DEBUGINFO
+ static FILE *fdebug = NULL;
+#define PDEBUG(fmt, args...) \
+ do { \
+ struct timeval tv; \
+ gettimeofday(&tv, 0); \
+ fprintf(fdebug, "DEBUG[%d]:%ld.%ld:%s:%s():%d: " fmt, \
+ getpid(), \
+ tv.tv_sec, tv.tv_usec, \
+ __FILE__, __FUNCTION__, __LINE__, args); \
+ fflush(fdebug); \
+ } while(0)
+#else
+#define PDEBUG(fmt...)
+#endif
+
+
/* Reference counting singleton class that creates a single connection
* to icd so that icd reference counting works as expected. This is
* needed because DBusDispatcher uses private dbus connections
@@ -239,6 +260,13 @@ public:
icd = myfriend;
timeout = dbus_timeout;
+
+#ifdef PRINT_DEBUGINFO
+ if (!fdebug) {
+ fdebug = fopen("/tmp/maemoicd.log", "a+");
+ }
+ PDEBUG("created %s\n", "IcdPrivate");
+#endif
}
void clearState()
@@ -672,6 +700,8 @@ uint IcdPrivate::state_non_blocking(QList<IcdStateResult>& state_results)
uint signals_left, total_signals;
IcdStateResult result;
+ PDEBUG("%s\n", "non blocking state");
+
clearState();
reply = mDBus->call(ICD_DBUS_API_STATE_REQ);
if (reply.type() != QVariant::List)
@@ -719,6 +749,7 @@ uint IcdPrivate::state_non_blocking(QList<IcdStateResult>& state_results)
}
timer.stop();
+ PDEBUG("total_signals=%d\n", total_signals);
return total_signals;
}
@@ -731,11 +762,14 @@ uint IcdPrivate::state_non_blocking(QList<IcdStateResult>& state_results)
*/
uint IcdPrivate::state(QList<IcdStateResult>& state_results)
{
- QTimer timer;
QVariant reply;
QVariantList vl;
uint signals_left, total_signals;
IcdStateResult result;
+ time_t started;
+ int timeout_secs = timeout / 1000;
+
+ PDEBUG("%s\n", "state_results");
clearState();
reply = mDBus->call(ICD_DBUS_API_STATE_REQ);
@@ -749,17 +783,16 @@ uint IcdPrivate::state(QList<IcdStateResult>& state_results)
if (!signals_left)
return 0;
- timer.setSingleShot(true);
- timer.start(timeout);
+ started = time(0);
state_results.clear();
mError.clear();
while (signals_left) {
mInterface.clear();
- while (timer.isActive() && mInterface.isEmpty()) {
+ while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) {
mDBus->synchronousDispatch(1000);
}
- if (!timer.isActive()) {
+ if (time(0)>(started+timeout_secs)) {
total_signals = 0;
break;
}
@@ -782,8 +815,8 @@ uint IcdPrivate::state(QList<IcdStateResult>& state_results)
break;
}
}
- timer.stop();
+ PDEBUG("total_signals=%d\n", total_signals);
return total_signals;
}
@@ -956,11 +989,14 @@ static void get_addrinfo_all_result(QList<QVariant>& args,
*/
uint IcdPrivate::addrinfo(QList<IcdAddressInfoResult>& addr_results)
{
- QTimer timer;
QVariant reply;
QVariantList vl;
uint signals_left, total_signals;
IcdAddressInfoResult result;
+ time_t started;
+ int timeout_secs = timeout / 1000;
+
+ PDEBUG("%s\n", "addr_results");
clearState();
reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ);
@@ -976,16 +1012,15 @@ uint IcdPrivate::addrinfo(QList<IcdAddressInfoResult>& addr_results)
if (!signals_left)
return 0;
- timer.setSingleShot(true);
- timer.start(timeout);
+ started = time(0);
addr_results.clear();
while (signals_left) {
mInterface.clear();
- while (timer.isActive() && mInterface.isEmpty()) {
+ while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) {
mDBus->synchronousDispatch(1000);
}
- if (!timer.isActive()) {
+ if (time(0)>(started+timeout_secs)) {
total_signals = 0;
break;
}
@@ -1003,7 +1038,8 @@ uint IcdPrivate::addrinfo(QList<IcdAddressInfoResult>& addr_results)
break;
}
}
- timer.stop();
+
+ PDEBUG("total_signals=%d\n", total_signals);
return total_signals;
}
@@ -1015,6 +1051,8 @@ uint IcdPrivate::addrinfo_non_blocking(QList<IcdAddressInfoResult>& addr_results
uint signals_left, total_signals;
IcdAddressInfoResult result;
+ PDEBUG("%s\n", "non blocking addrinfo");
+
clearState();
reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ);
if (reply.type() != QVariant::List)
@@ -1057,6 +1095,7 @@ uint IcdPrivate::addrinfo_non_blocking(QList<IcdAddressInfoResult>& addr_results
}
}
timer.stop();
+ PDEBUG("total_signals=%d\n", total_signals);
return total_signals;
}
diff --git a/src/3rdparty/libconninet/tests/Makefile.am b/src/3rdparty/libconninet/tests/Makefile.am
deleted file mode 100644
index f6f41ea..0000000
--- a/src/3rdparty/libconninet/tests/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-DEFS = -DDBUS_API_SUBJECT_TO_CHANGE
-INCLUDES = @GLIB_CFLAGS@ @DBUS_CFLAGS@ @CONNSETTINGS_CFLAGS@ @OSSO_IC_CFLAGS@ @ICD_DEV_CFLAGS@ \
- @QTCORE_CFLAGS@ @QTDBUS_CFLAGS@ @QTCORE_CFLAGS@ @QTNETWORK_CFLAGS@ @QTTEST_CFLAGS@ \
- -I$(top_srcdir) \
- -I$(top_srcdir)/src
-
-LIBS = @GLIB_LIBS@ @DBUS_LIBS@ @CONNSETTINGS_LIBS@ @OSSO_IC_LIBS@ @ICD_DEV_LIBS@ \
- @QTCORE_LIBS@ @QTDBUS_LIBS@ @QTCORE_LIBS@ @QTNETWORK_LIBS@ @QTTEST_LIBS@ \
- $(top_builddir)/src/libconninet.la
-
-AM_CFLAGS = $(CONCFLAGS)
-AM_LDFLAGS = -static
-
-bin_PROGRAMS = test_dbusdispatcher test_iapconf test_maemo_icd test_iapmonitor test_proxyconf
-
-test_dbusdispatcher_SOURCES = ut_dbusdispatcher.cpp
-ut_dbusdispatcher.o: ut_dbusdispatcher.moc
-
-test_iapconf_SOURCES = ut_iapconf.cpp
-ut_iapconf.o: ut_iapconf.moc
-
-test_maemo_icd_SOURCES = ut_maemo_icd.cpp
-ut_maemo_icd.o: ut_maemo_icd.moc
-
-test_iapmonitor_SOURCES = ut_iapmonitor.cpp
-ut_iapmonitor.o: ut_iapmonitor.moc
-
-test_proxyconf_SOURCES = ut_proxyconf.cpp
-ut_proxyconf.o: ut_proxyconf.moc
-
-
-MAINTAINERCLEANFILES = Makefile.in
-
-# This rule lets GNU make create any *.moc from the equivalent *.cpp
-%.moc: %.cpp
- moc $< -o $@
-
-# This line ensures that generated moc files are deleted when we make clean.
-CLEANFILES = *.moc
diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
index 9dcba60..c1ca23d 100644
--- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
@@ -139,6 +139,7 @@ void GraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
/*!
\qmlclass WebView QDeclarativeWebView
+ \ingroup qml-view-elements
\since 4.7
\brief The WebView item allows you to add web content to a canvas.
\inherits Item
diff --git a/src/corelib/codecs/qtextcodec_symbian.cpp b/src/corelib/codecs/qtextcodec_symbian.cpp
index e4db9d7..20e0cfc 100644
--- a/src/corelib/codecs/qtextcodec_symbian.cpp
+++ b/src/corelib/codecs/qtextcodec_symbian.cpp
@@ -53,8 +53,10 @@ struct QSymbianCodecInitData {
const char *aliases;
};
-/* This table contains the known Symbian codecs aliases. It is ordered by charsetId.
- It is required as symbian does not provide have aliases.
+/* This table contains the known Symbian codecs aliases.
+ It is required because symbian does not provide aliases for codecs.
+ It is also faster to have a name here than asking the system.
+ It is ordered by charsetId to allow binary search lookup
*/
static const QSymbianCodecInitData codecsData[] = {
{ /*268439485*/ KCharacterSetIdentifierShiftJis, 17, "Shift_JIS\0MS_Kanji\0csShiftJIS\0MS_KANJI\0SJIS\0" },
diff --git a/src/corelib/concurrent/qtconcurrentrun.cpp b/src/corelib/concurrent/qtconcurrentrun.cpp
index 5a9c755..e80a204 100644
--- a/src/corelib/concurrent/qtconcurrentrun.cpp
+++ b/src/corelib/concurrent/qtconcurrentrun.cpp
@@ -99,7 +99,7 @@
functions; passing by pointer is useful for calling non-const member
functions that modify the instance.
- For example, calling QString::split() (a const member function) in a
+ For example, calling QByteArray::split() (a const member function) in a
separate thread is done like this:
\snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp 4
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
index af657b2..003e781 100644
--- a/src/corelib/io/qprocess_symbian.cpp
+++ b/src/corelib/io/qprocess_symbian.cpp
@@ -375,10 +375,9 @@ QProcessActive::QProcessActive()
// Nothing to do
}
-// Called from ProcessManagerThread
+// Called from main thread
QProcessActive::~QProcessActive()
{
- Cancel();
process = NULL;
pproc = NULL;
}
@@ -482,10 +481,9 @@ QProcessManagerMediator::QProcessManagerMediator()
// Nothing to do
}
-// Called from ProcessManagerThread
+// Called from main thread
QProcessManagerMediator::~QProcessManagerMediator()
{
- Cancel();
processManagerThread.Close();
currentCommand = ENoCommand;
currentObserver = NULL;
@@ -648,25 +646,36 @@ QProcessManager::QProcessManager()
QProcessManager::~QProcessManager()
{
QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager()");
- // Cancel death listening for all child processes
- if (mediator) {
- QMap<int, QProcessActive *>::Iterator it = children.begin();
- while (it != children.end()) {
- // Remove all monitors
- QProcessActive *active = it.value();
- mediator->remove(active);
-
- QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager() removed listening for a process");
- ++it;
+
+ // Check if manager thread is still alive. If this destructor is ran as part of global
+ // static cleanup, manager thread will most likely be terminated by kernel at this point,
+ // so trying to delete QProcessActives and QProcessMediators will panic as they
+ // will still be active. They can also no longer be canceled as the thread is already gone.
+ // In case manager thread has already died, we simply do nothing and let the deletion of
+ // the main heap at process exit take care of stray objects.
+
+ if (managerThread.Handle() && managerThread.ExitType() == EExitPending) {
+ // Cancel death listening for all child processes
+ if (mediator) {
+ QMap<int, QProcessActive *>::Iterator it = children.begin();
+ while (it != children.end()) {
+ // Remove all monitors
+ QProcessActive *active = it.value();
+ mediator->remove(active);
+
+ QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager() removed listening for a process");
+ ++it;
+ }
+
+ // Terminate process manager thread.
+ mediator->terminate();
+ delete mediator;
}
- // Terminate process manager thread.
- mediator->terminate();
- delete mediator;
+ qDeleteAll(children.values());
+ children.clear();
}
- qDeleteAll(children.values());
- children.clear();
managerThread.Close();
managerMutex.Close();
}
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 360f99d..14ed514 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -586,10 +586,11 @@ template <class Key, class T>
Q_INLINE_TEMPLATE QHash<Key, T> &QHash<Key, T>::operator=(const QHash<Key, T> &other)
{
if (d != other.d) {
- other.d->ref.ref();
+ QHashData *o = other.d;
+ o->ref.ref();
if (!d->ref.deref())
freeData(d);
- d = other.d;
+ d = o;
if (!d->sharable)
detach_helper();
}
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index d145fe3..9b3efa3 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -312,10 +312,11 @@ template <typename T>
QLinkedList<T> &QLinkedList<T>::operator=(const QLinkedList<T> &l)
{
if (d != l.d) {
- l.d->ref.ref();
+ QLinkedListData *o = l.d;
+ o->ref.ref();
if (!d->ref.deref())
free(d);
- d = l.d;
+ d = o;
if (!d->sharable)
detach_helper();
}
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 99c9795..1282bca 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -424,10 +424,11 @@ template <typename T>
Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l)
{
if (d != l.d) {
- l.d->ref.ref();
+ QListData::Data *o = l.d;
+ o->ref.ref();
if (!d->ref.deref())
free(d);
- d = l.d;
+ d = o;
if (!d->sharable)
detach_helper();
}
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 2d11613..08f5a35 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -424,10 +424,11 @@ template <class Key, class T>
Q_INLINE_TEMPLATE QMap<Key, T> &QMap<Key, T>::operator=(const QMap<Key, T> &other)
{
if (d != other.d) {
- other.d->ref.ref();
+ QMapData* o = other.d;
+ o->ref.ref();
if (!d->ref.deref())
freeData(d);
- d = other.d;
+ d = o;
if (!d->sharable)
detach_helper();
}
diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h
index 80ba7b7..1ae2fa9 100644
--- a/src/corelib/tools/qshareddata.h
+++ b/src/corelib/tools/qshareddata.h
@@ -95,9 +95,10 @@ public:
if (o.d != d) {
if (o.d)
o.d->ref.ref();
- if (d && !d->ref.deref())
- delete d;
+ T *old = d;
d = o.d;
+ if (old && !old->ref.deref())
+ delete old;
}
return *this;
}
@@ -105,9 +106,10 @@ public:
if (o != d) {
if (o)
o->ref.ref();
- if (d && !d->ref.deref())
- delete d;
+ T *old = d;
d = o;
+ if (old && !old->ref.deref())
+ delete old;
}
return *this;
}
@@ -172,9 +174,10 @@ public:
if (o.d != d) {
if (o.d)
o.d->ref.ref();
- if (d && !d->ref.deref())
- delete d;
+ T *old = d;
d = o.d;
+ if (old && !old->ref.deref())
+ delete old;
}
return *this;
}
@@ -182,9 +185,10 @@ public:
if (o != d) {
if (o)
o->ref.ref();
- if (d && !d->ref.deref())
- delete d;
+ T *old = d;
d = o;
+ if (old && !old->ref.deref())
+ delete old;
}
return *this;
}
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 5613c12..2f0ad42 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -377,10 +377,11 @@ inline void QVector<T>::replace(int i, const T &t)
template <typename T>
QVector<T> &QVector<T>::operator=(const QVector<T> &v)
{
- v.d->ref.ref();
+ QVectorData *o = v.d;
+ o->ref.ref();
if (!d->ref.deref())
free(p);
- d = v.d;
+ d = o;
if (!d->sharable)
detach_helper();
return *this;
diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp
index 19d8ab3..bf07080 100644
--- a/src/declarative/debugger/qdeclarativedebug.cpp
+++ b/src/declarative/debugger/qdeclarativedebug.cpp
@@ -340,6 +340,8 @@ void QDeclarativeEngineDebugPrivate::message(const QByteArray &data)
if (!watch)
return;
emit watch->valueChanged(name, value);
+ } else if (type == "OBJECT_CREATED") {
+ emit q_func()->newObjects();
}
}
@@ -507,7 +509,7 @@ QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObject(const QDeclar
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId()
- << false;
+ << false << true;
d->client->sendMessage(message);
} else {
query->m_state = QDeclarativeDebugQuery::Error;
@@ -530,7 +532,7 @@ QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObjectRecursive(cons
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId()
- << true;
+ << true << true;
d->client->sendMessage(message);
} else {
query->m_state = QDeclarativeDebugQuery::Error;
diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h
index 2e79c5d..f0fc488 100644
--- a/src/declarative/debugger/qdeclarativedebug_p.h
+++ b/src/declarative/debugger/qdeclarativedebug_p.h
@@ -99,6 +99,9 @@ public:
bool resetBindingForObject(int objectDebugId, const QString &propertyName);
bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
+Q_SIGNALS:
+ void newObjects();
+
private:
Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
};
diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
index d8527d3..e0a2149 100644
--- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
@@ -62,7 +62,8 @@ QT_BEGIN_NAMESPACE
\qmlclass AnimatedImage QDeclarativeAnimatedImage
\inherits Image
\since 4.7
-
+ \ingroup basic-visual-elements
+
The AnimatedImage element provides for playing animations stored as images containing a series of frames,
such as GIF files.
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 4881248..e0c7fc2 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -56,6 +56,7 @@ QT_BEGIN_NAMESPACE
\brief The BorderImage element provides an image that can be used as a border.
\inherits Item
\since 4.7
+ \ingroup qm-basic-visual-elements
A BorderImage breaks an image into 9 sections, as shown below:
diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp
index 81ec6e1..0a35a3f 100644
--- a/src/declarative/graphicsitems/qdeclarativeevents.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp
@@ -45,6 +45,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass KeyEvent QDeclarativeKeyEvent
\since 4.7
+ \ingroup qml-event-elements
+
\brief The KeyEvent object provides information about a key event.
For example, the following changes the Item's state property when the Enter
@@ -115,6 +117,8 @@ Item {
/*!
\qmlclass MouseEvent QDeclarativeMouseEvent
\since 4.7
+ \ingroup qml-event-elements
+
\brief The MouseEvent object provides information about a mouse event.
The position of the mouse can be found via the x and y properties.
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 61b4dcd..1e862cc 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
static const int FlickThreshold = 20;
// Really slow flicks can be annoying.
-static const int minimumFlickVelocity = 200;
+static const int MinimumFlickVelocity = 75;
QDeclarativeFlickableVisibleArea::QDeclarativeFlickableVisibleArea(QDeclarativeFlickable *parent)
: QObject(parent), flickable(parent), m_xPosition(0.), m_widthRatio(0.)
@@ -345,6 +345,8 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd()
/*!
\qmlclass Flickable QDeclarativeFlickable
\since 4.7
+ \ingroup qml-basic-interaction-elements
+
\brief The Flickable item provides a surface that can be "flicked".
\inherits Item
@@ -777,23 +779,15 @@ void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEv
}
vTime = timeline.time();
- if (qAbs(vData.velocity) > 10 && qAbs(event->pos().y() - pressPos.y()) > FlickThreshold) {
- qreal velocity = vData.velocity;
- if (qAbs(velocity) < minimumFlickVelocity) // Minimum velocity to avoid annoyingly slow flicks.
- velocity = velocity < 0 ? -minimumFlickVelocity : minimumFlickVelocity;
- flickY(velocity);
- } else {
+ if (qAbs(vData.velocity) > MinimumFlickVelocity && qAbs(event->pos().y() - pressPos.y()) > FlickThreshold)
+ flickY(vData.velocity);
+ else
fixupY();
- }
- if (qAbs(hData.velocity) > 10 && qAbs(event->pos().x() - pressPos.x()) > FlickThreshold) {
- qreal velocity = hData.velocity;
- if (qAbs(velocity) < minimumFlickVelocity) // Minimum velocity to avoid annoyingly slow flicks.
- velocity = velocity < 0 ? -minimumFlickVelocity : minimumFlickVelocity;
- flickX(velocity);
- } else {
+ if (qAbs(hData.velocity) > MinimumFlickVelocity && qAbs(event->pos().x() - pressPos.x()) > FlickThreshold)
+ flickX(hData.velocity);
+ else
fixupX();
- }
lastPosTime.invalidate();
@@ -1027,7 +1021,7 @@ void QDeclarativeFlickable::cancelFlick()
void QDeclarativeFlickablePrivate::data_append(QDeclarativeListProperty<QObject> *prop, QObject *o)
{
- QDeclarativeItem *i = qobject_cast<QDeclarativeItem *>(o);
+ QGraphicsObject *i = qobject_cast<QGraphicsObject *>(o);
if (i)
i->setParentItem(static_cast<QDeclarativeFlickablePrivate*>(prop->data)->contentItem);
else
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
index b266273..6ce0fa6 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
@@ -70,6 +70,8 @@ public:
/*!
\qmlclass Flipable QDeclarativeFlipable
\since 4.7
+ \ingroup qml-basic-interaction-elements
+
\brief The Flipable item provides a surface that can be flipped.
\inherits Item
diff --git a/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp b/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp
index bd60e25..5c7959a 100644
--- a/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp
@@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass FocusPanel QDeclarativeFocusPanel
\since 4.7
+ \ingroup qml-basic-interaction-elements
+
\brief The FocusPanel item explicitly creates a focus panel.
\inherits Item
diff --git a/src/declarative/graphicsitems/qdeclarativefocusscope.cpp b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp
index e8e6fa2..4498275 100644
--- a/src/declarative/graphicsitems/qdeclarativefocusscope.cpp
+++ b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp
@@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass FocusScope QDeclarativeFocusScope
\since 4.7
+ \ingroup qml-basic-interaction-elements
+
\brief The FocusScope object explicitly creates a focus scope.
\inherits Item
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 68a4c64..d67e69a 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1056,6 +1056,8 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
/*!
\qmlclass GridView QDeclarativeGridView
\since 4.7
+ \ingroup qml-view-elements
+
\inherits Flickable
\brief The GridView item provides a grid view of items provided by a model.
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index 37736cc..1cc5f81 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Image QDeclarativeImage
\since 4.7
+ \ingroup qml-vasic-visual-elements
+
\brief The Image element allows you to add bitmaps to a scene.
\inherits Item
@@ -329,7 +331,7 @@ qreal QDeclarativeImage::paintedHeight() const
Unlike the \l {Item::}{width} and \l {Item::}{height} properties, which scale
the painting of the image, this property sets the actual number of pixels
stored for the loaded image so that large images do not use more
- memory than necessary. For example, this ensures the image is memory is no
+ memory than necessary. For example, this ensures the image in memory is no
larger than 1024x1024 pixels, regardless of the Image's \l {Item::}{width} and
\l {Item::}{height} values:
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
index ba40443..d6b935b 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
@@ -147,10 +147,15 @@ void QDeclarativeImageBase::load()
setImplicitWidth(0);
setImplicitHeight(0);
emit statusChanged(d->status);
+ d->sourcesize.setWidth(0);
+ d->sourcesize.setHeight(0);
+ emit sourceSizeChanged();
pixmapChange();
update();
} else {
+
d->status = Loading;
+ emit statusChanged(d->status);
d->pix.load(qmlEngine(this), d->url, d->sourcesize, d->async);
@@ -169,53 +174,34 @@ void QDeclarativeImageBase::load()
d->pix.connectDownloadProgress(this, thisRequestProgress);
} else {
- QSize impsize = d->pix.implicitSize();
- setImplicitWidth(impsize.width());
- setImplicitHeight(impsize.height());
-
- if (d->pix.isReady()) {
- d->status = Ready;
-
- if (!d->sourcesize.isValid())
- emit sourceSizeChanged();
-
- } else {
- d->status = Error;
- qmlInfo(this) << d->pix.error();
- }
- d->progress = 1.0;
- emit statusChanged(d->status);
- emit progressChanged(d->progress);
- pixmapChange();
- update();
+ requestFinished();
}
-
}
-
- emit statusChanged(d->status);
}
void QDeclarativeImageBase::requestFinished()
{
Q_D(QDeclarativeImageBase);
- QSize impsize = d->pix.implicitSize();
-
if (d->pix.isError()) {
d->status = Error;
qmlInfo(this) << d->pix.error();
+ } else {
+ d->status = Ready;
}
+ emit statusChanged(d->status);
- setImplicitWidth(impsize.width());
- setImplicitHeight(impsize.height());
+ setImplicitWidth(d->pix.width());
+ setImplicitHeight(d->pix.height());
- if (d->status == Loading)
- d->status = Ready;
d->progress = 1.0;
- emit statusChanged(d->status);
- emit progressChanged(1.0);
- if (!d->sourcesize.isValid())
+ emit progressChanged(d->progress);
+
+ if (d->sourcesize.width() != d->pix.width() || d->sourcesize.height() != d->pix.height()) {
+ d->sourcesize.setWidth(d->pix.width());
+ d->sourcesize.setHeight(d->pix.height());
emit sourceSizeChanged();
+ }
pixmapChange();
update();
}
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index cc7c673..0f16a79 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -69,6 +69,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Transform QGraphicsTransform
+ \ingroup qml-transform-elements
\since 4.7
\brief The Transform elements provide a way of building advanced transformations on Items.
@@ -90,6 +91,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Translate QDeclarativeTranslate
+ \ingroup qml-transform-elements
\since 4.7
\brief The Translate object provides a way to move an Item without changing its x or y properties.
@@ -131,6 +133,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Scale QGraphicsScale
+ \ingroup qml-transform-elements
\since 4.7
\brief The Scale element provides a way to scale an Item.
@@ -172,6 +175,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Rotation QGraphicsRotation
+ \ingroup qml-transform-elements
\since 4.7
\brief The Rotation object provides a way to rotate an Item.
@@ -419,6 +423,7 @@ void QDeclarativeItemKeyFilter::componentComplete()
/*!
\qmlclass KeyNavigation QDeclarativeKeyNavigationAttached
+ \ingroup qml-basic-interaction-elements
\since 4.7
\brief The KeyNavigation attached property supports key navigation by arrow keys.
@@ -725,6 +730,7 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post)
/*!
\qmlclass Keys QDeclarativeKeysAttached
+ \ingroup qml-basic-interaction-elements
\since 4.7
\brief The Keys attached property provides key handling to Items.
@@ -1310,6 +1316,7 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec
/*!
\qmlclass Item QDeclarativeItem
+ \ingroup qml-basic-visual-elements
\since 4.7
\brief The Item is the most basic of all visual items in QML.
diff --git a/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp
index 38d5f59..8509473 100644
--- a/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass LayoutItem QDeclarativeLayoutItem
+ \ingroup qml-utility-elements
\since 4.7
\brief The LayoutItem element allows declarative UI elements to be placed inside Qt's Graphics View layouts.
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index e1dd1c0..2e2e08c 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -983,7 +983,7 @@ void QDeclarativeListViewPrivate::updateSections()
void QDeclarativeListViewPrivate::updateCurrentSection()
{
if (!sectionCriteria || visibleItems.isEmpty()) {
- currentSection = QString();
+ currentSection.clear();
return;
}
int index = 0;
@@ -1357,6 +1357,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
/*!
\qmlclass ListView QDeclarativeListView
+ \ingroup qml-view-elements
\since 4.7
\inherits Flickable
\brief The ListView item provides a list view of items provided by a model.
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index d28181e..2fde4c8 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -108,59 +108,83 @@ void QDeclarativeLoaderPrivate::initResize()
/*!
\qmlclass Loader QDeclarativeLoader
+ \ingroup qml-utility-elements
\since 4.7
\inherits Item
\brief The Loader item allows dynamically loading an Item-based
subtree from a URL or Component.
- The Loader element instantiates an item from a component. The component to
- be instantiated may be specified directly by the \l sourceComponent
- property, or loaded from a URL via the \l source property.
+ Loader is used to dynamically load visual QML components. It can load a
+ QML file (using the \l source property) or a \l Component object (using
+ the \l sourceComponent property). It is useful for delaying the creation
+ of a component until it is required: for example, when a component should
+ be created on demand, or when a component should not be created
+ unnecessarily for performance reasons.
- 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:
+ Here is a Loader that loads "Page1.qml" as a component when the
+ \l MouseArea is clicked:
- \code
- import Qt 4.7
+ \snippet doc/src/snippets/declarative/loader/simple.qml 0
- Item {
- width: 200; height: 200
+ The loaded item can be accessed using the \l item property.
- MouseArea {
- anchors.fill: parent
- onClicked: pageLoader.source = "Page1.qml"
- }
+ Loader is like any other visual item and must be positioned and sized
+ accordingly to become visible. Once the component is loaded, the Loader
+ is automatically resized to the size of the component.
- Loader { id: pageLoader }
- }
- \endcode
+ If the \l source or \l sourceComponent changes, any previously instantiated
+ items are destroyed. Setting \l source to an empty string or setting
+ \l sourceComponent to \c undefined destroys the currently loaded item,
+ freeing resources and leaving the Loader empty.
+
+
+ \section2 Receiving signals from loaded items
- Note that Loader is like any other graphical Item and needs to be positioned
- and sized accordingly to become visible. When a component is loaded, the
- Loader is automatically resized to the size of the component.
+ Any signals emitted from the loaded item can be received using the
+ \l Connections element. For example, the following \c application.qml
+ loads \c MyItem.qml, and is able to receive the \c message signal from
+ the loaded item through a \l Connections object:
- If the Loader source is changed, any previous items instantiated
- will be destroyed. Setting \l source to an empty string, or setting
- sourceComponent to \e undefined
- will destroy the currently instantiated items, freeing resources
- and leaving the Loader empty. For example:
+ \table
+ \row
+ \o application.qml
+ \o MyItem.qml
+ \row
+ \o \snippet doc/src/snippets/declarative/loader/connections.qml 0
+ \o \snippet doc/src/snippets/declarative/loader/MyItem.qml 0
+ \endtable
- \code
- pageLoader.source = ""
- \endcode
+ Alternatively, since \c MyItem.qml is loaded within the scope of the
+ Loader, it could also directly call any function defined in the Loader or
+ its parent \l Item.
- or
- \code
- pageLoader.sourceComponent = undefined
- \endcode
+ \section2 Focus and key events
- unloads "Page1.qml" and frees resources consumed by it.
+ Loader is a focus scope. Its \l {Item::}{focus} property must be set to
+ \c true for any of its children to get the \e {active focus}. (See
+ \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page}
+ for more details.) Any key events received in the loaded item should likely
+ also be \l {KeyEvent::}{accepted} so they are not propagated to the Loader.
- Note that Loader is a focus scope. Its \c focus property must be set to \c true for any of its children
- to get the \e {active focus} (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
+ For example, the following \c application.qml loads \c KeyReader.qml when
+ the \l MouseArea is clicked. Notice the \l {Item::}{focus} property is
+ set to \c true for the Loader as well as the \l Item in the dynamically
+ loaded object:
+
+ \table
+ \row
+ \o application.qml
+ \o KeyReader.qml
+ \row
+ \o \snippet doc/src/snippets/declarative/loader/focus.qml 0
+ \o \snippet doc/src/snippets/declarative/loader/KeyReader.qml 0
+ \endtable
+
+ Once \c KeyReader.qml is loaded, it accepts key events and sets
+ \c event.accepted to \c true so that the event is not propagated to the
+ parent \l Rectangle.
\sa {dynamic-object-creation}{Dynamic Object Creation}
*/
@@ -197,8 +221,13 @@ QDeclarativeLoader::~QDeclarativeLoader()
/*!
\qmlproperty url Loader::source
- This property holds the URL of the QML component to
- instantiate.
+ This property holds the URL of the QML component to instantiate.
+
+ Note the QML component must be an \l Item-based component. Loader cannot
+ load non-visual components.
+
+ To unload the currently loaded item, set this property to an empty string,
+ or set \l sourceComponent to \c undefined.
\sa sourceComponent, status, progress
*/
@@ -257,7 +286,8 @@ void QDeclarativeLoader::setSource(const QUrl &url)
}
\endqml
- Note this value must hold a \l Component object; it cannot be a \l Item.
+ To unload the currently loaded item, set this property to an empty string,
+ or set \l sourceComponent to \c undefined.
\sa source, progress
*/
@@ -476,7 +506,7 @@ void QDeclarativeLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)
/*!
\qmlproperty Item Loader::item
- This property holds the top-level item created from source.
+ This property holds the top-level item that is currently loaded.
*/
QGraphicsObject *QDeclarativeLoader::item() const
{
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index dcdb9f6..2823888 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -180,6 +180,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate()
/*!
\qmlclass MouseArea QDeclarativeMouseArea
+ \ingroup qml-basic-interaction-elements
\since 4.7
\brief The MouseArea item enables simple mouse handling.
\inherits Item
diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp
index c48011d3..0c069ce 100644
--- a/src/declarative/graphicsitems/qdeclarativepath.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepath.cpp
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass PathElement QDeclarativePathElement
+ \ingroup qml-view-elements
\since 4.7
\brief PathElement is the base path type.
@@ -67,6 +68,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Path QDeclarativePath
+ \ingroup qml-view-elements
\since 4.7
\brief A Path object defines a path for use by \l PathView.
@@ -497,6 +499,7 @@ void QDeclarativeCurve::setY(qreal y)
/*!
\qmlclass PathAttribute QDeclarativePathAttribute
+ \ingroup qml-view-elements
\since 4.7
\brief The PathAttribute allows setting an attribute at a given position in a Path.
@@ -587,6 +590,7 @@ void QDeclarativePathAttribute::setValue(qreal value)
/*!
\qmlclass PathLine QDeclarativePathLine
+ \ingroup qml-view-elements
\since 4.7
\brief The PathLine defines a straight line.
@@ -627,6 +631,7 @@ void QDeclarativePathLine::addToPath(QPainterPath &path)
/*!
\qmlclass PathQuad QDeclarativePathQuad
+ \ingroup qml-view-elements
\since 4.7
\brief The PathQuad defines a quadratic Bezier curve with a control point.
@@ -713,6 +718,7 @@ void QDeclarativePathQuad::addToPath(QPainterPath &path)
/*!
\qmlclass PathCubic QDeclarativePathCubic
+ \ingroup qml-view-elements
\since 4.7
\brief The PathCubic defines a cubic Bezier curve with two control points.
@@ -828,6 +834,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path)
/*!
\qmlclass PathPercent QDeclarativePathPercent
+ \ingroup qml-view-elements
\since 4.7
\brief The PathPercent manipulates the way a path is interpreted.
@@ -886,6 +893,7 @@ void QDeclarativePathPercent::setValue(qreal value)
{
if (_value != value) {
_value = value;
+ emit valueChanged();
emit changed();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h
index 5ab5cfd..21e1b24 100644
--- a/src/declarative/graphicsitems/qdeclarativepath_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepath_p.h
@@ -190,13 +190,16 @@ private:
class Q_AUTOTEST_EXPORT QDeclarativePathPercent : public QDeclarativePathElement
{
Q_OBJECT
- Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed)
+ Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged)
public:
QDeclarativePathPercent(QObject *parent=0) : QDeclarativePathElement(parent) {}
qreal value() const;
void setValue(qreal value);
+signals:
+ void valueChanged();
+
private:
qreal _value;
};
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 380c6ad..4b97505 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -326,6 +326,7 @@ void QDeclarativePathViewPrivate::regenerate()
/*!
\qmlclass PathView QDeclarativePathView
+ \ingroup qml-view-elements
\since 4.7
\brief The PathView element lays out model-provided items on a path.
\inherits Item
@@ -479,7 +480,8 @@ void QDeclarativePathView::setModel(const QVariant &model)
connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset()));
connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*)));
}
- d->offset = qmlMod(d->offset, qreal(d->model->count()));
+ if (d->model->count())
+ d->offset = qmlMod(d->offset, qreal(d->model->count()));
if (d->offset < 0)
d->offset = d->model->count() + d->offset;
d->regenerate();
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index 179f13d..4ceb5d9 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -61,16 +61,37 @@ static const QDeclarativeItemPrivate::ChangeTypes watchedChanges
| QDeclarativeItemPrivate::Opacity
| QDeclarativeItemPrivate::Destroyed;
-void QDeclarativeBasePositionerPrivate::watchChanges(QDeclarativeItem *other)
+void QDeclarativeBasePositionerPrivate::watchChanges(QGraphicsObject *other)
{
- QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other));
- otherPrivate->addItemChangeListener(this, watchedChanges);
+ if (QGraphicsItemPrivate::get(other)->isDeclarativeItem) {
+ QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other));
+ otherPrivate->addItemChangeListener(this, watchedChanges);
+ } else {
+ Q_Q(QDeclarativeBasePositioner);
+ QObject::connect(other, SIGNAL(widthChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
+ QObject::connect(other, SIGNAL(heightChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
+ QObject::connect(other, SIGNAL(opacityChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
+ QObject::connect(other, SIGNAL(visibleChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
+ }
}
-void QDeclarativeBasePositionerPrivate::unwatchChanges(QDeclarativeItem* other)
+void QDeclarativeBasePositionerPrivate::unwatchChanges(QGraphicsObject* other)
{
- QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other));
- otherPrivate->removeItemChangeListener(this, watchedChanges);
+ if (QGraphicsItemPrivate::get(other)->isDeclarativeItem) {
+ QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other));
+ otherPrivate->removeItemChangeListener(this, watchedChanges);
+ } else {
+ Q_Q(QDeclarativeBasePositioner);
+ QObject::disconnect(other, SIGNAL(widthChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
+ QObject::disconnect(other, SIGNAL(heightChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
+ QObject::disconnect(other, SIGNAL(opacityChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
+ QObject::disconnect(other, SIGNAL(visibleChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
+ }
+}
+
+void QDeclarativeBasePositioner::graphicsWidgetGeometryChanged()
+{
+ prePositioning();
}
/*!
@@ -174,16 +195,16 @@ QVariant QDeclarativeBasePositioner::itemChange(GraphicsItemChange change,
Q_D(QDeclarativeBasePositioner);
if (change == ItemChildAddedChange){
QGraphicsItem* item = value.value<QGraphicsItem*>();
- QDeclarativeItem* child = 0;
+ QGraphicsObject* child = 0;
if(item)
- child = qobject_cast<QDeclarativeItem*>(item->toGraphicsObject());
+ child = item->toGraphicsObject();
if (child)
prePositioning();
} else if (change == ItemChildRemovedChange) {
QGraphicsItem* item = value.value<QGraphicsItem*>();
- QDeclarativeItem* child = 0;
+ QGraphicsObject* child = 0;
if(item)
- child = qobject_cast<QDeclarativeItem*>(item->toGraphicsObject());
+ child = item->toGraphicsObject();
if (child) {
QDeclarativeBasePositioner::PositionedItem posItem(child);
int idx = positionedItems.find(posItem);
@@ -194,7 +215,6 @@ QVariant QDeclarativeBasePositioner::itemChange(GraphicsItemChange change,
prePositioning();
}
}
-
return QDeclarativeItem::itemChange(change, value);
}
@@ -216,10 +236,10 @@ void QDeclarativeBasePositioner::prePositioning()
QPODVector<PositionedItem,8> oldItems;
positionedItems.copyAndClear(oldItems);
for (int ii = 0; ii < children.count(); ++ii) {
- QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(ii));
+ QGraphicsObject *child = children.at(ii)->toGraphicsObject();
if (!child)
continue;
- QDeclarativeItemPrivate *childPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(child));
+ QGraphicsItemPrivate *childPrivate = static_cast<QGraphicsItemPrivate*>(QGraphicsItemPrivate::get(child));
PositionedItem *item = 0;
PositionedItem posItem(child);
int wIdx = oldItems.find(posItem);
@@ -302,14 +322,15 @@ void QDeclarativeBasePositioner::finishApplyTransitions()
d->moveActions.clear();
}
-static inline bool isInvisible(QDeclarativeItem *child)
+static inline bool isInvisible(QGraphicsObject *child)
{
- QDeclarativeItemPrivate *childPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(child));
- return child->opacity() == 0.0 || childPrivate->explicitlyHidden || !child->width() || !child->height();
+ QGraphicsItemPrivate *childPrivate = static_cast<QGraphicsItemPrivate*>(QGraphicsItemPrivate::get(child));
+ return child->opacity() == 0.0 || childPrivate->explicitlyHidden || !childPrivate->width() || !childPrivate->height();
}
/*!
\qmlclass Column QDeclarativeColumn
+ \ingroup qml-positioning-elements
\since 4.7
\brief The Column item arranges its children vertically.
\inherits Item
@@ -440,9 +461,9 @@ void QDeclarativeColumn::doPositioning(QSizeF *contentSize)
if(child.item->y() != voffset)
positionY(voffset, child);
- contentSize->setWidth(qMax(contentSize->width(), child.item->width()));
+ contentSize->setWidth(qMax(contentSize->width(), QGraphicsItemPrivate::get(child.item)->width()));
- voffset += child.item->height();
+ voffset += QGraphicsItemPrivate::get(child.item)->height();
voffset += spacing();
}
@@ -454,8 +475,8 @@ void QDeclarativeColumn::reportConflictingAnchors()
QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate*>(QDeclarativeBasePositionerPrivate::get(this));
for (int ii = 0; ii < positionedItems.count(); ++ii) {
const PositionedItem &child = positionedItems.at(ii);
- if (child.item) {
- QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors;
+ if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) {
+ QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors;
if (anchors) {
QDeclarativeAnchors::Anchors usedAnchors = anchors->usedAnchors();
if (usedAnchors & QDeclarativeAnchors::TopAnchor ||
@@ -475,6 +496,7 @@ void QDeclarativeColumn::reportConflictingAnchors()
/*!
\qmlclass Row QDeclarativeRow
+ \ingroup qml-positioning-elements
\since 4.7
\brief The Row item arranges its children horizontally.
\inherits Item
@@ -579,9 +601,9 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize)
if(child.item->x() != hoffset)
positionX(hoffset, child);
- contentSize->setHeight(qMax(contentSize->height(), child.item->height()));
+ contentSize->setHeight(qMax(contentSize->height(), QGraphicsItemPrivate::get(child.item)->height()));
- hoffset += child.item->width();
+ hoffset += QGraphicsItemPrivate::get(child.item)->width();
hoffset += spacing();
}
@@ -593,8 +615,8 @@ void QDeclarativeRow::reportConflictingAnchors()
QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate*>(QDeclarativeBasePositionerPrivate::get(this));
for (int ii = 0; ii < positionedItems.count(); ++ii) {
const PositionedItem &child = positionedItems.at(ii);
- if (child.item) {
- QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors;
+ if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) {
+ QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors;
if (anchors) {
QDeclarativeAnchors::Anchors usedAnchors = anchors->usedAnchors();
if (usedAnchors & QDeclarativeAnchors::LeftAnchor ||
@@ -613,6 +635,7 @@ void QDeclarativeRow::reportConflictingAnchors()
/*!
\qmlclass Grid QDeclarativeGrid
+ \ingroup qml-positioning-elements
\since 4.7
\brief The Grid item positions its children in a grid.
\inherits Item
@@ -814,10 +837,11 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize)
const PositionedItem &child = positionedItems.at(childIndex++);
if (!child.item || isInvisible(child.item))
continue;
- if (child.item->width() > maxColWidth[j])
- maxColWidth[j] = child.item->width();
- if (child.item->height() > maxRowHeight[i])
- maxRowHeight[i] = child.item->height();
+ QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item);
+ if (childPrivate->width() > maxColWidth[j])
+ maxColWidth[j] = childPrivate->width();
+ if (childPrivate->height() > maxRowHeight[i])
+ maxRowHeight[i] = childPrivate->height();
}
}
} else {
@@ -833,10 +857,11 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize)
const PositionedItem &child = positionedItems.at(childIndex++);
if (!child.item || isInvisible(child.item))
continue;
- if (child.item->width() > maxColWidth[j])
- maxColWidth[j] = child.item->width();
- if (child.item->height() > maxRowHeight[i])
- maxRowHeight[i] = child.item->height();
+ QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item);
+ if (childPrivate->width() > maxColWidth[j])
+ maxColWidth[j] = childPrivate->width();
+ if (childPrivate->height() > maxRowHeight[i])
+ maxRowHeight[i] = childPrivate->height();
}
}
}
@@ -855,7 +880,7 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize)
}
if (m_flow == LeftToRight) {
- contentSize->setWidth(qMax(contentSize->width(), xoffset + child.item->width()));
+ contentSize->setWidth(qMax(contentSize->width(), xoffset + QGraphicsItemPrivate::get(child.item)->width()));
contentSize->setHeight(yoffset + maxRowHeight[curRow]);
xoffset+=maxColWidth[curCol]+spacing();
@@ -869,7 +894,7 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize)
break;
}
} else {
- contentSize->setHeight(qMax(contentSize->height(), yoffset + child.item->height()));
+ contentSize->setHeight(qMax(contentSize->height(), yoffset + QGraphicsItemPrivate::get(child.item)->height()));
contentSize->setWidth(xoffset + maxColWidth[curCol]);
yoffset+=maxRowHeight[curRow]+spacing();
@@ -891,8 +916,8 @@ void QDeclarativeGrid::reportConflictingAnchors()
QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate*>(QDeclarativeBasePositionerPrivate::get(this));
for (int ii = 0; ii < positionedItems.count(); ++ii) {
const PositionedItem &child = positionedItems.at(ii);
- if (child.item) {
- QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors;
+ if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) {
+ QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors;
if (anchors && (anchors->usedAnchors() || anchors->fill() || anchors->centerIn())) {
d->anchorConflict = true;
break;
@@ -905,6 +930,7 @@ void QDeclarativeGrid::reportConflictingAnchors()
/*!
\qmlclass Flow QDeclarativeFlow
+ \ingroup qml-positioning-elements
\since 4.7
\brief The Flow item arranges its children side by side, wrapping as necessary.
\inherits Item
@@ -1026,14 +1052,15 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize)
if (!child.item || isInvisible(child.item))
continue;
+ QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item);
if (d->flow == LeftToRight) {
- if (widthValid() && hoffset && hoffset + child.item->width() > width()) {
+ if (widthValid() && hoffset && hoffset + childPrivate->width() > width()) {
hoffset = 0;
voffset += linemax + spacing();
linemax = 0;
}
} else {
- if (heightValid() && voffset && voffset + child.item->height() > height()) {
+ if (heightValid() && voffset && voffset + childPrivate->height() > height()) {
voffset = 0;
hoffset += linemax + spacing();
linemax = 0;
@@ -1045,17 +1072,17 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize)
positionY(voffset, child);
}
- contentSize->setWidth(qMax(contentSize->width(), hoffset + child.item->width()));
- contentSize->setHeight(qMax(contentSize->height(), voffset + child.item->height()));
+ contentSize->setWidth(qMax(contentSize->width(), hoffset + childPrivate->width()));
+ contentSize->setHeight(qMax(contentSize->height(), voffset + childPrivate->height()));
if (d->flow == LeftToRight) {
- hoffset += child.item->width();
+ hoffset += childPrivate->width();
hoffset += spacing();
- linemax = qMax(linemax, qCeil(child.item->height()));
+ linemax = qMax(linemax, qCeil(childPrivate->height()));
} else {
- voffset += child.item->height();
+ voffset += childPrivate->height();
voffset += spacing();
- linemax = qMax(linemax, qCeil(child.item->width()));
+ linemax = qMax(linemax, qCeil(childPrivate->width()));
}
}
}
@@ -1065,8 +1092,8 @@ void QDeclarativeFlow::reportConflictingAnchors()
Q_D(QDeclarativeFlow);
for (int ii = 0; ii < positionedItems.count(); ++ii) {
const PositionedItem &child = positionedItems.at(ii);
- if (child.item) {
- QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors;
+ if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) {
+ QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors;
if (anchors && (anchors->usedAnchors() || anchors->fill() || anchors->centerIn())) {
d->anchorConflict = true;
break;
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
index c03e518..f9ecc0a 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
@@ -91,14 +91,16 @@ Q_SIGNALS:
protected Q_SLOTS:
void prePositioning();
+ void graphicsWidgetGeometryChanged();
protected:
virtual void doPositioning(QSizeF *contentSize)=0;
virtual void reportConflictingAnchors()=0;
- struct PositionedItem {
- PositionedItem(QDeclarativeItem *i) : item(i), isNew(false), isVisible(true) {}
+ class PositionedItem {
+ public :
+ PositionedItem(QGraphicsObject *i) : item(i), isNew(false), isVisible(true) {}
bool operator==(const PositionedItem &other) const { return other.item == item; }
- QDeclarativeItem *item;
+ QGraphicsObject *item;
bool isNew;
bool isVisible;
};
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
index 822079b..35946e9 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
@@ -94,8 +94,8 @@ public:
QDeclarativeTransitionManager addTransitionManager;
QDeclarativeTransitionManager moveTransitionManager;
- void watchChanges(QDeclarativeItem *other);
- void unwatchChanges(QDeclarativeItem* other);
+ void watchChanges(QGraphicsObject *other);
+ void unwatchChanges(QGraphicsObject* other);
bool queuedPositioning : 1;
bool doingPositioning : 1;
bool anchorConflict : 1;
@@ -123,6 +123,7 @@ public:
if (newGeometry.size() != oldGeometry.size())
q->prePositioning();
}
+
virtual void itemVisibilityChanged(QDeclarativeItem *)
{
schedulePositioning();
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index c49be46..5990c2d 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -84,6 +84,7 @@ void QDeclarativePen::setWidth(int w)
/*!
\qmlclass GradientStop QDeclarativeGradientStop
+ \ingroup qml-basic-visual-elements
\since 4.7
\brief The GradientStop item defines the color at a position in a Gradient
@@ -105,6 +106,7 @@ void QDeclarativeGradientStop::updateGradient()
/*!
\qmlclass Gradient QDeclarativeGradient
+ \ingroup qml-basic-visual-elements
\since 4.7
\brief The Gradient item defines a gradient fill.
@@ -152,6 +154,7 @@ void QDeclarativeGradient::doUpdate()
/*!
\qmlclass Rectangle QDeclarativeRectangle
+ \ingroup qml-basic-visual-elements
\since 4.7
\brief The Rectangle item allows you to add rectangles to a scene.
\inherits Item
diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
index 68e7e9a..4a951a2 100644
--- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
@@ -62,6 +62,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate()
/*!
\qmlclass Repeater QDeclarativeRepeater
+ \ingroup qml-utility-elements
\since 4.7
\inherits Item
@@ -245,8 +246,8 @@ void QDeclarativeRepeater::setModel(const QVariant &model)
connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
*/
regenerate();
- emit countChanged();
}
+ emit countChanged();
}
/*!
@@ -377,6 +378,7 @@ void QDeclarativeRepeater::itemsInserted(int index, int count)
d->deletables.insert(modelIndex, item);
}
}
+ emit countChanged();
}
void QDeclarativeRepeater::itemsRemoved(int index, int count)
@@ -391,6 +393,7 @@ void QDeclarativeRepeater::itemsRemoved(int index, int count)
else
break;
}
+ emit countChanged();
}
void QDeclarativeRepeater::itemsMoved(int from, int to, int count)
@@ -420,6 +423,7 @@ void QDeclarativeRepeater::modelReset()
if (!isComponentComplete())
return;
regenerate();
+ emit countChanged();
}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index ab2be9c..e5ad743 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -162,7 +162,8 @@ QSet<QUrl> QTextDocumentWithImageResources::errors;
/*!
\qmlclass Text QDeclarativeText
- \since 4.7
+ \ingroup qml-basic-visual-elements
+ \since 4.7
\brief The Text item allows you to add formatted text to a scene.
\inherits Item
@@ -1046,10 +1047,10 @@ QPixmap QDeclarativeTextPrivate::richTextImage(bool drawStyle)
QAbstractTextDocumentLayout::PaintContext context;
+ QTextOption oldOption(doc->defaultTextOption());
if (drawStyle) {
context.palette.setColor(QPalette::Text, styleColor);
- // ### Do we really want this?
- QTextOption colorOption;
+ QTextOption colorOption(doc->defaultTextOption());
colorOption.setFlags(QTextOption::SuppressColors);
doc->setDefaultTextOption(colorOption);
} else {
@@ -1057,7 +1058,7 @@ QPixmap QDeclarativeTextPrivate::richTextImage(bool drawStyle)
}
doc->documentLayout()->draw(&p, context);
if (drawStyle)
- doc->setDefaultTextOption(QTextOption());
+ doc->setDefaultTextOption(oldOption);
return img;
}
@@ -1217,7 +1218,7 @@ void QDeclarativeText::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (!d->richText || !d->doc || d->doc->documentLayout()->anchorAt(event->pos()).isEmpty()) {
event->setAccepted(false);
- d->activeLink = QString();
+ d->activeLink.clear();
} else {
d->activeLink = d->doc->documentLayout()->anchorAt(event->pos());
}
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 8117676..b8e8726 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass TextEdit QDeclarativeTextEdit
+ \ingroup qml-basic-visual-elements
\since 4.7
\brief The TextEdit item displays multiple lines of editable formatted text.
\inherits Item
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 90f5a70..b4f36f4 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass TextInput QDeclarativeTextInput
+ \ingroup qml-basic-visual-elements
\since 4.7
\brief The TextInput item displays an editable line of text.
\inherits Item
@@ -276,8 +277,10 @@ void QDeclarativeTextInput::setSelectionColor(const QColor &color)
QPalette p = d->control->palette();
p.setColor(QPalette::Highlight, d->selectionColor);
d->control->setPalette(p);
- clearCache();
- update();
+ if (d->control->hasSelectedText()) {
+ clearCache();
+ update();
+ }
emit selectionColorChanged(color);
}
@@ -302,8 +305,10 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color)
QPalette p = d->control->palette();
p.setColor(QPalette::HighlightedText, d->selectedTextColor);
d->control->setPalette(p);
- clearCache();
- update();
+ if (d->control->hasSelectedText()) {
+ clearCache();
+ update();
+ }
emit selectedTextColorChanged(color);
}
@@ -561,6 +566,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b)
/*!
\qmlclass IntValidator QIntValidator
+ \ingroup qml-basic-visual-elements
This element provides a validator for integer values.
*/
@@ -579,6 +585,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b)
/*!
\qmlclass DoubleValidator QDoubleValidator
+ \ingroup qml-basic-visual-elements
This element provides a validator for non-integer numbers.
*/
@@ -617,6 +624,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b)
/*!
\qmlclass RegExpValidator QRegExpValidator
+ \ingroup qml-basic-visual-elements
This element provides a validator, which counts as valid any string which
matches a specified regular expression.
@@ -1229,8 +1237,12 @@ void QDeclarativeTextInput::setPasswordCharacter(const QString &str)
Q_D(QDeclarativeTextInput);
if(str.length() < 1)
return;
- emit passwordCharacterChanged();
d->control->setPasswordCharacter(str.constData()[0]);
+ EchoMode echoMode_ = echoMode();
+ if (echoMode_ == Password || echoMode_ == PasswordEchoOnEdit) {
+ updateSize();
+ }
+ emit passwordCharacterChanged();
}
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index a489b5a..65b14cf 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -128,6 +128,7 @@ public:
/*!
\qmlclass VisualItemModel QDeclarativeVisualItemModel
+ \ingroup qml-working-with-data
\since 4.7
\brief The VisualItemModel allows items to be provided to a view.
@@ -237,20 +238,6 @@ QString QDeclarativeVisualItemModel::stringValue(int index, const QString &name)
return QDeclarativeEngine::contextForObject(d->children.at(index).item)->contextProperty(name).toString();
}
-QVariant QDeclarativeVisualItemModel::evaluate(int index, const QString &expression, QObject *objectContext)
-{
- Q_D(QDeclarativeVisualItemModel);
- if (index < 0 || index >= d->children.count())
- return QVariant();
- QDeclarativeContext *ccontext = qmlContext(this);
- QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext);
- ctxt->setContextObject(d->children.at(index).item);
- QDeclarativeExpression e(ctxt, objectContext, expression);
- QVariant value = e.evaluate();
- delete ctxt;
- return value;
-}
-
int QDeclarativeVisualItemModel::indexOf(QDeclarativeItem *item, QObject *) const
{
Q_D(const QDeclarativeVisualItemModel);
@@ -644,6 +631,7 @@ QDeclarativeVisualDataModelData *QDeclarativeVisualDataModelPrivate::data(QObjec
/*!
\qmlclass VisualDataModel QDeclarativeVisualDataModel
+ \ingroup qml-working-with-data
\brief The VisualDataModel encapsulates a model and delegate
A VisualDataModel encapsulates a model and the delegate that will
@@ -726,6 +714,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model)
QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)),
this, SLOT(_q_rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)));
QObject::disconnect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset()));
+ d->m_abstractItemModel = 0;
} else if (d->m_visualItemModel) {
QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsInserted(int,int)),
this, SIGNAL(itemsInserted(int,int)));
@@ -977,7 +966,7 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q
Q_ASSERT(p->declarativeData);
QDeclarativeData *d = static_cast<QDeclarativeData*>(p->declarativeData);
if (d->ownContext && d->context)
- d->context->clearExpressions();
+ d->context->clearContext();
if (inPackage) {
emit destroyingPackage(qobject_cast<QDeclarativePackage*>(obj));
@@ -1165,38 +1154,6 @@ QString QDeclarativeVisualDataModel::stringValue(int index, const QString &name)
return val;
}
-QVariant QDeclarativeVisualDataModel::evaluate(int index, const QString &expression, QObject *objectContext)
-{
- Q_D(QDeclarativeVisualDataModel);
- if (d->m_visualItemModel)
- return d->m_visualItemModel->evaluate(index, expression, objectContext);
-
- if ((!d->m_listModelInterface && !d->m_abstractItemModel) || !d->m_delegate)
- return QVariant();
-
- QVariant value;
- QObject *nobj = d->m_cache.item(index);
- if (nobj) {
- QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(nobj);
- if (item) {
- QDeclarativeExpression e(qmlContext(item), objectContext, expression);
- value = e.evaluate();
- }
- } else {
- QDeclarativeContext *ccontext = d->m_context;
- if (!ccontext) ccontext = qmlContext(this);
- QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext);
- QDeclarativeVisualDataModelData *data = new QDeclarativeVisualDataModelData(index, this);
- ctxt->setContextObject(data);
- QDeclarativeExpression e(ctxt, objectContext, expression);
- value = e.evaluate();
- delete data;
- delete ctxt;
- }
-
- return value;
-}
-
int QDeclarativeVisualDataModel::indexOf(QDeclarativeItem *item, QObject *) const
{
QVariant val = QDeclarativeEngine::contextForObject(item)->contextProperty(QLatin1String("index"));
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
index d5c0de2..50d2c53 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
@@ -79,7 +79,6 @@ public:
virtual ReleaseFlags release(QDeclarativeItem *item) = 0;
virtual bool completePending() const = 0;
virtual void completeItem() = 0;
- virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext) = 0;
virtual QString stringValue(int, const QString &) { return QString(); }
virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const = 0;
@@ -122,7 +121,6 @@ public:
virtual bool completePending() const;
virtual void completeItem();
virtual QString stringValue(int index, const QString &role);
- virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext);
virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const;
@@ -177,7 +175,6 @@ public:
bool completePending() const;
void completeItem();
virtual QString stringValue(int index, const QString &role);
- QVariant evaluate(int index, const QString &expression, QObject *objectContext);
int indexOf(QDeclarativeItem *item, QObject *objectContext) const;
diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp
index 65a6af2..cd08658 100644
--- a/src/declarative/qml/parser/qdeclarativejslexer.cpp
+++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp
@@ -120,7 +120,7 @@ Lexer::~Lexer()
void Lexer::setCode(const QString &c, int lineno)
{
- errmsg = QString();
+ errmsg.clear();
yylineno = lineno;
yycolumn = 1;
restrKeyword = false;
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 5f4a063..d2d1f19 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -54,6 +54,7 @@
#include "private/qdeclarativeglobal_p.h"
#include "private/qdeclarativescriptparser_p.h"
#include "private/qdeclarativedebugtrace_p.h"
+#include "private/qdeclarativeenginedebug_p.h"
#include <QStack>
#include <QStringList>
@@ -104,6 +105,7 @@ class QByteArray;
/*!
\qmlclass Component QDeclarativeComponent
+ \ingroup qml-utility-elements
\since 4.7
\brief The Component element encapsulates a QML component definition.
@@ -599,7 +601,7 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
property, or else the object will not be visible.
Dynamically created instances can be deleted with the \c destroy() method.
- See \l {Dynamic Object Management} for more information.
+ See \l {Dynamic Object Management in QML} for more information.
*/
/*!
@@ -764,8 +766,11 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons
QObject *rv = begin(ctxt, ep, cc, start, count, &state, bindings);
- if (rv && !context->isInternal && ep->isDebugging)
- context->asQDeclarativeContextPrivate()->instances.append(rv);
+ if (ep->isDebugging && rv) {
+ if (!context->isInternal)
+ context->asQDeclarativeContextPrivate()->instances.append(rv);
+ QDeclarativeEngineDebugServer::instance()->objectCreated(engine, rv);
+ }
return rv;
}
diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
index 26b2a9b..2e77534 100644
--- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp
+++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
@@ -544,7 +544,7 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData
}
- foreach (QDeclarativeScriptParser::Import imp, unit->data.imports()) {
+ foreach (const QDeclarativeScriptParser::Import &imp, unit->data.imports()) {
QDeclarativeDirComponents qmldircomponentsnetwork;
if (imp.type == QDeclarativeScriptParser::Import::Script)
continue;
diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp
index a58dc6c..a3b16d9 100644
--- a/src/declarative/qml/qdeclarativecontext.cpp
+++ b/src/declarative/qml/qdeclarativecontext.cpp
@@ -533,8 +533,21 @@ void QDeclarativeContextData::invalidate()
parent = 0;
}
-void QDeclarativeContextData::clearExpressions()
+void QDeclarativeContextData::clearContext()
{
+ if (engine) {
+ while (componentAttached) {
+ QDeclarativeComponentAttached *a = componentAttached;
+ componentAttached = a->next;
+ if (componentAttached) componentAttached->prev = &componentAttached;
+
+ a->next = 0;
+ a->prev = 0;
+
+ emit a->destruction();
+ }
+ }
+
QDeclarativeAbstractExpression *expression = expressions;
while (expression) {
QDeclarativeAbstractExpression *nextExpression = expression->m_nextExpression;
@@ -555,7 +568,7 @@ void QDeclarativeContextData::destroy()
if (engine) invalidate();
- clearExpressions();
+ clearContext();
while (contextObjects) {
QDeclarativeData *co = contextObjects;
diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h
index c5a039a..6c14feb 100644
--- a/src/declarative/qml/qdeclarativecontext_p.h
+++ b/src/declarative/qml/qdeclarativecontext_p.h
@@ -113,7 +113,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeContextData
public:
QDeclarativeContextData();
QDeclarativeContextData(QDeclarativeContext *);
- void clearExpressions();
+ void clearContext();
void destroy();
void invalidate();
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 3fe89a5..4d244c5 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -114,6 +114,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass QtObject QObject
+ \ingroup qml-utility-elements
\since 4.7
\brief The QtObject element is the most basic element in QML.
@@ -185,6 +186,7 @@ void QDeclarativeEnginePrivate::defineModule()
/*!
\qmlclass QML:Qt QDeclarativeEnginePrivate
+ \ingroup qml-utility-elements
\brief The QML global Qt object provides useful enums and functions from Qt.
\keyword QmlGlobalQtObject
@@ -241,7 +243,7 @@ The format specification is described at \l{QML:Qt::formatDateTime}{Qt.formatDat
\section1 Dynamic Object Creation
The following functions on the global object allow you to dynamically create QML
-items from files or strings. See \l{Dynamic Object Management} for an overview
+items from files or strings. See \l{Dynamic Object Management in QML} for an overview
of their use.
\list
@@ -436,8 +438,6 @@ void QDeclarativeEnginePrivate::clear(SimpleList<QDeclarativeParserStatus> &pss)
pss.clear();
}
-Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer);
-
void QDeclarativePrivate::qdeclarativeelement_destructor(QObject *o)
{
QObjectPrivate *p = QObjectPrivate::get(o);
@@ -479,9 +479,8 @@ void QDeclarativeEnginePrivate::init()
if (QCoreApplication::instance()->thread() == q->thread() &&
QDeclarativeEngineDebugServer::isDebuggingEnabled()) {
- qmlEngineDebugServer();
isDebugging = true;
- QDeclarativeEngineDebugServer::addEngine(q);
+ QDeclarativeEngineDebugServer::instance()->addEngine(q);
}
}
@@ -545,11 +544,11 @@ QDeclarativeEngine::~QDeclarativeEngine()
{
Q_D(QDeclarativeEngine);
if (d->isDebugging)
- QDeclarativeEngineDebugServer::remEngine(this);
+ QDeclarativeEngineDebugServer::instance()->remEngine(this);
}
/*! \fn void QDeclarativeEngine::quit()
- This signal is emitted when the QDeclarativeEngine quits.
+ This signal is emitted when the QML loaded by the engine would like to quit.
*/
/*! \fn void QDeclarativeEngine::warnings(const QList<QDeclarativeError> &warnings)
@@ -672,7 +671,7 @@ void QDeclarativeEngine::addImageProvider(const QString &providerId, QDeclarativ
{
Q_D(QDeclarativeEngine);
QMutexLocker locker(&d->mutex);
- d->imageProviders.insert(providerId, provider);
+ d->imageProviders.insert(providerId, QSharedPointer<QDeclarativeImageProvider>(provider));
}
/*!
@@ -682,7 +681,7 @@ QDeclarativeImageProvider *QDeclarativeEngine::imageProvider(const QString &prov
{
Q_D(const QDeclarativeEngine);
QMutexLocker locker(&d->mutex);
- return d->imageProviders.value(providerId);
+ return d->imageProviders.value(providerId).data();
}
/*!
@@ -696,13 +695,14 @@ void QDeclarativeEngine::removeImageProvider(const QString &providerId)
{
Q_D(QDeclarativeEngine);
QMutexLocker locker(&d->mutex);
- delete d->imageProviders.take(providerId);
+ d->imageProviders.take(providerId);
}
QDeclarativeImageProvider::ImageType QDeclarativeEnginePrivate::getImageProviderType(const QUrl &url)
{
QMutexLocker locker(&mutex);
- QDeclarativeImageProvider *provider = imageProviders.value(url.host());
+ QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host());
+ locker.unlock();
if (provider)
return provider->imageType();
return static_cast<QDeclarativeImageProvider::ImageType>(-1);
@@ -712,7 +712,8 @@ QImage QDeclarativeEnginePrivate::getImageFromProvider(const QUrl &url, QSize *s
{
QMutexLocker locker(&mutex);
QImage image;
- QDeclarativeImageProvider *provider = imageProviders.value(url.host());
+ QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host());
+ locker.unlock();
if (provider)
image = provider->requestImage(url.path().mid(1), size, req_size);
return image;
@@ -722,7 +723,8 @@ QPixmap QDeclarativeEnginePrivate::getPixmapFromProvider(const QUrl &url, QSize
{
QMutexLocker locker(&mutex);
QPixmap pixmap;
- QDeclarativeImageProvider *provider = imageProviders.value(url.host());
+ QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host());
+ locker.unlock();
if (provider)
pixmap = provider->requestPixmap(url.path().mid(1), size, req_size);
return pixmap;
@@ -1119,7 +1121,7 @@ For example:
\snippet doc/src/snippets/declarative/createComponent-simple.qml 0
-See \l {Dynamic Object Management} for more information on using this function.
+See \l {Dynamic Object Management in QML} for more information on using this function.
To create a QML object from an arbitrary string of QML (instead of a file),
use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}.
@@ -1171,7 +1173,7 @@ Note that this function returns immediately, and therefore may not work if
the \a qml string loads new components (that is, external QML files that have not yet been loaded).
If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead.
-See \l {Dynamic Object Management} for more information on using this function.
+See \l {Dynamic Object Management in QML} for more information on using this function.
*/
QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine)
@@ -2074,7 +2076,7 @@ void QDeclarativeEnginePrivate::registerCompositeType(QDeclarativeCompiledData *
QByteArray name = data->root->className();
QByteArray ptr = name + '*';
- QByteArray lst = "QDeclarativeListProperty<" + name + ">";
+ QByteArray lst = "QDeclarativeListProperty<" + name + '>';
int ptr_type = QMetaType::registerType(ptr.constData(), voidptr_destructor,
voidptr_constructor);
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index 3b5dd5a..db2db35 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -232,7 +232,7 @@ public:
mutable QNetworkAccessManager *networkAccessManager;
mutable QDeclarativeNetworkAccessManagerFactory *networkAccessManagerFactory;
- QHash<QString,QDeclarativeImageProvider*> imageProviders;
+ QHash<QString,QSharedPointer<QDeclarativeImageProvider> > imageProviders;
QDeclarativeImageProvider::ImageType getImageProviderType(const QUrl &url);
QImage getImageFromProvider(const QUrl &url, QSize *size, const QSize& req_size);
QPixmap getPixmapFromProvider(const QUrl &url, QSize *size, const QSize& req_size);
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 1837366..ed28185 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -58,7 +58,13 @@
QT_BEGIN_NAMESPACE
-QList<QDeclarativeEngine *> QDeclarativeEngineDebugServer::m_engines;
+Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer);
+
+QDeclarativeEngineDebugServer *QDeclarativeEngineDebugServer::instance()
+{
+ return qmlEngineDebugServer();
+}
+
QDeclarativeEngineDebugServer::QDeclarativeEngineDebugServer(QObject *parent)
: QDeclarativeDebugService(QLatin1String("QDeclarativeEngine"), parent),
m_watch(new QDeclarativeWatcher(this))
@@ -182,7 +188,7 @@ QVariant QDeclarativeEngineDebugServer::valueContents(const QVariant &value) con
}
void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message,
- QObject *object, bool recur)
+ QObject *object, bool recur, bool dumpProperties)
{
message << objectData(object);
@@ -209,6 +215,8 @@ void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message,
continue;
QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child);
if (signal) {
+ if (!dumpProperties)
+ continue;
QDeclarativeObjectProperty prop;
prop.type = QDeclarativeObjectProperty::SignalProperty;
prop.hasNotifySignal = false;
@@ -229,12 +237,17 @@ void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message,
fakeProperties << prop;
} else {
if (recur)
- buildObjectDump(message, child, recur);
+ buildObjectDump(message, child, recur, dumpProperties);
else
message << objectData(child);
}
}
+ if (!dumpProperties) {
+ message << 0;
+ return;
+ }
+
message << (object->metaObject()->propertyCount() + fakeProperties.count());
for (int ii = 0; ii < object->metaObject()->propertyCount(); ++ii)
@@ -257,8 +270,7 @@ void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message, QDecla
QDeclarativeContextData *child = p->childContexts;
while (child) {
- if (!child->isInternal)
- ++count;
+ ++count;
child = child->nextChild;
}
@@ -266,8 +278,7 @@ void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message, QDecla
child = p->childContexts;
while (child) {
- if (!child->isInternal)
- buildObjectList(message, child->asQDeclarativeContext());
+ buildObjectList(message, child->asQDeclarativeContext());
child = child->nextChild;
}
@@ -372,8 +383,9 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message)
int queryId;
int objectId;
bool recurse;
+ bool dumpProperties = true;
- ds >> queryId >> objectId >> recurse;
+ ds >> queryId >> objectId >> recurse >> dumpProperties;
QObject *object = QDeclarativeDebugService::objectForId(objectId);
@@ -382,7 +394,7 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message)
rs << QByteArray("FETCH_OBJECT_R") << queryId;
if (object)
- buildObjectDump(rs, object, recurse);
+ buildObjectDump(rs, object, recurse, dumpProperties);
sendMessage(reply);
} else if (type == "WATCH_OBJECT") {
@@ -592,4 +604,19 @@ void QDeclarativeEngineDebugServer::remEngine(QDeclarativeEngine *engine)
m_engines.removeAll(engine);
}
+void QDeclarativeEngineDebugServer::objectCreated(QDeclarativeEngine *engine, QObject *object)
+{
+ Q_ASSERT(engine);
+ Q_ASSERT(m_engines.contains(engine));
+
+ int engineId = QDeclarativeDebugService::idForObject(engine);
+ int objectId = QDeclarativeDebugService::idForObject(object);
+
+ QByteArray reply;
+ QDataStream rs(&reply, QIODevice::WriteOnly);
+
+ rs << QByteArray("OBJECT_CREATED") << engineId << objectId;
+ sendMessage(reply);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h
index ea35b40..613f1fe 100644
--- a/src/declarative/qml/qdeclarativeenginedebug_p.h
+++ b/src/declarative/qml/qdeclarativeenginedebug_p.h
@@ -92,8 +92,11 @@ public:
bool hasNotifySignal;
};
- static void addEngine(QDeclarativeEngine *);
- static void remEngine(QDeclarativeEngine *);
+ void addEngine(QDeclarativeEngine *);
+ void remEngine(QDeclarativeEngine *);
+ void objectCreated(QDeclarativeEngine *, QObject *);
+
+ static QDeclarativeEngineDebugServer *instance();
protected:
virtual void messageReceived(const QByteArray &);
@@ -103,7 +106,7 @@ private Q_SLOTS:
private:
void buildObjectList(QDataStream &, QDeclarativeContext *);
- void buildObjectDump(QDataStream &, QObject *, bool);
+ void buildObjectDump(QDataStream &, QObject *, bool, bool);
QDeclarativeObjectData objectData(QObject *);
QDeclarativeObjectProperty propertyData(QObject *, int);
QVariant valueContents(const QVariant &defaultValue) const;
@@ -111,7 +114,7 @@ private:
void resetBinding(int objectId, const QString &propertyName);
void setMethodBody(int objectId, const QString &method, const QString &body);
- static QList<QDeclarativeEngine *> m_engines;
+ QList<QDeclarativeEngine *> m_engines;
QDeclarativeWatcher *m_watch;
};
Q_DECLARATIVE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugServer::QDeclarativeObjectData &);
diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp
index ea68327..ef31be7 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.cpp
+++ b/src/declarative/qml/qdeclarativeimageprovider.cpp
@@ -161,7 +161,9 @@ QDeclarativeImageProvider::QDeclarativeImageProvider(ImageType type)
}
/*!
- \internal
+ Destroys the QDeclarativeImageProvider
+
+ \note The destructor of your derived class need to be thread safe.
*/
QDeclarativeImageProvider::~QDeclarativeImageProvider()
{
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index 8d81b34..5c21ebc 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -338,7 +338,7 @@ QString QDeclarativeImportsPrivate::resolvedUri(const QString &dir_arg, QDeclara
qSort(paths.begin(), paths.end(), greaterThan); // Ensure subdirs preceed their parents.
QString stableRelativePath = dir;
- foreach( QString path, paths) {
+ foreach(const QString &path, paths) {
if (dir.startsWith(path)) {
stableRelativePath = dir.mid(path.length()+1);
break;
diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index 0657f49..0b3b35f 100644
--- a/src/declarative/qml/qdeclarativescriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -543,7 +543,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
QString typemodifier;
if(node->typeModifier)
typemodifier = node->typeModifier->asString();
- if (typemodifier == QString()) {
+ if (typemodifier.isEmpty()) {
type = Object::DynamicProperty::Custom;
} else if(typemodifier == QLatin1String("list")) {
type = Object::DynamicProperty::CustomList;
diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index a42f131..509ca6b 100644
--- a/src/declarative/qml/qdeclarativeworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -514,6 +514,7 @@ void QDeclarativeWorkerScriptEngine::run()
/*!
\qmlclass WorkerScript QDeclarativeWorkerScript
+ \ingroup qml-utility-elements
\brief The WorkerScript element enables the use of threads in QML.
Use WorkerScript to run operations in a new thread.
diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
index eb37dd8..301ea1d 100644
--- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp
+++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
@@ -967,8 +967,9 @@ public:
QScriptValue send(QScriptValue *me, const QByteArray &);
QScriptValue abort(QScriptValue *me);
- QString responseBody() const;
+ QString responseBody();
const QByteArray & rawResponseBody() const;
+ bool receivedXml() const;
private slots:
void downloadProgress(qint64);
void error(QNetworkReply::NetworkError);
@@ -991,6 +992,15 @@ private:
HeadersList m_headersList;
void fillHeadersList();
+ bool m_gotXml;
+ QByteArray m_mime;
+ QByteArray m_charset;
+ QTextCodec *m_textCodec;
+#ifndef QT_NO_TEXTCODEC
+ QTextCodec* findTextCodec() const;
+#endif
+ void readEncoding();
+
QScriptValue m_me; // Set to the data object while a send() is ongoing (to access the callback)
QScriptValue dispatchCallback(QScriptValue *me);
@@ -1008,7 +1018,7 @@ private:
QDeclarativeXMLHttpRequest::QDeclarativeXMLHttpRequest(QNetworkAccessManager *manager)
: m_state(Unsent), m_errorFlag(false), m_sendFlag(false),
- m_redirectCount(0), m_network(0), m_nam(manager)
+ m_redirectCount(0), m_gotXml(false), m_textCodec(0), m_network(0), m_nam(manager)
{
}
@@ -1278,6 +1288,7 @@ void QDeclarativeXMLHttpRequest::finished()
if (cbv.isError()) printError(cbv);
}
m_responseEntityBody.append(m_network->readAll());
+ readEncoding();
if (xhrDump()) {
qWarning().nospace() << "XMLHttpRequest: RESPONSE " << qPrintable(m_url.toString());
@@ -1303,15 +1314,72 @@ void QDeclarativeXMLHttpRequest::finished()
}
-QString QDeclarativeXMLHttpRequest::responseBody() const
+void QDeclarativeXMLHttpRequest::readEncoding()
+{
+ foreach (const HeaderPair &header, m_headersList) {
+ if (header.first == "content-type") {
+ int separatorIdx = header.second.indexOf(';');
+ if (separatorIdx == -1) {
+ m_mime == header.second;
+ } else {
+ m_mime = header.second.mid(0, separatorIdx);
+ int charsetIdx = header.second.indexOf("charset=");
+ if (charsetIdx != -1) {
+ charsetIdx += 8;
+ separatorIdx = header.second.indexOf(';', charsetIdx);
+ m_charset = header.second.mid(charsetIdx, separatorIdx >= 0 ? separatorIdx : header.second.length());
+ }
+ }
+ break;
+ }
+ }
+
+ if (m_mime.isEmpty() || m_mime == "text/xml" || m_mime == "application/xml" || m_mime.endsWith("+xml"))
+ m_gotXml = true;
+}
+
+bool QDeclarativeXMLHttpRequest::receivedXml() const
+{
+ return m_gotXml;
+}
+
+
+#ifndef QT_NO_TEXTCODEC
+QTextCodec* QDeclarativeXMLHttpRequest::findTextCodec() const
+{
+ QTextCodec *codec = 0;
+
+ if (!m_charset.isEmpty())
+ codec = QTextCodec::codecForName(m_charset);
+
+ if (!codec && m_gotXml) {
+ QXmlStreamReader reader(m_responseEntityBody);
+ reader.readNext();
+ codec = QTextCodec::codecForName(reader.documentEncoding().toString().toUtf8());
+ }
+
+ if (!codec && m_mime == "text/html")
+ codec = QTextCodec::codecForHtml(m_responseEntityBody, 0);
+
+ if (!codec)
+ codec = QTextCodec::codecForUtfText(m_responseEntityBody, 0);
+
+ if (!codec)
+ codec = QTextCodec::codecForName("UTF-8");
+ return codec;
+}
+#endif
+
+
+QString QDeclarativeXMLHttpRequest::responseBody()
{
- QXmlStreamReader reader(m_responseEntityBody);
- reader.readNext();
#ifndef QT_NO_TEXTCODEC
- QTextCodec *codec = QTextCodec::codecForName(reader.documentEncoding().toUtf8());
- if (codec)
- return codec->toUnicode(m_responseEntityBody);
+ if (!m_textCodec)
+ m_textCodec = findTextCodec();
+ if (m_textCodec)
+ return m_textCodec->toUnicode(m_responseEntityBody);
#endif
+
return QString::fromUtf8(m_responseEntityBody);
}
@@ -1572,7 +1640,8 @@ static QScriptValue qmlxmlhttprequest_responseXML(QScriptContext *context, QScri
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
- if (request->readyState() != QDeclarativeXMLHttpRequest::Loading &&
+ if (!request->receivedXml() ||
+ request->readyState() != QDeclarativeXMLHttpRequest::Loading &&
request->readyState() != QDeclarativeXMLHttpRequest::Done)
return engine->nullValue();
else
diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp
index 6e4d7b8..0954248 100644
--- a/src/declarative/qml/qmetaobjectbuilder.cpp
+++ b/src/declarative/qml/qmetaobjectbuilder.cpp
@@ -1142,7 +1142,7 @@ static QByteArray buildParameterNames
if (!parameterNames.isEmpty()) {
QByteArray names;
bool first = true;
- foreach (QByteArray name, parameterNames) {
+ foreach (const QByteArray &name, parameterNames) {
if (first)
first = false;
else
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index a747706..4e9e8d5 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -74,6 +74,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Animation QDeclarativeAbstractAnimation
+ \ingroup qml-animation-transition
\since 4.7
\brief The Animation element is the base of all QML animations.
@@ -554,6 +555,7 @@ void QDeclarativeAbstractAnimation::timelineComplete()
/*!
\qmlclass PauseAnimation QDeclarativePauseAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits Animation
\brief The PauseAnimation element provides a pause for an animation.
@@ -630,6 +632,7 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation()
/*!
\qmlclass ColorAnimation QDeclarativeColorAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits PropertyAnimation
\brief The ColorAnimation element animates changes in color values.
@@ -691,9 +694,12 @@ QDeclarativeColorAnimation::~QDeclarativeColorAnimation()
}
\endqml
- If this value is not set and the ColorAnimation is defined within
- a \l Transition, it defaults to the value defined in the starting
- state of the \l Transition.
+ If the ColorAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the starting state of the
+ \l Transition, or the current value of the property at the moment the
+ \l Behavior is triggered.
+
+ \sa {QML Animation}
*/
QColor QDeclarativeColorAnimation::from() const
{
@@ -711,9 +717,12 @@ void QDeclarativeColorAnimation::setFrom(const QColor &f)
This property holds the color value at which the animation should end.
- If this value is not set and the ColorAnimation is defined within
- a \l Transition or \l Behavior, it defaults to the value defined in the end
- state of the \l Transition or \l Behavior.
+ If the ColorAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the end state of the
+ \l Transition, or the value of the property change that triggered the
+ \l Behavior.
+
+ \sa {QML Animation}
*/
QColor QDeclarativeColorAnimation::to() const
{
@@ -730,6 +739,7 @@ void QDeclarativeColorAnimation::setTo(const QColor &t)
/*!
\qmlclass ScriptAction QDeclarativeScriptAction
+ \ingroup qml-animation-transition
\since 4.7
\inherits Animation
\brief The ScriptAction element allows scripts to be run during an animation.
@@ -878,33 +888,50 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation()
/*!
\qmlclass PropertyAction QDeclarativePropertyAction
+ \ingroup qml-animation-transition
\since 4.7
\inherits Animation
\brief The PropertyAction element allows immediate property changes during animation.
- PropertyAction is used to specify an immediate property change
- during an animation. The property change is not animated.
+ PropertyAction is used to specify an immediate property change during an
+ animation. The property change is not animated.
- For example, to explicitly set \c {theImage.smooth = true} during a \l Transition:
- \code
- transitions: Transition {
- ...
- PropertyAction { target: theImage; property: "smooth"; value: true }
- ...
- }
- \endcode
+ It is useful for setting non-animated property values during an animation.
- Or, to set \c theWebView.url to the value set for the destination state:
- \code
+ For example, here is a SequentialAnimation that sets the image's
+ \l {Image::}{smooth} property to \c true, animates the width of the image,
+ then sets \l {Image::}{smooth} back to \c false:
+
+ \snippet doc/src/snippets/declarative/propertyaction.qml standalone
+
+ PropertyAction is also useful for setting the exact point at which a property
+ change should occur during a \l Transition. For example, if PropertyChanges
+ was used in a \l State to rotate an item around a particular
+ \l {Item::}{transformOrigin}, it might be implemented like this:
+
+ \snippet doc/src/snippets/declarative/propertyaction.qml transition
+
+ However, with this code, the \c transformOrigin is not set until \e after
+ the animation, as a \l State is taken to define the values at the \e end of
+ a transition. The animation would rotate at the default \c transformOrigin,
+ then jump to \c Item.BottomRight. To fix this, insert a PropertyChanges
+ before the RotationAnimation begins:
+
+ \qml
transitions: Transition {
- ...
- PropertyAction { target: theWebView; property: "url" }
- ...
+ SequentialAnimation {
+ PropertyAction { target: rect; property: "transformOrigin" }
+ RotationAnimation { ... }
+ }
}
- \endcode
-
+ \endqml
+
+ This immediately sets the \c transformOrigin property to the value defined
+ in the end state of the \l Transition (i.e. the value defined in the
+ PropertyChanges object) so that the rotation animation begins with the
+ correct transform origin.
- \sa QtDeclarative
+ \sa {QML Animation}, QtDeclarative
*/
/*!
\internal
@@ -1009,7 +1036,11 @@ QDeclarativeListProperty<QObject> QDeclarativePropertyAction::exclude()
/*!
\qmlproperty any PropertyAction::value
This property holds the value to be set on the property.
- If not set, then the value defined for the end state of the transition.
+
+ If the PropertyAction is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the end state of the
+ \l Transition, or the value of the property change that triggered the
+ \l Behavior.
*/
QVariant QDeclarativePropertyAction::value() const
{
@@ -1129,6 +1160,7 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions,
/*!
\qmlclass NumberAnimation QDeclarativeNumberAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits PropertyAnimation
\brief The NumberAnimation element animates changes in qreal-type values.
@@ -1184,7 +1216,7 @@ void QDeclarativeNumberAnimation::init()
/*!
\qmlproperty real NumberAnimation::from
- This property holds the starting number value.
+ This property holds the starting value for the animation.
For example, the following animation is not applied until the \c x value
has reached 100:
@@ -1199,9 +1231,12 @@ void QDeclarativeNumberAnimation::init()
}
\endqml
- If this value is not set and the NumberAnimation is defined within
- a \l Transition, it defaults to the value defined in the start
- state of the \l Transition.
+ If the NumberAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the starting state of the
+ \l Transition, or the current value of the property at the moment the
+ \l Behavior is triggered.
+
+ \sa {QML Animation}
*/
qreal QDeclarativeNumberAnimation::from() const
@@ -1217,11 +1252,14 @@ void QDeclarativeNumberAnimation::setFrom(qreal f)
/*!
\qmlproperty real NumberAnimation::to
- This property holds the ending number value.
+ This property holds the end value for the animation.
- If this value is not set and the NumberAnimation is defined within
- a \l Transition or \l Behavior, it defaults to the value defined in the end
- state of the \l Transition or \l Behavior.
+ If the NumberAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the end state of the
+ \l Transition, or the value of the property change that triggered the
+ \l Behavior.
+
+ \sa {QML Animation}
*/
qreal QDeclarativeNumberAnimation::to() const
{
@@ -1238,6 +1276,7 @@ void QDeclarativeNumberAnimation::setTo(qreal t)
/*!
\qmlclass Vector3dAnimation QDeclarativeVector3dAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits PropertyAnimation
\brief The Vector3dAnimation element animates changes in QVector3d values.
@@ -1273,10 +1312,14 @@ QDeclarativeVector3dAnimation::~QDeclarativeVector3dAnimation()
/*!
\qmlproperty real Vector3dAnimation::from
- This property holds the starting value.
+ This property holds the starting value for the animation.
+
+ If the Vector3dAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the starting state of the
+ \l Transition, or the current value of the property at the moment the
+ \l Behavior is triggered.
- If this value is not set, it defaults to the value defined in the start
- state of the \l Transition.
+ \sa {QML Animation}
*/
QVector3D QDeclarativeVector3dAnimation::from() const
{
@@ -1291,10 +1334,14 @@ void QDeclarativeVector3dAnimation::setFrom(QVector3D f)
/*!
\qmlproperty real Vector3dAnimation::to
- This property holds the ending value.
+ This property holds the end value for the animation.
- If this value is not set, it defaults to the value defined in the end
- state of the \l Transition or \l Behavior.
+ If the Vector3dAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the end state of the
+ \l Transition, or the value of the property change that triggered the
+ \l Behavior.
+
+ \sa {QML Animation}
*/
QVector3D QDeclarativeVector3dAnimation::to() const
{
@@ -1311,6 +1358,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
/*!
\qmlclass RotationAnimation QDeclarativeRotationAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits PropertyAnimation
\brief The RotationAnimation element animates changes in rotation values.
@@ -1335,6 +1383,12 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
your own properties via \l {PropertyAnimation::properties}{properties} or
\l {PropertyAnimation::property}{property}.
+ Also, note the \l Rectangle will be rotated around its default
+ \l {Item::}{transformOrigin} (which is \c Item.Center). To use a different
+ transform origin, set the origin in the PropertyChanges object and apply
+ the change at the start of the animation using PropertyAction. See the
+ PropertyAction documentation for more details.
+
Like any other animation element, a RotationAnimation can be applied in a
number of ways, including transitions, behaviors and property value
sources. The \l {QML Animation} documentation shows a variety of methods
@@ -1400,7 +1454,7 @@ QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation()
/*!
\qmlproperty real RotationAnimation::from
- This property holds the starting number value.
+ This property holds the starting value for the animation.
For example, the following animation is not applied until the \c angle value
has reached 100:
@@ -1415,8 +1469,12 @@ QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation()
}
\endqml
- If this value is not set, it defaults to the value defined in the start
- state of the \l Transition.
+ If the RotationAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the starting state of the
+ \l Transition, or the current value of the property at the moment the
+ \l Behavior is triggered.
+
+ \sa {QML Animation}
*/
qreal QDeclarativeRotationAnimation::from() const
{
@@ -1431,10 +1489,14 @@ void QDeclarativeRotationAnimation::setFrom(qreal f)
/*!
\qmlproperty real RotationAnimation::to
- This property holds the ending value.
+ This property holds the end value for the animation..
+
+ If the RotationAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the end state of the
+ \l Transition, or the value of the property change that triggered the
+ \l Behavior.
- If this value is not set, it defaults to the value defined in the end
- state of the \l Transition or \l Behavior.
+ \sa {QML Animation}
*/
qreal QDeclarativeRotationAnimation::to() const
{
@@ -1540,6 +1602,7 @@ QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeAnimationGro
/*!
\qmlclass SequentialAnimation QDeclarativeSequentialAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits Animation
\brief The SequentialAnimation element allows animations to be run sequentially.
@@ -1613,6 +1676,7 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio
/*!
\qmlclass ParallelAnimation QDeclarativeParallelAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits Animation
\brief The ParallelAnimation element allows animations to be run in parallel.
@@ -1731,6 +1795,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int
/*!
\qmlclass PropertyAnimation QDeclarativePropertyAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits Animation
\brief The PropertyAnimation element animates changes in property values.
@@ -1843,8 +1908,14 @@ void QDeclarativePropertyAnimation::setDuration(int duration)
/*!
\qmlproperty real PropertyAnimation::from
- This property holds the starting value.
- If not set, then the value defined in the start state of the transition.
+ This property holds the starting value for the animation.
+
+ If the PropertyAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the starting state of the
+ \l Transition, or the current value of the property at the moment the
+ \l Behavior is triggered.
+
+ \sa {QML Animation}
*/
QVariant QDeclarativePropertyAnimation::from() const
{
@@ -1864,8 +1935,14 @@ void QDeclarativePropertyAnimation::setFrom(const QVariant &f)
/*!
\qmlproperty real PropertyAnimation::to
- This property holds the ending value.
- If not set, then the value defined in the end state of the transition or \l Behavior.
+ This property holds the end value for the animation.
+
+ If the PropertyAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the end state of the
+ \l Transition, or the value of the property change that triggered the
+ \l Behavior.
+
+ \sa {QML Animation}
*/
QVariant QDeclarativePropertyAnimation::to() const
{
@@ -2392,12 +2469,15 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions
d->actions = &data->actions;
} else {
delete data;
+ d->va->setFromSourcedValue(0); //clear previous data
+ d->va->setAnimValue(0, QAbstractAnimation::DeleteWhenStopped); //clear previous data
d->actions = 0;
}
}
/*!
\qmlclass ParentAnimation QDeclarativeParentAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits Animation
\brief The ParentAnimation element animates changes in parent values.
@@ -2488,7 +2568,10 @@ void QDeclarativeParentAnimation::setTarget(QDeclarativeItem *target)
\qmlproperty Item ParentAnimation::newParent
The new parent to animate to.
- If not set, then the parent defined in the end state of the transition.
+ If the ParentAnimation is defined within a \l Transition or \l Behavior,
+ this value defaults to the value defined in the end state of the
+ \l Transition, or the value of the property change that triggered the
+ \l Behavior.
*/
QDeclarativeItem *QDeclarativeParentAnimation::newParent() const
{
@@ -2757,6 +2840,7 @@ QAbstractAnimation *QDeclarativeParentAnimation::qtAnimation()
/*!
\qmlclass AnchorAnimation QDeclarativeAnchorAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits Animation
\brief The AnchorAnimation element animates changes in anchor values.
diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h
index a1bb64f..8cb17e4 100644
--- a/src/declarative/util/qdeclarativeanimation_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p.h
@@ -74,7 +74,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeAbstractAnimation : public QObject, publi
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged)
- Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged)
+ Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopCountChanged)
Q_CLASSINFO("DefaultMethod", "start()")
public:
@@ -301,8 +301,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeColorAnimation : public QDeclarativeProperty
{
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativePropertyAnimation)
- Q_PROPERTY(QColor from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(QColor to READ to WRITE setTo NOTIFY toChanged)
+ Q_PROPERTY(QColor from READ from WRITE setFrom)
+ Q_PROPERTY(QColor to READ to WRITE setTo)
public:
QDeclarativeColorAnimation(QObject *parent=0);
@@ -320,8 +320,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeNumberAnimation : public QDeclarativePropert
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativePropertyAnimation)
- Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged)
+ Q_PROPERTY(qreal from READ from WRITE setFrom)
+ Q_PROPERTY(qreal to READ to WRITE setTo)
public:
QDeclarativeNumberAnimation(QObject *parent=0);
@@ -345,8 +345,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeVector3dAnimation : public QDeclarativePrope
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativePropertyAnimation)
- Q_PROPERTY(QVector3D from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(QVector3D to READ to WRITE setTo NOTIFY toChanged)
+ Q_PROPERTY(QVector3D from READ from WRITE setFrom)
+ Q_PROPERTY(QVector3D to READ to WRITE setTo)
public:
QDeclarativeVector3dAnimation(QObject *parent=0);
@@ -366,8 +366,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeRotationAnimation : public QDeclarativePrope
Q_DECLARE_PRIVATE(QDeclarativeRotationAnimation)
Q_ENUMS(RotationDirection)
- Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged)
+ Q_PROPERTY(qreal from READ from WRITE setFrom)
+ Q_PROPERTY(qreal to READ to WRITE setTo)
Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged)
public:
diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp
index 1e7f81a..f1b6f9a 100644
--- a/src/declarative/util/qdeclarativebehavior.cpp
+++ b/src/declarative/util/qdeclarativebehavior.cpp
@@ -72,6 +72,7 @@ public:
/*!
\qmlclass Behavior QDeclarativeBehavior
+ \ingroup qml-animation-transition
\since 4.7
\brief The Behavior element allows you to specify a default animation for a property change.
diff --git a/src/declarative/util/qdeclarativebind.cpp b/src/declarative/util/qdeclarativebind.cpp
index 5fab631..86d08f5 100644
--- a/src/declarative/util/qdeclarativebind.cpp
+++ b/src/declarative/util/qdeclarativebind.cpp
@@ -72,6 +72,7 @@ public:
/*!
\qmlclass Binding QDeclarativeBind
+ \ingroup qml-working-with-data
\since 4.7
\brief The Binding element allows arbitrary property bindings to be created.
diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp
index b364821..293928e 100644
--- a/src/declarative/util/qdeclarativeconnections.cpp
+++ b/src/declarative/util/qdeclarativeconnections.cpp
@@ -71,6 +71,7 @@ public:
/*!
\qmlclass Connections QDeclarativeConnections
+ \ingroup qml-utility-elements
\since 4.7
\brief A Connections element describes generalized connections to signals.
diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp
index 83bdb17..1755855 100644
--- a/src/declarative/util/qdeclarativefontloader.cpp
+++ b/src/declarative/util/qdeclarativefontloader.cpp
@@ -78,6 +78,7 @@ public:
/*!
\qmlclass FontLoader QDeclarativeFontLoader
+ \ingroup qml-utility-elements
\since 4.7
\brief The FontLoader element allows fonts to be loaded by name or URL.
@@ -129,6 +130,7 @@ void QDeclarativeFontLoader::setSource(const QUrl &url)
d->status = Loading;
emit statusChanged();
+ emit sourceChanged();
#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(d->url);
if (!lf.isEmpty()) {
diff --git a/src/declarative/util/qdeclarativefontloader_p.h b/src/declarative/util/qdeclarativefontloader_p.h
index 6947547..0344d99 100644
--- a/src/declarative/util/qdeclarativefontloader_p.h
+++ b/src/declarative/util/qdeclarativefontloader_p.h
@@ -82,6 +82,7 @@ private Q_SLOTS:
void replyFinished();
Q_SIGNALS:
+ void sourceChanged();
void nameChanged();
void statusChanged();
};
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 3a6a5b0..d84de26 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -68,6 +68,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM
/*!
\qmlclass ListModel QDeclarativeListModel
+ \ingroup qml-working-with-data
\since 4.7
\brief The ListModel element defines a free-form list data source.
@@ -129,7 +130,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM
\snippet examples/declarative/threading/threadedlistmodel/dataloader.js 0
- The application's \tt Timer object periodically sends a message to the
+working-with-data
worker script by calling \l WorkerScript::sendMessage(). When this message
is received, \l {WorkerScript::onMessage}{WorkerScript.onMessage()} is invoked in
\tt dataloader.js, which appends the current time to the list model.
@@ -569,7 +570,7 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser
QList<QDeclarativeCustomParserProperty> props = node.properties();
for(int jj = 0; jj < props.count(); ++jj) {
const QDeclarativeCustomParserProperty &nodeProp = props.at(jj);
- if (nodeProp.name() == "") {
+ if (nodeProp.name().isEmpty()) {
error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot contain nested elements"));
return false;
}
@@ -657,7 +658,7 @@ QByteArray QDeclarativeListModelParser::compile(const QList<QDeclarativeCustomPa
for(int ii = 0; ii < customProps.count(); ++ii) {
const QDeclarativeCustomParserProperty &prop = customProps.at(ii);
- if(prop.name() != "") { // isn't default property
+ if(!prop.name().isEmpty()) { // isn't default property
error(prop, QDeclarativeListModel::tr("ListModel: undefined property '%1'").arg(QString::fromUtf8(prop.name())));
return QByteArray();
}
@@ -769,6 +770,7 @@ bool QDeclarativeListModelParser::definesEmptyList(const QString &s)
/*!
\qmlclass ListElement
+ \ingroup qml-working-with-data
\since 4.7
\brief The ListElement element defines a data item in a ListModel.
diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp
index 534c923..498de6d 100644
--- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp
+++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp
@@ -187,12 +187,17 @@ void QDeclarativeListModelWorkerAgent::sync()
s->data = data;
s->list = m_copy;
data.changes.clear();
+
+ mutex.lock();
QCoreApplication::postEvent(this, s);
+ syncDone.wait(&mutex);
+ mutex.unlock();
}
bool QDeclarativeListModelWorkerAgent::event(QEvent *e)
{
if (e->type() == QEvent::User) {
+ QMutexLocker locker(&mutex);
Sync *s = static_cast<Sync *>(e);
const QList<Change> &changes = s->data.changes;
@@ -202,13 +207,18 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e)
FlatListModel *orig = m_orig->m_flat;
FlatListModel *copy = s->list->m_flat;
- if (!orig || !copy)
+ if (!orig || !copy) {
+ syncDone.wakeAll();
return QObject::event(e);
-
+ }
+
orig->m_roles = copy->m_roles;
orig->m_strings = copy->m_strings;
orig->m_values = copy->m_values;
+ syncDone.wakeAll();
+ locker.unlock();
+
for (int ii = 0; ii < changes.count(); ++ii) {
const Change &change = changes.at(ii);
switch (change.type) {
@@ -229,6 +239,8 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e)
if (cc)
emit m_orig->countChanged();
+ } else {
+ syncDone.wakeAll();
}
}
diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
index 1622144..01da374 100644
--- a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
+++ b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
@@ -57,6 +57,8 @@
#include <QtScript/qscriptvalue.h>
#include <QtGui/qevent.h>
+#include <QMutex>
+#include <QWaitCondition>
QT_BEGIN_HEADER
@@ -142,6 +144,8 @@ private:
QAtomicInt m_ref;
QDeclarativeListModel *m_orig;
QDeclarativeListModel *m_copy;
+ QMutex mutex;
+ QWaitCondition syncDone;
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativepackage.cpp b/src/declarative/util/qdeclarativepackage.cpp
index 1a4f2a7..a5ec9b3 100644
--- a/src/declarative/util/qdeclarativepackage.cpp
+++ b/src/declarative/util/qdeclarativepackage.cpp
@@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Package QDeclarativePackage
+ \ingroup qml-working-with-data
\brief Package provides a collection of named items.
The Package class is used in conjunction with
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index 12c6353..c28ada3 100644
--- a/src/declarative/util/qdeclarativepropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -61,51 +61,34 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass PropertyChanges QDeclarativePropertyChanges
+ \ingroup qml-state-elements
\since 4.7
\brief The PropertyChanges element describes new property bindings or values for a state.
- PropertyChanges provides a state change that modifies the properties of an item.
+ PropertyChanges is used to define the property values or bindings in a
+ \l State. This enables an item's property values to be changed when it
+ \l {QML States}{changes between states}.
- Here is a property change that modifies the text and color of a \l Text element
- when it is clicked:
+ To create a PropertyChanges object, specify the \l target item whose
+ properties are to be modified, and define the new property values or
+ bindings. For example:
- \qml
- Text {
- id: myText
- width: 100; height: 100
- text: "Hello"
- color: "blue"
-
- states: State {
- name: "myState"
-
- PropertyChanges {
- target: myText
- text: "Goodbye"
- color: "red"
- }
- }
-
- MouseArea { anchors.fill: parent; onClicked: myText.state = 'myState' }
- }
- \endqml
-
- By default, PropertyChanges will establish new bindings where appropriate.
- For example, the following creates a new binding for myItem's \c height property.
-
- \qml
- PropertyChanges {
- target: myItem
- height: parent.height
- }
- \endqml
-
- If you don't want a binding to be established (and instead just want to assign
- the value of the binding at the time the state is entered),
- you should set the PropertyChange's \l{PropertyChanges::explicit}{explicit}
+ \snippet doc/src/snippets/declarative/propertychanges.qml import
+ \codeline
+ \snippet doc/src/snippets/declarative/propertychanges.qml 0
+
+ When the mouse is pressed, the \l Rectangle changes to the \e resized
+ state. In this state, the PropertyChanges object sets the rectangle's
+ color to blue and the \c height value to that of \c container.height.
+
+ Note this automatically binds \c rect.height to \c container.height
+ in the \e resized state. If a property binding should not be
+ established, and the height should just be set to the value of
+ \c container.height at the time of the state change, set the \l explicit
property to \c true.
-
- State-specific script for signal handlers can also be specified:
+
+ A PropertyChanges object can also override the default signal handler
+ for an object to implement a signal handler specific to the new state:
\qml
PropertyChanges {
@@ -114,36 +97,31 @@ QT_BEGIN_NAMESPACE
}
\endqml
- You can reset a property in a state change by assigning \c undefined. In the following
- example we reset \c theText's width when we enter state1. This will give the text its
- natural width (which is the whole string on one line).
+ \note PropertyChanges can be used to change anchor margins, but not other anchor
+ values; use AnchorChanges for this instead. Similarly, to change an \l Item's
+ \l {Item::}{parent} value, use ParentChanges instead.
- \qml
- import Qt 4.7
-
- Rectangle {
- width: 640
- height: 480
- Text {
- id: theText
- width: 50
- wrapMode: Text.WordWrap
- text: "a text string that is longer than 50 pixels"
- }
- states: State {
- name: "state1"
- PropertyChanges {
- target: theText
- width: undefined
- }
- }
- }
- \endqml
+ \section2 Resetting property values
- Anchor margins should be changed with PropertyChanges, but other anchor changes or changes to
- an Item's parent should be done using the associated change elements
- (ParentChange and AnchorChanges, respectively).
+ The \c undefined value can be used to reset the property value for a state.
+ In the following example, when \c theText changes to the \e widerText
+ state, its \c width property is reset, giving the text its natural width
+ and displaying the whole string on a single line.
+
+ \snippet doc/src/snippets/declarative/propertychanges.qml reset
+
+
+ \section2 Immediate property changes in transitions
+
+ When \l Transitions are used to animate state changes, they animate
+ properties from their values in the current state to those defined in the
+ new state (as defined by PropertyChanges objects). However,
+ it is sometimes desirable to set a property value \e immediately during a
+ \l Transition, without animation; in these cases, the PropertyAction
+ element can be used to force an immediate property change.
+
+ See the PropertyAction documentation for more details.
\sa {declarative/animation/states}{states example}, {qmlstate}{States}, QtDeclarative
*/
@@ -396,12 +374,12 @@ void QDeclarativePropertyChanges::setObject(QObject *o)
/*!
\qmlproperty bool PropertyChanges::restoreEntryValues
-
- Whether or not the previous values should be restored when
- leaving the state. By default, restoreEntryValues is true.
- By setting restoreEntryValues to false, you can create a temporary state
- that has permanent effects on property values.
+ This property holds whether the previous values should be restored when
+ leaving the state.
+
+ The default value is \c true. Setting this value to \c false creates a
+ temporary state that has permanent effects on property values.
*/
bool QDeclarativePropertyChanges::restoreEntryValues() const
{
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
index 30e1491..b2f02e6 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation.cpp
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -249,6 +249,7 @@ void QSmoothedAnimation::init()
/*!
\qmlclass SmoothedAnimation QDeclarativeSmoothedAnimation
+ \ingroup qml-animation-transition
\since 4.7
\inherits NumberAnimation
\brief The SmoothedAnimation element allows a property to smoothly track a value.
diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp
index 6f4ac51..fce4097 100644
--- a/src/declarative/util/qdeclarativespringanimation.cpp
+++ b/src/declarative/util/qdeclarativespringanimation.cpp
@@ -228,6 +228,7 @@ void QDeclarativeSpringAnimationPrivate::updateMode()
/*!
\qmlclass SpringAnimation QDeclarativeSpringAnimation
+ \ingroup qml-animation-transition
\inherits Animation
\since 4.7
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index 028bacb..6e17cf2 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -133,6 +133,7 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje
/*!
\qmlclass State QDeclarativeState
+ \ingroup qml-state-elements
\since 4.7
\brief The State element defines configurations of objects and properties.
diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp
index 1c1e964..6d9563e 100644
--- a/src/declarative/util/qdeclarativestategroup.cpp
+++ b/src/declarative/util/qdeclarativestategroup.cpp
@@ -88,6 +88,7 @@ public:
/*!
\qmlclass StateGroup QDeclarativeStateGroup
+ \ingroup qml-state-elements
\since 4.7
\brief The StateGroup element provides state support for non-Item elements.
@@ -271,7 +272,7 @@ void QDeclarativeStateGroup::componentComplete()
return;
} else if (!d->currentState.isEmpty()) {
QString cs = d->currentState;
- d->currentState = QString();
+ d->currentState.clear();
d->setCurrentStateInternal(cs, true);
}
}
@@ -313,7 +314,7 @@ bool QDeclarativeStateGroupPrivate::updateAutoState()
}
}
if (revert) {
- bool rv = currentState != QString();
+ bool rv = !currentState.isEmpty();
q->setState(QString());
return rv;
} else {
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 2291c16..6e6f0cb 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -161,6 +161,7 @@ void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, Q
/*!
\preliminary
\qmlclass ParentChange QDeclarativeParentChange
+ \ingroup qml-state-elements
\brief The ParentChange element allows you to reparent an Item in a state change.
ParentChange reparents an item while preserving its visual appearance (position, size,
@@ -589,6 +590,7 @@ public:
/*!
\qmlclass StateChangeScript QDeclarativeStateChangeScript
+ \ingroup qml-state-elements
\brief The StateChangeScript element allows you to run a script in a state.
A StateChangeScript is run upon entering a state. You can optionally use
@@ -693,6 +695,7 @@ QString QDeclarativeStateChangeScript::typeName() const
/*!
\qmlclass AnchorChanges QDeclarativeAnchorChanges
+ \ingroup qml-state-elements
\brief The AnchorChanges element allows you to change the anchors of an item in a state.
The AnchorChanges element is used to modify the anchors of an item in a \l State.
diff --git a/src/declarative/util/qdeclarativesystempalette.cpp b/src/declarative/util/qdeclarativesystempalette.cpp
index c334859..7b80736 100644
--- a/src/declarative/util/qdeclarativesystempalette.cpp
+++ b/src/declarative/util/qdeclarativesystempalette.cpp
@@ -58,6 +58,7 @@ public:
/*!
\qmlclass SystemPalette QDeclarativeSystemPalette
+ \ingroup qml-utility-elements
\since 4.7
\brief The SystemPalette element provides access to the Qt palettes.
diff --git a/src/declarative/util/qdeclarativetimer.cpp b/src/declarative/util/qdeclarativetimer.cpp
index 838a8f3..56320e6 100644
--- a/src/declarative/util/qdeclarativetimer.cpp
+++ b/src/declarative/util/qdeclarativetimer.cpp
@@ -70,6 +70,7 @@ public:
/*!
\qmlclass Timer QDeclarativeTimer
+ \ingroup qml-utility-elements
\since 4.7
\brief The Timer item triggers a handler at a specified interval.
diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp
index aa1426c..21d7ded 100644
--- a/src/declarative/util/qdeclarativetransition.cpp
+++ b/src/declarative/util/qdeclarativetransition.cpp
@@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Transition QDeclarativeTransition
+ \ingroup qml-animation-transition
\since 4.7
\brief The Transition element defines animated transitions that occur on state changes.
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index ece3d3a..cef78af 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -72,6 +72,7 @@ typedef QPair<int, int> QDeclarativeXmlListRange;
/*!
\qmlclass XmlRole QDeclarativeXmlListModelRole
+ \ingroup qml-working-with-data
\since 4.7
\brief The XmlRole element allows you to specify a role for an XmlListModel.
@@ -505,6 +506,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
/*!
\qmlclass XmlListModel QDeclarativeXmlListModel
+ \ingroup qml-working-with-data
\since 4.7
\brief The XmlListModel element is used to specify a model using XPath expressions.
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index 64fc0ee..87850a7 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -119,6 +119,7 @@ QT_USE_NAMESPACE
- (QString)removeExtensions:(const QString &)filter;
- (void)createTextField;
- (void)createPopUpButton:(const QString &)selectedFilter hideDetails:(BOOL)hideDetails;
+- (QStringList)findStrippedFilterWithVisualFilterName:(QString)name;
- (void)createAccessory;
@end
@@ -127,8 +128,6 @@ QT_USE_NAMESPACE
- (id)initWithAcceptMode:(QT_PREPEND_NAMESPACE(QFileDialog::AcceptMode))acceptMode
title:(const QString &)title
- nameFilters:(const QStringList &)nameFilters
- selectedNameFilter:(const QString &)selectedNameFilter
hideNameFilterDetails:(bool)hideNameFilterDetails
qDirFilter:(QT_PREPEND_NAMESPACE(QDir::Filters))qDirFilter
fileOptions:(QT_PREPEND_NAMESPACE(QFileDialog::Options))fileOptions
@@ -158,8 +157,10 @@ QT_USE_NAMESPACE
mPriv = priv;
mLastFilterCheckPath = new QString;
mQDirFilterEntryList = new QStringList;
- mNameFilterDropDownList = new QStringList(nameFilters);
- mSelectedNameFilter = new QStringList(qt_clean_filter_list(selectedNameFilter));
+ mNameFilterDropDownList = new QStringList(priv->nameFilters);
+ QString selectedVisualNameFilter = priv->qFileDialogUi->fileTypeCombo->currentText();
+ mSelectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]);
+
QFileInfo sel(selectFile);
if (sel.isDir()){
mCurrentDir = [qt_mac_QStringToNSString(sel.absoluteFilePath()) retain];
@@ -168,8 +169,9 @@ QT_USE_NAMESPACE
mCurrentDir = [qt_mac_QStringToNSString(sel.absolutePath()) retain];
mCurrentSelection = new QString(sel.absoluteFilePath());
}
+
[mSavePanel setTitle:qt_mac_QStringToNSString(title)];
- [self createPopUpButton:selectedNameFilter hideDetails:hideNameFilterDetails];
+ [self createPopUpButton:selectedVisualNameFilter hideDetails:hideNameFilterDetails];
[self createTextField];
[self createAccessory];
[mSavePanel setAccessoryView:mNameFilterDropDownList->size() > 1 ? mAccessoryView : nil];
@@ -350,7 +352,7 @@ QT_USE_NAMESPACE
// This mDelegate function is called when the _name_ filter changes.
Q_UNUSED(sender);
QString selection = mNameFilterDropDownList->value([mPopUpButton indexOfSelectedItem]);
- *mSelectedNameFilter = QT_PREPEND_NAMESPACE(qt_clean_filter_list)(selection);
+ *mSelectedNameFilter = [self findStrippedFilterWithVisualFilterName:selection];
[mSavePanel validateVisibleColumns];
[self updateProperties];
if (mPriv)
@@ -499,6 +501,15 @@ QT_USE_NAMESPACE
}
}
+- (QStringList) findStrippedFilterWithVisualFilterName:(QString)name
+{
+ for (int i=0; i<mNameFilterDropDownList->size(); ++i) {
+ if (mNameFilterDropDownList->at(i).startsWith(name))
+ return qt_clean_filter_list(mNameFilterDropDownList->at(i));
+ }
+ return QStringList();
+}
+
- (void)createAccessory
{
NSRect accessoryRect = { { 0.0, 0.0 }, { 450.0, 33.0 } };
@@ -1039,8 +1050,6 @@ void QFileDialogPrivate::createNSOpenSavePanelDelegate()
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) alloc]
initWithAcceptMode:acceptMode
title:q->windowTitle()
- nameFilters:q->nameFilters()
- selectedNameFilter:q->selectedNameFilter()
hideNameFilterDetails:q->testOption(QFileDialog::HideNameFilterDetails)
qDirFilter:model->filter()
fileOptions:opts
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index fea6e8d..15cc109 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -165,7 +165,7 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
if (chosenVisualInfo) {
// Skip size checks if implementation supports non-matching visual
// and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444).
- if (QEgl::hasExtension("EGL_NV_post_convert_replication"))
+ if (QEgl::hasExtension("EGL_NV_post_convert_rounding"))
return visualId;
int visualRedSize = countBits(chosenVisualInfo->red_mask);
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 6d1bb44..995426f 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -5126,7 +5126,9 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
q->update(itemBoundingRect.translated(item->d_ptr->sceneTransform.dx(),
item->d_ptr->sceneTransform.dy()));
} else {
- q->update(item->d_ptr->sceneTransform.mapRect(itemBoundingRect));
+ QRectF rect = item->d_ptr->sceneTransform.mapRect(itemBoundingRect);
+ if (!rect.isEmpty())
+ q->update(rect);
}
} else {
QRectF dirtyRect;
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 32560be..d568c40 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -2596,9 +2596,11 @@ void QGraphicsView::updateScene(const QList<QRectF> &rects)
// Convert scene rects to viewport rects.
foreach (const QRectF &rect, rects) {
- QRect xrect = transform.mapRect(rect).toRect();
+ QRect xrect = transform.mapRect(rect).toAlignedRect();
if (!(d->optimizationFlags & DontAdjustForAntialiasing))
xrect.adjust(-2, -2, 2, 2);
+ else
+ xrect.adjust(-1, -1, 1, 1);
if (!viewportRect.intersects(xrect))
continue;
dirtyViewportRects << xrect;
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 051aa45..d5db431 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -830,15 +830,17 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
return false;
QFileInfo info(fileName);
- if (!info.exists())
- return false;
-
QString key = QLatin1Literal("qt_pixmap")
% info.absoluteFilePath()
% HexString<uint>(info.lastModified().toTime_t())
% HexString<quint64>(info.size())
% HexString<uint>(data ? data->pixelType() : QPixmapData::PixmapType);
+ // Note: If no extension is provided, we try to match the
+ // file against known plugin extensions
+ if (!info.completeSuffix().isEmpty() && !info.exists())
+ return false;
+
if (QPixmapCache::find(key, *this))
return true;
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 214c31f..12add05 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2271,9 +2271,11 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
} else {
d->selectionModel->setCurrentIndex(newCurrent, command);
d->pressedPosition = visualRect(newCurrent).center() + d->offset();
- // We copy the same behaviour as for mousePressEvent().
- QRect rect(d->pressedPosition - d->offset(), QSize(1, 1));
- setSelection(rect, command);
+ if (newCurrent.isValid()) {
+ // We copy the same behaviour as for mousePressEvent().
+ QRect rect(d->pressedPosition - d->offset(), QSize(1, 1));
+ setSelection(rect, command);
+ }
}
event->accept();
return;
diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h
index 899b01b..5764318 100644
--- a/src/gui/kernel/qaction_p.h
+++ b/src/gui/kernel/qaction_p.h
@@ -112,12 +112,12 @@ public:
//for soft keys management
uint forceEnabledInSoftkeys : 1;
uint menuActionSoftkeys : 1;
-
- QAction::MenuRole menuRole : 3;
- QAction::SoftKeyRole softKeyRole : 2;
- QAction::Priority priority : 14;
int iconVisibleInMenu : 3; // Only has values -1, 0, and 1
+ QAction::MenuRole menuRole;
+ QAction::SoftKeyRole softKeyRole;
+ QAction::Priority priority;
+
QList<QWidget *> widgets;
#ifndef QT_NO_GRAPHICSVIEW
QList<QGraphicsWidget *> graphicsWidgets;
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 028e3aa..d9c3b6a 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -1053,6 +1053,18 @@ QApplication::~QApplication()
QApplicationPrivate::is_app_closing = true;
QApplicationPrivate::is_app_running = false;
+ // delete all widgets
+ if (QWidgetPrivate::allWidgets) {
+ QWidgetSet *mySet = QWidgetPrivate::allWidgets;
+ QWidgetPrivate::allWidgets = 0;
+ for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) {
+ register QWidget *w = *it;
+ if (!w->parent()) // window
+ w->destroy(true, true);
+ }
+ delete mySet;
+ }
+
delete qt_desktopWidget;
qt_desktopWidget = 0;
@@ -1073,18 +1085,6 @@ QApplication::~QApplication()
delete QWidgetPrivate::mapper;
QWidgetPrivate::mapper = 0;
- // delete all widgets
- if (QWidgetPrivate::allWidgets) {
- QWidgetSet *mySet = QWidgetPrivate::allWidgets;
- QWidgetPrivate::allWidgets = 0;
- for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) {
- register QWidget *w = *it;
- if (!w->parent()) // window
- w->destroy(true, true);
- }
- delete mySet;
- }
-
delete QApplicationPrivate::app_pal;
QApplicationPrivate::app_pal = 0;
delete QApplicationPrivate::sys_pal;
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 4ed00f8..5c1f29e 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -135,6 +135,38 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo
}
#endif
+void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible)
+{
+ if (QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control)) {
+ QWidget *const widget = QWidgetPrivate::mapper->value(control);
+ QWidget *const window = widget->window();
+ if (QTLWExtra *topData = qt_widget_private(window)->maybeTopData()) {
+ QWidgetBackingStoreTracker &backingStore = topData->backingStore;
+ if (visible) {
+ if (backingStore.data()) {
+ backingStore.registerWidget(widget);
+ } else {
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+ S60->wsSession().SendEffectCommand(ETfxCmdRestoreLayer);
+#endif
+ backingStore.create(window);
+ backingStore.registerWidget(widget);
+ qt_widget_private(widget)->invalidateBuffer(widget->rect());
+ widget->repaint();
+ }
+ } else {
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+ S60->wsSession().SendEffectCommand(ETfxCmdDeallocateLayer);
+#endif
+ backingStore.unregisterWidget(widget);
+ // In order to ensure that any resources used by the window surface
+ // are immediately freed, we flush the WSERV command buffer.
+ S60->wsSession().Flush();
+ }
+ }
+ }
+}
+
bool qt_nograb() // application no-grab option
{
#if defined(QT_DEBUG)
@@ -1075,17 +1107,19 @@ void QSymbianControl::Draw(const TRect& controlRect) const
CFbsBitmap *bitmap = s60Surface->symbianBitmap();
CWindowGc &gc = SystemGc();
- switch(qwidget->d_func()->extraData()->nativePaintMode) {
+ QWExtra::NativePaintMode nativePaintMode = qwidget->d_func()->extraData()->nativePaintMode;
+ if(qwidget->d_func()->paintOnScreen())
+ nativePaintMode = QWExtra::Disable;
+
+ switch(nativePaintMode) {
case QWExtra::Disable:
// Do nothing
break;
-
case QWExtra::Blit:
if (qwidget->d_func()->isOpaque)
gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect);
break;
-
case QWExtra::ZeroFill:
if (Window().DisplayMode() == EColor16MA
|| Window().DisplayMode() == Q_SYMBIAN_ECOLOR16MAP) {
@@ -1098,7 +1132,6 @@ void QSymbianControl::Draw(const TRect& controlRect) const
gc.Clear(controlRect);
};
break;
-
default:
Q_ASSERT(false);
}
@@ -1475,6 +1508,8 @@ void qt_init(QApplicationPrivate * /* priv */, int)
S60->avkonComponentsSupportTransparency = (value==1) ? true : false;
}
}
+ delete repository;
+ repository = 0;
#endif
#ifdef QT_KEYPAD_NAVIGATION
@@ -1920,35 +1955,10 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent
if (callSymbianEventFilters(symbianEvent))
return 1;
const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged();
- QWidget *w = QWidgetPrivate::mapper->value(control);
- QWidget *const window = w->window();
- if (!window->d_func()->maybeTopData())
- break;
- QRefCountedWidgetBackingStore &backingStore = window->d_func()->maybeTopData()->backingStore;
- if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) {
-#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
- S60->wsSession().SendEffectCommand(ETfxCmdDeallocateLayer);
-#endif
- // Decrement backing store reference count
- backingStore.deref();
- // In order to ensure that any resources used by the window surface
- // are immediately freed, we flush the WSERV command buffer.
- S60->wsSession().Flush();
- } else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) {
- if (backingStore.data()) {
- // Increment backing store reference count
- backingStore.ref();
- } else {
-#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
- S60->wsSession().SendEffectCommand(ETfxCmdRestoreLayer);
-#endif
- // Create backing store with an initial reference count of 1
- backingStore.create(window);
- backingStore.ref();
- w->d_func()->invalidateBuffer(w->rect());
- w->repaint();
- }
- }
+ if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible)
+ S60->controlVisibilityChanged(control, false);
+ else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible)
+ S60->controlVisibilityChanged(control, true);
return 1;
}
break;
diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp
index 9fcc718..4b75f0a 100644
--- a/src/gui/kernel/qclipboard_x11.cpp
+++ b/src/gui/kernel/qclipboard_x11.cpp
@@ -456,7 +456,8 @@ QClipboard::QClipboard(QObject *parent)
XCheckIfEvent(X11->display, &ev, &qt_init_timestamp_scanner, (XPointer)&data);
if (data.timestamp == CurrentTime) {
setupOwner();
- int dummy = 0;
+ // We need this value just for completeness, we don't use it.
+ long dummy = 0;
Window ownerId = owner->internalWinId();
XChangeProperty(X11->display, ownerId,
ATOM(CLIP_TEMPORARY), XA_INTEGER, 32,
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index 8d65aa1..8d38f45 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -255,5 +255,10 @@ QT_USE_NAMESPACE
qApp->quit();
}
}
+
+ - (void)orderFrontCharacterPalette:(id)sender
+ {
+ [NSApp orderFrontCharacterPalette:sender];
+ }
@end
#endif // QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qcocoamenuloader_mac_p.h b/src/gui/kernel/qcocoamenuloader_mac_p.h
index a75ad0a..edacfa5 100644
--- a/src/gui/kernel/qcocoamenuloader_mac_p.h
+++ b/src/gui/kernel/qcocoamenuloader_mac_p.h
@@ -88,6 +88,7 @@
- (IBAction)hide:(id)sender;
- (IBAction)qtDispatcherToQAction:(id)sender;
- (void)qtUpdateMenubar;
+- (void)orderFrontCharacterPalette:(id)sender;
@end
#endif // QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index e26fbde..89f01d8 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -785,7 +785,7 @@ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions()
// the stacking order of the windows while doing so, we put
// up a block that is used in QCocoaWindow and QCocoaPanel:
int stackSize = cocoaModalSessionStack.size();
- for (int i=stackSize-1; i>=0; --i) {
+ for (int i=0; i<stackSize; ++i) {
QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
if (info.session) {
[NSApp endModalSession:info.session];
@@ -822,12 +822,12 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
QBoolBlocker block1(blockSendPostedEvents, true);
info.nswindow = window;
[(NSWindow*) info.nswindow retain];
- // When creating a modal session cocoa will rearrange the windows.
- // In order to avoid windows to be put behind another we need to
- // keep the window level.
- int level = [window level];
+ int levelBeforeEnterModal = [window level];
info.session = [NSApp beginModalSessionForWindow:window];
- [window setLevel:level];
+ // Make sure we don't stack the window lower that it was before
+ // entering modal, in case it e.g. had the stays-on-top flag set:
+ if (levelBeforeEnterModal > [window level])
+ [window setLevel:levelBeforeEnterModal];
}
currentModalSessionCached = info.session;
}
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index fe9dd8a..e768a21 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -129,7 +129,12 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r
void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)
{
QList<QGestureRecognizer *> list = m_recognizers.values(type);
- m_recognizers.remove(type);
+ while (QGestureRecognizer *recognizer = m_recognizers.take(type)) {
+ if (!m_obsoleteGestures.contains(recognizer)) {
+ // inserting even an empty QSet will cause the recognizer to be deleted on destruction of the manager
+ m_obsoleteGestures.insert(recognizer, QSet<QGesture *>());
+ }
+ }
foreach (QGesture *g, m_gestureToRecognizer.keys()) {
QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g);
if (list.contains(recognizer)) {
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index a18ea07..ad6a99a 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -164,6 +164,7 @@ public:
static inline CEikButtonGroupContainer* buttonGroupContainer();
static void setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible);
#endif
+ static void controlVisibilityChanged(CCoeControl *control, bool visible);
#ifdef Q_OS_SYMBIAN
TTrapHandler *s60InstalledTrapHandler;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 22123a0..0baecce 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -162,47 +162,76 @@ static inline bool hasBackingStoreSupport()
extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp
extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
+/*!
+ \internal
+ \class QWidgetBackingStoreTracker
+ \brief Class which allows tracking of which widgets are using a given backing store
+
+ QWidgetBackingStoreTracker is a thin wrapper around a QWidgetBackingStore pointer,
+ which maintains a list of the QWidgets which are currently using the backing
+ store. This list is modified via the registerWidget and unregisterWidget functions.
+ */
-QRefCountedWidgetBackingStore::QRefCountedWidgetBackingStore()
+QWidgetBackingStoreTracker::QWidgetBackingStoreTracker()
: m_ptr(0)
- , m_count(0)
{
}
-QRefCountedWidgetBackingStore::~QRefCountedWidgetBackingStore()
+QWidgetBackingStoreTracker::~QWidgetBackingStoreTracker()
{
delete m_ptr;
}
-void QRefCountedWidgetBackingStore::create(QWidget *widget)
+/*!
+ \internal
+ Destroy the contained QWidgetBackingStore, if not null, and clear the list of
+ widgets using the backing store, then create a new QWidgetBackingStore, providing
+ the QWidget.
+ */
+void QWidgetBackingStoreTracker::create(QWidget *widget)
{
destroy();
m_ptr = new QWidgetBackingStore(widget);
- m_count = 0;
}
-void QRefCountedWidgetBackingStore::destroy()
+/*!
+ \internal
+ Destroy the contained QWidgetBackingStore, if not null, and clear the list of
+ widgets using the backing store.
+ */
+void QWidgetBackingStoreTracker::destroy()
{
delete m_ptr;
m_ptr = 0;
- m_count = 0;
+ m_widgets.clear();
}
-void QRefCountedWidgetBackingStore::ref()
+/*!
+ \internal
+ Add the widget to the list of widgets currently using the backing store.
+ If the widget was already in the list, this function is a no-op.
+ */
+void QWidgetBackingStoreTracker::registerWidget(QWidget *w)
{
Q_ASSERT(m_ptr);
- ++m_count;
+ Q_ASSERT(w->internalWinId());
+ Q_ASSERT(qt_widget_private(w)->maybeBackingStore() == m_ptr);
+ m_widgets.insert(w);
}
-void QRefCountedWidgetBackingStore::deref()
+/*!
+ \internal
+ Remove the widget from the list of widgets currently using the backing store.
+ If the widget was in the list, and removing it causes the list to be empty,
+ the backing store is deleted.
+ If the widget was not in the list, this function is a no-op.
+ */
+void QWidgetBackingStoreTracker::unregisterWidget(QWidget *w)
{
- if (m_count) {
- Q_ASSERT(m_ptr);
- if (0 == --m_count) {
- delete m_ptr;
- m_ptr = 0;
- }
+ if (m_widgets.remove(w) && m_widgets.isEmpty()) {
+ delete m_ptr;
+ m_ptr = 0;
}
}
@@ -1245,7 +1274,16 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
q->setAttribute(Qt::WA_WState_Hidden);
//give potential windows a bigger "pre-initial" size; create_sys() will give them a new size later
+#ifdef Q_OS_SYMBIAN
+ if (isGLWidget) {
+ // Don't waste GPU mem for unnecessary large egl surface
+ data.crect = QRect(0,0,2,2);
+ } else {
+ data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,360,640);
+ }
+#else
data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,640,480);
+#endif
focus_next = focus_prev = q;
@@ -9934,7 +9972,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
desktopWidget = parent;
bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget;
-#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_MAC)
+#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN)
if (newParent && parent && !desktopWidget) {
if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings))
parent->d_func()->enforceNativeChildren();
@@ -10588,7 +10626,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
}
case Qt::WA_PaintOnScreen:
d->updateIsOpaque();
-#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC)
+#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN)
// Recreate the widget if it's already created as an alien widget and
// WA_PaintOnScreen is enabled. Paint on screen widgets must have win id.
// So must their children.
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index c499d93..ef7e1d3 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2796,10 +2796,14 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
if (QWidget *parent = q->parentWidget()) {
if (parent->testAttribute(Qt::WA_WState_Created)) {
- if (set)
- [qt_mac_window_for(parent) addChildWindow:qt_mac_window_for(q) ordered:NSWindowAbove];
- else
+ if (set) {
+ if (parent->isVisible()) {
+ NSWindow *childwin = qt_mac_window_for(q);
+ [qt_mac_window_for(parent) addChildWindow:childwin ordered:NSWindowAbove];
+ }
+ } else {
[qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)];
+ }
}
}
@@ -2807,10 +2811,12 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
for (int i=0; i<widgets.size(); ++i) {
QWidget *child = widgets.at(i);
if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) {
- if (set)
- [qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove];
- else
+ if (set) {
+ NSWindow *childwin = qt_mac_window_for(child);
+ [qt_mac_window_for(q) addChildWindow:childwin ordered:NSWindowAbove];
+ } else {
[qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)];
+ }
}
}
}
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 9118919..c943bd8 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -110,17 +110,18 @@ class QWidgetItemV2;
class QStyle;
-class Q_AUTOTEST_EXPORT QRefCountedWidgetBackingStore
+class Q_AUTOTEST_EXPORT QWidgetBackingStoreTracker
{
+
public:
- QRefCountedWidgetBackingStore();
- ~QRefCountedWidgetBackingStore();
+ QWidgetBackingStoreTracker();
+ ~QWidgetBackingStoreTracker();
void create(QWidget *tlw);
void destroy();
- void ref();
- void deref();
+ void registerWidget(QWidget *w);
+ void unregisterWidget(QWidget *w);
inline QWidgetBackingStore* data()
{
@@ -143,11 +144,11 @@ public:
}
private:
- Q_DISABLE_COPY(QRefCountedWidgetBackingStore)
+ Q_DISABLE_COPY(QWidgetBackingStoreTracker)
private:
QWidgetBackingStore* m_ptr;
- int m_count;
+ QSet<QWidget *> m_widgets;
};
struct QTLWExtra {
@@ -156,7 +157,7 @@ struct QTLWExtra {
// Regular pointers (keep them together to avoid gaps on 64 bits architectures).
QIcon *icon; // widget icon
QPixmap *iconPixmap;
- QRefCountedWidgetBackingStore backingStore;
+ QWidgetBackingStoreTracker backingStore;
QWindowSurface *windowSurface;
QPainter *sharedPainter;
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 5075803..222d707 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -486,14 +486,13 @@ void QWidgetPrivate::show_sys()
activateSymbianWindow();
QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
+ const bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
#ifdef Q_WS_S60
// Lazily initialize the S60 screen furniture when the first window is shown.
- if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)
+ if (q->isWindow() && !QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)
&& !S60->buttonGroupContainer() && !S60->statusPane()) {
- bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
-
if (!q->testAttribute(Qt::WA_DontShowOnScreen)) {
// Create the status pane and CBA here
@@ -508,23 +507,24 @@ void QWidgetPrivate::show_sys()
// Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver.
QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId());
S60->statusPane()->SetObserver(desktopControl);
-
- // Hide the status pane if fullscreen OR
- // Fill client area if maximized OR
- // Put window below status pane unless the window has an explicit position.
- if (isFullscreen) {
+ if (isFullscreen)
S60->statusPane()->MakeVisible(false);
- } else if (q->windowState() & Qt::WindowMaximized) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
- id->SetExtent(r.iTl, r.Size());
- } else if (!q->testAttribute(Qt::WA_Moved)) {
- id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl);
- }
}
}
}
#endif
+ // Fill client area if maximized OR
+ // Put window below status pane unless the window has an explicit position.
+ if (!isFullscreen) {
+ if (q->windowState() & Qt::WindowMaximized) {
+ TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ id->SetExtent(r.iTl, r.Size());
+ } else if (!q->testAttribute(Qt::WA_Moved)) {
+ id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl);
+ }
+ }
+
id->MakeVisible(true);
if(q->isWindow())
@@ -688,6 +688,12 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
QSymbianControl *old_winid = static_cast<QSymbianControl *>(wasCreated ? data.winid : 0);
if ((q->windowType() == Qt::Desktop))
old_winid = 0;
+
+ // old_winid may not have received a 'not visible' visibility
+ // changed event before being destroyed; make sure that it is
+ // removed from the backing store's list of visible windows.
+ S60->controlVisibilityChanged(old_winid, false);
+
setWinId(0);
// hide and reparent our own window away. Otherwise we might get
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index dfa4a48..793d380 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -212,6 +212,7 @@ if(mmx|3dnow|sse|sse2|iwmmxt) {
SSE3DNOW_SOURCES += painting/qdrawhelper_sse3dnow.cpp
SSE_SOURCES += painting/qdrawhelper_sse.cpp
SSE2_SOURCES += painting/qdrawhelper_sse2.cpp
+ SSSE3_SOURCES += painting/qdrawhelper_ssse3.cpp
IWMMXT_SOURCES += painting/qdrawhelper_iwmmxt.cpp
}
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 83751ed..ac9b994 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -352,7 +352,7 @@ void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QWindowS
// Always flush repainted areas.
dirtyOnScreen += toClean;
-#ifdef Q_WS_QWS
+#if defined(Q_WS_QWS) && !defined(Q_BACKINGSTORE_SUBSURFACES)
toClean.translate(tlwOffset);
#endif
@@ -1294,7 +1294,12 @@ void QWidgetBackingStore::sync()
#ifdef Q_BACKINGSTORE_SUBSURFACES
QWindowSurface *subSurface = w->windowSurface();
BeginPaintInfo beginPaintInfo;
- beginPaint(toBePainted, w, subSurface, &beginPaintInfo, false);
+
+ QPoint off = w->mapTo(tlw, QPoint());
+ toBePainted.translate(off);
+ beginPaint(toBePainted, w, subSurface, &beginPaintInfo, true);
+ toBePainted.translate(-off);
+
if (beginPaintInfo.nothingToPaint)
continue;
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 054f96f..d6beb72 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -7958,6 +7958,17 @@ void qInitDrawhelperAsm()
qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2;
qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
+
+#if defined(QT_HAVE_SSSE3)
+ if (features & SSSE3) {
+ extern void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
+ }
+#endif // QT_HAVE_SSSE3
} else
#endif
{
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
new file mode 100644
index 0000000..9c02009
--- /dev/null
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -0,0 +1,253 @@
+/****************************************************************************
+**
+** 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 QtGui 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$
+**
+****************************************************************************/
+
+
+#ifdef QT_HAVE_SSSE3
+
+#include <private/qsimd_p.h>
+#include <private/qdrawhelper_x86_p.h>
+#include <private/qdrawingprimitive_sse2_p.h>
+
+QT_BEGIN_NAMESPACE
+
+inline static void blend_pixel(quint32 &dst, const quint32 src)
+{
+ if (src >= 0xff000000)
+ dst = src;
+ else if (src != 0)
+ dst = src + BYTE_MUL(dst, qAlpha(~src));
+}
+
+
+/* The instruction palignr uses direct arguments, so we have to generate the code fo the different
+ shift (4, 8, 12). Checking the alignment inside the loop is unfortunatelly way too slow.
+ */
+#define BLENDING_LOOP(palignrOffset, length)\
+ for (; x < length-3; x += 4) { \
+ const __m128i srcVectorLastLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes + 4]);\
+ const __m128i srcVector = _mm_alignr_epi8(srcVectorLastLoaded, srcVectorPrevLoaded, palignrOffset); \
+ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \
+ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \
+ _mm_store_si128((__m128i *)&dst[x], srcVector); \
+ } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \
+ __m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask); \
+ alphaChannel = _mm_sub_epi16(one, alphaChannel); \
+ const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \
+ __m128i destMultipliedByOneMinusAlpha; \
+ BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \
+ const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \
+ _mm_store_si128((__m128i *)&dst[x], result); \
+ } \
+ srcVectorPrevLoaded = srcVectorLastLoaded;\
+ }
+
+
+#define BLEND_SOURCE_OVER_ARGB32_FIRST_ROW_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
+ int x = 0; \
+\
+ /* First, get dst aligned. */ \
+ const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\
+ const int prologLength = qMin(length, offsetToAlignOn16Bytes);\
+\
+ for (; x < prologLength; ++x) {\
+ blend_pixel(dst[x], src[x]); \
+ } \
+\
+ const int minusOffsetToAlignSrcOn16Bytes = (reinterpret_cast<quintptr>(&(src[x])) >> 2) & 0x3;\
+\
+ if (!minusOffsetToAlignSrcOn16Bytes) {\
+ /* src is aligned, usual algorithm but with aligned operations.\
+ See the SSE2 version for more documentation on the algorithm itself. */\
+ const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\
+ for (; x < length-3; x += 4) { \
+ const __m128i srcVector = _mm_load_si128((__m128i *)&src[x]); \
+ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \
+ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \
+ _mm_store_si128((__m128i *)&dst[x], srcVector); \
+ } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \
+ __m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask); \
+ alphaChannel = _mm_sub_epi16(one, alphaChannel); \
+ const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \
+ __m128i destMultipliedByOneMinusAlpha; \
+ BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \
+ const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \
+ _mm_store_si128((__m128i *)&dst[x], result); \
+ } \
+ } /* end for() */\
+ } else if ((length - x) >= 8) {\
+ /* We are at the first line, so "x - minusOffsetToAlignSrcOn16Bytes" could go before src, and\
+ generate an invalid access. */\
+\
+ /* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\
+ __m128i srcVectorPrevLoaded;\
+ if (minusOffsetToAlignSrcOn16Bytes > prologLength) {\
+ /* We go forward 4 pixels to avoid reading before src. */\
+ for (; x < prologLength + 4; ++x)\
+ blend_pixel(dst[x], src[x]); \
+ }\
+ srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\
+ const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\
+\
+ const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\
+ switch (palignrOffset) {\
+ case 4:\
+ BLENDING_LOOP(4, length)\
+ break;\
+ case 8:\
+ BLENDING_LOOP(8, length)\
+ break;\
+ case 12:\
+ BLENDING_LOOP(12, length)\
+ break;\
+ }\
+ }\
+ for (; x < length; ++x) \
+ blend_pixel(dst[x], src[x]); \
+}
+
+// Basically blend src over dst with the const alpha defined as constAlphaVector.
+// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as:
+//const __m128i nullVector = _mm_set1_epi32(0);
+//const __m128i half = _mm_set1_epi16(0x80);
+//const __m128i one = _mm_set1_epi16(0xff);
+//const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
+//const __m128i alphaMask = _mm_set1_epi32(0xff000000);
+//
+// The computation being done is:
+// result = s + d * (1-alpha)
+// with shortcuts if fully opaque or fully transparent.
+#define BLEND_SOURCE_OVER_ARGB32_MAIN_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
+ int x = 0; \
+\
+ /* First, get dst aligned. */ \
+ ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
+ blend_pixel(dst[x], src[x]); \
+ } \
+\
+ const int minusOffsetToAlignSrcOn16Bytes = (reinterpret_cast<quintptr>(&(src[x])) >> 2) & 0x3;\
+\
+ if (!minusOffsetToAlignSrcOn16Bytes) {\
+ /* src is aligned, usual algorithm but with aligned operations.\
+ See the SSE2 version for more documentation on the algorithm itself. */\
+ const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\
+ for (; x < length-3; x += 4) { \
+ const __m128i srcVector = _mm_load_si128((__m128i *)&src[x]); \
+ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \
+ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \
+ _mm_store_si128((__m128i *)&dst[x], srcVector); \
+ } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \
+ __m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask); \
+ alphaChannel = _mm_sub_epi16(one, alphaChannel); \
+ const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \
+ __m128i destMultipliedByOneMinusAlpha; \
+ BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \
+ const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \
+ _mm_store_si128((__m128i *)&dst[x], result); \
+ } \
+ } /* end for() */\
+ } else if ((length - x) >= 8) {\
+ /* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\
+ __m128i srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\
+ const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\
+\
+ const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\
+ switch (palignrOffset) {\
+ case 4:\
+ BLENDING_LOOP(4, length)\
+ break;\
+ case 8:\
+ BLENDING_LOOP(8, length)\
+ break;\
+ case 12:\
+ BLENDING_LOOP(12, length)\
+ break;\
+ }\
+ }\
+ for (; x < length; ++x) \
+ blend_pixel(dst[x], src[x]); \
+}
+
+void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha)
+{
+ const quint32 *src = (const quint32 *) srcPixels;
+ quint32 *dst = (quint32 *) destPixels;
+ if (const_alpha == 256) {
+ const __m128i alphaMask = _mm_set1_epi32(0xff000000);
+ const __m128i nullVector = _mm_setzero_si128();
+ const __m128i half = _mm_set1_epi16(0x80);
+ const __m128i one = _mm_set1_epi16(0xff);
+ const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
+
+ // We have to unrol the first row in order to deal with the load on unaligned data
+ // prior to the src pointer.
+ BLEND_SOURCE_OVER_ARGB32_FIRST_ROW_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask);
+ dst = (quint32 *)(((uchar *) dst) + dbpl);
+ src = (const quint32 *)(((const uchar *) src) + sbpl);
+
+ for (int y = 1; y < h; ++y) {
+ BLEND_SOURCE_OVER_ARGB32_MAIN_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask);
+ dst = (quint32 *)(((uchar *) dst) + dbpl);
+ src = (const quint32 *)(((const uchar *) src) + sbpl);
+ }
+ } else if (const_alpha != 0) {
+ // dest = (s + d * sia) * ca + d * cia
+ // = s * ca + d * (sia * ca + cia)
+ // = s * ca + d * (1 - sa*ca)
+ const_alpha = (const_alpha * 255) >> 8;
+ const __m128i nullVector = _mm_setzero_si128();
+ const __m128i half = _mm_set1_epi16(0x80);
+ const __m128i one = _mm_set1_epi16(0xff);
+ const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
+ const __m128i constAlphaVector = _mm_set1_epi16(const_alpha);
+ for (int y = 0; y < h; ++y) {
+ BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, w, nullVector, half, one, colorMask, constAlphaVector)
+ dst = (quint32 *)(((uchar *) dst) + dbpl);
+ src = (const quint32 *)(((const uchar *) src) + sbpl);
+ }
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_HAVE_SSSE3
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 5e7c67a..94039fb 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -956,53 +956,49 @@
const QT_FT_Vector* control2,
const QT_FT_Vector* to )
{
- TPos dx, dy, da, db;
int top, level;
int* levels;
QT_FT_Vector* arc;
+ int mid_x = ( DOWNSCALE( ras.x ) + to->x +
+ 3 * (control1->x + control2->x ) ) / 8;
+ int mid_y = ( DOWNSCALE( ras.y ) + to->y +
+ 3 * (control1->y + control2->y ) ) / 8;
+ TPos dx = DOWNSCALE( ras.x ) + to->x - ( mid_x << 1 );
+ TPos dy = DOWNSCALE( ras.y ) + to->y - ( mid_y << 1 );
- dx = DOWNSCALE( ras.x ) + to->x - ( control1->x << 1 );
if ( dx < 0 )
dx = -dx;
- dy = DOWNSCALE( ras.y ) + to->y - ( control1->y << 1 );
if ( dy < 0 )
dy = -dy;
if ( dx < dy )
dx = dy;
- da = dx;
-
- dx = DOWNSCALE( ras.x ) + to->x - 3 * ( control1->x + control2->x );
- if ( dx < 0 )
- dx = -dx;
- dy = DOWNSCALE( ras.y ) + to->y - 3 * ( control1->x + control2->y );
- if ( dy < 0 )
- dy = -dy;
- if ( dx < dy )
- dx = dy;
- db = dx;
level = 1;
- da = da / ras.cubic_level;
- db = db / ras.conic_level;
- while ( da > 0 || db > 0 )
+ dx /= ras.cubic_level;
+ while ( dx > 0 )
{
- da >>= 2;
- db >>= 3;
+ dx >>= 2;
level++;
}
if ( level <= 1 )
{
- TPos to_x, to_y, mid_x, mid_y;
+ TPos to_x, to_y;
to_x = UPSCALE( to->x );
to_y = UPSCALE( to->y );
+
+ /* Recalculation of midpoint is needed only if */
+ /* UPSCALE and DOWNSCALE have any effect. */
+
+#if ( PIXEL_BITS != 6 )
mid_x = ( ras.x + to_x +
3 * UPSCALE( control1->x + control2->x ) ) / 8;
mid_y = ( ras.y + to_y +
3 * UPSCALE( control1->y + control2->y ) ) / 8;
+#endif
gray_render_line( RAS_VAR_ mid_x, mid_y );
gray_render_line( RAS_VAR_ to_x, to_y );
@@ -1359,10 +1355,6 @@
/* <Input> */
/* outline :: A pointer to the source target. */
/* */
- /* func_interface :: A table of `emitters', i.e,. function pointers */
- /* called during decomposition to indicate path */
- /* operations. */
- /* */
/* user :: A typeless pointer which is passed to each */
/* emitter during the decomposition. It can be */
/* used to store the state during the */
@@ -1373,15 +1365,10 @@
/* */
static
int QT_FT_Outline_Decompose( const QT_FT_Outline* outline,
- const QT_FT_Outline_Funcs* func_interface,
void* user )
{
#undef SCALED
-#if 0
-#define SCALED( x ) ( ( (x) << shift ) - delta )
-#else
#define SCALED( x ) (x)
-#endif
QT_FT_Vector v_last;
QT_FT_Vector v_control;
@@ -1396,12 +1383,6 @@
int error;
char tag; /* current point's state */
-#if 0
- int shift = func_interface->shift;
- TPos delta = func_interface->delta;
-#endif
-
-
first = 0;
for ( n = 0; n < outline->n_contours; n++ )
@@ -1455,7 +1436,7 @@
tags--;
}
- error = func_interface->move_to( &v_start, user );
+ error = gray_move_to( &v_start, user );
if ( error )
goto Exit;
@@ -1475,7 +1456,7 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
- error = func_interface->line_to( &vec, user );
+ error = gray_line_to( &vec, user );
if ( error )
goto Exit;
continue;
@@ -1502,7 +1483,7 @@
if ( tag == QT_FT_CURVE_TAG_ON )
{
- error = func_interface->conic_to( &v_control, &vec,
+ error = gray_conic_to( &v_control, &vec,
user );
if ( error )
goto Exit;
@@ -1515,7 +1496,7 @@
v_middle.x = ( v_control.x + vec.x ) / 2;
v_middle.y = ( v_control.y + vec.y ) / 2;
- error = func_interface->conic_to( &v_control, &v_middle,
+ error = gray_conic_to( &v_control, &v_middle,
user );
if ( error )
goto Exit;
@@ -1524,7 +1505,7 @@
goto Do_Conic;
}
- error = func_interface->conic_to( &v_control, &v_start,
+ error = gray_conic_to( &v_control, &v_start,
user );
goto Close;
}
@@ -1555,20 +1536,20 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
- error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
+ error = gray_cubic_to( &vec1, &vec2, &vec, user );
if ( error )
goto Exit;
continue;
}
- error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
+ error = gray_cubic_to( &vec1, &vec2, &v_start, user );
goto Close;
}
}
}
/* close the contour with a line segment */
- error = func_interface->line_to( &v_start, user );
+ error = gray_line_to( &v_start, user );
Close:
if ( error )
@@ -1596,22 +1577,11 @@
static int
gray_convert_glyph_inner( RAS_ARG )
{
- static
- const QT_FT_Outline_Funcs func_interface =
- {
- (QT_FT_Outline_MoveTo_Func) gray_move_to,
- (QT_FT_Outline_LineTo_Func) gray_line_to,
- (QT_FT_Outline_ConicTo_Func)gray_conic_to,
- (QT_FT_Outline_CubicTo_Func)gray_cubic_to,
- 0,
- 0
- };
-
volatile int error = 0;
if ( qt_ft_setjmp( ras.jump_buffer ) == 0 )
{
- error = QT_FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
+ error = QT_FT_Outline_Decompose( &ras.outline, &ras );
gray_record_cell( RAS_VAR );
}
else
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index e521e01..fecf25f 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -696,10 +696,11 @@ void QX11PaintEngine::drawLines(const QLine *lines, int lineCount)
linef = d->matrix.map(QLineF(lines[i]));
}
if (clipLine(&linef, d->polygonClipper.boundingRect())) {
- int x1 = qFloor(linef.x1() + aliasedCoordinateDelta);
- int y1 = qFloor(linef.y1() + aliasedCoordinateDelta);
- int x2 = qFloor(linef.x2() + aliasedCoordinateDelta);
- int y2 = qFloor(linef.y2() + aliasedCoordinateDelta);
+ int x1 = qRound(linef.x1() + aliasedCoordinateDelta);
+ int y1 = qRound(linef.y1() + aliasedCoordinateDelta);
+ int x2 = qRound(linef.x2() + aliasedCoordinateDelta);
+ int y2 = qRound(linef.y2() + aliasedCoordinateDelta);
+
XDrawLine(d->dpy, d->hd, d->gc, x1, y1, x2, y2);
}
}
@@ -729,10 +730,11 @@ void QX11PaintEngine::drawLines(const QLineF *lines, int lineCount)
for (int i = 0; i < lineCount; ++i) {
QLineF linef = d->matrix.map(lines[i]);
if (clipLine(&linef, d->polygonClipper.boundingRect())) {
- int x1 = qFloor(linef.x1() + aliasedCoordinateDelta);
- int y1 = qFloor(linef.y1() + aliasedCoordinateDelta);
- int x2 = qFloor(linef.x2() + aliasedCoordinateDelta);
- int y2 = qFloor(linef.y2() + aliasedCoordinateDelta);
+ int x1 = qRound(linef.x1() + aliasedCoordinateDelta);
+ int y1 = qRound(linef.y1() + aliasedCoordinateDelta);
+ int x2 = qRound(linef.x2() + aliasedCoordinateDelta);
+ int y2 = qRound(linef.y2() + aliasedCoordinateDelta);
+
XDrawLine(d->dpy, d->hd, d->gc, x1, y1, x2, y2);
}
}
@@ -1688,8 +1690,8 @@ void QX11PaintEnginePrivate::strokePolygon_dev(const QPointF *polygonPoints, int
if (clippedCount > 0) {
QVarLengthArray<XPoint> xpoints(clippedCount);
for (int i = 0; i < clippedCount; ++i) {
- xpoints[i].x = qFloor(clippedPoints[i].x + aliasedCoordinateDelta);
- xpoints[i].y = qFloor(clippedPoints[i].y + aliasedCoordinateDelta);
+ xpoints[i].x = qRound(clippedPoints[i].x + aliasedCoordinateDelta);
+ xpoints[i].y = qRound(clippedPoints[i].y + aliasedCoordinateDelta);
}
uint numberPoints = qMin(clippedCount, xlibMaxLinePoints);
XPoint *pts = xpoints.data();
@@ -1914,6 +1916,8 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect
int sh = qRound(sr.height());
QPixmap pixmap = qt_toX11Pixmap(px);
+ if(pixmap.isNull())
+ return;
if ((d->xinfo && d->xinfo->screen() != pixmap.x11Info().screen())
|| (pixmap.x11Info().screen() != DefaultScreen(X11->display))) {
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 314f349..1f1bb29 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5986,10 +5986,13 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
return;
}
- if (d->extended->type() == QPaintEngine::OpenGL2 && !staticText_d->untransformedCoordinates) {
+ bool paintEngineSupportsTransformations = d->extended->type() == QPaintEngine::OpenGL2
+ || d->extended->type() == QPaintEngine::OpenVG;
+
+ if (paintEngineSupportsTransformations && !staticText_d->untransformedCoordinates) {
staticText_d->untransformedCoordinates = true;
staticText_d->needsRelayout = true;
- } else if (d->extended->type() != QPaintEngine::OpenGL2 && staticText_d->untransformedCoordinates) {
+ } else if (!paintEngineSupportsTransformations && staticText_d->untransformedCoordinates) {
staticText_d->untransformedCoordinates = false;
staticText_d->needsRelayout = true;
}
diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp
index a816ed2..170668b 100644
--- a/src/gui/painting/qwindowsurface_qws.cpp
+++ b/src/gui/painting/qwindowsurface_qws.cpp
@@ -882,7 +882,11 @@ void QWSMemorySurface::beginPaint(const QRegion &rgn)
const QVector<QRect> rects = rgn.rects();
const QColor blank = Qt::transparent;
for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
- p.fillRect(*it, blank);
+ QRect r = *it;
+#ifdef Q_BACKINGSTORE_SUBSURFACES
+ r.translate(painterOffset());
+#endif
+ p.fillRect(r, blank);
}
}
QWSWindowSurface::beginPaint(rgn);
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 32b1df9..441a8c8 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1101,14 +1101,6 @@ void QTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *conte
}
}
break;
- case QEvent::LayoutDirectionChange: {
- if (contextWidget) {
- QTextOption opt = document()->defaultTextOption();
- opt.setTextDirection(contextWidget->layoutDirection());
- document()->setDefaultTextOption(opt);
- }
- }
- // FALL THROUGH
default:
break;
}
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index e366f77..12a8924 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -1156,6 +1156,10 @@ Qt::LayoutDirection QTextBlock::textDirection() const
if (dir != Qt::LayoutDirectionAuto)
return dir;
+ dir = p->defaultTextOption.textDirection();
+ if (dir != Qt::LayoutDirectionAuto)
+ return dir;
+
const QString buffer = p->buffer();
const int pos = position();
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index 04d6de9..e718212 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -921,10 +921,12 @@ void QCompleterPrivate::showPopup(const QRect& rect)
void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path)
{
Q_Q(QCompleter);
+#ifndef QT_NO_LINEEDIT
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget);
//the path given by QFileSystemModel does not end with /
if (lineEdit && !lineEdit->text().isEmpty() && !q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/'))
q->complete();
+#endif
}
/*!
diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm
index ce85919..15fae23 100644
--- a/src/gui/widgets/qcocoamenu_mac.mm
+++ b/src/gui/widgets/qcocoamenu_mac.mm
@@ -188,6 +188,18 @@ QT_USE_NAMESPACE
return NO;
}
+- (NSInteger)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector
+{
+ NSInteger index = [super indexOfItemWithTarget:anObject andAction:actionSelector];
+ static SEL selForOFCP = NSSelectorFromString(@"orderFrontCharacterPalette:");
+ if (index == -1 && selForOFCP == actionSelector) {
+ // Check if the 'orderFrontCharacterPalette' SEL exists for QCocoaMenuLoader object
+ QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
+ return [super indexOfItemWithTarget:loader andAction:actionSelector];
+ }
+ return index;
+}
+
@end
QT_BEGIN_NAMESPACE
diff --git a/src/gui/widgets/qcocoamenu_mac_p.h b/src/gui/widgets/qcocoamenu_mac_p.h
index d6ac8c5..1a42642 100644
--- a/src/gui/widgets/qcocoamenu_mac_p.h
+++ b/src/gui/widgets/qcocoamenu_mac_p.h
@@ -76,6 +76,7 @@ QT_FORWARD_DECLARE_CLASS(QAction)
}
- (id)initWithQMenu:(QMenu*)menu;
- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action;
+- (NSInteger)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector;
@end
#endif
diff --git a/src/gui/widgets/qdatetimeedit.h b/src/gui/widgets/qdatetimeedit.h
index 81bbdb9..d2f315a 100644
--- a/src/gui/widgets/qdatetimeedit.h
+++ b/src/gui/widgets/qdatetimeedit.h
@@ -206,7 +206,6 @@ private:
class Q_GUI_EXPORT QTimeEdit : public QDateTimeEdit
{
Q_OBJECT
- Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged USER true)
public:
QTimeEdit(QWidget *parent = 0);
QTimeEdit(const QTime &time, QWidget *parent = 0);
@@ -215,7 +214,6 @@ public:
class Q_GUI_EXPORT QDateEdit : public QDateTimeEdit
{
Q_OBJECT
- Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true)
public:
QDateEdit(QWidget *parent = 0);
QDateEdit(const QDate &date, QWidget *parent = 0);
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
index 2f4d1df..6c38911 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
@@ -94,6 +94,7 @@ public:
/*!
\qmlclass FolderListModel QDeclarativeFolderListModel
+ \ingroup qml-working-with-data
\brief The FolderListModel provides a model of the contents of a folder in a filesystem.
FolderListModel provides access to the local filesystem. The \e folder property
diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp
index ed936d5..500c6bf 100644
--- a/src/imports/gestures/qdeclarativegesturearea.cpp
+++ b/src/imports/gestures/qdeclarativegesturearea.cpp
@@ -79,6 +79,8 @@ public:
/*!
\qmlclass GestureArea QDeclarativeGestureArea
+ \ingroup qml-basic-interaction-elements
+
\brief The GestureArea item enables simple gesture handling.
\inherits Item
diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp
index b842109..5cd9c0c 100644
--- a/src/imports/particles/qdeclarativeparticles.cpp
+++ b/src/imports/particles/qdeclarativeparticles.cpp
@@ -154,6 +154,7 @@ void QDeclarativeParticleMotion::destroy(QDeclarativeParticle &particle)
/*!
\qmlclass ParticleMotionLinear QDeclarativeParticleMotionLinear
+ \ingroup qml-particle-elements
\since 4.7
\brief The ParticleMotionLinear object moves particles linearly.
@@ -180,6 +181,7 @@ void QDeclarativeParticleMotionLinear::advance(QDeclarativeParticle &p, int inte
/*!
\qmlclass ParticleMotionGravity QDeclarativeParticleMotionGravity
+ \ingroup qml-particle-elements
\since 4.7
\brief The ParticleMotionGravity object moves particles towards a point.
@@ -271,6 +273,7 @@ void QDeclarativeParticleMotionGravity::advance(QDeclarativeParticle &p, int int
/*!
\qmlclass ParticleMotionWander QDeclarativeParticleMotionWander
+ \ingroup qml-particle-elements
\since 4.7
\brief The ParticleMotionWander object moves particles in a somewhat random fashion.
@@ -634,6 +637,7 @@ void QDeclarativeParticlesPrivate::updateOpacity(QDeclarativeParticle &p, int ag
/*!
\qmlclass Particles QDeclarativeParticles
+ \ingroup qml-particle-elements
\since 4.7
\brief The Particles object generates and moves particles.
\inherits Item
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index c4f7c00..dd174bf 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -63,6 +63,7 @@ QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate()
: pollTimer(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true)
{
qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration");
+ qRegisterMetaType<QNetworkConfigurationPrivatePointer>("QNetworkConfigurationPrivatePointer");
moveToThread(QCoreApplicationPrivate::mainThread());
updateConfigurations();
diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp
index 60851ac..3190a30 100644
--- a/src/network/bearer/qnetworkconfiguration.cpp
+++ b/src/network/bearer/qnetworkconfiguration.cpp
@@ -406,13 +406,6 @@ QList<QNetworkConfiguration> QNetworkConfiguration::children() const
This function is deprecated. It is equivalent to calling bearerTypeName(), however
bearerType() should be used in preference.
*/
-QString QNetworkConfiguration::bearerName() const
-{
- // This function cannot be inline as it would break Qt Mobility.
- // Qt Mobility uses the Qt header as well and since the Mobility Bearer library
- // does not provide bearerTypeName() we cannot use an inline function.
- return bearerTypeName();
-}
/*!
Returns the type of bearer used by this network configuration.
diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h
index 18b92a9..593dbbe 100644
--- a/src/network/bearer/qnetworkconfiguration.h
+++ b/src/network/bearer/qnetworkconfiguration.h
@@ -103,6 +103,7 @@ public:
Q_DECLARE_FLAGS(StateFlags, StateFlag)
+#ifndef QT_MOBILITY_BEARER
enum BearerType {
BearerUnknown,
BearerEthernet,
@@ -114,17 +115,22 @@ public:
BearerBluetooth,
BearerWiMAX
};
+#endif
StateFlags state() const;
Type type() const;
Purpose purpose() const;
- // Required to maintain source compatibility with Qt Mobility.
+#ifndef QT_MOBILITY_BEARER
#ifdef QT_DEPRECATED
- QT_DEPRECATED QString bearerName() const;
+ // Required to maintain source compatibility with Qt Mobility.
+ QT_DEPRECATED inline QString bearerName() const { return bearerTypeName(); }
#endif
BearerType bearerType() const;
QString bearerTypeName() const;
+#else
+ QString bearerName() const;
+#endif
QString identifier() const;
bool isRoamingAvailable() const;
diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h
index e7fffac..0b40147 100644
--- a/src/network/bearer/qnetworksession.h
+++ b/src/network/bearer/qnetworksession.h
@@ -89,11 +89,7 @@ public:
OperationNotSupportedError,
InvalidConfigurationError
};
-#ifndef QT_MOBILITY_BEARER
- QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0);
-#else
explicit QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0);
-#endif
virtual ~QNetworkSession();
bool isOpen() const;
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index c2338be..6e56553 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -90,7 +90,10 @@
QT_BEGIN_NAMESPACE
-//#define QT_GL_NO_SCISSOR_TEST
+#if defined(Q_OS_SYMBIAN)
+#define QT_GL_NO_SCISSOR_TEST
+#endif
+
#if defined(Q_WS_WIN)
extern Q_GUI_EXPORT bool qt_cleartype_enabled;
#endif
@@ -374,12 +377,12 @@ void QGL2PaintEngineExPrivate::updateMatrix()
dx = ceilf(dx - 0.5f);
dy = ceilf(dy - 0.5f);
}
-
+#ifndef Q_OS_SYMBIAN
if (addOffset) {
dx += 0.49f;
dy += 0.49f;
}
-
+#endif
pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13();
pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23();
pmvMatrix[2][0] = (wfactor * dx) - transform.m33();
@@ -686,7 +689,12 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
const QPointF* const points = reinterpret_cast<const QPointF*>(path.points());
// ### Remove before release...
- static bool do_vectorpath_cache = qgetenv("QT_OPENGL_NO_PATH_CACHE").isEmpty();
+#ifdef Q_OS_SYMBIAN
+ // ### There are some unresolved issues in Symbian vector path caching.
+ static bool do_vectorpath_cache = false;
+#else
+ static bool do_vectorpath_cache = true;
+#endif
// Check to see if there's any hints
if (path.shape() == QVectorPath::RectangleHint) {
diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp
index df7cbc2..f14b0a4 100644
--- a/src/opengl/gl2paintengineex/qtriangulator.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulator.cpp
@@ -65,7 +65,11 @@ QT_BEGIN_NAMESPACE
// Quick sort.
template <class T, class LessThan>
+#ifdef Q_CC_RVCT // RVCT 2.2 doesn't see recursive _static_ template function
+void sort(T *array, int count, LessThan lessThan)
+#else
static void sort(T *array, int count, LessThan lessThan)
+#endif
{
// If the number of elements fall below some threshold, use insertion sort.
const int INSERTION_SORT_LIMIT = 7; // About 7 is fastest on my computer...
@@ -122,7 +126,11 @@ sort_loop_end:
// Quick sort.
template <class T>
+#ifdef Q_CC_RVCT
+void sort(T *array, int count) // RVCT 2.2 doesn't see recursive _static_ template function
+#else
static void sort(T *array, int count)
+#endif
{
// If the number of elements fall below some threshold, use insertion sort.
const int INSERTION_SORT_LIMIT = 25; // About 25 is fastest on my computer...
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 81b964a..c7ca4bc 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -11,30 +11,30 @@ unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
include(../qbase.pri)
-!win32:!embedded:!mac:CONFIG += x11
+!win32:!embedded:!mac:!symbian:CONFIG += x11
contains(QT_CONFIG, opengl):CONFIG += opengl
contains(QT_CONFIG, opengles1):CONFIG += opengles1
contains(QT_CONFIG, opengles2):CONFIG += opengles2
contains(QT_CONFIG, egl):CONFIG += egl
HEADERS += qgl.h \
- qgl_p.h \
- qglcolormap.h \
+ qgl_p.h \
+ qglcolormap.h \
qglfunctions.h \
- qglpixelbuffer.h \
+ qglpixelbuffer.h \
qglpixelbuffer_p.h \
- qglframebufferobject.h \
+ qglframebufferobject.h \
qglframebufferobject_p.h \
qglextensions_p.h \
qglpaintdevice_p.h \
qglbuffer.h \
-SOURCES += qgl.cpp \
- qglcolormap.cpp \
+SOURCES += qgl.cpp \
+ qglcolormap.cpp \
qglfunctions.cpp \
- qglpixelbuffer.cpp \
- qglframebufferobject.cpp \
+ qglpixelbuffer.cpp \
+ qglframebufferobject.cpp \
qglextensions.cpp \
qglpaintdevice.cpp \
qglbuffer.cpp \
@@ -121,7 +121,7 @@ mac {
win32:!wince*: {
DEFINES += QT_NO_EGL
SOURCES += qgl_win.cpp \
- qglpixelbuffer_win.cpp
+ qglpixelbuffer_win.cpp
}
wince*: {
SOURCES += qgl_wince.cpp \
@@ -149,4 +149,14 @@ embedded {
}
}
+symbian {
+ SOURCES += qgl_symbian.cpp \
+ qglpixelbuffer_egl.cpp \
+ qgl_egl.cpp
+
+ HEADERS += qgl_egl_p.h
+
+ symbian:TARGET.UID3 = 0x2002131A
+}
+
INCLUDEPATH += ../3rdparty/harfbuzz/src
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 71d42a5..aac6db4 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -98,7 +98,7 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
+#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs;
#endif
@@ -1691,6 +1691,10 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
workaround_needsFullClearOnEveryFrame = false;
workaround_brokenFBOReadBack = false;
workaroundsCached = false;
+
+ workaround_brokenTextureFromPixmap = false;
+ workaround_brokenTextureFromPixmap_init = false;
+
for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
vertexAttributeArraysEnabledState[i] = false;
}
@@ -2260,7 +2264,7 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu
}
}
-#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
+#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
QGLExtensionFuncs& QGLContextPrivate::extensionFuncs(const QGLContext *)
{
return qt_extensionFuncs;
@@ -2283,11 +2287,19 @@ QImage QGLContextPrivate::convertToGLFormat(const QImage &image, bool force_prem
QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format,
QGLContext::BindOptions options)
{
+ Q_Q(QGLContext);
+
const qint64 key = image.cacheKey();
QGLTexture *texture = textureCacheLookup(key, target);
if (texture) {
- glBindTexture(target, texture->id);
- return texture;
+ if (image.paintingActive()) {
+ // A QPainter is active on the image - take the safe route and replace the texture.
+ q->deleteTexture(texture->id);
+ texture = 0;
+ } else {
+ glBindTexture(target, texture->id);
+ return texture;
+ }
}
if (!texture)
@@ -2553,14 +2565,19 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target,
}
#else
Q_UNUSED(pd);
- Q_UNUSED(q);
#endif
const qint64 key = pixmap.cacheKey();
QGLTexture *texture = textureCacheLookup(key, target);
if (texture) {
- glBindTexture(target, texture->id);
- return texture;
+ if (pixmap.paintingActive()) {
+ // A QPainter is active on the pixmap - take the safe route and replace the texture.
+ q->deleteTexture(texture->id);
+ texture = 0;
+ } else {
+ glBindTexture(target, texture->id);
+ return texture;
+ }
}
#if defined(Q_WS_X11)
@@ -2571,11 +2588,27 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target,
&& target == GL_TEXTURE_2D
&& QApplication::instance()->thread() == QThread::currentThread())
{
- texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options);
- if (texture) {
- texture->options |= QGLContext::MemoryManagedBindOption;
- texture->boundPixmap = pd;
- boundPixmaps.insert(pd, QPixmap(pixmap));
+ if (!workaround_brokenTextureFromPixmap_init) {
+ workaround_brokenTextureFromPixmap_init = true;
+
+ const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
+ const int pos = versionString.indexOf("NVIDIA ");
+
+ if (pos >= 0) {
+ const QByteArray nvidiaVersionString = versionString.mid(pos + strlen("NVIDIA "));
+
+ if (nvidiaVersionString.startsWith("195") || nvidiaVersionString.startsWith("256"))
+ workaround_brokenTextureFromPixmap = true;
+ }
+ }
+
+ if (!workaround_brokenTextureFromPixmap) {
+ texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options);
+ if (texture) {
+ texture->options |= QGLContext::MemoryManagedBindOption;
+ texture->boundPixmap = pd;
+ boundPixmaps.insert(pd, QPixmap(pixmap));
+ }
}
}
#endif
@@ -4156,6 +4189,34 @@ bool QGLWidget::event(QEvent *e)
d->glcx->d_ptr->clearDrawable();
# endif
}
+#elif defined(Q_OS_SYMBIAN)
+ // prevents errors on some systems, where we get a flush to a
+ // hidden widget
+ if (e->type() == QEvent::Hide) {
+ makeCurrent();
+ glFinish();
+ doneCurrent();
+ } else if (e->type() == QEvent::ParentChange) {
+ // if we've reparented a window that has the current context
+ // bound, we need to rebind that context to the new window id
+ if (d->glcx == QGLContext::currentContext())
+ makeCurrent();
+
+ if (testAttribute(Qt::WA_TranslucentBackground))
+ setContext(new QGLContext(d->glcx->requestedFormat(), this));
+ }
+
+ // A re-parent is likely to destroy the Symbian window and re-create it. It is important
+ // that we free the EGL surface _before_ the winID changes - otherwise we can leak.
+ if (e->type() == QEvent::ParentAboutToChange)
+ d->glcx->d_func()->destroyEglSurfaceForDevice();
+
+ if ((e->type() == QEvent::ParentChange) || (e->type() == QEvent::WindowStateChange)) {
+ // The window may have been re-created during re-parent or state change - if so, the EGL
+ // surface will need to be re-created.
+ d->recreateEglSurface();
+ }
+
#endif
return QWidget::event(e);
@@ -4363,6 +4424,11 @@ void QGLWidget::glDraw()
Q_D(QGLWidget);
if (!isValid())
return;
+#ifdef Q_OS_SYMBIAN
+ // Crashes on Symbian if trying to render to invisible surfaces
+ if (!isVisible() && d->glcx->device()->devType() == QInternal::Widget)
+ return;
+#endif
makeCurrent();
#ifndef QT_OPENGL_ES
if (d->glcx->deviceIsPixmap())
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index a154325..ebd1169 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -230,7 +230,7 @@ void QGLContext::swapBuffers() const
void QGLContextPrivate::destroyEglSurfaceForDevice()
{
if (eglSurface != EGL_NO_SURFACE) {
-#ifdef Q_WS_X11
+#if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN)
// Make sure we don't call eglDestroySurface on a surface which
// was created for a different winId. This applies only to QGLWidget
// paint device, so make sure this is the one we're operating on
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 5044795..f86a848 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -167,6 +167,9 @@ public:
#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
, eglSurfaceWindowId(0)
#endif
+#if defined(Q_OS_SYMBIAN)
+ , eglSurfaceWindowId(0)
+#endif
{
isGLWidget = 1;
}
@@ -208,6 +211,10 @@ public:
#elif defined(Q_WS_QWS)
QWSGLWindowSurface *wsurf;
#endif
+#ifdef Q_OS_SYMBIAN
+ void recreateEglSurface();
+ WId eglSurfaceWindowId;
+#endif
};
class QGLContextGroupResourceBase;
@@ -394,6 +401,9 @@ public:
uint workaround_brokenFBOReadBack : 1;
uint workaroundsCached : 1;
+ uint workaround_brokenTextureFromPixmap : 1;
+ uint workaround_brokenTextureFromPixmap_init : 1;
+
QPaintDevice *paintDevice;
QColor transpColor;
QGLContext *q_ptr;
@@ -416,7 +426,7 @@ public:
static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *ctx) { return ctx->d_ptr->group->extensionFuncs(); }
#endif
-#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
+#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
static Q_OPENGL_EXPORT QGLExtensionFuncs qt_extensionFuncs;
static Q_OPENGL_EXPORT QGLExtensionFuncs& extensionFuncs(const QGLContext *);
#endif
diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp
new file mode 100644
index 0000000..73fe4c9
--- /dev/null
+++ b/src/opengl/qgl_symbian.cpp
@@ -0,0 +1,362 @@
+/****************************************************************************
+**
+** 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 QtOpenGL 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$
+**
+****************************************************************************/
+
+
+#include "qgl.h"
+#include <coemain.h>
+#include <coecntrl.h>
+#include <w32std.h>
+#include <private/qpixmap_s60_p.h>
+#include <private/qimagepixmapcleanuphooks_p.h>
+#include <private/qgl_p.h>
+#include <private/qpaintengine_opengl_p.h>
+#include <private/qwidget_p.h> // to access QWExtra
+#include "qgl_egl_p.h"
+#include "qcolormap.h"
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+// Turn off "direct to window" rendering if EGL cannot support it.
+#if !defined(EGL_RENDER_BUFFER) || !defined(EGL_SINGLE_BUFFER)
+#if defined(QGL_DIRECT_TO_WINDOW)
+#undef QGL_DIRECT_TO_WINDOW
+#endif
+#endif
+
+// Determine if preserved window contents should be used.
+#if !defined(EGL_SWAP_BEHAVIOR) || !defined(EGL_BUFFER_PRESERVED)
+#if !defined(QGL_NO_PRESERVED_SWAP)
+#define QGL_NO_PRESERVED_SWAP 1
+#endif
+#endif
+
+/*
+ QGLTemporaryContext implementation
+*/
+
+
+class QGLTemporaryContextPrivate
+{
+public:
+ bool initialized;
+ RWindow *window;
+ EGLContext context;
+ EGLSurface surface;
+ EGLDisplay display;
+};
+
+QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *)
+ : d(new QGLTemporaryContextPrivate)
+{
+ d->initialized = false;
+ d->window = 0;
+ d->context = 0;
+ d->surface = 0;
+
+ d->display = d->display = QEgl::display();
+
+ EGLConfig config;
+ int numConfigs = 0;
+ EGLint attribs[] = {
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+#ifdef QT_OPENGL_ES_2
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+#endif
+ EGL_NONE
+ };
+
+ eglChooseConfig(d->display, attribs, &config, 1, &numConfigs);
+ if (!numConfigs) {
+ qWarning("QGLTemporaryContext: No EGL configurations available.");
+ return;
+ }
+
+ d->window = new RWindow(CCoeEnv::Static()->WsSession());
+ d->window->Construct(CCoeEnv::Static()->RootWin(),(uint)this);
+
+ d->surface = eglCreateWindowSurface(d->display, config, (EGLNativeWindowType) d->window, NULL);
+
+ if (d->surface == EGL_NO_SURFACE) {
+ qWarning("QGLTemporaryContext: Error creating EGL surface.");
+ delete d->window;
+ d->window = 0;
+ return;
+ }
+
+ EGLint contextAttribs[] = {
+#ifdef QT_OPENGL_ES_2
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+#endif
+ EGL_NONE
+ };
+ d->context = eglCreateContext(d->display, config, 0, contextAttribs);
+ if (d->context != EGL_NO_CONTEXT
+ && eglMakeCurrent(d->display, d->surface, d->surface, d->context))
+ {
+ d->initialized = true;
+ } else {
+ qWarning("QGLTemporaryContext: Error creating EGL context.");
+ d->window = 0;
+ return;
+ }
+}
+
+QGLTemporaryContext::~QGLTemporaryContext()
+{
+ if (d->initialized) {
+ eglMakeCurrent(d->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ eglDestroyContext(d->display, d->context);
+ eglDestroySurface(d->display, d->surface);
+ delete d->window;
+ }
+}
+
+bool QGLFormat::hasOpenGLOverlays()
+{
+ return false;
+}
+
+// Chooses the EGL config and creates the EGL context
+bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as in qgl_x11egl.cpp
+{
+ Q_D(QGLContext);
+
+ if (!device())
+ return false;
+
+ int devType = device()->devType();
+
+ if ((devType != QInternal::Widget) && (devType != QInternal::Pbuffer)) {
+ qWarning("WARNING: Creating a QGLContext not supported on device type %d", devType);
+ return false;
+ }
+
+ // Get the display and initialize it.
+ if (d->eglContext == 0) {
+ d->eglContext = new QEglContext();
+ d->ownsEglContext = true;
+ d->eglContext->setApi(QEgl::OpenGL);
+
+ // If the device is a widget with WA_TranslucentBackground set, make sure the glFormat
+ // has the alpha channel option set:
+ if (devType == QInternal::Widget) {
+ QWidget* widget = static_cast<QWidget*>(device());
+ if (widget->testAttribute(Qt::WA_TranslucentBackground))
+ d->glFormat.setAlpha(true);
+ }
+
+ // Construct the configuration we need for this surface.
+ QEglProperties configProps;
+ configProps.setDeviceType(devType);
+ configProps.setPaintDeviceFormat(device());
+ configProps.setRenderableType(QEgl::OpenGL);
+ configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_SWAP_BEHAVIOR_PRESERVED_BIT);
+
+ qt_eglproperties_set_glformat(configProps, d->glFormat);
+
+ if (!d->eglContext->chooseConfig(configProps, QEgl::BestPixelFormat)) {
+ delete d->eglContext;
+ d->eglContext = 0;
+ return false;
+ }
+
+ // Create a new context for the configuration.
+ QEglContext* eglSharedContext = shareContext ? shareContext->d_func()->eglContext : 0;
+ if (!d->eglContext->createContext(eglSharedContext)) {
+ delete d->eglContext;
+ d->eglContext = 0;
+ return false;
+ }
+ d->sharing = d->eglContext->isSharing();
+ if (d->sharing && shareContext)
+ const_cast<QGLContext *>(shareContext)->d_func()->sharing = true;
+ }
+
+ // Inform the higher layers about the actual format properties
+ qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config());
+
+ // Do don't create the EGLSurface for everything.
+ // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface
+ // QGLWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface
+ // QGLPixelBuffer - no, it creates the surface itself and stores it in QGLPixelBufferPrivate::pbuf
+
+ if (devType == QInternal::Widget) {
+ if (d->eglSurface != EGL_NO_SURFACE)
+ eglDestroySurface(d->eglContext->display(), d->eglSurface);
+
+ d->eglSurface = QEgl::createSurface(device(), d->eglContext->config());
+
+#if !defined(QGL_NO_PRESERVED_SWAP)
+ eglGetError(); // Clear error state first.
+ eglSurfaceAttrib(QEgl::display(), d->eglSurface,
+ EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
+ if (eglGetError() != EGL_SUCCESS) {
+ qWarning("QGLContext: could not enable preserved swap");
+ }
+#endif
+
+ setWindowCreated(true);
+ }
+
+ return true;
+}
+
+void QGLWidget::resizeEvent(QResizeEvent *)
+{
+ Q_D(QGLWidget);
+ if (!isValid())
+ return;
+
+ if (QGLContext::currentContext())
+ doneCurrent();
+
+ // Symbian needs to recreate the surface on resize.
+ d->recreateEglSurface();
+
+ makeCurrent();
+ if (!d->glcx->initialized())
+ glInit();
+ resizeGL(width(), height());
+ //handle overlay
+}
+
+const QGLContext* QGLWidget::overlayContext() const
+{
+ return 0;
+}
+
+void QGLWidget::makeOverlayCurrent()
+{
+ //handle overlay
+}
+
+void QGLWidget::updateOverlayGL()
+{
+ //handle overlay
+}
+
+void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, bool deleteOldContext)
+{
+ Q_D(QGLWidget);
+ if (context == 0) {
+ qWarning("QGLWidget::setContext: Cannot set null context");
+ return;
+ }
+ if (!context->deviceIsPixmap() && context->device() != this) {
+ qWarning("QGLWidget::setContext: Context must refer to this widget");
+ return;
+ }
+
+ if (d->glcx)
+ d->glcx->doneCurrent();
+ QGLContext* oldcx = d->glcx;
+ d->glcx = context;
+
+ bool createFailed = false;
+ if (!d->glcx->isValid()) {
+ // Create the QGLContext here, which in turn chooses the EGL config
+ // and creates the EGL context:
+ if (!d->glcx->create(shareContext ? shareContext : oldcx))
+ createFailed = true;
+ }
+ if (createFailed) {
+ if (deleteOldContext)
+ delete oldcx;
+ return;
+ }
+
+ d->eglSurfaceWindowId = winId(); // Remember the window id we created the surface for
+}
+
+void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget* shareWidget)
+{
+ Q_Q(QGLWidget);
+
+ initContext(context, shareWidget);
+
+ if(q->isValid() && glcx->format().hasOverlay()) {
+ //no overlay
+ qWarning("QtOpenGL ES doesn't currently support overlays");
+ }
+}
+
+void QGLWidgetPrivate::cleanupColormaps()
+{
+}
+
+const QGLColormap & QGLWidget::colormap() const
+{
+ return d_func()->cmap;
+}
+
+void QGLWidget::setColormap(const QGLColormap &)
+{
+}
+
+void QGLWidgetPrivate::recreateEglSurface()
+{
+ Q_Q(QGLWidget);
+
+ WId currentId = q->winId();
+
+ if (glcx->d_func()->eglSurface != EGL_NO_SURFACE) {
+ eglDestroySurface(glcx->d_func()->eglContext->display(),
+ glcx->d_func()->eglSurface);
+ }
+
+ glcx->d_func()->eglSurface = QEgl::createSurface(glcx->device(),
+ glcx->d_func()->eglContext->config());
+
+#if !defined(QGL_NO_PRESERVED_SWAP)
+ eglGetError(); // Clear error state first.
+ eglSurfaceAttrib(QEgl::display(), glcx->d_func()->eglSurface,
+ EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
+ if (eglGetError() != EGL_SUCCESS) {
+ qWarning("QGLContext: could not enable preserved swap");
+ }
+#endif
+
+ eglSurfaceWindowId = currentId;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 653e805..1efd398 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -367,7 +367,7 @@ void QGLPixmapData::ensureCreated() const
}
void QGLPixmapData::fromImage(const QImage &image,
- Qt::ImageConversionFlags /*flags*/)
+ Qt::ImageConversionFlags flags)
{
if (image.size() == QSize(w, h))
setSerialNumber(++qt_gl_pixmap_serial);
@@ -381,7 +381,9 @@ void QGLPixmapData::fromImage(const QImage &image,
if (qApp->desktop()->depth() == 16)
format = QImage::Format_RGB16;
- if (image.hasAlphaChannel() && const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels())
+ if (image.hasAlphaChannel()
+ && ((flags & Qt::NoOpaqueDetection)
+ || const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels()))
format = QImage::Format_ARGB32_Premultiplied;;
m_source = image.convertToFormat(format);
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index cb413d0..e8ec333 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -47,6 +47,9 @@
#endif
#include "qvg_p.h"
#include "qvgimagepool_p.h"
+#include <QBuffer>
+#include <QImageReader>
+#include <QtGui/private/qimage_p.h>
QT_BEGIN_NAMESPACE
@@ -152,11 +155,59 @@ void QVGPixmapData::resize(int wid, int ht)
void QVGPixmapData::fromImage
(const QImage &image, Qt::ImageConversionFlags flags)
{
+ QImage img = image;
+ createPixmapForImage(img, flags, false);
+}
+
+void QVGPixmapData::fromImageReader(QImageReader *imageReader,
+ Qt::ImageConversionFlags flags)
+{
+ QImage image = imageReader->read();
+ if (image.isNull())
+ return;
+
+ createPixmapForImage(image, flags, true);
+}
+
+bool QVGPixmapData::fromFile(const QString &filename, const char *format,
+ Qt::ImageConversionFlags flags)
+{
+ QImage image = QImageReader(filename, format).read();
+ if (image.isNull())
+ return false;
+
+ createPixmapForImage(image, flags, true);
+
+ return !isNull();
+}
+
+bool QVGPixmapData::fromData(const uchar *buffer, uint len, const char *format,
+ Qt::ImageConversionFlags flags)
+{
+ QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer), len);
+ QBuffer b(&a);
+ b.open(QIODevice::ReadOnly);
+ QImage image = QImageReader(&b, format).read();
+ if (image.isNull())
+ return false;
+
+ createPixmapForImage(image, flags, true);
+
+ return !isNull();
+}
+
+void QVGPixmapData::createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace)
+{
if (image.size() == QSize(w, h))
setSerialNumber(++qt_vg_pixmap_serial);
else
resize(image.width(), image.height());
- source = image.convertToFormat(sourceFormat(), flags);
+
+ if (inPlace && image.data_ptr()->convertInPlace(sourceFormat(), flags))
+ source = image;
+ else
+ source = image.convertToFormat(sourceFormat());
+
recreate = true;
}
diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h
index c21b48f..114d545 100644
--- a/src/openvg/qpixmapdata_vg_p.h
+++ b/src/openvg/qpixmapdata_vg_p.h
@@ -64,6 +64,7 @@ QT_BEGIN_NAMESPACE
class QEglContext;
class QVGImagePool;
+class QImageReader;
#if !defined(QT_NO_EGL)
class QVGPixmapData;
@@ -87,6 +88,12 @@ public:
void resize(int width, int height);
void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
+ void fromImageReader(QImageReader *imageReader,
+ Qt::ImageConversionFlags flags);
+ bool fromFile(const QString &filename, const char *format,
+ Qt::ImageConversionFlags flags);
+ bool fromData(const uchar *buffer, uint len, const char *format,
+ Qt::ImageConversionFlags flags);
void fill(const QColor &color);
bool hasAlphaChannel() const;
@@ -126,6 +133,7 @@ public:
protected:
int metric(QPaintDevice::PaintDeviceMetric metric) const;
+ void createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace);
#if defined(Q_OS_SYMBIAN)
void cleanup();
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index 6d8f7f2..bbe8ab1 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -5,7 +5,7 @@ contains(QT_CONFIG, dbus) {
SUBDIRS += icd
} else {
SUBDIRS += generic
- !mac:SUBDIRS += connman networkmanager
+ linux*:SUBDIRS += connman networkmanager
}
}
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index 3b5ae86..341f7cd 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -328,7 +328,6 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath)
void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value)
{
Q_UNUSED(path);
-// qDebug() << __FUNCTION__ << path << item << value.variant();
QMutexLocker locker(&mutex);
if(item == "Services") {
@@ -380,12 +379,10 @@ void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QSt
void QConnmanEngine::networkPropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value)
{
QMutexLocker locker(&mutex);
-// qDebug() << __FUNCTION__ << path << item << value.variant();
}
void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const QString &item,const QDBusVariant &value)
{
-// qDebug() << __FUNCTION__ << devpath << item << value.variant();
QMutexLocker locker(&mutex);
if(item == "Networks") {
@@ -429,7 +426,6 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q
void QConnmanEngine::technologyPropertyChangedContext(const QString & path, const QString &item, const QDBusVariant &value)
{
-// qDebug() << __FUNCTION__ << path << item << value.variant();
if(item == "Devices") {
QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant());
QStringList list = qdbus_cast<QStringList>(arg);
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index 0ffada9..3fc0bae 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -481,9 +481,7 @@ QVariant QConnmanProfileInterface::getProperty(const QString &property)
QVariantMap map = getProperties();
if (map.contains(property)) {
var = map.value(property);
- } else {
- qDebug() <<__FUNCTION__<< "Could not find" << property;
- }
+ }
return var;
}
@@ -522,8 +520,6 @@ QConnmanServiceInterface::~QConnmanServiceInterface()
void QConnmanServiceInterface::connectNotify(const char *signal)
{
-// qWarning() << __FUNCTION__ << signal << this->path();
-
if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
this->path(),
@@ -569,9 +565,7 @@ QVariant QConnmanServiceInterface::getProperty(const QString &property)
QVariantMap map = getProperties();
if (map.contains(property)) {
var = map.value(property);
- } else {
-// qDebug() <<__FUNCTION__<< "Could not find" << property;
- }
+ }
return var;
}
@@ -1051,15 +1045,7 @@ QVariantMap QConnmanDeviceInterface::getProperties()
bool QConnmanDeviceInterface::setProperty(const QString &name, const QDBusVariant &value)
{
-
-// QList<QVariant> args;
- qWarning() << __FUNCTION__ << name << value.variant();
-// args << QVariant::fromValue(name);
-// args << QVariant::fromValue(value);
-
QDBusMessage reply = this->call(QLatin1String("SetProperty"),name, QVariant::fromValue(value));
-qWarning() << reply.errorMessage();
-
return true;
}
@@ -1148,7 +1134,6 @@ bool QConnmanDeviceInterface::setEnabled(bool powered)
<< QVariant::fromValue(QDBusVariant(powered));
QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args);
- qWarning() << reply.errorMessage() << reply.errorName();
return true;
}
@@ -1164,8 +1149,6 @@ QConnmanDBusHelper::~QConnmanDBusHelper()
void QConnmanDBusHelper::propertyChanged(const QString &item, const QDBusVariant &var)
{
QDBusMessage msg = this->message();
-// qWarning() << sender();
- // qWarning() << msg.interface() << msg.path() << item << var.variant() <<"\n";
Q_EMIT propertyChangedContext(msg.path() ,item, var);
}
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index 0900329..3264f15 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -275,6 +275,8 @@ void QIcdEngine::initialize()
userChoiceConfigurations.insert(cpPriv->id, ptr);
doRequestUpdate();
+
+ getIcdInitialState();
}
static inline QString network_attrs_to_security(uint network_attrs)
@@ -623,7 +625,11 @@ void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned)
changed = true;
}
- if (ptr->state != QNetworkConfiguration::Discovered) {
+ /* If this config is the current active one, we do not set it
+ * to discovered.
+ */
+ if ((ptr->state != QNetworkConfiguration::Discovered) &&
+ (ptr->state != QNetworkConfiguration::Active)) {
ptr->state = QNetworkConfiguration::Discovered;
changed = true;
}
@@ -786,10 +792,48 @@ void QIcdEngine::startListeningStateSignalsForAllConnections()
ICD_DBUS_API_INTERFACE,
ICD_DBUS_API_STATE_SIG,
this, SLOT(connectionStateSignalsSlot(QDBusMessage)));
+}
+
+void QIcdEngine::getIcdInitialState()
+{
+ /* Instead of requesting ICD status asynchronously, we ask it synchronously.
+ * It ensures that we always get right icd status BEFORE initialize() ends.
+ * If not, initialize() might end before we got icd status and
+ * QNetworkConfigurationManager::updateConfigurations()
+ * call from user might also end before receiving icd status.
+ * In such case, we come up to a bug:
+ * QNetworkConfigurationManagerPrivate::isOnline() will be false even
+ * if we are connected.
+ */
+ Maemo::Icd icd;
+ QList<Maemo::IcdStateResult> state_results;
+ QNetworkConfigurationPrivatePointer ptr;
- // Calling ICD_DBUS_API_STATE_REQ makes sure that initial state will be updated immediately
- m_gettingInitialConnectionState = true;
- m_dbusInterface->call(ICD_DBUS_API_STATE_REQ);
+ if (icd.state(state_results) && !state_results.isEmpty()) {
+
+ if (!(state_results.first().params.network_attrs == 0 &&
+ state_results.first().params.network_id.isEmpty())) {
+
+ switch (state_results.first().state) {
+ case ICD_STATE_CONNECTED:
+ m_onlineIapId = state_results.first().params.network_id;
+
+ ptr = accessPointConfigurations.value(m_onlineIapId);
+ if (ptr) {
+ QMutexLocker configLocker(&ptr->mutex);
+ ptr->state = QNetworkConfiguration::Active;
+ configLocker.unlock();
+
+ mutex.unlock();
+ emit configurationChanged(ptr);
+ mutex.lock();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
}
void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg)
@@ -814,12 +858,12 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg)
ptr->type = QNetworkConfiguration::InternetAccessPoint;
if (ptr->state != QNetworkConfiguration::Active) {
ptr->state = QNetworkConfiguration::Active;
- if (!m_gettingInitialConnectionState) {
- configLocker.unlock();
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- }
+
+ configLocker.unlock();
+ locker.unlock();
+ emit configurationChanged(ptr);
+ locker.relock();
+
m_onlineIapId = iapid;
}
} else {
@@ -840,22 +884,21 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg)
ptr->type = QNetworkConfiguration::InternetAccessPoint;
if (ptr->state == QNetworkConfiguration::Active) {
ptr->state = QNetworkConfiguration::Discovered;
- if (!m_gettingInitialConnectionState) {
- configLocker.unlock();
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- // Note: If ICD switches used IAP from one to another:
- // 1) new IAP is reported to be online first
- // 2) old IAP is reported to be offline then
- // => Device can be reported to be offline only
- // if last known online IAP is reported to be disconnected
- if (iapid == m_onlineIapId) {
- // It's known that there is only one global ICD connection
- // => Because ICD state was reported to be DISCONNECTED, Device is offline
- m_onlineIapId.clear();
- }
+ configLocker.unlock();
+ locker.unlock();
+ emit configurationChanged(ptr);
+ locker.relock();
+
+ // Note: If ICD switches used IAP from one to another:
+ // 1) new IAP is reported to be online first
+ // 2) old IAP is reported to be offline then
+ // => Device can be reported to be offline only
+ // if last known online IAP is reported to be disconnected
+ if (iapid == m_onlineIapId) {
+ // It's known that there is only one global ICD connection
+ // => Because ICD state was reported to be DISCONNECTED, Device is offline
+ m_onlineIapId.clear();
}
}
} else {
@@ -876,8 +919,6 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg)
locker.unlock();
emit iapStateChanged(iapid, icd_connection_state);
locker.relock();
-
- m_gettingInitialConnectionState = false;
}
void QIcdEngine::requestUpdate()
diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h
index a768d84..0d5ba27 100644
--- a/src/plugins/bearer/icd/qicdengine.h
+++ b/src/plugins/bearer/icd/qicdengine.h
@@ -152,6 +152,7 @@ private:
void startListeningStateSignalsForAllConnections();
void doRequestUpdate(QList<Maemo::IcdScanResult> scanned = QList<Maemo::IcdScanResult>());
void cancelAsyncConfigurationUpdate();
+ void getIcdInitialState();
private:
IapMonitor *iapMonitor;
@@ -162,7 +163,6 @@ private:
QList<Maemo::IcdScanResult> m_scanResult;
bool firstUpdate;
- bool m_gettingInitialConnectionState;
bool m_scanGoingOn;
};
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp
index 2583b28..3170bf6 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp
@@ -339,8 +339,6 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
isOpen = false;
opened = false;
- connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged()));
-
connect(engine, SIGNAL(iapStateChanged(const QString&, uint)),
this, SLOT(iapStateChanged(const QString&, uint)));
@@ -460,14 +458,15 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
else
ptr->name = ptr->id;
+ const QString identifier = ptr->id;
+
+ configLocker.unlock();
+
// Add the new active configuration to manager or update the old config
- if (!engine->hasIdentifier(ptr->id)) {
- configLocker.unlock();
+ if (!engine->hasIdentifier(identifier))
engine->addSessionConfiguration(ptr);
- } else {
- configLocker.unlock();
+ else
engine->changedSessionConfiguration(ptr);
- }
}
break;
diff --git a/src/plugins/graphicssystems/opengl/opengl.pro b/src/plugins/graphicssystems/opengl/opengl.pro