summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/declarative/webbrowser/content/Button.qml2
-rw-r--r--demos/declarative/webbrowser/content/FlickableWebView.qml5
-rw-r--r--demos/declarative/webbrowser/webbrowser.qml2
-rw-r--r--doc/src/declarative/basictypes.qdoc473
-rw-r--r--doc/src/declarative/elements.qdoc14
-rw-r--r--doc/src/declarative/globalobject.qdoc2
-rw-r--r--doc/src/declarative/pics/gridview-highlight.pngbin0 -> 11806 bytes
-rw-r--r--doc/src/declarative/pics/gridview-simple.pngbin0 -> 10149 bytes
-rw-r--r--doc/src/declarative/pics/gridview.pngbin10564 -> 0 bytes
-rw-r--r--doc/src/declarative/pics/rect-border-width.pngbin0 -> 356 bytes
-rw-r--r--doc/src/declarative/pics/repeater-modeldata.pngbin0 -> 3394 bytes
-rw-r--r--doc/src/declarative/pics/translate.pngbin0 -> 398 bytes
-rw-r--r--doc/src/declarative/pics/visualitemmodel.pngbin0 -> 347 bytes
-rw-r--r--doc/src/declarative/qml-intro.qdoc26
-rw-r--r--doc/src/development/rcc.qdoc40
-rw-r--r--doc/src/examples/pixelator.qdoc6
-rw-r--r--doc/src/examples/waitconditions.qdoc2
-rw-r--r--doc/src/snippets/declarative/gridview/ContactModel.qml (renamed from doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml)14
-rw-r--r--doc/src/snippets/declarative/gridview/gridview.qml110
-rw-r--r--doc/src/snippets/declarative/listview/highlight.qml104
-rw-r--r--doc/src/snippets/declarative/mousearea.qml119
-rw-r--r--doc/src/snippets/declarative/pathview/ContactModel.qml (renamed from doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml)9
-rw-r--r--doc/src/snippets/declarative/pathview/pathattributes.qml13
-rw-r--r--doc/src/snippets/declarative/pathview/pathview.qml22
-rw-r--r--doc/src/snippets/declarative/pathview/pics/qtlogo.png (renamed from doc/src/snippets/declarative/pathview/pics/qtlogo-64.png)bin2991 -> 2991 bytes
-rw-r--r--doc/src/snippets/declarative/rect-border-width.qml (renamed from doc/src/snippets/declarative/drag.qml)23
-rw-r--r--doc/src/snippets/declarative/repeater-modeldata.qml (renamed from doc/src/snippets/declarative/mouseregion.qml)31
-rw-r--r--examples/declarative/modelviews/webview/content/FieldText.qml2
-rw-r--r--examples/declarative/sqllocalstorage/hello.qml2
-rw-r--r--examples/declarative/text/edit/edit.qml16
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/app.qml1
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/app.qml1
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/app.qml1
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml1
-rw-r--r--examples/itemviews/fetchmore/filelistmodel.cpp2
-rw-r--r--mkspecs/common/qws.conf4
-rw-r--r--src/3rdparty/webkit/.tag2
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog10
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.pro2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog21
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/docs.pri2
-rw-r--r--src/corelib/global/qfeatures.h10
-rw-r--r--src/corelib/global/qfeatures.txt2
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp92
-rw-r--r--src/corelib/xml/qxmlstream.cpp2
-rw-r--r--src/declarative/QmlChanges.txt1
-rw-r--r--src/declarative/debugger/qdeclarativedebugtrace_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp27
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp185
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp5
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativelayoutitem.cpp5
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp37
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp50
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp59
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath.cpp7
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp13
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners.cpp101
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp18
-rw-r--r--src/declarative/graphicsitems/qdeclarativerepeater.cpp14
-rw-r--r--src/declarative/graphicsitems/qdeclarativescalegrid.cpp5
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp20
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp200
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p.h13
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p_p.h12
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp194
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p.h29
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p_p.h11
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp6
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp4
-rw-r--r--src/declarative/qml/qdeclarativecontext_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp38
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h3
-rw-r--r--src/declarative/qml/qdeclarativeinfo.h2
-rw-r--r--src/declarative/qml/qdeclarativeinstruction.cpp5
-rw-r--r--src/declarative/qml/qdeclarativepropertycache_p.h2
-rw-r--r--src/declarative/qml/qdeclarativestringconverters.cpp4
-rw-r--r--src/declarative/qml/qdeclarativestringconverters_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp6
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp23
-rw-r--r--src/declarative/util/qdeclarativefontloader.cpp31
-rw-r--r--src/declarative/util/qdeclarativepackage_p.h2
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp19
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp2
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation_p_p.h2
-rw-r--r--src/declarative/util/qdeclarativestate.cpp2
-rw-r--r--src/declarative/util/qdeclarativestate_p.h2
-rw-r--r--src/declarative/util/qdeclarativetimeline_p_p.h8
-rw-r--r--src/declarative/util/qdeclarativetimer.cpp23
-rw-r--r--src/declarative/util/qdeclarativetransitionmanager.cpp2
-rw-r--r--src/declarative/util/qdeclarativetransitionmanager_p_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp26
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp41
-rw-r--r--src/gui/kernel/qapplication.cpp17
-rw-r--r--src/gui/kernel/qdrag.cpp4
-rw-r--r--src/gui/painting/qpainter.cpp23
-rw-r--r--src/gui/text/qstatictext.cpp37
-rw-r--r--src/gui/text/qstatictext_p.h7
-rw-r--r--src/gui/text/qtextcursor.cpp87
-rw-r--r--src/gui/text/qtextcursor.h6
-rw-r--r--src/gui/text/qtextcursor_p.h3
-rw-r--r--src/gui/text/qtextlayout.cpp3
-rw-r--r--src/imports/folderlistmodel/plugin.cpp2
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp4
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.h4
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp33
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h3
-rw-r--r--src/opengl/qgl.cpp51
-rw-r--r--src/opengl/qgl_p.h36
-rw-r--r--src/s60installs/qt.iby15
-rw-r--r--src/s60installs/s60installs.pro21
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp48
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp122
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/positionAt.qml8
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp181
-rw-r--r--tests/auto/declarative/qdeclarativeviewer/data/orientation.qml17
-rw-r--r--tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp4
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml3
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml3
-rw-r--r--tests/auto/qstatictext/tst_qstatictext.cpp7
-rw-r--r--tests/auto/qtextcursor/tst_qtextcursor.cpp8
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp25
-rw-r--r--tools/assistant/tools/assistant/doc/images/assistant-assistant.pngbin105954 -> 205326 bytes
-rw-r--r--tools/porting/src/codemodel.h2
-rw-r--r--tools/qml/deviceorientation.cpp2
-rw-r--r--tools/qml/deviceorientation.h9
-rw-r--r--tools/qml/deviceorientation_maemo.cpp12
-rw-r--r--tools/qml/qmlruntime.cpp82
-rw-r--r--tools/qml/qmlruntime.h9
136 files changed, 2129 insertions, 1262 deletions
diff --git a/demos/declarative/webbrowser/content/Button.qml b/demos/declarative/webbrowser/content/Button.qml
index 976502c..4642cc7 100644
--- a/demos/declarative/webbrowser/content/Button.qml
+++ b/demos/declarative/webbrowser/content/Button.qml
@@ -49,7 +49,7 @@ Item {
Image {
id: icon; anchors.centerIn: parent
- opacity: action.enabled ? 1.0 : 0.4
+ opacity: if(action != undefined) {action.enabled ? 1.0 : 0.4} else 0
}
MouseArea {
diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml
index 34e8fff..62da2ea 100644
--- a/demos/declarative/webbrowser/content/FlickableWebView.qml
+++ b/demos/declarative/webbrowser/content/FlickableWebView.qml
@@ -48,6 +48,7 @@ Flickable {
property alias progress: webView.progress
property alias url: webView.url
property alias back: webView.back
+ property alias stop: webView.stop
property alias reload: webView.reload
property alias forward: webView.forward
@@ -96,8 +97,8 @@ Flickable {
function doZoom(zoom,centerX,centerY)
{
if (centerX) {
- var sc = zoom/contentsScale;
- scaleAnim.to = zoom;
+ var sc = zoom*contentsScale;
+ scaleAnim.to = sc;
flickVX.from = flickable.contentX
flickVX.to = Math.max(0,Math.min(centerX-flickable.width/2,webView.width*sc-flickable.width))
finalX.value = flickVX.to
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml
index 36e03bf..a923c92 100644
--- a/demos/declarative/webbrowser/webbrowser.qml
+++ b/demos/declarative/webbrowser/webbrowser.qml
@@ -47,7 +47,7 @@ import "content"
Rectangle {
id: webBrowser
- property string urlString : "http://qt.nokia.com/"
+ property string urlString : "http://www.nokia.com/"
width: 800; height: 600
color: "#343434"
diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc
index 8db1c35..87dab81 100644
--- a/doc/src/declarative/basictypes.qdoc
+++ b/doc/src/declarative/basictypes.qdoc
@@ -40,322 +40,377 @@
****************************************************************************/
/*!
- \page qdeclarativebasictypes.html
- \title QML Basic Types
+ \page qdeclarativebasictypes.html
+ \title QML Basic Types
- QML has a set of primitive types, as listed below, that are used throughout
- the \l {QML Elements}.
+ QML has a set of primitive types, as listed below, that are used throughout
+ the \l {QML Elements}.
- The simpler types in this list can also be used for defining a new
- \c property in a component. See \l{Extending types from QML} for the
- list of types that can be used for custom properties.
+ Some of these types can also be used for defining
+ \c property values in QML. See \l{Extending types from QML} for the
+ list of types that can be used for \c property values.
- \annotatedlist qmlbasictypes
+ \annotatedlist qmlbasictypes
*/
/*!
- \qmlbasictype int
- \ingroup qmlbasictypes
+ \qmlbasictype int
+ \ingroup qmlbasictypes
- \brief An integer is a whole number, e.g. 0, 10, or -20.
+ \brief An integer is a whole number, e.g. 0, 10, or -20.
- An integer is a whole number, e.g. 0, 10, or -20. The possible \c
- int values range from around -2000000000 to around 2000000000,
- although most elements will only accept a reduced range (which they
- mention in their documentation).
+ An integer is a whole number, e.g. 0, 10, or -20. The possible \c
+ int values range from around -2000000000 to around 2000000000,
+ although most elements will only accept a reduced range (which they
+ mention in their documentation).
- Example:
- \qml
- Item { width: 100; height: 200 }
- \endqml
+ Example:
+ \qml
+ Item { width: 100; height: 200 }
+ \endqml
- \sa {QML Basic Types}
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype bool
- \ingroup qmlbasictypes
+ \qmlbasictype bool
+ \ingroup qmlbasictypes
- \brief A boolean is a binary true/false value.
+ \brief A boolean is a binary true/false value.
- A boolean is a binary true/false value.
+ A boolean is a binary true/false value.
- Example:
- \qml
- Item { focus: true; clip: false }
- \endqml
+ Example:
+ \qml
+ Item { focus: true; clip: false }
+ \endqml
- \sa {QML Basic Types}
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype real
- \ingroup qmlbasictypes
+ \qmlbasictype real
+ \ingroup qmlbasictypes
- \brief A real number has a decimal point, e.g. 1.2 or -29.8.
+ \brief A real number has a decimal point, e.g. 1.2 or -29.8.
- A real number has a decimal point, e.g. 1.2 or -29.8.
+ A real number has a decimal point, e.g. 1.2 or -29.8.
- Example:
- \qml
- Item { width: 100.45; height: 150.82 }
- \endqml
+ Example:
+ \qml
+ Item { width: 100.45; height: 150.82 }
+ \endqml
- \note In QML all reals are stored in single precision, \l
- {http://en.wikipedia.org/wiki/IEEE_754} {IEEE floating point}
- format.
+ \note In QML all reals are stored in single precision, \l
+ {http://en.wikipedia.org/wiki/IEEE_754} {IEEE floating point}
+ format.
- \sa {QML Basic Types}
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype string
- \ingroup qmlbasictypes
+ \qmlbasictype string
+ \ingroup qmlbasictypes
- \brief A string is a free form text in quotes, e.g. "Hello world!".
+ \brief A string is a free form text in quotes, e.g. "Hello world!".
- A string is a free form text in quotes, e.g. "Hello world!".
+ A string is a free form text in quotes, e.g. "Hello world!".
- Example:
- \qml
- Text { text: "Hello world!" }
- \endqml
+ Example:
+ \qml
+ Text { text: "Hello world!" }
+ \endqml
- \sa {QML Basic Types}
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype url
- \ingroup qmlbasictypes
+ \qmlbasictype url
+ \ingroup qmlbasictypes
- \brief A URL is a resource locator, like a file name.
+ \brief A URL is a resource locator, like a file name.
- A URL is a resource locator, like a file name. It can be either
- absolute, e.g. "http://qt.nokia.com", or relative, e.g.
- "pics/logo.png". A relative URL is resolved relative to the URL of
- the component where the URL is converted from a JavaScript string
- expression to a url property value.
+ A URL is a resource locator, like a file name. It can be either
+ absolute, e.g. "http://qt.nokia.com", or relative, e.g.
+ "pics/logo.png". A relative URL is resolved relative to the URL of
+ the component where the URL is converted from a JavaScript string
+ expression to a url property value.
- Example:
- \qml
- Image { source: "pics/logo.png" }
- \endqml
+ Example:
+ \qml
+ Image { source: "pics/logo.png" }
+ \endqml
- \raw HTML
- \endraw
+ \raw HTML
+ \endraw
- \sa {QML Basic Types}
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype color
- \ingroup qmlbasictypes
-
- \brief A color is a standard color name in quotes.
-
- A color is a standard color name in quotes. It is normally specified
- as an \l {http://www.w3.org/TR/SVG/types.html#ColorKeywords} {SVG
- color name}. These names include colors like "red", "green" and
- "lightsteelblue".
-
- If the color you want isn't part of this list, colors can also be
- specified in hexidecimal triplets or quads that take the form \c
- "#RRGGBB" and \c "#AARRGGBB" respectively. For example, the color
- red corresponds to a triplet of \c "#FF0000" and a slightly
- transparent blue to a quad of \c "#800000FF".
-
- Example:
- \qml
- Rectangle { color: "steelblue" }
- Rectangle { color: "#FF0000" }
- Rectangle { color: "#800000FF" }
- \endqml
-
- \sa {QML Basic Types}
+ \qmlbasictype color
+ \ingroup qmlbasictypes
+
+ \brief A color is a standard color name in quotes.
+
+ A color is a standard color name in quotes. It is normally specified
+ as an \l {http://www.w3.org/TR/SVG/types.html#ColorKeywords} {SVG
+ color name}. These names include colors like "red", "green" and
+ "lightsteelblue".
+
+ If the color you want isn't part of this list, colors can also be
+ specified in hexidecimal triplets or quads that take the form \c
+ "#RRGGBB" and \c "#AARRGGBB" respectively. For example, the color
+ red corresponds to a triplet of \c "#FF0000" and a slightly
+ transparent blue to a quad of \c "#800000FF".
+
+ Example:
+ \qml
+ Rectangle { color: "steelblue" }
+ Rectangle { color: "#FF0000" }
+ Rectangle { color: "#800000FF" }
+ \endqml
+
+ Or with the \l{Qt::rgba()}{Qt.rgba()}, \l{Qt::hsla()}{Qt.hsla()}, \l{Qt::darker()}{Qt.darker()},
+ \l{Qt::lighter()}{Qt.lighter()} or \l{Qt::tint()}{Qt.tint()} functions:
+
+ \qml
+ Rectangle { color: Qt.rgba(255, 0, 0, 1) }
+ \endqml
+
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype point
- \ingroup qmlbasictypes
+ \qmlbasictype point
+ \ingroup qmlbasictypes
+
+ \brief A point type has x and y attributes.
+
+ A \c point type has \c x and \c y attributes.
- \brief A point is specified as "x,y".
+ To create a \c point value, specify it as a "x,y" string:
- A point is specified as "x,y".
+ \qml
+ CustomObject { myPointProperty: "0,20" }
+ \endqml
- Example:
- \qml
- Widget { pos: "0,20" }
- \endqml
+ Or use the \l{Qt::point()}{Qt.point()} function:
- \sa {QML Basic Types}
+ \qml
+ CustomObject { myPointProperty: Qt.point(0, 20) }
+ \endqml
+
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype size
- \ingroup qmlbasictypes
+ \qmlbasictype size
+ \ingroup qmlbasictypes
+
+ \brief A size type has width and height attributes
+
+ A \c size type has \c width and \c height attributes.
- \brief A size is specified as "width x height".
+ For example, to read the \l {Image::sourceSize} \c size property:
- A size is specified as "width x height".
+ \qml
+ Column {
+ Image { id: image; source: "logo.png" }
+ Text { text: image.sourceSize.width + "," + image.sourceSize.height }
+ }
+ \endqml
- Example:
- \qml
- Widget { size: "150x50" }
- \endqml
+ To create a \c size value, specify it as a "width x height" string:
- \sa {QML Basic Types}
+ \qml
+ LayoutItem { preferredSize: "150x50" }
+ \endqml
+
+ Or use the \l{Qt::size()}{Qt.size()} function:
+
+ \qml
+ LayoutItem { preferredSize: Qt.size(150, 50) }
+ \endqml
+
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype rect
- \ingroup qmlbasictypes
+ \qmlbasictype rect
+ \ingroup qmlbasictypes
+
+ \brief A rect type has x, y, width and height attributes.
+
+ A \c rect type has \c x, \c y, \c width and \c height attributes.
+
+ For example, to read the \l {Item::childrenRect.x}{Item::childrenRect} \c rect property:
+ \qml
+ Rectangle {
+ width: childrenRect.width
+ height: childrenRect.height
- \brief A rect is specified as "x, y, width x height".
+ Rectangle { width: 100; height: 100 }
+ }
+ \endqml
- A rect is specified as "x, y, width x height".
+ To create a \c rect value, specify it as a "x, y, width x height" string:
- Example:
- \qml
- Widget { geometry: "50,50,100x100" }
- \endqml
+ \qml
+ CustomObject { myRectProperty: "50,50,100x100" }
+ \endqml
- \sa {QML Basic Types}
+ Or use the \l{Qt::rect()}{Qt.rect()} function:
+
+ \qml
+ CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) }
+ \endqml
+
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype date
- \ingroup qmlbasictypes
+ \qmlbasictype date
+ \ingroup qmlbasictypes
+
+ \brief A date is specified as "YYYY-MM-DD".
- \brief A date is specified as "YYYY-MM-DD".
+ To create a \c date value, specify it as a "YYYY-MM-DD" string:
- A date is specified as "YYYY-MM-DD".
+ Example:
+ \qml
+ MyDatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" }
+ \endqml
- Example:
- \qml
- DatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" }
- \endqml
+ To read a date value returned from a C++ extension class, use
+ \l{Qt::formatDate()}{Qt.formatDate()} and \l{Qt::formatDateTime()}{Qt.formatDateTime()}.
- \sa {QML Basic Types}
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype time
- \ingroup qmlbasictypes
+ \qmlbasictype time
+ \ingroup qmlbasictypes
- \brief A time is specified as "hh:mm:ss".
+ \brief A time is specified as "hh:mm:ss".
- A time is specified as "hh:mm:ss".
+ A time is specified as "hh:mm:ss".
- Example:
- \qml
- TimePicker { time: "14:22:15" }
- \endqml
+ Example:
+ \qml
+ MyTimePicker { time: "14:22:15" }
+ \endqml
- \sa {QML Basic Types}
+ To read a time value returned from a C++ extension class, use
+ \l{Qt::formatTime()}{Qt.formatTime()} and \l{Qt::formatDateTime()}{Qt.formatDateTime()}.
+
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype font
- \ingroup qmlbasictypes
+ \qmlbasictype font
+ \ingroup qmlbasictypes
- \brief A font type has the properties of a QFont.
+ \brief A font type has the properties of a QFont.
- A font type has the properties of a QFont. The properties are:
+ A font type has the properties of a QFont. The properties are:
- \list
- \o \c string font.family
- \o \c bool font.bold
- \o \c bool font.italic
- \o \c bool font.underline
- \o \c real font.pointSize
- \o \c int font.pixelSize
- \endlist
+ \list
+ \o \c string font.family
+ \o \c bool font.bold
+ \o \c bool font.italic
+ \o \c bool font.underline
+ \o \c real font.pointSize
+ \o \c int font.pixelSize
+ \endlist
- Example:
- \qml
- Text { font.family: "Helvetica"; font.pointSize: 13; font.bold: true }
- \endqml
+ Example:
+ \qml
+ Text { font.family: "Helvetica"; font.pointSize: 13; font.bold: true }
+ \endqml
- \sa {QML Basic Types}
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype action
- \ingroup qmlbasictypes
+ \qmlbasictype action
+ \ingroup qmlbasictypes
- \brief The action type has all the properties of QAction.
+ \brief The action type has all the properties of QAction.
- The action type has all the properties of QAction. The properties
- are:
+ The action type has all the properties of QAction. The properties
+ are:
- \list
- \o \c slot action.trigger - invoke the action
- \o \c bool action.enabled - true if the action is enabled
- \o \c string action.text - the text associated with the action
- \endlist
+ \list
+ \o \c slot action.trigger - invoke the action
+ \o \c bool action.enabled - true if the action is enabled
+ \o \c string action.text - the text associated with the action
+ \endlist
- Actions are used like this:
+ Actions are used like this:
- \qml
- MouseArea { onClicked: MyItem.myaction.trigger() }
- State { name: "enabled"; when: MyItem.myaction.enabled == true }
- Text { text: MyItem.someaction.text }
- \endqml
+ \qml
+ MouseArea { onClicked: myaction.trigger() }
+ State { name: "enabled"; when: myaction.enabled == true }
+ Text { text: someaction.text }
+ \endqml
- \sa {QML Basic Types}
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype list
- \ingroup qmlbasictypes
-
- \brief A list of objects.
-
- A list of objects. While not technically a basic type, QML also
- supports lists of object types. When used from QML, the engine
- automatically appends each value to the list.
-
- For example, the \l Item class contains a list property named
- children that can be used like this:
-
- \qml
- Item {
- children: [
- Item { id: child1 },
- Rectangle { id: child2 },
- Text { id: child3 }
- ]
- }
- \endqml
- \c Child1, \c Child2 and \c Child3 will all be added to the children list
- in the order in which they appear.
-
- \sa {QML Basic Types}
+ \qmlbasictype list
+ \ingroup qmlbasictypes
+
+ \brief A list of objects.
+
+ A list of objects. While not technically a basic type, QML also
+ supports lists of object types. When used from QML, the engine
+ automatically appends each value to the list.
+
+ For example, the \l Item class contains a list property named
+ children that can be used like this:
+
+ \qml
+ Item {
+ children: [
+ Item { id: child1 },
+ Rectangle { id: child2 },
+ Text { id: child3 }
+ ]
+ }
+ \endqml
+ \c child1, \c child2 and \c child3 will all be added to the children list
+ in the order in which they appear.
+
+ \sa {QML Basic Types}
*/
/*!
- \qmlbasictype vector3d
- \ingroup qmlbasictypes
+ \qmlbasictype vector3d
+ \ingroup qmlbasictypes
+
+ \brief A vector3d type has x, y, and z attributes.
- \brief A vector3d is specified as "x,y,z".
+ A \c vector3d type has \c x, \c y, and \c z attributes.
- A vector3d is specified as "x,y,z".
+ To create a \c vector3d value, specify it as a "x,y,z" string:
- \qml
- Rotation { angle: 60; axis: "0,1,0" }
- \endqml
+ \qml
+ Rotation { angle: 60; axis: "0,1,0" }
+ \endqml
- or with the \c{Qt.vector3d()} helper function:
+ or with the \l{Qt::vector3d()}{Qt.vector3d()} function:
- \qml
- Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) }
- \endqml
+ \qml
+ Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) }
+ \endqml
- or as separate \c x, \c y, and \c z components:
+ or as separate \c x, \c y, and \c z components:
- \qml
- Rotation { angle: 60; axis.x: 0; axis.y: 1; axis.z: 0 }
- \endqml
+ \qml
+ Rotation { angle: 60; axis.x: 0; axis.y: 1; axis.z: 0 }
+ \endqml
- \sa {QML Basic Types}
+ \sa {QML Basic Types}
*/
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 574a187..aa48bcb 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -59,8 +59,8 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt
\o \l State
\o \l PropertyChanges
\o \l StateGroup
+\o \l StateChangeScript
\o \l ParentChange (Item-specific)
-\o \l StateChangeScript (Item-specific)
\o \l AnchorChanges (Item-specific)
\endlist
@@ -76,6 +76,7 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt
\o \l ParentAnimation
\o \l AnchorAnimation
\o \l SmoothedAnimation
+\o \l Vector3dAnimation
\o \l PropertyAction
\o \l ScriptAction
\o \l Transition
@@ -167,8 +168,8 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt
\header
\o \bold {Views}
\o \bold {Positioners}
-\o \bold {Media}
\o \bold {Effects}
+\o
\row
\o
@@ -201,13 +202,6 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt
\o
\list
-\o \l SoundEffect
-\o \l Audio
-\o \l Video
-\endlist
-
-\o
-\list
\o \l Particles (experimental)
\list
\o \l ParticleMotionLinear
@@ -217,4 +211,6 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt
\endlist
\endtable
+\o
+
*/
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
index 7d4f9b9..3121e95 100644
--- a/doc/src/declarative/globalobject.qdoc
+++ b/doc/src/declarative/globalobject.qdoc
@@ -49,7 +49,7 @@ Contains all the properties of the JavaScript global object, plus:
\section1 Qt Object
-The \l{qml-qt.html}{Qt object} provides useful enums and functions from Qt, for use in all QML
+The \l{Qt}{Qt object} provides useful enums and functions from Qt, for use in all QML
files.
\section1 XMLHttpRequest
diff --git a/doc/src/declarative/pics/gridview-highlight.png b/doc/src/declarative/pics/gridview-highlight.png
new file mode 100644
index 0000000..b54af37
--- /dev/null
+++ b/doc/src/declarative/pics/gridview-highlight.png
Binary files differ
diff --git a/doc/src/declarative/pics/gridview-simple.png b/doc/src/declarative/pics/gridview-simple.png
new file mode 100644
index 0000000..a102939
--- /dev/null
+++ b/doc/src/declarative/pics/gridview-simple.png
Binary files differ
diff --git a/doc/src/declarative/pics/gridview.png b/doc/src/declarative/pics/gridview.png
deleted file mode 100644
index 3726893..0000000
--- a/doc/src/declarative/pics/gridview.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/declarative/pics/rect-border-width.png b/doc/src/declarative/pics/rect-border-width.png
new file mode 100644
index 0000000..c3c6c2c
--- /dev/null
+++ b/doc/src/declarative/pics/rect-border-width.png
Binary files differ
diff --git a/doc/src/declarative/pics/repeater-modeldata.png b/doc/src/declarative/pics/repeater-modeldata.png
new file mode 100644
index 0000000..6d8df0d
--- /dev/null
+++ b/doc/src/declarative/pics/repeater-modeldata.png
Binary files differ
diff --git a/doc/src/declarative/pics/translate.png b/doc/src/declarative/pics/translate.png
new file mode 100644
index 0000000..baf58b0
--- /dev/null
+++ b/doc/src/declarative/pics/translate.png
Binary files differ
diff --git a/doc/src/declarative/pics/visualitemmodel.png b/doc/src/declarative/pics/visualitemmodel.png
new file mode 100644
index 0000000..5e6d132
--- /dev/null
+++ b/doc/src/declarative/pics/visualitemmodel.png
Binary files differ
diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc
index 64a4949..848e094 100644
--- a/doc/src/declarative/qml-intro.qdoc
+++ b/doc/src/declarative/qml-intro.qdoc
@@ -864,49 +864,49 @@ paused, and reaching the end of the media. They allow the developer to connect,
some QML that will handle this event.
-\section1 Analyzing An Example: Dial
+\section1 Analyzing An Example: Dial Control
-In the Qt \e {examples/declarative/toys} folder you will find a folder
-\e {dial} which contains the \e dial example.
+In the Qt \e {examples/declarative/ui-components} folder you will find a folder
+\e {dialcontrol} which contains the \e dialcontrol example.
\image qml-dial.png "QML Dial example with Slider"
In essence this small application has a sliding bar that you can slide using
a mouse, and a graphical dial that responds to the position of the slider.
-The code for the example is in two parts: Dial.qml and dial-example.qml.
+The code for the example is in two parts: Dial.qml and dialcontrol.qml.
-\e {Dial.qml} can be found in the \e content sub-directory. It defines a Dial
+\e {Dial.qml} can be found in the \e content sub-directory. It defines a \c Dial
component similar to an odometer. Eventually, the example will hook up a slider
component so that moving the slider will change the position of a needle on the
dial.
-The code for the Dial, identified by the name of the file, contains four images
+The code for the \c Dial, identified by the name of the file, contains four images
in overlapping order: the background (numbers and divisions), the shadow of the
needle, the needle itself, and finally the 'glass' overlay (containing
transparent layers).
-The needle_shadow.png image has a Rotation assigned to the \e transform
+The \c needle_shadow.png image has a \l Rotation assigned to the \e transform
attribute of the \l Image. The rotation is set to match the angle of the needle
image angle value \e {needleRotation.angle}. Both the needle and the
needle_shadow have the same default \e x and \e y values but the rotation origin
for the needle is slightly different so that a shadow will be evident as the
needle moves.
-\snippet ../../examples/declarative/toys/dial/content/Dial.qml needle_shadow
+\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml needle_shadow
And the needle
-\snippet ../../examples/declarative/toys/dial/content/Dial.qml needle
+\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml needle
The final image is the overlay which simply has a position defined.
-\snippet ../../examples/declarative/toys/dial/content/Dial.qml overlay
+\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml overlay
-\e {dial-example.qml} in the \e {examples/declarative/toys/dial} directory is the
+\e {dialcontrol.qml} in the \e {examples/declarative/ui-components/dialcontrol} directory is the
main file of the example. It defines the visual environment that the Dial
will fit into. Because the \e Dial component and the images live in the \e
-content sub-directory we will have to import this into \e dial-example. So the
+content sub-directory we will have to import this into \e dialcontrol.qml. So the
start of the file looks like
\code
@@ -919,7 +919,7 @@ a gray color. Inside this rectangle is our component \e Dial and a \l Rectangle.
Inside the rectangle called 'container' is another rectangle with the
interesting name 'slider'.
-\snippet ../../examples/declarative/toys/dial/dial-example.qml 0
+\snippet ../../examples/declarative/ui-components/dialcontrol/dialcontrol.qml 0
The Dial component, named 'dial, is \e anchored to the center of the main
rectangle. The \c value attribute of 'dial' is set to a value based on the
diff --git a/doc/src/development/rcc.qdoc b/doc/src/development/rcc.qdoc
index 1541e11..999408b 100644
--- a/doc/src/development/rcc.qdoc
+++ b/doc/src/development/rcc.qdoc
@@ -60,28 +60,30 @@
\row \o \c{-o} \o \c{file} \o Write output to \c{file} rather than to stdout.
\row \o \c{-name} \o \c{name} \o Create an external initialization
- function with \c{name}.
-
- \row \o \c{-threshold} \o \c{level} \o Specifies a threshold \c{level} (in
- bytes) to use when deciding whether
- to compress a file. If the file is
- smaller than the threshold \c{level},
- it is not compressed. The default
- threshold level is 70 bytes.
-
+ function with \c{name}.
+
+ \row \o \c{-threshold} \o \c{level} \o Specifies a threshold \c{level} (as a
+ percentage) to use when deciding whether to compress
+ a file. If the reduction in the file size is greater than
+ the threshold \c{level}, it is compressed; otherwise,
+ the uncompressed data is stored instead. The default
+ threshold level is 70%, meaning that compressed files
+ which are 30% or less of their original size are
+ stored as compressed data.
+
\row \o \c{-compress} \o \c{level} \o Compress input files to the given
- compression \c{level}, which is an
- integer in the range 1 to 9. Level 1
- does the least compression but is
- fastest. Level 9 does the most
- compression but is slowest. To turn
- off compression, use \c{-no-compress}.
- The default value for \c{level} is -1,
- which means use zlib's default
- compression level.
+ compression \c{level}, which is an
+ integer in the range 1 to 9. Level 1
+ does the least compression but is
+ fastest. Level 9 does the most
+ compression but is slowest. To turn
+ off compression, use \c{-no-compress}.
+ The default value for \c{level} is -1,
+ which means use zlib's default
+ compression level.
\row \o \c{-root} \o \c{path} \o Prefix the resource access path with \c{path}.
- The default is no prefix.
+ The default is no prefix.
\row \o \c{-no-compress} \o \o Disable compression.
diff --git a/doc/src/examples/pixelator.qdoc b/doc/src/examples/pixelator.qdoc
index 09ae3e8..95099e1 100644
--- a/doc/src/examples/pixelator.qdoc
+++ b/doc/src/examples/pixelator.qdoc
@@ -80,8 +80,6 @@
functions to indicate the dimensions of the image and supply data to other
components.
- For convenience, the image to be used is passed in the constructor.
-
\section1 ImageModel Class Implementation
The constructor is trivial:
@@ -89,7 +87,7 @@
\snippet examples/itemviews/pixelator/imagemodel.cpp 0
The \c setImage() function sets the image that will be used by the model:
-
+
\snippet examples/itemviews/pixelator/imagemodel.cpp 1
The QAbstractItemModel::reset() call tells the view(s) that the model
@@ -233,7 +231,7 @@
This enables the items to be drawn without any gaps between them. Removing
the headers also prevents the user from adjusting the sizes of individual
rows and columns.
-
+
We also set the minimum section size to 1 on the headers. If we
didn't, the headers would default to a larger size, preventing
us from displaying really small items (which can be specified
diff --git a/doc/src/examples/waitconditions.qdoc b/doc/src/examples/waitconditions.qdoc
index 1d3ff84..d4f680e 100644
--- a/doc/src/examples/waitconditions.qdoc
+++ b/doc/src/examples/waitconditions.qdoc
@@ -92,7 +92,7 @@
Together, the wait conditions, the mutex, and the \c numUsedBytes
counter ensure that the producer is never more than \c BufferSize
bytes ahead of the consumer, and that the consumer never reads
- data that the consumer hasn't generated yet.
+ data that the producer hasn't generated yet.
\section1 Producer Class
diff --git a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml b/doc/src/snippets/declarative/gridview/ContactModel.qml
index 1e79030..2da4660 100644
--- a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml
+++ b/doc/src/snippets/declarative/gridview/ContactModel.qml
@@ -39,28 +39,26 @@
**
****************************************************************************/
+//![0]
import Qt 4.7
ListModel {
- id: contactModel
+
ListElement {
- name: "Bill Smith"
- number: "555 3264"
+ name: "Jim Williams"
portrait: "pics/portrait.png"
}
ListElement {
- name: "Jim Williams"
- number: "555 5673"
+ name: "John Brown"
portrait: "pics/portrait.png"
}
ListElement {
- name: "John Brown"
- number: "555 8426"
+ name: "Bill Smyth"
portrait: "pics/portrait.png"
}
ListElement {
name: "Sam Wise"
- number: "555 0473"
portrait: "pics/portrait.png"
}
}
+//![0]
diff --git a/doc/src/snippets/declarative/gridview/gridview.qml b/doc/src/snippets/declarative/gridview/gridview.qml
index 3c205bc..0b3bbf3 100644
--- a/doc/src/snippets/declarative/gridview/gridview.qml
+++ b/doc/src/snippets/declarative/gridview/gridview.qml
@@ -39,50 +39,98 @@
**
****************************************************************************/
+//![import]
import Qt 4.7
+//![import]
-//! [3]
Rectangle {
- width: 240; height: 180; color: "white"
- // ContactModel model is defined in dummydata/ContactModel.qml
- // The viewer automatically loads files in dummydata/* to assist
- // development without a real data source.
-
- // Define a delegate component. A component will be
- // instantiated for each visible item in the list.
-//! [0]
+ width: childrenRect.width; height: childrenRect.height
+
+Row {
+
+//![classdocs simple]
+GridView {
+ width: 300; height: 200
+
+ model: ContactModel {}
+ delegate: Column {
+ Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter }
+ Text { text: name; anchors.horizontalCenter: parent.horizontalCenter }
+ }
+}
+//![classdocs simple]
+
+
+//![classdocs advanced]
+Rectangle {
+ width: 300; height: 200
+
Component {
- id: delegate
+ id: contactDelegate
Item {
- id: wrapper
- width: 80; height: 78
+ width: grid.cellWidth; height: grid.cellHeight
Column {
+ anchors.fill: parent
Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter }
Text { text: name; anchors.horizontalCenter: parent.horizontalCenter }
}
}
}
-//! [0]
- // Define a highlight component. Just one of these will be instantiated
- // by each ListView and placed behind the current item.
-//! [1]
- Component {
- id: highlight
- Rectangle {
- color: "lightsteelblue"
- radius: 5
- }
- }
-//! [1]
- // The actual grid
-//! [2]
+
GridView {
- width: parent.width; height: parent.height
- model: ContactModel; delegate: delegate
+ id: grid
+ anchors.fill: parent
cellWidth: 80; cellHeight: 80
- highlight: highlight
+
+ model: ContactModel {}
+ delegate: contactDelegate
+ highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
focus: true
}
-//! [2]
}
-//! [3]
+//![classdocs advanced]
+
+//![delayRemove]
+Component {
+ id: delegate
+ Item {
+ GridView.onRemove: SequentialAnimation {
+ PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: true }
+ NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: Easing.InOutQuad }
+ PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: false }
+ }
+ }
+}
+//![delayRemove]
+
+//![highlightFollowsCurrentItem]
+Component {
+ id: highlight
+ Rectangle {
+ width: view.cellWidth; height: view.cellHeight
+ color: "lightsteelblue"; radius: 5
+ SpringFollow on x { to: view.currentItem.x; spring: 3; damping: 0.2 }
+ SpringFollow on y { to: view.currentItem.y; spring: 3; damping: 0.2 }
+ }
+}
+
+GridView {
+ id: view
+ width: 300; height: 200
+ cellWidth: 80; cellHeight: 80
+
+ model: ContactModel {}
+ delegate: Column {
+ Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter }
+ Text { text: name; anchors.horizontalCenter: parent.horizontalCenter }
+ }
+
+ highlight: highlight
+ highlightFollowsCurrentItem: false
+ focus: true
+}
+//![highlightFollowsCurrentItem]
+
+}
+
+}
diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml
deleted file mode 100644
index af9e95f..0000000
--- a/doc/src/snippets/declarative/listview/highlight.qml
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the 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
-
-Rectangle {
- width: 180; height: 200; color: "white"
-
- // ContactModel model is defined in dummydata/ContactModel.qml
- // The viewer automatically loads files in dummydata/* to assist
- // development without a real data source.
-
- // Define a delegate component. A component will be
- // instantiated for each visible item in the list.
-//! [0]
- Component {
- id: delegate
- Item {
- id: wrapper
- width: 180; height: 40
- Column {
- x: 5; y: 5
- Text { text: '<b>Name:</b> ' + name }
- Text { text: '<b>Number:</b> ' + number }
- }
- // Use the ListView.isCurrentItem attached property to
- // indent the item if it is the current item.
- states: [
- State {
- name: "Current"
- when: wrapper.ListView.isCurrentItem
- PropertyChanges { target: wrapper; x: 10 }
- }
- ]
- transitions: [
- Transition { NumberAnimation { properties: "x"; duration: 200 } }
- ]
- }
- }
-//! [0]
- // Specify a highlight with custom movement. Note that autoHighlight
- // is set to false in the ListView so that we can control how the
- // highlight moves to the current item.
-//! [1]
- Component {
- id: highlight
- Rectangle {
- width: 180; height: 40
- color: "lightsteelblue"; radius: 5
- SpringFollow on y {
- to: list.currentItem.y
- spring: 3
- damping: 0.2
- }
- }
- }
- ListView {
- id: list
- width: parent.height; height: parent.height
- model: ContactModel; delegate: delegate
- highlight: highlight
- highlightFollowsCurrentItem: false
- focus: true
- }
-//! [1]
-}
diff --git a/doc/src/snippets/declarative/mousearea.qml b/doc/src/snippets/declarative/mousearea.qml
new file mode 100644
index 0000000..c6071c7
--- /dev/null
+++ b/doc/src/snippets/declarative/mousearea.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** 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]
+
+Rectangle {
+ width: childrenRect.width
+ height: childrenRect.height
+
+Row {
+
+//! [intro]
+Rectangle {
+ width: 100; height: 100
+ color: "green"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { parent.color = 'red' }
+ }
+}
+//! [intro]
+
+//! [intro-extended]
+Rectangle {
+ width: 100; height: 100
+ color: "green"
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button == Qt.RightButton)
+ parent.color = 'blue';
+ else
+ parent.color = 'red';
+ }
+ }
+}
+//! [intro-extended]
+
+//! [drag]
+Rectangle {
+ id: container
+ width: 600; height: 200
+
+ Image {
+ id: pic
+ source: "pics/qt.png"
+ opacity: (600.0 - pic.x) / 600
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: pic
+ drag.axis: Drag.XAxis
+ drag.minimumX: 0
+ drag.maximumX: container.width - pic.width
+ }
+ }
+}
+//! [drag]
+
+//! [mousebuttons]
+Text {
+ text: mouseArea.pressedButtons & Qt.RightButton ? "right" : ""
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ }
+}
+//! [mousebuttons]
+
+}
+
+}
diff --git a/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml b/doc/src/snippets/declarative/pathview/ContactModel.qml
index a52b60a..1a042a3 100644
--- a/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml
+++ b/doc/src/snippets/declarative/pathview/ContactModel.qml
@@ -39,20 +39,21 @@
**
****************************************************************************/
+//![0]
import Qt 4.7
ListModel {
- id: menuModel
ListElement {
name: "Bill Jones"
- icon: "pics/qtlogo-64.png"
+ icon: "pics/qtlogo.png"
}
ListElement {
name: "Jane Doe"
- icon: "pics/qtlogo-64.png"
+ icon: "pics/qtlogo.png"
}
ListElement {
name: "John Smith"
- icon: "pics/qtlogo-64.png"
+ icon: "pics/qtlogo.png"
}
}
+//![0]
diff --git a/doc/src/snippets/declarative/pathview/pathattributes.qml b/doc/src/snippets/declarative/pathview/pathattributes.qml
index e8d2509..3ba3b95 100644
--- a/doc/src/snippets/declarative/pathview/pathattributes.qml
+++ b/doc/src/snippets/declarative/pathview/pathattributes.qml
@@ -39,16 +39,16 @@
**
****************************************************************************/
+//! [0]
import Qt 4.7
Rectangle {
- width: 240; height: 200; color: 'white'
-//! [0]
+ width: 240; height: 200
+
//! [1]
Component {
id: delegate
Item {
- id: wrapper
width: 80; height: 80
scale: PathView.scale
opacity: PathView.opacity
@@ -59,9 +59,12 @@ Rectangle {
}
}
//! [1]
+
//! [2]
PathView {
- anchors.fill: parent; model: MenuModel; delegate: delegate
+ anchors.fill: parent
+ model: ContactModel {}
+ delegate: delegate
path: Path {
startX: 120; startY: 100
PathAttribute { name: "scale"; value: 1.0 }
@@ -73,5 +76,5 @@ Rectangle {
}
}
//! [2]
-//! [0]
}
+//! [0]
diff --git a/doc/src/snippets/declarative/pathview/pathview.qml b/doc/src/snippets/declarative/pathview/pathview.qml
index 31b793d..1669847 100644
--- a/doc/src/snippets/declarative/pathview/pathview.qml
+++ b/doc/src/snippets/declarative/pathview/pathview.qml
@@ -39,27 +39,27 @@
**
****************************************************************************/
+//! [0]
import Qt 4.7
Rectangle {
- width: 240; height: 200; color: 'white'
-//! [0]
+ width: 240; height: 200
+
//! [1]
Component {
id: delegate
- Item {
- id: wrapper
- width: 80; height: 80
- Column {
- Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon }
- Text { text: name; font.pointSize: 16}
- }
+ Column {
+ Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon }
+ Text { text: name; font.pointSize: 16 }
}
}
//! [1]
+
//! [2]
PathView {
- anchors.fill: parent; model: MenuModel; delegate: delegate
+ anchors.fill: parent
+ model: ContactModel {}
+ delegate: delegate
path: Path {
startX: 120; startY: 100
PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
@@ -67,5 +67,5 @@ Rectangle {
}
}
//! [2]
-//! [0]
}
+//! [0]
diff --git a/doc/src/snippets/declarative/pathview/pics/qtlogo-64.png b/doc/src/snippets/declarative/pathview/pics/qtlogo.png
index 4f68e16..4f68e16 100644
--- a/doc/src/snippets/declarative/pathview/pics/qtlogo-64.png
+++ b/doc/src/snippets/declarative/pathview/pics/qtlogo.png
Binary files differ
diff --git a/doc/src/snippets/declarative/drag.qml b/doc/src/snippets/declarative/rect-border-width.qml
index 0a69574..73ce9f6 100644
--- a/doc/src/snippets/declarative/drag.qml
+++ b/doc/src/snippets/declarative/rect-border-width.qml
@@ -41,19 +41,20 @@
import Qt 4.7
-//! [0]
+//![0]
Rectangle {
- id: blurtest; width: 600; height: 200; color: "white"
- Image {
- id: pic; source: "qtlogo-64.png"; anchors.verticalCenter: parent.verticalCenter
- opacity: (600.0-pic.x) / 600;
- MouseArea {
+ width: 100; height: 100
+ color: "yellow"
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 10
+ clip: true
+
+ Rectangle {
anchors.fill: parent
- drag.target: pic
- drag.axis: Drag.XAxis
- drag.minimumX: 0
- drag.maximumX: blurtest.width-pic.width
+ border.width: 1
}
}
}
-//! [0]
+//![0]
diff --git a/doc/src/snippets/declarative/mouseregion.qml b/doc/src/snippets/declarative/repeater-modeldata.qml
index a162854..3b4cc6d 100644
--- a/doc/src/snippets/declarative/mouseregion.qml
+++ b/doc/src/snippets/declarative/repeater-modeldata.qml
@@ -41,35 +41,12 @@
import Qt 4.7
-Rectangle { width: 200; height: 100
-Row {
//! [0]
-Rectangle {
- width: 100; height: 100
- color: "green"
-
- MouseArea {
- anchors.fill: parent
- onClicked: { parent.color = 'red' }
+Column {
+ Repeater {
+ model: ["apples", "oranges", "pears"]
+ Text { text: "Data: " + modelData }
}
}
//! [0]
-//! [1]
-Rectangle {
- width: 100; height: 100
- color: "green"
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.LeftButton | Qt.RightButton
- onClicked: {
- if (mouse.button == Qt.RightButton)
- parent.color = 'blue';
- else
- parent.color = 'red';
- }
- }
-}
-//! [1]
-}
-}
diff --git a/examples/declarative/modelviews/webview/content/FieldText.qml b/examples/declarative/modelviews/webview/content/FieldText.qml
index c9adde5..17fa4cd 100644
--- a/examples/declarative/modelviews/webview/content/FieldText.qml
+++ b/examples/declarative/modelviews/webview/content/FieldText.qml
@@ -161,8 +161,6 @@ Item {
color: "black"
readOnly: false
focus: true
- selectionStart: 0
- selectionEnd: -1
}
PropertyChanges {
target: editRegion
diff --git a/examples/declarative/sqllocalstorage/hello.qml b/examples/declarative/sqllocalstorage/hello.qml
index 0913d42..421a74c 100644
--- a/examples/declarative/sqllocalstorage/hello.qml
+++ b/examples/declarative/sqllocalstorage/hello.qml
@@ -68,4 +68,4 @@ Text {
Component.onCompleted: findGreetings()
}
-
+//![0]
diff --git a/examples/declarative/text/edit/edit.qml b/examples/declarative/text/edit/edit.qml
index 2774739..0be42e9 100644
--- a/examples/declarative/text/edit/edit.qml
+++ b/examples/declarative/text/edit/edit.qml
@@ -157,14 +157,16 @@ Rectangle {
if (editor.state == "selection" && drag != "") {
if (drag == "start") {
var pos = edit.positionAt(mouse.x+x+startHandle.width/2,mouse.y+y);
- if (edit.selectionEnd < pos)
- edit.selectionEnd = pos;
- edit.selectionStart = pos;
+ var e = edit.selectionEnd;
+ if (e < pos)
+ e = pos;
+ edit.select(pos,e);
} else if (drag == "end") {
var pos = edit.positionAt(mouse.x+x-endHandle.width/2,mouse.y+y);
- if (edit.selectionStart > pos)
- edit.selectionStart = pos;
- edit.selectionEnd = pos;
+ var s = edit.selectionStart;
+ if (s > pos)
+ s = pos;
+ edit.select(s,pos);
}
}
}
@@ -226,7 +228,7 @@ Rectangle {
height: 16
Text { anchors.centerIn: parent; text: "Deselect" }
MouseArea { anchors.fill: parent;
- onClicked: { edit.cursorPosition = edit.selectionEnd; edit.selectionStart = edit.selectionEnd; editor.state = "" } }
+ onClicked: { edit.cursorPosition = edit.selectionEnd; edit.select(edit.cursorPosition,edit.cursorPosition); editor.state = "" } }
}
}
}
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/app.qml b/examples/declarative/tutorials/extending/chapter1-basics/app.qml
index 7de32f2..9af155c 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/app.qml
+++ b/examples/declarative/tutorials/extending/chapter1-basics/app.qml
@@ -55,3 +55,4 @@ Rectangle {
text: aMusician.name + " plays the " + aMusician.instrument
}
}
+//![0]
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/app.qml b/examples/declarative/tutorials/extending/chapter2-methods/app.qml
index 495413f..02d33c2 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/app.qml
+++ b/examples/declarative/tutorials/extending/chapter2-methods/app.qml
@@ -57,3 +57,4 @@ Rectangle {
onClicked: aMusician.perform()
}
}
+//![0]
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml b/examples/declarative/tutorials/extending/chapter3-bindings/app.qml
index 46408cb..8bf6ecf 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/app.qml
@@ -69,3 +69,4 @@ Rectangle {
}
}
}
+//![0]
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml
index 09662d6..d76f801 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml
@@ -51,3 +51,4 @@ Item {
Component.onCompleted: console.log("Reddy plays the " + reddy.instrument.type)
}
+//![0]
diff --git a/examples/itemviews/fetchmore/filelistmodel.cpp b/examples/itemviews/fetchmore/filelistmodel.cpp
index 05ab45e..942150e 100644
--- a/examples/itemviews/fetchmore/filelistmodel.cpp
+++ b/examples/itemviews/fetchmore/filelistmodel.cpp
@@ -92,7 +92,7 @@ void FileListModel::fetchMore(const QModelIndex & /* index */)
int remainder = fileList.size() - fileCount;
int itemsToFetch = qMin(100, remainder);
- beginInsertRows(QModelIndex(), fileCount, fileCount+itemsToFetch);
+ beginInsertRows(QModelIndex(), fileCount, fileCount+itemsToFetch-1);
fileCount += itemsToFetch;
diff --git a/mkspecs/common/qws.conf b/mkspecs/common/qws.conf
index 96341a7..225f0ff 100644
--- a/mkspecs/common/qws.conf
+++ b/mkspecs/common/qws.conf
@@ -14,6 +14,10 @@ QMAKE_INCDIR_X11 =
QMAKE_LIBDIR_X11 =
QMAKE_INCDIR_OPENGL =
QMAKE_LIBDIR_OPENGL =
+QMAKE_INCDIR_OPENGL_ES1 =
+QMAKE_LIBDIR_OPENGL_ES1 =
+QMAKE_INCDIR_OPENGL_ES2 =
+QMAKE_LIBDIR_OPENGL_ES2 =
QMAKE_LIBS_X11 =
QMAKE_LIBS_X11SM =
QMAKE_LIBS_OPENGL =
diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag
index 49b1cbe..8cb0e53 100644
--- a/src/3rdparty/webkit/.tag
+++ b/src/3rdparty/webkit/.tag
@@ -1 +1 @@
-c58dc2f491a824ac56e31c440fcf7fe16dab09c4
+f59a934694947496cedecc5256a71bff60c43c4c
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index 1db0c55..fb78e36 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from
and has the sha1 checksum
- 531b0d7cd2af830f0d17b83b6e4a489794481539
+ c58dc2f491a824ac56e31c440fcf7fe16dab09c4
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index daf10fa..ff7d214 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-05-31 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Escape backslashes in the .pro files
+
+ qmake in Qt 4.7 warns about unescaped backspaces and deprecates them.
+
+ * WebCore.pro:
+
2010-05-28 Antti Koivisto <koivisto@iki.fi>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
index 5def728..63e78a7 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -159,7 +159,7 @@ defineTest(addExtraCompiler) {
for(file,input) {
base = $$basename(file)
- base ~= s/\..+//
+ base ~= s/\\..+//
newfile=$$replace(outputRule,\\$\\{QMAKE_FILE_BASE\\},$$base)
SOURCES += $$newfile
}
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro b/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro
index 389fb5f..22d4c8d 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro
+++ b/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro
@@ -28,7 +28,7 @@ qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}define QT_QTWEBKIT_MOD
qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}include $${ESCAPE}<QtNetwork/QtNetwork$${ESCAPE}>$${QUOTE} >> $${qtheader_module.target} &&
WEBKIT_CLASS_HEADERS = $${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}PWD/QtWebKit
-regex = ".*\sclass\sQWEBKIT_EXPORT\s(\w+)\s(.*)"
+regex = ".*\\sclass\\sQWEBKIT_EXPORT\\s(\\w+)\\s(.*)"
for(HEADER, WEBKIT_API_HEADERS) {
# 1. Append to QtWebKit header that includes all other header files
@@ -70,7 +70,7 @@ for(HEADER, WEBKIT_API_HEADERS) {
res = $$find(src, $$regex)
isEmpty(res):break()
- exp = $$replace(src, $$regex, "EXPORTED_CLASS = \1")
+ exp = $$replace(src, $$regex, "EXPORTED_CLASS = \\1")
eval($$exp)
CLASS_TARGET = "qtheader_$${EXPORTED_CLASS}"
@@ -87,7 +87,7 @@ for(HEADER, WEBKIT_API_HEADERS) {
# Qt's QRegExp does not support inline non-greedy matching,
# so we'll have to work around it by updating the haystack
- src = $$replace(src, $$regex, "\2")
+ src = $$replace(src, $$regex, "\\2")
src_words = $$join(src, $${LITERAL_WHITESPACE})
}
}
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index a61ca2e..564c6fe 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -3620,7 +3620,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const
languageName = d->client->ownerWidget()->locale().name();
else
languageName = QLocale().name();
- languageName[2] = QLatin1Char('-');
+ languageName.replace(QLatin1Char('_'), QLatin1Char('-'));
// Application name/version
QString appName = QCoreApplication::applicationName();
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index cc2d39a..b6cbf92 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,24 @@
+2010-05-31 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Escape backslashes in the .pro files
+
+ qmake in Qt 4.7 warns about unescaped backspaces and deprecates them.
+
+ * Api/DerivedSources.pro:
+ * docs/docs.pri:
+
+2010-05-19 Denis Dzyubenko <denis.dzyubenko@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ When creating the UA, do not sassmue the language code is a
+ two-letter iso639-1 code.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::userAgentForUrl):
+
2010-05-28 Antti Koivisto <koivisto@iki.fi>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/docs.pri b/src/3rdparty/webkit/WebKit/qt/docs/docs.pri
index 804817b..a56ddb4 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/docs.pri
+++ b/src/3rdparty/webkit/WebKit/qt/docs/docs.pri
@@ -3,7 +3,7 @@ include(../../../WebKit.pri)
unix {
QDOC = SRCDIR=$$PWD/../../.. OUTPUT_DIR=$$OUTPUT_DIR $$(QTDIR)/bin/qdoc3
} else {
- QDOC = $$(QTDIR)\bin\qdoc3.exe
+ QDOC = $$(QTDIR)\\bin\\qdoc3.exe
}
unix {
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index c66047a..a333153 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -335,11 +335,6 @@
#define QT_NO_DATESTRING
#endif
-// QtDBus module
-#if !defined(QT_NO_DBUS) && (defined(QT_NO_PROPERTIES))
-#define QT_NO_DBUS
-#endif
-
// QDial
#if !defined(QT_NO_DIAL) && (defined(QT_NO_SLIDER))
#define QT_NO_DIAL
@@ -515,6 +510,11 @@
#define QT_NO_CONTEXTMENU
#endif
+// QtDBus module
+#if !defined(QT_NO_DBUS) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_DOM))
+#define QT_NO_DBUS
+#endif
+
// File Transfer Protocol
#if !defined(QT_NO_FTP) && (defined(QT_NO_URLINFO) || defined(QT_NO_TEXTDATE))
#define QT_NO_FTP
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index ed173b1..3e6af24 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -1373,7 +1373,7 @@ SeeAlso: ???
Feature: DBUS
Description: Provides classes for D-Bus.
Section: D-Bus
-Requires: PROPERTIES
+Requires: PROPERTIES DOM
Name: QtDBus module
SeeAlso: ???
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 24c26b6..b0e2f48 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -2508,29 +2508,35 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
When reimplementing a subclass, this method simplifies moving
entities in your model. This method is responsible for moving
persistent indexes in the model, which you would otherwise be
- required to do yourself.
-
- Using beginMoveRows and endMoveRows is an alternative to emitting
- layoutAboutToBeChanged and layoutChanged directly along with
- changePersistentIndexes. layoutAboutToBeChanged is emitted by
- this method for compatibility reasons.
+ required to do yourself. Using beginMoveRows and endMoveRows
+ is an alternative to emitting layoutAboutToBeChanged and
+ layoutChanged directly along with changePersistentIndexes.
+ layoutAboutToBeChanged is emitted by this method for compatibility
+ reasons.
The \a sourceParent index corresponds to the parent from which the
- rows are moved; \a sourceFirst and \a sourceLast are the row
- numbers of the rows to be moved. The \a destinationParent index
- corresponds to the parent into which the rows are moved. The \a
+ rows are moved; \a sourceFirst and \a sourceLast are the first and last
+ row numbers of the rows to be moved. The \a destinationParent index
+ corresponds to the parent into which those rows are moved. The \a
destinationChild is the row to which the rows will be moved. That
is, the index at row \a sourceFirst in \a sourceParent will become
- row \a destinationChild in \a destinationParent. Its siblings will
- be moved correspondingly.
-
- Note that \a sourceParent and \a destinationParent may be the
- same, in which case you must ensure that the \a destinationChild is
- not within the range of \a sourceFirst and \a sourceLast. You
- must also ensure that you do not attempt to move a row to one of
- its own children or ancestors. This method returns false if either
- condition is true, in which case you should abort your move
- operation.
+ row \a destinationChild in \a destinationParent, followed by all other
+ rows up to \a sourceLast.
+
+ However, when moving rows down in the same parent (\a sourceParent
+ and \a destinationParent are equal), the rows will be placed before the
+ \a destinationChild index. That is, if you wish to move rows 0 and 1 so
+ they will become rows 1 and 2, \a destinationChild should be 3. In this
+ case, the new index for the source row \c i (which is between
+ \a sourceFirst and \a sourceLast) is equal to
+ \c {(destinationChild-sourceLast-1+i)}.
+
+ Note that if \a sourceParent and \a destinationParent are the same,
+ you must ensure that the \a destinationChild is not within the range
+ of \a sourceFirst and \a sourceLast + 1. You must also ensure that you
+ do not attempt to move a row to one of its own children or ancestors.
+ This method returns false if either condition is true, in which case you
+ should abort your move operation.
\table 80%
\row
@@ -2761,29 +2767,35 @@ void QAbstractItemModel::endRemoveColumns()
When reimplementing a subclass, this method simplifies moving
entities in your model. This method is responsible for moving
persistent indexes in the model, which you would otherwise be
- required to do yourself.
-
- Using beginMoveColumns and endMoveColumns is an alternative to
- emitting layoutAboutToBeChanged and layoutChanged directly along
- with changePersistentIndexes. layoutAboutToBeChanged is emitted
- by this method for compatibility reasons.
+ required to do yourself. Using beginMoveRows and endMoveRows
+ is an alternative to emitting layoutAboutToBeChanged and
+ layoutChanged directly along with changePersistentIndexes.
+ layoutAboutToBeChanged is emitted by this method for compatibility
+ reasons.
The \a sourceParent index corresponds to the parent from which the
- columns are moved; \a sourceFirst and \a sourceLast are the column
- numbers of the columns to be moved. The \a destinationParent index
- corresponds to the parent into which the columns are moved. The \a
- destinationChild is the column to which the columns will be
- moved. That is, the index at column \a sourceFirst in \a
- sourceParent will become column \a destinationChild in \a
- destinationParent. Its siblings will be moved correspondingly.
-
- Note that \a sourceParent and \a destinationParent may be the
- same, in which case you must ensure that the \a destinationChild
- is not within the range of \a sourceFirst and \a sourceLast. You
- must also ensure that you do not attempt to move a row to one of
- its own chilren or ancestors. This method returns false if either
- condition is true, in which case you should abort your move
- operation.
+ columns are moved; \a sourceFirst and \a sourceLast are the first and last
+ column numbers of the columns to be moved. The \a destinationParent index
+ corresponds to the parent into which those columns are moved. The \a
+ destinationChild is the column to which the columns will be moved. That
+ is, the index at column \a sourceFirst in \a sourceParent will become
+ column \a destinationChild in \a destinationParent, followed by all other
+ columns up to \a sourceLast.
+
+ However, when moving columns down in the same parent (\a sourceParent
+ and \a destinationParent are equal), the columnss will be placed before the
+ \a destinationChild index. That is, if you wish to move columns 0 and 1 so
+ they will become columns 1 and 2, \a destinationChild should be 3. In this
+ case, the new index for the source column \c i (which is between
+ \a sourceFirst and \a sourceLast) is equal to
+ \c {(destinationChild-sourceLast-1+i)}.
+
+ Note that if \a sourceParent and \a destinationParent are the same,
+ you must ensure that the \a destinationChild is not within the range
+ of \a sourceFirst and \a sourceLast + 1. You must also ensure that you
+ do not attempt to move a column to one of its own children or ancestors.
+ This method returns false if either condition is true, in which case you
+ should abort your move operation.
\sa endMoveColumns()
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index ae12007..853f311 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -560,7 +560,7 @@ void QXmlStreamReader::clear()
chunk of XML can be added with addData(), if the XML is being read
from a QByteArray, or by waiting for more data to arrive if the
XML is being read from a QIODevice. Either way, atEnd() will
- return false once more adata is available.
+ return false once more data is available.
\sa hasError(), error(), device(), QIODevice::atEnd()
*/
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index 0df5f10..5735b1e 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -2,7 +2,6 @@
The changes below are pre Qt 4.7.0 RC
TextInput and TextEdit:
- - showInputPanelOnFocus property added
- openSoftwareInputPanel() and closeSoftwareInputPanel() functions added
Flickable:
- overShoot is replaced by boundsBehavior enumeration
diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h
index 5ba49a8..704c49a 100644
--- a/src/declarative/debugger/qdeclarativedebugtrace_p.h
+++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h
@@ -50,7 +50,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QUrl;
-class QDeclarativeDebugTrace : public QDeclarativeDebugService
+class Q_AUTOTEST_EXPORT QDeclarativeDebugTrace : public QDeclarativeDebugService
{
public:
enum EventType {
diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
index 32a6321..261cc5c 100644
--- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
@@ -72,13 +72,22 @@ QT_BEGIN_NAMESPACE
\o \image animatedimageitem.gif
\o
\qml
-Item {
- width: anim.width; height: anim.height+8
- AnimatedImage { id: anim; source: "pics/games-anim.gif" }
- Rectangle { color: "red"; width: 4; height: 8; y: anim.height
- x: (anim.width-width)*anim.currentFrame/(anim.frameCount-1)
+ import Qt 4.7
+
+ Rectangle {
+ width: animation.width; height: animation.height + 8
+
+ AnimatedImage { id: animation; source: "animation.gif" }
+
+ Rectangle {
+ property int frames: animation.frameCount
+
+ width: 4; height: 8
+ x: (animation.width - width) * animation.currentFrame / frames
+ y: animation.height
+ color: "red"
+ }
}
-}
\endqml
\endtable
*/
@@ -96,7 +105,7 @@ QDeclarativeAnimatedImage::~QDeclarativeAnimatedImage()
/*!
\qmlproperty bool AnimatedImage::paused
- This property holds whether the animated image is paused or not
+ This property holds whether the animated image is paused.
Defaults to false, and can be set to true when you want to pause.
*/
@@ -120,7 +129,7 @@ void QDeclarativeAnimatedImage::setPaused(bool pause)
}
/*!
\qmlproperty bool AnimatedImage::playing
- This property holds whether the animated image is playing or not
+ This property holds whether the animated image is playing.
Defaults to true, so as to start playing immediately.
*/
@@ -263,7 +272,9 @@ void QDeclarativeAnimatedImage::movieRequestFinished()
d->_movie = new QMovie(d->reply);
if (!d->_movie->isValid()){
+#ifndef QT_NO_DEBUG_STREAM
qmlInfo(this) << "Error Reading Animated Image File " << d->url;
+#endif
delete d->_movie;
d->_movie = 0;
return;
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
index d926119..8c9d2dd 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
@@ -74,7 +74,7 @@ public:
\inherits Item
Flipable is an item that can be visibly "flipped" between its front and
- back sides. It is used together with Rotation and State/Transition to
+ back sides. It is used together with \l Rotation and \l {State}/\l {Transition} to
produce a flipping effect.
Here is a Flipable that flips whenever it is clicked:
@@ -83,10 +83,12 @@ public:
\image flipable.gif
- The Rotation element is used to specify the angle and axis of the flip,
- and the State defines the changes in angle which produce the flipping
- effect. Finally, the Transition creates the animation that changes the
+ The \l Rotation element is used to specify the angle and axis of the flip,
+ and the \l State defines the changes in angle which produce the flipping
+ effect. Finally, the \l Transition creates the animation that changes the
angle over one second.
+
+ \sa {declarative/ui-components/flipable}{Flipable example}
*/
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 906f1fc..ffffc2f 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -904,28 +904,43 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
\inherits Flickable
\brief The GridView item provides a grid view of items provided by a model.
- The model is typically provided by a QAbstractListModel "C++ model object",
- but can also be created directly in QML.
+ A GridView displays data from models created from built-in QML elements like ListModel
+ and XmlListModel, or custom model classes defined in C++ that inherit from
+ QAbstractListModel.
- The items are laid out top to bottom (vertically) or left to right (horizontally)
- and may be flicked to scroll.
+ A GridView has a \l model, which defines the data to be displayed, and
+ a \l delegate, which defines how the data should be displayed. Items in a
+ GridView are laid out horizontally or vertically. Grid views are inherently flickable
+ as GridView inherits from \l Flickable.
- The below example creates a very simple grid, using a QML model.
+ For example, if there is a simple list model defined in a file \c ContactModel.qml like this:
- \image gridview.png
+ \snippet doc/src/snippets/declarative/gridview/ContactModel.qml 0
- \snippet doc/src/snippets/declarative/gridview/gridview.qml 3
+ Another component can display this model data in a GridView, like this:
- The model is defined as a ListModel using QML:
- \quotefile doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml import
+ \codeline
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs simple
+ \image gridview-simple.png
- In this case ListModel is a handy way for us to test our UI. In practice
- the model would be implemented in C++, or perhaps via a SQL data source.
+ Here, the GridView creates a \c ContactModel component for its model, and a \l Column element
+ (containing \l Image and \ Text elements) for its delegate. The view will create a new delegate
+ for each item in the model. Notice the delegate is able to access the model's \c name and
+ \c portrait data directly.
+
+ An improved grid view is shown below. The delegate is visually improved and is moved
+ into a separate \c contactDelegate component. Also, the currently selected item is highlighted
+ with a blue \l Rectangle using the \l highlight property, and \c focus is set to \c true
+ to enable keyboard navigation for the grid view.
+
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs advanced
+ \image gridview-highlight.png
Delegates are instantiated as needed and may be destroyed at any time.
State should \e never be stored in a delegate.
- \bold Note that views do not enable \e clip automatically. If the view
+ \note Views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
nicely.
@@ -971,19 +986,7 @@ QDeclarativeGridView::~QDeclarativeGridView()
The example below ensures that the animation completes before
the item is removed from the grid.
- \code
- Component {
- id: myDelegate
- Item {
- id: wrapper
- GridView.onRemove: SequentialAnimation {
- PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: true }
- NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: Easing.InOutQuad }
- PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: false }
- }
- }
- }
- \endcode
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml delayRemove
*/
/*!
@@ -1001,10 +1004,10 @@ QDeclarativeGridView::~QDeclarativeGridView()
\qmlproperty model GridView::model
This property holds the model providing data for the grid.
- The model provides a set of data that is used to create the items
- for the view. For large or dynamic datasets the model is usually
- provided by a C++ model object. The C++ model object must be a \l
- {QAbstractItemModel} subclass, a VisualModel, or a simple list.
+ The model provides the set of data that is used to create the items
+ in the view. Models can be created directly in QML using \l ListModel, \l XmlListModel
+ or \l VisualItemModel, or provided by C++ model classes. If a C++ model class is
+ used, it must be a subclass of \l QAbstractItemModel or a simple list.
\sa {qmlmodels}{Data Models}
*/
@@ -1079,11 +1082,11 @@ void QDeclarativeGridView::setModel(const QVariant &model)
that is not needed for the normal display of the delegate in a \l Loader which
can load additional elements when needed.
- Note that the GridView will layout the items based on the size of the root item
+ The GridView will layout the items based on the size of the root item
in the delegate.
- Here is an example delegate:
- \snippet doc/src/snippets/declarative/gridview/gridview.qml 0
+ \note Delegates are instantiated as needed and may be destroyed at any time.
+ State should \e never be stored in a delegate.
*/
QDeclarativeComponent *QDeclarativeGridView::delegate() const
{
@@ -1157,8 +1160,7 @@ QDeclarativeItem *QDeclarativeGridView::currentItem()
/*!
\qmlproperty Item GridView::highlightItem
- \c highlightItem holds the highlight item, which was created
- from the \l highlight component.
+ This holds the highlight item created from the \l highlight component.
The highlightItem is managed by the view unless
\l highlightFollowsCurrentItem is set to false.
@@ -1189,13 +1191,10 @@ int QDeclarativeGridView::count() const
\qmlproperty Component GridView::highlight
This property holds the component to use as the highlight.
- An instance of the highlight component will be created for each view.
- The geometry of the resultant component instance will be managed by the view
+ An instance of the highlight component is created for each view.
+ The geometry of the resulting component instance will be managed by the view
so as to stay with the current item, unless the highlightFollowsCurrentItem property is false.
- The below example demonstrates how to make a simple highlight:
- \snippet doc/src/snippets/declarative/gridview/gridview.qml 1
-
\sa highlightItem, highlightFollowsCurrentItem
*/
QDeclarativeComponent *QDeclarativeGridView::highlight() const
@@ -1218,21 +1217,14 @@ void QDeclarativeGridView::setHighlight(QDeclarativeComponent *highlight)
\qmlproperty bool GridView::highlightFollowsCurrentItem
This property sets whether the highlight is managed by the view.
- If highlightFollowsCurrentItem is true, the highlight will be moved smoothly
- to follow the current item. If highlightFollowsCurrentItem is false, the
- highlight will not be moved by the view, and must be implemented
- by the highlight component, for example:
-
- \code
- Component {
- id: myHighlight
- Rectangle {
- id: wrapper; color: "lightsteelblue"; radius: 4; width: 320; height: 60
- SpringFollow on y { source: wrapper.GridView.view.currentItem.y; spring: 3; damping: 0.2 }
- SpringFollow on x { source: wrapper.GridView.view.currentItem.x; spring: 3; damping: 0.2 }
- }
- }
- \endcode
+ If this property is true, the highlight is moved smoothly
+ to follow the current item. Otherwise, the
+ highlight is not moved by the view, and any movement must be implemented
+ by the highlight.
+
+ Here is a highlight with its motion defined by a \l {SpringFollow} item:
+
+ \snippet doc/src/snippets/declarative/gridview/gridview.qml highlightFollowsCurrentItem
*/
bool QDeclarativeGridView::highlightFollowsCurrentItem() const
{
@@ -1290,32 +1282,30 @@ void QDeclarativeGridView::setHighlightMoveDuration(int duration)
\qmlproperty real GridView::preferredHighlightEnd
\qmlproperty enumeration GridView::highlightRangeMode
- These properties set the preferred range of the highlight (current item)
- within the view.
+ These properties define the preferred range of the highlight (for the current item)
+ within the view. The \c preferredHighlightBegin value must be less than the
+ \c preferredHighlightEnd value.
- Note that this is the correct way to influence where the
- current item ends up when the view scrolls. For example, if you want the
- currently selected item to be in the middle of the list, then set the
- highlight range to be where the middle item would go. Then, when the view scrolls,
- the currently selected item will be the item at that spot. This also applies to
- when the currently selected item changes - it will scroll to within the preferred
- highlight range. Furthermore, the behaviour of the current item index will occur
- whether or not a highlight exists.
+ These properties affect the position of the current item when the view is scrolled.
+ For example, if the currently selected item should stay in the middle of the
+ view when it is scrolled, set the \c preferredHighlightBegin and
+ \c preferredHighlightEnd values to the top and bottom coordinates of where the middle
+ item would be. If the \c currentItem is changed programmatically, the view will
+ automatically scroll so that the current item is in the middle of the view.
+ Furthermore, the behavior of the current item index will occur whether or not a
+ highlight exists.
- If highlightRangeMode is set to \e GridView.ApplyRange the view will
- attempt to maintain the highlight within the range, however
- the highlight can move outside of the range at the ends of the list
- or due to a mouse interaction.
+ Valid values for \c highlightRangeMode are:
- If highlightRangeMode is set to \e GridView.StrictlyEnforceRange the highlight will never
- move outside of the range. This means that the current item will change
- if a keyboard or mouse action would cause the highlight to move
- outside of the range.
-
- The default value is \e GridView.NoHighlightRange.
-
- Note that a valid range requires preferredHighlightEnd to be greater
- than or equal to preferredHighlightBegin.
+ \list
+ \o GridView.ApplyRange - the view attempts to maintain the highlight within the range.
+ However, the highlight can move outside of the range at the ends of the view or due
+ to mouse interaction.
+ \o GridView.StrictlyEnforceRange - the highlight never moves outside of the range.
+ The current item changes if a keyboard or mouse action would cause the highlight to move
+ outside of the range.
+ \o GridView.NoHighlightRange - this is the default value.
+ \endlist
*/
qreal QDeclarativeGridView::preferredHighlightBegin() const
{
@@ -1370,10 +1360,12 @@ void QDeclarativeGridView::setHighlightRangeMode(HighlightRangeMode mode)
\qmlproperty enumeration GridView::flow
This property holds the flow of the grid.
- Possible values are \c GridView.LeftToRight (default) and \c GridView.TopToBottom.
+ Possible values:
- If \a flow is \c GridView.LeftToRight, the view will scroll vertically.
- If \a flow is \c GridView.TopToBottom, the view will scroll horizontally.
+ \list
+ \o GridView.LeftToRight (default) - Items are laid out from left to right, and the view scrolls vertically
+ \o GridView.TopToBottom - Items are laid out from top to bottom, and the view scrolls horizontally
+ \endlist
*/
QDeclarativeGridView::Flow QDeclarativeGridView::flow() const
{
@@ -1405,8 +1397,9 @@ void QDeclarativeGridView::setFlow(Flow flow)
\qmlproperty bool GridView::keyNavigationWraps
This property holds whether the grid wraps key navigation
- If this property is true then key presses to move off of one end of the grid will cause the
- selection to jump to the other side.
+ If this is true, key navigation that would move the current item selection
+ past one end of the view instead wraps around and moves the selection to
+ the other end of the view.
*/
bool QDeclarativeGridView::isWrapEnabled() const
{
@@ -1463,7 +1456,7 @@ void QDeclarativeGridView::setCacheBuffer(int buffer)
\qmlproperty int GridView::cellWidth
\qmlproperty int GridView::cellHeight
- These properties holds the width and height of each cell in the grid
+ These properties holds the width and height of each cell in the grid.
The default cell size is 100x100.
*/
@@ -1503,14 +1496,14 @@ void QDeclarativeGridView::setCellHeight(int cellHeight)
/*!
\qmlproperty enumeration GridView::snapMode
- This property determines where the view will settle following a drag or flick.
- The allowed values are:
+ This property determines how the view scrolling will settle following a drag or flick.
+ The possible values are:
\list
- \o GridView.NoSnap (default) - the view will stop anywhere within the visible area.
- \o GridView.SnapToRow - the view will settle with a row (or column for TopToBottom flow)
+ \o GridView.NoSnap (default) - the view stops anywhere within the visible area.
+ \o GridView.SnapToRow - the view settles with a row (or column for \c GridView.TopToBottom flow)
aligned with the start of the view.
- \o GridView.SnapOneRow - the view will settle no more than one row (or column for TopToBottom flow)
+ \o GridView.SnapOneRow - the view will settle no more than one row (or column for \c GridView.TopToBottom flow)
away from the first visible row at the time the mouse button is released.
This mode is particularly useful for moving one page at a time.
\endlist
@@ -1789,22 +1782,22 @@ void QDeclarativeGridView::moveCurrentIndexRight()
\a mode:
\list
- \o Beginning - position item at the top (or left for TopToBottom flow) of the view.
- \o Center- position item in the center of the view.
- \o End - position item at bottom (or right for horizontal orientation) of the view.
- \o Visible - if any part of the item is visible then take no action, otherwise
+ \o GridView.Beginning - position item at the top (or left for \c GridView.TopToBottom flow) of the view.
+ \o GridView.Center - position item in the center of the view.
+ \o GridView.End - position item at bottom (or right for horizontal orientation) of the view.
+ \o GridView.Visible - if any part of the item is visible then take no action, otherwise
bring the item into view.
- \o Contain - ensure the entire item is visible. If the item is larger than
- the view the item is positioned at the top (or left for TopToBottom flow) of the view.
+ \o GridView.Contain - ensure the entire item is visible. If the item is larger than
+ the view the item is positioned at the top (or left for \c GridView.TopToBottom flow) of the view.
\endlist
If positioning the view at the index would cause empty space to be displayed at
the beginning or end of the view, the view will be positioned at the boundary.
- It is not recommended to use contentX or contentY to position the view
+ It is not recommended to use \l {Flickable::}{contentX} or \l {Flickable::}{contentY} to position the view
at a particular index. This is unreliable since removing items from the start
of the view does not cause all other items to be repositioned.
- The correct way to bring an item into view is with positionViewAtIndex.
+ The correct way to bring an item into view is with \c positionViewAtIndex.
*/
void QDeclarativeGridView::positionViewAtIndex(int index, int mode)
{
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index 4593cf8..94240c2 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -275,11 +275,6 @@ qreal QDeclarativeImage::paintedHeight() const
\o Image.Error - an error occurred while loading the image
\endlist
- Note that a change in the status property does not cause anything to happen
- (although it reflects what has happened with the image internally). If you wish
- to react to the change in status you need to do it yourself, for example in one
- of the following ways:
-
Use this status to provide an update or respond to the status change in some way.
For example, you could:
diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h
index 5ea700d..fa5b2a9 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h
@@ -87,8 +87,6 @@ protected:
QDeclarativeImage(QDeclarativeImagePrivate &dd, QDeclarativeItem *parent);
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
void pixmapChange();
-
-protected Q_SLOTS:
void updatePaintedGeometry();
private:
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 7bd08ce..9949e65 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -97,9 +97,11 @@ QT_BEGIN_NAMESPACE
The Translate object provides independent control over position in addition to the Item's x and y properties.
- The following example moves the Y axis of the Rectangles while still allowing the Row element
+ The following example moves the Y axis of the \l Rectangle elements while still allowing the \l Row element
to lay the items out as if they had not been transformed:
\qml
+ import Qt 4.7
+
Row {
Rectangle {
width: 100; height: 100
@@ -113,6 +115,8 @@ QT_BEGIN_NAMESPACE
}
}
\endqml
+
+ \image translate.png
*/
/*!
@@ -3131,6 +3135,7 @@ bool QDeclarativeItem::event(QEvent *ev)
return QGraphicsObject::event(ev);
}
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, QDeclarativeItem *item)
{
if (!item) {
@@ -3144,6 +3149,7 @@ QDebug operator<<(QDebug debug, QDeclarativeItem *item)
<< ", z =" << item->zValue() << ')';
return debug;
}
+#endif
qint64 QDeclarativeItemPrivate::consistentTime = -1;
void QDeclarativeItemPrivate::setConsistentTime(qint64 t)
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h
index 29fd241..77e316b 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem.h
@@ -209,7 +209,9 @@ T qobject_cast(QGraphicsItem *item)
return qobject_cast<T>(o);
}
+#ifndef QT_NO_DEBUG_STREAM
QDebug Q_DECLARATIVE_EXPORT operator<<(QDebug debug, QDeclarativeItem *item);
+#endif
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
index 151a9e9..0be8dac 100644
--- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
@@ -112,9 +112,11 @@ void QDeclarativeItemModule::defineModule()
qmlRegisterType<QDeclarativePathPercent>("Qt",4,7,"PathPercent");
qmlRegisterType<QDeclarativePathQuad>("Qt",4,7,"PathQuad");
qmlRegisterType<QDeclarativePathView>("Qt",4,7,"PathView");
+#ifndef QT_NO_VALIDATOR
qmlRegisterType<QIntValidator>("Qt",4,7,"IntValidator");
qmlRegisterType<QDoubleValidator>("Qt",4,7,"DoubleValidator");
qmlRegisterType<QRegExpValidator>("Qt",4,7,"RegExpValidator");
+#endif
qmlRegisterType<QDeclarativeRectangle>("Qt",4,7,"Rectangle");
qmlRegisterType<QDeclarativeRepeater>("Qt",4,7,"Repeater");
qmlRegisterType<QGraphicsRotation>("Qt",4,7,"Rotation");
@@ -138,7 +140,9 @@ void QDeclarativeItemModule::defineModule()
qmlRegisterType<QDeclarativePathElement>();
qmlRegisterType<QDeclarativeCurve>();
qmlRegisterType<QDeclarativeScaleGrid>();
+#ifndef QT_NO_VALIDATOR
qmlRegisterType<QValidator>();
+#endif
qmlRegisterType<QDeclarativeVisualModel>();
#ifndef QT_NO_ACTION
qmlRegisterType<QAction>();
diff --git a/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp
index 4add66d..38d5f59 100644
--- a/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp
@@ -58,7 +58,10 @@ QT_BEGIN_NAMESPACE
taking its size hints into account, and you can propagate this to the other elements in your UI via anchors and bindings.
This is a QGraphicsLayoutItem subclass, and its properties merely expose the QGraphicsLayoutItem functionality to QML.
- See the QGraphicsLayoutItem documentation for further details.
+
+ The \l{declarative/cppextensions/qgraphicslayouts/layoutitem}{LayoutItem example}
+ demonstrates how a LayoutItem can be used within a \l{Graphics View Framework}{Graphics View}
+ scene.
*/
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 78c56d6..dbd1976 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -427,6 +427,8 @@ public:
scheduleLayout();
}
}
+ if (currentItem && currentItem->item == item)
+ updateHighlight();
if (trackedItem && trackedItem->item == item)
q->trackedPositionChanged();
}
@@ -1103,7 +1105,9 @@ void QDeclarativeListViewPrivate::updateHeader()
void QDeclarativeListViewPrivate::fixupPosition()
{
- moveReason = Other;
+ if ((haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange)
+ || snapMode != QDeclarativeListView::NoSnap)
+ moveReason = Other;
if (orient == QDeclarativeListView::Vertical)
fixupY();
else
@@ -1325,13 +1329,11 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
Another component can display this model data in a ListView, like this:
- \table
- \row
- \o \snippet doc/src/snippets/declarative/listview/listview.qml import
+ \snippet doc/src/snippets/declarative/listview/listview.qml import
\codeline
\snippet doc/src/snippets/declarative/listview/listview.qml classdocs simple
- \o \image listview-simple.png
- \endtable
+
+ \image listview-simple.png
Here, the ListView creates a \c ContactModel component for its model, and a \l Text element
for its delegate. The view will create a new \l Text component for each item in the model. Notice
@@ -1342,13 +1344,10 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
with a blue \l Rectangle using the \l highlight property, and \c focus is set to \c true
to enable keyboard navigation for the list view.
- \table
- \row
- \o \snippet doc/src/snippets/declarative/listview/listview.qml classdocs advanced
- \o \image listview-highlight.png
- \endtable
+ \snippet doc/src/snippets/declarative/listview/listview.qml classdocs advanced
+ \image listview-highlight.png
- In a ListView, delegates are instantiated as needed and may be destroyed at any time.
+ In a GridView, delegates are instantiated as needed and may be destroyed at any time.
State should \e never be stored in a delegate.
\note Views do not enable \e clip automatically. If the view
@@ -1466,13 +1465,15 @@ void QDeclarativeListView::setModel(const QVariant &model)
disconnect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
}
d->clear();
+ QDeclarativeVisualModel *oldModel = d->model;
+ d->model = 0;
d->setPosition(0);
d->modelVariant = model;
QObject *object = qvariant_cast<QObject*>(model);
QDeclarativeVisualModel *vim = 0;
if (object && (vim = qobject_cast<QDeclarativeVisualModel *>(object))) {
if (d->ownModel) {
- delete d->model;
+ delete oldModel;
d->ownModel = false;
}
d->model = vim;
@@ -1480,6 +1481,8 @@ void QDeclarativeListView::setModel(const QVariant &model)
if (!d->ownModel) {
d->model = new QDeclarativeVisualDataModel(qmlContext(this), this);
d->ownModel = true;
+ } else {
+ d->model = oldModel;
}
if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
dataModel->setModel(model);
@@ -1630,7 +1633,7 @@ int QDeclarativeListView::count() const
This property holds the component to use as the highlight.
An instance of the highlight component is created for each list.
- The geometry of the resultant component instance is managed by the list
+ The geometry of the resulting component instance is managed by the list
so as to stay with the current item, unless the highlightFollowsCurrentItem
property is false.
@@ -1663,7 +1666,7 @@ void QDeclarativeListView::setHighlight(QDeclarativeComponent *highlight)
highlight is not moved by the view, and any movement must be implemented
by the highlight.
- Here is a highlight with its motion defined by the a \l {SpringFollow} item:
+ Here is a highlight with its motion defined by a \l {SpringFollow} item:
\snippet doc/src/snippets/declarative/listview/listview.qml highlightFollowsCurrentItem
@@ -2038,8 +2041,8 @@ void QDeclarativeListView::setHighlightResizeDuration(int duration)
/*!
\qmlproperty enumeration ListView::snapMode
- This property determines where the view's scrolling behavior stops following a drag or flick.
- The allowed values are:
+ This property determines how the view scrolling will settle following a drag or flick.
+ The possible values are:
\list
\o ListView.NoSnap (default) - the view stops anywhere within the visible area.
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index 4995baf..898c5a5 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -115,27 +115,37 @@ void QDeclarativeLoaderPrivate::initResize()
subtree from a QML URL or Component.
Loader instantiates an item from a component. The component to
- instantiate may be specified directly by the \c sourceComponent
- property, or loaded from a URL via the \c source property.
+ instantiate may be specified directly by the \l sourceComponent
+ property, or loaded from a URL via the \l source property.
It is also an effective means of delaying the creation of a component
until it is required:
\code
+ import Qt 4.7
+
Loader { id: pageLoader }
+
Rectangle {
- MouseArea { anchors.fill: parent; onClicked: pageLoader.source = "Page1.qml" }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: pageLoader.source = "Page1.qml"
+ }
}
\endcode
If the Loader source is changed, any previous items instantiated
- will be destroyed. Setting \c source to an empty string, or setting
+ 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:
\code
pageLoader.source = ""
+ \endcode
+
or
+
+ \code
pageLoader.sourceComponent = undefined
\endcode
@@ -340,19 +350,31 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
\o Loader.Error - an error occurred while loading the QML source
\endlist
- Note that a change in the status property does not cause anything to happen
- (although it reflects what has happened to the loader internally). If you wish
- to react to the change in status you need to do it yourself, for example in one
- of the following ways:
- \list
- \o Create a state, so that a state change occurs, e.g. State{name: 'loaded'; when: loader.status = Loader.Ready;}
- \o Do something inside the onLoaded signal handler, e.g. Loader{id: loader; onLoaded: console.log('Loaded');}
- \o Bind to the status variable somewhere, e.g. Text{text: if(loader.status!=Loader.Ready){'Not Loaded';}else{'Loaded';}}
- \endlist
- \sa progress
+ Use this status to provide an update or respond to the status change in some way.
+ For example, you could:
+
+ \e {Trigger a state change:}
+ \qml
+ State { name: 'loaded'; when: loader.status = Loader.Ready }
+ \endqml
+
+ \e {Implement an \c onStatusChanged signal handler:}
+ \qml
+ Loader {
+ id: loader
+ onStatusChanged: if (loader.status == Loader.Ready) console.log('Loaded')
+ }
+ \endqml
+
+ \e {Bind to the status value:}
+ \qml
+ Text { text: loader.status != Loader.Ready ? 'Not Loaded' : 'Loaded' }
+ \endqml
Note that if the source is a local file, the status will initially be Ready (or Error). While
there will be no onStatusChanged signal in that case, the onLoaded will still be invoked.
+
+ \sa progress
*/
QDeclarativeLoader::Status QDeclarativeLoader::status() const
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index 1947c00..6fca283 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -172,17 +172,21 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate()
A MouseArea is typically used in conjunction with a visible item,
where the MouseArea effectively 'proxies' mouse handling for that
- item. For example, we can put a MouseArea in a Rectangle that changes
- the Rectangle color to red when clicked:
- \snippet doc/src/snippets/declarative/mouseregion.qml 0
+ item. For example, we can put a MouseArea in a \l Rectangle that changes
+ the \l Rectangle color to red when clicked:
+
+ \snippet doc/src/snippets/declarative/mousearea.qml import
+ \codeline
+ \snippet doc/src/snippets/declarative/mousearea.qml intro
Many MouseArea signals pass a \l {MouseEvent}{mouse} parameter that contains
additional information about the mouse event, such as the position, button,
and any key modifiers.
- Below we have the previous
- example extended so as to give a different color when you right click.
- \snippet doc/src/snippets/declarative/mouseregion.qml 1
+ Here is an extension of the previous example that produces a different
+ color when the area is right clicked:
+
+ \snippet doc/src/snippets/declarative/mousearea.qml intro-extended
For basic key handling, see the \l {Keys}{Keys attached property}.
@@ -238,7 +242,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate()
releasing is also considered a click).
The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
- position of the release of the click, and whether the click wasHeld.
+ position of the release of the click, and whether the click was held.
The \e accepted property of the MouseEvent parameter is ignored in this handler.
*/
@@ -262,7 +266,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate()
This handler is called when there is a release.
The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
- position of the release of the click, and whether the click wasHeld.
+ position of the release of the click, and whether the click was held.
The \e accepted property of the MouseEvent parameter is ignored in this handler.
*/
@@ -282,7 +286,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate()
This handler is called when there is a double-click (a press followed by a release followed by a press).
The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
- position of the release of the click, and whether the click wasHeld.
+ position of the release of the click, and whether the click was held.
The \e accepted property of the MouseEvent parameter is ignored in this handler.
*/
@@ -328,10 +332,10 @@ QDeclarativeMouseArea::~QDeclarativeMouseArea()
while a button is pressed, and will remain valid as long as the button is held
even if the mouse is moved outside the area.
- If hoverEnabled is true then these properties will be valid:
+ If hoverEnabled is true then these properties will be valid when:
\list
- \i when no button is pressed, but the mouse is within the MouseArea (containsMouse is true).
- \i if a button is pressed and held, even if it has since moved out of the area.
+ \i no button is pressed, but the mouse is within the MouseArea (containsMouse is true).
+ \i a button is pressed and held, even if it has since moved out of the area.
\endlist
The coordinates are relative to the MouseArea.
@@ -378,18 +382,7 @@ void QDeclarativeMouseArea::setEnabled(bool a)
\endlist
The code below displays "right" when the right mouse buttons is pressed:
- \code
- Text {
- text: mr.pressedButtons & Qt.RightButton ? "right" : ""
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- MouseArea {
- id: mr
- acceptedButtons: Qt.LeftButton | Qt.RightButton
- anchors.fill: parent
- }
- }
- \endcode
+ \snippet doc/src/snippets/declarative/mousearea.qml mousebuttons
\sa acceptedButtons
*/
@@ -705,7 +698,7 @@ void QDeclarativeMouseArea::setHovered(bool h)
MouseArea { acceptedButtons: Qt.LeftButton | Qt.RightButton }
\endcode
- The default is to accept the Left button.
+ The default value is \c Qt.LeftButton.
*/
Qt::MouseButtons QDeclarativeMouseArea::acceptedButtons() const
{
@@ -765,17 +758,19 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag()
\qmlproperty real MouseArea::drag.minimumY
\qmlproperty real MouseArea::drag.maximumY
- drag provides a convenient way to make an item draggable.
+ \c drag provides a convenient way to make an item draggable.
\list
- \i \c target specifies the item to drag.
- \i \c active specifies if the target item is being currently dragged.
- \i \c axis specifies whether dragging can be done horizontally (Drag.XAxis), vertically (Drag.YAxis), or both (Drag.XandYAxis)
- \i the minimum and maximum properties limit how far the target can be dragged along the corresponding axes.
+ \i \c drag.target specifies the item to drag.
+ \i \c drag.active specifies if the target item is currently being dragged.
+ \i \c drag.axis specifies whether dragging can be done horizontally (\c Drag.XAxis), vertically (\c Drag.YAxis), or both (\c Drag.XandYAxis)
+ \i \c drag.minimum and \c drag.maximum limit how far the target can be dragged along the corresponding axes.
\endlist
- The following example uses drag to reduce the opacity of an image as it moves to the right:
- \snippet doc/src/snippets/declarative/drag.qml 0
+ The following example displays an image that can be dragged along the X-axis. The opacity
+ of the image is reduced when it is dragged to the right.
+
+ \snippet doc/src/snippets/declarative/mousearea.qml drag
*/
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp
index 141a938..a904869 100644
--- a/src/declarative/graphicsitems/qdeclarativepath.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepath.cpp
@@ -628,7 +628,7 @@ void QDeclarativePathLine::addToPath(QPainterPath &path)
\qml
Path {
startX: 0; startY: 0
- PathQuad x: 200; y: 0; controlX: 100; controlY: 150 }
+ PathQuad { x: 200; y: 0; controlX: 100; controlY: 150 }
}
\endqml
\endtable
@@ -713,8 +713,9 @@ void QDeclarativePathQuad::addToPath(QPainterPath &path)
Path {
startX: 20; startY: 0
PathCubic {
- x: 180; y: 0; control1X: -10; control1Y: 90
- control2X: 210; control2Y: 90
+ x: 180; y: 0
+ control1X: -10; control1Y: 90
+ control2X: 210; control2Y: 90
}
}
\endqml
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 448ec06..f58b054 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -310,11 +310,21 @@ void QDeclarativePathViewPrivate::regenerate()
\brief The PathView element lays out model-provided items on a path.
\inherits Item
- The model is typically provided by a QAbstractListModel "C++ model object", but can also be created directly in QML.
+ A PathView displays data from models created from built-in QML elements like ListModel
+ and XmlListModel, or custom model classes defined in C++ that inherit from
+ QAbstractListModel.
+ A ListView has a \l model, which defines the data to be displayed, and
+ a \l delegate, which defines how the data should be displayed.
The \l delegate is instantiated for each item on the \l path.
The items may be flicked to move them along the path.
+ For example, if there is a simple list model defined in a file \c ContactModel.qml like this:
+
+ \snippet doc/src/snippets/declarative/pathview/ContactModel.qml 0
+
+ This data can be represented as a PathView, like this:
+
\snippet doc/src/snippets/declarative/pathview/pathview.qml 0
\image pathview.gif
@@ -885,6 +895,7 @@ void QDeclarativePathView::setPathItemCount(int i)
if (i < 1)
i = 1;
d->pathItems = i;
+ d->updateMappedRange();
if (d->isValid() && isComponentComplete()) {
d->regenerate();
}
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index 8796e63..20cc46b 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -302,7 +302,7 @@ void QDeclarativeBasePositioner::finishApplyTransitions()
/*!
\qmlclass Column QDeclarativeColumn
\since 4.7
- \brief The Column item lines up its children vertically.
+ \brief The Column item arranges its children vertically.
\inherits Item
The Column item positions its child items so that they are vertically
@@ -346,7 +346,8 @@ Column {
will not change. If you manually change the x or y properties in script, bind
the x or y properties, use anchors on a child of a positioner, or have the
height of a child depend on the position of a child, then the
- positioner may exhibit strange behaviour.
+ positioner may exhibit strange behaviour. If you need to perform any of these
+ actions, consider positioning the items without the use of a Column.
*/
/*!
@@ -396,7 +397,7 @@ Column {
spacing is the amount in pixels left empty between each adjacent
item, and defaults to 0.
- The below example places a Grid containing a red, a blue and a
+ The below example places a \l Grid containing a red, a blue and a
green rectangle on a gray background. The area the grid positioner
occupies is colored white. The top positioner has the default of no spacing,
and the bottom positioner has its spacing set to 2.
@@ -468,17 +469,15 @@ void QDeclarativeColumn::reportConflictingAnchors()
/*!
\qmlclass Row QDeclarativeRow
\since 4.7
- \brief The Row item lines up its children horizontally.
+ \brief The Row item arranges its children horizontally.
\inherits Item
The Row item positions its child items so that they are
- horizontally aligned and not overlapping. Spacing can be added between the
- items, and a margin around all items can also be added. It also provides for
- transitions to be set when items are added, moved, or removed in the
- positioner. Adding and removing apply both to items which are deleted or have
- their position in the document changed so as to no longer be children of the
- positioner, as well as to items which have their opacity set to or from zero
- so as to appear or disappear.
+ horizontally aligned and not overlapping.
+
+ Use \l spacing to set the spacing between items in a Row, and use the
+ \l add and \l move properties to set the transitions that should be applied
+ when items are added to, removed from, or re-positioned within the Row.
The below example lays out differently shaped rectangles using a Row.
\qml
@@ -495,8 +494,8 @@ Row {
will not change. If you manually change the x or y properties in script, bind
the x or y properties, use anchors on a child of a positioner, or have the
width of a child depend on the position of a child, then the
- positioner may exhibit strange behaviour.
-
+ positioner may exhibit strange behaviour. If you need to perform any of these
+ actions, consider positioning the items without the use of a Row.
*/
/*!
\qmlproperty Transition Row::add
@@ -504,12 +503,10 @@ Row {
The transition will only be applied to the added item(s).
Positioner transitions will only affect the position (x,y) of items.
- Added can mean that either the object has been created or
- reparented, and thus is now a child or the positioner, or that the
+ An object is considered to be added to the positioner if it has been
+ created or reparented and thus is now a child or the positioner, or if the
object has had its opacity increased from zero, and thus is now
visible.
-
-
*/
/*!
\qmlproperty Transition Row::move
@@ -540,7 +537,7 @@ Row {
spacing is the amount in pixels left empty between each adjacent
item, and defaults to 0.
- The below example places a Grid containing a red, a blue and a
+ The below example places a \l Grid containing a red, a blue and a
green rectangle on a gray background. The area the grid positioner
occupies is colored white. The top positioner has the default of no spacing,
and the bottom positioner has its spacing set to 2.
@@ -610,18 +607,20 @@ void QDeclarativeRow::reportConflictingAnchors()
\inherits Item
The Grid item positions its child items so that they are
- aligned in a grid and are not overlapping. Spacing can be added
- between the items. It also provides for transitions to be set when items are
+ aligned in a grid and are not overlapping.
+
+ Spacing can be added
+ between child items. It also provides for transitions to be set when items are
added, moved, or removed in the positioner. Adding and removing apply
both to items which are deleted or have their position in the
document changed so as to no longer be children of the positioner, as
well as to items which have their opacity set to or from zero so
as to appear or disappear.
- The Grid defaults to using four columns, and as many rows as
- are necessary to fit all the child items. The number of rows
- and/or the number of columns can be constrained by setting the rows
- or columns properties. The grid positioner calculates a grid with
+ A Grid defaults to four columns, and as many rows as
+ are necessary to fit all child items. The number of rows
+ and/or the number of columns can be constrained by setting the \l rows
+ or \l columns properties. The grid positioner calculates a grid with
rectangular cells of sufficient size to hold all items, and then
places the items in the cells, going across then down, and
positioning each item at the (0,0) corner of the cell. The below
@@ -648,7 +647,8 @@ Grid {
will not change. If you manually change the x or y properties in script, bind
the x or y properties, use anchors on a child of a positioner, or have the
width or height of a child depend on the position of a child, then the
- positioner may exhibit strange behaviour.
+ positioner may exhibit strange behaviour. If you need to perform any of these
+ actions, consider positioning the items without the use of a Grid.
*/
/*!
\qmlproperty Transition Grid::add
@@ -658,12 +658,10 @@ Grid {
as that is all the positioners affect. To animate other property change
you will have to do so based on how you have changed those properties.
- Added can mean that either the object has been created or
- reparented, and thus is now a child or the positioner, or that the
+ An object is considered to be added to the positioner if it has been
+ created or reparented and thus is now a child or the positioner, or if the
object has had its opacity increased from zero, and thus is now
visible.
-
-
*/
/*!
\qmlproperty Transition Grid::move
@@ -714,18 +712,16 @@ QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) :
\qmlproperty int Grid::columns
This property holds the number of columns in the grid.
- When the columns property is set the Grid will always have
- that many columns. Note that if you do not have enough items to
- fill this many columns some columns will be of zero width.
+ If the grid does not have enough items to fill the specified
+ number of columns, some columns will be of zero width.
*/
/*!
\qmlproperty int Grid::rows
This property holds the number of rows in the grid.
- When the rows property is set the Grid will always have that
- many rows. Note that if you do not have enough items to fill this
- many rows some rows will be of zero width.
+ If the grid does not have enough items to fill the specified
+ number of rows, some rows will be of zero width.
*/
void QDeclarativeGrid::setColumns(const int columns)
@@ -750,12 +746,14 @@ void QDeclarativeGrid::setRows(const int rows)
\qmlproperty enumeration Grid::flow
This property holds the flow of the layout.
- Possible values are \c Grid.LeftToRight (default) and \c Grid.TopToBottom.
+ Possible values are:
- If \a flow is \c Grid.LeftToRight, the items are positioned next to
- to each other from left to right, then wrapped to the next line.
- If \a flow is \c Grid.TopToBottom, the items are positioned next to each
- other from top to bottom, then wrapped to the next column.
+ \list
+ \o Grid.LeftToRight (default) - Items are positioned next to
+ to each other from left to right, then wrapped to the next line.
+ \o Grid.TopToBottom - Items are positioned next to each
+ other from top to bottom, then wrapped to the next column.
+ \endlist
*/
QDeclarativeGrid::Flow QDeclarativeGrid::flow() const
{
@@ -893,14 +891,18 @@ void QDeclarativeGrid::reportConflictingAnchors()
/*!
\qmlclass Flow QDeclarativeFlow
\since 4.7
- \brief The Flow item lines up its children side by side, wrapping as necessary.
+ \brief The Flow item arranges its children side by side, wrapping as necessary.
\inherits Item
+ The Flow item positions its child items so that they are side by side and are
+ not overlapping.
+
Note that the positioner assumes that the x and y positions of its children
will not change. If you manually change the x or y properties in script, bind
the x or y properties, use anchors on a child of a positioner, or have the
width or height of a child depend on the position of a child, then the
- positioner may exhibit strange behaviour.
+ positioner may exhibit strange behaviour. If you need to perform any of these
+ actions, consider positioning the items without the use of a Flow.
*/
/*!
@@ -909,9 +911,10 @@ void QDeclarativeGrid::reportConflictingAnchors()
The transition will only be applied to the added item(s).
Positioner transitions will only affect the position (x,y) of items.
- Added can mean that either the object has been created or reparented, and thus is now a child or the positioner, or that the object has had its opacity increased from zero, and thus is now visible.
-
-
+ An object is considered to be added to the positioner if it has been
+ created or reparented and thus is now a child or the positioner, or if the
+ object has had its opacity increased from zero, and thus is now
+ visible.
*/
/*!
\qmlproperty Transition Flow::move
@@ -965,14 +968,16 @@ QDeclarativeFlow::QDeclarativeFlow(QDeclarativeItem *parent)
\qmlproperty enumeration Flow::flow
This property holds the flow of the layout.
- Possible values are \c Flow.LeftToRight (default) and \c Flow.TopToBottom.
+ Possible values are:
- If \a flow is \c Flow.LeftToRight, the items are positioned next to
+ \list
+ \o Flow.LeftToRight (default) - Items are positioned next to
to each other from left to right until the width of the Flow
is exceeded, then wrapped to the next line.
- If \a flow is \c Flow.TopToBottom, the items are positioned next to each
+ \o Flow.TopToBottom - Items are positioned next to each
other from top to bottom until the height of the Flow is exceeded,
then wrapped to the next column.
+ \endlist
*/
QDeclarativeFlow::Flow QDeclarativeFlow::flow() const
{
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index 301ca00..2756877 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -160,6 +160,8 @@ void QDeclarativeGradient::doUpdate()
You can also create rounded rectangles using the \l radius property.
\qml
+ import Qt 4.7
+
Rectangle {
width: 100
height: 100
@@ -202,8 +204,20 @@ void QDeclarativeRectangle::doUpdate()
A width of 1 creates a thin line. For no line, use a width of 0 or a transparent color.
- To keep the border smooth (rather than blurry), odd widths cause the rectangle to be painted at
- a half-pixel offset;
+ If \c border.width is an odd number, the rectangle is painted at a half-pixel offset to retain
+ border smoothness. Also, the border is rendered evenly on either side of the
+ rectangle's boundaries, and the spare pixel is rendered to the right and below the
+ rectangle (as documented for QRect rendering). This can cause unintended effects if
+ \c border.width is 1 and the rectangle is \l{Item::clip}{clipped} by a parent item:
+
+ \table
+ \row
+ \o \snippet doc/src/snippets/declarative/rect-border-width.qml 0
+ \o \image rect-border-width.png
+ \endtable
+
+ Here, the innermost rectangle's border is clipped on the bottom and right edges by its
+ parent. To avoid this, the border width can be set to two instead of one.
*/
QDeclarativePen *QDeclarativeRectangle::border()
{
diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
index 04076f8..691cfa2 100644
--- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
@@ -80,14 +80,20 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate()
The index is always exposed as an accessible \c index property.
In the case of an object or string list, the data element (of type string
or object) is available as the \c modelData property. In the case of a Qt model,
- all roles are available as named properties just like in the view classes. The
- following example shows how to use the index property inside the instantiated
- items.
+ all roles are available as named properties just like in the view classes.
- \snippet doc/src/snippets/declarative/repeater-index.qml 0
+ The following example shows how to use the \c index property inside the instantiated
+ items:
+ \snippet doc/src/snippets/declarative/repeater-index.qml 0
\image repeater-index.png
+ The repeater could also use the \c modelData property to reference the data for a
+ particular index:
+
+ \snippet doc/src/snippets/declarative/repeater-modeldata.qml 0
+ \image repeater-modeldata.png
+
Items instantiated by the Repeater are inserted, in order, as
children of the Repeater's parent. The insertion starts immediately after
the repeater's position in its parent stacking list. This is to allow
diff --git a/src/declarative/graphicsitems/qdeclarativescalegrid.cpp b/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
index fe89190..a053aa0 100644
--- a/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
+++ b/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
@@ -130,8 +130,9 @@ QDeclarativeGridScaledImage::QDeclarativeGridScaledImage(QIODevice *data)
int b = -1;
QString imgFile;
- while(!data->atEnd()) {
- QString line = QString::fromUtf8(data->readLine().trimmed());
+ QByteArray raw;
+ while(raw = data->readLine(), !raw.isEmpty()) {
+ QString line = QString::fromUtf8(raw.trimmed());
if (line.isEmpty() || line.startsWith(QLatin1Char('#')))
continue;
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 2c1eb67..f4722c3 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -119,6 +119,8 @@ QSet<QUrl> QTextDocumentWithImageResources::errors;
A Text item can display both plain and rich text. For example:
\qml
+ import Qt 4.7
+
Text { text: "Hello World!"; font.family: "Helvetica"; font.pointSize: 24; color: "red" }
Text { text: "<b>Hello</b> <i>World!</i>" }
\endqml
@@ -318,7 +320,11 @@ void QDeclarativeText::setText(const QString &n)
if (d->richText) {
if (isComponentComplete()) {
d->ensureDoc();
+#ifndef QT_NO_TEXTHTMLPARSER
d->doc->setHtml(n);
+#else
+ d->doc->setPlainText(n);
+#endif
}
}
@@ -473,6 +479,7 @@ void QDeclarativeText::setHAlign(HAlignment align)
return;
d->hAlign = align;
+ update();
emit horizontalAlignmentChanged(align);
}
@@ -489,6 +496,7 @@ void QDeclarativeText::setVAlign(VAlignment align)
return;
d->vAlign = align;
+ update();
emit verticalAlignmentChanged(align);
}
@@ -605,7 +613,11 @@ void QDeclarativeText::setTextFormat(TextFormat format)
} else if (!wasRich && d->richText) {
if (isComponentComplete()) {
d->ensureDoc();
+#ifndef QT_NO_TEXTHTMLPARSER
d->doc->setHtml(d->text);
+#else
+ d->doc->setPlainText(d->text);
+#endif
}
d->updateLayout();
d->markImgDirty();
@@ -991,7 +1003,11 @@ void QDeclarativeText::reloadWithResources()
Q_D(QDeclarativeText);
if (!d->richText)
return;
+#ifndef QT_NO_TEXTHTMLPARSER
d->doc->setHtml(d->text);
+#else
+ d->doc->setPlainText(d->text);
+#endif
d->updateLayout();
d->markImgDirty();
}
@@ -1121,7 +1137,11 @@ void QDeclarativeText::componentComplete()
if (d->dirty) {
if (d->richText) {
d->ensureDoc();
+#ifndef QT_NO_TEXTHTMLPARSER
d->doc->setHtml(d->text);
+#else
+ d->doc->setPlainText(d->text);
+#endif
}
d->updateLayout();
d->dirty = false;
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index f8876f2..48826ff 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -127,9 +127,11 @@ QString QDeclarativeTextEdit::text() const
{
Q_D(const QDeclarativeTextEdit);
+#ifndef QT_NO_TEXTHTMLPARSER
if (d->richText)
return d->document->toHtml();
else
+#endif
return d->document->toPlainText();
}
@@ -260,7 +262,11 @@ void QDeclarativeTextEdit::setText(const QString &text)
d->text = text;
d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text));
if (d->richText) {
+#ifndef QT_NO_TEXTHTMLPARSER
d->control->setHtml(text);
+#else
+ d->control->setPlainText(text);
+#endif
} else {
d->control->setPlainText(text);
}
@@ -325,7 +331,11 @@ void QDeclarativeTextEdit::setTextFormat(TextFormat format)
d->control->setPlainText(d->text);
updateSize();
} else if (!wasRich && d->richText) {
+#ifndef QT_NO_TEXTHTMLPARSER
d->control->setHtml(d->text);
+#else
+ d->control->setPlainText(d->text);
+#endif
updateSize();
}
d->format = format;
@@ -570,7 +580,7 @@ int QDeclarativeTextEdit::positionAt(int x, int y) const
}
/*!
- \qmlmethod int TextEdit::moveCursorSeletion(int pos)
+ \qmlmethod int TextEdit::moveCursorSelection(int pos)
Moves the cursor to \a position and updates the selection accordingly.
(To only move the cursor, set the \l cursorPosition property.)
@@ -717,12 +727,9 @@ void QDeclarativeTextEdit::loadCursorDelegate()
\qmlproperty int TextEdit::selectionStart
The cursor position before the first character in the current selection.
- Setting this and selectionEnd allows you to specify a selection in the
- text edit.
- Note that if selectionStart == selectionEnd then there is no current
- selection. If you attempt to set selectionStart to a value outside of
- the current text, selectionStart will not be changed.
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
\sa selectionEnd, cursorPosition, selectedText
*/
@@ -732,25 +739,13 @@ int QDeclarativeTextEdit::selectionStart() const
return d->control->textCursor().selectionStart();
}
-void QDeclarativeTextEdit::setSelectionStart(int s)
-{
- Q_D(QDeclarativeTextEdit);
- if(d->lastSelectionStart == s || s < 0 || s > text().length())
- return;
- d->lastSelectionStart = s;
- d->updateSelection();// Will emit the relevant signals
-}
-
/*!
\qmlproperty int TextEdit::selectionEnd
The cursor position after the last character in the current selection.
- Setting this and selectionStart allows you to specify a selection in the
- text edit.
- Note that if selectionStart == selectionEnd then there is no current
- selection. If you attempt to set selectionEnd to a value outside of
- the current text, selectionEnd will not be changed.
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
\sa selectionStart, cursorPosition, selectedText
*/
@@ -760,15 +755,6 @@ int QDeclarativeTextEdit::selectionEnd() const
return d->control->textCursor().selectionEnd();
}
-void QDeclarativeTextEdit::setSelectionEnd(int s)
-{
- Q_D(QDeclarativeTextEdit);
- if(d->lastSelectionEnd == s || s < 0 || s > text().length())
- return;
- d->lastSelectionEnd = s;
- d->updateSelection();// Will emit the relevant signals
-}
-
/*!
\qmlproperty string TextEdit::selectedText
@@ -1018,6 +1004,8 @@ void QDeclarativeTextEditPrivate::focusChanged(bool hasFocus)
}
/*!
+ \qmlmethod void TextEdit::selectAll()
+
Causes all text to be selected.
*/
void QDeclarativeTextEdit::selectAll()
@@ -1027,6 +1015,8 @@ void QDeclarativeTextEdit::selectAll()
}
/*!
+ \qmlmethod void TextEdit::selectWord()
+
Causes the word closest to the current cursor position to be selected.
*/
void QDeclarativeTextEdit::selectWord()
@@ -1038,6 +1028,35 @@ void QDeclarativeTextEdit::selectWord()
}
/*!
+ \qmlmethod void TextEdit::select(start,end)
+
+ Causes the text from \a start to \a end to be selected.
+
+ If either start or end is out of range, the selection is not changed.
+
+ After calling this, selectionStart will become the lesser
+ and selectionEnd will become the greater (regardless of the order passed
+ to this method).
+
+ \sa selectionStart, selectionEnd
+*/
+void QDeclarativeTextEdit::select(int start, int end)
+{
+ Q_D(QDeclarativeTextEdit);
+ if (start < 0 || end < 0 || start > d->text.length() || end > d->text.length())
+ return;
+ QTextCursor cursor = d->control->textCursor();
+ cursor.beginEditBlock();
+ cursor.setPosition(start, QTextCursor::MoveAnchor);
+ cursor.setPosition(end, QTextCursor::KeepAnchor);
+ cursor.endEditBlock();
+ d->control->setTextCursor(cursor);
+
+ // QTBUG-11100
+ updateSelectionMarkers();
+}
+
+/*!
\qmlmethod TextEdit::cut()
Moves the currently selected text to the system clipboard.
@@ -1087,9 +1106,15 @@ void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
p = p->parentItem();
}
setFocus(true);
- if (hasFocus() == hadFocus && d->showInputPanelOnFocus && !isReadOnly()) {
- // re-open input panel on press if already focused
- openSoftwareInputPanel();
+ if (d->showInputPanelOnFocus) {
+ if (hasFocus() && hadFocus && !isReadOnly()) {
+ // re-open input panel on press if already focused
+ openSoftwareInputPanel();
+ }
+ } else { // show input panel on click
+ if (hasFocus() && !hadFocus) {
+ d->clickCausedFocus = true;
+ }
}
}
if (event->type() != QEvent::GraphicsSceneMouseDoubleClick || d->selectByMouse)
@@ -1106,6 +1131,17 @@ void QDeclarativeTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextEdit);
d->control->processEvent(event, QPointF(0, -d->yoff));
+ if (!d->showInputPanelOnFocus) { // input panel on click
+ if (d->focusOnPress && !isReadOnly() && boundingRect().contains(event->pos())) {
+ if (QGraphicsView * view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {
+ if (view->scene() && view->scene() == scene()) {
+ qt_widget_private(view)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus);
+ }
+ }
+ }
+ }
+ d->clickCausedFocus = false;
+
if (!event->isAccepted())
QDeclarativePaintedItem::mouseReleaseEvent(event);
}
@@ -1182,9 +1218,14 @@ void QDeclarativeTextEdit::drawContents(QPainter *painter, const QRect &bounds)
void QDeclarativeTextEdit::updateImgCache(const QRectF &rf)
{
Q_D(const QDeclarativeTextEdit);
- QRect r = rf.toRect();
- if (r != QRect(0,0,INT_MAX,INT_MAX)) // Don't translate "everything"
- r = r.translated(0,d->yoff);
+ QRect r;
+ if (!rf.isValid()) {
+ r = QRect(0,0,INT_MAX,INT_MAX);
+ } else {
+ r = rf.toRect();
+ if (r != QRect(0,0,INT_MAX,INT_MAX)) // Don't translate "everything"
+ r = r.translated(0,d->yoff);
+ }
dirtyCache(r);
emit update();
}
@@ -1254,7 +1295,6 @@ void QDeclarativeTextEditPrivate::updateSelection()
QTextCursor cursor = control->textCursor();
bool startChange = (lastSelectionStart != cursor.selectionStart());
bool endChange = (lastSelectionEnd != cursor.selectionEnd());
- //### Is it worth calculating a more minimal set of movements?
cursor.beginEditBlock();
cursor.setPosition(lastSelectionStart, QTextCursor::MoveAnchor);
cursor.setPosition(lastSelectionEnd, QTextCursor::KeepAnchor);
@@ -1264,8 +1304,6 @@ void QDeclarativeTextEditPrivate::updateSelection()
q->selectionStartChanged();
if(endChange)
q->selectionEndChanged();
- startChange = (lastSelectionStart != control->textCursor().selectionStart());
- endChange = (lastSelectionEnd != control->textCursor().selectionEnd());
}
void QDeclarativeTextEdit::updateSelectionMarkers()
@@ -1351,10 +1389,14 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption()
customizing when you want the input keyboard to be shown and hidden in
your application.
- By default input panels are shown when TextEdit element gains focus and hidden
- when the focus is lost. You can disable the automatic behavior by setting the
- property showInputPanelOnFocus to false and use functions openSoftwareInputPanel()
- and closeSoftwareInputPanel() to implement the behavior you want.
+ By default the opening of input panels follows the platform style. On Symbian^1 and
+ Symbian^3 -based devices the panels are opened by clicking TextEdit and need to be
+ manually closed by the user. On other platforms the panels are automatically opened
+ when TextEdit element gains focus and closed when the focus is lost.
+
+ . You can disable the automatic behavior by setting the property \c focusOnPress to false
+ and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
+ the behavior you want.
Only relevant on platforms, which provide virtual keyboards.
@@ -1363,12 +1405,19 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption()
TextEdit {
id: textEdit
text: "Hello world!"
- showInputPanelOnFocus: false
+ focusOnPress: false
MouseArea {
anchors.fill: parent
- onClicked: textEdit.openSoftwareInputPanel()
+ onClicked: {
+ if (!textEdit.focus) {
+ textEdit.focus = true;
+ textEdit.openSoftwareInputPanel();
+ } else {
+ textEdit.focus = false;
+ textEdit.closeSoftwareInputPanel();
+ }
+ }
}
- onFocusChanged: if (!focus) closeSoftwareInputpanel()
}
\endcode
*/
@@ -1391,10 +1440,14 @@ void QDeclarativeTextEdit::openSoftwareInputPanel()
for customizing when you want the input keyboard to be shown and hidden in
your application.
- By default input panels are shown when TextEdit element gains focus and hidden
- when the focus is lost. You can disable the automatic behavior by setting the
- property showInputPanelOnFocus to false and use functions openSoftwareInputPanel()
- and closeSoftwareInputPanel() to implement the behavior you want.
+ By default the opening of input panels follows the platform style. On Symbian^1 and
+ Symbian^3 -based devices the panels are opened by clicking TextEdit and need to be
+ manually closed by the user. On other platforms the panels are automatically opened
+ when TextEdit element gains focus and closed when the focus is lost.
+
+ . You can disable the automatic behavior by setting the property \c focusOnPress to false
+ and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
+ the behavior you want.
Only relevant on platforms, which provide virtual keyboards.
@@ -1403,12 +1456,19 @@ void QDeclarativeTextEdit::openSoftwareInputPanel()
TextEdit {
id: textEdit
text: "Hello world!"
- showInputPanelOnFocus: false
+ focusOnPress: false
MouseArea {
anchors.fill: parent
- onClicked: textEdit.openSoftwareInputPanel()
+ onClicked: {
+ if (!textEdit.focus) {
+ textEdit.focus = true;
+ textEdit.openSoftwareInputPanel();
+ } else {
+ textEdit.focus = false;
+ textEdit.closeSoftwareInputPanel();
+ }
+ }
}
- onFocusChanged: if (!focus) closeSoftwareInputpanel()
}
\endcode
*/
@@ -1424,35 +1484,13 @@ void QDeclarativeTextEdit::closeSoftwareInputPanel()
}
}
-/*!
- \qmlproperty bool TextEdit::showInputPanelOnFocus
- Whether input panels are automatically shown when TextEdit element gains
- focus and hidden when focus is lost. By default this is set to true.
-
- Only relevant on platforms, which provide virtual keyboards.
-*/
-bool QDeclarativeTextEdit::showInputPanelOnFocus() const
-{
- Q_D(const QDeclarativeTextEdit);
- return d->showInputPanelOnFocus;
-}
-
-void QDeclarativeTextEdit::setShowInputPanelOnFocus(bool showOnFocus)
-{
- Q_D(QDeclarativeTextEdit);
- if (d->showInputPanelOnFocus == showOnFocus)
- return;
-
- d->showInputPanelOnFocus = showOnFocus;
-
- emit showInputPanelOnFocusChanged(d->showInputPanelOnFocus);
-}
-
void QDeclarativeTextEdit::focusInEvent(QFocusEvent *event)
{
Q_D(const QDeclarativeTextEdit);
- if (d->showInputPanelOnFocus && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) {
- openSoftwareInputPanel();
+ if (d->showInputPanelOnFocus) {
+ if (d->focusOnPress && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) {
+ openSoftwareInputPanel();
+ }
}
QDeclarativePaintedItem::focusInEvent(event);
}
@@ -1460,8 +1498,10 @@ void QDeclarativeTextEdit::focusInEvent(QFocusEvent *event)
void QDeclarativeTextEdit::focusOutEvent(QFocusEvent *event)
{
Q_D(const QDeclarativeTextEdit);
- if (d->showInputPanelOnFocus && !isReadOnly()) {
- closeSoftwareInputPanel();
+ if (d->showInputPanelOnFocus) {
+ if (d->focusOnPress && !isReadOnly()) {
+ closeSoftwareInputPanel();
+ }
}
QDeclarativePaintedItem::focusOutEvent(event);
}
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
index a83b3db..3846d49 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
@@ -82,11 +82,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem
Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
Q_PROPERTY(QDeclarativeComponent* cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged)
- Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
- Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
+ Q_PROPERTY(int selectionStart READ selectionStart NOTIFY selectionStartChanged)
+ Q_PROPERTY(int selectionEnd READ selectionEnd NOTIFY selectionEndChanged)
Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectionChanged)
Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY focusOnPressChanged)
- Q_PROPERTY(bool showInputPanelOnFocus READ showInputPanelOnFocus WRITE setShowInputPanelOnFocus NOTIFY showInputPanelOnFocusChanged)
Q_PROPERTY(bool persistentSelection READ persistentSelection WRITE setPersistentSelection NOTIFY persistentSelectionChanged)
Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin NOTIFY textMarginChanged)
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
@@ -160,19 +159,13 @@ public:
void setCursorDelegate(QDeclarativeComponent*);
int selectionStart() const;
- void setSelectionStart(int);
-
int selectionEnd() const;
- void setSelectionEnd(int);
QString selectedText() const;
bool focusOnPress() const;
void setFocusOnPress(bool on);
- bool showInputPanelOnFocus() const;
- void setShowInputPanelOnFocus(bool showOnFocus);
-
bool persistentSelection() const;
void setPersistentSelection(bool on);
@@ -225,11 +218,11 @@ Q_SIGNALS:
void persistentSelectionChanged(bool isPersistentSelection);
void textMarginChanged(qreal textMargin);
void selectByMouseChanged(bool selectByMouse);
- void showInputPanelOnFocusChanged(bool showOnFocus);
public Q_SLOTS:
void selectAll();
void selectWord();
+ void select(int start, int end);
void cut();
void copy();
void paste();
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
index 8e1d630..4092e65 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
@@ -70,12 +70,17 @@ public:
QDeclarativeTextEditPrivate()
: color("black"), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop),
imgDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true),
- showInputPanelOnFocus(true), persistentSelection(true), textMargin(0.0), lastSelectionStart(0),
- lastSelectionEnd(0), cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText),
- document(0), wrapMode(QDeclarativeTextEdit::NoWrap),
+ showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true), textMargin(0.0),
+ lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0),
+ format(QDeclarativeTextEdit::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap),
selectByMouse(false),
yoff(0)
{
+#ifdef Q_OS_SYMBIAN
+ if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) {
+ showInputPanelOnFocus = false;
+ }
+#endif
}
void init();
@@ -102,6 +107,7 @@ public:
bool cursorVisible : 1;
bool focusOnPress : 1;
bool showInputPanelOnFocus : 1;
+ bool clickCausedFocus : 1;
bool persistentSelection : 1;
qreal textMargin;
int lastSelectionStart;
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 9a6a070..1202101 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -46,6 +46,7 @@
#include <qdeclarativeinfo.h>
#include <QValidator>
+#include <QTextCursor>
#include <QApplication>
#include <QFontMetrics>
#include <QPainter>
@@ -429,10 +430,12 @@ void QDeclarativeTextInput::setCursorPosition(int cp)
Returns a Rect which encompasses the cursor, but which may be larger than is
required. Ignores custom cursor delegates.
*/
-QRect QDeclarativeTextInput::cursorRect() const
+QRect QDeclarativeTextInput::cursorRectangle() const
{
Q_D(const QDeclarativeTextInput);
- return d->control->cursorRect();
+ QRect r = d->control->cursorRect();
+ r.setHeight(r.height()-1); // Make consistent with TextEdit (QLineControl inexplicably adds 1)
+ return r;
}
/*!
@@ -454,15 +457,6 @@ int QDeclarativeTextInput::selectionStart() const
return d->lastSelectionStart;
}
-void QDeclarativeTextInput::setSelectionStart(int s)
-{
- Q_D(QDeclarativeTextInput);
- if(d->lastSelectionStart == s || s < 0 || s > text().length())
- return;
- d->lastSelectionStart = s;
- d->control->setSelection(s, d->lastSelectionEnd - s);
-}
-
/*!
\qmlproperty int TextInput::selectionEnd
@@ -482,13 +476,12 @@ int QDeclarativeTextInput::selectionEnd() const
return d->lastSelectionEnd;
}
-void QDeclarativeTextInput::setSelectionEnd(int s)
+void QDeclarativeTextInput::select(int start, int end)
{
Q_D(QDeclarativeTextInput);
- if(d->lastSelectionEnd == s || s < 0 || s > text().length())
+ if (start < 0 || end < 0 || start > d->control->text().length() || end > d->control->text().length())
return;
- d->lastSelectionEnd = s;
- d->control->setSelection(d->lastSelectionStart, s - d->lastSelectionStart);
+ d->control->setSelection(start, end-start);
}
/*!
@@ -648,6 +641,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b)
\sa acceptableInput, inputMask
*/
+#ifndef QT_NO_VALIDATOR
QValidator* QDeclarativeTextInput::validator() const
{
Q_D(const QDeclarativeTextInput);
@@ -669,6 +663,7 @@ void QDeclarativeTextInput::setValidator(QValidator* v)
emit validatorChanged();
}
+#endif // QT_NO_VALIDATOR
/*!
\qmlproperty string TextInput::inputMask
@@ -833,6 +828,19 @@ void QDeclarativeTextInput::moveCursor()
}
/*!
+ \qmlmethod rect TextInput::positionToRectangle(int x)
+*/
+QRectF QDeclarativeTextInput::positionToRectangle(int x) const
+{
+ Q_D(const QDeclarativeTextInput);
+ QFontMetrics fm = QFontMetrics(d->font);
+ return QRectF(d->control->cursorToX(x)-d->hscroll,
+ 0.0,
+ d->control->cursorWidth(),
+ cursorRectangle().height());
+}
+
+/*!
\qmlmethod int TextInput::positionAt(int x)
This function returns the character position at
@@ -843,10 +851,10 @@ void QDeclarativeTextInput::moveCursor()
This means that for all x values before the first character this function returns 0,
and for all x values after the last character this function returns text.length.
*/
-int QDeclarativeTextInput::positionAt(int x)
+int QDeclarativeTextInput::positionAt(int x) const
{
Q_D(const QDeclarativeTextInput);
- return d->control->xToPos(x - d->hscroll);
+ return d->control->xToPos(x + d->hscroll);
}
void QDeclarativeTextInputPrivate::focusChanged(bool hasFocus)
@@ -883,6 +891,22 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev)
QDeclarativePaintedItem::keyPressEvent(ev);
}
+/*!
+\overload
+Handles the given mouse \a event.
+*/
+void QDeclarativeTextInput::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_D(QDeclarativeTextInput);
+ if (d->selectByMouse) {
+ int cursor = d->xToPos(event->pos().x());
+ d->control->selectWordAtPos(cursor);
+ event->setAccepted(true);
+ } else {
+ QDeclarativePaintedItem::mouseDoubleClickEvent(event);
+ }
+}
+
void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextInput);
@@ -895,12 +919,17 @@ void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
p = p->parentItem();
}
setFocus(true);
- if (hasFocus() == hadFocus && d->showInputPanelOnFocus && !isReadOnly()) {
- // re-open input panel on press w already focused
- openSoftwareInputPanel();
+ if (d->showInputPanelOnFocus) {
+ if (hasFocus() && hadFocus && !isReadOnly()) {
+ // re-open input panel on press if already focused
+ openSoftwareInputPanel();
+ }
+ } else { // show input panel on click
+ if (hasFocus() && !hadFocus) {
+ d->clickCausedFocus = true;
+ }
}
}
-
bool mark = event->modifiers() & Qt::ShiftModifier;
int cursor = d->xToPos(event->pos().x());
d->control->moveCursor(cursor, mark);
@@ -925,6 +954,16 @@ Handles the given mouse \a event.
void QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextInput);
+ if (!d->showInputPanelOnFocus) { // input panel on click
+ if (d->focusOnPress && !isReadOnly() && boundingRect().contains(event->pos())) {
+ if (QGraphicsView * view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {
+ if (view->scene() && view->scene() == scene()) {
+ qt_widget_private(view)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus);
+ }
+ }
+ }
+ }
+ d->clickCausedFocus = false;
d->control->processEvent(event);
if (!event->isAccepted())
QDeclarativePaintedItem::mouseReleaseEvent(event);
@@ -941,10 +980,9 @@ bool QDeclarativeTextInput::event(QEvent* ev)
case QEvent::GraphicsSceneMousePress:
case QEvent::GraphicsSceneMouseMove:
case QEvent::GraphicsSceneMouseRelease:
+ case QEvent::GraphicsSceneMouseDoubleClick:
break;
default:
- if (ev->type() == QEvent::GraphicsSceneMouseDoubleClick && !d->selectByMouse)
- break;
handled = d->control->processEvent(ev);
if (ev->type() == QEvent::InputMethod)
updateSize();
@@ -1019,7 +1057,6 @@ void QDeclarativeTextInput::drawContents(QPainter *p, const QRect &r)
d->hscroll -= minLB;
offset = QPoint(d->hscroll, 0);
}
-
d->control->draw(p, offset, r, flags);
p->restore();
@@ -1057,12 +1094,27 @@ QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property)
}
}
+/*!
+ \qmlmethod void TextInput::selectAll()
+
+ Causes all text to be selected.
+*/
void QDeclarativeTextInput::selectAll()
{
Q_D(QDeclarativeTextInput);
d->control->setSelection(0, d->control->text().length());
}
+/*!
+ \qmlmethod void TextInput::selectWord()
+
+ Causes the word closest to the current cursor position to be selected.
+*/
+void QDeclarativeTextInput::selectWord()
+{
+ Q_D(QDeclarativeTextInput);
+ d->control->selectWordAtPos(d->control->cursor());
+}
/*!
\qmlproperty bool TextInput::smooth
@@ -1181,26 +1233,37 @@ void QDeclarativeTextInput::moveCursorSelection(int position)
customizing when you want the input keyboard to be shown and hidden in
your application.
- By default input panels are shown when TextInput element gains focus and hidden
- when the focus is lost. You can disable the automatic behavior by setting the
- property showInputPanelOnFocus to false and use functions openSoftwareInputPanel()
- and closeSoftwareInputPanel() to implement the behavior you want.
+ By default the opening of input panels follows the platform style. On Symbian^1 and
+ Symbian^3 -based devices the panels are opened by clicking TextInput and need to be
+ manually closed by the user. On other platforms the panels are automatically opened
+ when TextInput element gains focus and closed when the focus is lost.
+
+ . You can disable the automatic behavior by setting the property \c focusOnPress to false
+ and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
+ the behavior you want.
Only relevant on platforms, which provide virtual keyboards.
- \code
+ \qml
import Qt 4.7
TextInput {
id: textInput
text: "Hello world!"
- showInputPanelOnFocus: false
+ focusOnPress: false
MouseArea {
anchors.fill: parent
- onClicked: textInput.openSoftwareInputPanel()
+ onClicked: {
+ if (!textInput.focus) {
+ textInput.focus = true;
+ textInput.openSoftwareInputPanel();
+ } else {
+ textInput.focus = false;
+ textInput.closeSoftwareInputPanel();
+ }
+ }
}
- onFocusChanged: if (!focus) closeSoftwareInputPanel()
}
- \endcode
+ \endqml
*/
void QDeclarativeTextInput::openSoftwareInputPanel()
{
@@ -1221,26 +1284,37 @@ void QDeclarativeTextInput::openSoftwareInputPanel()
for customizing when you want the input keyboard to be shown and hidden in
your application.
- By default input panels are shown when TextInput element gains focus and hidden
- when the focus is lost. You can disable the automatic behavior by setting the
- property showInputPanelOnFocus to false and use functions openSoftwareInputPanel()
- and closeSoftwareInputPanel() to implement the behavior you want.
+ By default the opening of input panels follows the platform style. On Symbian^1 and
+ Symbian^3 -based devices the panels are opened by clicking TextInput and need to be
+ manually closed by the user. On other platforms the panels are automatically opened
+ when TextInput element gains focus and closed when the focus is lost.
+
+ . You can disable the automatic behavior by setting the property \c focusOnPress to false
+ and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
+ the behavior you want.
Only relevant on platforms, which provide virtual keyboards.
- \code
+ \qml
import Qt 4.7
TextInput {
id: textInput
text: "Hello world!"
- showInputPanelOnFocus: false
+ focusOnPress: false
MouseArea {
anchors.fill: parent
- onClicked: textInput.openSoftwareInputPanel()
+ onClicked: {
+ if (!textInput.focus) {
+ textInput.focus = true;
+ textInput.openSoftwareInputPanel();
+ } else {
+ textInput.focus = false;
+ textInput.closeSoftwareInputPanel();
+ }
+ }
}
- onFocusChanged: if (!focus) closeSoftwareInputPanel()
}
- \endcode
+ \endqml
*/
void QDeclarativeTextInput::closeSoftwareInputPanel()
{
@@ -1255,35 +1329,13 @@ void QDeclarativeTextInput::closeSoftwareInputPanel()
}
}
-/*!
- \qmlproperty bool TextInput::showInputPanelOnFocus
- Whether input panels are automatically shown when TextInput element gains
- focus and hidden when focus is lost. By default this is set to true.
-
- Only relevant on platforms, which provide virtual keyboards.
-*/
-bool QDeclarativeTextInput::showInputPanelOnFocus() const
-{
- Q_D(const QDeclarativeTextInput);
- return d->showInputPanelOnFocus;
-}
-
-void QDeclarativeTextInput::setShowInputPanelOnFocus(bool showOnFocus)
-{
- Q_D(QDeclarativeTextInput);
- if (d->showInputPanelOnFocus == showOnFocus)
- return;
-
- d->showInputPanelOnFocus = showOnFocus;
-
- emit showInputPanelOnFocusChanged(d->showInputPanelOnFocus);
-}
-
void QDeclarativeTextInput::focusInEvent(QFocusEvent *event)
{
Q_D(const QDeclarativeTextInput);
- if (d->showInputPanelOnFocus && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) {
- openSoftwareInputPanel();
+ if (d->showInputPanelOnFocus) {
+ if (d->focusOnPress && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) {
+ openSoftwareInputPanel();
+ }
}
QDeclarativePaintedItem::focusInEvent(event);
}
@@ -1291,8 +1343,10 @@ void QDeclarativeTextInput::focusInEvent(QFocusEvent *event)
void QDeclarativeTextInput::focusOutEvent(QFocusEvent *event)
{
Q_D(const QDeclarativeTextInput);
- if (d->showInputPanelOnFocus && !isReadOnly()) {
- closeSoftwareInputPanel();
+ if (d->showInputPanelOnFocus) {
+ if (d->focusOnPress && !isReadOnly()) {
+ closeSoftwareInputPanel();
+ }
}
QDeclarativePaintedItem::focusOutEvent(event);
}
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
index 6bb94c2..e34634a 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
@@ -72,21 +72,22 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextInput : public QDeclarativePaintedIte
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged)
Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged)
Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
- Q_PROPERTY(QRect cursorRect READ cursorRect NOTIFY cursorPositionChanged)
+ Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorPositionChanged)
Q_PROPERTY(QDeclarativeComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged)
- Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
- Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
+ Q_PROPERTY(int selectionStart READ selectionStart NOTIFY selectionStartChanged)
+ Q_PROPERTY(int selectionEnd READ selectionEnd NOTIFY selectionEndChanged)
Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged)
Q_PROPERTY(int maximumLength READ maxLength WRITE setMaxLength NOTIFY maximumLengthChanged)
+#ifndef QT_NO_VALIDATOR
Q_PROPERTY(QValidator* validator READ validator WRITE setValidator NOTIFY validatorChanged)
+#endif
Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask NOTIFY inputMaskChanged)
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged)
Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged)
Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY focusOnPressChanged)
- Q_PROPERTY(bool showInputPanelOnFocus READ showInputPanelOnFocus WRITE setShowInputPanelOnFocus NOTIFY showInputPanelOnFocusChanged)
Q_PROPERTY(QString passwordCharacter READ passwordCharacter WRITE setPasswordCharacter NOTIFY passwordCharacterChanged)
Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged)
Q_PROPERTY(bool autoScroll READ autoScroll WRITE setAutoScroll NOTIFY autoScrollChanged)
@@ -110,7 +111,8 @@ public:
};
//Auxilliary functions needed to control the TextInput from QML
- Q_INVOKABLE int positionAt(int x);
+ Q_INVOKABLE int positionAt(int x) const;
+ Q_INVOKABLE QRectF positionToRectangle(int x) const;
Q_INVOKABLE void moveCursorSelection(int pos);
Q_INVOKABLE void openSoftwareInputPanel();
@@ -143,22 +145,20 @@ public:
int cursorPosition() const;
void setCursorPosition(int cp);
- QRect cursorRect() const;
+ QRect cursorRectangle() const;
int selectionStart() const;
- void setSelectionStart(int);
-
int selectionEnd() const;
- void setSelectionEnd(int);
QString selectedText() const;
int maxLength() const;
void setMaxLength(int ml);
+#ifndef QT_NO_VALIDATOR
QValidator * validator() const;
void setValidator(QValidator* v);
-
+#endif
QString inputMask() const;
void setInputMask(const QString &im);
@@ -176,9 +176,6 @@ public:
bool focusOnPress() const;
void setFocusOnPress(bool);
- bool showInputPanelOnFocus() const;
- void setShowInputPanelOnFocus(bool showOnFocus);
-
bool autoScroll() const;
void setAutoScroll(bool);
@@ -215,7 +212,6 @@ Q_SIGNALS:
void focusOnPressChanged(bool focusOnPress);
void autoScrollChanged(bool autoScroll);
void selectByMouseChanged(bool selectByMouse);
- void showInputPanelOnFocusChanged(bool showOnFocus);
protected:
virtual void geometryChanged(const QRectF &newGeometry,
@@ -224,6 +220,7 @@ protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
void keyPressEvent(QKeyEvent* ev);
bool event(QEvent *e);
void focusInEvent(QFocusEvent *event);
@@ -231,6 +228,8 @@ protected:
public Q_SLOTS:
void selectAll();
+ void selectWord();
+ void select(int start, int end);
private Q_SLOTS:
void updateSize(bool needsRedraw = true);
@@ -248,10 +247,12 @@ private:
QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeTextInput)
+#ifndef QT_NO_VALIDATOR
QML_DECLARE_TYPE(QValidator)
QML_DECLARE_TYPE(QIntValidator)
QML_DECLARE_TYPE(QDoubleValidator)
QML_DECLARE_TYPE(QRegExpValidator)
+#endif
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
index f44d014..6865147 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
@@ -72,9 +72,15 @@ public:
color((QRgb)0), style(QDeclarativeText::Normal),
styleColor((QRgb)0), hAlign(QDeclarativeTextInput::AlignLeft),
hscroll(0), oldScroll(0), focused(false), focusOnPress(true),
- showInputPanelOnFocus(true), cursorVisible(false), autoScroll(true),
- selectByMouse(false)
+ showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false),
+ autoScroll(true), selectByMouse(false)
{
+#ifdef Q_OS_SYMBIAN
+ if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) {
+ showInputPanelOnFocus = false;
+ }
+#endif
+
}
~QDeclarativeTextInputPrivate()
@@ -116,6 +122,7 @@ public:
bool focused;
bool focusOnPress;
bool showInputPanelOnFocus;
+ bool clickCausedFocus;
bool cursorVisible;
bool autoScroll;
bool selectByMouse;
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index c6ee46f..2a88a80 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -119,11 +119,11 @@ public:
visual delegate (items).
An item can determine its index within the
- model via the VisualItemModel.index attached property.
+ model via the \c VisualItemModel.index attached property.
The example below places three colored rectangles in a ListView.
\code
- Item {
+ Rectangle {
VisualItemModel {
id: itemModel
Rectangle { height: 30; width: 80; color: "red" }
@@ -137,6 +137,8 @@ public:
}
}
\endcode
+
+ \image visualitemmodel.png
*/
QDeclarativeVisualItemModel::QDeclarativeVisualItemModel(QObject *parent)
: QDeclarativeVisualModel(*(new QDeclarativeVisualItemModelPrivate), parent)
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index d27aced..80a1093 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -240,6 +240,7 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop,
if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: color expected"));
}
break;
+#ifndef QT_NO_TEXTDATE
case QVariant::Date:
{
bool ok;
@@ -261,6 +262,7 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop,
if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: datetime expected"));
}
break;
+#endif // QT_NO_TEXTDATE
case QVariant::Point:
case QVariant::PointF:
{
@@ -414,6 +416,7 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
instr.storeColor.value = c.rgba();
}
break;
+#ifndef QT_NO_TEXTDATE
case QVariant::Date:
{
QDate d = QDeclarativeStringConverters::dateFromString(string);
@@ -447,6 +450,7 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
instr.storeDateTime.valueIndex = index;
}
break;
+#endif // QT_NO_TEXTDATE
case QVariant::Point:
case QVariant::PointF:
{
diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h
index 6b6cd0a..1f5aaf1 100644
--- a/src/declarative/qml/qdeclarativecontext_p.h
+++ b/src/declarative/qml/qdeclarativecontext_p.h
@@ -108,7 +108,7 @@ public:
class QDeclarativeComponentAttached;
class QDeclarativeGuardedContextData;
-class QDeclarativeContextData
+class Q_AUTOTEST_EXPORT QDeclarativeContextData
{
public:
QDeclarativeContextData();
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 8679e76..39b0802 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -155,14 +155,26 @@ void QDeclarativeEnginePrivate::defineModule()
\qmlclass Qt QDeclarativeEnginePrivate
\brief The QML global Qt object provides useful enums and functions from Qt.
-The Qt object provides useful enums and functions from Qt, for use in all QML files.
+The \c Qt object provides useful enums and functions from Qt, for use in all QML files.
+
+The \c Qt object is not a QML element; it cannot be instantiated. It is a global object
+with enums and functions. To use it, call the members of the global \c Qt object directly.
+For example:
+
+\qml
+import Qt 4.7
+
+Text {
+ color: Qt.rgba(255, 0, 0, 1)
+ text: Qt.md5("hello, world")
+}
+\endqml
-You do not create instances of this type, but instead use the members of the global "Qt" object.
\section1 Enums
The Qt object contains all enums in the Qt namespace. For example, you can
-access the AlignLeft member of the Qt::AlignmentFlag enum with \c Qt.AlignLeft.
+access the \c AlignLeft member of the \c Qt::AlignmentFlag enum with \c Qt.AlignLeft.
For a full list of enums, see the \l{Qt Namespace} documentation.
@@ -172,7 +184,7 @@ data types. This is primarily useful when setting the properties of an item
when the property has one of the following types:
\list
-\o \c color - use \l{Qt::rgba()}{Qt.rgba()}, \l{Qt::darker()}{Qt.darker()}, \l{Qt::lighter()}{Qt.lighter()} or \l{Qt::tint()}{Qt.tint()}
+\o \c color - use \l{Qt::rgba()}{Qt.rgba()}, \l{Qt::hsla()}{Qt.hsla()}, \l{Qt::darker()}{Qt.darker()}, \l{Qt::lighter()}{Qt.lighter()} or \l{Qt::tint()}{Qt.tint()}
\o \c rect - use \l{Qt::rect()}{Qt.rect()}
\o \c point - use \l{Qt::point()}{Qt.point()}
\o \c size - use \l{Qt::size()}{Qt.size()}
@@ -200,8 +212,8 @@ items from files or strings. See \l{Dynamic Object Management} for an overview
of their use.
\list
- \o \l{Qt::createComponent}{object Qt.createComponent(url)}
- \o \l{Qt::createQmlObject}{object Qt.createQmlObject(string qml, object parent, string filepath)}
+ \o \l{Qt::createComponent()}{object Qt.createComponent(url)}
+ \o \l{Qt::createQmlObject()}{object Qt.createQmlObject(string qml, object parent, string filepath)}
\endlist
*/
@@ -284,10 +296,12 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr
qtObject.setProperty(QLatin1String("tint"), newFunction(QDeclarativeEnginePrivate::tint, 2));
}
+#ifndef QT_NO_TEXTDATE
//date/time formatting
qtObject.setProperty(QLatin1String("formatDate"),newFunction(QDeclarativeEnginePrivate::formatDate, 2));
qtObject.setProperty(QLatin1String("formatTime"),newFunction(QDeclarativeEnginePrivate::formatTime, 2));
qtObject.setProperty(QLatin1String("formatDateTime"),newFunction(QDeclarativeEnginePrivate::formatDateTime, 2));
+#endif
//misc methods
qtObject.setProperty(QLatin1String("openUrlExternally"),newFunction(QDeclarativeEnginePrivate::desktopOpenUrl, 1));
@@ -1034,7 +1048,7 @@ QString QDeclarativeEnginePrivate::urlToLocalFileOrQrc(const QUrl& url)
/*!
\qmlmethod object Qt::createComponent(url)
-Returns a \l Component object created from the QML file at the specified \a url,
+Returns a \l Component object created using the QML file at the specified \a url,
or \c null if there was an error in creating the component.
Call \l {Component::createObject()}{Component.createObject()} on the returned
@@ -1219,6 +1233,7 @@ QScriptValue QDeclarativeEnginePrivate::vector3d(QScriptContext *ctxt, QScriptEn
\qmlmethod string Qt::formatDate(datetime date, variant format)
Returns the string representation of \c date, formatted according to \c format.
*/
+#ifndef QT_NO_TEXTDATE
QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptEngine*engine)
{
int argCount = ctxt->argumentCount();
@@ -1356,11 +1371,12 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
}
+#endif // QT_NO_TEXTDATE
/*!
\qmlmethod color Qt::rgba(real red, real green, real blue, real alpha)
-Returns a Color with the specified \c red, \c green, \c blue and \c alpha components.
+Returns a color with the specified \c red, \c green, \c blue and \c alpha components.
All components should be in the range 0-1 inclusive.
*/
QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine *engine)
@@ -1388,7 +1404,7 @@ QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine
/*!
\qmlmethod color Qt::hsla(real hue, real saturation, real lightness, real alpha)
-Returns a Color with the specified \c hue, \c saturation, \c lightness and \c alpha components.
+Returns a color with the specified \c hue, \c saturation, \c lightness and \c alpha components.
All components should be in the range 0-1 inclusive.
*/
QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine *engine)
@@ -1416,7 +1432,9 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
/*!
\qmlmethod rect Qt::rect(int x, int y, int width, int height)
-Returns a Rect with the top-left corner at \c x, \c y and the specified \c width and \c height.
+Returns a \c rect with the top-left corner at \c x, \c y and the specified \c width and \c height.
+
+The returned object has \c x, \c y, \c width and \c height attributes with the given values.
*/
QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine)
{
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index 804476c..3269e98 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -302,10 +302,11 @@ public:
static QScriptValue consoleLog(QScriptContext*, QScriptEngine*);
static QScriptValue quit(QScriptContext*, QScriptEngine*);
+#ifndef QT_NO_TEXTDATE
static QScriptValue formatDate(QScriptContext*, QScriptEngine*);
static QScriptValue formatTime(QScriptContext*, QScriptEngine*);
static QScriptValue formatDateTime(QScriptContext*, QScriptEngine*);
-
+#endif
static QScriptEngine *getScriptEngine(QDeclarativeEngine *e) { return &e->d_func()->scriptEngine; }
static QDeclarativeEngine *getEngine(QScriptEngine *e) { return static_cast<QDeclarativeScriptEngine*>(e)->p->q_func(); }
static QDeclarativeEnginePrivate *get(QDeclarativeEngine *e) { return e->d_func(); }
diff --git a/src/declarative/qml/qdeclarativeinfo.h b/src/declarative/qml/qdeclarativeinfo.h
index 2ac28f4..b41abd8 100644
--- a/src/declarative/qml/qdeclarativeinfo.h
+++ b/src/declarative/qml/qdeclarativeinfo.h
@@ -81,7 +81,9 @@ public:
inline QDeclarativeInfo &operator<<(const void * t) { QDebug::operator<<(t); return *this; }
inline QDeclarativeInfo &operator<<(QTextStreamFunction f) { QDebug::operator<<(f); return *this; }
inline QDeclarativeInfo &operator<<(QTextStreamManipulator m) { QDebug::operator<<(m); return *this; }
+#ifndef QT_NO_DEBUG_STREAM
inline QDeclarativeInfo &operator<<(const QUrl &t) { static_cast<QDebug &>(*this) << t; return *this; }
+#endif
private:
friend Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me);
diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp
index b86d082..0f7b09d 100644
--- a/src/declarative/qml/qdeclarativeinstruction.cpp
+++ b/src/declarative/qml/qdeclarativeinstruction.cpp
@@ -49,6 +49,10 @@ QT_BEGIN_NAMESPACE
void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
{
+#ifdef QT_NO_DEBUG_STREAM
+ Q_UNUSED(instr)
+ Q_UNUSED(idx)
+#else
QByteArray lineNumber = QByteArray::number(instr->line);
if (instr->line == (unsigned short)-1)
lineNumber = "NA";
@@ -217,6 +221,7 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
qWarning().nospace() << idx << "\t\t" << line << "\t" << "XXX UNKOWN INSTRUCTION" << "\t" << instr->type;
break;
}
+#endif // QT_NO_DEBUG_STREAM
}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h
index b01e5cc..72cfeba 100644
--- a/src/declarative/qml/qdeclarativepropertycache_p.h
+++ b/src/declarative/qml/qdeclarativepropertycache_p.h
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
class QDeclarativeEngine;
class QMetaProperty;
-class QDeclarativePropertyCache : public QDeclarativeRefCount, public QDeclarativeCleanup
+class Q_AUTOTEST_EXPORT QDeclarativePropertyCache : public QDeclarativeRefCount, public QDeclarativeCleanup
{
public:
QDeclarativePropertyCache(QDeclarativeEngine *);
diff --git a/src/declarative/qml/qdeclarativestringconverters.cpp b/src/declarative/qml/qdeclarativestringconverters.cpp
index bbcc00b..8bd2cf1 100644
--- a/src/declarative/qml/qdeclarativestringconverters.cpp
+++ b/src/declarative/qml/qdeclarativestringconverters.cpp
@@ -106,12 +106,14 @@ QVariant QDeclarativeStringConverters::variantFromString(const QString &s, int p
return QVariant(uint(qRound(s.toDouble(ok))));
case QMetaType::QColor:
return QVariant::fromValue(colorFromString(s, ok));
+#ifndef QT_NO_TEXTDATE
case QMetaType::QDate:
return QVariant::fromValue(dateFromString(s, ok));
case QMetaType::QTime:
return QVariant::fromValue(timeFromString(s, ok));
case QMetaType::QDateTime:
return QVariant::fromValue(dateTimeFromString(s, ok));
+#endif // QT_NO_TEXTDATE
case QMetaType::QPointF:
return QVariant::fromValue(pointFFromString(s, ok));
case QMetaType::QPoint:
@@ -150,6 +152,7 @@ QColor QDeclarativeStringConverters::colorFromString(const QString &s, bool *ok)
}
}
+#ifndef QT_NO_TEXTDATE
QDate QDeclarativeStringConverters::dateFromString(const QString &s, bool *ok)
{
QDate d = QDate::fromString(s, Qt::ISODate);
@@ -170,6 +173,7 @@ QDateTime QDeclarativeStringConverters::dateTimeFromString(const QString &s, boo
if (ok) *ok = d.isValid();
return d;
}
+#endif // QT_NO_TEXTDATE
//expects input of "x,y"
QPointF QDeclarativeStringConverters::pointFFromString(const QString &s, bool *ok)
diff --git a/src/declarative/qml/qdeclarativestringconverters_p.h b/src/declarative/qml/qdeclarativestringconverters_p.h
index 97f72fc..842d1b3 100644
--- a/src/declarative/qml/qdeclarativestringconverters_p.h
+++ b/src/declarative/qml/qdeclarativestringconverters_p.h
@@ -73,9 +73,11 @@ namespace QDeclarativeStringConverters
QVariant Q_DECLARATIVE_EXPORT variantFromString(const QString &, int preferredType, bool *ok = 0);
QColor Q_DECLARATIVE_EXPORT colorFromString(const QString &, bool *ok = 0);
+#ifndef QT_NO_TEXTDATE
QDate Q_DECLARATIVE_EXPORT dateFromString(const QString &, bool *ok = 0);
QTime Q_DECLARATIVE_EXPORT timeFromString(const QString &, bool *ok = 0);
QDateTime Q_DECLARATIVE_EXPORT dateTimeFromString(const QString &, bool *ok = 0);
+#endif
QPointF Q_DECLARATIVE_EXPORT pointFFromString(const QString &, bool *ok = 0);
QSizeF Q_DECLARATIVE_EXPORT sizeFFromString(const QString &, bool *ok = 0);
QRectF Q_DECLARATIVE_EXPORT rectFFromString(const QString &, bool *ok = 0);
diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index 2ca030e..e0ee84f 100644
--- a/src/declarative/qml/qdeclarativeworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -521,7 +521,7 @@ void QDeclarativeWorkerScriptEngine::run()
that the main GUI thread is not blocked.
Messages can be passed between the new thread and the parent thread
- using sendMessage() and the onMessage() handler.
+ using \l sendMessage() and the \l {WorkerScript::onMessage}{onMessage()} handler.
Here is an example:
@@ -555,7 +555,7 @@ QDeclarativeWorkerScript::~QDeclarativeWorkerScript()
/*!
\qmlproperty url WorkerScript::source
- This holds the url of the javascript file that implements the
+ This holds the url of the JavaScript file that implements the
\tt WorkerScript.onMessage() handler for threaded operations.
*/
QUrl QDeclarativeWorkerScript::source() const
@@ -576,7 +576,7 @@ void QDeclarativeWorkerScript::setSource(const QUrl &source)
emit sourceChanged();
}
-/*
+/*!
\qmlmethod WorkerScript::sendMessage(jsobject message)
Sends the given \a message to a worker script handler in another
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index de1c0cb..0eae136 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -557,6 +557,8 @@ void QDeclarativeAbstractAnimation::timelineComplete()
NumberAnimation { ... duration: 200 }
}
\endcode
+
+ \sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
/*!
\internal
@@ -627,6 +629,8 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation()
When used in a transition, ColorAnimation will by default animate
all properties of type color that are changing. If a property or properties
are explicitly set for the animation, then those will be used instead.
+
+ \sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
/*!
\internal
@@ -1082,11 +1086,13 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions,
\inherits PropertyAnimation
\brief The NumberAnimation element allows you to animate changes in properties of type qreal.
- Animate a set of properties over 200ms, from their values in the start state to
+ For example, to animate a set of properties over 200ms, from their values in the start state to
their values in the end state of the transition:
\code
NumberAnimation { properties: "x,y,scale"; duration: 200 }
\endcode
+
+ \sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
/*!
@@ -1156,6 +1162,8 @@ void QDeclarativeNumberAnimation::setTo(qreal t)
\since 4.7
\inherits PropertyAnimation
\brief The Vector3dAnimation element allows you to animate changes in properties of type QVector3d.
+
+ \sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
/*!
@@ -1224,7 +1232,8 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
When used in a transition RotationAnimation will rotate all
properties named "rotation" or "angle". You can override this by providing
- your own properties via \c properties or \c property.
+ your own properties via \l {PropertyAnimation::properties}{properties} or
+ \l {PropertyAnimation::property}{property}.
In the following example we use RotationAnimation to animate the rotation
between states via the shortest path.
@@ -1238,6 +1247,8 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
RotationAnimation { direction: RotationAnimation.Shortest }
}
\endqml
+
+ \sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
/*!
@@ -1446,7 +1457,7 @@ QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeAnimationGro
}
\endcode
- \sa ParallelAnimation
+ \sa ParallelAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
QDeclarativeSequentialAnimation::QDeclarativeSequentialAnimation(QObject *parent) :
@@ -1508,7 +1519,7 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio
}
\endcode
- \sa SequentialAnimation
+ \sa SequentialAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
/*!
\internal
@@ -1657,6 +1668,8 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int
Depending on how the animation is used, the set of properties normally used will be
different. For more information see the individual property documentation, as well
as the \l{QML Animation} introduction.
+
+ \sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
QDeclarativePropertyAnimation::QDeclarativePropertyAnimation(QObject *parent)
@@ -2319,6 +2332,8 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions
When used in a transition, ParentAnimation will by default animate
all ParentChanges.
+
+ \sa {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
/*!
diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp
index c73f827..3c2e239 100644
--- a/src/declarative/util/qdeclarativefontloader.cpp
+++ b/src/declarative/util/qdeclarativefontloader.cpp
@@ -83,6 +83,8 @@ public:
Example:
\qml
+ import Qt 4.7
+
FontLoader { id: fixedFont; name: "Courier" }
FontLoader { id: webFont; source: "http://www.mysite.com/myfont.ttf" }
@@ -183,15 +185,26 @@ void QDeclarativeFontLoader::setName(const QString &name)
\o FontLoader.Error - an error occurred while loading the font
\endlist
- Note that a change in the status property does not cause anything to happen
- (although it reflects what has happened to the font loader internally). If you wish
- to react to the change in status you need to do it yourself, for example in one
- of the following ways:
- \list
- \o Create a state, so that a state change occurs, e.g. State{name: 'loaded'; when: loader.status = FontLoader.Ready;}
- \o Do something inside the onStatusChanged signal handler, e.g. FontLoader{id: loader; onStatusChanged: if(loader.status == FontLoader.Ready) console.log('Loaded');}
- \o Bind to the status variable somewhere, e.g. Text{text: if(loader.status!=FontLoader.Ready){'Not Loaded';}else{'Loaded';}}
- \endlist
+ Use this status to provide an update or respond to the status change in some way.
+ For example, you could:
+
+ \e {Trigger a state change:}
+ \qml
+ State { name: 'loaded'; when: loader.status = FontLoader.Ready }
+ \endqml
+
+ \e {Implement an \c onStatusChanged signal handler:}
+ \qml
+ FontLoader {
+ id: loader
+ onStatusChanged: if (loader.status == FontLoader.Ready) console.log('Loaded')
+ }
+ \endqml
+
+ \e {Bind to the status value:}
+ \qml
+ Text { text: loader.status != FontLoader.Ready ? 'Not Loaded' : 'Loaded' }
+ \endqml
*/
QDeclarativeFontLoader::Status QDeclarativeFontLoader::status() const
{
diff --git a/src/declarative/util/qdeclarativepackage_p.h b/src/declarative/util/qdeclarativepackage_p.h
index 87d9b80..57d9c22 100644
--- a/src/declarative/util/qdeclarativepackage_p.h
+++ b/src/declarative/util/qdeclarativepackage_p.h
@@ -58,7 +58,7 @@ QT_MODULE(Declarative)
class QDeclarativePackagePrivate;
class QDeclarativePackageAttached;
-class QDeclarativePackage : public QObject
+class Q_AUTOTEST_EXPORT QDeclarativePackage : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativePackage)
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index d99de7a..e98afeb 100644
--- a/src/declarative/util/qdeclarativepropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -62,11 +62,11 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass PropertyChanges QDeclarativePropertyChanges
\since 4.7
- \brief The PropertyChanges element describes new property values for a state.
+ \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.
- Here is a property change that modifies the text and color of a Text element
+ Here is a property change that modifies the text and color of a \l Text element
when it is clicked:
\qml
@@ -89,6 +89,21 @@ QT_BEGIN_NAMESPACE
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 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}
+ property to \c true.
State-specific script for signal handlers can also be specified:
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
index bd48ef0..6b6df4d 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation.cpp
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -307,7 +307,7 @@ Rectangle {
set to a value such as 0.5 units/second. Animating from 0 to 1.0 with a velocity
of 0.5 will take 2000 ms to complete.
- \sa SpringFollow
+ \sa SpringFollow, {QML Animation}, {declarative/animation/basics}{Animation basics example}
*/
QDeclarativeSmoothedAnimation::QDeclarativeSmoothedAnimation(QObject *parent)
diff --git a/src/declarative/util/qdeclarativesmoothedanimation_p_p.h b/src/declarative/util/qdeclarativesmoothedanimation_p_p.h
index 81cd229..8cdbea2 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation_p_p.h
+++ b/src/declarative/util/qdeclarativesmoothedanimation_p_p.h
@@ -65,7 +65,7 @@
QT_BEGIN_NAMESPACE
-class QSmoothedAnimation : public QAbstractAnimation
+class Q_AUTOTEST_EXPORT QSmoothedAnimation : public QAbstractAnimation
{
public:
QSmoothedAnimation(QObject *parent=0);
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index b5f7900..dc2b2cc 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -486,6 +486,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit
// All the local reverts now become part of the ongoing revertList
d->revertList << additionalReverts;
+#ifndef QT_NO_DEBUG_STREAM
// Output for debugging
if (stateChangeDebug()) {
foreach(const QDeclarativeAction &action, applyList) {
@@ -497,6 +498,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit
<< "To:" << action.toValue;
}
}
+#endif
d->transitionManager.transition(applyList, trans);
}
diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h
index 25715c6..37b24cb 100644
--- a/src/declarative/util/qdeclarativestate_p.h
+++ b/src/declarative/util/qdeclarativestate_p.h
@@ -84,7 +84,7 @@ public:
void deleteFromBinding();
};
-class QDeclarativeActionEvent
+class Q_AUTOTEST_EXPORT QDeclarativeActionEvent
{
public:
virtual ~QDeclarativeActionEvent();
diff --git a/src/declarative/util/qdeclarativetimeline_p_p.h b/src/declarative/util/qdeclarativetimeline_p_p.h
index 598c897..61f6bcd 100644
--- a/src/declarative/util/qdeclarativetimeline_p_p.h
+++ b/src/declarative/util/qdeclarativetimeline_p_p.h
@@ -63,7 +63,7 @@ class QDeclarativeTimeLineValue;
class QDeclarativeTimeLineCallback;
struct QDeclarativeTimeLinePrivate;
class QDeclarativeTimeLineObject;
-class QDeclarativeTimeLine : public QAbstractAnimation
+class Q_AUTOTEST_EXPORT QDeclarativeTimeLine : public QAbstractAnimation
{
Q_OBJECT
public:
@@ -117,7 +117,7 @@ private:
QDeclarativeTimeLinePrivate *d;
};
-class QDeclarativeTimeLineObject
+class Q_AUTOTEST_EXPORT QDeclarativeTimeLineObject
{
public:
QDeclarativeTimeLineObject();
@@ -129,7 +129,7 @@ protected:
QDeclarativeTimeLine *_t;
};
-class QDeclarativeTimeLineValue : public QDeclarativeTimeLineObject
+class Q_AUTOTEST_EXPORT QDeclarativeTimeLineValue : public QDeclarativeTimeLineObject
{
public:
QDeclarativeTimeLineValue(qreal v = 0.) : _v(v) {}
@@ -147,7 +147,7 @@ private:
qreal _v;
};
-class QDeclarativeTimeLineCallback
+class Q_AUTOTEST_EXPORT QDeclarativeTimeLineCallback
{
public:
typedef void (*Callback)(void *);
diff --git a/src/declarative/util/qdeclarativetimer.cpp b/src/declarative/util/qdeclarativetimer.cpp
index 53a9d83..9e18eb5 100644
--- a/src/declarative/util/qdeclarativetimer.cpp
+++ b/src/declarative/util/qdeclarativetimer.cpp
@@ -80,17 +80,22 @@ public:
the text every 500 milliseconds:
\qml
- Timer {
- interval: 500; running: true; repeat: true
- onTriggered: time.text = Date().toString()
- }
- Text {
- id: time
+ import Qt 4.7
+
+ Item {
+ Timer {
+ interval: 500; running: true; repeat: true
+ onTriggered: time.text = Date().toString()
+ }
+
+ Text {
+ id: time
+ }
}
\endqml
- QDeclarativeTimer is synchronized with the animation timer. Since the animation
- timer is usually set to 60fps, the resolution of QDeclarativeTimer will be
+ The Timer element is synchronized with the animation timer. Since the animation
+ timer is usually set to 60fps, the resolution of Timer will be
at best 16ms.
If the Timer is running and one of its properties is changed, the
@@ -98,8 +103,6 @@ public:
1000ms has its \e repeat property changed 500ms after starting, the
elapsed time will be reset to 0, and the Timer will be triggered
1000ms later.
-
- \sa {QtDeclarative}
*/
QDeclarativeTimer::QDeclarativeTimer(QObject *parent)
diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp
index 368d484..9f198e4 100644
--- a/src/declarative/util/qdeclarativetransitionmanager.cpp
+++ b/src/declarative/util/qdeclarativetransitionmanager.cpp
@@ -233,6 +233,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &
action.property.write(action.toValue);
}
}
+#ifndef QT_NO_DEBUG_STREAM
if (stateChangeDebug()) {
foreach(const QDeclarativeAction &action, applyList) {
if (action.event)
@@ -243,6 +244,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &
<< "To:" << action.toValue;
}
}
+#endif
if (!transition)
d->applyBindings();
}
diff --git a/src/declarative/util/qdeclarativetransitionmanager_p_p.h b/src/declarative/util/qdeclarativetransitionmanager_p_p.h
index 2e23898..75d11a9 100644
--- a/src/declarative/util/qdeclarativetransitionmanager_p_p.h
+++ b/src/declarative/util/qdeclarativetransitionmanager_p_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class QDeclarativeStatePrivate;
class QDeclarativeTransitionManagerPrivate;
-class QDeclarativeTransitionManager
+class Q_AUTOTEST_EXPORT QDeclarativeTransitionManager
{
public:
QDeclarativeTransitionManager();
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 36d21a6..b3e1701 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -5687,32 +5687,30 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect)
return;
}
+ // Find pixmap in cache.
QPixmap cachedPixmap;
if (!QPixmapCache::find(cache->key, &cachedPixmap)) {
update(rect);
return;
}
+ QRect scrollRect = (rect.isNull() ? boundingRect() : rect).toAlignedRect();
+ if (!scrollRect.intersects(cache->boundingRect))
+ return; // Nothing to scroll.
+
+ // Remove from cache to avoid deep copy when modifying.
+ QPixmapCache::remove(cache->key);
+
QRegion exposed;
- const bool scrollEntirePixmap = rect.isNull();
- if (scrollEntirePixmap) {
- // Scroll entire pixmap.
- cachedPixmap.scroll(dx, dy, cachedPixmap.rect(), &exposed);
- } else {
- if (!rect.intersects(cache->boundingRect))
- return; // Nothing to scroll.
- // Scroll sub-rect of pixmap. The rect is in item coordinates
- // so we have to translate it to pixmap coordinates.
- QRect scrollRect = rect.toAlignedRect();
- cachedPixmap.scroll(dx, dy, scrollRect.translated(-cache->boundingRect.topLeft()), &exposed);
- }
+ cachedPixmap.scroll(dx, dy, scrollRect.translated(-cache->boundingRect.topLeft()), &exposed);
- QPixmapCache::replace(cache->key, cachedPixmap);
+ // Reinsert into cache.
+ cache->key = QPixmapCache::insert(cachedPixmap);
// Translate the existing expose.
for (int i = 0; i < cache->exposed.size(); ++i) {
QRectF &e = cache->exposed[i];
- if (!scrollEntirePixmap && !e.intersects(rect))
+ if (!rect.isNull() && !e.intersects(rect))
continue;
e.translate(dx, dy);
}
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index d081cfd..4cdc4ad 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -44,6 +44,9 @@
#include "qcoefepinputcontext_p.h"
#include <qapplication.h>
#include <qtextformat.h>
+#include <qgraphicsview.h>
+#include <qgraphicsscene.h>
+#include <qgraphicswidget.h>
#include <private/qcore_symbian_p.h>
#include <fepitfr.h>
@@ -320,12 +323,14 @@ TCoeInputCapabilities QCoeFepInputContext::inputCapabilities()
return TCoeInputCapabilities(m_textCapabilities, this, 0);
}
-static QTextCharFormat qt_TCharFormat2QTextCharFormat(const TCharFormat &cFormat)
+static QTextCharFormat qt_TCharFormat2QTextCharFormat(const TCharFormat &cFormat, bool validStyleColor)
{
QTextCharFormat qFormat;
- QBrush foreground(QColor(cFormat.iFontPresentation.iTextColor.Internal()));
- qFormat.setForeground(foreground);
+ if (validStyleColor) {
+ QBrush foreground(QColor(cFormat.iFontPresentation.iTextColor.Internal()));
+ qFormat.setForeground(foreground);
+ }
qFormat.setFontStrikeOut(cFormat.iFontPresentation.iStrikethrough == EStrikethroughOn);
qFormat.setFontUnderline(cFormat.iFontPresentation.iUnderline == EUnderlineOn);
@@ -484,10 +489,30 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
void QCoeFepInputContext::applyFormat(QList<QInputMethodEvent::Attribute> *attributes)
{
TCharFormat cFormat;
- const QColor styleTextColor = focusWidget() ? focusWidget()->palette().text().color() :
- QApplication::palette("QLineEdit").text().color();
- const TLogicalRgb fontColor(TRgb(styleTextColor.red(), styleTextColor.green(), styleTextColor.blue(), styleTextColor.alpha()));
- cFormat.iFontPresentation.iTextColor = fontColor;
+ QColor styleTextColor;
+ if (QWidget *focused = focusWidget()) {
+ QGraphicsView *gv = qobject_cast<QGraphicsView*>(focused);
+ if (!gv) // could be either the QGV or its viewport that has focus
+ gv = qobject_cast<QGraphicsView*>(focused->parentWidget());
+ if (gv) {
+ if (QGraphicsScene *scene = gv->scene()) {
+ if (QGraphicsItem *focusItem = scene->focusItem()) {
+ if (focusItem->isWidget()) {
+ styleTextColor = static_cast<QGraphicsWidget*>(focusItem)->palette().text().color();
+ }
+ }
+ }
+ } else {
+ styleTextColor = focused->palette().text().color();
+ }
+ } else {
+ styleTextColor = QApplication::palette("QLineEdit").text().color();
+ }
+
+ if (styleTextColor.isValid()) {
+ const TLogicalRgb fontColor(TRgb(styleTextColor.red(), styleTextColor.green(), styleTextColor.blue(), styleTextColor.alpha()));
+ cFormat.iFontPresentation.iTextColor = fontColor;
+ }
TInt numChars = 0;
TInt charPos = 0;
@@ -501,7 +526,7 @@ void QCoeFepInputContext::applyFormat(QList<QInputMethodEvent::Attribute> *attri
attributes->append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,
charPos,
numChars,
- QVariant(qt_TCharFormat2QTextCharFormat(cFormat))));
+ QVariant(qt_TCharFormat2QTextCharFormat(cFormat, styleTextColor.isValid()))));
charPos += numChars;
if (charPos >= m_preeditString.size()) {
break;
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index a2c058a..09a3bfe 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -780,6 +780,9 @@ void QApplicationPrivate::construct(
qt_is_gui_used = (qt_appType != QApplication::Tty);
process_cmdline();
+ // the environment variable has the lowest precedence of runtime graphicssystem switches
+ if (graphics_system_name.isEmpty())
+ graphics_system_name = QString::fromLocal8Bit(qgetenv("QT_GRAPHICSSYSTEM"));
// Must be called before initialize()
qt_init(this, qt_appType
#ifdef Q_WS_X11
@@ -1560,10 +1563,18 @@ QStyle* QApplication::setStyle(const QString& style)
on-screen widgets and QPixmaps. The available systems are \c{"native"},
\c{"raster"} and \c{"opengl"}.
- This function call overrides both the application commandline
- \c{-graphicssystem} switch and the configure \c{-graphicssystem} switch.
+ There are several ways to set the graphics backend, in order of decreasing
+ precedence:
+ \list
+ \o the application commandline \c{-graphicssystem} switch
+ \o QApplication::setGraphicsSystem()
+ \o the QT_GRAPHICSSYSTEM environment variable
+ \o the Qt configure \c{-graphicssystem} switch
+ \endlist
+ If the highest precedence switch sets an invalid name, the error will be
+ ignored and the default backend will be used.
- \warning This function must be called before the QApplication constructor
+ \warning This function is only effective before the QApplication constructor
is called.
\note The \c{"opengl"} option is currently experimental.
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index b57615c..77f8fc0 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -253,7 +253,9 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions)
can take some time, but this function does not block the event
loop. Other events are still delivered to the application while
the operation is performed. On Windows, the Qt event loop is
- blocked while during the operation.
+ blocked during the operation. However, QDrag::exec() on
+ Windows causes processEvents() to be called frequently to keep the GUI responsive.
+ If any loops or operations are called while a drag operation is active, it will block the drag operation.
*/
Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defaultDropAction)
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 657229a..4596754 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5855,14 +5855,24 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
return;
}
+ if (d->extended->type() == QPaintEngine::OpenGL2 && !staticText_d->untransformedCoordinates) {
+ staticText_d->untransformedCoordinates = true;
+ staticText_d->needsRelayout = true;
+ } else if (d->extended->type() != QPaintEngine::OpenGL2 && staticText_d->untransformedCoordinates) {
+ staticText_d->untransformedCoordinates = false;
+ staticText_d->needsRelayout = true;
+ }
+
// Don't recalculate entire layout because of translation, rather add the dx and dy
// into the position to move each text item the correct distance.
- QPointF transformedPosition = topLeftPosition * d->state->matrix;
- QTransform matrix = d->state->matrix;
+ QPointF transformedPosition = topLeftPosition;
+ if (!staticText_d->untransformedCoordinates)
+ transformedPosition = transformedPosition * d->state->matrix;
+ QTransform oldMatrix;
// The translation has been applied to transformedPosition. Remove translation
// component from matrix.
- if (d->state->matrix.isTranslating()) {
+ if (d->state->matrix.isTranslating() && !staticText_d->untransformedCoordinates) {
qreal m11 = d->state->matrix.m11();
qreal m12 = d->state->matrix.m12();
qreal m13 = d->state->matrix.m13();
@@ -5871,6 +5881,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
qreal m23 = d->state->matrix.m23();
qreal m33 = d->state->matrix.m33();
+ oldMatrix = d->state->matrix;
d->state->matrix.setMatrix(m11, m12, m13,
m21, m22, m23,
0.0, 0.0, m33);
@@ -5879,7 +5890,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
// If the transform is not identical to the text transform,
// we have to relayout the text (for other transformations than plain translation)
bool staticTextNeedsReinit = staticText_d->needsRelayout;
- if (staticText_d->matrix != d->state->matrix) {
+ if (!staticText_d->untransformedCoordinates && staticText_d->matrix != d->state->matrix) {
staticText_d->matrix = d->state->matrix;
staticTextNeedsReinit = true;
}
@@ -5918,8 +5929,8 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
if (currentColor != oldPen.color())
setPen(oldPen);
- if (matrix.isTranslating())
- d->state->matrix = matrix;
+ if (!staticText_d->untransformedCoordinates && oldMatrix.isTranslating())
+ d->state->matrix = oldMatrix;
}
/*!
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 84c1d96..10870aa 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -115,10 +115,12 @@ QT_BEGIN_NAMESPACE
Qt::RichText.
If it's the first time the static text is drawn, or if the static text, or the painter's font
- or matrix have been altered since the last time it was drawn, the text's layout has to be
- recalculated. This will impose an overhead on the QPainter::drawStaticText() call where the
- relayout occurs. To avoid this overhead in the paint event, you can call prepare() ahead of
- time to ensure that the layout is calculated.
+ has been altered since the last time it was drawn, the text's layout has to be
+ recalculated. On some paint engines, changing the matrix of the painter will also cause the
+ layout to be recalculated. In particular, this will happen for any engine except for the
+ OpenGL2 paint engine. Recalculating the layout will impose an overhead on the
+ QPainter::drawStaticText() call where it occurs. To avoid this overhead in the paint event, you
+ can call prepare() ahead of time to ensure that the layout is calculated.
\sa QPainter::drawText(), QPainter::drawStaticText(), QTextLayout, QTextDocument
*/
@@ -188,8 +190,9 @@ void QStaticText::detach()
When drawStaticText() is called, the layout of the QStaticText will be recalculated if any part
of the QStaticText object has changed since the last time it was drawn. It will also be
- recalculated if the painter's font or matrix are not the same as when the QStaticText was last
- drawn.
+ recalculated if the painter's font is not the same as when the QStaticText was last drawn, or,
+ on any other paint engine than the OpenGL2 engine, if the painter's matrix has been altered
+ since the static text was last drawn.
To avoid the overhead of creating the layout the first time you draw the QStaticText after
making changes, you can use the prepare() function and pass in the \a matrix and \a font you
@@ -364,14 +367,16 @@ QSizeF QStaticText::size() const
QStaticTextPrivate::QStaticTextPrivate()
: textWidth(-1.0), items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0),
- needsRelayout(true), useBackendOptimizations(false), textFormat(Qt::AutoText)
+ needsRelayout(true), useBackendOptimizations(false), textFormat(Qt::AutoText),
+ untransformedCoordinates(false)
{
}
QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other)
: text(other.text), font(other.font), textWidth(other.textWidth), matrix(other.matrix),
items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0), needsRelayout(true),
- useBackendOptimizations(other.useBackendOptimizations), textFormat(other.textFormat)
+ useBackendOptimizations(other.useBackendOptimizations), textFormat(other.textFormat),
+ untransformedCoordinates(other.untransformedCoordinates)
{
}
@@ -396,8 +401,9 @@ namespace {
class DrawTextItemRecorder: public QPaintEngine
{
public:
- DrawTextItemRecorder(bool useBackendOptimizations, int numChars)
- : m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations)
+ DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations, int numChars)
+ : m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations),
+ m_untransformedCoordinates(untransformedCoordinates)
{
}
@@ -423,7 +429,7 @@ namespace {
if (m_dirtyPen)
currentItem.color = state->pen().color();
- QTransform matrix = state->transform();
+ QTransform matrix = m_untransformedCoordinates ? QTransform() : state->transform();
matrix.translate(position.x(), position.y());
QVarLengthArray<glyph_t> glyphs;
@@ -486,14 +492,17 @@ namespace {
bool m_dirtyPen;
bool m_useBackendOptimizations;
+ bool m_untransformedCoordinates;
};
class DrawTextItemDevice: public QPaintDevice
{
public:
- DrawTextItemDevice(bool useBackendOptimizations, int numChars)
+ DrawTextItemDevice(bool untransformedCoordinates, bool useBackendOptimizations,
+ int numChars)
{
- m_paintEngine = new DrawTextItemRecorder(useBackendOptimizations, numChars);
+ m_paintEngine = new DrawTextItemRecorder(untransformedCoordinates,
+ useBackendOptimizations, numChars);
}
~DrawTextItemDevice()
@@ -629,7 +638,7 @@ void QStaticTextPrivate::init()
position = QPointF(0, 0);
- DrawTextItemDevice device(useBackendOptimizations, text.size());
+ DrawTextItemDevice device(untransformedCoordinates, useBackendOptimizations, text.size());
{
QPainter painter(&device);
painter.setFont(font);
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index 2ab5579..1a96291 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -148,9 +148,10 @@ public:
QFixedPoint *positionPool; // 4 bytes per text
QChar *charPool; // 4 bytes per text
- unsigned char needsRelayout : 1;
- unsigned char useBackendOptimizations : 1; // 1 byte per text
- unsigned char textFormat : 2;
+ unsigned char needsRelayout : 1; // 1 byte per text
+ unsigned char useBackendOptimizations : 1;
+ unsigned char textFormat : 2;
+ unsigned char untransformedCoordinates : 1;
// ================
// 167 bytes per text
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index c91df3c..d6ac3aa 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -64,7 +64,7 @@ enum {
QTextCursorPrivate::QTextCursorPrivate(QTextDocumentPrivate *p)
: priv(p), x(0), position(0), anchor(0), adjusted_anchor(0),
- currentCharFormat(-1), visualNavigation(false)
+ currentCharFormat(-1), visualNavigation(false), keepPositionOnInsert(false)
{
priv->addCursor(this);
}
@@ -79,6 +79,7 @@ QTextCursorPrivate::QTextCursorPrivate(const QTextCursorPrivate &rhs)
x = rhs.x;
currentCharFormat = rhs.currentCharFormat;
visualNavigation = rhs.visualNavigation;
+ keepPositionOnInsert = rhs.keepPositionOnInsert;
priv->addCursor(this);
}
@@ -95,7 +96,7 @@ QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int position
if (position < positionOfChange
|| (position == positionOfChange
&& (op == QTextUndoCommand::KeepCursor
- || anchor < position)
+ || keepPositionOnInsert)
)
) {
result = CursorUnchanged;
@@ -1276,6 +1277,80 @@ void QTextCursor::setVisualNavigation(bool b)
d->visualNavigation = b;
}
+
+/*!
+ \since 4.7
+
+ Sets the visual x position for vertical cursor movements.
+
+ The vertical movement x position is cleared automatically when the cursor moves horizontally, and kept
+ unchanged when the cursor moves vertically. The mechanism allows the cursor to move up and down on a
+ visually straight line with proportional fonts, and to gently "jump" over short lines.
+
+ A value of -1 indicates no predefined x position. It will then be set automatically the next time the
+ cursor moves up or down.
+
+ \sa verticalMovementX()
+ */
+void QTextCursor::setVerticalMovementX(int x)
+{
+ if (d)
+ d->x = x;
+}
+
+/*! \since 4.7
+
+ Returns the visual x position for vertical cursor movements.
+
+ A value of -1 indicates no predefined x position. It will then be set automatically the next time the
+ cursor moves up or down.
+
+ \sa setVerticalMovementX()
+ */
+int QTextCursor::verticalMovementX() const
+{
+ return d ? d->x : -1;
+}
+
+/*!
+ \since 4.7
+
+ Returns whether the cursor should keep its current position when text gets inserted at the position of the
+ cursor.
+
+ The default is false;
+
+ \sa setKeepPositionOnInsert()
+ */
+bool QTextCursor::keepPositionOnInsert() const
+{
+ return d ? d->keepPositionOnInsert : false;
+}
+
+/*!
+ \since 4.7
+
+ Defines whether the cursor should keep its current position when text gets inserted at the current position of the
+ cursor.
+
+ If \b is true, the cursor keeps its current position when text gets inserted at the positing of the cursor.
+ If \b is false, the cursor moves along with the inserted text.
+
+ The default is false.
+
+ Note that a cursor always moves when text is inserted before the current position of the cursor, and it
+ always keeps its position when text is inserted after the current position of the cursor.
+
+ \sa keepPositionOnInsert()
+ */
+void QTextCursor::setKeepPositionOnInsert(bool b)
+{
+ if (d)
+ d->keepPositionOnInsert = b;
+}
+
+
+
/*!
Inserts \a text at the current position, using the current
character format.
@@ -1408,16 +1483,16 @@ void QTextCursor::deletePreviousChar()
{
if (!d || !d->priv)
return;
-
+
if (d->position != d->anchor) {
removeSelectedText();
return;
}
-
+
if (d->anchor < 1 || !d->canDelete(d->anchor-1))
return;
d->anchor--;
-
+
QTextDocumentPrivate::FragmentIterator fragIt = d->priv->find(d->anchor);
const QTextFragmentData * const frag = fragIt.value();
int fpos = fragIt.position();
@@ -1429,7 +1504,7 @@ void QTextCursor::deletePreviousChar()
if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00)
--d->anchor;
}
-
+
d->adjusted_anchor = d->anchor;
d->remove();
d->setX();
diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h
index 3e968a3..251cb33 100644
--- a/src/gui/text/qtextcursor.h
+++ b/src/gui/text/qtextcursor.h
@@ -132,6 +132,12 @@ public:
bool visualNavigation() const;
void setVisualNavigation(bool b);
+ void setVerticalMovementX(int x);
+ int verticalMovementX() const;
+
+ void setKeepPositionOnInsert(bool b);
+ bool keepPositionOnInsert() const;
+
void deleteChar();
void deletePreviousChar();
diff --git a/src/gui/text/qtextcursor_p.h b/src/gui/text/qtextcursor_p.h
index 1bdfa78..4e36b95 100644
--- a/src/gui/text/qtextcursor_p.h
+++ b/src/gui/text/qtextcursor_p.h
@@ -112,7 +112,8 @@ public:
int anchor;
int adjusted_anchor;
int currentCharFormat;
- bool visualNavigation;
+ uint visualNavigation : 1;
+ uint keepPositionOnInsert : 1;
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index ce7915d..3f67408 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -858,7 +858,8 @@ QRectF QTextLayout::boundingRect() const
const QScriptLine &si = d->lines[i];
xmin = qMin(xmin, si.x);
ymin = qMin(ymin, si.y);
- xmax = qMax(xmax, si.x+qMax(si.width, si.textWidth));
+ QFixed lineWidth = si.width < QFIXED_MAX ? qMax(si.width, si.textWidth) : si.textWidth;
+ xmax = qMax(xmax, si.x+lineWidth);
// ### shouldn't the ascent be used in ymin???
ymax = qMax(ymax, si.y+si.height());
}
diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp
index 555df3c..1ec6106 100644
--- a/src/imports/folderlistmodel/plugin.cpp
+++ b/src/imports/folderlistmodel/plugin.cpp
@@ -53,7 +53,9 @@ public:
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.folderlistmodel"));
+#ifndef QT_NO_DIRMODEL
qmlRegisterType<QDeclarativeFolderListModel>(uri,1,0,"FolderListModel");
+#endif
}
};
//![class decl]
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
index fccb9d4..9cf81ca 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
@@ -45,6 +45,8 @@
#include <QDebug>
#include <qdeclarativecontext.h>
+#ifndef QT_NO_DIRMODEL
+
QT_BEGIN_NAMESPACE
class QDeclarativeFolderListModelPrivate
@@ -397,3 +399,5 @@ void QDeclarativeFolderListModel::setShowOnlyReadable(bool on)
//![code]
QT_END_NAMESPACE
+
+#endif // QT_NO_DIRMODEL
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
index ea7d701..1bab5f84 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
@@ -47,6 +47,8 @@
#include <QUrl>
#include <QAbstractListModel>
+#ifndef QT_NO_DIRMODEL
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -152,4 +154,6 @@ QML_DECLARE_TYPE(QDeclarativeFolderListModel)
QT_END_HEADER
+#endif // QT_NO_DIRMODEL
+
#endif // QDECLARATIVEFOLDERLISTMODEL_H
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 5758b25..ee49a3d 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1333,8 +1333,16 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
QFontEngineGlyphCache::Type glyphType = textItem->fontEngine->glyphFormat >= 0
? QFontEngineGlyphCache::Type(textItem->fontEngine->glyphFormat)
: d->glyphCacheType;
+ if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
+ if (d->device->alphaRequested() || state()->matrix.type() > QTransform::TxTranslate
+ || (state()->composition_mode != QPainter::CompositionMode_Source
+ && state()->composition_mode != QPainter::CompositionMode_SourceOver))
+ {
+ glyphType = QFontEngineGlyphCache::Raster_A8;
+ }
+ }
- d->drawCachedGlyphs(glyphType, textItem, true);
+ d->drawCachedGlyphs(glyphType, textItem);
}
bool QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src)
@@ -1408,7 +1416,7 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
staticTextItem.numGlyphs = glyphs.size();
staticTextItem.glyphPositions = positions.data();
- d->drawCachedGlyphs(glyphType, &staticTextItem, false);
+ d->drawCachedGlyphs(glyphType, &staticTextItem);
}
return;
}
@@ -1439,21 +1447,16 @@ namespace {
// #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO
void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType,
- QStaticTextItem *staticTextItem,
- bool includeMatrixInCache)
+ QStaticTextItem *staticTextItem)
{
Q_Q(QGL2PaintEngineEx);
QOpenGL2PaintEngineState *s = q->state();
QGLTextureGlyphCache *cache =
- (QGLTextureGlyphCache *) staticTextItem->fontEngine->glyphCache(ctx, glyphType,
- includeMatrixInCache
- ? s->matrix
- : QTransform());
+ (QGLTextureGlyphCache *) staticTextItem->fontEngine->glyphCache(ctx, glyphType, QTransform());
if (!cache || cache->cacheType() != glyphType) {
- cache = new QGLTextureGlyphCache(ctx, glyphType,
- includeMatrixInCache ? s->matrix : QTransform());
+ cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
staticTextItem->fontEngine->setGlyphCache(ctx, cache);
}
@@ -1561,13 +1564,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
QBrush pensBrush = q->state()->pen.brush();
setBrush(pensBrush);
- // When painting a QStaticTextItem, the glyph positions are already in device coordinates,
- // therefore we temporarily set an identity matrix on the painter for the draw call to
- // avoid transforming the positions twice.
- QTransform old = s->matrix;
- if (includeMatrixInCache)
- s->matrix = QTransform();
-
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
// Subpixel antialiasing without gamma correction
@@ -1664,9 +1660,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
#else
glDrawElements(GL_TRIANGLE_STRIP, 6 * staticTextItem->numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
#endif
-
- if (includeMatrixInCache)
- s->matrix = old;
}
void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 0a046dc..59b90d8 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -202,8 +202,7 @@ public:
void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false);
void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
QPainter::PixmapFragmentHints hints);
- void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem,
- bool includeMatrixInCache);
+ void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem);
// Calls glVertexAttributePointer if the pointer has changed
inline void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer);
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 922a96c..c8502c2 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -91,6 +91,7 @@
#include "qcolormap.h"
#include "qfile.h"
#include "qlibrary.h"
+#include <qmutex.h>
QT_BEGIN_NAMESPACE
@@ -1515,10 +1516,33 @@ bool operator!=(const QGLFormat& a, const QGLFormat& b)
return !(a == b);
}
+struct QGLContextGroupList {
+ void append(QGLContextGroup *group) {
+ QMutexLocker locker(&m_mutex);
+ m_list.append(group);
+ }
+
+ void remove(QGLContextGroup *group) {
+ QMutexLocker locker(&m_mutex);
+ m_list.removeOne(group);
+ }
+
+ QList<QGLContextGroup *> m_list;
+ QMutex m_mutex;
+};
+
+Q_GLOBAL_STATIC(QGLContextGroupList, qt_context_groups)
+
/*****************************************************************************
QGLContext implementation
*****************************************************************************/
+QGLContextGroup::QGLContextGroup(const QGLContext *context)
+ : m_context(context), m_guards(0), m_refs(1)
+{
+ qt_context_groups()->append(this);
+}
+
QGLContextGroup::~QGLContextGroup()
{
// Clear any remaining QGLSharedResourceGuard objects on the group.
@@ -1528,6 +1552,7 @@ QGLContextGroup::~QGLContextGroup()
guard->m_id = 0;
guard = guard->m_next;
}
+ qt_context_groups()->remove(this);
}
void QGLContextGroup::addGuard(QGLSharedResourceGuard *guard)
@@ -1736,7 +1761,7 @@ void QGLTextureCache::insert(QGLContext* ctx, qint64 key, QGLTexture* texture, i
QWriteLocker locker(&m_lock);
if (m_cache.totalCost() + cost > m_cache.maxCost()) {
// the cache is full - make an attempt to remove something
- const QList<qint64> keys = m_cache.keys();
+ const QList<QGLTextureCacheKey> keys = m_cache.keys();
int i = 0;
while (i < m_cache.count()
&& (m_cache.totalCost() + cost > m_cache.maxCost())) {
@@ -1746,13 +1771,26 @@ void QGLTextureCache::insert(QGLContext* ctx, qint64 key, QGLTexture* texture, i
++i;
}
}
- m_cache.insert(key, texture, cost);
+ const QGLTextureCacheKey cacheKey = {key, QGLContextPrivate::contextGroup(ctx)};
+ m_cache.insert(cacheKey, texture, cost);
+}
+
+void QGLTextureCache::remove(qint64 key)
+{
+ QWriteLocker locker(&m_lock);
+ QMutexLocker groupLocker(&qt_context_groups()->m_mutex);
+ QList<QGLContextGroup *>::const_iterator it = qt_context_groups()->m_list.constBegin();
+ while (it != qt_context_groups()->m_list.constEnd()) {
+ const QGLTextureCacheKey cacheKey = {key, *it};
+ m_cache.remove(cacheKey);
+ ++it;
+ }
}
bool QGLTextureCache::remove(QGLContext* ctx, GLuint textureId)
{
QWriteLocker locker(&m_lock);
- QList<qint64> keys = m_cache.keys();
+ QList<QGLTextureCacheKey> keys = m_cache.keys();
for (int i = 0; i < keys.size(); ++i) {
QGLTexture *tex = m_cache.object(keys.at(i));
if (tex->id == textureId && tex->context == ctx) {
@@ -1767,9 +1805,9 @@ bool QGLTextureCache::remove(QGLContext* ctx, GLuint textureId)
void QGLTextureCache::removeContextTextures(QGLContext* ctx)
{
QWriteLocker locker(&m_lock);
- QList<qint64> keys = m_cache.keys();
+ QList<QGLTextureCacheKey> keys = m_cache.keys();
for (int i = 0; i < keys.size(); ++i) {
- const qint64 &key = keys.at(i);
+ const QGLTextureCacheKey &key = keys.at(i);
if (m_cache.object(key)->context == ctx)
m_cache.remove(key);
}
@@ -1782,7 +1820,6 @@ void QGLTextureCache::removeContextTextures(QGLContext* ctx)
void QGLTextureCache::cleanupTexturesForCacheKey(qint64 cacheKey)
{
qt_gl_texture_cache()->remove(cacheKey);
- Q_ASSERT(qt_gl_texture_cache()->getTexture(cacheKey) == 0);
}
@@ -2425,7 +2462,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
QGLTexture *QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum target)
{
Q_Q(QGLContext);
- QGLTexture *texture = QGLTextureCache::instance()->getTexture(key);
+ QGLTexture *texture = QGLTextureCache::instance()->getTexture(q, key);
if (texture && texture->target == target
&& (texture->context == q || QGLContext::areSharing(q, texture->context)))
{
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index d92f963..16c225f 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -230,7 +230,7 @@ public:
static void addShare(const QGLContext *context, const QGLContext *share);
static void removeShare(const QGLContext *context);
private:
- QGLContextGroup(const QGLContext *context) : m_context(context), m_guards(0), m_refs(1) { }
+ QGLContextGroup(const QGLContext *context);
QGLExtensionFuncs m_extensionFuncs;
const QGLContext *m_context; // context group's representative
@@ -522,17 +522,33 @@ public:
QSize bindCompressedTexturePVR(const char *buf, int len);
};
+struct QGLTextureCacheKey {
+ qint64 key;
+ QGLContextGroup *group;
+};
+
+inline bool operator==(const QGLTextureCacheKey &a, const QGLTextureCacheKey &b)
+{
+ return a.key == b.key && a.group == b.group;
+}
+
+inline uint qHash(const QGLTextureCacheKey &key)
+{
+ return qHash(key.key) ^ qHash(key.group);
+}
+
+
class Q_AUTOTEST_EXPORT QGLTextureCache {
public:
QGLTextureCache();
~QGLTextureCache();
void insert(QGLContext *ctx, qint64 key, QGLTexture *texture, int cost);
- inline void remove(quint64 key);
+ void remove(qint64 key);
inline int size();
inline void setMaxCost(int newMax);
inline int maxCost();
- inline QGLTexture* getTexture(quint64 key);
+ inline QGLTexture* getTexture(QGLContext *ctx, qint64 key);
bool remove(QGLContext *ctx, GLuint textureId);
void removeContextTextures(QGLContext *ctx);
@@ -542,7 +558,7 @@ public:
static void cleanupBeforePixmapDestruction(QPixmapData* pixmap);
private:
- QCache<qint64, QGLTexture> m_cache;
+ QCache<QGLTextureCacheKey, QGLTexture> m_cache;
QReadWriteLock m_lock;
};
@@ -563,19 +579,13 @@ int QGLTextureCache::maxCost()
return m_cache.maxCost();
}
-QGLTexture* QGLTextureCache::getTexture(quint64 key)
+QGLTexture* QGLTextureCache::getTexture(QGLContext *ctx, qint64 key)
{
QReadLocker locker(&m_lock);
- return m_cache.object(key);
+ const QGLTextureCacheKey cacheKey = {key, QGLContextPrivate::contextGroup(ctx)};
+ return m_cache.object(cacheKey);
}
-void QGLTextureCache::remove(quint64 key)
-{
- QWriteLocker locker(&m_lock);
- m_cache.remove(key);
-}
-
-
extern Q_OPENGL_EXPORT QPaintEngine* qt_qgl_paint_engine();
bool qt_gl_preferGL2Engine();
diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby
index ec019e2..f43f344 100644
--- a/src/s60installs/qt.iby
+++ b/src/s60installs/qt.iby
@@ -74,6 +74,21 @@ data=\epoc32\data\z\resource\qt\plugins\codecs\qtwcodecs.qtplugin resou
// iconengines stubs
data=\epoc32\data\z\resource\qt\plugins\iconengines\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin
+// qml import plugins
+file=ABI_DIR\BUILD_DIR\qmlwebkitplugin.dll SHARED_LIB_DIR\qmlwebkitplugin.dll
+file=ABI_DIR\BUILD_DIR\qmlfolderlistmodelplugin.dll SHARED_LIB_DIR\qmlfolderlistmodelplugin.dll
+file=ABI_DIR\BUILD_DIR\qmlgesturesplugin.dll SHARED_LIB_DIR\qmlgesturesplugin.dll
+file=ABI_DIR\BUILD_DIR\qmlparticlesplugin.dll SHARED_LIB_DIR\qmlparticlesplugin.dll
+
+data=\epoc32\data\z\resource\qt\imports\org\webkit\qmlwebkitplugin.qtplugin resource\qt\imports\org\webkit\qmlwebkitplugin.qtplugin
+data=\epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin
+data=\epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin
+data=\epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin
+
+data=\epoc32\data\z\resource\qt\imports\org\webkit\qmldir resource\qt\imports\org\webkit\qmldir
+data=\epoc32\data\z\resource\qt\imports\Qt\labs\folderlistmodel\qmldir resource\qt\imports\Qt\labs\folderlistmodel\qmldir
+data=\epoc32\data\z\resource\qt\imports\Qt\labs\gestures\qmldir resource\qt\imports\Qt\labs\gestures\qmldir
+data=\epoc32\data\z\resource\qt\imports\Qt\labs\particles\qmldir resource\qt\imports\Qt\labs\particles\qmldir
// QtMultimedia audio backend
data=\epoc32\data\qt\qtlibspluginstubs\qaudio.qtplugin resource\qt\plugins\audio\qaudio.qtplugin
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 136f270..532269d 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -150,6 +150,27 @@ symbian: {
contains(QT_CONFIG, declarative): {
qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtDeclarative$${QT_LIBINFIX}.dll
+
+ folderlistmodelImport.sources = $$QMAKE_LIBDIR_QT/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll
+ gesturesImport.sources = $$QMAKE_LIBDIR_QT/qmlgesturesplugin$${QT_LIBINFIX}.dll
+ particlesImport.sources = $$QMAKE_LIBDIR_QT/qmlparticlesplugin$${QT_LIBINFIX}.dll
+
+ folderlistmodelImport.sources += $$QT_SOURCE_TREE/src/imports/folderlistmodel/qmldir
+ gesturesImport.sources += $$QT_SOURCE_TREE/src/imports/gestures/qmldir
+ particlesImport.sources += $$QT_SOURCE_TREE/src/imports/particles/qmldir
+
+ folderlistmodelImport.path = $$QT_IMPORTS_BASE_DIR/Qt/labs/folderlistmodel
+ gesturesImport.path = $$QT_IMPORTS_BASE_DIR/Qt/labs/gestures
+ particlesImport.path = $$QT_IMPORTS_BASE_DIR/Qt/labs/particles
+
+ DEPLOYMENT += folderlistmodelImport gesturesImport particlesImport
+
+ contains(QT_CONFIG, webkit): {
+ webkitImport.sources = $$QMAKE_LIBDIR_QT/qmlwebkitplugin$${QT_LIBINFIX}.dll
+ webkitImport.sources += $$QT_SOURCE_TREE/src/imports/webkit/qmldir
+ webkitImport.path = $$QT_IMPORTS_BASE_DIR/org/webkit
+ DEPLOYMENT += webkitImport
+ }
}
graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index 203760e..2aef9bb 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -91,6 +91,7 @@ private slots:
void modelChanges();
void QTBUG_9791();
void manualHighlight();
+ void QTBUG_11105();
private:
template <class T> void items();
@@ -1493,6 +1494,53 @@ void tst_QDeclarativeListView::manualHighlight()
QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y());
}
+void tst_QDeclarativeListView::QTBUG_11105()
+{
+ QDeclarativeView *canvas = createView();
+
+ TestModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QDeclarativeContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml"));
+ qApp->processEvents();
+
+ QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QDeclarativeItem *viewport = listview->viewport();
+ QTRY_VERIFY(viewport != 0);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_VERIFY(item->y() == i*20);
+ }
+
+ listview->positionViewAtIndex(20, QDeclarativeListView::Beginning);
+ QCOMPARE(listview->contentY(), 280.);
+
+ TestModel model2;
+ for (int i = 0; i < 5; i++)
+ model2.addItem("Item" + QString::number(i), "");
+
+ ctxt->setContextProperty("testModel", &model2);
+
+ itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count();
+ QCOMPARE(itemCount, 5);
+
+ delete canvas;
+}
+
void tst_QDeclarativeListView::qListModelInterface_items()
{
items<TestModel>();
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index d3e3c3a..fbab30e 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -50,6 +50,7 @@
#include <QtDeclarative/qdeclarativeexpression.h>
#include <QtDeclarative/qdeclarativecomponent.h>
#include <private/qdeclarativetextedit_p.h>
+#include <private/qdeclarativetextedit_p_p.h>
#include <QFontMetrics>
#include <QDeclarativeView>
#include <QStyle>
@@ -86,7 +87,8 @@ private slots:
void delegateLoading();
void navigation();
void readOnly();
- void sendRequestSoftwareInputPanelEvent();
+ void openInputPanelOnClick();
+ void openInputPanelOnFocus();
void geometrySignals();
private:
void simulateKey(QDeclarativeView *, int key);
@@ -551,11 +553,11 @@ void tst_qdeclarativetextedit::selection()
//Test selection
for(int i=0; i<= testStr.size(); i++) {
- textEditObject->setSelectionEnd(i);
+ textEditObject->select(0,i);
QCOMPARE(testStr.mid(0,i), textEditObject->selectedText());
}
for(int i=0; i<= testStr.size(); i++) {
- textEditObject->setSelectionStart(i);
+ textEditObject->select(i,testStr.size());
QCOMPARE(testStr.mid(i,testStr.size()-i), textEditObject->selectedText());
}
@@ -565,43 +567,26 @@ void tst_qdeclarativetextedit::selection()
QVERIFY(textEditObject->selectionEnd() == 0);
QVERIFY(textEditObject->selectedText().isNull());
- for(int i=0; i< testStr.size(); i++) {
- textEditObject->setSelectionStart(i);
- QCOMPARE(textEditObject->selectionEnd(), i);
- QCOMPARE(testStr.mid(i,0), textEditObject->selectedText());
- textEditObject->setSelectionEnd(i+1);
- QCOMPARE(textEditObject->selectionStart(), i);
- QCOMPARE(testStr.mid(i,1), textEditObject->selectedText());
- }
-
- for(int i= testStr.size() - 1; i>0; i--) {
- textEditObject->setSelectionEnd(i);
- QCOMPARE(testStr.mid(i,0), textEditObject->selectedText());
- textEditObject->setSelectionStart(i-1);
- QCOMPARE(testStr.mid(i-1,1), textEditObject->selectedText());
- }
-
//Test Error Ignoring behaviour
textEditObject->setCursorPosition(0);
QVERIFY(textEditObject->selectedText().isNull());
- textEditObject->setSelectionStart(-10);
+ textEditObject->select(-10,0);
QVERIFY(textEditObject->selectedText().isNull());
- textEditObject->setSelectionStart(100);
+ textEditObject->select(100,101);
QVERIFY(textEditObject->selectedText().isNull());
- textEditObject->setSelectionEnd(-10);
+ textEditObject->select(0,-10);
QVERIFY(textEditObject->selectedText().isNull());
- textEditObject->setSelectionEnd(100);
+ textEditObject->select(0,100);
QVERIFY(textEditObject->selectedText().isNull());
- textEditObject->setSelectionStart(0);
- textEditObject->setSelectionEnd(10);
+ textEditObject->select(0,10);
QVERIFY(textEditObject->selectedText().size() == 10);
- textEditObject->setSelectionStart(-10);
+ textEditObject->select(-10,0);
QVERIFY(textEditObject->selectedText().size() == 10);
- textEditObject->setSelectionStart(100);
+ textEditObject->select(100,101);
QVERIFY(textEditObject->selectedText().size() == 10);
- textEditObject->setSelectionEnd(-10);
+ textEditObject->select(0,-10);
QVERIFY(textEditObject->selectedText().size() == 10);
- textEditObject->setSelectionEnd(100);
+ textEditObject->select(0,100);
QVERIFY(textEditObject->selectedText().size() == 10);
}
@@ -834,14 +819,14 @@ public:
bool closeInputPanelReceived;
};
-void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent()
+void tst_qdeclarativetextedit::openInputPanelOnClick()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
MyInputContext ic;
view.setInputContext(&ic);
QDeclarativeTextEdit edit;
- QSignalSpy inputPanelonFocusSpy(&edit, SIGNAL(showInputPanelOnFocusChanged(bool)));
+ QSignalSpy focusOnPressSpy(&edit, SIGNAL(focusOnPressChanged(bool)));
edit.setText("Hello world");
edit.setPos(0, 0);
scene.addItem(&edit);
@@ -851,7 +836,58 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent()
QTest::qWaitForWindowShown(&view);
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
- QVERIFY(edit.showInputPanelOnFocus());
+ QDeclarativeItemPrivate* pri = QDeclarativeItemPrivate::get(&edit);
+ QDeclarativeTextEditPrivate *editPrivate = static_cast<QDeclarativeTextEditPrivate*>(pri);
+
+ // input panel on click
+ editPrivate->showInputPanelOnFocus = false;
+
+ QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
+ view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos()));
+ QApplication::processEvents();
+ if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) {
+ QCOMPARE(ic.openInputPanelReceived, false);
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos()));
+ QApplication::processEvents();
+ QCOMPARE(ic.openInputPanelReceived, true);
+ } else if (behavior == QStyle::RSIP_OnMouseClick) {
+ QCOMPARE(ic.openInputPanelReceived, true);
+ }
+ ic.openInputPanelReceived = false;
+
+ // focus should not cause input panels to open or close
+ edit.setFocus(false);
+ edit.setFocus(true);
+ edit.setFocus(false);
+ edit.setFocus(true);
+ edit.setFocus(false);
+ QCOMPARE(ic.openInputPanelReceived, false);
+ QCOMPARE(ic.closeInputPanelReceived, false);
+}
+
+void tst_qdeclarativetextedit::openInputPanelOnFocus()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ MyInputContext ic;
+ view.setInputContext(&ic);
+ QDeclarativeTextEdit edit;
+ QSignalSpy focusOnPressSpy(&edit, SIGNAL(focusOnPressChanged(bool)));
+ edit.setText("Hello world");
+ edit.setPos(0, 0);
+ scene.addItem(&edit);
+ view.show();
+ qApp->setAutoSipEnabled(true);
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+
+ QDeclarativeItemPrivate* pri = QDeclarativeItemPrivate::get(&edit);
+ QDeclarativeTextEditPrivate *editPrivate = static_cast<QDeclarativeTextEditPrivate*>(pri);
+ editPrivate->showInputPanelOnFocus = true;
+
+ QVERIFY(edit.focusOnPress());
QCOMPARE(ic.openInputPanelReceived, false);
QCOMPARE(ic.closeInputPanelReceived, false);
@@ -884,9 +920,9 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent()
QCOMPARE(ic.closeInputPanelReceived, true);
ic.closeInputPanelReceived = false;
- // no input panel events if showInputPanelOnFocus is false
- edit.setShowInputPanelOnFocus(false);
- QCOMPARE(inputPanelonFocusSpy.count(),1);
+ // no automatic input panel events if focusOnPress is false
+ edit.setFocusOnPress(false);
+ QCOMPARE(focusOnPressSpy.count(),1);
QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos()));
QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos()));
edit.setFocus(false);
@@ -894,8 +930,8 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent()
QCOMPARE(ic.openInputPanelReceived, false);
QCOMPARE(ic.closeInputPanelReceived, false);
- edit.setShowInputPanelOnFocus(false);
- QCOMPARE(inputPanelonFocusSpy.count(),1);
+ edit.setFocusOnPress(false);
+ QCOMPARE(focusOnPressSpy.count(),1);
// one show input panel event when openSoftwareInputPanel is called
edit.openSoftwareInputPanel();
@@ -909,14 +945,17 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent()
QCOMPARE(ic.closeInputPanelReceived, true);
ic.openInputPanelReceived = false;
- // set showInputPanelOnFocus back to true
- edit.setShowInputPanelOnFocus(true);
- QCOMPARE(inputPanelonFocusSpy.count(),2);
+ // set focusOnPress back to true
+ edit.setFocusOnPress(true);
+ QCOMPARE(focusOnPressSpy.count(),2);
edit.setFocus(false);
QCOMPARE(ic.openInputPanelReceived, false);
QCOMPARE(ic.closeInputPanelReceived, true);
ic.closeInputPanelReceived = false;
+ edit.setFocusOnPress(true);
+ QCOMPARE(focusOnPressSpy.count(),2);
+
// active window focus reason should not cause input panel to open
QGraphicsObject * editObject = qobject_cast<QGraphicsObject*>(&edit);
editObject->setFocus(Qt::ActiveWindowFocusReason);
@@ -927,9 +966,6 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent()
edit.setFocus(true);
QCOMPARE(ic.openInputPanelReceived, false);
QCOMPARE(ic.closeInputPanelReceived, false);
-
- edit.setShowInputPanelOnFocus(true);
- QCOMPARE(inputPanelonFocusSpy.count(),2);
}
void tst_qdeclarativetextedit::geometrySignals()
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/positionAt.qml b/tests/auto/declarative/qdeclarativetextinput/data/positionAt.qml
new file mode 100644
index 0000000..2800351
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/positionAt.qml
@@ -0,0 +1,8 @@
+import Qt 4.7
+
+TextInput{
+ focus: true
+ objectName: "myInput"
+ width: 50
+ text: "This is a long piece of text"
+}
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index c01cfa5..3cb4da0 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -45,6 +45,7 @@
#include <QFile>
#include <QtDeclarative/qdeclarativeview.h>
#include <private/qdeclarativetextinput_p.h>
+#include <private/qdeclarativetextinput_p_p.h>
#include <QDebug>
#include <QStyle>
#include <QInputContext>
@@ -63,6 +64,8 @@ private slots:
void color();
void selection();
+ void positionAt();
+
void maxLength();
void masks();
void validators();
@@ -72,7 +75,8 @@ private slots:
void navigation();
void readOnly();
- void sendRequestSoftwareInputPanelEvent();
+ void openInputPanelOnClick();
+ void openInputPanelOnFocus();
void setHAlignClearCache();
void focusOutClearSelection();
@@ -322,11 +326,11 @@ void tst_qdeclarativetextinput::selection()
//Test selection
for(int i=0; i<= testStr.size(); i++) {
- textinputObject->setSelectionEnd(i);
+ textinputObject->select(0,i);
QCOMPARE(testStr.mid(0,i), textinputObject->selectedText());
}
for(int i=0; i<= testStr.size(); i++) {
- textinputObject->setSelectionStart(i);
+ textinputObject->select(i,testStr.size());
QCOMPARE(testStr.mid(i,testStr.size()-i), textinputObject->selectedText());
}
@@ -336,48 +340,72 @@ void tst_qdeclarativetextinput::selection()
QVERIFY(textinputObject->selectionEnd() == 0);
QVERIFY(textinputObject->selectedText().isNull());
- for(int i=0; i< testStr.size(); i++) {
- textinputObject->setSelectionStart(i);
- QCOMPARE(textinputObject->selectionEnd(), i);
- QCOMPARE(testStr.mid(i,0), textinputObject->selectedText());
- textinputObject->setSelectionEnd(i+1);
- QCOMPARE(textinputObject->selectionStart(), i);
- QCOMPARE(testStr.mid(i,1), textinputObject->selectedText());
- }
-
- for(int i= testStr.size() - 1; i>0; i--) {
- textinputObject->setSelectionEnd(i);
- QCOMPARE(testStr.mid(i,0), textinputObject->selectedText());
- textinputObject->setSelectionStart(i-1);
- QCOMPARE(testStr.mid(i-1,1), textinputObject->selectedText());
- }
-
//Test Error Ignoring behaviour
textinputObject->setCursorPosition(0);
QVERIFY(textinputObject->selectedText().isNull());
- textinputObject->setSelectionStart(-10);
+ textinputObject->select(-10,0);
QVERIFY(textinputObject->selectedText().isNull());
- textinputObject->setSelectionStart(100);
+ textinputObject->select(100,110);
QVERIFY(textinputObject->selectedText().isNull());
- textinputObject->setSelectionEnd(-10);
+ textinputObject->select(0,-10);
QVERIFY(textinputObject->selectedText().isNull());
- textinputObject->setSelectionEnd(100);
+ textinputObject->select(0,100);
QVERIFY(textinputObject->selectedText().isNull());
- textinputObject->setSelectionStart(0);
- textinputObject->setSelectionEnd(10);
+ textinputObject->select(0,10);
QVERIFY(textinputObject->selectedText().size() == 10);
- textinputObject->setSelectionStart(-10);
+ textinputObject->select(-10,10);
QVERIFY(textinputObject->selectedText().size() == 10);
- textinputObject->setSelectionStart(100);
+ textinputObject->select(100,101);
QVERIFY(textinputObject->selectedText().size() == 10);
- textinputObject->setSelectionEnd(-10);
+ textinputObject->select(0,-10);
QVERIFY(textinputObject->selectedText().size() == 10);
- textinputObject->setSelectionEnd(100);
+ textinputObject->select(0,100);
QVERIFY(textinputObject->selectedText().size() == 10);
delete textinputObject;
}
+void tst_qdeclarativetextinput::positionAt()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml");
+ QVERIFY(canvas->rootObject() != 0);
+ canvas->show();
+ canvas->setFocus();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+
+ QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject());
+ QVERIFY(textinputObject != 0);
+
+ // Check autoscrolled...
+ QFontMetrics fm(textinputObject->font());
+
+ int pos = textinputObject->positionAt(textinputObject->width()/2);
+ int diff = abs(fm.width(textinputObject->text()) - (fm.width(textinputObject->text().left(pos))+textinputObject->width()/2));
+
+ // some tollerance for different fonts.
+#ifdef Q_OS_LINUX
+ QVERIFY(diff < 2);
+#else
+ QVERIFY(diff < 5);
+#endif
+
+ // Check without autoscroll...
+ QEXPECT_FAIL("", "QTBUG-11127", Abort);
+ textinputObject->setAutoScroll(false);
+ pos = textinputObject->positionAt(textinputObject->width()/2);
+ diff = abs(fm.width(textinputObject->text().left(pos))-textinputObject->width()/2);
+
+ // some tollerance for different fonts.
+#ifdef Q_OS_LINUX
+ QVERIFY(diff < 2);
+#else
+ QVERIFY(diff < 5);
+#endif
+
+ delete canvas;
+}
+
void tst_qdeclarativetextinput::maxLength()
{
//QString componentStr = "import Qt 4.7\nTextInput { maximumLength: 10; }";
@@ -565,8 +593,7 @@ void tst_qdeclarativetextinput::navigation()
QVERIFY(input->hasFocus() == true);
//QT-2944: If text is selected, ensure we deselect upon cursor motion
input->setCursorPosition(input->text().length());
- input->setSelectionStart(0);
- input->setSelectionEnd(input->text().length());
+ input->select(0,input->text().length());
QVERIFY(input->selectionStart() != input->selectionEnd());
simulateKey(canvas, Qt::Key_Right);
QVERIFY(input->selectionStart() == input->selectionEnd());
@@ -603,13 +630,13 @@ void tst_qdeclarativetextinput::cursorDelegate()
//Test Delegate gets moved
for(int i=0; i<= textInputObject->text().length(); i++){
textInputObject->setCursorPosition(i);
- //+5 is because the TextInput cursorRect is just a 10xHeight area centered on cursor position
- QCOMPARE(textInputObject->cursorRect().x() + 5, qRound(delegateObject->x()));
- QCOMPARE(textInputObject->cursorRect().y(), qRound(delegateObject->y()));
+ //+5 is because the TextInput cursorRectangle is just a 10xHeight area centered on cursor position
+ QCOMPARE(textInputObject->cursorRectangle().x() + 5, qRound(delegateObject->x()));
+ QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y()));
}
textInputObject->setCursorPosition(0);
- QCOMPARE(textInputObject->cursorRect().x()+5, qRound(delegateObject->x()));
- QCOMPARE(textInputObject->cursorRect().y(), qRound(delegateObject->y()));
+ QCOMPARE(textInputObject->cursorRectangle().x()+5, qRound(delegateObject->x()));
+ QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y()));
//Test Delegate gets deleted
textInputObject->setCursorDelegate(0);
QVERIFY(!textInputObject->findChild<QDeclarativeItem*>("cursorInstance"));
@@ -738,14 +765,61 @@ public:
bool closeInputPanelReceived;
};
-void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent()
+void tst_qdeclarativetextinput::openInputPanelOnClick()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ MyInputContext ic;
+ view.setInputContext(&ic);
+ QDeclarativeTextInput input;
+ QSignalSpy focusOnPressSpy(&input, SIGNAL(focusOnPressChanged(bool)));
+ input.setText("Hello world");
+ input.setPos(0, 0);
+ scene.addItem(&input);
+ view.show();
+ qApp->setAutoSipEnabled(true);
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+
+ QDeclarativeItemPrivate* pri = QDeclarativeItemPrivate::get(&input);
+ QDeclarativeTextInputPrivate *inputPrivate = static_cast<QDeclarativeTextInputPrivate*>(pri);
+
+ // input panel on click
+ inputPrivate->showInputPanelOnFocus = false;
+
+ QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
+ view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos()));
+ QApplication::processEvents();
+ if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) {
+ QCOMPARE(ic.openInputPanelReceived, false);
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos()));
+ QApplication::processEvents();
+ QCOMPARE(ic.openInputPanelReceived, true);
+ } else if (behavior == QStyle::RSIP_OnMouseClick) {
+ QCOMPARE(ic.openInputPanelReceived, true);
+ }
+ ic.openInputPanelReceived = false;
+
+ // focus should not cause input panels to open or close
+ input.setFocus(false);
+ input.setFocus(true);
+ input.setFocus(false);
+ input.setFocus(true);
+ input.setFocus(false);
+ QCOMPARE(ic.openInputPanelReceived, false);
+ QCOMPARE(ic.closeInputPanelReceived, false);
+}
+
+void tst_qdeclarativetextinput::openInputPanelOnFocus()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
MyInputContext ic;
view.setInputContext(&ic);
QDeclarativeTextInput input;
- QSignalSpy inputPanelonFocusSpy(&input, SIGNAL(showInputPanelOnFocusChanged(bool)));
+ QSignalSpy focusOnPressSpy(&input, SIGNAL(focusOnPressChanged(bool)));
input.setText("Hello world");
input.setPos(0, 0);
scene.addItem(&input);
@@ -755,7 +829,11 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent()
QTest::qWaitForWindowShown(&view);
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
- QVERIFY(input.showInputPanelOnFocus());
+ QDeclarativeItemPrivate* pri = QDeclarativeItemPrivate::get(&input);
+ QDeclarativeTextInputPrivate *inputPrivate = static_cast<QDeclarativeTextInputPrivate*>(pri);
+ inputPrivate->showInputPanelOnFocus = true;
+
+ QVERIFY(input.focusOnPress());
QCOMPARE(ic.openInputPanelReceived, false);
QCOMPARE(ic.closeInputPanelReceived, false);
@@ -788,9 +866,9 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent()
QCOMPARE(ic.closeInputPanelReceived, true);
ic.closeInputPanelReceived = false;
- // no input panel events if showInputPanelOnFocus is false
- input.setShowInputPanelOnFocus(false);
- QCOMPARE(inputPanelonFocusSpy.count(),1);
+ // no automatic input panel events if focusOnPress is false
+ input.setFocusOnPress(false);
+ QCOMPARE(focusOnPressSpy.count(),1);
QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos()));
QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos()));
input.setFocus(false);
@@ -798,8 +876,8 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent()
QCOMPARE(ic.openInputPanelReceived, false);
QCOMPARE(ic.closeInputPanelReceived, false);
- input.setShowInputPanelOnFocus(false);
- QCOMPARE(inputPanelonFocusSpy.count(),1);
+ input.setFocusOnPress(false);
+ QCOMPARE(focusOnPressSpy.count(),1);
// one show input panel event when openSoftwareInputPanel is called
input.openSoftwareInputPanel();
@@ -813,14 +891,17 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent()
QCOMPARE(ic.closeInputPanelReceived, true);
ic.openInputPanelReceived = false;
- // set showInputPanelOnFocus back to true
- input.setShowInputPanelOnFocus(true);
- QCOMPARE(inputPanelonFocusSpy.count(),2);
+ // set focusOnPress back to true
+ input.setFocusOnPress(true);
+ QCOMPARE(focusOnPressSpy.count(),2);
input.setFocus(false);
QCOMPARE(ic.openInputPanelReceived, false);
QCOMPARE(ic.closeInputPanelReceived, true);
ic.closeInputPanelReceived = false;
+ input.setFocusOnPress(true);
+ QCOMPARE(focusOnPressSpy.count(),2);
+
// active window focus reason should not cause input panel to open
QGraphicsObject * inputObject = qobject_cast<QGraphicsObject*>(&input);
inputObject->setFocus(Qt::ActiveWindowFocusReason);
@@ -831,9 +912,6 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent()
input.setFocus(true);
QCOMPARE(ic.openInputPanelReceived, false);
QCOMPARE(ic.closeInputPanelReceived, false);
-
- input.setShowInputPanelOnFocus(true);
- QCOMPARE(inputPanelonFocusSpy.count(),2);
}
class MyTextInput : public QDeclarativeTextInput
@@ -881,8 +959,7 @@ void tst_qdeclarativetextinput::focusOutClearSelection()
view.show();
QApplication::setActiveWindow(&view);
QTest::qWaitForWindowShown(&view);
- input.setSelectionStart(2);
- input.setSelectionEnd(5);
+ input.select(2,5);
//The selection should work
QTRY_COMPARE(input.selectedText(), QLatin1String("llo"));
input2.setFocus(true);
diff --git a/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml b/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml
index 687fac6..be911a3 100644
--- a/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml
+++ b/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml
@@ -1,10 +1,19 @@
import Qt 4.7
Rectangle {
color: "black"
- width: (runtime.orientation == Orientation.Landscape) ? 300 : 200
- height: (runtime.orientation == Orientation.Landscape) ? 200 : 300
+ width: (runtime.orientation == Orientation.RightUp || runtime.orientation == Orientation.LeftUp) ? 300 : 200
+ height: (runtime.orientation == Orientation.RightUp || runtime.orientation == Orientation.LeftUp) ? 200 : 300
Text {
- text: runtime.orientation == Orientation.Landscape ? "Landscape" : "Portrait"
+ text: {
+ if (runtime.orientation == Orientation.TopUp)
+ return "TopUp"
+ if (runtime.orientation == Orientation.TopDown)
+ return "TopDown"
+ if (runtime.orientation == Orientation.LeftUp)
+ return "LeftUp"
+ if (runtime.orientation == Orientation.RightUp)
+ return "RightUp"
+ }
color: "white"
}
-} \ No newline at end of file
+}
diff --git a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp
index 9429dc9..f296d9e 100644
--- a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp
+++ b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp
@@ -82,7 +82,7 @@ void tst_QDeclarativeViewer::orientation()
QCOMPARE(viewer->size(), QSize(200, 300+viewer->menuBar()->height()));
QCOMPARE(viewer->size(), viewer->sizeHint());
- viewer->toggleOrientation();
+ viewer->rotateOrientation();
qApp->processEvents();
QCOMPARE(rootItem->width(), 300.0);
@@ -92,7 +92,7 @@ void tst_QDeclarativeViewer::orientation()
QCOMPARE(viewer->size(), QSize(300, 200+viewer->menuBar()->height()));
QCOMPARE(viewer->size(), viewer->sizeHint());
- viewer->toggleOrientation();
+ viewer->rotateOrientation();
qApp->processEvents();
QCOMPARE(rootItem->width(), 200.0);
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml
index 0273282..53538cb 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml
+++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml
@@ -65,8 +65,7 @@ Item {
onReleased: {
}
onDoubleClicked: {
- textEdit.selectionStart=0;
- textEdit.selectionEnd=textEdit.text.length;
+ textEdit.selectAll()
}
z: textEdit.z + 1
}
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml
index cc0ad3c..69f57c6 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml
+++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml
@@ -58,8 +58,7 @@ Item {
onReleased: {
}
onDoubleClicked: {
- textInp.selectionStart=0;
- textInp.selectionEnd=textInp.text.length;
+ textInp.selectAll()
}
z: textInp.z + 1
}
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp
index c7801ac..1d166f4 100644
--- a/tests/auto/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/qstatictext/tst_qstatictext.cpp
@@ -324,8 +324,7 @@ bool tst_QStaticText::supportsTransformations() const
QPaintEngine::Type type = engine->type();
- if (type == QPaintEngine::OpenGL2
- || type == QPaintEngine::OpenGL
+ if (type == QPaintEngine::OpenGL
#if !defined Q_WS_WIN
|| type == QPaintEngine::Raster
#endif
@@ -471,7 +470,7 @@ void tst_QStaticText::transformationChanged()
p.drawText(QRectF(0, 0, 1000, 1000), 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
- p.scale(7.0, 5.0);
+ p.scale(2.0, 2.5);
p.drawText(QRectF(0, 0, 1000, 1000), 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
}
@@ -487,7 +486,7 @@ void tst_QStaticText::transformationChanged()
p.drawStaticText(QPointF(0, 0), text);
- p.scale(7.0, 5.0);
+ p.scale(2.0, 2.5);
p.drawStaticText(QPointF(0, 0), text);
}
diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp
index d44ce72..99babac 100644
--- a/tests/auto/qtextcursor/tst_qtextcursor.cpp
+++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp
@@ -226,9 +226,9 @@ void tst_QTextCursor::navigation1()
cursor.movePosition(QTextCursor::End);
cursor.insertBlock();
{
- int oldPos = cursor.position();
- cursor.movePosition(QTextCursor::End);
- QVERIFY(cursor.position() == oldPos);
+ int oldPos = cursor.position();
+ cursor.movePosition(QTextCursor::End);
+ QVERIFY(cursor.position() == oldPos);
}
QVERIFY(cursor.atBlockStart());
QVERIFY(cursor.position() == 9);
@@ -1699,8 +1699,10 @@ void tst_QTextCursor::adjustCursorsOnInsert()
QCOMPARE(selection.position(), posAfter+1);
doc->undo();
+ selection.setKeepPositionOnInsert(true);
cursor.setPosition(posAfter);
cursor.insertText(QLatin1String("x"));
+ selection.setKeepPositionOnInsert(false);
QCOMPARE(selection.anchor(), posBefore);
QCOMPARE(selection.position(), posAfter);
doc->undo();
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index caf9bd3..1a5f493 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -110,6 +110,8 @@ private slots:
void longText();
void widthOfTabs();
void columnWrapWithTabs();
+ void boundingRectForUnsetLineWidth();
+ void boundingRectForSetLineWidth();
// QTextLine stuff
void setNumColumnsWrapAtWordBoundaryOrAnywhere();
@@ -1307,6 +1309,29 @@ void tst_QTextLayout::columnWrapWithTabs()
}
+void tst_QTextLayout::boundingRectForUnsetLineWidth()
+{
+ QTextLayout layout("FOOBAR");
+
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ QCOMPARE(layout.boundingRect().width(), line.naturalTextWidth());
+}
+
+void tst_QTextLayout::boundingRectForSetLineWidth()
+{
+ QTextLayout layout("FOOBAR");
+
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ line.setLineWidth(QFIXED_MAX - 1);
+ layout.endLayout();
+
+ QCOMPARE(layout.boundingRect().width(), qreal(QFIXED_MAX - 1));
+}
+
void tst_QTextLayout::lineWidthFromBOM()
{
const QString string(QChar(0xfeff)); // BYTE ORDER MARK
diff --git a/tools/assistant/tools/assistant/doc/images/assistant-assistant.png b/tools/assistant/tools/assistant/doc/images/assistant-assistant.png
index b825de0..1ff5cc9 100644
--- a/tools/assistant/tools/assistant/doc/images/assistant-assistant.png
+++ b/tools/assistant/tools/assistant/doc/images/assistant-assistant.png
Binary files differ
diff --git a/tools/porting/src/codemodel.h b/tools/porting/src/codemodel.h
index cb3088f..04ad178 100644
--- a/tools/porting/src/codemodel.h
+++ b/tools/porting/src/codemodel.h
@@ -96,7 +96,7 @@ class Collection: public QMultiHash<QByteArray, CollectedType *>
{
public:
void add(CollectedType *collectedItem)
- { insert(collectedItem->name(), collectedItem); }
+ { this->insert(collectedItem->name(), collectedItem); }
};
typedef Collection<Scope> ScopeCollection;
diff --git a/tools/qml/deviceorientation.cpp b/tools/qml/deviceorientation.cpp
index e7c70d5..a13b912 100644
--- a/tools/qml/deviceorientation.cpp
+++ b/tools/qml/deviceorientation.cpp
@@ -47,7 +47,7 @@ class DefaultDeviceOrientation : public DeviceOrientation
{
Q_OBJECT
public:
- DefaultDeviceOrientation() : DeviceOrientation(), m_orientation(DeviceOrientation::Portrait) {}
+ DefaultDeviceOrientation() : DeviceOrientation(), m_orientation(DeviceOrientation::TopUp) {}
Orientation orientation() const {
return m_orientation;
diff --git a/tools/qml/deviceorientation.h b/tools/qml/deviceorientation.h
index d209005..fe73868 100644
--- a/tools/qml/deviceorientation.h
+++ b/tools/qml/deviceorientation.h
@@ -52,7 +52,14 @@ class DeviceOrientation : public QObject
Q_OBJECT
Q_ENUMS(Orientation)
public:
- enum Orientation { UnknownOrientation, Portrait, Landscape };
+ enum Orientation {
+ UnknownOrientation,
+ TopUp,
+ TopDown,
+ LeftUp,
+ RightUp
+ };
+
virtual Orientation orientation() const = 0;
virtual void setOrientation(Orientation) = 0;
diff --git a/tools/qml/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo.cpp
index 9f12f3d..501ff79 100644
--- a/tools/qml/deviceorientation_maemo.cpp
+++ b/tools/qml/deviceorientation_maemo.cpp
@@ -48,11 +48,11 @@ class MaemoOrientation : public DeviceOrientation
Q_OBJECT
public:
MaemoOrientation()
- : DeviceOrientation(),m_current(Portrait), m_lastSeen(Portrait), m_lastSeenCount(0)
+ : DeviceOrientation(),m_current(TopUp), m_lastSeen(TopUp), m_lastSeenCount(0)
{
m_current = get();
if (m_current == UnknownOrientation)
- m_current = Portrait;
+ m_current = TopUp;
startTimer(100);
}
@@ -101,9 +101,13 @@ private:
if (abs(az) > 850) {
o = UnknownOrientation;
} else if (ax < -750) {
- o = Portrait;
+ o = LeftUp;
+ } else if (ax > 750) {
+ o = RightUp;
} else if (ay < -750) {
- o = Landscape;
+ o = TopUp;
+ } else if (ay > 750) {
+ o = TopDown;
}
return o;
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index fe323c1..f681303 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -367,7 +367,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
#endif
, loggerWindow(new LoggerWidget())
, frame_stream(0), mb(0)
- , portraitOrientation(0), landscapeOrientation(0)
+ , orientation(0)
, showWarningsWindow(0)
, m_scriptOptions(0)
, tester(0)
@@ -418,7 +418,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
if (!(flags & Qt::FramelessWindowHint)) {
createMenu(menuBar(),0);
- setPortrait();
+ changeOrientation(orientation->actions().value(0));
}
#if !defined(Q_OS_SYMBIAN)
@@ -571,26 +571,25 @@ void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu)
QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties"));
- QActionGroup *orientation = new QActionGroup(parent);
+ orientation = new QActionGroup(parent);
- QAction *toggleOrientation = new QAction(tr("&Toggle Orientation"), parent);
- toggleOrientation->setCheckable(true);
- toggleOrientation->setShortcut(QKeySequence("Ctrl+T"));
- settingsMenu->addAction(toggleOrientation);
- connect(toggleOrientation, SIGNAL(triggered()), this, SLOT(toggleOrientation()));
+ QAction *rotateOrientation = new QAction(tr("Rotate orientation"), parent);
+ rotateOrientation->setShortcut(QKeySequence("Ctrl+T"));
+ settingsMenu->addAction(rotateOrientation);
+ connect(rotateOrientation, SIGNAL(triggered()), this, SLOT(rotateOrientation()));
orientation->setExclusive(true);
- portraitOrientation = new QAction(tr("orientation: Portrait"), parent);
- portraitOrientation->setCheckable(true);
- connect(portraitOrientation, SIGNAL(triggered()), this, SLOT(setPortrait()));
- orientation->addAction(portraitOrientation);
- propertiesMenu->addAction(portraitOrientation);
-
- landscapeOrientation = new QAction(tr("orientation: Landscape"), parent);
- landscapeOrientation->setCheckable(true);
- connect(landscapeOrientation, SIGNAL(triggered()), this, SLOT(setLandscape()));
- orientation->addAction(landscapeOrientation);
- propertiesMenu->addAction(landscapeOrientation);
+ connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*)));
+
+ orientation->addAction(tr("orientation: TopUp"));
+ orientation->addAction(tr("orientation: LeftUp"));
+ orientation->addAction(tr("orientation: TopDown"));
+ orientation->addAction(tr("orientation: RightUp"));
+ QList<QAction *> actions = orientation->actions();
+ for (int i=0; i<actions.count(); i++) {
+ propertiesMenu->addAction(actions[i]);
+ actions[i]->setCheckable(true);
+ }
if (flatmenu) flatmenu->addSeparator();
@@ -624,21 +623,16 @@ void QDeclarativeViewer::proxySettingsChanged()
reload ();
}
-void QDeclarativeViewer::setPortrait()
-{
- DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait);
- portraitOrientation->setChecked(true);
-}
-
-void QDeclarativeViewer::setLandscape()
+void QDeclarativeViewer::rotateOrientation()
{
- DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape);
- landscapeOrientation->setChecked(true);
-}
+ QAction *current = orientation->checkedAction();
+ QList<QAction *> actions = orientation->actions();
+ int index = actions.indexOf(current);
+ if (index < 0)
+ return;
-void QDeclarativeViewer::toggleOrientation()
-{
- DeviceOrientation::instance()->setOrientation(DeviceOrientation::instance()->orientation()==DeviceOrientation::Portrait?DeviceOrientation::Landscape:DeviceOrientation::Portrait);
+ QAction *newOrientation = actions[(index + 1) % actions.count()];
+ changeOrientation(newOrientation);
}
void QDeclarativeViewer::toggleFullScreen()
@@ -971,12 +965,7 @@ void QDeclarativeViewer::keyPressEvent(QKeyEvent *event)
} else if (event->key() == Qt::Key_F9 || (event->key() == Qt::Key_9 && devicemode)) {
toggleRecording();
} else if (event->key() == Qt::Key_F10) {
- if (portraitOrientation) {
- if (portraitOrientation->isChecked())
- setLandscape();
- else
- setPortrait();
- }
+ rotateOrientation();
}
QWidget::keyPressEvent(event);
@@ -1181,6 +1170,23 @@ void QDeclarativeViewer::recordFrame()
}
}
+void QDeclarativeViewer::changeOrientation(QAction *action)
+{
+ if (!action)
+ return;
+ action->setChecked(true);
+
+ QString o = action->text().split(QLatin1Char(':')).value(1).trimmed();
+ if (o == QLatin1String("TopUp"))
+ DeviceOrientation::instance()->setOrientation(DeviceOrientation::TopUp);
+ else if (o == QLatin1String("TopDown"))
+ DeviceOrientation::instance()->setOrientation(DeviceOrientation::TopDown);
+ else if (o == QLatin1String("LeftUp"))
+ DeviceOrientation::instance()->setOrientation(DeviceOrientation::LeftUp);
+ else if (o == QLatin1String("RightUp"))
+ DeviceOrientation::instance()->setOrientation(DeviceOrientation::RightUp);
+}
+
void QDeclarativeViewer::orientationChanged()
{
if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) {
diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h
index 5086e02..27bd217 100644
--- a/tools/qml/qmlruntime.h
+++ b/tools/qml/qmlruntime.h
@@ -124,7 +124,7 @@ public slots:
void ffmpegFinished(int code);
void showProxySettings ();
void proxySettingsChanged ();
- void toggleOrientation();
+ void rotateOrientation();
void statusChanged();
void setSlowMode(bool);
void launch(const QString &);
@@ -140,9 +140,8 @@ private slots:
void recordFrame();
void chooseRecordingOptions();
void pickRecordingFile();
- void setPortrait();
- void setLandscape();
void toggleFullScreen();
+ void changeOrientation(QAction*);
void orientationChanged();
void showWarnings(bool show);
@@ -183,9 +182,7 @@ private:
bool ffmpegAvailable;
bool convertAvailable;
- QAction *portraitOrientation;
- QAction *landscapeOrientation;
-
+ QActionGroup *orientation;
QAction *showWarningsWindow;
QString m_script;