summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-08-20 05:48:45 (GMT)
committerLorn Potter <lorn.potter@nokia.com>2010-08-20 05:48:45 (GMT)
commit790c76b57d2697b8aadc2428c252890260207144 (patch)
treed445a865c40d781774bcfbb46180d50bd96aa978
parente4d89bfba06b38f32dc2ad2d8f1d474bc5477361 (diff)
parentd129112034d600ea925a4199d8bad72388444335 (diff)
downloadQt-790c76b57d2697b8aadc2428c252890260207144.zip
Qt-790c76b57d2697b8aadc2428c252890260207144.tar.gz
Qt-790c76b57d2697b8aadc2428c252890260207144.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
-rw-r--r--doc/src/deployment/deployment.qdoc6
-rw-r--r--doc/src/getting-started/gettingstartedqml.qdoc10
-rw-r--r--doc/src/snippets/declarative/loader/KeyReader.qml53
-rw-r--r--doc/src/snippets/declarative/loader/MyItem.qml55
-rw-r--r--doc/src/snippets/declarative/loader/connections.qml57
-rw-r--r--doc/src/snippets/declarative/loader/focus.qml62
-rw-r--r--doc/src/snippets/declarative/loader/simple.qml54
-rw-r--r--doc/src/xml-processing/xquery-introduction.qdoc1
-rw-r--r--src/corelib/codecs/qtextcodec_symbian.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp107
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp15
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.cpp4
-rw-r--r--src/gui/image/qpixmap.cpp3
-rw-r--r--src/gui/kernel/qclipboard_x11.cpp3
-rw-r--r--src/gui/kernel/qwidget_s60.cpp26
-rw-r--r--src/opengl/qpixmapdata_gl.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart-arm.pngbin12596 -> 0 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart-mac.pngbin12621 -> 0 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart-win32.pngbin12621 -> 12457 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart.pngbin12577 -> 12424 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200-arm.pngbin8063 -> 0 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200-mac.pngbin8062 -> 0 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200-win32.pngbin8062 -> 7939 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200.pngbin8063 -> 7943 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp16
-rw-r--r--tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp105
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp18
-rw-r--r--tools/qdoc3/htmlgenerator.cpp41
29 files changed, 544 insertions, 106 deletions
diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc
index 00771ed..f2908bd 100644
--- a/doc/src/deployment/deployment.qdoc
+++ b/doc/src/deployment/deployment.qdoc
@@ -1442,10 +1442,8 @@
\endlist
\note If you want a 3rd party library to be included in your
- application bundle, then you must add an excplicit lib entry for
- that library to your application's .pro file. Otherwise, the
- \c macdeployqt tool will not copy the 3rd party .dylib into the
- bundle.
+ application bundle, then you must copy the library into the
+ bundle manually, after the bundle is created.
\c macdeployqt supports the following options:
\list
diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc
index 885e6ce..a19d281 100644
--- a/doc/src/getting-started/gettingstartedqml.qdoc
+++ b/doc/src/getting-started/gettingstartedqml.qdoc
@@ -224,15 +224,13 @@
\code
import Qt 4.7 \\import the main Qt QML module
import "folderName" \\import the contents of the folder
- import "Button.qml" \\import a QML file
- import "NewButton.qml" as ButtonModule \\import a QML file and give it a name
import "script.js" as Script \\import a Javascript file and name it as Script
\endcode
- To use the \c Button element in \c FileMenu.qml, we need to import \c Button.qml.
- The syntax shown above, shows how to use the \c import keyword. However, the
- \c {import Button.qml} is not necessary; qmlviewer will import all the contents
- of the current directory. We can directly create a \c Button element by declaring
+ The syntax shown above shows how to use the \c import keyword. This is required to
+ use JavaScript files, or QML files that are not within the same directory. Since
+ \c Button.qml is in the same directory as \c FileMenu.qml, we do not need to import
+ the \c Button.qml file to use it. We can directly create a \c Button element by declaring
\c Button{}, similar to a \c Rectangle{} declaration.
\code
diff --git a/doc/src/snippets/declarative/loader/KeyReader.qml b/doc/src/snippets/declarative/loader/KeyReader.qml
new file mode 100644
index 0000000..4423ac6
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/KeyReader.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Item {
+ Item {
+ focus: true
+ Keys.onPressed: {
+ console.log("Loaded item captured:", event.text);
+ event.accepted = true;
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/loader/MyItem.qml b/doc/src/snippets/declarative/loader/MyItem.qml
new file mode 100644
index 0000000..cc69661
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/MyItem.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Rectangle {
+ id: myItem
+ signal message(string msg)
+
+ width: 100; height: 100
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myItem.message("clicked!")
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/loader/connections.qml b/doc/src/snippets/declarative/loader/connections.qml
new file mode 100644
index 0000000..babac4e
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/connections.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Item {
+ width: 100; height: 100
+
+ Loader {
+ id: myLoader
+ source: "MyItem.qml"
+ }
+
+ Connections {
+ target: myLoader.item
+ onMessage: console.log(msg)
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/loader/focus.qml b/doc/src/snippets/declarative/loader/focus.qml
new file mode 100644
index 0000000..464d986
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/focus.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Rectangle {
+ width: 200; height: 200
+
+ Loader {
+ id: loader
+ focus: true
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: loader.source = "KeyReader.qml"
+ }
+
+ Keys.onPressed: {
+ console.log("Captured:", event.text);
+ }
+}
+//![0]
+
diff --git a/doc/src/snippets/declarative/loader/simple.qml b/doc/src/snippets/declarative/loader/simple.qml
new file mode 100644
index 0000000..e0dc6b3
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/simple.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Qt 4.7
+
+Item {
+ width: 200; height: 200
+
+ Loader { id: pageLoader }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: pageLoader.source = "Page1.qml"
+ }
+}
+//![0]
diff --git a/doc/src/xml-processing/xquery-introduction.qdoc b/doc/src/xml-processing/xquery-introduction.qdoc
index b79c205..b5356f7 100644
--- a/doc/src/xml-processing/xquery-introduction.qdoc
+++ b/doc/src/xml-processing/xquery-introduction.qdoc
@@ -29,6 +29,7 @@
\page xquery-introduction.html
\title A Short Path to XQuery
+\pagekeywords XPath XQuery
\startpage XQuery
\target XQuery-introduction
diff --git a/src/corelib/codecs/qtextcodec_symbian.cpp b/src/corelib/codecs/qtextcodec_symbian.cpp
index e4db9d7..20e0cfc 100644
--- a/src/corelib/codecs/qtextcodec_symbian.cpp
+++ b/src/corelib/codecs/qtextcodec_symbian.cpp
@@ -53,8 +53,10 @@ struct QSymbianCodecInitData {
const char *aliases;
};
-/* This table contains the known Symbian codecs aliases. It is ordered by charsetId.
- It is required as symbian does not provide have aliases.
+/* This table contains the known Symbian codecs aliases.
+ It is required because symbian does not provide aliases for codecs.
+ It is also faster to have a name here than asking the system.
+ It is ordered by charsetId to allow binary search lookup
*/
static const QSymbianCodecInitData codecsData[] = {
{ /*268439485*/ KCharacterSetIdentifierShiftJis, 17, "Shift_JIS\0MS_Kanji\0csShiftJIS\0MS_KANJI\0SJIS\0" },
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index 4c6268f..2fde4c8 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -115,53 +115,76 @@ void QDeclarativeLoaderPrivate::initResize()
\brief The Loader item allows dynamically loading an Item-based
subtree from a URL or Component.
- The Loader element instantiates an item from a component. The component to
- be instantiated may be specified directly by the \l sourceComponent
- property, or loaded from a URL via the \l source property.
+ Loader is used to dynamically load visual QML components. It can load a
+ QML file (using the \l source property) or a \l Component object (using
+ the \l sourceComponent property). It is useful for delaying the creation
+ of a component until it is required: for example, when a component should
+ be created on demand, or when a component should not be created
+ unnecessarily for performance reasons.
- Loader can be used to delay the creation of a component until it
- is required. For example, this loads "Page1.qml" as a component
- into the Loader element, when the \l MouseArea is clicked:
+ Here is a Loader that loads "Page1.qml" as a component when the
+ \l MouseArea is clicked:
- \code
- import Qt 4.7
+ \snippet doc/src/snippets/declarative/loader/simple.qml 0
- Item {
- width: 200; height: 200
+ The loaded item can be accessed using the \l item property.
- MouseArea {
- anchors.fill: parent
- onClicked: pageLoader.source = "Page1.qml"
- }
+ Loader is like any other visual item and must be positioned and sized
+ accordingly to become visible. Once the component is loaded, the Loader
+ is automatically resized to the size of the component.
- Loader { id: pageLoader }
- }
- \endcode
+ If the \l source or \l sourceComponent changes, any previously instantiated
+ items are destroyed. Setting \l source to an empty string or setting
+ \l sourceComponent to \c undefined destroys the currently loaded item,
+ freeing resources and leaving the Loader empty.
+
+
+ \section2 Receiving signals from loaded items
- Note that Loader is like any other graphical Item and needs to be positioned
- and sized accordingly to become visible. When a component is loaded, the
- Loader is automatically resized to the size of the component.
+ Any signals emitted from the loaded item can be received using the
+ \l Connections element. For example, the following \c application.qml
+ loads \c MyItem.qml, and is able to receive the \c message signal from
+ the loaded item through a \l Connections object:
- If the Loader source is changed, any previous items instantiated
- will be destroyed. Setting \l source to an empty string, or setting
- sourceComponent to \e undefined
- will destroy the currently instantiated items, freeing resources
- and leaving the Loader empty. For example:
+ \table
+ \row
+ \o application.qml
+ \o MyItem.qml
+ \row
+ \o \snippet doc/src/snippets/declarative/loader/connections.qml 0
+ \o \snippet doc/src/snippets/declarative/loader/MyItem.qml 0
+ \endtable
- \code
- pageLoader.source = ""
- \endcode
+ Alternatively, since \c MyItem.qml is loaded within the scope of the
+ Loader, it could also directly call any function defined in the Loader or
+ its parent \l Item.
- or
- \code
- pageLoader.sourceComponent = undefined
- \endcode
+ \section2 Focus and key events
- unloads "Page1.qml" and frees resources consumed by it.
+ Loader is a focus scope. Its \l {Item::}{focus} property must be set to
+ \c true for any of its children to get the \e {active focus}. (See
+ \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page}
+ for more details.) Any key events received in the loaded item should likely
+ also be \l {KeyEvent::}{accepted} so they are not propagated to the Loader.
- Note that Loader is a focus scope. Its \c focus property must be set to \c true for any of its children
- to get the \e {active focus} (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
+ For example, the following \c application.qml loads \c KeyReader.qml when
+ the \l MouseArea is clicked. Notice the \l {Item::}{focus} property is
+ set to \c true for the Loader as well as the \l Item in the dynamically
+ loaded object:
+
+ \table
+ \row
+ \o application.qml
+ \o KeyReader.qml
+ \row
+ \o \snippet doc/src/snippets/declarative/loader/focus.qml 0
+ \o \snippet doc/src/snippets/declarative/loader/KeyReader.qml 0
+ \endtable
+
+ Once \c KeyReader.qml is loaded, it accepts key events and sets
+ \c event.accepted to \c true so that the event is not propagated to the
+ parent \l Rectangle.
\sa {dynamic-object-creation}{Dynamic Object Creation}
*/
@@ -198,8 +221,13 @@ QDeclarativeLoader::~QDeclarativeLoader()
/*!
\qmlproperty url Loader::source
- This property holds the URL of the QML component to
- instantiate.
+ This property holds the URL of the QML component to instantiate.
+
+ Note the QML component must be an \l Item-based component. Loader cannot
+ load non-visual components.
+
+ To unload the currently loaded item, set this property to an empty string,
+ or set \l sourceComponent to \c undefined.
\sa sourceComponent, status, progress
*/
@@ -258,7 +286,8 @@ void QDeclarativeLoader::setSource(const QUrl &url)
}
\endqml
- Note this value must hold a \l Component object; it cannot be a \l Item.
+ To unload the currently loaded item, set this property to an empty string,
+ or set \l sourceComponent to \c undefined.
\sa source, progress
*/
@@ -477,7 +506,7 @@ void QDeclarativeLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)
/*!
\qmlproperty Item Loader::item
- This property holds the top-level item created from source.
+ This property holds the top-level item that is currently loaded.
*/
QGraphicsObject *QDeclarativeLoader::item() const
{
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 513fc65..bc7468f 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -674,7 +674,7 @@ void QDeclarativeEngine::addImageProvider(const QString &providerId, QDeclarativ
{
Q_D(QDeclarativeEngine);
QMutexLocker locker(&d->mutex);
- d->imageProviders.insert(providerId, provider);
+ d->imageProviders.insert(providerId, QSharedPointer<QDeclarativeImageProvider>(provider));
}
/*!
@@ -684,7 +684,7 @@ QDeclarativeImageProvider *QDeclarativeEngine::imageProvider(const QString &prov
{
Q_D(const QDeclarativeEngine);
QMutexLocker locker(&d->mutex);
- return d->imageProviders.value(providerId);
+ return d->imageProviders.value(providerId).data();
}
/*!
@@ -698,13 +698,14 @@ void QDeclarativeEngine::removeImageProvider(const QString &providerId)
{
Q_D(QDeclarativeEngine);
QMutexLocker locker(&d->mutex);
- delete d->imageProviders.take(providerId);
+ d->imageProviders.take(providerId);
}
QDeclarativeImageProvider::ImageType QDeclarativeEnginePrivate::getImageProviderType(const QUrl &url)
{
QMutexLocker locker(&mutex);
- QDeclarativeImageProvider *provider = imageProviders.value(url.host());
+ QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host());
+ locker.unlock();
if (provider)
return provider->imageType();
return static_cast<QDeclarativeImageProvider::ImageType>(-1);
@@ -714,7 +715,8 @@ QImage QDeclarativeEnginePrivate::getImageFromProvider(const QUrl &url, QSize *s
{
QMutexLocker locker(&mutex);
QImage image;
- QDeclarativeImageProvider *provider = imageProviders.value(url.host());
+ QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host());
+ locker.unlock();
if (provider)
image = provider->requestImage(url.path().mid(1), size, req_size);
return image;
@@ -724,7 +726,8 @@ QPixmap QDeclarativeEnginePrivate::getPixmapFromProvider(const QUrl &url, QSize
{
QMutexLocker locker(&mutex);
QPixmap pixmap;
- QDeclarativeImageProvider *provider = imageProviders.value(url.host());
+ QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host());
+ locker.unlock();
if (provider)
pixmap = provider->requestPixmap(url.path().mid(1), size, req_size);
return pixmap;
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index 3b5dd5a..db2db35 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -232,7 +232,7 @@ public:
mutable QNetworkAccessManager *networkAccessManager;
mutable QDeclarativeNetworkAccessManagerFactory *networkAccessManagerFactory;
- QHash<QString,QDeclarativeImageProvider*> imageProviders;
+ QHash<QString,QSharedPointer<QDeclarativeImageProvider> > imageProviders;
QDeclarativeImageProvider::ImageType getImageProviderType(const QUrl &url);
QImage getImageFromProvider(const QUrl &url, QSize *size, const QSize& req_size);
QPixmap getPixmapFromProvider(const QUrl &url, QSize *size, const QSize& req_size);
diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp
index ea68327..ef31be7 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.cpp
+++ b/src/declarative/qml/qdeclarativeimageprovider.cpp
@@ -161,7 +161,9 @@ QDeclarativeImageProvider::QDeclarativeImageProvider(ImageType type)
}
/*!
- \internal
+ Destroys the QDeclarativeImageProvider
+
+ \note The destructor of your derived class need to be thread safe.
*/
QDeclarativeImageProvider::~QDeclarativeImageProvider()
{
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index ef9be8f..1c0ceff 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -830,9 +830,6 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
return false;
QFileInfo info(fileName);
- if (!info.exists())
- return false;
-
QString key = QLatin1Literal("qt_pixmap")
% info.absoluteFilePath()
% HexString<uint>(info.lastModified().toTime_t())
diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp
index 9fcc718..4b75f0a 100644
--- a/src/gui/kernel/qclipboard_x11.cpp
+++ b/src/gui/kernel/qclipboard_x11.cpp
@@ -456,7 +456,8 @@ QClipboard::QClipboard(QObject *parent)
XCheckIfEvent(X11->display, &ev, &qt_init_timestamp_scanner, (XPointer)&data);
if (data.timestamp == CurrentTime) {
setupOwner();
- int dummy = 0;
+ // We need this value just for completeness, we don't use it.
+ long dummy = 0;
Window ownerId = owner->internalWinId();
XChangeProperty(X11->display, ownerId,
ATOM(CLIP_TEMPORARY), XA_INTEGER, 32,
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 319f330..7ab9fbc 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -482,14 +482,13 @@ void QWidgetPrivate::show_sys()
activateSymbianWindow();
QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
+ const bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
#ifdef Q_WS_S60
// Lazily initialize the S60 screen furniture when the first window is shown.
if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)
&& !S60->buttonGroupContainer() && !S60->statusPane()) {
- bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
-
if (!q->testAttribute(Qt::WA_DontShowOnScreen)) {
// Create the status pane and CBA here
@@ -504,23 +503,24 @@ void QWidgetPrivate::show_sys()
// Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver.
QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId());
S60->statusPane()->SetObserver(desktopControl);
-
- // Hide the status pane if fullscreen OR
- // Fill client area if maximized OR
- // Put window below status pane unless the window has an explicit position.
- if (isFullscreen) {
+ if (isFullscreen)
S60->statusPane()->MakeVisible(false);
- } else if (q->windowState() & Qt::WindowMaximized) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
- id->SetExtent(r.iTl, r.Size());
- } else if (!q->testAttribute(Qt::WA_Moved)) {
- id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl);
- }
}
}
}
#endif
+ // Fill client area if maximized OR
+ // Put window below status pane unless the window has an explicit position.
+ if (!isFullscreen) {
+ if (q->windowState() & Qt::WindowMaximized) {
+ TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ id->SetExtent(r.iTl, r.Size());
+ } else if (!q->testAttribute(Qt::WA_Moved)) {
+ id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl);
+ }
+ }
+
id->MakeVisible(true);
if(q->isWindow())
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 653e805..1efd398 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -367,7 +367,7 @@ void QGLPixmapData::ensureCreated() const
}
void QGLPixmapData::fromImage(const QImage &image,
- Qt::ImageConversionFlags /*flags*/)
+ Qt::ImageConversionFlags flags)
{
if (image.size() == QSize(w, h))
setSerialNumber(++qt_gl_pixmap_serial);
@@ -381,7 +381,9 @@ void QGLPixmapData::fromImage(const QImage &image,
if (qApp->desktop()->depth() == 16)
format = QImage::Format_RGB16;
- if (image.hasAlphaChannel() && const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels())
+ if (image.hasAlphaChannel()
+ && ((flags & Qt::NoOpaqueDetection)
+ || const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels()))
format = QImage::Format_ARGB32_Premultiplied;;
m_source = image.convertToFormat(format);
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png b/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png
deleted file mode 100644
index 3245027..0000000
--- a/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-mac.png b/tests/auto/declarative/qdeclarativeimage/data/heart-mac.png
deleted file mode 100644
index d7df0e4..0000000
--- a/tests/auto/declarative/qdeclarativeimage/data/heart-mac.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-win32.png b/tests/auto/declarative/qdeclarativeimage/data/heart-win32.png
index 351da13..5992e79 100644
--- a/tests/auto/declarative/qdeclarativeimage/data/heart-win32.png
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart-win32.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart.png b/tests/auto/declarative/qdeclarativeimage/data/heart.png
index 372b224..ff93f6c 100644
--- a/tests/auto/declarative/qdeclarativeimage/data/heart.png
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png b/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png
deleted file mode 100644
index b16db76..0000000
--- a/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200-mac.png b/tests/auto/declarative/qdeclarativeimage/data/heart200-mac.png
deleted file mode 100644
index df22325..0000000
--- a/tests/auto/declarative/qdeclarativeimage/data/heart200-mac.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200-win32.png b/tests/auto/declarative/qdeclarativeimage/data/heart200-win32.png
index 4976ff9..19b20a8 100644
--- a/tests/auto/declarative/qdeclarativeimage/data/heart200-win32.png
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart200-win32.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200.png b/tests/auto/declarative/qdeclarativeimage/data/heart200.png
index 786e75d..5a31ae8 100644
--- a/tests/auto/declarative/qdeclarativeimage/data/heart200.png
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart200.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index b8d2828..0f1050e 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -274,14 +274,10 @@ void tst_qdeclarativeimage::svg()
QCOMPARE(obj->pixmap().height(), 300);
QCOMPARE(obj->width(), 550.0);
QCOMPARE(obj->height(), 500.0);
-#if defined(Q_OS_MAC)
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-mac.png"));
+#if defined(Q_OS_LINUX)
+ QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png"));
#elif defined(Q_OS_WIN32)
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-win32.png"));
-#elif defined(QT_ARCH_ARM)
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-arm.png"));
-#else
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png"));
#endif
obj->setSourceSize(QSize(200,200));
@@ -290,14 +286,10 @@ void tst_qdeclarativeimage::svg()
QCOMPARE(obj->pixmap().height(), 200);
QCOMPARE(obj->width(), 550.0);
QCOMPARE(obj->height(), 500.0);
-#if defined(Q_OS_MAC)
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-mac.png"));
+#if defined(Q_OS_LINUX)
+ QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png"));
#elif defined(Q_OS_WIN32)
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-win32.png"));
-#elif defined(QT_ARCH_ARM)
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-arm.png"));
-#else
- QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png"));
#endif
delete obj;
}
diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
index e0b46f0..4a9224e 100644
--- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
+++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
@@ -44,6 +44,7 @@
#include <QtDeclarative/qdeclarativeimageprovider.h>
#include <private/qdeclarativeimage_p.h>
#include <QImageReader>
+#include <QWaitCondition>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -85,6 +86,8 @@ private slots:
void removeProvider_data();
void removeProvider();
+ void threadTest();
+
private:
QString newImageFileName() const;
void fillRequestTestsData(const QString &id);
@@ -95,9 +98,15 @@ private:
class TestQImageProvider : public QDeclarativeImageProvider
{
public:
- TestQImageProvider()
- : QDeclarativeImageProvider(Image)
+ TestQImageProvider(bool *deleteWatch = 0)
+ : QDeclarativeImageProvider(Image), deleteWatch(deleteWatch)
+ {
+ }
+
+ ~TestQImageProvider()
{
+ if (deleteWatch)
+ *deleteWatch = true;
}
QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize)
@@ -114,6 +123,8 @@ public:
image = image.scaled(requestedSize);
return image;
}
+
+ bool *deleteWatch;
};
Q_DECLARE_METATYPE(TestQImageProvider*);
@@ -121,11 +132,17 @@ Q_DECLARE_METATYPE(TestQImageProvider*);
class TestQPixmapProvider : public QDeclarativeImageProvider
{
public:
- TestQPixmapProvider()
- : QDeclarativeImageProvider(Pixmap)
+ TestQPixmapProvider(bool *deleteWatch = 0)
+ : QDeclarativeImageProvider(Pixmap), deleteWatch(deleteWatch)
{
}
+ ~TestQPixmapProvider()
+ {
+ if (deleteWatch)
+ *deleteWatch = true;
+ }
+
QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize)
{
if (id == QLatin1String("no-such-file.png"))
@@ -140,6 +157,8 @@ public:
image = image.scaled(requestedSize);
return image;
}
+
+ bool *deleteWatch;
};
Q_DECLARE_METATYPE(TestQPixmapProvider*);
@@ -225,7 +244,9 @@ void tst_qdeclarativeimageprovider::requestImage_sync_data()
void tst_qdeclarativeimageprovider::requestImage_sync()
{
- runTest(false, new TestQImageProvider);
+ bool deleteWatch = false;
+ runTest(false, new TestQImageProvider(&deleteWatch));
+ QVERIFY(deleteWatch);
}
void tst_qdeclarativeimageprovider::requestImage_async_data()
@@ -235,7 +256,9 @@ void tst_qdeclarativeimageprovider::requestImage_async_data()
void tst_qdeclarativeimageprovider::requestImage_async()
{
- runTest(true, new TestQImageProvider);
+ bool deleteWatch = false;
+ runTest(true, new TestQImageProvider(&deleteWatch));
+ QVERIFY(deleteWatch);
}
void tst_qdeclarativeimageprovider::requestPixmap_sync_data()
@@ -245,13 +268,15 @@ void tst_qdeclarativeimageprovider::requestPixmap_sync_data()
void tst_qdeclarativeimageprovider::requestPixmap_sync()
{
- runTest(false, new TestQPixmapProvider);
+ bool deleteWatch = false;
+ runTest(false, new TestQPixmapProvider(&deleteWatch));
+ QVERIFY(deleteWatch);
}
void tst_qdeclarativeimageprovider::requestPixmap_async()
{
QDeclarativeEngine engine;
- QDeclarativeImageProvider *provider = new TestQPixmapProvider;
+ QDeclarativeImageProvider *provider = new TestQPixmapProvider();
engine.addImageProvider("test", provider);
QVERIFY(engine.imageProvider("test") != 0);
@@ -305,6 +330,70 @@ void tst_qdeclarativeimageprovider::removeProvider()
delete obj;
}
+class TestThreadProvider : public QDeclarativeImageProvider
+{
+ public:
+ TestThreadProvider() : QDeclarativeImageProvider(Image), ok(false) {}
+
+ ~TestThreadProvider() {}
+
+ QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize)
+ {
+ mutex.lock();
+ if (!ok)
+ cond.wait(&mutex);
+ mutex.unlock();
+ QVector<int> v;
+ for (int i = 0; i < 10000; i++)
+ v.prepend(i); //do some computation
+ QImage image(50,50, QImage::Format_RGB32);
+ image.fill(QColor(id).rgb());
+ if (size)
+ *size = image.size();
+ if (requestedSize.isValid())
+ image = image.scaled(requestedSize);
+ return image;
+ }
+
+ QWaitCondition cond;
+ QMutex mutex;
+ bool ok;
+};
+
+
+void tst_qdeclarativeimageprovider::threadTest()
+{
+ QDeclarativeEngine engine;
+
+ TestThreadProvider *provider = new TestThreadProvider;
+
+ engine.addImageProvider("test_thread", provider);
+ QVERIFY(engine.imageProvider("test_thread") != 0);
+
+ QString componentStr = "import Qt 4.7\nItem { \n"
+ "Image { source: \"image://test_thread/blue\"; asynchronous: true; }\n"
+ "Image { source: \"image://test_thread/red\"; asynchronous: true; }\n"
+ "Image { source: \"image://test_thread/green\"; asynchronous: true; }\n"
+ "Image { source: \"image://test_thread/yellow\"; asynchronous: true; }\n"
+ " }";
+ QDeclarativeComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QObject *obj = component.create();
+ //MUST not deadlock
+ QVERIFY(obj != 0);
+ QList<QDeclarativeImage *> images = obj->findChildren<QDeclarativeImage *>();
+ QCOMPARE(images.count(), 4);
+ QTest::qWait(100);
+ foreach(QDeclarativeImage *img, images) {
+ QCOMPARE(img->status(), QDeclarativeImage::Loading);
+ }
+ provider->ok = true;
+ provider->cond.wakeAll();
+ foreach(QDeclarativeImage *img, images) {
+ TRY_WAIT(img->status() == QDeclarativeImage::Ready);
+ }
+}
+
QTEST_MAIN(tst_qdeclarativeimageprovider)
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index f22edf6..e461b64 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -1673,31 +1673,39 @@ void tst_QPixmap::preserveDepth()
void tst_QPixmap::loadAsBitmapOrPixmap()
{
QImage tmp(10, 10, QImage::Format_RGB32);
- tmp.save("tmp.png");
+ tmp.save("temp_image.png");
bool ok;
// Check that we can load the pixmap as a pixmap and that it then turns into a pixmap
- QPixmap pixmap("tmp.png");
+ QPixmap pixmap("temp_image.png");
QVERIFY(!pixmap.isNull());
QVERIFY(pixmap.depth() > 1);
QVERIFY(!pixmap.isQBitmap());
pixmap = QPixmap();
- ok = pixmap.load("tmp.png");
+ ok = pixmap.load("temp_image.png");
+ QVERIFY(ok);
+ QVERIFY(!pixmap.isNull());
+ QVERIFY(pixmap.depth() > 1);
+ QVERIFY(!pixmap.isQBitmap());
+
+ //now we can try to load it without an extension
+ pixmap = QPixmap();
+ ok = pixmap.load("temp_image");
QVERIFY(ok);
QVERIFY(!pixmap.isNull());
QVERIFY(pixmap.depth() > 1);
QVERIFY(!pixmap.isQBitmap());
// The do the same check for bitmaps..
- QBitmap bitmap("tmp.png");
+ QBitmap bitmap("temp_image.png");
QVERIFY(!bitmap.isNull());
QVERIFY(bitmap.depth() == 1);
QVERIFY(bitmap.isQBitmap());
bitmap = QBitmap();
- ok = bitmap.load("tmp.png");
+ ok = bitmap.load("temp_image.png");
QVERIFY(ok);
QVERIFY(!bitmap.isNull());
QVERIFY(bitmap.depth() == 1);
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 8215ddc..3e79a9f 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -4436,6 +4436,9 @@ bool HtmlGenerator::generatePageElement(QXmlStreamWriter& writer,
if (node->isInnerNode()) {
const InnerNode* inner = static_cast<const InnerNode*>(node);
+ if (!inner->pageKeywords().isEmpty())
+ pageWords << inner->pageKeywords();
+
switch (node->type()) {
case Node::Fake:
{
@@ -4463,9 +4466,6 @@ bool HtmlGenerator::generatePageElement(QXmlStreamWriter& writer,
pageWords << title;
break;
}
-
- if (!inner->pageKeywords().isEmpty())
- pageWords << inner->pageKeywords();
}
else {
switch (node->type()) {
@@ -4502,6 +4502,12 @@ bool HtmlGenerator::generatePageElement(QXmlStreamWriter& writer,
pageWords << title;
break;
}
+
+ Node* parent = node->parent();
+ if (parent && ((parent->type() == Node::Class) ||
+ (parent->type() == Node::Namespace))) {
+ pageWords << parent->name();
+ }
}
writer.writeAttribute("id",t);
@@ -4531,6 +4537,35 @@ bool HtmlGenerator::generatePageElement(QXmlStreamWriter& writer,
}
writer.writeEndElement();
writer.writeEndElement();
+
+ if (node->type() == Node::Fake && node->doc().hasTableOfContents()) {
+ QList<Atom*> toc = node->doc().tableOfContents();
+ if (!toc.isEmpty()) {
+ for (int i = 0; i < toc.size(); ++i) {
+ Text headingText = Text::sectionHeading(toc.at(i));
+ QString s = headingText.toString();
+ writer.writeStartElement("page");
+ t.setNum(id++);
+ QString internalUrl = url + "#" + Doc::canonicalTitle(s);
+ writer.writeAttribute("id",t);
+ writer.writeStartElement("pageWords");
+ writer.writeCharacters(pageWords.join(" "));
+ writer.writeCharacters(" ");
+ writer.writeCharacters(s);
+ writer.writeEndElement();
+ writer.writeStartElement("pageTitle");
+ writer.writeCharacters(s);
+ writer.writeEndElement();
+ writer.writeStartElement("pageUrl");
+ writer.writeCharacters(internalUrl);
+ writer.writeEndElement();
+ writer.writeStartElement("pageType");
+ writer.writeCharacters("Article");
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+ }
+ }
return true;
}