summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2010-12-15 13:16:24 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2010-12-15 13:16:24 (GMT)
commit1c1d3e79e1b7cb2cdffaee38a98bc777e3a7b961 (patch)
tree5c33473950b22db0a0eb9c230005cd8e7f251538
parentcace8e6a9f00ee478dfe63a7fa6959056cfe7e8a (diff)
parent0c6780c39d18a4fd06b9bed94400de365a518c45 (diff)
downloadQt-1c1d3e79e1b7cb2cdffaee38a98bc777e3a7b961.zip
Qt-1c1d3e79e1b7cb2cdffaee38a98bc777e3a7b961.tar.gz
Qt-1c1d3e79e1b7cb2cdffaee38a98bc777e3a7b961.tar.bz2
Merge branch '4.7' into mimir
-rwxr-xr-xconfigure7
-rw-r--r--doc/src/declarative/anchor-layout.qdoc66
-rw-r--r--doc/src/declarative/declarativeui.qdoc1
-rw-r--r--doc/src/declarative/extending.qdoc4
-rw-r--r--doc/src/declarative/javascriptblocks.qdoc30
-rw-r--r--doc/src/declarative/qtbinding.qdoc34
-rw-r--r--doc/src/examples/diagramscene.qdoc2
-rw-r--r--doc/src/snippets/declarative/integrating-javascript/includejs/app.qml56
-rw-r--r--doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js49
-rw-r--r--doc/src/snippets/declarative/integrating-javascript/includejs/script.js48
-rw-r--r--doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml54
-rw-r--r--doc/src/snippets/declarative/qtbinding/variantlistmap/main.cpp67
-rw-r--r--doc/src/snippets/declarative/qtbinding/variantlistmap/variantlistmap.pro2
-rw-r--r--mkspecs/common/symbian/symbian.conf2
-rw-r--r--qmake/project.cpp4
-rw-r--r--src/3rdparty/phonon/mmf/abstractaudioeffect.h2
-rw-r--r--src/3rdparty/phonon/mmf/audioequalizer.cpp2
-rw-r--r--src/3rdparty/phonon/mmf/bassboost.cpp2
-rw-r--r--src/3rdparty/phonon/mmf/environmentalreverb.cpp2
-rw-r--r--src/3rdparty/phonon/mmf/loudness.cpp2
-rw-r--r--src/3rdparty/phonon/mmf/stereowidening.cpp2
-rw-r--r--src/corelib/global/qendian.h5
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp52
-rw-r--r--src/corelib/tools/qsimd.cpp14
-rw-r--r--src/declarative/declarative.pro1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp14
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h10
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp36
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp28
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp27
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp8
-rw-r--r--src/declarative/qml/qdeclarativeinclude.cpp24
-rw-r--r--src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp53
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp19
-rw-r--r--src/declarative/qml/qdeclarativesqldatabase.cpp26
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp4
-rw-r--r--src/gui/dialogs/dialogs.pri2
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm8
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp18
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h4
-rw-r--r--src/gui/graphicsview/qgraphicslayout.cpp7
-rw-r--r--src/gui/graphicsview/qgraphicslayoutitem.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp4
-rw-r--r--src/gui/graphicsview/qgridlayoutengine_p.h2
-rw-r--r--src/gui/image/qimage.cpp25
-rw-r--r--src/gui/image/qpixmap_raster.cpp11
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp8
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp4
-rw-r--r--src/gui/kernel/qapplication.cpp6
-rw-r--r--src/gui/kernel/qapplication_s60.cpp7
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h2
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm3
-rw-r--r--src/gui/kernel/qeventdispatcher_s60_p.h7
-rw-r--r--src/gui/kernel/qwidget_mac.mm16
-rw-r--r--src/gui/kernel/qwidget_s60.cpp4
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_p.h4
-rw-r--r--src/gui/painting/qgrayraster.c36
-rw-r--r--src/gui/painting/qpathclipper.cpp14
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp130
-rw-r--r--src/gui/text/qfontengine_s60.cpp182
-rw-r--r--src/gui/text/qfontengine_s60_p.h16
-rw-r--r--src/gui/text/qtextdocument.cpp6
-rw-r--r--src/gui/widgets/qcombobox.cpp2
-rw-r--r--src/gui/widgets/qlabel.cpp2
-rw-r--r--src/gui/widgets/qlinecontrol.cpp9
-rw-r--r--src/gui/widgets/qlinecontrol_p.h1
-rw-r--r--src/gui/widgets/qmenu.cpp5
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp4
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp80
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp19
-rw-r--r--src/opengl/qwindowsurface_gl.cpp13
-rw-r--r--src/openvg/qpaintengine_vg.cpp3
-rw-r--r--src/plugins/bearer/icd/proxyconf.cpp4
-rw-r--r--src/plugins/graphicssystems/meego/dithering.cpp11
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp9
-rw-r--r--src/plugins/phonon/mmf/mmf.pro4
-rw-r--r--src/s60installs/bwins/QtGuiu.def7
-rw-r--r--src/s60installs/eabi/QtGuiu.def7
-rw-r--r--src/s60installs/s60installs.pro2
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/forceActiveFocus.qml26
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp109
-rw-r--r--tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml4
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp15
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/displaylist.qml9
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml37
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp117
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp4
-rw-r--r--tests/auto/qapplication/modal/main.cpp1
-rw-r--r--tests/auto/qapplication/test/test.pro2
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp23
-rw-r--r--tests/auto/qimage/tst_qimage.cpp16
-rw-r--r--tests/auto/qinputcontext/qinputcontext.pro2
-rw-r--r--tests/auto/qinputcontext/tst_qinputcontext.cpp141
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp4
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp27
-rw-r--r--tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp10
-rw-r--r--tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro5
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp39
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp10
-rw-r--r--tools/configure/configureapp.cpp2
-rw-r--r--tools/linguist/linguist/messagemodel.cpp7
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h3
-rw-r--r--tools/qml/browser/Browser.qml2
-rw-r--r--tools/qml/deviceorientation.h4
-rw-r--r--tools/qml/main.cpp56
-rw-r--r--tools/qml/qdeclarativetester.cpp16
-rw-r--r--tools/qml/qdeclarativetester.h4
-rw-r--r--tools/qml/qml.pro4
-rw-r--r--tools/qml/qmlruntime.cpp4
-rw-r--r--tools/qml/startup/startup.qml6
118 files changed, 1721 insertions, 478 deletions
diff --git a/configure b/configure
index 86c14dd..7141880 100755
--- a/configure
+++ b/configure
@@ -8595,9 +8595,12 @@ for file in .projects .projects.3; do
case $a in
*winmain/winmain.pro)
- [ "$XPLATFORM_MINGW" = "yes" ] || continue
+ if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
+ continue
+ fi
SPEC=$XQMAKESPEC ;;
- *s60main/s60main.pro) if [ "$CFG_NOPROCESS" = "yes" ] || [ -z "`echo "$XPLATFORM" | grep "symbian" >/dev/null`"]; then
+ *s60main/s60main.pro)
+ if [ "$CFG_NOPROCESS" = "yes" ] || ! echo "$XPLATFORM" | grep "symbian" >/dev/null; then
continue
fi;;
*examples/activeqt/*) continue ;;
diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc
index b77ce36..f5d5697 100644
--- a/doc/src/declarative/anchor-layout.qdoc
+++ b/doc/src/declarative/anchor-layout.qdoc
@@ -30,6 +30,8 @@
\target anchor-layout
\title Anchor-based Layout in QML
+\section1 Overview
+
In addition to the more traditional \l Grid, \l Row, and \l Column,
QML also provides a way to layout items using the concept of \e anchors.
Each item can be thought of as having a set of 7 invisible "anchor lines":
@@ -54,20 +56,6 @@ In this case, the left edge of \e rect2 is bound to the right edge of \e rect1,
\image edge1.png
-The anchoring system also allows you to specify margins and offsets. Margins specify the amount of empty space to leave to the outside of an item, while offsets allow you to manipulate positioning using the center anchor lines. Note that margins specified using the anchor layout system only have meaning for anchors; they won't have any effect when using other layouts or absolute positioning.
-
-\image margins_qml.png
-
-The following example specifies a left margin:
-
-\code
-Rectangle { id: rect1; ... }
-Rectangle { id: rect2; anchors.left: rect1.right; anchors.leftMargin: 5; ... }
-\endcode
-
-In this case, a margin of 5 pixels is reserved to the left of \e rect2, producing the following:
-
-\image edge2.png
You can specify multiple anchors. For example:
@@ -78,7 +66,9 @@ Rectangle { id: rect2; anchors.left: rect1.right; anchors.top: rect1.bottom; ...
\image edge3.png
-By specifying multiple horizontal or vertical anchors you can control the size of an item. For example:
+By specifying multiple horizontal or vertical anchors you can control the size of an item. Below,
+\e rect2 is anchored to the right of \e rect1 and the left of \e rect3. If either of the blue
+rectangles are moved, \e rect2 will stretch and shrink as necessary:
\code
Rectangle { id: rect1; x: 0; ... }
@@ -88,9 +78,42 @@ Rectangle { id: rect3; x: 150; ... }
\image edge4.png
-\section1 Limitations
-For performance reasons, you can only anchor an item to its siblings and direct parent. For example, the following anchor would be considered invalid and would produce a warning:
+\section1 Anchor Margins and Offsets
+
+The anchoring system also allows \e margins and \e offsets to be specified for an item's anchors.
+Margins specify the amount of empty space to leave to the outside of an item's anchor, while
+offsets allow positioning to be manipulated using the center anchor lines. An item can
+specify its anchor margins individually through \l {Item::anchors.leftMargin}{leftMargin},
+\l {Item::anchors.rightMargin}{rightMargin}, \l {Item::anchors.topMargin}{topMargin} and
+\l {Item::anchors.bottomMargin}{bottomMargin}, or use \l {Item::}{anchors.margins} to
+specify the same margin value for all four edges. Anchor offsets are specified using
+\l {Item::anchors.horizontalCenterOffset}{horizontalCenterOffset},
+\l {Item::anchors.verticalCenterOffset}{verticalCenterOffset} and
+\l {Item::anchors.baselineOffset}{baselineOffset}.
+
+\image margins_qml.png
+
+The following example specifies a left margin:
+
+\code
+Rectangle { id: rect1; ... }
+Rectangle { id: rect2; anchors.left: rect1.right; anchors.leftMargin: 5; ... }
+\endcode
+
+In this case, a margin of 5 pixels is reserved to the left of \e rect2, producing the following:
+
+\image edge2.png
+
+\note Anchor margins only apply to anchors; they are \e not a generic means of applying margins to an \l Item.
+If an anchor margin is specified for an edge but the item is not anchored to any item on that
+edge, the margin is not applied.
+
+
+\section1 Restrictions
+
+For performance reasons, you can only anchor an item to its siblings and direct parent. For example,
+the following anchor is invalid and would produce a warning:
\badcode
Item {
@@ -103,4 +126,13 @@ Item {
}
\endcode
+Also, anchor-based layouts cannot be mixed with absolute positioning. If an item specifies its
+\l {Item::}{x} position and also sets \l {Item::}{anchors.left},
+or anchors its left and right edges but additionally sets a \l {Item::}{width}, the
+result is undefined, as it would not be clear whether the item should use anchoring or absolute
+positioning. The same can be said for setting an item's \l {Item::}{y} and \l {Item::}{height}
+with \l {Item::}{anchors.top} and \l {Item::}{anchors.bottom}, or setting \l {Item::}{anchors.fill}
+as well as \l {Item::}{width} or \l {Item::}{height}. If you wish to change from using
+anchor-based to absolute positioning, you can clear an anchor value by setting it to \c undefined.
+
*/
diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc
index 3d963e2..41b9952 100644
--- a/doc/src/declarative/declarativeui.qdoc
+++ b/doc/src/declarative/declarativeui.qdoc
@@ -108,6 +108,7 @@ Module.
\section1 Handling Data
\list
+\o \l{QML Basic Types}{QML Basic Data Types}
\o \l{Using QML Positioner and Repeater Items}
\o \l{QML Data Models}
\o \l{Presenting Data with QML}
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index fc5c586..e23ca91 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -596,10 +596,10 @@ the appropriate property on the extension object is used instead.
When an extended type is installed, one of the
\code
template<typename T, typename ExtendedT>
-int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
+int qmlRegisterExtendedType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
template<typename T, typename ExtendedT>
-int qmlRegisterType()
+int qmlRegisterExtendedType()
\endcode
functions should be used instead of the regular \c qmlRegisterType() variations.
The arguments are identical to the corresponding non-extension registration functions,
diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc
index 16d0633..155bd6e 100644
--- a/doc/src/declarative/javascriptblocks.qdoc
+++ b/doc/src/declarative/javascriptblocks.qdoc
@@ -94,9 +94,8 @@ Both relative and absolute JavaScript URLs can be imported. In the case of a
relative URL, the location is resolved relative to the location of the
\l {QML Document} that contains the import. If the script file is not accessible,
an error will occur. If the JavaScript needs to be fetched from a network
-resource, the QML document has a "Loading"
-\l {QDeclarativeComponent::status()}{status} until the script has been
-downloaded.
+resource, the component's \l {QDeclarativeComponent::status()}{status} is set to
+"Loading" until the script has been downloaded.
Imported JavaScript files are always qualified using the "as" keyword. The
qualifier for JavaScript files must be unique, so there is always a one-to-one
@@ -143,6 +142,31 @@ As they are shared, stateless library files cannot access QML component instance
objects or properties directly, although QML values can be passed as function
parameters.
+
+\section2 Importing One JavaScript File From Another
+
+If a JavaScript file needs to use functions defined inside another JavaScript file,
+the other file can be imported using the \l {QML:Qt::include()}{Qt.include()}
+function. This imports all functions from the other file into the current file's
+namespace.
+
+For example, the QML code below left calls \c showCalculations() in \c script.js,
+which in turn can call \c factorial() in \c factorial.js, as it has included
+\c factorial.js using \l {QML:Qt::include()}{Qt.include()}.
+
+\table
+\row
+\o {1,2} \snippet doc/src/snippets/declarative/integrating-javascript/includejs/app.qml 0
+\o \snippet doc/src/snippets/declarative/integrating-javascript/includejs/script.js 0
+\row
+\o \snippet doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js 0
+\endtable
+
+Notice that calling \l {QML:Qt::include()}{Qt.include()} imports all functions from
+\c factorial.js into the \c MyScript namespace, which means the QML component can also
+access \c factorial() directly as \c MyScript.factorial().
+
+
\section1 Running JavaScript at Startup
It is occasionally necessary to run some imperative code at application (or
diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc
index 71f41bc..04b8ca6 100644
--- a/doc/src/declarative/qtbinding.qdoc
+++ b/doc/src/declarative/qtbinding.qdoc
@@ -426,6 +426,7 @@ By default, QML recognizes the following data types:
\o QSize, QSizeF
\o QRect, QRectF
\o QVariant
+\o QVariantList, QVariantMap
\o QObject*
\o Enumerations declared with Q_ENUMS()
\endlist
@@ -434,6 +435,37 @@ To allow a custom C++ type to be created or used in QML, the C++ class must be r
type using qmlRegisterType(), as shown in the \l {Defining new QML elements} section above.
+\section2 JavaScript arrays and objects
+
+There is built-in support for automatic type conversion between QVariantList and JavaScript
+arrays, and QVariantMap and JavaScript objects.
+
+For example, the function defined in QML below left expects two arguments, an array and an object, and prints
+their contents using the standard JavaScript syntax for array and object item access. The C++ code
+below right calls this function, passing a QVariantList and a QVariantMap, which are automatically
+converted to JavaScript array and object values, repectively:
+
+\table
+\row
+\o \snippet doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml 0
+\o \snippet doc/src/snippets/declarative/qtbinding/variantlistmap/main.cpp 0
+\endtable
+
+This produces output like:
+
+\code
+Array item: 10
+Array item: #00ff00
+Array item: bottles
+Object item: language = QML
+Object item: released = Tue Sep 21 2010 00:00:00 GMT+1000 (EST)
+\endcode
+
+Similarly, if a C++ type uses a QVariantList or QVariantMap type for a property or method
+parameter, the value can be created as a JavaScript array or object in the QML
+side, and is automatically converted to a QVariantList or QVariantMap when it is passed to C++.
+
+
\section2 Using enumerations of a custom type
To use an enumeration from a custom C++ component, the enumeration must be declared with Q_ENUMS() to
@@ -455,7 +487,7 @@ See the \l {Tutorial: Writing QML extensions with C++}{Writing QML extensions wi
the \l {Extending QML in C++} reference documentation for more information.
-\section2 Automatic type conversion
+\section2 Automatic type conversion from strings
As a convenience, some basic types can be specified in QML using format strings to make it easier to
pass simple values from QML to C++.
diff --git a/doc/src/examples/diagramscene.qdoc b/doc/src/examples/diagramscene.qdoc
index 98bc983..d5cc4e3 100644
--- a/doc/src/examples/diagramscene.qdoc
+++ b/doc/src/examples/diagramscene.qdoc
@@ -195,7 +195,7 @@
This function returns a QWidget containing a QToolButton with
an image of one of the \c DiagramItems, i.e., flowchart shapes.
The image is created by the \c DiagramItem through the \c image()
- function. The QButtonGroup class lets us attach a QVariant with
+ function. The QButtonGroup class lets us attach an id (int) with
each button; we store the diagram's type, i.e., the
DiagramItem::DiagramType enum. We use the stored diagram type when
we create new diagram items for the scene. The widgets created
diff --git a/doc/src/snippets/declarative/integrating-javascript/includejs/app.qml b/doc/src/snippets/declarative/integrating-javascript/includejs/app.qml
new file mode 100644
index 0000000..2ecc475
--- /dev/null
+++ b/doc/src/snippets/declarative/integrating-javascript/includejs/app.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 1.0
+import "script.js" as MyScript
+
+Item {
+ width: 100; height: 100
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ MyScript.showCalculations(10)
+ console.log("Call factorial() from QML:",
+ MyScript.factorial(10))
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js b/doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js
new file mode 100644
index 0000000..0a01e9e
--- /dev/null
+++ b/doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// factorial.js
+function factorial(a) {
+ a = parseInt(a);
+ if (a <= 0)
+ return 1;
+ else
+ return a * factorial(a - 1);
+}
+//![0]
diff --git a/doc/src/snippets/declarative/integrating-javascript/includejs/script.js b/doc/src/snippets/declarative/integrating-javascript/includejs/script.js
new file mode 100644
index 0000000..7380412
--- /dev/null
+++ b/doc/src/snippets/declarative/integrating-javascript/includejs/script.js
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+// script.js
+Qt.include("factorial.js")
+
+function showCalculations(value) {
+ console.log("Call factorial() from script.js:",
+ factorial(value));
+}
+//![0]
diff --git a/doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml b/doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml
new file mode 100644
index 0000000..dd59fed
--- /dev/null
+++ b/doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+
+//![0]
+// MyItem.qml
+Item {
+ function readValues(anArray, anObject) {
+ for (var i=0; i<anArray.length; i++)
+ console.log("Array item:", anArray[i])
+
+ for (var prop in anObject) {
+ console.log("Object item:", prop, "=", anObject[prop])
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/qtbinding/variantlistmap/main.cpp b/doc/src/snippets/declarative/qtbinding/variantlistmap/main.cpp
new file mode 100644
index 0000000..9986264
--- /dev/null
+++ b/doc/src/snippets/declarative/qtbinding/variantlistmap/main.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore>
+#include <QtDeclarative>
+
+int main(int argc, char *argv[]) {
+ QApplication app(argc, argv);
+
+//![0]
+// C++
+QDeclarativeView view(QUrl::fromLocalFile("MyItem.qml"));
+
+QVariantList list;
+list << 10 << Qt::green << "bottles";
+
+QVariantMap map;
+map.insert("language", "QML");
+map.insert("released", QDate(2010, 9, 21));
+
+QMetaObject::invokeMethod(view.rootObject(), "readValues",
+ Q_ARG(QVariant, QVariant::fromValue(list)),
+ Q_ARG(QVariant, QVariant::fromValue(map)));
+//![0]
+
+ view.setSource(QUrl::fromLocalFile("MyItem.qml"));
+ view.show();
+
+ return app.exec();
+}
+
diff --git a/doc/src/snippets/declarative/qtbinding/variantlistmap/variantlistmap.pro b/doc/src/snippets/declarative/qtbinding/variantlistmap/variantlistmap.pro
new file mode 100644
index 0000000..68eeaf2
--- /dev/null
+++ b/doc/src/snippets/declarative/qtbinding/variantlistmap/variantlistmap.pro
@@ -0,0 +1,2 @@
+QT += declarative
+SOURCES += main.cpp
diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf
index 11907cf..707335c 100644
--- a/mkspecs/common/symbian/symbian.conf
+++ b/mkspecs/common/symbian/symbian.conf
@@ -147,7 +147,7 @@ SYMBIAN_SUPPORTED_LANGUAGES = \
# These directories must match what configure uses for QT_INSTALL_PLUGINS and QT_INSTALL_IMPORTS
QT_PLUGINS_BASE_DIR = /resource/qt$${QT_LIBINFIX}/plugins
-QT_IMPORTS_BASE_DIR = /resource/qt/imports
+QT_IMPORTS_BASE_DIR = /resource/qt$${QT_LIBINFIX}/imports
load(symbian/platform_paths)
diff --git a/qmake/project.cpp b/qmake/project.cpp
index d967a63..bd81b17 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -2173,7 +2173,7 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
const QRegExp regex(r, Qt::CaseSensitive, QRegExp::Wildcard);
for(int d = 0; d < dirs.count(); d++) {
QString dir = dirs[d];
- if(!dir.isEmpty() && !dir.endsWith(Option::dir_sep))
+ if(!dir.isEmpty() && !dir.endsWith(QDir::separator()))
dir += "/";
QDir qdir(dir);
@@ -2389,7 +2389,7 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QMap<QSt
return true;
//regular expression I guess
QString dirstr = qmake_getpwd();
- int slsh = file.lastIndexOf(Option::dir_sep);
+ int slsh = file.lastIndexOf(QDir::separator());
if(slsh != -1) {
dirstr = file.left(slsh+1);
file = file.right(file.length() - slsh - 1);
diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h
index 8879636..70adcf6 100644
--- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h
+++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h
@@ -21,7 +21,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QScopedPointer>
-#include <audioeffectbase.h>
+#include <AudioEffectBase.h>
#include <phonon/effectinterface.h>
diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp
index 28433f6..1d2bbd4 100644
--- a/src/3rdparty/phonon/mmf/audioequalizer.cpp
+++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp
@@ -16,7 +16,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <audioequalizerbase.h>
+#include <AudioEqualizerBase.h>
#include "audioequalizer.h"
QT_BEGIN_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp
index 81d9208..67076f6 100644
--- a/src/3rdparty/phonon/mmf/bassboost.cpp
+++ b/src/3rdparty/phonon/mmf/bassboost.cpp
@@ -16,7 +16,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <bassboostbase.h>
+#include <BassBoostBase.h>
#include "bassboost.h"
QT_BEGIN_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/environmentalreverb.cpp b/src/3rdparty/phonon/mmf/environmentalreverb.cpp
index c500385..d4f5223 100644
--- a/src/3rdparty/phonon/mmf/environmentalreverb.cpp
+++ b/src/3rdparty/phonon/mmf/environmentalreverb.cpp
@@ -16,7 +16,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <environmentalreverbbase.h>
+#include <EnvironmentalReverbBase.h>
#include "environmentalreverb.h"
QT_BEGIN_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/loudness.cpp b/src/3rdparty/phonon/mmf/loudness.cpp
index 22d7518..ca05ab0 100644
--- a/src/3rdparty/phonon/mmf/loudness.cpp
+++ b/src/3rdparty/phonon/mmf/loudness.cpp
@@ -16,7 +16,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <loudnessbase.h>
+#include <LoudnessBase.h>
#include "loudness.h"
QT_BEGIN_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/stereowidening.cpp b/src/3rdparty/phonon/mmf/stereowidening.cpp
index e452160..f90651b 100644
--- a/src/3rdparty/phonon/mmf/stereowidening.cpp
+++ b/src/3rdparty/phonon/mmf/stereowidening.cpp
@@ -16,7 +16,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stereowideningbase.h>
+#include <StereoWideningBase.h>
#include "stereowidening.h"
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index d53504a..08415bf 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -44,9 +44,8 @@
#include <QtCore/qglobal.h>
-#ifdef Q_OS_LINUX
-# include <features.h>
-#endif
+// include stdlib.h and hope that it defines __GLIBC__ for glibc-based systems
+#include <stdlib.h>
#ifdef __GLIBC__
#include <byteswap.h>
diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
index bcf4477..bf675a7 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.cpp
+++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
@@ -77,10 +77,14 @@ Q_DESTRUCTOR_FUNCTION(timerIdsDestructorFunction)
static QBasicAtomicInt nextFreeTimerId = Q_BASIC_ATOMIC_INITIALIZER(1);
+static const int TimerIdMask = 0x00ffffff;
+static const int TimerSerialMask = ~TimerIdMask & ~0x80000000;
+static const int TimerSerialCounter = TimerIdMask + 1;
+
// avoid the ABA-problem by using 7 of the top 8 bits of the timerId as a serial number
static inline int prepareNewValueWithSerialNumber(int oldId, int newId)
{
- return (newId & 0x00FFFFFF) | ((oldId + 0x01000000) & 0x7f000000);
+ return (newId & TimerIdMask) | ((oldId + TimerSerialCounter) & TimerSerialMask);
}
static inline int bucketOffset(int timerId)
@@ -120,17 +124,32 @@ void QAbstractEventDispatcherPrivate::init()
}
}
+// Timer IDs are implemented using a free-list;
+// there's a vector initialized with:
+// X[i] = i + 1
+// and nextFreeTimerId starts with 1.
+//
+// Allocating a timer ID involves taking the ID from
+// X[nextFreeTimerId]
+// updating nextFreeTimerId to this value and returning the old value
+//
+// When the timer ID is allocated, its cell in the vector is unused (it's a
+// free list). As an added protection, we use the cell to store an invalid
+// (negative) value that we can later check for integrity.
+//
+// (continues below).
int QAbstractEventDispatcherPrivate::allocateTimerId()
{
int timerId, newTimerId;
+ int at, *b;
do {
- timerId = nextFreeTimerId;
+ timerId = nextFreeTimerId; //.loadAcquire(); // ### FIXME Proper memory ordering semantics
// which bucket are we looking in?
- int which = timerId & 0x00ffffff;
+ int which = timerId & TimerIdMask;
int bucket = bucketOffset(which);
- int at = bucketIndex(bucket, which);
- int *b = timerIds[bucket];
+ at = bucketIndex(bucket, which);
+ b = timerIds[bucket];
if (!b) {
// allocate a new bucket
@@ -142,23 +161,38 @@ int QAbstractEventDispatcherPrivate::allocateTimerId()
}
}
- newTimerId = b[at];
+ newTimerId = prepareNewValueWithSerialNumber(timerId, b[at]);
} while (!nextFreeTimerId.testAndSetRelaxed(timerId, newTimerId));
+ b[at] = -timerId;
+
return timerId;
}
+// Releasing a timer ID requires putting the current ID back in the vector;
+// we do it by setting:
+// X[timerId] = nextFreeTimerId;
+// then we update nextFreeTimerId to the timer we've just released
+//
+// The extra code in allocateTimerId and releaseTimerId are ABA prevention
+// and bucket memory. The buckets are simply to make sure we allocate only
+// the necessary number of timers. See above.
+//
+// ABA prevention simply adds a value to 7 of the top 8 bits when resetting
+// nextFreeTimerId.
void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId)
{
- int which = timerId & 0x00ffffff;
+ int which = timerId & TimerIdMask;
int bucket = bucketOffset(which);
int at = bucketIndex(bucket, which);
int *b = timerIds[bucket];
+ Q_ASSERT(b[at] == -timerId);
+
int freeId, newTimerId;
do {
- freeId = nextFreeTimerId;
- b[at] = freeId & 0x00ffffff;
+ freeId = nextFreeTimerId;//.loadAcquire(); // ### FIXME Proper memory ordering semantics
+ b[at] = freeId & TimerIdMask;
newTimerId = prepareNewValueWithSerialNumber(freeId, timerId);
} while (!nextFreeTimerId.testAndSetRelease(freeId, newTimerId));
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index 63ebafb..bc5e9e4 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -285,7 +285,13 @@ static inline uint detectProcessorFeatures()
uint features = MMX|SSE|SSE2|CMOV;
uint feature_result = 0;
-#if defined(Q_CC_GNU)
+#if defined (Q_OS_WIN64)
+ {
+ int info[4];
+ __cpuid(info, 1);
+ feature_result = info[2];
+ }
+#elif defined(Q_CC_GNU)
quint64 tmp;
asm ("xchg %%rbx, %1\n"
"cpuid\n"
@@ -294,12 +300,6 @@ static inline uint detectProcessorFeatures()
: "a" (1)
: "%edx"
);
-#elif defined (Q_OS_WIN64)
- {
- int info[4];
- __cpuid(info, 1);
- feature_result = info[2];
- }
#endif
if (feature_result & (1u))
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index 93ad861..1ad888b 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -2,7 +2,6 @@ TARGET = QtDeclarative
QPRO_PWD = $$PWD
QT = core gui script network
contains(QT_CONFIG, svg): QT += svg
-contains(QT_CONFIG, opengl): QT += opengl
DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index cd770d4..7ebed2f 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -700,8 +700,8 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
bool rejectY = false;
bool rejectX = false;
- bool stealY = false;
- bool stealX = false;
+ bool stealY = stealMouse;
+ bool stealX = stealMouse;
if (q->yflick()) {
int dy = int(event->pos().y() - pressPos.y());
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 264f12c..bb5b68b 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -735,7 +735,7 @@ void QDeclarativeGridViewPrivate::createHighlight()
QDeclarative_setParent_noEvent(item, q->contentItem());
item->setParentItem(q->contentItem());
highlight = new FxGridItem(item, q);
- if (currentItem)
+ if (currentItem && autoHighlight)
highlight->setPosition(currentItem->colPos(), currentItem->rowPos());
highlightXAnimator = new QSmoothedAnimation(q);
highlightXAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("x"));
@@ -1253,7 +1253,8 @@ void QDeclarativeGridView::setModel(const QVariant &model)
d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeGridViewPrivate::Other;
@@ -1321,7 +1322,8 @@ void QDeclarativeGridView::setDelegate(QDeclarativeComponent *delegate)
d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeGridViewPrivate::Other;
@@ -2241,7 +2243,8 @@ void QDeclarativeGridView::componentComplete()
else
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeGridViewPrivate::Other;
@@ -2649,7 +2652,8 @@ void QDeclarativeGridView::modelReset()
d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeGridViewPrivate::Other;
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 11286b0..24d9b03 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1831,9 +1831,9 @@ void QDeclarativeItem::setClip(bool c)
/*!
\qmlproperty real Item::z
- Sets the stacking order of the item. By default the stacking order is 0.
+ Sets the stacking order of sibling items. By default the stacking order is 0.
- Items with a higher stacking value are drawn on top of items with a
+ Items with a higher stacking value are drawn on top of siblings with a
lower stacking order. Items with the same stacking value are drawn
bottom up in the order they appear. Items with a negative stacking
value are drawn under their parent's content.
@@ -2134,6 +2134,8 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
Margins apply to top, bottom, left, right, and fill anchors.
The \c anchors.margins property can be used to set all of the various margins at once, to the same value.
+ Note that margins are anchor-specific and are not applied if an item does not
+ use anchors.
Offsets apply for horizontal center, vertical center, and baseline anchors.
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index d8635b9..a36ee34 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -126,7 +126,7 @@ public:
widthValid(false), heightValid(false),
componentComplete(true), keepMouse(false),
smooth(false), transformOriginDirty(true), doneEventPreHandler(false), keyHandler(0),
- mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0)
+ mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0), hadSubFocusItem(false)
{
QGraphicsItemPrivate::acceptedMouseButtons = 0;
isDeclarativeItem = 1;
@@ -275,6 +275,8 @@ public:
qreal implicitWidth;
qreal implicitHeight;
+ bool hadSubFocusItem;
+
QPointF computeTransformOrigin() const;
virtual void setPosHelper(const QPointF &pos)
@@ -288,9 +290,11 @@ public:
// Reimplemented from QGraphicsItemPrivate
virtual void subFocusItemChange()
{
- if (flags & QGraphicsItem::ItemIsFocusScope || !parent)
- emit q_func()->activeFocusChanged(subFocusItem != 0);
+ bool hasSubFocusItem = subFocusItem != 0;
+ if (((flags & QGraphicsItem::ItemIsFocusScope) || !parent) && hasSubFocusItem != hadSubFocusItem)
+ emit q_func()->activeFocusChanged(hasSubFocusItem);
//see also QDeclarativeItemPrivate::focusChanged
+ hadSubFocusItem = hasSubFocusItem;
}
// Reimplemented from QGraphicsItemPrivate
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 845da79..2a7f508 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -265,6 +265,8 @@ public:
}
}
pos = (*(--visibleItems.constEnd()))->endPosition() + invisibleCount * (averageSize + spacing);
+ } else if (model && model->count()) {
+ pos = model->count() * averageSize + (model->count()-1) * spacing;
}
return pos;
}
@@ -739,16 +741,20 @@ void QDeclarativeListViewPrivate::layout()
return;
}
if (!visibleItems.isEmpty()) {
- qreal oldEnd = visibleItems.last()->endPosition();
+ bool fixedCurrent = currentItem && visibleItems.first()->item == currentItem->item;
+ qreal sum = visibleItems.first()->size();
qreal pos = visibleItems.first()->position() + visibleItems.first()->size() + spacing;
for (int i=1; i < visibleItems.count(); ++i) {
FxListItem *item = visibleItems.at(i);
item->setPosition(pos);
pos += item->size() + spacing;
+ sum += item->size();
+ fixedCurrent = fixedCurrent || (currentItem && item->item == currentItem->item);
}
- // move current item if it is after the visible items.
- if (currentItem && currentIndex > lastVisibleIndex())
- currentItem->setPosition(currentItem->position() + (visibleItems.last()->endPosition() - oldEnd));
+ averageSize = qRound(sum / visibleItems.count());
+ // move current item if it is not a visible item.
+ if (currentIndex >= 0 && currentItem && !fixedCurrent)
+ currentItem->setPosition(positionAt(currentIndex));
}
q->refill();
minExtentDirty = true;
@@ -1046,6 +1052,8 @@ void QDeclarativeListViewPrivate::updateCurrent(int modelIndex)
// This is slightly sub-optimal, but section heading caching minimizes the impact.
if (currentItem->section)
currentItem->section->setVisible(false);
+ if (visibleItems.isEmpty())
+ averageSize = currentItem->size();
}
updateHighlight();
emit q->currentIndexChanged();
@@ -1567,10 +1575,12 @@ void QDeclarativeListView::setModel(const QVariant &model)
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->position());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->position());
d->updateTrackedItem();
}
}
+ d->updateViewport();
}
connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
@@ -1638,9 +1648,11 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate)
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->position());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->position());
d->updateTrackedItem();
}
+ d->updateViewport();
}
}
emit delegateChanged();
@@ -2628,8 +2640,10 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode)
cancelFlick();
d->setPosition(pos);
if (d->highlight) {
- d->highlight->setPosition(d->currentItem->itemPosition());
- d->highlight->setSize(d->currentItem->itemSize());
+ if (d->autoHighlight) {
+ d->highlight->setPosition(d->currentItem->itemPosition());
+ d->highlight->setSize(d->currentItem->itemSize());
+ }
d->updateHighlight();
}
}
@@ -2675,7 +2689,8 @@ void QDeclarativeListView::componentComplete()
else
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->position());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->position());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeListViewPrivate::Other;
@@ -3138,7 +3153,8 @@ void QDeclarativeListView::modelReset()
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
if (d->highlight && d->currentItem) {
- d->highlight->setPosition(d->currentItem->position());
+ if (d->autoHighlight)
+ d->highlight->setPosition(d->currentItem->position());
d->updateTrackedItem();
}
d->moveReason = QDeclarativeListViewPrivate::Other;
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 7c79afe..87ea214 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -1478,7 +1478,7 @@ void QDeclarativePathView::itemsRemoved(int modelIndex, int count)
currentChanged = true;
} else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) {
// current item has been removed.
- d->currentIndex = qMin(modelIndex, d->modelCount-1);
+ d->currentIndex = qMin(modelIndex, d->modelCount-count-1);
if (d->currentItem) {
if (QDeclarativePathViewAttached *att = d->attached(d->currentItem))
att->setIsCurrentItem(true);
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index f8421a3..df103de 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -1479,6 +1479,7 @@ void QDeclarativeTextInput::cursorPosChanged()
updateRect();//TODO: Only update rect between pos's
updateMicroFocus();
emit cursorPositionChanged();
+ d->control->resetCursorBlinkTimer();
if(!d->control->hasSelectedText()){
if(d->lastSelectionStart != d->control->cursor()){
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 4fe6c4c..4f5213a 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -1367,7 +1367,7 @@ void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent,
Q_D(QDeclarativeVisualDataModel);
const int count = sourceEnd - sourceStart + 1;
if (destinationParent == d->m_root && sourceParent == d->m_root) {
- _q_itemsMoved(sourceStart, destinationRow, count);
+ _q_itemsMoved(sourceStart, sourceStart > destinationRow ? destinationRow : destinationRow-1, count);
} else if (sourceParent == d->m_root) {
_q_itemsRemoved(sourceStart, count);
} else if (destinationParent == d->m_root) {
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 63bde0f..77fc925 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -147,32 +147,36 @@ class QByteArray;
Components are reusable, encapsulated QML elements with well-defined interfaces.
Components are often defined by \l {qdeclarativedocuments.html}{component files} -
- that is, \c .qml files. The \e Component element allows components to be defined
- within QML items rather than in a separate file. This may be useful for reusing
- a small component within a QML file, or for defining a component that logically
- belongs with other QML components within a file.
+ that is, \c .qml files. The \e Component element essentially allows QML components
+ to be defined inline, within a \l {QML Document}{QML document}, rather than as a separate QML file.
+ This may be useful for reusing a small component within a QML file, or for defining
+ a component that logically belongs with other QML components within a file.
For example, here is a component that is used by multiple \l Loader objects.
- It contains a top level \l Rectangle item:
+ It contains a single item, a \l Rectangle:
\snippet doc/src/snippets/declarative/component.qml 0
Notice that while a \l Rectangle by itself would be automatically
rendered and displayed, this is not the case for the above rectangle
because it is defined inside a \c Component. The component encapsulates the
- QML elements within, as if they were defined in a separate \c .qml
+ QML elements within, as if they were defined in a separate QML
file, and is not loaded until requested (in this case, by the
two \l Loader objects).
- A Component cannot contain anything other
- than an \c id and a single top level item. While the \c id is optional,
- the top level item is not; you cannot define an empty component.
+ Defining a \c Component is similar to defining a \l {QML Document}{QML document}.
+ A QML document has a single top-level item that defines the behaviors and
+ properties of that component, and cannot define properties or behaviors outside
+ of that top-level item. In the same way, a \c Component definition contains a single
+ top level item (which in the above example is a \l Rectangle) and cannot define any
+ data outside of this item, with the exception of an \e id (which in the above example
+ is \e redSquare).
- The Component element is commonly used to provide graphical components
- for views. For example, the ListView::delegate property requires a Component
+ The \c Component element is commonly used to provide graphical components
+ for views. For example, the ListView::delegate property requires a \c Component
to specify how each list item is to be displayed.
- Component objects can also be dynamically created using
+ \c Component objects can also be created dynamically using
\l{QML:Qt::createComponent()}{Qt.createComponent()}.
*/
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index a8404f0..201e675 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -261,6 +261,33 @@ of their use.
\endlist
*/
+/*!
+\qmlmethod object Qt::include(string url, jsobject callback)
+
+Includes another JavaScript file. This method can only be used from within JavaScript files,
+and not regular QML files.
+
+This imports all functions from \a url into the current script's namespace.
+
+Qt.include() returns an object that describes the status of the operation. The object has
+a single property, \c {status}, that is set to one of the following values:
+
+\table
+\header \o Symbol \o Value \o Description
+\row \o result.OK \o 0 \o The include completed successfully.
+\row \o result.LOADING \o 1 \o Data is being loaded from the network.
+\row \o result.NETWORK_ERROR \o 2 \o A network error occurred while fetching the url.
+\row \o result.EXCEPTION \o 3 \o A JavaScript exception occurred while executing the included code.
+An additional \c exception property will be set in this case.
+\endtable
+
+The \c status property will be updated as the operation progresses.
+
+If provided, \a callback is invoked when the operation completes. The callback is passed
+the same object as is returned from the Qt.include() call.
+*/
+// Qt.include() is implemented in qdeclarativeinclude.cpp
+
QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
: captureProperties(false), rootContext(0), isDebugging(false),
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index acc13de..94765f2 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -382,7 +382,13 @@ bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath
foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) {
QString resolvedFilePath = database->resolvePlugin(dir, plugin.path, plugin.name);
-
+#if defined(QT_LIBINFIX) && defined(Q_OS_SYMBIAN)
+ if (resolvedFilePath.isEmpty()) {
+ // In case of libinfixed build, attempt to load libinfixed version, too.
+ QString infixedPluginName = plugin.name + QLatin1String(QT_LIBINFIX);
+ resolvedFilePath = database->resolvePlugin(dir, plugin.path, infixedPluginName);
+ }
+#endif
if (!resolvedFilePath.isEmpty()) {
if (!database->importPlugin(resolvedFilePath, uri, errorString)) {
if (errorString)
diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp
index 1e240d7..a9ecdda 100644
--- a/src/declarative/qml/qdeclarativeinclude.cpp
+++ b/src/declarative/qml/qdeclarativeinclude.cpp
@@ -172,28 +172,8 @@ void QDeclarativeInclude::callback(QScriptEngine *engine, QScriptValue &callback
}
}
-/*!
-\qmlmethod object Qt::include(string url, jsobject callback)
-
-Include another JavaScript file. This method can only be used from within JavaScript files,
-and not regular QML files.
-
-Qt.include() returns an object that describes the status of the operation. The object has
-a single property, \c {status} that is set to one of the following values:
-
-\table
-\header \o Symbol \o Value \o Description
-\row \o result.OK \o 0 \o The include completed successfully.
-\row \o result.LOADING \o 1 \o Data is being loaded from the network.
-\row \o result.NETWORK_ERROR \o 2 \o A network error occurred while fetching the url.
-\row \o result.EXCEPTION \o 3 \o A JavaScript exception occurred while executing the included code.
-An additional \c exception property will be set in this case.
-\endtable
-
-The return object's properties will be updated as the operation progresses.
-
-If provided, \a callback is invoked when the operation completes. The callback is passed
-the same object as is returned from the Qt.include() call.
+/*
+ Documented in qdeclarativeengine.cpp
*/
QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *engine)
{
diff --git a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
index d22798d..36e9721 100644
--- a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
+++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
@@ -46,27 +46,44 @@ QT_BEGIN_NAMESPACE
/*!
\class QDeclarativeNetworkAccessManagerFactory
\since 4.7
- \brief The QDeclarativeNetworkAccessManagerFactory class provides a factory for QNetworkAccessManager for use by a Qt Declarative engine.
+ \brief The QDeclarativeNetworkAccessManagerFactory class creates QNetworkAccessManager instances for a QML engine.
- QNetworkAccessManager is used for all network access by QML.
- By implementing a factory it is possible to create custom
- QNetworkAccessManager with specialized caching, proxy and
- cookie support.
+ A QML engine uses QNetworkAccessManager for all network access.
+ By implementing a factory, it is possible to provide the QML engine
+ with custom QNetworkAccessManager instances with specialized caching,
+ proxy and cookies support.
- To implement a factory, subclass QDeclarativeNetworkAccessManagerFactory and implement
- the create() method.
+ To implement a factory, subclass QDeclarativeNetworkAccessManagerFactory and
+ implement the virtual create() method, then assign it to the relevant QML
+ engine using QDeclarativeEngine::setNetworkAccessManagerFactory().
- To use a factory, assign it to the relevant QDeclarativeEngine using
- QDeclarativeEngine::setNetworkAccessManagerFactory().
+ Note the QML engine may create QNetworkAccessManager instances
+ from multiple threads. Because of this, the implementation of the create()
+ method must be \l{Reentrancy and Thread-Safety}{reentrant}. In addition,
+ the developer should be careful if the signals of the object to be
+ returned from create() are connected to the slots of an object that may
+ be created in a different thread:
- Note: the create() method may be called by multiple threads, so ensure the
- implementation of this method is reentrant.
+ \list
+ \o The QML engine internally handles all requests, and cleans up any
+ QNetworkReply objects it creates. Receiving the
+ QNetworkAccessManager::finished() signal in another thread may not
+ provide the receiver with a valid reply object if it has already
+ been deleted.
+ \o Authentication details provided to QNetworkAccessManager::authenticationRequired()
+ must be provided immediately, so this signal cannot be connected as a
+ Qt::QueuedConnection (or as the default Qt::AutoConnection from another
+ thread).
+ \endlist
+
+ For more information about signals and threads, see
+ \l {Threads and QObjects} and \l {Signals and Slots Across Threads}.
- \sa QDeclarativeEngine::setNetworkAccessManagerFactory(), {declarative/cppextensions/networkaccessmanagerfactory}{NetworkAccessManagerFactory example}
+ \sa {declarative/cppextensions/networkaccessmanagerfactory}{NetworkAccessManagerFactory example}
*/
/*!
- The destructor is empty.
+ Destroys the factory. The default implementation does nothing.
*/
QDeclarativeNetworkAccessManagerFactory::~QDeclarativeNetworkAccessManagerFactory()
{
@@ -75,13 +92,9 @@ QDeclarativeNetworkAccessManagerFactory::~QDeclarativeNetworkAccessManagerFactor
/*!
\fn QNetworkAccessManager *QDeclarativeNetworkAccessManagerFactory::create(QObject *parent)
- Implement this method to create a QNetworkAccessManager with \a parent.
- This allows proxies, caching and cookie support to be setup appropriately.
-
- This method must return a new QNetworkAccessManager each time it is called.
- The parent of the QNetworkAccessManager must be the \a parent provided.
- The QNetworkAccessManager(s) created by this
- function will be destroyed automatically when their parent is destroyed.
+ Creates and returns a network access manager with the specified \a parent.
+ This method must return a new QNetworkAccessManager instance each time
+ it is called.
Note: this method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index df0917f..60edd64 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -77,15 +77,28 @@ a property on a specific object instance. To read a property's value, programme
QDeclarativeProperty instance and call the read() method. Likewise to write a property value the
write() method is used.
+For example, for the following QML code:
+
+\qml
+// MyItem.qml
+import QtQuick 1.0
+
+Text { text: "A bit of text" }
+\endqml
+
+The \l Text object's properties could be accessed using QDeclarativeProperty, like this:
+
\code
+#include <QDeclarativeProperty>
+#include <QGraphicsObject>
-QObject *object = declarativeComponent.create();
+...
-QDeclarativeProperty property(object, "font.pixelSize");
+QDeclarativeView view(QUrl::fromLocalFile("MyItem.qml"));
+QDeclarativeProperty property(view.rootObject(), "font.pixelSize");
qWarning() << "Current pixel size:" << property.read().toInt();
property.write(24);
qWarning() << "Pixel size should now be 24:" << property.read().toInt();
-
\endcode
*/
diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp
index 45f277e..bda02a5 100644
--- a/src/declarative/qml/qdeclarativesqldatabase.cpp
+++ b/src/declarative/qml/qdeclarativesqldatabase.cpp
@@ -172,16 +172,23 @@ static const char* sqlerror[] = {
return errorValue; \
}
-
-static QString databaseFile(const QString& connectionName, QScriptEngine *engine)
+static QString qmlsqldatabase_databasesPath(QScriptEngine *engine)
{
QDeclarativeScriptEngine *qmlengine = static_cast<QDeclarativeScriptEngine*>(engine);
- QString basename = qmlengine->offlineStoragePath
- + QDir::separator() + QLatin1String("Databases") + QDir::separator();
- basename += connectionName;
- return basename;
+ return qmlengine->offlineStoragePath
+ + QDir::separator() + QLatin1String("Databases");
}
+static void qmlsqldatabase_initDatabasesPath(QScriptEngine *engine)
+{
+ QDir().mkpath(qmlsqldatabase_databasesPath(engine));
+}
+
+static QString qmlsqldatabase_databaseFile(const QString& connectionName, QScriptEngine *engine)
+{
+ return qmlsqldatabase_databasesPath(engine) + QDir::separator()
+ + connectionName;
+}
static QScriptValue qmlsqldatabase_item(QScriptContext *context, QScriptEngine *engine)
@@ -302,7 +309,7 @@ static QScriptValue qmlsqldatabase_change_version(QScriptContext *context, QScri
if (ok) {
context->thisObject().setProperty(QLatin1String("version"), to_version, QScriptValue::ReadOnly);
- QSettings ini(databaseFile(db.connectionName(),engine)+QLatin1String(".ini"),QSettings::IniFormat);
+ QSettings ini(qmlsqldatabase_databaseFile(db.connectionName(),engine) + QLatin1String(".ini"), QSettings::IniFormat);
ini.setValue(QLatin1String("Version"), to_version);
}
@@ -348,6 +355,8 @@ static QScriptValue qmlsqldatabase_read_transaction(QScriptContext *context, QSc
*/
static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEngine *engine)
{
+ qmlsqldatabase_initDatabasesPath(engine);
+
QSqlDatabase database;
QString dbname = context->argument(0).toString();
@@ -360,7 +369,7 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng
md5.addData(dbname.toUtf8());
QString dbid(QLatin1String(md5.result().toHex()));
- QString basename = databaseFile(dbid,engine);
+ QString basename = qmlsqldatabase_databaseFile(dbid, engine);
bool created = false;
QString version = dbversion;
@@ -375,7 +384,6 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng
} else {
created = !QFile::exists(basename+QLatin1String(".sqlite"));
database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), dbid);
- QDir().mkpath(basename);
if (created) {
ini.setValue(QLatin1String("Name"), dbname);
if (dbcreationCallback.isFunction())
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index ce5b483..49a12b1 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -503,9 +503,9 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
\qmlclass XmlListModel QDeclarativeXmlListModel
\ingroup qml-working-with-data
\since 4.7
- \brief The XmlListModel element is used to specify a model using XPath expressions.
+ \brief The XmlListModel element is used to specify a read-only model using XPath expressions.
- XmlListModel is used to create a model from XML data. It can be used as a data source
+ XmlListModel is used to create a read-only model from XML data. It can be used as a data source
for view elements (such as ListView, PathView, GridView) and other elements that interact with model
data (such as \l Repeater).
diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri
index c25b6d5..12e3a71 100644
--- a/src/gui/dialogs/dialogs.pri
+++ b/src/gui/dialogs/dialogs.pri
@@ -109,7 +109,7 @@ SOURCES += \
dialogs/qprintpreviewdialog.cpp
symbian:contains(QT_CONFIG, s60) {
- LIBS += -lcommondialogs
+ LIBS += -lCommonDialogs
SOURCES += dialogs/qfiledialog_symbian.cpp \
dialogs/qcolordialog_symbian.cpp
}
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index 87850a7..1e13113 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -719,6 +719,14 @@ bool QFileDialogPrivate::setVisible_sys(bool visible)
if (!visible == q->isHidden())
return false;
+ if (q->windowFlags() & Qt::WindowStaysOnTopHint) {
+ // The native file dialog tries all it can to stay
+ // on the NSModalPanel level. And it might also show
+ // its own "create directory" dialog that we cannot control.
+ // So we need to use the non-native version in this case...
+ return false;
+ }
+
#ifndef QT_MAC_USE_COCOA
return visible ? showCarbonNavServicesDialog() : hideCarbonNavServicesDialog();
#else
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 7ab49cb..94e1a72 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3295,9 +3295,13 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
}
// Update the child focus chain.
- if (scene && scene->focusItem())
- scene->focusItem()->d_ptr->clearSubFocus();
- f->d_ptr->setSubFocus();
+ QGraphicsItem *commonAncestor = 0;
+ if (scene && scene->focusItem()) {
+ commonAncestor = scene->focusItem()->commonAncestorItem(f);
+ scene->focusItem()->d_ptr->clearSubFocus(scene->focusItem(), commonAncestor);
+ }
+
+ f->d_ptr->setSubFocus(f, commonAncestor);
// Update the scene's focus item.
if (scene) {
@@ -5554,7 +5558,7 @@ void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMost
/*!
\internal
*/
-void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem)
+void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem, QGraphicsItem *stopItem)
{
// Update focus child chain. Stop at panels, or if this item
// is hidden, stop at the first item with a visible parent.
@@ -5567,7 +5571,7 @@ void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem)
if (parent != q_ptr && parent->d_ptr->subFocusItem) {
if (parent->d_ptr->subFocusItem == q_ptr)
break;
- parent->d_ptr->subFocusItem->d_ptr->clearSubFocus();
+ parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(0, stopItem);
}
parent->d_ptr->subFocusItem = q_ptr;
parent->d_ptr->subFocusItemChange();
@@ -5580,12 +5584,12 @@ void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem)
/*!
\internal
*/
-void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem)
+void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem *stopItem)
{
// Reset sub focus chain.
QGraphicsItem *parent = rootItem ? rootItem : q_ptr;
do {
- if (parent->d_ptr->subFocusItem != q_ptr)
+ if (parent->d_ptr->subFocusItem != q_ptr || parent == stopItem)
break;
parent->d_ptr->subFocusItem = 0;
parent->d_ptr->subFocusItemChange();
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 1b7aa97..b938759 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -479,8 +479,8 @@ public:
void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide);
void clearFocusHelper(bool giveFocusToParent);
- void setSubFocus(QGraphicsItem *rootItem = 0);
- void clearSubFocus(QGraphicsItem *rootItem = 0);
+ void setSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0);
+ void clearSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0);
void resetFocusProxy();
virtual void subFocusItemChange();
virtual void focusScopeItemChange(bool isSubFocusItem);
diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp
index 86b4589..3e95735 100644
--- a/src/gui/graphicsview/qgraphicslayout.cpp
+++ b/src/gui/graphicsview/qgraphicslayout.cpp
@@ -307,10 +307,13 @@ void QGraphicsLayout::invalidate()
// does not call the base implementation? In addition, updateGeometry()
// does more than we need.
layoutItem->d_func()->sizeHintCacheDirty = true;
- layoutItem = layoutItem->parentLayoutItem();
+ layoutItem->d_func()->sizeHintWithConstraintCacheDirty = true;
+ layoutItem = layoutItem->parentLayoutItem();
}
- if (layoutItem)
+ if (layoutItem) {
layoutItem->d_func()->sizeHintCacheDirty = true;
+ layoutItem->d_func()->sizeHintWithConstraintCacheDirty = true;
+ }
bool postIt = layoutItem ? !layoutItem->isLayout() : false;
if (postIt) {
diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp
index 016cfbf..df13039 100644
--- a/src/gui/graphicsview/qgraphicslayoutitem.cpp
+++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp
@@ -128,6 +128,7 @@ QGraphicsLayoutItemPrivate::~QGraphicsLayoutItemPrivate()
void QGraphicsLayoutItemPrivate::init()
{
sizeHintCacheDirty = true;
+ sizeHintWithConstraintCacheDirty = true;
sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
}
@@ -828,6 +829,7 @@ void QGraphicsLayoutItem::updateGeometry()
{
Q_D(QGraphicsLayoutItem);
d->sizeHintCacheDirty = true;
+ d->sizeHintWithConstraintCacheDirty = true;
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index a0015dc..726e6d7 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4583,13 +4583,13 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
itemCache->exposed.clear();
deviceData->cacheIndent = QPoint();
pix = QPixmap();
- } else {
+ } else if (!viewRect.isNull()) {
allowPartialCacheExposure = deviceData->cacheIndent != QPoint();
}
// Allow partial cache exposure if the device rect isn't fully contained and
// deviceRect is 20% taller or wider than the viewRect.
- if (!allowPartialCacheExposure && !viewRect.contains(deviceRect)) {
+ if (!allowPartialCacheExposure && !viewRect.isNull() && !viewRect.contains(deviceRect)) {
allowPartialCacheExposure = (viewRect.width() * 1.2 < deviceRect.width())
|| (viewRect.height() * 1.2 < deviceRect.height());
}
diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h
index 44efbba..1b2e2ec 100644
--- a/src/gui/graphicsview/qgridlayoutengine_p.h
+++ b/src/gui/graphicsview/qgridlayoutengine_p.h
@@ -433,7 +433,7 @@ private:
// Lazily computed from the above user input
mutable int q_cachedEffectiveFirstRows[NOrientations];
mutable int q_cachedEffectiveLastRows[NOrientations];
- mutable quint8 q_cachedConstraintOrientation : 2;
+ mutable quint8 q_cachedConstraintOrientation : 3;
// Layout item input
mutable QLayoutStyleInfo q_cachedDataForStyleInfo;
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 2bb0897..cc3b867 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1121,9 +1121,14 @@ QImage::QImage(const char * const xpm[])
QImage::QImage(const QImage &image)
: QPaintDevice()
{
- d = image.d;
- if (d)
- d->ref.ref();
+ if (image.paintingActive()) {
+ d = 0;
+ operator=(image.copy());
+ } else {
+ d = image.d;
+ if (d)
+ d->ref.ref();
+ }
}
#ifdef QT3_SUPPORT
@@ -1320,11 +1325,15 @@ QImage::~QImage()
QImage &QImage::operator=(const QImage &image)
{
- if (image.d)
- image.d->ref.ref();
- if (d && !d->ref.deref())
- delete d;
- d = image.d;
+ if (image.paintingActive()) {
+ operator=(image.copy());
+ } else {
+ if (image.d)
+ image.d->ref.ref();
+ if (d && !d->ref.deref())
+ delete d;
+ d = image.d;
+ }
return *this;
}
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 53f3559..29bf5f5 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -44,11 +44,13 @@
#include "qpixmap_raster_p.h"
#include "qnativeimage_p.h"
#include "qimage_p.h"
+#include "qpaintengine.h"
#include "qbitmap.h"
#include "qimage.h"
#include <QBuffer>
#include <QImageReader>
+#include <private/qimage_p.h>
#include <private/qsimd_p.h>
#include <private/qwidget_p.h>
#include <private/qdrawhelper_p.h>
@@ -302,6 +304,15 @@ bool QRasterPixmapData::hasAlphaChannel() const
QImage QRasterPixmapData::toImage() const
{
+ if (!image.isNull()) {
+ QImageData *data = const_cast<QImage &>(image).data_ptr();
+ if (data->paintEngine && data->paintEngine->isActive()
+ && data->paintEngine->paintDevice() == &image)
+ {
+ return image.copy();
+ }
+ }
+
return image;
}
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 4a1b9b9..686f388 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -657,6 +657,8 @@ void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText,
if (!w)
return;
+ commitTemporaryPreeditString();
+
m_inlinePosition = aPositionOfInsertionPointInInlineText;
QList<QInputMethodEvent::Attribute> attributes;
@@ -694,6 +696,12 @@ void QCoeFepInputContext::SetInlineEditingCursorVisibilityL(TBool aCursorVisibil
void QCoeFepInputContext::CancelFepInlineEdit()
{
+ // We are not supposed to ever have a tempPreeditString and a real preedit string
+ // from S60 at the same time, so it should be safe to rely on this test to determine
+ // whether we should honor S60's request to clear the text or not.
+ if (m_hasTempPreeditString)
+ return;
+
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent event(QLatin1String(""), attributes);
event.setCommitString(QLatin1String(""), 0, 0);
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index dc8d938..0d9819e 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -782,14 +782,14 @@ void QSortFilterProxyModelPrivate::source_items_inserted(
if (orthogonal_source_to_proxy.isEmpty()) {
const int ortho_end = (orient == Qt::Horizontal) ? model->rowCount(source_parent) : model->columnCount(source_parent);
+ orthogonal_source_to_proxy.resize(ortho_end);
+
for (int ortho_item = 0; ortho_item < ortho_end; ++ortho_item) {
if ((orient == Qt::Horizontal) ? q->filterAcceptsRow(ortho_item, source_parent)
: q->filterAcceptsColumn(ortho_item, source_parent)) {
orthogonal_proxy_to_source.append(ortho_item);
}
}
- orthogonal_source_to_proxy.resize(orthogonal_proxy_to_source.size());
-
if (orient == Qt::Horizontal) {
// We're reacting to columnsInserted, but we've just inserted new rows. Sort them.
sort_source_rows(orthogonal_proxy_to_source, source_parent);
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index a4ae46b..b4ff7c4 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -1101,6 +1101,9 @@ QApplication::~QApplication()
QApplicationPrivate::is_app_closing = true;
QApplicationPrivate::is_app_running = false;
+ delete QWidgetPrivate::mapper;
+ QWidgetPrivate::mapper = 0;
+
// delete all widgets
if (QWidgetPrivate::allWidgets) {
QWidgetSet *mySet = QWidgetPrivate::allWidgets;
@@ -1130,9 +1133,6 @@ QApplication::~QApplication()
delete d->ignore_cursor; d->ignore_cursor = 0;
#endif
- delete QWidgetPrivate::mapper;
- QWidgetPrivate::mapper = 0;
-
delete QApplicationPrivate::app_pal;
QApplicationPrivate::app_pal = 0;
delete QApplicationPrivate::sys_pal;
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 8596563..81fa4e6 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1633,6 +1633,13 @@ void qt_cleanup()
//Change mouse pointer back
S60->wsSession().SetPointerCursorMode(EPointerCursorNone);
+#ifdef Q_WS_S60
+ // Clear CBA
+ CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(0);
+ delete S60->buttonGroupContainer();
+ S60->setButtonGroupContainer(0);
+#endif
+
if (S60->qtOwnsS60Environment) {
// Restore the S60 framework trap handler. See qt_init().
User::SetTrapHandler(S60->s60InstalledTrapHandler);
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index ddf1a27..1e2e71b 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -182,7 +182,7 @@ QT_END_NAMESPACE
bool handled = false;
// sometimes need to redirect mouse events to the popup.
QWidget *popup = qAppInstance()->activePopupWidget();
- if (popup) {
+ if (popup && popup != widget) {
switch([event type])
{
case NSLeftMouseDown:
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 515c6d3..dc926e0 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -844,7 +844,7 @@ static void setChildrenWorksWhenModal(QWidget *widget, bool worksWhenModal)
NSWindow *window = qt_mac_window_for(dialogs[i]);
if (window && [window isKindOfClass:[NSPanel class]]) {
[static_cast<NSPanel *>(window) setWorksWhenModal:worksWhenModal];
- if (worksWhenModal && dialogs[i]->isVisible()){
+ if (worksWhenModal && [window isVisible]){
[window orderFront:window];
}
}
@@ -856,6 +856,7 @@ void QEventDispatcherMacPrivate::updateChildrenWorksWhenModal()
// Make the dialog children of the widget
// active. And make the dialog children of
// the previous modal dialog unactive again:
+ QMacCocoaAutoReleasePool pool;
int size = cocoaModalSessionStack.size();
if (size > 0){
if (QWidget *prevModal = cocoaModalSessionStack[size-1].widget)
diff --git a/src/gui/kernel/qeventdispatcher_s60_p.h b/src/gui/kernel/qeventdispatcher_s60_p.h
index c14fef0..539a21c 100644
--- a/src/gui/kernel/qeventdispatcher_s60_p.h
+++ b/src/gui/kernel/qeventdispatcher_s60_p.h
@@ -75,6 +75,13 @@ public:
void complete();
private:
+ // Workaround for a BC break from S60 3.2 -> 5.0, where the CEikonEnv override was removed.
+ // To avoid linking to that when we build against 3.2, define an empty body here.
+ // Reserved_*() have been verified to be empty in the S60 code.
+ void Reserved_1() {}
+ void Reserved_2() {}
+
+private:
int m_lastIterationCount;
TInt m_savedStatusCode;
bool m_hasAlreadyRun;
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 997419b..b89cb88 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2822,23 +2822,31 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
if (NSWindow *pwin = [qt_mac_nativeview_for(parent) window]) {
if (set) {
Qt::WindowType ptype = parent->window()->windowType();
- if ([pwin isVisible] && (ptype == Qt::Window || ptype == Qt::Dialog) && ![qwin parentWindow])
+ if ([pwin isVisible] && (ptype == Qt::Window || ptype == Qt::Dialog) && ![qwin parentWindow]) {
+ NSInteger level = [qwin level];
[pwin addChildWindow:qwin ordered:NSWindowAbove];
+ if ([qwin level] < level)
+ [qwin setLevel:level];
+ }
} else {
[pwin removeChildWindow:qwin];
}
}
}
- QList<QWidget *> widgets = q->findChildren<QWidget *>();
+ QObjectList widgets = q->children();
for (int i=0; i<widgets.size(); ++i) {
- QWidget *child = widgets.at(i);
+ QWidget *child = qobject_cast<QWidget *>(widgets.at(i));
if (child && child->isWindow()) {
if (NSWindow *cwin = [qt_mac_nativeview_for(child) window]) {
if (set) {
Qt::WindowType ctype = child->window()->windowType();
- if ([cwin isVisible] && (ctype == Qt::Window || ctype == Qt::Dialog) && ![cwin parentWindow])
+ if ([cwin isVisible] && (ctype == Qt::Window || ctype == Qt::Dialog) && ![cwin parentWindow]) {
+ NSInteger level = [cwin level];
[qwin addChildWindow:cwin ordered:NSWindowAbove];
+ if ([cwin level] < level)
+ [cwin setLevel:level];
+ }
} else {
[qwin removeChildWindow:qt_mac_window_for(child)];
}
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 609307c..d6ad3c3 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -504,7 +504,7 @@ void QWidgetPrivate::show_sys()
CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba,
CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
- CEikButtonGroupContainer *oldCba = CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(cba);
+ CEikButtonGroupContainer *oldCba = factory->SwapButtonGroup(cba);
Q_ASSERT(!oldCba);
S60->setButtonGroupContainer(cba);
@@ -513,7 +513,7 @@ void QWidgetPrivate::show_sys()
menuBar->SetMenuType(CEikMenuBar::EMenuOptions);
S60->appUi()->AddToStackL(menuBar,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus);
- CEikMenuBar *oldMenu = CEikonEnv::Static()->AppUiFactory()->SwapMenuBar(menuBar);
+ CEikMenuBar *oldMenu = factory->SwapMenuBar(menuBar);
Q_ASSERT(!oldMenu);
)
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index a4ab278..024a69d 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6432,6 +6432,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedTiled(int count, const QSpan *sp
int px = int(tx) - (tx < 0);
int py = int(ty) - (ty < 0);
+ px %= image_width;
+ py %= image_height;
if (px < 0)
px += image_width;
if (py < 0)
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 0cc2e40..33fd21e 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -1684,9 +1684,7 @@ QT_TRIVIAL_MEMCONVERT_IMPL(qrgb888)
QT_TRIVIAL_MEMCONVERT_IMPL(qargb6666)
QT_TRIVIAL_MEMCONVERT_IMPL(qrgb666)
QT_TRIVIAL_MEMCONVERT_IMPL(quint16)
-#ifdef Q_WS_QWS
QT_TRIVIAL_MEMCONVERT_IMPL(qrgb565)
-#endif
QT_TRIVIAL_MEMCONVERT_IMPL(qargb8565)
QT_TRIVIAL_MEMCONVERT_IMPL(qargb8555)
QT_TRIVIAL_MEMCONVERT_IMPL(qrgb555)
@@ -1783,9 +1781,7 @@ QT_RECTCONVERT_TRIVIAL_IMPL(quint32)
QT_RECTCONVERT_TRIVIAL_IMPL(qrgb888)
QT_RECTCONVERT_TRIVIAL_IMPL(qargb6666)
QT_RECTCONVERT_TRIVIAL_IMPL(qrgb666)
-#ifdef Q_WS_QWS
QT_RECTCONVERT_TRIVIAL_IMPL(qrgb565)
-#endif
QT_RECTCONVERT_TRIVIAL_IMPL(qargb8565)
QT_RECTCONVERT_TRIVIAL_IMPL(quint16)
QT_RECTCONVERT_TRIVIAL_IMPL(qargb8555)
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index ec9ebeb..001345f 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -963,49 +963,53 @@
const QT_FT_Vector* control2,
const QT_FT_Vector* to )
{
+ TPos dx, dy, da, db;
int top, level;
int* levels;
QT_FT_Vector* arc;
- int mid_x = ( DOWNSCALE( ras.x ) + to->x +
- 3 * (control1->x + control2->x ) ) / 8;
- int mid_y = ( DOWNSCALE( ras.y ) + to->y +
- 3 * (control1->y + control2->y ) ) / 8;
- TPos dx = DOWNSCALE( ras.x ) + to->x - ( mid_x << 1 );
- TPos dy = DOWNSCALE( ras.y ) + to->y - ( mid_y << 1 );
+ dx = DOWNSCALE( ras.x ) + to->x - ( control1->x << 1 );
if ( dx < 0 )
dx = -dx;
+ dy = DOWNSCALE( ras.y ) + to->y - ( control1->y << 1 );
if ( dy < 0 )
dy = -dy;
if ( dx < dy )
dx = dy;
+ da = dx;
+
+ dx = DOWNSCALE( ras.x ) + to->x - 3 * ( control1->x + control2->x );
+ if ( dx < 0 )
+ dx = -dx;
+ dy = DOWNSCALE( ras.y ) + to->y - 3 * ( control1->y + control2->y );
+ if ( dy < 0 )
+ dy = -dy;
+ if ( dx < dy )
+ dx = dy;
+ db = dx;
level = 1;
- dx /= ras.cubic_level;
- while ( dx > 0 )
+ da = da / ras.cubic_level;
+ db = db / ras.conic_level;
+ while ( da > 0 || db > 0 )
{
- dx >>= 2;
+ da >>= 2;
+ db >>= 3;
level++;
}
if ( level <= 1 )
{
- TPos to_x, to_y;
+ TPos to_x, to_y, mid_x, mid_y;
to_x = UPSCALE( to->x );
to_y = UPSCALE( to->y );
-
- /* Recalculation of midpoint is needed only if */
- /* UPSCALE and DOWNSCALE have any effect. */
-
-#if ( PIXEL_BITS != 6 )
mid_x = ( ras.x + to_x +
3 * UPSCALE( control1->x + control2->x ) ) / 8;
mid_y = ( ras.y + to_y +
3 * UPSCALE( control1->y + control2->y ) ) / 8;
-#endif
gray_render_line( RAS_VAR_ mid_x, mid_y );
gray_render_line( RAS_VAR_ to_x, to_y );
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index a17b7c1..5060ad6 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -868,9 +868,9 @@ QWingedEdge::QWingedEdge() :
}
QWingedEdge::QWingedEdge(const QPainterPath &subject, const QPainterPath &clip) :
- m_edges(subject.length()),
- m_vertices(subject.length()),
- m_segments(subject.length())
+ m_edges(subject.elementCount()),
+ m_vertices(subject.elementCount()),
+ m_segments(subject.elementCount())
{
m_segments.setPath(subject);
m_segments.addPath(clip);
@@ -1405,9 +1405,9 @@ bool QPathClipper::intersect()
else if (clipIsRect)
return subjectPath.intersects(r2);
- QPathSegments a(subjectPath.length());
+ QPathSegments a(subjectPath.elementCount());
a.setPath(subjectPath);
- QPathSegments b(clipPath.length());
+ QPathSegments b(clipPath.elementCount());
b.setPath(clipPath);
QIntersectionFinder finder;
@@ -1450,9 +1450,9 @@ bool QPathClipper::contains()
if (clipIsRect)
return subjectPath.contains(r2);
- QPathSegments a(subjectPath.length());
+ QPathSegments a(subjectPath.elementCount());
a.setPath(subjectPath);
- QPathSegments b(clipPath.length());
+ QPathSegments b(clipPath.elementCount());
b.setPath(clipPath);
QIntersectionFinder finder;
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index 5e168c6..9a77a7a 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -116,7 +116,6 @@ public:
const QSymbianTypeFaceExtras *extras(const QString &typeface, bool bold, bool italic) const;
void addFontFileToFontStore(const QFileInfo &fontFileInfo);
-#ifndef Q_SYMBIAN_HAS_FONTTABLE_API
struct CFontFromFontStoreReleaser {
static inline void cleanup(CFont *font)
{
@@ -127,7 +126,6 @@ public:
dbExtras->m_store->ReleaseFont(font);
}
};
-#endif // !Q_SYMBIAN_HAS_FONTTABLE_API
struct CFontFromScreenDeviceReleaser {
static inline void cleanup(CFont *font)
@@ -138,37 +136,38 @@ public:
}
};
-#ifndef Q_SYMBIAN_HAS_FONTTABLE_API
+// m_heap, m_store, m_rasterizer and m_extras are used if Symbian
+// does not provide the Font Table API
RHeap* m_heap;
CFontStore *m_store;
COpenFontRasterizer *m_rasterizer;
mutable QList<const QSymbianTypeFaceExtras *> m_extras;
-#endif // !Q_SYMBIAN_HAS_FONTTABLE_API
+
mutable QHash<QString, const QSymbianTypeFaceExtras *> m_extrasHash;
};
QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementation()
{
-#ifndef Q_SYMBIAN_HAS_FONTTABLE_API
- QStringList filters;
- filters.append(QLatin1String("*.ttf"));
- filters.append(QLatin1String("*.ccc"));
- filters.append(QLatin1String("*.ltt"));
- const QFileInfoList fontFiles = alternativeFilePaths(QLatin1String("resource\\Fonts"), filters);
-
- const TInt heapMinLength = 0x1000;
- const TInt heapMaxLength = qMax(0x20000 * fontFiles.count(), heapMinLength);
- m_heap = User::ChunkHeap(NULL, heapMinLength, heapMaxLength);
- QT_TRAP_THROWING(
- m_store = CFontStore::NewL(m_heap);
- m_rasterizer = COpenFontRasterizer::NewL(TUid::Uid(0x101F7F5E));
- CleanupStack::PushL(m_rasterizer);
- m_store->InstallRasterizerL(m_rasterizer);
- CleanupStack::Pop(m_rasterizer););
-
- foreach (const QFileInfo &fontFileInfo, fontFiles)
- addFontFileToFontStore(fontFileInfo);
-#endif // !Q_SYMBIAN_HAS_FONTTABLE_API
+ if (!QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) {
+ QStringList filters;
+ filters.append(QLatin1String("*.ttf"));
+ filters.append(QLatin1String("*.ccc"));
+ filters.append(QLatin1String("*.ltt"));
+ const QFileInfoList fontFiles = alternativeFilePaths(QLatin1String("resource\\Fonts"), filters);
+
+ const TInt heapMinLength = 0x1000;
+ const TInt heapMaxLength = qMax(0x20000 * fontFiles.count(), heapMinLength);
+ m_heap = User::ChunkHeap(NULL, heapMinLength, heapMaxLength);
+ QT_TRAP_THROWING(
+ m_store = CFontStore::NewL(m_heap);
+ m_rasterizer = COpenFontRasterizer::NewL(TUid::Uid(0x101F7F5E));
+ CleanupStack::PushL(m_rasterizer);
+ m_store->InstallRasterizerL(m_rasterizer);
+ CleanupStack::Pop(m_rasterizer););
+
+ foreach (const QFileInfo &fontFileInfo, fontFiles)
+ addFontFileToFontStore(fontFileInfo);
+ }
}
void qt_cleanup_symbianFontDatabaseExtras()
@@ -177,26 +176,26 @@ void qt_cleanup_symbianFontDatabaseExtras()
static_cast<const QSymbianFontDatabaseExtrasImplementation*>(privateDb()->symbianExtras);
if (!dbExtras)
return; // initializeDb() has never been called
-#ifdef Q_SYMBIAN_HAS_FONTTABLE_API
- qDeleteAll(dbExtras->m_extrasHash);
-#else // Q_SYMBIAN_HAS_FONTTABLE_API
- typedef QList<const QSymbianTypeFaceExtras *>::iterator iterator;
- for (iterator p = dbExtras->m_extras.begin(); p != dbExtras->m_extras.end(); ++p) {
- dbExtras->m_store->ReleaseFont((*p)->fontOwner());
- delete *p;
+ if (QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) {
+ qDeleteAll(dbExtras->m_extrasHash);
+ } else {
+ typedef QList<const QSymbianTypeFaceExtras *>::iterator iterator;
+ for (iterator p = dbExtras->m_extras.begin(); p != dbExtras->m_extras.end(); ++p) {
+ dbExtras->m_store->ReleaseFont((*p)->fontOwner());
+ delete *p;
+ }
+ dbExtras->m_extras.clear();
}
- dbExtras->m_extras.clear();
-#endif // Q_SYMBIAN_HAS_FONTTABLE_API
dbExtras->m_extrasHash.clear();
}
QSymbianFontDatabaseExtrasImplementation::~QSymbianFontDatabaseExtrasImplementation()
{
qt_cleanup_symbianFontDatabaseExtras();
-#ifndef Q_SYMBIAN_HAS_FONTTABLE_API
- delete m_store;
- m_heap->Close();
-#endif // !Q_SYMBIAN_HAS_FONTTABLE_API
+ if (!QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) {
+ delete m_store;
+ m_heap->Close();
+ }
}
#ifndef FNTSTORE_H_INLINES_SUPPORT_FMM
@@ -228,44 +227,45 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c
searchSpec.iFontStyle.SetPosture(EPostureItalic);
CFont* font = NULL;
-#ifdef Q_SYMBIAN_HAS_FONTTABLE_API
- const TInt err = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(font, searchSpec);
- Q_ASSERT(err == KErrNone && font);
- QScopedPointer<CFont, CFontFromScreenDeviceReleaser> sFont(font);
- QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font);
- sFont.take();
- m_extrasHash.insert(searchKey, extras);
-#else // Q_SYMBIAN_HAS_FONTTABLE_API
- const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, searchSpec);
- Q_ASSERT(err == KErrNone && font);
- const CBitmapFont *bitmapFont = static_cast<CBitmapFont*>(font);
- COpenFont *openFont =
-#ifdef FNTSTORE_H_INLINES_SUPPORT_FMM
- bitmapFont->OpenFont();
-#else // FNTSTORE_H_INLINES_SUPPORT_FMM
- OpenFontFromBitmapFont(bitmapFont);
-#endif // FNTSTORE_H_INLINES_SUPPORT_FMM
- const TOpenFontFaceAttrib* const attrib = openFont->FaceAttrib();
- const QString foundKey =
- QString((const QChar*)attrib->FullName().Ptr(), attrib->FullName().Length());
- if (!m_extrasHash.contains(foundKey)) {
- QScopedPointer<CFont, CFontFromFontStoreReleaser> sFont(font);
- QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font, openFont);
+ if (QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) {
+ const TInt err = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(font, searchSpec);
+ Q_ASSERT(err == KErrNone && font);
+ QScopedPointer<CFont, CFontFromScreenDeviceReleaser> sFont(font);
+ QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font);
sFont.take();
- m_extras.append(extras);
m_extrasHash.insert(searchKey, extras);
- m_extrasHash.insert(foundKey, extras);
} else {
- m_store->ReleaseFont(font);
- m_extrasHash.insert(searchKey, m_extrasHash.value(foundKey));
+ const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, searchSpec);
+ Q_ASSERT(err == KErrNone && font);
+ const CBitmapFont *bitmapFont = static_cast<CBitmapFont*>(font);
+ COpenFont *openFont =
+#ifdef FNTSTORE_H_INLINES_SUPPORT_FMM
+ bitmapFont->OpenFont();
+#else // FNTSTORE_H_INLINES_SUPPORT_FMM
+ OpenFontFromBitmapFont(bitmapFont);
+#endif // FNTSTORE_H_INLINES_SUPPORT_FMM
+ const TOpenFontFaceAttrib* const attrib = openFont->FaceAttrib();
+ const QString foundKey =
+ QString((const QChar*)attrib->FullName().Ptr(), attrib->FullName().Length());
+ if (!m_extrasHash.contains(foundKey)) {
+ QScopedPointer<CFont, CFontFromFontStoreReleaser> sFont(font);
+ QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font, openFont);
+ sFont.take();
+ m_extras.append(extras);
+ m_extrasHash.insert(searchKey, extras);
+ m_extrasHash.insert(foundKey, extras);
+ } else {
+ m_store->ReleaseFont(font);
+ m_extrasHash.insert(searchKey, m_extrasHash.value(foundKey));
+ }
}
-#endif // Q_SYMBIAN_HAS_FONTTABLE_API
}
return m_extrasHash.value(searchKey);
}
void QSymbianFontDatabaseExtrasImplementation::addFontFileToFontStore(const QFileInfo &fontFileInfo)
{
+ Q_ASSERT(!QSymbianTypeFaceExtras::symbianFontTableApiAvailable());
const QString fontFile = QDir::toNativeSeparators(fontFileInfo.absoluteFilePath());
TPtrC fontFilePtr(qt_QString2TPtrC(fontFile));
QT_TRAP_THROWING(m_store->AddFileL(fontFilePtr));
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index bf30e1c..f8e5b4a 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -46,114 +46,115 @@
#include <private/qapplication_p.h>
#include "qimage.h"
#include <private/qt_s60_p.h>
+#include <private/qpixmap_s60_p.h>
#include <e32base.h>
#include <e32std.h>
#include <eikenv.h>
#include <gdi.h>
-#if defined(Q_SYMBIAN_HAS_FONTTABLE_API) || defined(Q_SYMBIAN_HAS_GLYPHOUTLINE_API)
+#if defined(Q_SYMBIAN_HAS_GLYPHOUTLINE_API)
#include <graphics/gdi/gdiplatapi.h>
-#endif // Q_SYMBIAN_HAS_FONTTABLE_API || Q_SYMBIAN_HAS_GLYPHOUTLINE_API
+#endif // Q_SYMBIAN_HAS_GLYPHOUTLINE_API
+
+// Replication of TGetFontTableParam & friends.
+// There is unfortunately no compile time flag like SYMBIAN_FONT_TABLE_API
+// that would help us to only replicate these things for Symbian versions
+// that do not yet have the font table Api. Symbian's public SDK does
+// generally not define any usable macros.
+class QSymbianTGetFontTableParam
+{
+public:
+ TUint32 iTag;
+ TAny *iContent;
+ TInt iLength;
+};
+const TUid QSymbianKFontGetFontTable = {0x102872C1};
+const TUid QSymbianKFontReleaseFontTable = {0x2002AC24};
QT_BEGIN_NAMESPACE
-#ifdef Q_SYMBIAN_HAS_FONTTABLE_API
QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* cFont, COpenFont *openFont)
: m_cFont(cFont)
, m_symbolCMap(false)
+ , m_openFont(openFont)
{
- Q_UNUSED(openFont)
+ if (!symbianFontTableApiAvailable()) {
+ TAny *trueTypeExtension = NULL;
+ m_openFont->ExtendedInterface(KUidOpenFontTrueTypeExtension, trueTypeExtension);
+ m_trueTypeExtension = static_cast<MOpenFontTrueTypeExtension*>(trueTypeExtension);
+ Q_ASSERT(m_trueTypeExtension);
+ }
}
QSymbianTypeFaceExtras::~QSymbianTypeFaceExtras()
{
- S60->screenDevice()->ReleaseFont(m_cFont);
+ if (symbianFontTableApiAvailable())
+ S60->screenDevice()->ReleaseFont(m_cFont);
}
QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const
{
- RFontTable fontTable;
- if (fontTable.Open(*m_cFont, tag) != KErrNone)
+ if (symbianFontTableApiAvailable()) {
+ QSymbianTGetFontTableParam fontTableParams = { tag, 0, 0 };
+ if (m_cFont->ExtendedFunction(QSymbianKFontGetFontTable, &fontTableParams) == KErrNone) {
+ const char* const fontTableContent =
+ static_cast<const char *>(fontTableParams.iContent);
+ const QByteArray fontTable(fontTableContent, fontTableParams.iLength);
+ m_cFont->ExtendedFunction(QSymbianKFontReleaseFontTable, &fontTableParams);
+ return fontTable;
+ }
return QByteArray();
- const QByteArray byteArray(reinterpret_cast<const char *>
- (fontTable.TableContent()),fontTable.TableLength());
- fontTable.Close();
- return byteArray;
+ } else {
+ Q_ASSERT(m_trueTypeExtension->HasTrueTypeTable(tag));
+ TInt error = KErrNone;
+ TInt tableByteLength = 0;
+ TAny *table = q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength));
+ const QByteArray result(static_cast<const char*>(table), tableByteLength);
+ m_trueTypeExtension->ReleaseTrueTypeTable(table);
+ return result;
+ }
}
bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *length) const
{
- RFontTable fontTable;
- if (fontTable.Open(*m_cFont, tag) != KErrNone)
- return false;
-
bool result = true;
- const TInt tableByteLength = fontTable.TableLength();
-
- if (*length > 0 && *length < tableByteLength) {
- result = false; // Caller did not allocate enough memory
+ if (symbianFontTableApiAvailable()) {
+ QSymbianTGetFontTableParam fontTableParams = { tag, 0, 0 };
+ if (m_cFont->ExtendedFunction(QSymbianKFontGetFontTable, &fontTableParams) == KErrNone) {
+ if (*length > 0 && *length < fontTableParams.iLength) {
+ result = false; // Caller did not allocate enough memory
+ } else {
+ *length = fontTableParams.iLength;
+ if (buffer)
+ memcpy(buffer, fontTableParams.iContent, fontTableParams.iLength);
+ }
+ m_cFont->ExtendedFunction(QSymbianKFontReleaseFontTable, &fontTableParams);
+ } else {
+ result = false;
+ }
} else {
- *length = tableByteLength;
- if (buffer)
- memcpy(buffer, fontTable.TableContent(), tableByteLength);
- }
-
- fontTable.Close();
- return result;
-}
-
-#else // Q_SYMBIAN_HAS_FONTTABLE_API
-QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* cFont, COpenFont *openFont)
- : m_cFont(cFont)
- , m_symbolCMap(false)
- , m_openFont(openFont)
-{
- TAny *trueTypeExtension = NULL;
- m_openFont->ExtendedInterface(KUidOpenFontTrueTypeExtension, trueTypeExtension);
- m_trueTypeExtension = static_cast<MOpenFontTrueTypeExtension*>(trueTypeExtension);
- Q_ASSERT(m_trueTypeExtension);
-}
-
-QSymbianTypeFaceExtras::~QSymbianTypeFaceExtras()
-{
-}
-
-QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const
-{
- Q_ASSERT(m_trueTypeExtension->HasTrueTypeTable(tag));
- TInt error = KErrNone;
- TInt tableByteLength = 0;
- TAny *table = q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength));
- QByteArray result(static_cast<const char*>(table), tableByteLength);
- m_trueTypeExtension->ReleaseTrueTypeTable(table);
- return result;
-}
+ if (!m_trueTypeExtension->HasTrueTypeTable(tag))
+ return false;
-bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *length) const
-{
- if (!m_trueTypeExtension->HasTrueTypeTable(tag))
- return false;
+ TInt error = KErrNone;
+ TInt tableByteLength;
+ TAny *table =
+ q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength));
- bool result = true;
- TInt error = KErrNone;
- TInt tableByteLength;
- TAny *table =
- q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength));
+ if (error != KErrNone) {
+ return false;
+ } else if (*length > 0 && *length < tableByteLength) {
+ result = false; // Caller did not allocate enough memory
+ } else {
+ *length = tableByteLength;
+ if (buffer)
+ memcpy(buffer, table, tableByteLength);
+ }
- if (error != KErrNone) {
- return false;
- } else if (*length > 0 && *length < tableByteLength) {
- result = false; // Caller did not allocate enough memory
- } else {
- *length = tableByteLength;
- if (buffer)
- memcpy(buffer, table, tableByteLength);
+ m_trueTypeExtension->ReleaseTrueTypeTable(table);
}
-
- m_trueTypeExtension->ReleaseTrueTypeTable(table);
return result;
}
-#endif // Q_SYMBIAN_HAS_FONTTABLE_API
const uchar *QSymbianTypeFaceExtras::cmap() const
{
@@ -195,6 +196,39 @@ QFixed QSymbianTypeFaceExtras::unitsPerEm() const
return m_unitsPerEm;
}
+bool QSymbianTypeFaceExtras::symbianFontTableApiAvailable()
+{
+ enum FontTableApiAvailability {
+ Unknown,
+ Available,
+ Unavailable
+ };
+ static FontTableApiAvailability availability =
+ QSysInfo::symbianVersion() < QSysInfo::SV_SF_3 ?
+ Unavailable : Unknown;
+ if (availability == Unknown) {
+ // Actually, we should ask CFeatureDiscovery::IsFeatureSupportedL()
+ // with FfFontTable here. But since at the time of writing, the
+ // FfFontTable flag check either gave false positives or false
+ // negatives. Here comes an implicit check via CFont::ExtendedFunction.
+ QSymbianTGetFontTableParam fontTableParams = {
+ MAKE_TAG('O', 'S', '/', '2'), 0, 0 };
+ QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
+ CFont *font;
+ const TInt getFontErr = S60->screenDevice()->GetNearestFontInTwips(font, TFontSpec());
+ Q_ASSERT(getFontErr == KErrNone);
+ if (font->ExtendedFunction(QSymbianKFontGetFontTable, &fontTableParams) == KErrNone) {
+ font->ExtendedFunction(QSymbianKFontReleaseFontTable, &fontTableParams);
+ availability = Available;
+ } else {
+ availability = Unavailable;
+ }
+ S60->screenDevice()->ReleaseFont(font);
+ lock.relock();
+ }
+ return availability == Available;
+}
+
// duplicated from qfontengine_xyz.cpp
static inline unsigned int getChar(const QChar *str, int &i, const int len)
{
diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h
index c65ce55..cdf2185 100644
--- a/src/gui/text/qfontengine_s60_p.h
+++ b/src/gui/text/qfontengine_s60_p.h
@@ -58,13 +58,11 @@
#include "qsize.h"
#include <openfont.h>
-#ifdef SYMBIAN_GDI_GLYPHDATA
-#define Q_SYMBIAN_HAS_FONTTABLE_API
-#endif
-
-#ifdef Q_SYMBIAN_HAS_FONTTABLE_API
+// The glyph outline code is intentionally disabled. It will be reactivated as
+// soon as the glyph outline API is backported from Symbian(^4) to Symbian(^3).
+#if 0
#define Q_SYMBIAN_HAS_GLYPHOUTLINE_API
-#endif // Q_SYMBIAN_HAS_FONTTABLE_API
+#endif
class CFont;
@@ -83,16 +81,18 @@ public:
CFont *fontOwner() const;
bool isSymbolCMap() const;
QFixed unitsPerEm() const;
+ static bool symbianFontTableApiAvailable();
private:
CFont* m_cFont;
mutable bool m_symbolCMap;
mutable QByteArray m_cmapTable;
mutable QFixed m_unitsPerEm;
-#ifndef Q_SYMBIAN_HAS_FONTTABLE_API
+
+ // m_openFont and m_openFont are used if Symbian does not provide
+ // the Font Table API
COpenFont *m_openFont;
mutable MOpenFontTrueTypeExtension *m_trueTypeExtension;
-#endif // Q_SYMBIAN_HAS_FONTTABLE_API
};
class QFontEngineS60 : public QFontEngine
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index c35069f..77e6aa1 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -596,8 +596,10 @@ void QTextDocument::markContentsDirty(int from, int length)
Q_D(QTextDocument);
d->documentChange(from, length);
if (!d->inContentsChange) {
- d->lout->documentChanged(d->docChangeFrom, d->docChangeOldLength, d->docChangeLength);
- d->docChangeFrom = -1;
+ if (d->lout) {
+ d->lout->documentChanged(d->docChangeFrom, d->docChangeOldLength, d->docChangeLength);
+ d->docChangeFrom = -1;
+ }
}
}
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 7859bdc..5a4e507 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -398,7 +398,7 @@ void QComboBoxPrivateContainer::leaveEvent(QEvent *)
#ifdef Q_WS_MAC
QStyleOptionComboBox opt = comboStyleOption();
if (combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo))
- view->clearSelection();
+ view->setCurrentIndex(QModelIndex());
#endif
}
diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp
index 42be03b..011b07a 100644
--- a/src/gui/widgets/qlabel.cpp
+++ b/src/gui/widgets/qlabel.cpp
@@ -682,7 +682,7 @@ QSize QLabelPrivate::sizeForWidth(int w) const
bool tryWidth = (w < 0) && (align & Qt::TextWordWrap);
if (tryWidth)
- w = fm.averageCharWidth() * 80;
+ w = qMin(fm.averageCharWidth() * 80, q->maximumSize().width());
else if (w < 0)
w = 2000;
w -= (hextra + contentsMargin.width());
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index f338f40..5ea9dc4 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -1308,6 +1308,15 @@ void QLineControl::setCursorBlinkPeriod(int msec)
m_blinkPeriod = msec;
}
+void QLineControl::resetCursorBlinkTimer()
+{
+ if (m_blinkPeriod == 0 || m_blinkTimer == 0)
+ return;
+ killTimer(m_blinkTimer);
+ m_blinkTimer = startTimer(m_blinkPeriod / 2);
+ m_blinkStatus = 1;
+}
+
void QLineControl::timerEvent(QTimerEvent *event)
{
if (event->timerId() == m_blinkTimer) {
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index 7068f62..d881acf 100644
--- a/src/gui/widgets/qlinecontrol_p.h
+++ b/src/gui/widgets/qlinecontrol_p.h
@@ -296,6 +296,7 @@ public:
int cursorBlinkPeriod() const { return m_blinkPeriod; }
void setCursorBlinkPeriod(int msec);
+ void resetCursorBlinkTimer();
QString cancelText() const { return m_cancelText; }
void setCancelText(const QString &text) { m_cancelText = text; }
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 4bea6de..74c2a9e 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -1320,6 +1320,9 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
Conversely, actions can be added to widgets with the addAction(),
addActions() and insertAction() functions.
+ \warning To make QMenu visible on the screen, exec() or popup() should be
+ used instead of show().
+
\section1 QMenu on Qt for Windows CE
If a menu is integrated into the native menubar on Windows Mobile we
@@ -1795,10 +1798,12 @@ QSize QMenu::sizeHint() const
void QMenu::popup(const QPoint &p, QAction *atAction)
{
Q_D(QMenu);
+#ifndef Q_OS_SYMBIAN
if (d->scroll) { // reset scroll state from last popup
d->scroll->scrollOffset = 0;
d->scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone;
}
+#endif
d->tearoffHighlighted = 0;
d->motions = 0;
d->doChildEffects = true;
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index cf6e674..3d1df06 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -271,8 +271,8 @@ void QNetworkReplyImplPrivate::_q_networkSessionConnected()
void QNetworkReplyImplPrivate::_q_networkSessionFailed()
{
- // Abort waiting replies.
- if (state == WaitingForSession) {
+ // Abort waiting and working replies.
+ if (state == WaitingForSession || state == Working) {
state = Working;
error(QNetworkReplyImpl::UnknownNetworkError,
QCoreApplication::translate("QNetworkReply", "Network session error."));
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 3ddc15a..668a3f0 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -163,6 +163,8 @@ void QGL2PaintEngineExPrivate::setBrush(const QBrush& brush)
Q_ASSERT(newStyle != Qt::NoBrush);
currentBrush = brush;
+ if (!currentBrushPixmap.isNull())
+ currentBrushPixmap = QPixmap();
brushUniformsDirty = true; // All brushes have at least one uniform
if (newStyle > Qt::SolidPattern)
@@ -221,10 +223,14 @@ void QGL2PaintEngineExPrivate::updateBrushTexture()
updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform);
}
else if (style == Qt::TexturePattern) {
- const QPixmap& texPixmap = currentBrush.texture();
+ currentBrushPixmap = currentBrush.texture();
+
+ int max_texture_size = ctx->d_func()->maxTextureSize();
+ if (currentBrushPixmap.width() > max_texture_size || currentBrushPixmap.height() > max_texture_size)
+ currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
- QGLTexture *tex = ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA,
+ QGLTexture *tex = ctx->d_func()->bindTexture(currentBrushPixmap, GL_TEXTURE_2D, GL_RGBA,
QGLContext::InternalBindOption |
QGLContext::CanFlipNativePixmapBindOption);
updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform);
@@ -1305,13 +1311,30 @@ void QGL2PaintEngineEx::transformChanged()
}
+static const QRectF scaleRect(const QRectF &r, qreal sx, qreal sy)
+{
+ return QRectF(r.x() * sx, r.y() * sy, r.width() * sx, r.height() * sy);
+}
+
void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, const QRectF & src)
{
Q_D(QGL2PaintEngineEx);
+ QGLContext *ctx = d->ctx;
+
+ int max_texture_size = ctx->d_func()->maxTextureSize();
+ if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) {
+ QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
+
+ const qreal sx = scaled.width() / qreal(pixmap.width());
+ const qreal sy = scaled.height() / qreal(pixmap.height());
+
+ drawPixmap(dest, scaled, scaleRect(src, sx, sy));
+ return;
+ }
+
ensureActive();
d->transferMode(ImageDrawingMode);
- QGLContext *ctx = d->ctx;
glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
QGLTexture *texture =
ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA,
@@ -1334,11 +1357,24 @@ void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const
Qt::ImageConversionFlags)
{
Q_D(QGL2PaintEngineEx);
+ QGLContext *ctx = d->ctx;
+
+ int max_texture_size = ctx->d_func()->maxTextureSize();
+ if (image.width() > max_texture_size || image.height() > max_texture_size) {
+ QImage scaled = image.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
+
+ const qreal sx = scaled.width() / qreal(image.width());
+ const qreal sy = scaled.height() / qreal(image.height());
+
+ drawImage(dest, scaled, scaleRect(src, sx, sy));
+ return;
+ }
+
ensureActive();
d->transferMode(ImageDrawingMode);
- QGLContext *ctx = d->ctx;
glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
+
QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption);
GLuint id = texture->id;
@@ -1464,6 +1500,7 @@ namespace {
QSize cacheSize;
QGL2PEXVertexArray vertexCoordinateArray;
QGL2PEXVertexArray textureCoordinateArray;
+ QFontEngineGlyphCache::Type glyphType;
};
}
@@ -1477,22 +1514,29 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
QOpenGL2PaintEngineState *s = q->state();
+ bool recreateVertexArrays = false;
+
QGLTextureGlyphCache *cache =
(QGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(ctx, glyphType, QTransform());
if (!cache || cache->cacheType() != glyphType) {
cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
staticTextItem->fontEngine()->setGlyphCache(ctx, cache);
+ recreateVertexArrays = true;
} else if (cache->context() == 0) { // Old context has been destroyed, new context has same ptr value
cache->setContext(ctx);
}
- bool recreateVertexArrays = false;
- if (staticTextItem->userDataNeedsUpdate)
+ if (staticTextItem->userDataNeedsUpdate) {
recreateVertexArrays = true;
- else if (staticTextItem->userData() == 0)
+ } else if (staticTextItem->userData() == 0) {
recreateVertexArrays = true;
- else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData)
+ } else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
recreateVertexArrays = true;
+ } else {
+ QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData());
+ if (userData->glyphType != glyphType)
+ recreateVertexArrays = true;
+ }
// We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays.
// If the cache size has changed, we do need to regenerate the vertices, but we don't need to repopulate the
@@ -1504,8 +1548,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
// No space in cache. We need to clear the cache and try again
cache->clear();
cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
- staticTextItem->glyphs, staticTextItem->glyphPositions);
- }
+ staticTextItem->glyphs, staticTextItem->glyphPositions);
+ }
}
if (cache->width() == 0 || cache->height() == 0)
@@ -1535,6 +1579,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData());
}
+ userData->glyphType = glyphType;
+
// Use cache if backend optimizations is turned on
vertexCoordinates = &userData->vertexCoordinateArray;
textureCoordinates = &userData->textureCoordinateArray;
@@ -1727,7 +1773,13 @@ void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *frag
}
ensureActive();
- d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
+ int max_texture_size = d->ctx->d_func()->maxTextureSize();
+ if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) {
+ QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
+ d->drawPixmapFragments(fragments, fragmentCount, scaled, hints);
+ } else {
+ d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
+ }
}
@@ -2139,7 +2191,11 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
const QPointF* const points = reinterpret_cast<const QPointF*>(path.points());
QRectF rect(points[0], points[2]);
- if (state()->matrix.type() <= QTransform::TxScale) {
+ if (state()->matrix.type() <= QTransform::TxScale
+ || (state()->matrix.type() == QTransform::TxRotate
+ && qFuzzyIsNull(state()->matrix.m11())
+ && qFuzzyIsNull(state()->matrix.m22())))
+ {
state()->rectangleClip = state()->rectangleClip.intersected(state()->matrix.mapRect(rect).toRect());
d->updateClipScissorTest();
return;
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index b255e75..02b737b 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -274,6 +274,8 @@ public:
QBrush currentBrush; // May not be the state's brush!
const QBrush noBrush;
+ QPixmap currentBrushPixmap;
+
QGL2PEXVertexArray vertexCoordinateArray;
QGL2PEXVertexArray textureCoordinateArray;
QVector<GLushort> elementIndices;
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
index 705ad09..66445cd 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -128,14 +128,17 @@ void QGLTextureGlyphCache::createTextureData(int width, int height)
m_width = width;
m_height = height;
- QVarLengthArray<uchar> data(width * height);
- for (int i = 0; i < data.size(); ++i)
- data[i] = 0;
-
- if (m_type == QFontEngineGlyphCache::Raster_RGBMask)
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
- else
+ if (m_type == QFontEngineGlyphCache::Raster_RGBMask) {
+ QVarLengthArray<uchar> data(width * height * 4);
+ for (int i = 0; i < data.size(); ++i)
+ data[i] = 0;
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
+ } else {
+ QVarLengthArray<uchar> data(width * height);
+ for (int i = 0; i < data.size(); ++i)
+ data[i] = 0;
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
+ }
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -287,7 +290,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph)
if (mask.format() == QImage::Format_RGB32) {
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits());
} else {
-#ifdef QT_OPENGL_ES2
+#ifdef QT_OPENGL_ES_2
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits());
#else
// glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index bbb98d0..f64b93c 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -377,7 +377,18 @@ void QGLWindowSurface::hijackWindow(QWidget *widget)
if (widgetPrivate->extraData()->glContext)
return;
- QGLContext *ctx = new QGLContext(surfaceFormat, widget);
+ QGLContext *ctx = NULL;
+
+ // For translucent top-level widgets we need alpha in the format.
+ if (widget->testAttribute(Qt::WA_TranslucentBackground)) {
+ QGLFormat modFormat(surfaceFormat);
+ modFormat.setSampleBuffers(false);
+ modFormat.setSamples(0);
+ modFormat.setAlpha(true);
+ ctx = new QGLContext(modFormat, widget);
+ } else
+ ctx = new QGLContext(surfaceFormat, widget);
+
ctx->create(qt_gl_share_widget()->context());
#ifndef QT_NO_EGL
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index b8e8bad..13156d7 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -3210,8 +3210,7 @@ void QVGPaintEngine::drawTiledPixmap
(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
{
QBrush brush(state()->pen.color(), pixmap);
- QTransform xform;
- xform.translate(-s.x(), -s.y());
+ QTransform xform = QTransform::fromTranslate(r.x() - s.x(), r.y() - s.y());
brush.setTransform(xform);
fillRect(r, brush);
}
diff --git a/src/plugins/bearer/icd/proxyconf.cpp b/src/plugins/bearer/icd/proxyconf.cpp
index 37501fb..efe2da7 100644
--- a/src/plugins/bearer/icd/proxyconf.cpp
+++ b/src/plugins/bearer/icd/proxyconf.cpp
@@ -306,12 +306,12 @@ QList<QNetworkProxy> ProxyConfPrivate::flush(const QNetworkProxyQuery &query)
if (isHostExcluded(query.peerHostName()))
return result; // no proxy for this host
- if (mode == "auto") {
+ if (mode == QLatin1String("AUTO")) {
// TODO: pac currently not supported, fix me
return result;
}
- if (mode == "manual") {
+ if (mode == QLatin1String("MANUAL")) {
bool isHttps = false;
QString protocol = query.protocolTag().toLower();
diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp
index 1a2e3fa..ca303a8 100644
--- a/src/plugins/graphicssystems/meego/dithering.cpp
+++ b/src/plugins/graphicssystems/meego/dithering.cpp
@@ -154,7 +154,10 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h
// Add the diffusion for this pixel we stored in the accumulator.
// >> 7 because the values in accumulator are stored * 128
- component[c] += accumulator[c][x] >> 7;
+ if (x != 0 && x != (width - 1)) {
+ if (accumulator[c][x] >> 7 != 0)
+ component[c] += rand() % accumulator[c][x] >> 7;
+ }
// Make sure we're not over the boundaries.
CLAMP_256(component[c]);
@@ -172,10 +175,10 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h
// Distribute the difference according to the matrix in the
// accumulation bufffer.
- ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 7);
- ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 3);
+ ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 3);
+ ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 5);
ACCUMULATE(accumulator[c], x, 1, width, diff * 5);
- ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 1);
+ ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 3);
}
// Write the newly produced pixel
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 507f70b..4a86082 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -124,8 +124,10 @@ QPixmapData* QMeeGoGraphicsSystem::wrapPixmapData(QPixmapData *pmd)
void QMeeGoGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/)
{
- if (QMeeGoGraphicsSystem::surfaceWasCreated)
+ if (QMeeGoGraphicsSystem::surfaceWasCreated) {
qWarning("Trying to set surface fixed size but surface already created!");
+ return;
+ }
#ifdef QT_WAS_PATCHED
QEglProperties *properties = new QEglProperties();
@@ -143,6 +145,11 @@ void QMeeGoGraphicsSystem::setSurfaceScaling(int x, int y, int width, int height
void QMeeGoGraphicsSystem::setTranslucent(bool translucent)
{
+ if (QMeeGoGraphicsSystem::surfaceWasCreated) {
+ qWarning("Trying to set translucency but surface already created!");
+ return;
+ }
+
QGLWindowSurface::surfaceFormat.setSampleBuffers(false);
QGLWindowSurface::surfaceFormat.setSamples(0);
QGLWindowSurface::surfaceFormat.setAlpha(translucent);
diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro
index 691fc80..5d7b61d 100644
--- a/src/plugins/phonon/mmf/mmf.pro
+++ b/src/plugins/phonon/mmf/mmf.pro
@@ -103,7 +103,7 @@ symbian {
exists($${EPOCROOT}epoc32/include/mw/downloadmgrclient.h) {
HEADERS += $$PHONON_MMF_DIR/download.h
SOURCES += $$PHONON_MMF_DIR/download.cpp
- LIBS += -ldownloadmgr
+ LIBS += -lDownloadMgr
DEFINES += PHONON_MMF_PROGRESSIVE_DOWNLOAD
}
}
@@ -125,7 +125,7 @@ symbian {
LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream
# These are for effects.
- LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect
+ LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerbase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect
# This is needed for having the .qtplugin file properly created on Symbian.
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend
diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def
index 6a33fc3..bf4d99f 100644
--- a/src/s60installs/bwins/QtGuiu.def
+++ b/src/s60installs/bwins/QtGuiu.def
@@ -2725,7 +2725,7 @@ EXPORTS
?clearSelection@QTextCursor@@QAEXXZ @ 2724 NONAME ; void QTextCursor::clearSelection(void)
?clearSpans@QTableView@@QAEXXZ @ 2725 NONAME ; void QTableView::clearSpans(void)
?clearString@QLineControl@@ABE?AVQString@@II@Z @ 2726 NONAME ; class QString QLineControl::clearString(unsigned int, unsigned int) const
- ?clearSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 2727 NONAME ; void QGraphicsItemPrivate::clearSubFocus(class QGraphicsItem *)
+ ?clearSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 2727 NONAME ABSENT ; void QGraphicsItemPrivate::clearSubFocus(class QGraphicsItem *)
?clearUndo@QLineControl@@QAEXXZ @ 2728 NONAME ; void QLineControl::clearUndo(void)
?click@QAbstractButton@@QAEXXZ @ 2729 NONAME ; void QAbstractButton::click(void)
?clicked@QAbstractButton@@IAEX_N@Z @ 2730 NONAME ; void QAbstractButton::clicked(bool)
@@ -9914,7 +9914,7 @@ EXPORTS
?setStyleSheet@QWidget@@QAEXABVQString@@@Z @ 9913 NONAME ; void QWidget::setStyleSheet(class QString const &)
?setStyleStrategy@QFont@@QAEXW4StyleStrategy@1@@Z @ 9914 NONAME ; void QFont::setStyleStrategy(enum QFont::StyleStrategy)
?setStyle_helper@QWidgetPrivate@@QAEXPAVQStyle@@_N1@Z @ 9915 NONAME ; void QWidgetPrivate::setStyle_helper(class QStyle *, bool, bool)
- ?setSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 9916 NONAME ; void QGraphicsItemPrivate::setSubFocus(class QGraphicsItem *)
+ ?setSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 9916 NONAME ABSENT ; void QGraphicsItemPrivate::setSubFocus(class QGraphicsItem *)
?setSubTitle@QWizardPage@@QAEXABVQString@@@Z @ 9917 NONAME ; void QWizardPage::setSubTitle(class QString const &)
?setSubTitleFormat@QWizard@@QAEXW4TextFormat@Qt@@@Z @ 9918 NONAME ; void QWizard::setSubTitleFormat(enum Qt::TextFormat)
?setSubmitPolicy@QDataWidgetMapper@@QAEXW4SubmitPolicy@1@@Z @ 9919 NONAME ; void QDataWidgetMapper::setSubmitPolicy(enum QDataWidgetMapper::SubmitPolicy)
@@ -12905,4 +12905,7 @@ EXPORTS
?reactivateDeferredActiveObjects@QEventDispatcherS60@@UAEXXZ @ 12904 NONAME ; void QEventDispatcherS60::reactivateDeferredActiveObjects(void)
?userData@QStaticTextItem@@QBEPAVQStaticTextUserData@@XZ @ 12905 NONAME ; class QStaticTextUserData * QStaticTextItem::userData(void) const
?populate@QTextureGlyphCache@@QAE_NPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12906 NONAME ; bool QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *)
+ ?resetCursorBlinkTimer@QLineControl@@QAEXXZ @ 12907 NONAME ; void QLineControl::resetCursorBlinkTimer(void)
+ ?setSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@0@Z @ 12908 NONAME ; void QGraphicsItemPrivate::setSubFocus(class QGraphicsItem *, class QGraphicsItem *)
+ ?clearSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@0@Z @ 12909 NONAME ; void QGraphicsItemPrivate::clearSubFocus(class QGraphicsItem *, class QGraphicsItem *)
diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
index 54768a1..48976a1 100644
--- a/src/s60installs/eabi/QtGuiu.def
+++ b/src/s60installs/eabi/QtGuiu.def
@@ -4658,11 +4658,11 @@ EXPORTS
_ZN20QGraphicsEllipseItemD1Ev @ 4657 NONAME
_ZN20QGraphicsEllipseItemD2Ev @ 4658 NONAME
_ZN20QGraphicsItemPrivate11removeChildEP13QGraphicsItem @ 4659 NONAME
- _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItem @ 4660 NONAME
+ _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItem @ 4660 NONAME ABSENT
_ZN20QGraphicsItemPrivate12remapItemPosEP6QEventP13QGraphicsItem @ 4661 NONAME
_ZN20QGraphicsItemPrivate12resolveDepthEv @ 4662 NONAME
_ZN20QGraphicsItemPrivate12setPosHelperERK7QPointF @ 4663 NONAME
- _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItem @ 4664 NONAME
+ _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItem @ 4664 NONAME ABSENT
_ZN20QGraphicsItemPrivate14setFocusHelperEN2Qt11FocusReasonEb @ 4665 NONAME ABSENT
_ZN20QGraphicsItemPrivate15resetFocusProxyEv @ 4666 NONAME
_ZN20QGraphicsItemPrivate16setEnabledHelperEbbb @ 4667 NONAME
@@ -12105,4 +12105,7 @@ EXPORTS
_ZN15QStaticTextItemD1Ev @ 12104 NONAME
_ZN15QStaticTextItemD2Ev @ 12105 NONAME
_ZN19QEventDispatcherS6031reactivateDeferredActiveObjectsEv @ 12106 NONAME
+ _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItemS1_ @ 12107 NONAME
+ _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItemS1_ @ 12108 NONAME
+ _ZN12QLineControl21resetCursorBlinkTimerEv @ 12109 NONAME
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index ff67bcf..5a435cd 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -132,7 +132,7 @@ symbian: {
codecs_plugins.path = c:$$QT_PLUGINS_BASE_DIR/codecs
contains(QT_CONFIG, phonon-backend) {
- phonon_backend_plugins.sources += $$QMAKE_LIBDIR_QT/phonon_mmf$${QT_LIBINFIX}.dll
+ phonon_backend_plugins.sources += $$QT_BUILD_TREE/plugins/phonon_backend/phonon_mmf$${QT_LIBINFIX}.dll
phonon_backend_plugins.path = c:$$QT_PLUGINS_BASE_DIR/phonon_backend
DEPLOYMENT += phonon_backend_plugins
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/forceActiveFocus.qml b/tests/auto/declarative/qdeclarativefocusscope/data/forceActiveFocus.qml
new file mode 100644
index 0000000..6c39d4a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/forceActiveFocus.qml
@@ -0,0 +1,26 @@
+import QtQuick 1.0
+
+Rectangle {
+ objectName: "root"
+ FocusScope {
+ objectName: "scope"
+ Item {
+ objectName: "item-a1"
+ FocusScope {
+ objectName: "scope-a"
+ Item {
+ objectName: "item-a2"
+ }
+ }
+ }
+ Item {
+ objectName: "item-b1"
+ FocusScope {
+ objectName: "scope-b"
+ Item {
+ objectName: "item-b2"
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
index 1645dac..6a3627b 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
+++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
@@ -71,6 +71,7 @@ private slots:
void noParentFocus();
void signalEmission();
void qtBug13380();
+ void forceActiveFocus();
};
/*
@@ -432,6 +433,114 @@ void tst_qdeclarativefocusscope::qtBug13380()
delete view;
}
+void tst_qdeclarativefocusscope::forceActiveFocus()
+{
+ QDeclarativeView *view = new QDeclarativeView;
+ view->setSource(QUrl::fromLocalFile(SRCDIR "/data/forceActiveFocus.qml"));
+
+ QGraphicsObject *rootObject = view->rootObject();
+ QVERIFY(rootObject);
+
+ QDeclarativeItem *scope = findItem<QDeclarativeItem>(rootObject, QLatin1String("scope"));
+ QDeclarativeItem *itemA1 = findItem<QDeclarativeItem>(rootObject, QLatin1String("item-a1"));
+ QDeclarativeItem *scopeA = findItem<QDeclarativeItem>(rootObject, QLatin1String("scope-a"));
+ QDeclarativeItem *itemA2 = findItem<QDeclarativeItem>(rootObject, QLatin1String("item-a2"));
+ QDeclarativeItem *itemB1 = findItem<QDeclarativeItem>(rootObject, QLatin1String("item-b1"));
+ QDeclarativeItem *scopeB = findItem<QDeclarativeItem>(rootObject, QLatin1String("scope-b"));
+ QDeclarativeItem *itemB2 = findItem<QDeclarativeItem>(rootObject, QLatin1String("item-b2"));
+
+ QVERIFY(scope);
+ QVERIFY(itemA1);
+ QVERIFY(scopeA);
+ QVERIFY(itemA2);
+ QVERIFY(itemB1);
+ QVERIFY(scopeB);
+ QVERIFY(itemB2);
+
+ QSignalSpy rootSpy(rootObject, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy scopeSpy(scope, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy scopeASpy(scopeA, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy scopeBSpy(scopeB, SIGNAL(activeFocusChanged(bool)));
+
+ // First, walk the focus from item-a1 down to item-a2 and back again
+ itemA1->forceActiveFocus();
+ QVERIFY(itemA1->hasActiveFocus());
+ QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ scopeA->forceActiveFocus();
+ QVERIFY(!itemA1->hasActiveFocus());
+ QVERIFY(scopeA->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ itemA2->forceActiveFocus();
+ QVERIFY(!itemA1->hasActiveFocus());
+ QVERIFY(itemA2->hasActiveFocus());
+ QVERIFY(scopeA->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ scopeA->forceActiveFocus();
+ QVERIFY(!itemA1->hasActiveFocus());
+ QVERIFY(itemA2->hasActiveFocus());
+ QVERIFY(scopeA->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ itemA1->forceActiveFocus();
+ QVERIFY(itemA1->hasActiveFocus());
+ QVERIFY(!scopeA->hasActiveFocus());
+ QVERIFY(!itemA2->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 2);
+ QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ // Then jump back and forth between branch 'a' and 'b'
+ itemB1->forceActiveFocus();
+ QVERIFY(itemB1->hasActiveFocus());
+ QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ scopeA->forceActiveFocus();
+ QVERIFY(!itemA1->hasActiveFocus());
+ QVERIFY(!itemB1->hasActiveFocus());
+ QVERIFY(scopeA->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 3);
+ QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ scopeB->forceActiveFocus();
+ QVERIFY(!scopeA->hasActiveFocus());
+ QVERIFY(!itemB1->hasActiveFocus());
+ QVERIFY(scopeB->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 4);
+ QCOMPARE(scopeBSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ itemA2->forceActiveFocus();
+ QVERIFY(!scopeB->hasActiveFocus());
+ QVERIFY(itemA2->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 5);
+ QCOMPARE(scopeBSpy.count(), 2);
+ QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ itemB2->forceActiveFocus();
+ QVERIFY(!itemA2->hasActiveFocus());
+ QVERIFY(itemB2->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 6);
+ QCOMPARE(scopeBSpy.count(), 3);
+ QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ delete view;
+}
+
QTEST_MAIN(tst_qdeclarativefocusscope)
#include "tst_qdeclarativefocusscope.moc"
diff --git a/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml
index 7bb2c95..d082847 100644
--- a/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml
+++ b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml
@@ -28,8 +28,8 @@ Item {
objectName: "highlight"
width: 80; height: 80
color: "lightsteelblue"; radius: 5
- y: grid.currentItem.y
- x: grid.currentItem.x
+ y: grid.currentItem.y+5
+ x: grid.currentItem.x+5
}
}
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
index 7998e30..fd5d140 100644
--- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
+++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
@@ -1215,15 +1215,22 @@ void tst_QDeclarativeGridView::manualHighlight()
QTRY_COMPARE(gridview->currentIndex(), 0);
QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 0));
- QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y());
- QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x());
+ QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y());
+ QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x());
gridview->setCurrentIndex(2);
QTRY_COMPARE(gridview->currentIndex(), 2);
QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 2));
- QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y());
- QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x());
+ QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y());
+ QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x());
+
+ gridview->positionViewAtIndex(8, QDeclarativeGridView::Contain);
+
+ QTRY_COMPARE(gridview->currentIndex(), 2);
+ QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 2));
+ QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y());
+ QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x());
}
void tst_QDeclarativeGridView::footer()
diff --git a/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml b/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml
index 487b70e..9d58530 100644
--- a/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml
+++ b/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml
@@ -1,6 +1,8 @@
import QtQuick 1.0
Rectangle {
+ id: root
+ property real delegateHeight: 20
width: 240
height: 320
color: "#ffffff"
@@ -10,7 +12,8 @@ Rectangle {
Rectangle {
id: wrapper
objectName: "wrapper"
- height: 20
+ height: root.delegateHeight
+ Behavior on height { NumberAnimation {} }
width: 240
Text {
text: index
@@ -20,6 +23,10 @@ Rectangle {
objectName: "displayText"
text: display
}
+ Text {
+ x: 200
+ text: wrapper.y
+ }
color: ListView.isCurrentItem ? "lightsteelblue" : "white"
}
},
diff --git a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml
index d8cfd9a..a32a194 100644
--- a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml
+++ b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml
@@ -28,7 +28,7 @@ Item {
objectName: "highlight"
width: 180; height: 20
color: "lightsteelblue"; radius: 5
- y: list.currentItem.y
+ y: list.currentItem.y+5
}
}
diff --git a/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml b/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml
new file mode 100644
index 0000000..0756618
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml
@@ -0,0 +1,37 @@
+import QtQuick 1.0
+
+Item {
+ width: 640
+ height: 480
+
+ function setModel() {
+ listView.model = listModel1
+ }
+
+ ListModel {
+ id: listModel1
+ ListElement { text: "Apple" }
+ ListElement { text: "Banana" }
+ ListElement { text: "Orange" }
+ ListElement { text: "Coconut" }
+ }
+
+ Rectangle {
+ width: 200
+ height: listView.contentHeight
+ color: "yellow"
+ anchors.centerIn: parent
+
+ ListView {
+ id: listView
+ objectName: "listview"
+ anchors.fill: parent
+
+ delegate: Item {
+ width: 200
+ height: 20
+ Text { text: model.text; anchors.centerIn: parent }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index 759caf2..b834d46 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -103,6 +103,8 @@ private slots:
void resizeView();
void sizeLessThan1();
void QTBUG_14821();
+ void resizeDelegate();
+ void QTBUG_16037();
private:
template <class T> void items();
@@ -1406,6 +1408,8 @@ void tst_QDeclarativeListView::resetModel()
QTRY_VERIFY(display != 0);
QTRY_COMPARE(display->text(), strings.at(i));
}
+
+ delete canvas;
}
void tst_QDeclarativeListView::propertyChanges()
@@ -1606,13 +1610,22 @@ void tst_QDeclarativeListView::manualHighlight()
QTRY_COMPARE(listview->currentIndex(), 0);
QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 0));
- QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y());
+ QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y());
listview->setCurrentIndex(2);
QTRY_COMPARE(listview->currentIndex(), 2);
QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 2));
- QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y());
+ QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y());
+
+ // QTBUG-15972
+ listview->positionViewAtIndex(3, QDeclarativeListView::Contain);
+
+ QTRY_COMPARE(listview->currentIndex(), 2);
+ QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 2));
+ QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y());
+
+ delete canvas;
}
void tst_QDeclarativeListView::QTBUG_11105()
@@ -1752,6 +1765,8 @@ void tst_QDeclarativeListView::footer()
model.clear();
QTRY_COMPARE(footer->y(), 0.0);
+
+ delete canvas;
}
void tst_QDeclarativeListView::resizeView()
@@ -1794,6 +1809,8 @@ void tst_QDeclarativeListView::resizeView()
QMetaObject::invokeMethod(canvas->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio));
QCOMPARE(heightRatio.toReal(), 0.25);
+
+ delete canvas;
}
void tst_QDeclarativeListView::sizeLessThan1()
@@ -1849,6 +1866,102 @@ void tst_QDeclarativeListView::QTBUG_14821()
listview->incrementCurrentIndex();
QCOMPARE(listview->currentIndex(), 0);
+
+ delete canvas;
+}
+
+void tst_QDeclarativeListView::resizeDelegate()
+{
+ QDeclarativeView *canvas = createView();
+
+ QStringList strings;
+ for (int i = 0; i < 30; ++i)
+ strings << QString::number(i);
+ QStringListModel model(strings);
+
+ QDeclarativeContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaylist.qml"));
+ qApp->processEvents();
+
+ QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QDeclarativeItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(listview->count(), model.rowCount());
+
+ listview->setCurrentIndex(25);
+ listview->setContentY(0);
+
+ for (int i = 0; i < 16; ++i) {
+ QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QCOMPARE(item->y(), i*20.0);
+ }
+
+ QCOMPARE(listview->currentItem()->y(), 500.0);
+ QTRY_COMPARE(listview->highlightItem()->y(), 500.0);
+
+ canvas->rootObject()->setProperty("delegateHeight", 30);
+ qApp->processEvents();
+
+ for (int i = 0; i < 11; ++i) {
+ QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QTRY_COMPARE(item->y(), i*30.0);
+ }
+
+ QTRY_COMPARE(listview->currentItem()->y(), 750.0);
+ QTRY_COMPARE(listview->highlightItem()->y(), 750.0);
+
+ listview->setCurrentIndex(1);
+ listview->positionViewAtIndex(25, QDeclarativeListView::Beginning);
+ listview->positionViewAtIndex(5, QDeclarativeListView::Beginning);
+
+ for (int i = 5; i < 16; ++i) {
+ QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QCOMPARE(item->y(), i*30.0);
+ }
+
+ QTRY_COMPARE(listview->currentItem()->y(), 30.0);
+ QTRY_COMPARE(listview->highlightItem()->y(), 30.0);
+
+ canvas->rootObject()->setProperty("delegateHeight", 20);
+ qApp->processEvents();
+
+ for (int i = 5; i < 11; ++i) {
+ QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QTRY_COMPARE(item->y(), 150 + (i-5)*20.0);
+ }
+
+ QTRY_COMPARE(listview->currentItem()->y(), 70.0);
+ QTRY_COMPARE(listview->highlightItem()->y(), 70.0);
+
+ delete canvas;
+}
+
+void tst_QDeclarativeListView::QTBUG_16037()
+{
+ QDeclarativeView *canvas = createView();
+
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug16037.qml"));
+ qApp->processEvents();
+
+ QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "listview");
+ QTRY_VERIFY(listview != 0);
+
+ QVERIFY(listview->contentHeight() <= 0.0);
+
+ QMetaObject::invokeMethod(canvas->rootObject(), "setModel");
+
+ QTRY_COMPARE(listview->contentHeight(), 80.0);
+
+ delete canvas;
}
void tst_QDeclarativeListView::qListModelInterface_items()
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index a2a5363..9193707 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -429,6 +429,10 @@ void tst_QDeclarativePathView::dataModel()
pathview->setOffset(0);
QCOMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 5);
+ pathview->setCurrentIndex(model.count()-1);
+ model.removeItem(model.count()-1);
+ QCOMPARE(pathview->currentIndex(), model.count()-1);
+
delete canvas;
}
diff --git a/tests/auto/qapplication/modal/main.cpp b/tests/auto/qapplication/modal/main.cpp
index f9d8fb4..3eaaa0d 100644
--- a/tests/auto/qapplication/modal/main.cpp
+++ b/tests/auto/qapplication/modal/main.cpp
@@ -47,6 +47,7 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
+ QApplication::setAttribute(Qt::AA_NativeWindows); //QTBUG-15774
base *b = new base();
return app.exec();
}
diff --git a/tests/auto/qapplication/test/test.pro b/tests/auto/qapplication/test/test.pro
index 2c54c37..d946e7e 100644
--- a/tests/auto/qapplication/test/test.pro
+++ b/tests/auto/qapplication/test/test.pro
@@ -17,7 +17,7 @@ symbian: {
someTest.sources = test.pro
someTest.path = test
windowIcon.sources = ../heart.svg
- DEPLOYMENT = additional deploy someTest windowIcon
+ DEPLOYMENT += additional deploy someTest windowIcon
LIBS += -lcone -lavkon
}
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index 6a2f849..588c476 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -288,6 +288,7 @@ private slots:
void taskQT657_paintIntoCacheWithTransparentParts();
void taskQTBUG_7863_paintIntoCacheWithTransparentParts();
void taskQT_3674_doNotCrash();
+ void taskQTBUG_15977_renderWithDeviceCoordinateCache();
};
void tst_QGraphicsScene::initTestCase()
@@ -4629,5 +4630,27 @@ void tst_QGraphicsScene::zeroScale()
QTRY_COMPARE(cl.changes.count(), 2);
}
+void tst_QGraphicsScene::taskQTBUG_15977_renderWithDeviceCoordinateCache()
+{
+ QGraphicsScene scene;
+ scene.setSceneRect(0, 0, 100, 100);
+ QGraphicsRectItem *rect = scene.addRect(0, 0, 100, 100);
+ rect->setPen(Qt::NoPen);
+ rect->setBrush(Qt::red);
+ rect->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+
+ QImage image(100, 100, QImage::Format_RGB32);
+ QPainter p(&image);
+ scene.render(&p);
+ p.end();
+
+ QImage expected(100, 100, QImage::Format_RGB32);
+ p.begin(&expected);
+ p.fillRect(expected.rect(), Qt::red);
+ p.end();
+
+ QCOMPARE(image, expected);
+}
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index b446941..b2c59fc 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -142,6 +142,8 @@ private slots:
void rgbSwapped_data();
void rgbSwapped();
+
+ void deepCopyWhenPaintingActive();
};
tst_QImage::tst_QImage()
@@ -1886,5 +1888,19 @@ void tst_QImage::rgbSwapped()
QCOMPARE(memcmp(image.constBits(), imageSwappedTwice.constBits(), image.numBytes()), 0);
}
+void tst_QImage::deepCopyWhenPaintingActive()
+{
+ QImage image(64, 64, QImage::Format_ARGB32_Premultiplied);
+ image.fill(0);
+
+ QPainter painter(&image);
+ QImage copy = image;
+
+ painter.setBrush(Qt::black);
+ painter.drawEllipse(image.rect());
+
+ QVERIFY(copy != image);
+}
+
QTEST_MAIN(tst_QImage)
#include "tst_qimage.moc"
diff --git a/tests/auto/qinputcontext/qinputcontext.pro b/tests/auto/qinputcontext/qinputcontext.pro
index ec6831e..4b3ab96 100644
--- a/tests/auto/qinputcontext/qinputcontext.pro
+++ b/tests/auto/qinputcontext/qinputcontext.pro
@@ -1,6 +1,8 @@
load(qttest_p4)
SOURCES += tst_qinputcontext.cpp
+contains(QT_CONFIG, webkit):QT += webkit
+
symbian {
LIBS += -lws32 -lcone
}
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp
index 5a258a9..020f177 100644
--- a/tests/auto/qinputcontext/tst_qinputcontext.cpp
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -50,6 +50,13 @@
#include <qwindowsstyle.h>
#include <qdesktopwidget.h>
#include <qpushbutton.h>
+#include <qgraphicsview.h>
+#include <qgraphicsscene.h>
+
+#ifdef QT_WEBKIT_LIB
+#include <qwebview.h>
+#include <qgraphicswebview.h>
+#endif
#ifdef Q_OS_SYMBIAN
#include <private/qt_s60_p.h>
@@ -466,6 +473,115 @@ void tst_QInputContext::focusProxy()
QCOMPARE(gic->focusWidget(), &proxy);
}
+#ifdef QT_WEBKIT_LIB
+class AutoWebView : public QWebView
+{
+ Q_OBJECT
+
+public:
+ AutoWebView()
+ : m_length(0)
+ , m_mode(QLineEdit::Normal)
+ {
+ updatePage();
+ }
+ ~AutoWebView() {}
+
+ void updatePage()
+ {
+ // The update might reset the input method parameters.
+ bool imEnabled = testAttribute(Qt::WA_InputMethodEnabled);
+ Qt::InputMethodHints hints = inputMethodHints();
+
+ QString page = "<html><body onLoad=\"document.forms.testform.testinput.focus()\">"
+ "<form name=\"testform\"><input name=\"testinput\" type=\"%1\" %2></form></body></html>";
+ if (m_mode == QLineEdit::Password)
+ page = page.arg("password");
+ else
+ page = page.arg("text");
+
+ if (m_length == 0)
+ page = page.arg("");
+ else
+ page = page.arg("maxlength=\"" + QString::number(m_length) + "\"");
+
+ setHtml(page);
+
+ setAttribute(Qt::WA_InputMethodEnabled, imEnabled);
+ setInputMethodHints(hints);
+ }
+ void setMaxLength(int length)
+ {
+ m_length = length;
+ updatePage();
+ }
+ void setEchoMode(QLineEdit::EchoMode mode)
+ {
+ m_mode = mode;
+ updatePage();
+ }
+
+ int m_length;
+ QLineEdit::EchoMode m_mode;
+};
+
+class AutoGraphicsWebView : public QGraphicsView
+{
+ Q_OBJECT
+
+public:
+ AutoGraphicsWebView()
+ : m_length(0)
+ , m_mode(QLineEdit::Normal)
+ {
+ m_scene.addItem(&m_view);
+ setScene(&m_scene);
+ m_view.setFocus();
+ updatePage();
+ }
+ ~AutoGraphicsWebView() {}
+
+ void updatePage()
+ {
+ // The update might reset the input method parameters.
+ bool imEnabled = testAttribute(Qt::WA_InputMethodEnabled);
+ Qt::InputMethodHints hints = inputMethodHints();
+
+ QString page = "<html><body onLoad=\"document.forms.testform.testinput.focus()\">"
+ "<form name=\"testform\"><input name=\"testinput\" type=\"%1\" %2></form></body></html>";
+ if (m_mode == QLineEdit::Password)
+ page = page.arg("password");
+ else
+ page = page.arg("text");
+
+ if (m_length == 0)
+ page = page.arg("");
+ else
+ page = page.arg("maxlength=\"" + QString::number(m_length) + "\"");
+
+ m_view.setHtml(page);
+
+ setAttribute(Qt::WA_InputMethodEnabled, imEnabled);
+ setInputMethodHints(hints);
+ }
+ void setMaxLength(int length)
+ {
+ m_length = length;
+ updatePage();
+ }
+ void setEchoMode(QLineEdit::EchoMode mode)
+ {
+ m_mode = mode;
+ updatePage();
+ }
+
+ int m_length;
+ QLineEdit::EchoMode m_mode;
+ QGraphicsScene m_scene;
+ QGraphicsWebView m_view;
+};
+#endif // QT_WEBKIT_LIB
+
void tst_QInputContext::symbianTestCoeFepInputContext_data()
{
#ifdef Q_OS_SYMBIAN
@@ -481,6 +597,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data()
symbianTestCoeFepInputContext_addData<QLineEdit>();
symbianTestCoeFepInputContext_addData<QPlainTextEdit>();
symbianTestCoeFepInputContext_addData<QTextEdit>();
+# ifdef QT_WEBKIT_LIB
+ symbianTestCoeFepInputContext_addData<AutoWebView>();
+ symbianTestCoeFepInputContext_addData<AutoGraphicsWebView>();
+# endif
#endif
}
@@ -1087,13 +1207,28 @@ void tst_QInputContext::symbianTestCoeFepInputContext()
editwidget->setAttribute(Qt::WA_InputMethodEnabled, inputMethodEnabled);
editwidget->setInputMethodHints(inputMethodHints);
- QLineEdit *lineedit = qobject_cast<QLineEdit *>(editwidget);
- if (lineedit) {
+ if (QLineEdit *lineedit = qobject_cast<QLineEdit *>(editwidget)) {
if (maxLength > 0)
lineedit->setMaxLength(maxLength);
lineedit->setEchoMode(echoMode);
+#ifdef QT_WEBKIT_LIB
+ } else if (AutoWebView *webView = qobject_cast<AutoWebView *>(editwidget)) {
+ if (maxLength > 0)
+ webView->setMaxLength(maxLength);
+ webView->setEchoMode(echoMode);
+ // WebKit disables T9 everywhere.
+ if (inputMethodEnabled && !(inputMethodHints & Qt::ImhNoPredictiveText))
+ return;
+ } else if (AutoGraphicsWebView *webView = qobject_cast<AutoGraphicsWebView *>(editwidget)) {
+ if (maxLength > 0)
+ webView->setMaxLength(maxLength);
+ webView->setEchoMode(echoMode);
+ // WebKit disables T9 everywhere.
+ if (inputMethodEnabled && !(inputMethodHints & Qt::ImhNoPredictiveText))
+ return;
+#endif
} else if (maxLength > 0 || echoMode != QLineEdit::Normal) {
- // Only QLineEdits support these features so don't attempt any tests using those
+ // Only some widgets support these features so don't attempt any tests using those
// on other widgets.
return;
}
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 9cf61f9..cff0ae9 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -336,10 +336,10 @@ private Q_SLOTS:
void parentingRepliesToTheApp();
};
-QT_BEGIN_NAMESPACE
-
bool tst_QNetworkReply::seedCreated = false;
+QT_BEGIN_NAMESPACE
+
namespace QTest {
template<>
char *toString(const QNetworkReply::NetworkError& code)
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 51e6cf5..419518a1 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -129,10 +129,7 @@ private slots:
void isNull();
void task_246446();
-#ifdef Q_WS_QWS
void convertFromImageNoDetach();
-#endif
-
void convertFromImageDetach();
#if defined(Q_WS_WIN)
@@ -185,6 +182,8 @@ private slots:
void preserveDepth();
void splash_crash();
+ void toImageDeepCopy();
+
void loadAsBitmapOrPixmap();
};
@@ -911,11 +910,13 @@ void tst_QPixmap::isNull()
}
}
-#ifdef Q_WS_QWS
void tst_QPixmap::convertFromImageNoDetach()
{
+ QPixmap randomPixmap(10, 10);
+ if (randomPixmap.pixmapData()->classId() != QPixmapData::RasterClass)
+ QSKIP("Test only valid for raster pixmaps", SkipAll);
+
//first get the screen format
- QPixmap randomPixmap(10,10);
QImage::Format screenFormat = randomPixmap.toImage().format();
QVERIFY(screenFormat != QImage::Format_Invalid);
@@ -930,7 +931,6 @@ void tst_QPixmap::convertFromImageNoDetach()
const QImage constCopy = copy;
QVERIFY(constOrig.bits() == constCopy.bits());
}
-#endif //Q_WS_QWS
void tst_QPixmap::convertFromImageDetach()
{
@@ -1751,6 +1751,21 @@ void tst_QPixmap::loadAsBitmapOrPixmap()
QVERIFY(bitmap.isQBitmap());
}
+void tst_QPixmap::toImageDeepCopy()
+{
+ QPixmap pixmap(64, 64);
+ pixmap.fill(Qt::white);
+
+ QPainter painter(&pixmap);
+ QImage first = pixmap.toImage();
+
+ painter.setBrush(Qt::black);
+ painter.drawEllipse(pixmap.rect());
+
+ QImage second = pixmap.toImage();
+
+ QVERIFY(first != second);
+}
QTEST_MAIN(tst_QPixmap)
diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
index a280256..4b14cc9 100644
--- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
+++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
@@ -745,6 +745,16 @@ tst_Suite::tst_Suite()
addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "1/-1e-2000", willFixInNextReleaseMessage);
#endif
+#ifdef Q_OS_SYMBIAN
+ addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-1, 0.5)", willFixInNextReleaseMessage);
+ addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-1, -0.5)", willFixInNextReleaseMessage);
+ addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.5.1 *", willFixInNextReleaseMessage);
+ addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.5.2 /", willFixInNextReleaseMessage);
+ addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.6.2 -", willFixInNextReleaseMessage);
+ addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 *=", willFixInNextReleaseMessage);
+ addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 /=", willFixInNextReleaseMessage);
+#endif
+
static const char klass[] = "tst_QScriptJsTestSuite";
QVector<uint> *data = qt_meta_data_tst_Suite();
diff --git a/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro b/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro
index d2c1147..7edd4a5 100644
--- a/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro
+++ b/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
-SOURCES += tst_qsortfilterproxymodel.cpp
-
+INCLUDEPATH += $$PWD/../modeltest
+SOURCES += tst_qsortfilterproxymodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp
+HEADERS += ../modeltest/dynamictreemodel.h ../modeltest/modeltest.h
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 66caf4a..93b9d30 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -43,6 +43,9 @@
#include <QtTest/QtTest>
#include "../../shared/util.h"
+#include "dynamictreemodel.h"
+#include "modeltest.h"
+
#include <QtCore>
#include <QtGui>
@@ -144,6 +147,7 @@ private slots:
void testMultipleProxiesWithSelection();
void mapSelectionFromSource();
+ void filteredColumns();
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
@@ -3174,5 +3178,40 @@ void tst_QSortFilterProxyModel::taskQTBUG_10287_unnecessaryMapCreation()
// No assert failure, it passes.
}
+class FilteredColumnProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+public:
+ FilteredColumnProxyModel(QObject *parent = 0)
+ : QSortFilterProxyModel(parent)
+ {
+
+ }
+
+protected:
+ bool filterAcceptsColumn(int column, const QModelIndex &source_parent) const
+ {
+ return column % 2 != 0;
+ }
+};
+
+void tst_QSortFilterProxyModel::filteredColumns()
+{
+ DynamicTreeModel *model = new DynamicTreeModel(this);
+
+ FilteredColumnProxyModel *proxy = new FilteredColumnProxyModel(this);
+ proxy->setSourceModel(model);
+
+ new ModelTest(proxy, this);
+
+ ModelInsertCommand *insertCommand = new ModelInsertCommand(model, this);
+ insertCommand->setNumCols(2);
+ insertCommand->setStartRow(0);
+ insertCommand->setEndRow(0);
+ // Parent is QModelIndex()
+ insertCommand->doCommand();
+
+}
+
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 5521873..d611225 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -10061,7 +10061,7 @@ void tst_QWidget::cbaVisibility()
// Verify window decorations i.e. status pane and CBA are visible.
CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
QVERIFY(statusPane->IsVisible());
- CEikButtonGroupContainer* buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ CEikButtonGroupContainer* buttonGroup = CEikButtonGroupContainer::Current();
QVERIFY(buttonGroup->IsVisible());
}
@@ -10078,7 +10078,7 @@ void tst_QWidget::fullScreenWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current();
//Enter
widget.showNormal();
@@ -10132,7 +10132,7 @@ void tst_QWidget::maximizedWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current();
//Enter
widget.showNormal();
@@ -10188,7 +10188,7 @@ void tst_QWidget::minimizedWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current();
//Enter
widget.showNormal();
@@ -10244,7 +10244,7 @@ void tst_QWidget::normalWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current();
//Enter
widget.showMaximized();
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 050ad62..c967dad 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -1029,6 +1029,8 @@ void Configure::parseCmdLine()
if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
dictionary[ "QT_INSTALL_PLUGINS" ] =
QString("\\resource\\qt%1\\plugins").arg(dictionary[ "QT_LIBINFIX" ]);
+ dictionary[ "QT_INSTALL_IMPORTS" ] =
+ QString("\\resource\\qt%1\\imports").arg(dictionary[ "QT_LIBINFIX" ]);
}
} else if (configCmdLine.at(i) == "-D") {
++i;
diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp
index 39ba9fd..c2edc75 100644
--- a/tools/linguist/linguist/messagemodel.cpp
+++ b/tools/linguist/linguist/messagemodel.cpp
@@ -209,6 +209,13 @@ bool DataModel::load(const QString &fileName, bool *langGuessed, QWidget *parent
return false;
}
+ if (!tor.messageCount()) {
+ QMessageBox::warning(parent, QObject::tr("Qt Linguist"),
+ tr("The translation file '%1' will not be loaded because it is empty.")
+ .arg(Qt::escape(fileName)));
+ return false;
+ }
+
Translator::Duplicates dupes = tor.resolveDuplicates();
if (!dupes.byId.isEmpty() || !dupes.byContents.isEmpty()) {
QString err = tr("<qt>Duplicate messages found in '%1':").arg(Qt::escape(fileName));
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
index d47c829..6df3c22 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
@@ -181,6 +181,9 @@ public:
This function needs to be called *before* any widget/content is created.
When called with true, the base window surface will be translucent and initialized
with QGLFormat.alpha == true.
+
+ This function is *deprecated*. Set Qt::WA_TranslucentBackground attribute
+ on the top-level widget *before* you show it instead.
*/
static void setTranslucent(bool translucent);
};
diff --git a/tools/qml/browser/Browser.qml b/tools/qml/browser/Browser.qml
index b9573da..968d077 100644
--- a/tools/qml/browser/Browser.qml
+++ b/tools/qml/browser/Browser.qml
@@ -173,7 +173,7 @@ Rectangle {
width: parent.width
model: folders1
delegate: folderDelegate
- highlight: Rectangle {
+ highlight: Rectangle {
color: palette.highlight
visible: root.showFocusHighlight && view1.count != 0
gradient: Gradient {
diff --git a/tools/qml/deviceorientation.h b/tools/qml/deviceorientation.h
index 487ebd4..88ceb1b 100644
--- a/tools/qml/deviceorientation.h
+++ b/tools/qml/deviceorientation.h
@@ -52,8 +52,8 @@ class DeviceOrientation : public QObject
Q_OBJECT
Q_ENUMS(Orientation)
public:
- enum Orientation {
- UnknownOrientation,
+ enum Orientation {
+ UnknownOrientation,
Portrait,
Landscape,
PortraitInverted,
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 209c72f..b9513b9 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -59,6 +59,19 @@ QtMsgHandler systemMsgOutput = 0;
static QDeclarativeViewer *openFile(const QString &fileName);
static void showViewer(QDeclarativeViewer *viewer);
+QString warnings;
+void exitApp(int i)
+{
+#ifdef Q_OS_WIN
+ // Debugging output is not visible by default on Windows -
+ // therefore show modal dialog with errors instead.
+ if (!warnings.isEmpty()) {
+ QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings);
+ }
+#endif
+ exit(i);
+}
+
#if defined (Q_OS_SYMBIAN)
#include <unistd.h>
#include <sys/types.h>
@@ -85,31 +98,22 @@ void myMessageOutput(QtMsgType type, const char *msg)
QWeakPointer<LoggerWidget> logger;
-QString warnings;
-void showWarnings()
-{
- if (!warnings.isEmpty()) {
- int argc = 0; char **argv = 0;
- QApplication application(argc, argv); // QApplication() in main has been destroyed already.
- Q_UNUSED(application)
- QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings);
- }
-}
-
static QAtomicInt recursiveLock(0);
void myMessageOutput(QtMsgType type, const char *msg)
{
QString strMsg = QString::fromLatin1(msg);
- if (!logger.isNull() && !QCoreApplication::closingDown()) {
- if (recursiveLock.testAndSetOrdered(0, 1)) {
- QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
- recursiveLock = 0;
+ if (!QCoreApplication::closingDown()) {
+ if (!logger.isNull()) {
+ if (recursiveLock.testAndSetOrdered(0, 1)) {
+ QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
+ recursiveLock = 0;
+ }
+ } else {
+ warnings += strMsg;
+ warnings += QLatin1Char('\n');
}
- } else {
- warnings += strMsg;
- warnings += QLatin1Char('\n');
}
if (systemMsgOutput) { // Windows
systemMsgOutput(type, msg);
@@ -165,7 +169,8 @@ void usage()
qWarning(" ");
qWarning(" Press F1 for interactive help");
- exit(1);
+
+ exitApp(1);
}
void scriptOptsUsage()
@@ -184,7 +189,8 @@ void scriptOptsUsage()
qWarning(" saveonexit ............................... save recording on viewer exit");
qWarning(" ");
qWarning(" One of record, play or both must be specified.");
- exit(1);
+
+ exitApp(1);
}
enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings };
@@ -370,7 +376,7 @@ static void parseCommandLineOptions(const QStringList &arguments)
qApp->setStartDragDistance(arguments.at(++i).toInt());
} else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) {
qWarning("Qt QML Viewer version %s", QT_VERSION_STR);
- exit(0);
+ exitApp(0);
} else if (arg == "-translation") {
if (lastArg) usage();
opts.translationFile = arguments.at(++i);
@@ -400,7 +406,7 @@ static void parseCommandLineOptions(const QStringList &arguments)
QDeclarativeEngine tmpEngine;
QString paths = tmpEngine.importPathList().join(QLatin1String(":"));
qWarning("Current search path: %s", paths.toLocal8Bit().constData());
- exit(0);
+ exitApp(0);
}
opts.imports << arguments.at(++i);
} else if (arg == "-P") {
@@ -529,12 +535,6 @@ int main(int argc, char ** argv)
systemMsgOutput = qInstallMsgHandler(myMessageOutput);
#endif
-#if defined (Q_OS_WIN)
- // Debugging output is not visible by default on Windows -
- // therefore show modal dialog with errors instead.
- atexit(showWarnings);
-#endif
-
#if defined (Q_WS_X11) || defined (Q_WS_MAC)
//### default to using raster graphics backend for now
bool gsSpecified = false;
diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp
index e3a1f59..1bcdb04 100644
--- a/tools/qml/qdeclarativetester.cpp
+++ b/tools/qml/qdeclarativetester.cpp
@@ -54,9 +54,9 @@ QT_BEGIN_NAMESPACE
extern Q_GUI_EXPORT bool qt_applefontsmoothing_enabled;
-QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts,
+QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts,
QDeclarativeView *parent)
-: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts),
+: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts),
testscript(0), hasCompleted(false), hasFailed(false)
{
parent->viewport()->installEventFilter(this);
@@ -75,8 +75,8 @@ QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer
QDeclarativeTester::~QDeclarativeTester()
{
- if (!hasFailed &&
- options & QDeclarativeViewer::Record &&
+ if (!hasFailed &&
+ options & QDeclarativeViewer::Record &&
options & QDeclarativeViewer::SaveOnExit)
save();
}
@@ -228,7 +228,7 @@ void QDeclarativeTester::save()
}
ts << " }\n";
- while (!mouseevents.isEmpty() &&
+ while (!mouseevents.isEmpty() &&
mouseevents.first().msec == fe.msec) {
MouseEvent me = mouseevents.takeFirst();
@@ -345,7 +345,7 @@ void QDeclarativeTester::updateCurrentTime(int msec)
if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) {
if (frame->msec() < msec) {
if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) {
- qWarning() << "QDeclarativeTester(" << m_script << "): Extra frame. Seen:"
+ qWarning() << "QDeclarativeTester(" << m_script << "): Extra frame. Seen:"
<< msec << "Expected:" << frame->msec();
imagefailure();
}
@@ -371,7 +371,7 @@ void QDeclarativeTester::updateCurrentTime(int msec)
}
if (goodImage != img) {
QString reject(frame->image().toLocalFile() + ".reject.png");
- qWarning() << "QDeclarativeTester(" << m_script << "): Image mismatch. Reject saved to:"
+ qWarning() << "QDeclarativeTester(" << m_script << "): Image mismatch. Reject saved to:"
<< reject;
img.save(reject);
bool doDiff = (goodImage.size() == img.size());
@@ -424,7 +424,7 @@ void QDeclarativeTester::updateCurrentTime(int msec)
ke.destination = ViewPort;
}
m_savedKeyEvents.append(ke);
- }
+ }
testscriptidx++;
}
diff --git a/tools/qml/qdeclarativetester.h b/tools/qml/qdeclarativetester.h
index 0cf508a..6fdf495 100644
--- a/tools/qml/qdeclarativetester.h
+++ b/tools/qml/qdeclarativetester.h
@@ -122,7 +122,7 @@ public:
int type() const { return m_type; }
void setType(int t) { m_type = t; }
-
+
int button() const { return m_button; }
void setButton(int b) { m_button = b; }
@@ -237,7 +237,7 @@ private:
struct MouseEvent {
MouseEvent(QMouseEvent *e)
- : type(e->type()), button(e->button()), buttons(e->buttons()),
+ : type(e->type()), button(e->button()), buttons(e->buttons()),
pos(e->pos()), modifiers(e->modifiers()), destination(View) {}
QEvent::Type type;
diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro
index 3927dd6..bdac6e3 100644
--- a/tools/qml/qml.pro
+++ b/tools/qml/qml.pro
@@ -4,7 +4,7 @@ DESTDIR = ../../bin
include(qml.pri)
-SOURCES += main.cpp
+SOURCES += main.cpp
INCLUDEPATH += ../../include/QtDeclarative
INCLUDEPATH += ../../src/declarative/util
@@ -26,7 +26,7 @@ wince* {
QT += xmlpatterns
}
contains(QT_CONFIG, webkit) {
- QT += webkit
+ QT += webkit
}
}
maemo5 {
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index a368bc1..142e4c5 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -820,7 +820,7 @@ void QDeclarativeViewer::createMenu()
fileMenu->addAction(reloadAction);
fileMenu->addSeparator();
fileMenu->addAction(closeAction);
-#if !defined(Q_OS_SYMBIAN)
+#if !defined(Q_OS_SYMBIAN)
fileMenu->addAction(quitAction);
QMenu *recordMenu = menu->addMenu(tr("&Recording"));
@@ -836,7 +836,7 @@ void QDeclarativeViewer::createMenu()
settingsMenu->addAction(proxyAction);
#if defined(Q_OS_SYMBIAN)
settingsMenu->addAction(fullscreenAction);
-#else
+#else
settingsMenu->addAction(recordOptions);
settingsMenu->addMenu(loggerWindow->preferencesMenu());
#endif // !Q_OS_SYMBIAN
diff --git a/tools/qml/startup/startup.qml b/tools/qml/startup/startup.qml
index 9ca50a3..35c44c2 100644
--- a/tools/qml/startup/startup.qml
+++ b/tools/qml/startup/startup.qml
@@ -92,8 +92,8 @@ Rectangle {
to: 360
loops: NumberAnimation.Infinite
running: true
- duration: 2000
- }
+ duration: 2000
+ }
}
}
}
@@ -168,6 +168,6 @@ Rectangle {
}
}
}
- ]
+ ]
} // treatsApp