summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Pernu <ville.pernu@nokia.com>2010-11-15 07:22:49 (GMT)
committerVille Pernu <ville.pernu@nokia.com>2010-11-15 07:22:49 (GMT)
commit57023a44b1c484ca72913bbb8efbbf83d5e77001 (patch)
treea5d9a4b4905df59ce404e71edbfe825d3438d51a
parent23480578e55c402e9c46897d0c338f026b6e55b8 (diff)
parent96a3848f8f460a39d5bad1e5c78e61857645c28f (diff)
downloadQt-57023a44b1c484ca72913bbb8efbbf83d5e77001.zip
Qt-57023a44b1c484ca72913bbb8efbbf83d5e77001.tar.gz
Qt-57023a44b1c484ca72913bbb8efbbf83d5e77001.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7staging
-rw-r--r--doc/src/getting-started/gettingstartedqml.qdoc17
-rw-r--r--doc/src/snippets/declarative/loader/sizeitem.qml62
-rw-r--r--doc/src/snippets/declarative/loader/sizeloader.qml62
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-buffer.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h9
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gdef.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-global.h4
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gsub.h9
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-open.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-stream.h8
-rw-r--r--src/corelib/tools/qlocale.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp41
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp46
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p_p.h4
-rw-r--r--src/gui/styles/qs60style.cpp107
-rw-r--r--src/gui/styles/qs60style_p.h7
-rw-r--r--src/gui/styles/qs60style_s60.cpp75
-rw-r--r--src/gui/widgets/qvalidator.cpp45
-rw-r--r--src/network/access/qhttpnetworkheader.cpp12
-rw-r--r--src/network/access/qnetworkrequest.cpp10
-rw-r--r--tests/auto/qdoublevalidator/tst_qdoublevalidator.cpp12
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp22
-rw-r--r--tools/qdoc3/helpprojectwriter.cpp16
-rw-r--r--tools/qdoc3/htmlgenerator.cpp9
-rw-r--r--tools/qdoc3/htmlgenerator.h2
-rw-r--r--tools/qdoc3/test/qt-build-docs.qdocconf8
-rw-r--r--tools/qdoc3/test/qt.qdocconf6
30 files changed, 452 insertions, 191 deletions
diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc
index c555627..54fa098 100644
--- a/doc/src/getting-started/gettingstartedqml.qdoc
+++ b/doc/src/getting-started/gettingstartedqml.qdoc
@@ -58,7 +58,12 @@
\image qml-texteditor5_editmenu.png
- To run the QML example code, merely provide the included \l{QML Viewer}{qmlviewer}
+ The final source code is in the \c{examples/tutorials/gettingStarted/gsQml}
+ directory. You may need to compile the C++ plugin in the
+ \c{examples/tutorials/gettingStarted/gsQml/} first. This will put the
+ C++ plugin in a directory where the QML files may find it.
+
+ To launch the text editor, merely provide the included \l{QML Viewer}{qmlviewer}
tool with the QML file as the argument. The C++ portion of this tutorial assumes
that the reader possesses basic knowledge of Qt's compilation procedures.
@@ -1005,4 +1010,14 @@
The application can function as a simple text editor, able to accept text
and save the text into a file. The text editor can also load from a file and
perform text manipulation.
+
+ \section1 Running the Text Editor
+
+ We need to compile the file dialog C++ plugin before the text editor can run.
+ To compile, enter the \c gsQml directory, then run \c qmake and compile
+ using \c make or \c nmake, depending on your platform. To run, launch
+ qmlviewer and open the \c texteditor.qml file.
+
+ The source code is in the \c{examples/tutorials/gettingStarted/gsQml}
+ directory.
*/
diff --git a/doc/src/snippets/declarative/loader/sizeitem.qml b/doc/src/snippets/declarative/loader/sizeitem.qml
new file mode 100644
index 0000000..6ace8d6
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/sizeitem.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 documentation 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 QtQuick 1.0
+
+Item {
+ width: 200; height: 200
+
+ Loader {
+ // position the Loader in the center of the parent
+ anchors.centerIn: parent
+ sourceComponent: rect
+ }
+
+ Component {
+ id: rect
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ }
+ }
+}
+//![0]
diff --git a/doc/src/snippets/declarative/loader/sizeloader.qml b/doc/src/snippets/declarative/loader/sizeloader.qml
new file mode 100644
index 0000000..eac7d57
--- /dev/null
+++ b/doc/src/snippets/declarative/loader/sizeloader.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 documentation 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 QtQuick 1.0
+
+Item {
+ width: 200; height: 200
+
+ Loader {
+ // Explicitly set the size of the Loader to the parent item's size
+ anchors.fill: parent
+ sourceComponent: rect
+ }
+
+ Component {
+ id: rect
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ }
+ }
+}
+//![0]
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h b/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h
index 0d7c2c2..0d631b2 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h
@@ -32,10 +32,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
typedef struct HB_GlyphItemRec_ {
HB_UInt gindex;
HB_UInt properties;
@@ -93,10 +89,6 @@ hb_buffer_add_glyph( HB_Buffer buffer,
HB_UInt properties,
HB_UInt cluster );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_BUFFER_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h
index 2a6d958..94e9b43 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h
@@ -33,11 +33,6 @@
HB_BEGIN_HEADER
-
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/* Attachment related structures */
struct HB_AttachPoint_
@@ -126,10 +121,6 @@ _HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef,
HB_Lookup* lo,
HB_UShort num_lookups );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_GDEF_PRIVATE_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h
index f9a03dd..ccb6bf9 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h
@@ -31,10 +31,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding
* flag in the LookupFlag field. */
#define HB_GDEF_BASE_GLYPH 0x0002
@@ -131,10 +127,6 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
HB_UShort* glyph_array,
HB_UShort* class_array );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_GDEF_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-global.h b/src/3rdparty/harfbuzz/src/harfbuzz-global.h
index bccd6a2..d4e6b46 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-global.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-global.h
@@ -39,10 +39,6 @@
#define HB_END_HEADER /* nothing */
#endif
-#if defined(__GNUC__) || defined(_MSC_VER)
-#define HB_USE_PACKED_STRUCTS
-#endif
-
HB_BEGIN_HEADER
#ifndef FALSE
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h
index 39f3159..63ba907 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h
@@ -32,10 +32,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/* shared tables */
#define VR_X_PLACEMENT_DEVICE 0
@@ -720,10 +716,6 @@ HB_INTERNAL void
_HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
HB_UShort lookup_type );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_GPOS_PRIVATE_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h
index 7eb329e..df0c3f6 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h
@@ -32,10 +32,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable;
/* LookupType 1 */
@@ -474,10 +470,6 @@ HB_INTERNAL void
_HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
HB_UShort lookup_type );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_GSUB_PRIVATE_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h b/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h
index b00df44..6e452bd 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h
@@ -31,11 +31,6 @@
HB_BEGIN_HEADER
-
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/* Lookup types for glyph substitution */
#define HB_GSUB_LOOKUP_SINGLE 1
@@ -139,10 +134,6 @@ HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub,
HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub,
HB_Buffer buffer );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_GSUB_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.h b/src/3rdparty/harfbuzz/src/harfbuzz-open.h
index 4ba6cf5..9ad7c98 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-open.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.h
@@ -30,10 +30,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/* Use this if a feature applies to all glyphs */
#define HB_ALL_GLYPHS 0xFFFF
@@ -279,10 +275,6 @@ enum HB_Type_
typedef enum HB_Type_ HB_Type;
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_OPEN_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
index ab5c07a..470e27b 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
@@ -34,10 +34,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/*
using anything else than signed or unsigned for bitfields in C is non standard,
but accepted by almost all compilers. And it gives a significant reduction in
@@ -258,10 +254,6 @@ typedef struct HB_Font_ {
void *userData;
} HB_FontRec;
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
typedef struct HB_ShaperItem_ HB_ShaperItem;
struct HB_ShaperItem_ {
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-stream.h b/src/3rdparty/harfbuzz/src/harfbuzz-stream.h
index a155cc2..cfbfb1c 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-stream.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-stream.h
@@ -30,10 +30,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
typedef struct HB_StreamRec_
{
HB_Byte* base;
@@ -42,10 +38,6 @@ typedef struct HB_StreamRec_
HB_UInt pos;
} HB_StreamRec;
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 8b424bb..1af2cb4 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -114,7 +114,7 @@ class Q_CORE_EXPORT QLocale
friend class QString;
friend class QByteArray;
friend class QIntValidator;
- friend class QDoubleValidator;
+ friend class QDoubleValidatorPrivate;
friend class QTextStream;
friend class QTextStreamPrivate;
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index 109fbbb..1119b92 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -129,15 +129,41 @@ void QDeclarativeLoaderPrivate::initResize()
The loaded item can be accessed using the \l item property.
- 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.
-
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 Loader sizing behavior
+
+ Loader is like any other visual item and must be positioned and sized
+ accordingly to become visible.
+
+ \list
+ \o If an explicit size is not specified for the Loader, the Loader
+ is automatically resized to the size of the loaded item once the
+ component is loaded.
+ \o If the size of the Loader is specified explicitly by setting
+ the width, height or by anchoring, the loaded item will be resized
+ to the size of the Loader.
+ \endlist
+
+ In both scenarios the size of the item and the Loader are identical.
+ This ensures that anchoring to the Loader is equivalent to anchoring
+ to the loaded item.
+
+ \table
+ \row
+ \o sizeloader.qml
+ \o sizeitem.qml
+ \row
+ \o \snippet doc/src/snippets/declarative/loader/sizeloader.qml 0
+ \o \snippet doc/src/snippets/declarative/loader/sizeitem.qml 0
+ \row
+ \o The red rectangle will be sized to the size of the root item.
+ \o The red rectangle will be 50x50, centered in the root item.
+ \endtable
+
\section2 Receiving signals from loaded items
@@ -343,12 +369,14 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
QDeclarativeContext *ctxt = new QDeclarativeContext(creationContext);
ctxt->setContextObject(q);
- QDeclarativeComponent *c = component;
- QObject *obj = component->create(ctxt);
+ QDeclarativeGuard<QDeclarativeComponent> c = component;
+ QObject *obj = component->beginCreate(ctxt);
if (component != c) {
// component->create could trigger a change in source that causes
// component to be set to something else. In that case we just
// need to cleanup.
+ if (c)
+ c->completeCreate();
delete obj;
delete ctxt;
return;
@@ -373,6 +401,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
delete ctxt;
source = QUrl();
}
+ component->completeCreate();
emit q->sourceChanged();
emit q->statusChanged();
emit q->progressChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index dc3d5ee..926bec2 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -373,7 +373,21 @@ void QDeclarativePathViewPrivate::regenerate()
opacity of the items as they rotate. This additional code can be seen in the
PathAttribute documentation.)
- The \c focus can be set to \c true to enable keyboard navigation.
+ PathView does not automatically handle keyboard navigation. This is because
+ the keys to use for navigation will depend upon the shape of the path. Navigation
+ can be added quite simply by setting \c focus to \c true and calling
+ \l decrementCurrentIndex() or \l incrementCurrentIndex(), for example to navigate
+ using the left and right arrow keys:
+
+ \code
+ PathView {
+ ...
+ focus: true
+ Keys.onLeftPressed: decrementCurrentIndex()
+ Keys.onRightPressed: incrementCurrentIndex()
+ }
+ \endcode
+
The path view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
Delegates are instantiated as needed and may be destroyed at any time.
@@ -607,6 +621,8 @@ void QDeclarativePathView::setCurrentIndex(int idx)
*/
void QDeclarativePathView::incrementCurrentIndex()
{
+ Q_D(QDeclarativePathView);
+ d->moveDirection = QDeclarativePathViewPrivate::Positive;
setCurrentIndex(currentIndex()+1);
}
@@ -625,6 +641,7 @@ void QDeclarativePathView::decrementCurrentIndex()
int idx = currentIndex()-1;
if (idx < 0)
idx = d->modelCount - 1;
+ d->moveDirection = QDeclarativePathViewPrivate::Negative;
setCurrentIndex(idx);
}
}
@@ -1636,7 +1653,7 @@ void QDeclarativePathViewPrivate::snapToCurrent()
if (!model || modelCount <= 0)
return;
- qreal targetOffset = modelCount - currentIndex;
+ qreal targetOffset = qmlMod(modelCount - currentIndex, modelCount);
moveReason = Other;
offsetAdj = 0.0;
@@ -1645,19 +1662,28 @@ void QDeclarativePathViewPrivate::snapToCurrent()
const int duration = highlightMoveDuration;
- if (targetOffset - offset > modelCount/2) {
+ if (moveDirection == Positive || (moveDirection == Shortest && targetOffset - offset > modelCount/2)) {
qreal distance = modelCount - targetOffset + offset;
- tl.move(moveOffset, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance));
- tl.set(moveOffset, modelCount);
- tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * (modelCount-targetOffset) / distance));
- } else if (targetOffset - offset <= -modelCount/2) {
+ if (targetOffset > moveOffset) {
+ tl.move(moveOffset, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance));
+ tl.set(moveOffset, modelCount);
+ tl.move(moveOffset, targetOffset, QEasingCurve(offset == 0.0 ? QEasingCurve::InOutQuad : QEasingCurve::OutQuad), int(duration * (modelCount-targetOffset) / distance));
+ } else {
+ tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);
+ }
+ } else if (moveDirection == Negative || targetOffset - offset <= -modelCount/2) {
qreal distance = modelCount - offset + targetOffset;
- tl.move(moveOffset, modelCount, QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance));
- tl.set(moveOffset, 0.0);
- tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * targetOffset / distance));
+ if (targetOffset < moveOffset) {
+ tl.move(moveOffset, modelCount, QEasingCurve(targetOffset == 0 ? QEasingCurve::InOutQuad : QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance));
+ tl.set(moveOffset, 0.0);
+ tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * targetOffset / distance));
+ } else {
+ tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);
+ }
} else {
tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);
}
+ moveDirection = Shortest;
}
QDeclarativePathViewAttached *QDeclarativePathView::qmlAttachedProperties(QObject *obj)
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
index b217216..6232b83 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
@@ -82,7 +82,7 @@ public:
, dragMargin(0), deceleration(100)
, moveOffset(this, &QDeclarativePathViewPrivate::setAdjustedOffset)
, firstIndex(-1), pathItems(-1), requestedIndex(-1)
- , moveReason(Other), attType(0), highlightComponent(0), highlightItem(0)
+ , moveReason(Other), moveDirection(Shortest), attType(0), highlightComponent(0), highlightItem(0)
, moveHighlight(this, &QDeclarativePathViewPrivate::setHighlightPosition)
, highlightPosition(0)
, highlightRangeStart(0), highlightRangeEnd(0)
@@ -173,6 +173,8 @@ public:
QVariant modelVariant;
enum MovementReason { Other, SetIndex, Mouse };
MovementReason moveReason;
+ enum MovementDirection { Shortest, Negative, Positive };
+ MovementDirection moveDirection;
QDeclarativeOpenMetaObjectType *attType;
QDeclarativeComponent *highlightComponent;
QDeclarativeItem *highlightItem;
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index f3fb2f5..5fe9050 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -405,13 +405,14 @@ void QS60StylePrivate::clearCaches(CacheClearReason reason)
QPixmapCache::clear();
break;
case CC_ThemeChange:
- m_colorCache.clear();
QPixmapCache::clear();
+#ifdef Q_WS_S60
+ deleteStoredSettings();
+#endif
deleteBackground();
break;
case CC_UndefinedChange:
default:
- m_colorCache.clear();
m_mappedFontsCache.clear();
QPixmapCache::clear();
deleteBackground();
@@ -419,64 +420,53 @@ void QS60StylePrivate::clearCaches(CacheClearReason reason)
}
}
-// Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use
-// for QPalette::Button and QPalette::ToolTipBase. Therefore S60Style needs to guesstimate
-// palette colors by calculating average rgb values for button pixels.
-// Returns Qt::black if there is an issue with the graphics (image is NULL, or no bits() found).
-QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
+QColor QS60StylePrivate::calculatedColor(SkinFrameElements frame) const
{
- const bool cachedColorExists = m_colorCache.contains(frame);
- if (!cachedColorExists) {
- const int frameCornerWidth = pixelMetric(PM_FrameCornerWidth);
- const int frameCornerHeight = pixelMetric(PM_FrameCornerHeight);
- Q_ASSERT(2 * frameCornerWidth < 32);
- Q_ASSERT(2 * frameCornerHeight < 32);
-
- const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32, 32)).toImage();
- Q_ASSERT(frameImage.bytesPerLine() > 0);
- if (frameImage.isNull())
- return Qt::black;
-
- const QRgb *pixelRgb = (const QRgb*)frameImage.bits();
- const int pixels = frameImage.byteCount()/sizeof(QRgb);
-
- int estimatedRed = 0;
- int estimatedGreen = 0;
- int estimatedBlue = 0;
-
- int skips = 0;
- int estimations = 0;
-
- const int topBorderLastPixel = frameCornerHeight*frameImage.width() - 1;
- const int bottomBorderFirstPixel = frameImage.width() * frameImage.height() - frameCornerHeight*frameImage.width() - 1;
- const int rightBorderFirstPixel = frameImage.width() - frameCornerWidth;
- const int leftBorderLastPixel = frameCornerWidth;
-
- while ((skips + estimations) < pixels) {
- if ((skips + estimations) > topBorderLastPixel &&
- (skips + estimations) < bottomBorderFirstPixel) {
- for (int rowIndex = 0; rowIndex < frameImage.width(); rowIndex++) {
- if (rowIndex > leftBorderLastPixel &&
- rowIndex < rightBorderFirstPixel) {
- estimatedRed += qRed(*pixelRgb);
- estimatedGreen += qGreen(*pixelRgb);
- estimatedBlue += qBlue(*pixelRgb);
- }
- pixelRgb++;
- estimations++;
+ const int frameCornerWidth = pixelMetric(PM_FrameCornerWidth);
+ const int frameCornerHeight = pixelMetric(PM_FrameCornerHeight);
+ Q_ASSERT(2 * frameCornerWidth < 32);
+ Q_ASSERT(2 * frameCornerHeight < 32);
+
+ const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32, 32)).toImage();
+ Q_ASSERT(frameImage.bytesPerLine() > 0);
+ if (frameImage.isNull())
+ return Qt::black;
+
+ const QRgb *pixelRgb = (const QRgb*)frameImage.constBits();
+ const int pixels = frameImage.byteCount() / sizeof(QRgb);
+
+ int estimatedRed = 0;
+ int estimatedGreen = 0;
+ int estimatedBlue = 0;
+
+ int skips = 0;
+ int estimations = 0;
+
+ const int topBorderLastPixel = frameCornerHeight * frameImage.width() - 1;
+ const int bottomBorderFirstPixel = frameImage.width() * frameImage.height() - topBorderLastPixel;
+ const int rightBorderFirstPixel = frameImage.width() - frameCornerWidth;
+ const int leftBorderLastPixel = frameCornerWidth;
+
+ while ((skips + estimations) < pixels) {
+ if ((skips + estimations) > topBorderLastPixel &&
+ (skips + estimations) < bottomBorderFirstPixel) {
+ for (int rowIndex = 0; rowIndex < frameImage.width(); rowIndex++) {
+ if (rowIndex > leftBorderLastPixel &&
+ rowIndex < rightBorderFirstPixel) {
+ estimatedRed += qRed(*pixelRgb);
+ estimatedGreen += qGreen(*pixelRgb);
+ estimatedBlue += qBlue(*pixelRgb);
}
- } else {
pixelRgb++;
- skips++;
+ estimations++;
}
+ } else {
+ pixelRgb++;
+ skips++;
}
- QColor frameColor(estimatedRed/estimations, estimatedGreen/estimations, estimatedBlue/estimations);
- m_colorCache.insert(frame, frameColor);
- return !estimations ? Qt::black : frameColor;
- } else {
- return m_colorCache.value(frame);
}
-
+ QColor frameColor(estimatedRed/estimations, estimatedGreen/estimations, estimatedBlue/estimations);
+ return !estimations ? Qt::black : frameColor;
}
void QS60StylePrivate::setThemePalette(QApplication *app) const
@@ -731,11 +721,14 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const
palette->setBrush(QPalette::Window, backgroundTexture());
// set as transparent so that styled full screen theme background is visible
palette->setBrush(QPalette::Base, Qt::transparent);
- // set button and tooltipbase based on pixel colors
+ // set button color based on pixel colors
+#ifndef Q_WS_S60
+ //For emulated style, just calculate the color every time
+ const QColor buttonColor = calculatedColor(SF_ButtonNormal);
+#else
const QColor buttonColor = colorFromFrameGraphics(SF_ButtonNormal);
+#endif
palette->setColor(QPalette::Button, buttonColor);
- const QColor toolTipColor = colorFromFrameGraphics(SF_ToolTip);
- palette->setColor(QPalette::ToolTipBase, toolTipColor);
palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter());
palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker());
palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125));
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index b46f75e..db4285d 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -523,8 +523,12 @@ public:
static bool isSingleClickUi();
static bool isWidgetPressed(const QWidget *widget);
- // calculates average color based on button skin graphics (minus borders).
+#ifdef Q_WS_S60
+ static void deleteStoredSettings();
+ // calculates average color based on theme graphics (minus borders).
QColor colorFromFrameGraphics(SkinFrameElements frame) const;
+#endif
+ QColor calculatedColor(SkinFrameElements frame) const;
//set theme palette for application
void setThemePalette(QApplication *application) const;
@@ -542,7 +546,6 @@ public:
static const int m_numberOfLayouts;
mutable QHash<QPair<QS60StyleEnums::FontCategories , int>, QFont> m_mappedFontsCache;
- mutable QHash<SkinFrameElements, QColor> m_colorCache;
// Has one entry per SkinFrameElements
static const struct frameElementCenter {
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index a1ea308..7b75d40 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -48,6 +48,7 @@
#include "private/qpixmap_s60_p.h"
#include "private/qcore_symbian_p.h"
#include "qapplication.h"
+#include "qsettings.h"
#include "qpluginloader.h"
#include "qlibraryinfo.h"
@@ -69,6 +70,8 @@
#include <gulicon.h>
#include <AknBitmapAnimation.h>
+#include <centralrepository.h>
+
#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
QT_BEGIN_NAMESPACE
@@ -81,6 +84,8 @@ enum TDrawType {
ENoDraw
};
+const TUid personalisationUID = { 0x101F876F };
+
enum TSupportRelease {
ES60_None = 0x0000, //indicates that the commonstyle should draw the graphics
ES60_3_1 = 0x0001,
@@ -689,6 +694,76 @@ bool QS60StylePrivate::isSingleClickUi()
return (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0);
}
+void QS60StylePrivate::deleteStoredSettings()
+{
+ QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
+ settings.beginGroup(QLatin1String("QS60Style"));
+ settings.remove("");
+ settings.endGroup();
+}
+
+// Since S60Style has 'button' as a graphic, we don't have any native color which to use
+// for QPalette::Button. Therefore S60Style needs to guesstimate palette color by calculating
+// average rgb values for button pixels.
+// Returns Qt::black if there is an issue with the graphics (image is NULL, or no constBits() found).
+QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
+{
+#ifndef QT_NO_SETTINGS
+ TInt themeID = 0;
+ //First we need to fetch active theme ID. We need to store the themeID at the same time
+ //as color, so that we can later check if the stored color is still from the same theme.
+ //Native side stores active theme UID/Timestamp into central repository.
+ int error = 0;
+ QT_TRAP_THROWING(
+ CRepository *themeRepository = CRepository::NewLC(personalisationUID);
+ if (themeRepository) {
+ static const TInt KThemePkgIDDesSize = 23; //size of the stored theme package ID
+ TBuf<32> value; //themeID is currently max of 8 + 1 + 8 characters, but lets have some extra space
+ const TUint32 key = 0x00000002; //active theme key in the repository
+ error = themeRepository->Get(key, value);
+ if (error == KErrNone) {
+ TLex lex(value);
+ TPtrC numberToken(lex.NextToken());
+ if (numberToken.Length())
+ error = TLex(numberToken).Val(themeID);
+ else
+ error = KErrArgument;
+ }
+ }
+ CleanupStack::PopAndDestroy(themeRepository);
+ );
+
+ QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
+ settings.beginGroup(QLatin1String("QS60Style"));
+ if (themeID != 0) {
+ QVariant buttonColor = settings.value(QLatin1String("ButtonColor"));
+ if (!buttonColor.isNull()) {
+ //there is a stored color value, lets see if the theme ID matches
+ if (error == KErrNone) {
+ QVariant themeUID = settings.value(QLatin1String("ThemeUID"));
+ if (!themeUID.isNull() && themeUID.toInt() == themeID) {
+ QColor storedColor(buttonColor.value<QColor>());
+ if (storedColor.isValid())
+ return storedColor;
+ }
+ }
+ settings.remove(""); //if color was invalid, or theme has been changed, just delete all stored settings
+ }
+ }
+#endif
+
+ QColor color = calculatedColor(frame);
+
+#ifndef QT_NO_SETTINGS
+ settings.setValue(QLatin1String("ThemeUID"), QVariant(themeID));
+ if (frame == SF_ButtonNormal) //other colors are not currently calculated from graphics
+ settings.setValue(QLatin1String("ButtonColor"), QVariant(color));
+ settings.endGroup();
+#endif
+
+ return color;
+}
+
QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
{
CCoeControl *control = targetWidget->effectiveWinId();
diff --git a/src/gui/widgets/qvalidator.cpp b/src/gui/widgets/qvalidator.cpp
index b75db45..130d091 100644
--- a/src/gui/widgets/qvalidator.cpp
+++ b/src/gui/widgets/qvalidator.cpp
@@ -499,6 +499,8 @@ public:
}
QDoubleValidator::Notation notation;
+
+ QValidator::State validateWithLocale(QString & input, QLocalePrivate::NumberMode numMode, const QLocale &locale) const;
};
@@ -654,42 +656,49 @@ QValidator::State QDoubleValidator::validate(QString & input, int &) const
break;
}
+ State currentLocaleValidation = d->validateWithLocale(input, numMode, locale());
+ if (currentLocaleValidation == Acceptable || locale().language() == QLocale::C)
+ return currentLocaleValidation;
+ State cLocaleValidation = d->validateWithLocale(input, numMode, QLocale(QLocale::C));
+ return qMax(currentLocaleValidation, cLocaleValidation);
+}
+
+QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QLocalePrivate::NumberMode numMode, const QLocale &locale) const
+{
+ Q_Q(const QDoubleValidator);
QByteArray buff;
- if (!locale().d()->validateChars(input, numMode, &buff, dec)) {
- QLocale cl(QLocale::C);
- if (!cl.d()->validateChars(input, numMode, &buff, dec))
- return Invalid;
- }
+ if (!locale.d()->validateChars(input, numMode, &buff, q->dec))
+ return QValidator::Invalid;
if (buff.isEmpty())
- return Intermediate;
+ return QValidator::Intermediate;
- if (b >= 0 && buff.startsWith('-'))
- return Invalid;
+ if (q->b >= 0 && buff.startsWith('-'))
+ return QValidator::Invalid;
- if (t < 0 && buff.startsWith('+'))
- return Invalid;
+ if (q->t < 0 && buff.startsWith('+'))
+ return QValidator::Invalid;
bool ok, overflow;
double i = QLocalePrivate::bytearrayToDouble(buff.constData(), &ok, &overflow);
if (overflow)
- return Invalid;
+ return QValidator::Invalid;
if (!ok)
- return Intermediate;
+ return QValidator::Intermediate;
- if (i >= b && i <= t)
- return Acceptable;
+ if (i >= q->b && i <= q->t)
+ return QValidator::Acceptable;
- if (d->notation == StandardNotation) {
- double max = qMax(qAbs(b), qAbs(t));
+ if (notation == QDoubleValidator::StandardNotation) {
+ double max = qMax(qAbs(q->b), qAbs(q->t));
if (max < LLONG_MAX) {
qlonglong n = pow10(numDigits(qlonglong(max))) - 1;
if (qAbs(i) > n)
- return Invalid;
+ return QValidator::Invalid;
}
}
- return Intermediate;
+ return QValidator::Intermediate;
}
diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp
index 669f9cf..3eb2f3b 100644
--- a/src/network/access/qhttpnetworkheader.cpp
+++ b/src/network/access/qhttpnetworkheader.cpp
@@ -60,7 +60,17 @@ QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QHttpNetworkHeaderPri
qint64 QHttpNetworkHeaderPrivate::contentLength() const
{
bool ok = false;
- QByteArray value = headerField("content-length");
+ // We are not using the headerField() method here because servers might send us multiple content-length
+ // headers which is crap (see QTBUG-15311). Therefore just take the first content-length header field.
+ QByteArray value;
+ QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(),
+ end = fields.constEnd();
+ for ( ; it != end; ++it)
+ if (qstricmp("content-length", it->first) == 0) {
+ value = it->second;
+ break;
+ }
+
qint64 length = value.toULongLong(&ok);
if (ok)
return length;
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index b761af5..162392d 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -899,10 +899,16 @@ void QNetworkHeadersPrivate::parseAndSetHeader(const QByteArray &key, const QByt
// is it a known header?
QNetworkRequest::KnownHeaders parsedKey = parseHeaderName(key);
if (parsedKey != QNetworkRequest::KnownHeaders(-1)) {
- if (value.isNull())
+ if (value.isNull()) {
cookedHeaders.remove(parsedKey);
- else
+ } else if (parsedKey == QNetworkRequest::ContentLengthHeader
+ && cookedHeaders.contains(QNetworkRequest::ContentLengthHeader)) {
+ // Only set the cooked header "Content-Length" once.
+ // See bug QTBUG-15311
+ } else {
cookedHeaders.insert(parsedKey, parseHeaderValue(parsedKey, value));
+ }
+
}
}
diff --git a/tests/auto/qdoublevalidator/tst_qdoublevalidator.cpp b/tests/auto/qdoublevalidator/tst_qdoublevalidator.cpp
index 26890b3..98c4740 100644
--- a/tests/auto/qdoublevalidator/tst_qdoublevalidator.cpp
+++ b/tests/auto/qdoublevalidator/tst_qdoublevalidator.cpp
@@ -214,6 +214,13 @@ void tst_QDoubleValidator::validate_data()
arabicNum += QChar(1643);
arabicNum += QChar(1636);
QTest::newRow("arabic") << "ar" << 0.0 << 20.0 << 2 << arabicNum << ACC << ACC;
+
+ QTest::newRow("data_QTBUG_14935-1") << "de" << 0.0 << 1.0 << 5 << QString("0.31") << ACC << ACC;
+ QTest::newRow("data_QTBUG_14935-2") << "de" << 0.0 << 1000000.0 << 5 << QString("3.123") << ACC << ACC;
+ QTest::newRow("data_QTBUG_14935-3") << "de" << 0.0 << 1000000.0 << 5 << QString("123,345.678") << ACC << ACC;
+
+ QTest::newRow("data_de_problem-1") << "de" << 0.0 << 10.0 << 0 << QString("1.0") << ITM << ITM;
+ QTest::newRow("data_de_problem-2") << "de" << 0.0 << 10.0 << 0 << QString("0.1") << INV << INV;
}
void tst_QDoubleValidator::validate()
@@ -226,6 +233,9 @@ void tst_QDoubleValidator::validate()
QFETCH(QValidator::State, scientific_state);
QFETCH(QValidator::State, standard_state);
+ QEXPECT_FAIL("data_de_problem-1", "To be fixed. See QTBUG-15210.", Abort);
+ QEXPECT_FAIL("data_de_problem-2", "To be fixed. See QTBUG-15210.", Abort);
+
QLocale::setDefault(QLocale(localeName));
QDoubleValidator dv(minimum, maximum, decimals, 0);
@@ -308,6 +318,8 @@ void tst_QDoubleValidator::validateIntEquiv()
QFETCH(QString, input);
QFETCH(QValidator::State, state);
+ QLocale::setDefault(QLocale("C"));
+
QDoubleValidator dv(minimum, maximum, 0, 0);
dv.setNotation(QDoubleValidator::StandardNotation);
int dummy;
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index a986438..41b3e0a 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -301,6 +301,8 @@ private Q_SLOTS:
void httpWithNoCredentialUsage();
+ void qtbug15311doubleContentLength();
+
// NOTE: This test must be last!
void parentingRepliesToTheApp();
};
@@ -4724,6 +4726,26 @@ void tst_QNetworkReply::httpWithNoCredentialUsage()
QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError);
}
+void tst_QNetworkReply::qtbug15311doubleContentLength()
+{
+ QByteArray response("HTTP/1.0 200 OK\r\nContent-Length: 3\r\nServer: bogus\r\nContent-Length: 3\r\n\r\nABC");
+ MiniHttpServer server(response);
+ server.doClose = true;
+
+ QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort())));
+ QNetworkReplyPtr reply = manager.get(request);
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(reply->isFinished());
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QCOMPARE(reply->size(), qint64(3));
+ QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), qint64(3));
+ QCOMPARE(reply->rawHeader("Content-length"), QByteArray("3, 3"));
+ QCOMPARE(reply->readAll(), QByteArray("ABC"));
+}
+
// NOTE: This test must be last testcase in tst_qnetworkreply!
diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp
index 98246c4..63e8df7 100644
--- a/tools/qdoc3/helpprojectwriter.cpp
+++ b/tools/qdoc3/helpprojectwriter.cpp
@@ -49,6 +49,7 @@
#include "config.h"
#include "node.h"
#include "tree.h"
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -250,8 +251,9 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
foreach (const QString &name, project.subprojects.keys()) {
SubProject subproject = project.subprojects[name];
// No selectors: accept all nodes.
- if (subproject.selectors.isEmpty())
+ if (subproject.selectors.isEmpty()) {
project.subprojects[name].nodes[objName] = node;
+ }
else if (subproject.selectors.contains(node->type())) {
// Accept only the node types in the selectors hash.
if (node->type() != Node::Fake)
@@ -262,9 +264,10 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
const FakeNode *fakeNode = static_cast<const FakeNode *>(node);
if (subproject.selectors[node->type()].contains(fakeNode->subType()) &&
fakeNode->subType() != Node::ExternalPage &&
- !fakeNode->fullTitle().isEmpty())
+ !fakeNode->fullTitle().isEmpty()) {
project.subprojects[name].nodes[objName] = node;
+ }
}
}
}
@@ -527,13 +530,11 @@ void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer
writer.writeStartElement("section");
writer.writeAttribute("ref", href);
writer.writeAttribute("title", fakeNode->fullTitle());
- // qDebug() << "Title:" << fakeNode->fullTitle();
- if (fakeNode->subType() == Node::HeaderFile) {
-
+ if ((fakeNode->subType() == Node::HeaderFile) || (fakeNode->subType() == Node::QmlClass)) {
// Write subsections for all members, obsolete members and Qt 3
// members.
- if (!project.memberStatus[node].isEmpty()) {
+ if (!project.memberStatus[node].isEmpty() || (fakeNode->subType() == Node::QmlClass)) {
QString membersPath = href.left(href.size()-5) + "-members.html";
writer.writeStartElement("section");
writer.writeAttribute("ref", membersPath);
@@ -690,8 +691,9 @@ void HelpProjectWriter::generateProject(HelpProject &project)
if (subproject.sortPages) {
QStringList titles = subproject.nodes.keys();
titles.sort();
- foreach (const QString &title, titles)
+ foreach (const QString &title, titles) {
writeNode(project, writer, subproject.nodes[title]);
+ }
} else {
// Find a contents node and navigate from there, using the NextLink values.
foreach (const Node *node, subproject.nodes) {
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 9e45f8c..76ee4e8 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -3413,7 +3413,7 @@ QString HtmlGenerator::protect(const QString &string, const QString &outputEncod
#undef APPEND
}
-QString HtmlGenerator::fileBase(const Node *node)
+QString HtmlGenerator::fileBase(const Node *node) const
{
QString result;
@@ -3544,8 +3544,11 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative)
return QString();
fn = fileName(node);
-/* if (!node->url().isEmpty())
- return fn;*/
+#if 0
+ if (!node->url().isEmpty())
+ return fn;
+#endif
+
#if 0
// ### reintroduce this test, without breaking .dcf files
if (fn != outFileName())
diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h
index d885ada..b96d737 100644
--- a/tools/qdoc3/htmlgenerator.h
+++ b/tools/qdoc3/htmlgenerator.h
@@ -241,7 +241,7 @@ class HtmlGenerator : public PageGenerator
void generateStatus(const Node *node, CodeMarker *marker);
QString registerRef(const QString& ref);
- QString fileBase(const Node *node);
+ virtual QString fileBase(const Node *node) const;
#if 0
QString fileBase(const Node *node, const SectionIterator& section);
#endif
diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf
index dcabeb4..358f17f 100644
--- a/tools/qdoc3/test/qt-build-docs.qdocconf
+++ b/tools/qdoc3/test/qt-build-docs.qdocconf
@@ -62,11 +62,15 @@ qhp.Qt.extraFiles = index.html \
qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc
qhp.Qt.customFilters.Qt.name = Qt 4.7.1
qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1
-qhp.Qt.subprojects = classes overviews examples
+qhp.Qt.subprojects = classes qmlelements overviews examples
qhp.Qt.subprojects.classes.title = Classes
-qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
+qhp.Qt.subprojects.classes.indexTitle = All Classes
qhp.Qt.subprojects.classes.selectors = class fake:headerfile
qhp.Qt.subprojects.classes.sortPages = true
+qhp.Qt.subprojects.qmlelements.title = QML Elements
+qhp.Qt.subprojects.qmlelements.indexTitle = QML Elements
+qhp.Qt.subprojects.qmlelements.selectors = fake:qmlclass
+qhp.Qt.subprojects.qmlelements.sortPages = true
qhp.Qt.subprojects.overviews.title = Overviews
qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs
qhp.Qt.subprojects.overviews.selectors = fake:page,group,module
diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf
index ea97205..947beb2 100644
--- a/tools/qdoc3/test/qt.qdocconf
+++ b/tools/qdoc3/test/qt.qdocconf
@@ -62,11 +62,15 @@ qhp.Qt.extraFiles = index.html \
qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc
qhp.Qt.customFilters.Qt.name = Qt 4.7.1
qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1
-qhp.Qt.subprojects = classes overviews examples
+qhp.Qt.subprojects = classes qmlelements overviews examples
qhp.Qt.subprojects.classes.title = Classes
qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
qhp.Qt.subprojects.classes.selectors = class fake:headerfile
qhp.Qt.subprojects.classes.sortPages = true
+qhp.Qt.subprojects.qmlelements.title = QML Elements
+qhp.Qt.subprojects.qmlelements.indexTitle = QML Elements
+qhp.Qt.subprojects.qmlelements.selectors = fake:qmlclass
+qhp.Qt.subprojects.qmlelements.sortPages = true
qhp.Qt.subprojects.overviews.title = Overviews
qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs
qhp.Qt.subprojects.overviews.selectors = fake:page,group,module