From 71ba2b0973d291e991e1498c266e69d6640c8531 Mon Sep 17 00:00:00 2001
From: Benjamin Poulain
Date: Wed, 16 Jun 2010 10:01:42 +0200
Subject: Reduce the memory consumption of QtFontStyle
QtFontSize::pixelSize() was allocating 8 slots for QtFontSize
while most fonts only require one.
This patch add a special case for the first QtFontSize in order to
reduce memory consumption.
The size of QtFontSize in memory has also been reduced.
Overall, the memory consumtion of QtFontStyle instances go down
from 100kb to 10kb.
Reviewed-by: Eskil Abrahamsen Blomfeldt
---
src/gui/text/qfontdatabase.cpp | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index ff29462..4c058ce 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -145,18 +145,18 @@ struct QtFontEncoding
struct QtFontSize
{
- unsigned short pixelSize;
-
#ifdef Q_WS_X11
- int count;
QtFontEncoding *encodings;
QtFontEncoding *encodingID(int id, uint xpoint = 0, uint xres = 0,
uint yres = 0, uint avgwidth = 0, bool add = false);
+ unsigned short count : 16;
#endif // Q_WS_X11
#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
QByteArray fileName;
int fileIndex;
#endif // defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
+
+ unsigned short pixelSize : 16;
};
@@ -284,7 +284,12 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add)
if (!add)
return 0;
- if (!(count % 8)) {
+ if (!pixelSizes) {
+ // Most style have only one font size, we avoid waisting memory
+ QtFontSize *newPixelSizes = (QtFontSize *)malloc(sizeof(QtFontSize));
+ Q_CHECK_PTR(newPixelSizes);
+ pixelSizes = newPixelSizes;
+ } else if (!(count % 8)) {
QtFontSize *newPixelSizes = (QtFontSize *)
realloc(pixelSizes,
(((count+8) >> 3) << 3) * sizeof(QtFontSize));
--
cgit v0.12
From 7b0f85f91c7bf51b98e96621312a0f5e86349461 Mon Sep 17 00:00:00 2001
From: Thiago Macieira
Date: Sat, 29 May 2010 20:34:46 +0200
Subject: Work around ICE in Intel C++ Compiler 11.1.072
qml/qdeclarativecompiledbindings.cpp(1141) (col. 11): internal error: 0_1855
Intel reports that this bug has been fixed with release 12 of ICC
Reviewed-By: Alan Alpert
---
src/declarative/qml/qdeclarativecompiledbindings.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp
index ad05e80..507e47b 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -64,7 +64,7 @@ DEFINE_BOOL_CONFIG_OPTION(bindingsDump, QML_BINDINGS_DUMP);
Q_GLOBAL_STATIC(QDeclarativeFastProperties, fastProperties);
-#ifdef __GNUC__
+#if defined(Q_CC_GNU) && (!defined(Q_CC_INTEL) || __INTEL_COMPILER >= 1200)
# define QML_THREADED_INTERPRETER
#endif
--
cgit v0.12
From 5b5785bc564ccea9f6868d02be3d1080cb5039b9 Mon Sep 17 00:00:00 2001
From: kh1
Date: Wed, 16 Jun 2010 12:24:12 +0200
Subject: Fix some kind of race condition while using remote commands.
Please do not merge to master, we had to fix it different there.
Because of async content loading, we have to cache the url to load. A
combination of SetSource and SyncContents would have lead to sync to the
old url till loading was finished. So return the cached during loading.
Task-number: QTBUG-11342
Reviewed-by: ck
---
tools/assistant/tools/assistant/helpviewer_qwv.cpp | 23 +++++++++++++++++++++-
tools/assistant/tools/assistant/helpviewer_qwv.h | 3 ++-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
index 244d091..dcbbf2c 100644
--- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp
+++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
@@ -172,6 +172,7 @@ private:
bool closeNewTabIfNeeded;
friend class HelpViewer;
+ QUrl m_loadingUrl;
Qt::MouseButtons m_pressedButtons;
Qt::KeyboardModifiers m_keyboardModifiers;
};
@@ -232,6 +233,11 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *,
return false;
}
+ m_loadingUrl = url; // because of async page loading, we will hit some kind
+ // of race condition while using a remote command, like a combination of
+ // SetSource; SyncContent. SetSource would be called and SyncContents shortly
+ // afterwards, but the page might not have finished loading and the old url
+ // would be returned.
return true;
}
@@ -268,6 +274,7 @@ HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom)
connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this,
SIGNAL(highlighted(QString)));
connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
+ connect(this, SIGNAL(loadStarted()), this, SLOT(setLoadStarted()));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested()));
@@ -333,10 +340,19 @@ bool HelpViewer::handleForwardBackwardMouseButtons(QMouseEvent *e)
return false;
}
+QUrl HelpViewer::source() const
+{
+ HelpPage *currentPage = static_cast (page());
+ if (currentPage && !hasLoadFinished()) {
+ // see HelpPage::acceptNavigationRequest(...)
+ return currentPage->m_loadingUrl;
+ }
+ return url();
+}
+
void HelpViewer::setSource(const QUrl &url)
{
TRACE_OBJ
- loadFinished = false;
load(url.toString() == QLatin1String("help") ? LocalHelpFile : url);
}
@@ -396,6 +412,11 @@ void HelpViewer::mousePressEvent(QMouseEvent *event)
QWebView::mousePressEvent(event);
}
+void HelpViewer::setLoadStarted()
+{
+ loadFinished = false;
+}
+
void HelpViewer::setLoadFinished(bool ok)
{
TRACE_OBJ
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.h b/tools/assistant/tools/assistant/helpviewer_qwv.h
index 2577828..1897e3e 100644
--- a/tools/assistant/tools/assistant/helpviewer_qwv.h
+++ b/tools/assistant/tools/assistant/helpviewer_qwv.h
@@ -71,8 +71,8 @@ public:
bool handleForwardBackwardMouseButtons(QMouseEvent *e);
+ QUrl source() const;
void setSource(const QUrl &url);
- inline QUrl source() const { return url(); }
inline QString documentTitle() const
{ return title(); }
@@ -109,6 +109,7 @@ protected:
private Q_SLOTS:
void actionChanged();
+ void setLoadStarted();
void setLoadFinished(bool ok);
private:
--
cgit v0.12
From 73fa311f67b21c9b897de0196d3b8227f27d828f Mon Sep 17 00:00:00 2001
From: Jocelyn Turcotte
Date: Tue, 15 Jun 2010 14:44:17 +0200
Subject: qmake: Fix CONFIG += exceptions_off with the MSVC project generator.
cl.exe default exception handling (when not specified on the command
line) is to disable exceptions. In vcproj files however, if the
ExceptionHandling option is not specified, the default behavior is to
enable exceptions without SEH (/EHsh).
This patch makes sure that ExceptionHandling is disabled when /EHsc is
not fed to parseOption (which happens when the exceptions_off config
is encountered).
For VS2003 the values are a bit different where "false"==ehNone,
"true"==ehNoSEH and ehSEH is not available. The default is "true"
if not specified thus why we set it to "false" when exceptions_off
is given.
Reviewed-by: Oswald Buddenhagen
---
qmake/generators/win32/msbuild_objectmodel.cpp | 1 +
qmake/generators/win32/msvc_objectmodel.cpp | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index 75fc910..bf874b2 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -385,6 +385,7 @@ VCXCLCompilerTool::VCXCLCompilerTool()
DisableLanguageExtensions(unset),
EnableFiberSafeOptimizations(unset),
EnablePREfast(unset),
+ ExceptionHandling("false"),
ExpandAttributedSource(unset),
FloatingPointExceptions(unset),
ForceConformanceInForLoopScope(unset),
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 1e060a0..e23e119 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -360,8 +360,11 @@ inline XmlOutput::xml_output xformUsePrecompiledHeaderForNET2005(pchOption whatP
inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh, DotNET compilerVersion)
{
- if (eh == ehDefault)
- return noxml();
+ if (eh == ehDefault) {
+ if (compilerVersion >= NET2005)
+ return attrE(_ExceptionHandling, ehNone);
+ return attrS(_ExceptionHandling, "false");
+ }
if (compilerVersion >= NET2005)
return attrE(_ExceptionHandling, eh);
--
cgit v0.12
From 7e08ce215763475c5933d2f035687e5db3d5295d Mon Sep 17 00:00:00 2001
From: Kent Hansen
Date: Wed, 16 Jun 2010 14:14:06 +0200
Subject: Updated JavaScriptCore from
/home/khansen/dev/qtwebkit-qtscript-integration to
javascriptcore-snapshot-16062010 ( 8b2d3443afca194f8ac50a63151dc9d19a150582 )
Integrated changes:
|| || JSC's currentThreadStackBase is not reentrant on some platforms
---
src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog | 17 +++++++++++++++++
.../JavaScriptCore/runtime/Collector.cpp | 18 ++++++++++--------
src/3rdparty/javascriptcore/VERSION | 4 ++--
3 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
index fd6125f..b0873ab 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
@@ -12,6 +12,23 @@
* wtf/Platform.h:
+2010-04-28 Simon Hausmann , Kent Hansen
+
+ Reviewed by Darin Adler.
+
+ JSC's currentThreadStackBase is not reentrant on some platforms
+ https://bugs.webkit.org/show_bug.cgi?id=37195
+
+ This function needs to be reentrant to avoid memory corruption on platforms where
+ the implementation uses global variables.
+
+ This patch adds a mutex lock where necessary and makes the Symbian implementation
+ reentrant.
+
+ * runtime/Collector.cpp:
+ (JSC::currentThreadStackBaseMutex):
+ (JSC::currentThreadStackBase):
+
2010-04-14 Kent Hansen
Reviewed by Maciej Stachowiak.
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
index 57f2a92..eafcc23 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
@@ -637,6 +637,8 @@ static inline void* currentThreadStackBase()
#elif OS(HPUX)
return hpux_get_stack_base();
#elif OS(QNX)
+ AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
+ MutexLocker locker(mutex);
return currentThreadStackBaseQNX();
#elif OS(SOLARIS)
stack_t s;
@@ -660,19 +662,17 @@ static inline void* currentThreadStackBase()
pthread_stackseg_np(thread, &stack);
return stack.ss_sp;
#elif OS(SYMBIAN)
- static void* stackBase = 0;
- if (stackBase == 0) {
- TThreadStackInfo info;
- RThread thread;
- thread.StackInfo(info);
- stackBase = (void*)info.iBase;
- }
- return (void*)stackBase;
+ TThreadStackInfo info;
+ RThread thread;
+ thread.StackInfo(info);
+ return (void*)info.iBase;
#elif OS(HAIKU)
thread_info threadInfo;
get_thread_info(find_thread(NULL), &threadInfo);
return threadInfo.stack_end;
#elif OS(UNIX)
+ AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
+ MutexLocker locker(mutex);
static void* stackBase = 0;
static size_t stackSize = 0;
static pthread_t stackThread;
@@ -695,6 +695,8 @@ static inline void* currentThreadStackBase()
}
return static_cast(stackBase) + stackSize;
#elif OS(WINCE)
+ AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
+ MutexLocker locker(mutex);
if (g_stackBase)
return g_stackBase;
else {
diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION
index 1b5109a..daecc37 100644
--- a/src/3rdparty/javascriptcore/VERSION
+++ b/src/3rdparty/javascriptcore/VERSION
@@ -4,8 +4,8 @@ This is a snapshot of JavaScriptCore from
The commit imported was from the
- javascriptcore-snapshot-19052010 branch/tag
+ javascriptcore-snapshot-16062010 branch/tag
and has the sha1 checksum
- 8039ba79702d6516cf6841c9f15b324ec499bbf3
+ 8b2d3443afca194f8ac50a63151dc9d19a150582
--
cgit v0.12
From 47d3d5569e25d0e88259e1f0448d87325da0ab6a Mon Sep 17 00:00:00 2001
From: Thomas Zander
Date: Wed, 16 Jun 2010 13:54:56 +0200
Subject: Make sure only started gestures can cause cancellations
The design is that calling setGestureCancelPolicy on the gesture
that is in starting state, and is accepted can cause other gestures
to be cancelled.
So change the logic to follow this, which means we won't try to execute
the cancel strategy if the gesture was never accepted and avoid the
crash detailed in the task.
Reviewed-by: Denis
Task-number: QTBUG-9771
---
src/gui/graphicsview/qgraphicsscene.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 6c5623e..ca3b56f 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -6277,7 +6277,8 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original)
{
Q_ASSERT(original);
QGraphicsItem *originalItem = gestureTargets.value(original);
- Q_ASSERT(originalItem);
+ if (originalItem == 0) // we only act on accepted gestures, which implies it has a target.
+ return;
// iterate over all active gestures and for each find the owner
// if the owner is part of our sub-hierarchy, cancel it.
--
cgit v0.12
From 3d03e0a1fdd04e1ab97ba0f95a3a934c879d047e Mon Sep 17 00:00:00 2001
From: Andreas Kling
Date: Wed, 16 Jun 2010 05:00:47 +0200
Subject: Defer allocation of GIF decoding tables/stack.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
WebKit creates many image readers but will only retrieve the dimensions
until the image itself is actually needed (i.e appears in the viewport.)
This avoids allocating 16kB per GIF image until it's time to actually
decode it.
Reviewed-by: Samuel Rødal
---
src/plugins/imageformats/gif/qgifhandler.cpp | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index 5e2157e..58093aa 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -132,8 +132,8 @@ private:
int code_size, clear_code, end_code, max_code_size, max_code;
int firstcode, oldcode, incode;
- short table[2][1<< max_lzw_bits];
- short stack[(1<<(max_lzw_bits))*2];
+ short* table[2];
+ short* stack;
short *sp;
bool needfirst;
int x, y;
@@ -162,6 +162,9 @@ QGIFFormat::QGIFFormat()
lcmap = false;
newFrame = false;
partialNewFrame = false;
+ table[0] = 0;
+ table[1] = 0;
+ stack = 0;
}
/*!
@@ -171,6 +174,7 @@ QGIFFormat::~QGIFFormat()
{
if (globalcmap) delete[] globalcmap;
if (localcmap) delete[] localcmap;
+ delete [] stack;
}
void QGIFFormat::disposePrevious(QImage *image)
@@ -237,6 +241,12 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
// CompuServe Incorporated. GIF(sm) is a Service Mark property of
// CompuServe Incorporated."
+ if (!stack) {
+ stack = new short[(1 << max_lzw_bits) * 4];
+ table[0] = &stack[(1 << max_lzw_bits) * 2];
+ table[1] = &stack[(1 << max_lzw_bits) * 3];
+ }
+
image->detach();
int bpl = image->bytesPerLine();
unsigned char *bits = image->bits();
--
cgit v0.12
From 00e3c4d7dcb5f14e9d13200a1e5d041d266f6610 Mon Sep 17 00:00:00 2001
From: Martin Smith
Date: Wed, 16 Jun 2010 14:49:07 +0200
Subject: doc: Added more DITA output to the XML generator
Some of the cxxFunction stuff for member functions.
Task-number: QTBUG-11391
---
tools/qdoc3/ditaxmlgenerator.cpp | 135 +++++++++++++++++++++++++++++++++++----
tools/qdoc3/ditaxmlgenerator.h | 20 +++++-
tools/qdoc3/node.cpp | 14 ++++
tools/qdoc3/node.h | 7 +-
4 files changed, 160 insertions(+), 16 deletions(-)
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index 197bc13..ebca881 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -501,19 +501,18 @@ QString DitaXmlGenerator::format()
}
/*!
- Create a new GUID, write it to the XML stream
- as an "id" attribute, and return it.
+ Calls lookupGuid() to get a GUID for \a text, then writes
+ it to the XML stream as an "id" attribute, and returns it.
*/
QString DitaXmlGenerator::writeGuidAttribute(QString text)
{
- QString guid = QUuid::createUuid().toString();
- name2guidMap.insert(text,guid);
+ QString guid = lookupGuid(text);
writer.writeAttribute("id",guid);
return guid;
}
/*!
- Looks up \a text in the GUID map. It it finds \a text,
+ Looks up \a text in the GUID map. If it finds \a text,
it returns the associated GUID. Otherwise it inserts
\a text into the map with a new GUID, and it returns
the new GUID.
@@ -1436,6 +1435,12 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
writer.writeStartElement(CXXCLASSACCESSSPECIFIER);
writer.writeAttribute("value",inner->accessString());
writer.writeEndElement(); //
+ if (cn->isAbstract()) {
+ writer.writeStartElement(CXXCLASSABSTRACT);
+ writer.writeAttribute("name","abstract");
+ writer.writeAttribute("value","abstract");
+ writer.writeEndElement(); //
+ }
writeDerivations(cn, marker);
writeLocation(cn, marker);
writer.writeEndElement(); //
@@ -1452,6 +1457,26 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
writer.writeEndElement(); //
writer.writeEndElement(); //
+
+ sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay);
+ s = sections.begin();
+ while (s != sections.end()) {
+ if ((*s).name == "Member Function Documentation") {
+ writeFunctions((*s),cn,marker);
+ }
+ else if ((*s).name == "Member Type Documentation") {
+ writeNestedClasses((*s),cn,marker);
+ writeEnumerations((*s),cn,marker);
+ writeTypedefs((*s),cn,marker);
+ }
+ else if ((*s).name == "Member Variable Documentation") {
+ writeDataMembers((*s),cn,marker);
+ }
+ else if ((*s).name == "Property Documentation") {
+ writeProperties((*s),cn,marker);
+ }
+ ++s;
+ }
writer.writeEndElement(); //
}
@@ -4502,19 +4527,101 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker)
}
}
-void DitaXmlGenerator::writeLocation(const ClassNode* cn, CodeMarker* marker)
+void DitaXmlGenerator::writeLocation(const Node* n, CodeMarker* marker)
{
- writer.writeStartElement(CXXCLASSAPIITEMLOCATION);
- writer.writeStartElement(CXXCLASSDECLARATIONFILE);
+ QString s1, s2, s3;
+ if (n->type() == Node::Class) {
+ s1 = CXXCLASSAPIITEMLOCATION;
+ s2 = CXXCLASSDECLARATIONFILE;
+ s3 = CXXCLASSDECLARATIONFILELINE;
+ }
+ else if (n->type() == Node::Function) {
+ s1 = CXXFUNCTIONAPIITEMLOCATION;
+ s2 = CXXFUNCTIONDECLARATIONFILE;
+ s3 = CXXFUNCTIONDECLARATIONFILELINE;
+ }
+ writer.writeStartElement(s1);
+ writer.writeStartElement(s2);
writer.writeAttribute("name","filePath");
- writer.writeAttribute("value",cn->location().filePath());
- writer.writeEndElement(); //
- writer.writeStartElement(CXXCLASSDECLARATIONFILELINE);
+ writer.writeAttribute("value",n->location().filePath());
+ writer.writeEndElement(); // DeclarationFile>
+ writer.writeStartElement(s3);
writer.writeAttribute("name","lineNumber");
QString lineNr;
- writer.writeAttribute("value",lineNr.setNum(cn->location().lineNo()));
- writer.writeEndElement(); //
- writer.writeEndElement(); //
+ writer.writeAttribute("value",lineNr.setNum(n->location().lineNo()));
+ writer.writeEndElement(); // DeclarationFileLine>
+ writer.writeEndElement(); // ApiItemLocation>
+}
+
+void DitaXmlGenerator::writeFunctions(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker) {
+ NodeList::ConstIterator m = s.members.begin();
+ while (m != s.members.end()) {
+ if ((*m)->type() == Node::Function) {
+ const FunctionNode* fn = reinterpret_cast(*m);
+ QString name = fn->name();
+ writer.writeStartElement(CXXFUNCTION);
+ writeGuidAttribute(name);
+ writer.writeStartElement(APINAME);
+ writer.writeCharacters(name);
+ writer.writeEndElement(); //
+ generateBrief(fn,marker);
+ writer.writeStartElement(CXXFUNCTIONDETAIL);
+ writer.writeStartElement(CXXFUNCTIONDEFINITION);
+ writer.writeStartElement(CXXFUNCTIONACCESSSPECIFIER);
+ writer.writeAttribute("value",fn->accessString());
+ writer.writeEndElement(); //
+
+ writeLocation(fn, marker);
+ writer.writeEndElement(); //
+ writer.writeStartElement(APIDESC);
+
+ if (!fn->doc().isEmpty()) {
+ writer.writeStartElement("p");
+ writer.writeAttribute("outputclass","h2");
+ writer.writeCharacters("Function Description");
+ writer.writeEndElement(); //
+ generateBody(fn, marker);
+ // generateAlsoList(inner, marker);
+ }
+
+ writer.writeEndElement(); //
+ writer.writeEndElement(); //
+ writer.writeEndElement(); //
+
+ if (fn->metaness() == FunctionNode::Ctor ||
+ fn->metaness() == FunctionNode::Dtor ||
+ fn->overloadNumber() != 1) {
+ }
+ }
+ ++m;
+ }
+}
+
+void DitaXmlGenerator::writeNestedClasses(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker) {
+}
+
+void DitaXmlGenerator::writeEnumerations(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker) {
+}
+
+void DitaXmlGenerator::writeTypedefs(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker) {
+}
+
+void DitaXmlGenerator::writeDataMembers(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker) {
+}
+
+void DitaXmlGenerator::writeProperties(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker) {
}
QT_END_NAMESPACE
diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h
index 070329b..5afd82a 100644
--- a/tools/qdoc3/ditaxmlgenerator.h
+++ b/tools/qdoc3/ditaxmlgenerator.h
@@ -111,7 +111,25 @@ class DitaXmlGenerator : public PageGenerator
virtual QString refForAtom(Atom *atom, const Node *node);
void writeDerivations(const ClassNode* cn, CodeMarker* marker);
- void writeLocation(const ClassNode* cn, CodeMarker* marker);
+ void writeLocation(const Node* n, CodeMarker* marker);
+ void writeFunctions(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
+ void writeNestedClasses(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
+ void writeEnumerations(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
+ void writeTypedefs(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
+ void writeDataMembers(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
+ void writeProperties(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker);
private:
enum SubTitleSize { SmallSubTitle, LargeSubTitle };
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 4664e9d..b71a43e 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -789,6 +789,7 @@ ClassNode::ClassNode(InnerNode *parent, const QString& name)
: InnerNode(Class, parent, name)
{
hidden = false;
+ abstract = false;
setPageType(ApiPage);
}
@@ -1078,6 +1079,19 @@ FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bo
}
/*!
+ Sets the \a virtualness of this function. If the \a virtualness
+ is PureVirtual, and if the parent() is a ClassNode, set the parent's
+ \e abstract flag to true.
+ */
+void FunctionNode::setVirtualness(Virtualness virtualness)
+{
+ vir = virtualness;
+ if ((virtualness == PureVirtual) && parent() &&
+ (parent()->type() == Node::Class))
+ parent()->setAbstract(true);
+}
+
+/*!
*/
void FunctionNode::setOverload(bool overlode)
{
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 523394d..ccfd9b6 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -261,6 +261,8 @@ class InnerNode : public Node
QStringList secondaryKeys();
const QStringList& pageKeywords() const { return pageKeywds; }
virtual void addPageKeywords(const QString& t) { pageKeywds << t; }
+ virtual bool isAbstract() const { return false; }
+ virtual void setAbstract(bool ) { }
protected:
InnerNode(Type type, InnerNode *parent, const QString& name);
@@ -341,11 +343,14 @@ class ClassNode : public InnerNode
void setServiceName(const QString& value) { sname = value; }
QString qmlElement() const { return qmlelement; }
void setQmlElement(const QString& value) { qmlelement = value; }
+ virtual bool isAbstract() const { return abstract; }
+ virtual void setAbstract(bool b) { abstract = b; }
private:
QList bas;
QList der;
bool hidden;
+ bool abstract;
QString sname;
QString qmlelement;
};
@@ -582,7 +587,7 @@ class FunctionNode : public LeafNode
void setReturnType(const QString& returnType) { rt = returnType; }
void setParentPath(const QStringList& parentPath) { pp = parentPath; }
void setMetaness(Metaness metaness) { met = metaness; }
- void setVirtualness(Virtualness virtualness) { vir = virtualness; }
+ void setVirtualness(Virtualness virtualness);
void setConst(bool conste) { con = conste; }
void setStatic(bool statique) { sta = statique; }
void setOverload(bool overlode);
--
cgit v0.12
From 6dffaee6ab0bbeddd9e0cb16ff4545c3cb09bfe9 Mon Sep 17 00:00:00 2001
From: Benjamin Poulain
Date: Thu, 17 Jun 2010 01:17:55 +0200
Subject: Allocate the memory for QtFontSize when count > 1
This fix a regression introduced by
71ba2b0973d291e991e1498c266e69d6640c8531.
In the case count >= 1 && count < 8, no memory is allocated.
Reviewed-by: Andreas Kling
---
src/gui/text/qfontdatabase.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 4c058ce..139139f 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -289,7 +289,7 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add)
QtFontSize *newPixelSizes = (QtFontSize *)malloc(sizeof(QtFontSize));
Q_CHECK_PTR(newPixelSizes);
pixelSizes = newPixelSizes;
- } else if (!(count % 8)) {
+ } else if (!(count % 8) || count == 1) {
QtFontSize *newPixelSizes = (QtFontSize *)
realloc(pixelSizes,
(((count+8) >> 3) << 3) * sizeof(QtFontSize));
--
cgit v0.12
From b768d155c5b40c66f7b83ca5e52ad6dda78c2fe8 Mon Sep 17 00:00:00 2001
From: Andreas Kling
Date: Thu, 17 Jun 2010 00:17:32 +0200
Subject: Implement QIODevice::peek() using read() + ungetBlock().
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The previous implementation was doing ungetChar() in a loop.
Task-number: QTBUG-9654
Reviewed-by: João Abecasis
Reviewed-by: mread
---
src/corelib/io/qiodevice.cpp | 21 ++++++++++++++-------
src/corelib/io/qiodevice_p.h | 9 +++++++++
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 223df9b..d2e4f75 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1476,10 +1476,13 @@ bool QIODevice::getChar(char *c)
*/
qint64 QIODevice::peek(char *data, qint64 maxSize)
{
+ Q_D(QIODevice);
qint64 readBytes = read(data, maxSize);
- int i = readBytes;
- while (i > 0)
- ungetChar(data[i-- - 1]);
+ if (readBytes <= 0)
+ return readBytes;
+
+ d->buffer.ungetBlock(data, readBytes);
+ d->pos -= readBytes;
return readBytes;
}
@@ -1502,11 +1505,15 @@ qint64 QIODevice::peek(char *data, qint64 maxSize)
*/
QByteArray QIODevice::peek(qint64 maxSize)
{
+ Q_D(QIODevice);
QByteArray result = read(maxSize);
- int i = result.size();
- const char *data = result.constData();
- while (i > 0)
- ungetChar(data[i-- - 1]);
+
+ if (result.isEmpty())
+ return result;
+
+ d->buffer.ungetBlock(result.constData(), result.size());
+ d->pos -= result.size();
+
return result;
}
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index 94dadca..225a0b9 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -151,6 +151,15 @@ public:
len++;
*first = c;
}
+ void ungetBlock(const char* block, int size) {
+ if ((first - buf) < size) {
+ // underflow, the existing valid data needs to move to the end of the (potentially bigger) buffer
+ makeSpace(len + size, freeSpaceAtStart);
+ memcpy(first - size, block, size);
+ }
+ first -= size;
+ len += size;
+ }
private:
enum FreeSpacePos {freeSpaceAtStart, freeSpaceAtEnd};
--
cgit v0.12
From 458a18284406dedcf0628c651fb3511553dbcb58 Mon Sep 17 00:00:00 2001
From: Peter Hartmann
Date: Thu, 17 Jun 2010 09:55:45 +0200
Subject: document QSslSocket::systemCaCertificates() change in changelog
Reviewed-by: Zeno Albisser
---
dist/changes-4.7.0 | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0
index 95cff56..c19bf15 100644
--- a/dist/changes-4.7.0
+++ b/dist/changes-4.7.0
@@ -377,3 +377,9 @@ QtCore:
ABIs, but it also allowed for unaligned access. Qt never generates
or uses unaligned access and the new EABI aligns as expected, so
the flag was removed.
+
+QtNetwork:
+ - Qt does no longer provide its own CA bundle, but uses system APIs for
+ retrieving the default system certificates. On Symbian,
+ QSslSocket::systemCaCertificates() provides an empty list of
+ certificates.
--
cgit v0.12
From d8d547b92e02546cb030ac9d4a45fe0d89e0e7f6 Mon Sep 17 00:00:00 2001
From: Kent Hansen
Date: Thu, 17 Jun 2010 12:27:43 +0200
Subject: Usefully convert from QtScript object/array to QVariant
For arrays, the conversion would crash if the array was cyclic.
Introduce a set that keeps track of which objects are being
converted, and return an empty list when a cycle is detected.
For other types of objects, the object was previously attempted
to be converted to a primitive, which typically meant you would
get the string representation ("[object Object]"), since most
(practically all) objects can be converted to a string -- not
useful at all.
Change the conversion so it converts the object to a QVariantMap
instead. This was already done for slots that took a QVariantMap
as argument, but only one level deep. Make the conversion recursive,
using the same mechanism as for arrays to detect cycles.
This change also means that you get a meaningful
JS object => QVariant => JS object roundtrip.
It also aligns the behavior with the Qt WebKit bridge.
Update the documentation to describe the new behavior.
The 4.7 changelog will also be updated under "important behavioral
changes".
This change exposed an issue with one of the QML autotests: A JS
object was assigned to a QVariant property, which caused it to be
converted to a string (rather than a QVariantMap) -- just shows
that the previous behavior was unintuitive). Later, this variant
property is compared to another object, the intention being to
compare the _properties_ of the two objects; but because the variant
property contained a string, this would cause the other operand
(object) to be converted to a string as well ("[object Object]"),
causing a meaningless test pass.
Change the test to deserialize both objects using JSON.stringify,
and compare the resulting strings, so that actual
JS object => QVariant(Map) => JS object roundtrip is tested (the
intention).
Task-number: QTBUG-3511
Reviewed-by: Olivier Goffart
---
src/script/api/qscriptengine.cpp | 30 +++--
src/script/api/qscriptengine_p.h | 6 +-
src/script/api/qscriptvalue.cpp | 4 +-
.../qdeclarativeworkerscript/data/BaseWorker.qml | 2 +-
.../tst_qdeclarativeworkerscript.cpp | 6 +-
.../qscriptextqobject/tst_qscriptextqobject.cpp | 140 +++++++++++++++++++++
tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 89 ++++++++++++-
tests/auto/qscriptvalue/tst_qscriptvalue.h | 2 +
8 files changed, 257 insertions(+), 22 deletions(-)
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index f02ea52..e2999c1 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -1011,12 +1011,17 @@ JSC::JSValue QScriptEnginePrivate::arrayFromVariantList(JSC::ExecState *exec, co
return arr;
}
-QVariantList QScriptEnginePrivate::variantListFromArray(JSC::ExecState *exec, JSC::JSValue arr)
+QVariantList QScriptEnginePrivate::variantListFromArray(JSC::ExecState *exec, JSC::JSArray *arr)
{
+ QScriptEnginePrivate *eng = QScript::scriptEngineFromExec(exec);
+ if (eng->visitedConversionObjects.contains(arr))
+ return QVariantList(); // Avoid recursion.
+ eng->visitedConversionObjects.insert(arr);
QVariantList lst;
uint len = toUInt32(exec, property(exec, arr, exec->propertyNames().length));
for (uint i = 0; i < len; ++i)
lst.append(toVariant(exec, property(exec, arr, i)));
+ eng->visitedConversionObjects.remove(arr);
return lst;
}
@@ -1029,14 +1034,19 @@ JSC::JSValue QScriptEnginePrivate::objectFromVariantMap(JSC::ExecState *exec, co
return obj;
}
-QVariantMap QScriptEnginePrivate::variantMapFromObject(JSC::ExecState *exec, JSC::JSValue obj)
+QVariantMap QScriptEnginePrivate::variantMapFromObject(JSC::ExecState *exec, JSC::JSObject *obj)
{
+ QScriptEnginePrivate *eng = QScript::scriptEngineFromExec(exec);
+ if (eng->visitedConversionObjects.contains(obj))
+ return QVariantMap(); // Avoid recursion.
+ eng->visitedConversionObjects.insert(obj);
JSC::PropertyNameArray propertyNames(exec);
- JSC::asObject(obj)->getOwnPropertyNames(exec, propertyNames, JSC::IncludeDontEnumProperties);
+ obj->getOwnPropertyNames(exec, propertyNames, JSC::IncludeDontEnumProperties);
QVariantMap vmap;
JSC::PropertyNameArray::const_iterator it = propertyNames.begin();
for( ; it != propertyNames.end(); ++it)
vmap.insert(it->ustring(), toVariant(exec, property(exec, obj, *it)));
+ eng->visitedConversionObjects.remove(obj);
return vmap;
}
@@ -1661,16 +1671,10 @@ QVariant QScriptEnginePrivate::toVariant(JSC::ExecState *exec, JSC::JSValue valu
return QVariant(toRegExp(exec, value));
#endif
else if (isArray(value))
- return variantListFromArray(exec, value);
+ return variantListFromArray(exec, JSC::asArray(value));
else if (QScriptDeclarativeClass *dc = declarativeClass(value))
return dc->toVariant(declarativeObject(value));
- // try to convert to primitive
- JSC::JSValue savedException;
- saveException(exec, &savedException);
- JSC::JSValue prim = value.toPrimitive(exec);
- restoreException(exec, savedException);
- if (!prim.isObject())
- return toVariant(exec, prim);
+ return variantMapFromObject(exec, JSC::asObject(value));
} else if (value.isNumber()) {
return QVariant(toNumber(exec, value));
} else if (value.isString()) {
@@ -3129,12 +3133,12 @@ bool QScriptEnginePrivate::convertValue(JSC::ExecState *exec, JSC::JSValue value
} break;
case QMetaType::QVariantList:
if (isArray(value)) {
- *reinterpret_cast(ptr) = variantListFromArray(exec, value);
+ *reinterpret_cast(ptr) = variantListFromArray(exec, JSC::asArray(value));
return true;
} break;
case QMetaType::QVariantMap:
if (isObject(value)) {
- *reinterpret_cast(ptr) = variantMapFromObject(exec, value);
+ *reinterpret_cast(ptr) = variantMapFromObject(exec, JSC::asObject(value));
return true;
} break;
case QMetaType::QVariant:
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index fd47208..56366e2 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -215,10 +215,10 @@ public:
static QStringList stringListFromArray(JSC::ExecState*, JSC::JSValue arr);
static JSC::JSValue arrayFromVariantList(JSC::ExecState*, const QVariantList &lst);
- static QVariantList variantListFromArray(JSC::ExecState*, JSC::JSValue arr);
+ static QVariantList variantListFromArray(JSC::ExecState*, JSC::JSArray *arr);
static JSC::JSValue objectFromVariantMap(JSC::ExecState*, const QVariantMap &vmap);
- static QVariantMap variantMapFromObject(JSC::ExecState*, JSC::JSValue obj);
+ static QVariantMap variantMapFromObject(JSC::ExecState*, JSC::JSObject *obj);
JSC::JSValue defaultPrototype(int metaTypeId) const;
void setDefaultPrototype(int metaTypeId, JSC::JSValue prototype);
@@ -378,6 +378,8 @@ public:
QHash loadedScripts;
QScriptValue m_currentException;
+ QSet visitedConversionObjects;
+
#ifndef QT_NO_QOBJECT
QHash m_qobjectData;
#endif
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 1310c8c..451d1b0 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -1215,8 +1215,8 @@ qsreal QScriptValue::toInteger() const
\row \o QObject Object \o A QVariant containing a pointer to the QObject.
\row \o Date Object \o A QVariant containing the date value (toDateTime()).
\row \o RegExp Object \o A QVariant containing the regular expression value (toRegExp()).
- \row \o Array Object \o The array is converted to a QVariantList.
- \row \o Object \o If the value is primitive, then the result is converted to a QVariant according to the above rules; otherwise, an invalid QVariant is returned.
+ \row \o Array Object \o The array is converted to a QVariantList. Each element is converted to a QVariant, recursively; cyclic references are not followed.
+ \row \o Object \o The object is converted to a QVariantMap. Each property is converted to a QVariant, recursively; cyclic references are not followed.
\endtable
\sa isVariant()
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml
index d275ca8..e06afa2 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml
@@ -13,7 +13,7 @@ WorkerScript {
function compareLiteralResponse(expected) {
var e = eval('(' + expected + ')')
- return worker.response == e
+ return JSON.stringify(worker.response) == JSON.stringify(e)
}
onMessage: {
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index 52c11e9..8e98874 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -170,13 +170,15 @@ void tst_QDeclarativeWorkerScript::messaging_sendJsObject()
QDeclarativeWorkerScript *worker = qobject_cast(component.create());
QVERIFY(worker != 0);
- QString jsObject = "{'name': 'zyz', 'spell power': 3101, 'haste': 1125}";
+ // Properties are in alphabetical order to enable string-based comparison after
+ // QVariant roundtrip, since the properties will be stored in a QVariantMap.
+ QString jsObject = "{'haste': 1125, 'name': 'zyz', 'spell power': 3101}";
QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(worker));
QScriptValue sv = engine->newObject();
+ sv.setProperty("haste", 1125);
sv.setProperty("name", "zyz");
sv.setProperty("spell power", 3101);
- sv.setProperty("haste", 1125);
QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, qVariantFromValue(sv))));
waitForEchoMessage(worker);
diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
index 09070e6..11813d8 100644
--- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
+++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
@@ -287,6 +287,8 @@ public:
{ m_qtFunctionInvoked = 15; m_actuals << v; return v; }
Q_INVOKABLE QVariantMap myInvokableWithVariantMapArg(const QVariantMap &vm)
{ m_qtFunctionInvoked = 16; m_actuals << vm; return vm; }
+ Q_INVOKABLE QVariantList myInvokableWithVariantListArg(const QVariantList &lst)
+ { m_qtFunctionInvoked = 62; m_actuals.append(QVariant(lst)); return lst; }
Q_INVOKABLE QList myInvokableWithListOfIntArg(const QList &lst)
{ m_qtFunctionInvoked = 17; m_actuals << qVariantFromValue(lst); return lst; }
Q_INVOKABLE QObject* myInvokableWithQObjectStarArg(QObject *obj)
@@ -535,6 +537,10 @@ private slots:
void emitAfterReceiverDeleted();
void inheritedSlots();
void enumerateMetaObject();
+ void nestedArrayAsSlotArgument_data();
+ void nestedArrayAsSlotArgument();
+ void nestedObjectAsSlotArgument_data();
+ void nestedObjectAsSlotArgument();
private:
QScriptEngine *m_engine;
@@ -3164,5 +3170,139 @@ void tst_QScriptExtQObject::enumerateMetaObject()
}
}
+void tst_QScriptExtQObject::nestedArrayAsSlotArgument_data()
+{
+ QTest::addColumn("program");
+ QTest::addColumn("expected");
+
+ QTest::newRow("[[]]")
+ << QString::fromLatin1("[[]]")
+ << (QVariantList() << (QVariant(QVariantList())));
+ QTest::newRow("[[123]]")
+ << QString::fromLatin1("[[123]]")
+ << (QVariantList() << (QVariant(QVariantList() << 123)));
+ QTest::newRow("[[], 123]")
+ << QString::fromLatin1("[[], 123]")
+ << (QVariantList() << QVariant(QVariantList()) << 123);
+
+ // Cyclic
+ QTest::newRow("var a=[]; a.push(a)")
+ << QString::fromLatin1("var a=[]; a.push(a); a")
+ << (QVariantList() << QVariant(QVariantList()));
+ QTest::newRow("var a=[]; a.push(123, a)")
+ << QString::fromLatin1("var a=[]; a.push(123, a); a")
+ << (QVariantList() << 123 << QVariant(QVariantList()));
+ QTest::newRow("var a=[]; var b=[]; a.push(b); b.push(a)")
+ << QString::fromLatin1("var a=[]; var b=[]; a.push(b); b.push(a); a")
+ << (QVariantList() << QVariant(QVariantList() << QVariant(QVariantList())));
+ QTest::newRow("var a=[]; var b=[]; a.push(123, b); b.push(456, a)")
+ << QString::fromLatin1("var a=[]; var b=[]; a.push(123, b); b.push(456, a); a")
+ << (QVariantList() << 123 << QVariant(QVariantList() << 456 << QVariant(QVariantList())));
+}
+
+void tst_QScriptExtQObject::nestedArrayAsSlotArgument()
+{
+ QFETCH(QString, program);
+ QFETCH(QVariantList, expected);
+ QScriptValue a = m_engine->evaluate(program);
+ QVERIFY(!a.isError());
+ QVERIFY(a.isArray());
+ // Slot that takes QVariantList
+ {
+ QVERIFY(!m_engine->evaluate("myObject.myInvokableWithVariantListArg")
+ .call(QScriptValue(), QScriptValueList() << a).isError());
+ QCOMPARE(m_myObject->qtFunctionInvoked(), 62);
+ QCOMPARE(m_myObject->qtFunctionActuals().size(), 1);
+ QCOMPARE(m_myObject->qtFunctionActuals().at(0).type(), QVariant::List);
+ QCOMPARE(m_myObject->qtFunctionActuals().at(0).toList(), expected);
+ }
+ // Slot that takes QVariant
+ {
+ m_myObject->resetQtFunctionInvoked();
+ QVERIFY(!m_engine->evaluate("myObject.myInvokableWithVariantArg")
+ .call(QScriptValue(), QScriptValueList() << a).isError());
+ QCOMPARE(m_myObject->qtFunctionInvoked(), 15);
+ QCOMPARE(m_myObject->qtFunctionActuals().size(), 1);
+ QCOMPARE(m_myObject->qtFunctionActuals().at(0).type(), QVariant::List);
+ QCOMPARE(m_myObject->qtFunctionActuals().at(0).toList(), expected);
+ }
+}
+
+void tst_QScriptExtQObject::nestedObjectAsSlotArgument_data()
+{
+ QTest::addColumn("program");
+ QTest::addColumn("expected");
+
+ {
+ QVariantMap m;
+ m["a"] = QVariantMap();
+ QTest::newRow("{ a:{} }")
+ << QString::fromLatin1("({ a:{} })")
+ << m;
+ }
+ {
+ QVariantMap m, m2;
+ m2["b"] = 10;
+ m2["c"] = 20;
+ m["a"] = m2;
+ QTest::newRow("{ a:{b:10, c:20} }")
+ << QString::fromLatin1("({ a:{b:10, c:20} })")
+ << m;
+ }
+ {
+ QVariantMap m;
+ m["a"] = 10;
+ m["b"] = QVariantList() << 20 << 30;
+ QTest::newRow("{ a:10, b:[20, 30]}")
+ << QString::fromLatin1("({ a:10, b:[20,30]})")
+ << m;
+ }
+
+ // Cyclic
+ {
+ QVariantMap m;
+ m["p"] = QVariantMap();
+ QTest::newRow("var o={}; o.p=o")
+ << QString::fromLatin1("var o={}; o.p=o; o")
+ << m;
+ }
+ {
+ QVariantMap m;
+ m["p"] = 123;
+ m["q"] = QVariantMap();
+ QTest::newRow("var o={}; o.p=123; o.q=o")
+ << QString::fromLatin1("var o={}; o.p=123; o.q=o; o")
+ << m;
+ }
+}
+
+void tst_QScriptExtQObject::nestedObjectAsSlotArgument()
+{
+ QFETCH(QString, program);
+ QFETCH(QVariantMap, expected);
+ QScriptValue o = m_engine->evaluate(program);
+ QVERIFY(!o.isError());
+ QVERIFY(o.isObject());
+ // Slot that takes QVariantMap
+ {
+ QVERIFY(!m_engine->evaluate("myObject.myInvokableWithVariantMapArg")
+ .call(QScriptValue(), QScriptValueList() << o).isError());
+ QCOMPARE(m_myObject->qtFunctionInvoked(), 16);
+ QCOMPARE(m_myObject->qtFunctionActuals().size(), 1);
+ QCOMPARE(m_myObject->qtFunctionActuals().at(0).type(), QVariant::Map);
+ QCOMPARE(m_myObject->qtFunctionActuals().at(0).toMap(), expected);
+ }
+ // Slot that takes QVariant
+ {
+ m_myObject->resetQtFunctionInvoked();
+ QVERIFY(!m_engine->evaluate("myObject.myInvokableWithVariantArg")
+ .call(QScriptValue(), QScriptValueList() << o).isError());
+ QCOMPARE(m_myObject->qtFunctionInvoked(), 15);
+ QCOMPARE(m_myObject->qtFunctionActuals().size(), 1);
+ QCOMPARE(m_myObject->qtFunctionActuals().at(0).type(), QVariant::Map);
+ QCOMPARE(m_myObject->qtFunctionActuals().at(0).toMap(), expected);
+ }
+}
+
QTEST_MAIN(tst_QScriptExtQObject)
#include "tst_qscriptextqobject.moc"
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index aa9fa15..8aa4e711 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -1270,7 +1270,7 @@ void tst_QScriptValue::toVariant_old()
QCOMPARE(opaque.toVariant(), var);
QScriptValue object = eng.newObject();
- QCOMPARE(object.toVariant(), QVariant(QString("[object Object]")));
+ QCOMPARE(object.toVariant(), QVariant(QVariantMap()));
QScriptValue qobject = eng.newQObject(this);
{
@@ -2296,7 +2296,7 @@ void tst_QScriptValue::getSetScriptClass()
QCOMPARE(obj.scriptClass(), (QScriptClass*)&testClass);
QVERIFY(obj.isObject());
QVERIFY(!obj.isVariant());
- QVERIFY(!obj.toVariant().isValid());
+ QCOMPARE(obj.toVariant(), QVariant(QVariantMap()));
}
{
QScriptValue obj = eng.newQObject(this);
@@ -3472,4 +3472,89 @@ void tst_QScriptValue::objectId()
QVERIFY(obj.strictlyEquals(eng.globalObject()));
}
+void tst_QScriptValue::nestedObjectToVariant_data()
+{
+ QTest::addColumn("program");
+ QTest::addColumn("expected");
+
+ // Array literals
+ QTest::newRow("[[]]")
+ << QString::fromLatin1("[[]]")
+ << QVariant(QVariantList() << (QVariant(QVariantList())));
+ QTest::newRow("[[123]]")
+ << QString::fromLatin1("[[123]]")
+ << QVariant(QVariantList() << (QVariant(QVariantList() << 123)));
+ QTest::newRow("[[], 123]")
+ << QString::fromLatin1("[[], 123]")
+ << QVariant(QVariantList() << QVariant(QVariantList()) << 123);
+
+ // Cyclic arrays
+ QTest::newRow("var a=[]; a.push(a)")
+ << QString::fromLatin1("var a=[]; a.push(a); a")
+ << QVariant(QVariantList() << QVariant(QVariantList()));
+ QTest::newRow("var a=[]; a.push(123, a)")
+ << QString::fromLatin1("var a=[]; a.push(123, a); a")
+ << QVariant(QVariantList() << 123 << QVariant(QVariantList()));
+ QTest::newRow("var a=[]; var b=[]; a.push(b); b.push(a)")
+ << QString::fromLatin1("var a=[]; var b=[]; a.push(b); b.push(a); a")
+ << QVariant(QVariantList() << QVariant(QVariantList() << QVariant(QVariantList())));
+ QTest::newRow("var a=[]; var b=[]; a.push(123, b); b.push(456, a)")
+ << QString::fromLatin1("var a=[]; var b=[]; a.push(123, b); b.push(456, a); a")
+ << QVariant(QVariantList() << 123 << QVariant(QVariantList() << 456 << QVariant(QVariantList())));
+
+ // Object literals
+ {
+ QVariantMap m;
+ m["a"] = QVariantMap();
+ QTest::newRow("{ a:{} }")
+ << QString::fromLatin1("({ a:{} })")
+ << QVariant(m);
+ }
+ {
+ QVariantMap m, m2;
+ m2["b"] = 10;
+ m2["c"] = 20;
+ m["a"] = m2;
+ QTest::newRow("{ a:{b:10, c:20} }")
+ << QString::fromLatin1("({ a:{b:10, c:20} })")
+ << QVariant(m);
+ }
+ {
+ QVariantMap m;
+ m["a"] = 10;
+ m["b"] = QVariantList() << 20 << 30;
+ QTest::newRow("{ a:10, b:[20, 30]}")
+ << QString::fromLatin1("({ a:10, b:[20,30]})")
+ << QVariant(m);
+ }
+
+ // Cyclic objects
+ {
+ QVariantMap m;
+ m["p"] = QVariantMap();
+ QTest::newRow("var o={}; o.p=o")
+ << QString::fromLatin1("var o={}; o.p=o; o")
+ << QVariant(m);
+ }
+ {
+ QVariantMap m;
+ m["p"] = 123;
+ m["q"] = QVariantMap();
+ QTest::newRow("var o={}; o.p=123; o.q=o")
+ << QString::fromLatin1("var o={}; o.p=123; o.q=o; o")
+ << QVariant(m);
+ }
+}
+
+void tst_QScriptValue::nestedObjectToVariant()
+{
+ QScriptEngine eng;
+ QFETCH(QString, program);
+ QFETCH(QVariant, expected);
+ QScriptValue o = eng.evaluate(program);
+ QVERIFY(!o.isError());
+ QVERIFY(o.isObject());
+ QCOMPARE(o.toVariant(), expected);
+}
+
QTEST_MAIN(tst_QScriptValue)
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.h b/tests/auto/qscriptvalue/tst_qscriptvalue.h
index aae35b2..8bfaa6a 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.h
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.h
@@ -225,6 +225,8 @@ private slots:
void engineDeleted();
void valueOfWithClosure();
void objectId();
+ void nestedObjectToVariant_data();
+ void nestedObjectToVariant();
private:
typedef void (tst_QScriptValue::*InitDataFunction)();
--
cgit v0.12
From 743443fe96725d7c1e5c9cce2422c2ceb9809efc Mon Sep 17 00:00:00 2001
From: Martin Smith
Date: Thu, 17 Jun 2010 15:12:23 +0200
Subject: doc: Added more DITA output to the XML generator
More cxxFunction stuff for member functions.
Task-number: QTBUG-11391
---
tools/qdoc3/ditaxmlgenerator.cpp | 114 +++++++++++++++++++++++++++++++++++----
tools/qdoc3/ditaxmlgenerator.h | 2 +
2 files changed, 105 insertions(+), 11 deletions(-)
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index ebca881..5f10885 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -4500,6 +4500,31 @@ void DitaXmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* ma
#endif
+/*!
+ Return the full qualification of the node \a n, but without
+ the name of \a n itself. e.g. A::B::C
+ */
+QString DitaXmlGenerator::fullQualification(const Node* n)
+{
+ QString fq;
+ InnerNode* in = n->parent();
+ while (in) {
+ if ((in->type() == Node::Class) ||
+ (in->type() == Node::Namespace)) {
+ if (in->name().isEmpty())
+ break;
+ if (fq.isEmpty())
+ fq = in->name();
+ else
+ fq = in->name() + "::" + fq;
+ }
+ else
+ break;
+ in = in->parent();
+ }
+ return fq;
+}
+
void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker)
{
QList::ConstIterator r;
@@ -4555,7 +4580,8 @@ void DitaXmlGenerator::writeLocation(const Node* n, CodeMarker* marker)
void DitaXmlGenerator::writeFunctions(const Section& s,
const ClassNode* cn,
- CodeMarker* marker) {
+ CodeMarker* marker)
+{
NodeList::ConstIterator m = s.members.begin();
while (m != s.members.end()) {
if ((*m)->type() == Node::Function) {
@@ -4573,19 +4599,80 @@ void DitaXmlGenerator::writeFunctions(const Section& s,
writer.writeAttribute("value",fn->accessString());
writer.writeEndElement(); //
+ if (fn->isStatic()) {
+ writer.writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC);
+ writer.writeAttribute("name","static");
+ writer.writeAttribute("value","static");
+ writer.writeEndElement(); //
+ }
+
+ if (fn->isConst()) {
+ writer.writeStartElement(CXXFUNCTIONCONST);
+ writer.writeAttribute("name","const");
+ writer.writeAttribute("value","const");
+ writer.writeEndElement(); //
+ }
+
+ if (fn->virtualness() != FunctionNode::NonVirtual) {
+ writer.writeStartElement(CXXFUNCTIONVIRTUAL);
+ writer.writeAttribute("name","virtual");
+ writer.writeAttribute("value","virtual");
+ writer.writeEndElement(); //
+ if (fn->virtualness() == FunctionNode::PureVirtual) {
+ writer.writeStartElement(CXXFUNCTIONPUREVIRTUAL);
+ writer.writeAttribute("name","pure virtual");
+ writer.writeAttribute("value","pure virtual");
+ writer.writeEndElement(); //
+ }
+ }
+
+ if (fn->name() == cn->name()) {
+ writer.writeStartElement(CXXFUNCTIONCONSTRUCTOR);
+ writer.writeAttribute("name","constructor");
+ writer.writeAttribute("value","constructor");
+ writer.writeEndElement(); //
+ }
+ else if (fn->name()[0] == QChar('~')) {
+ writer.writeStartElement(CXXFUNCTIONDESTRUCTOR);
+ writer.writeAttribute("name","destructor");
+ writer.writeAttribute("value","destructor");
+ writer.writeEndElement(); //
+ }
+ else {
+ writer.writeStartElement(CXXFUNCTIONDECLAREDTYPE);
+ writer.writeCharacters(fn->returnType());
+ writer.writeEndElement(); //
+ }
+ QString fq = fullQualification(fn);
+ if (!fq.isEmpty()) {
+ writer.writeStartElement(CXXFUNCTIONSCOPEDNAME);
+ writer.writeCharacters(fq);
+ writer.writeEndElement(); //
+ }
+ writer.writeStartElement(CXXFUNCTIONPROTOTYPE);
+ writer.writeCharacters(fn->signature(true));
+ writer.writeEndElement(); //
+
+ QString fnl = fn->signature(false);
+ int idx = fnl.indexOf(' ');
+ if (idx < 0)
+ idx = 0;
+ else
+ ++idx;
+ fnl = fn->parent()->name() + "::" + fnl.mid(idx);
+ writer.writeStartElement(CXXFUNCTIONNAMELOOKUP);
+ writer.writeCharacters(fnl);
+ writer.writeEndElement(); //
+
writeLocation(fn, marker);
writer.writeEndElement(); //
writer.writeStartElement(APIDESC);
if (!fn->doc().isEmpty()) {
- writer.writeStartElement("p");
- writer.writeAttribute("outputclass","h2");
- writer.writeCharacters("Function Description");
- writer.writeEndElement(); //
generateBody(fn, marker);
// generateAlsoList(inner, marker);
}
-
+
writer.writeEndElement(); //
writer.writeEndElement(); //
writer.writeEndElement(); //
@@ -4601,27 +4688,32 @@ void DitaXmlGenerator::writeFunctions(const Section& s,
void DitaXmlGenerator::writeNestedClasses(const Section& s,
const ClassNode* cn,
- CodeMarker* marker) {
+ CodeMarker* marker)
+{
}
void DitaXmlGenerator::writeEnumerations(const Section& s,
const ClassNode* cn,
- CodeMarker* marker) {
+ CodeMarker* marker)
+{
}
void DitaXmlGenerator::writeTypedefs(const Section& s,
const ClassNode* cn,
- CodeMarker* marker) {
+ CodeMarker* marker)
+{
}
void DitaXmlGenerator::writeDataMembers(const Section& s,
const ClassNode* cn,
- CodeMarker* marker) {
+ CodeMarker* marker)
+{
}
void DitaXmlGenerator::writeProperties(const Section& s,
const ClassNode* cn,
- CodeMarker* marker) {
+ CodeMarker* marker)
+{
}
QT_END_NAMESPACE
diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h
index 5afd82a..71304b3 100644
--- a/tools/qdoc3/ditaxmlgenerator.h
+++ b/tools/qdoc3/ditaxmlgenerator.h
@@ -110,6 +110,8 @@ class DitaXmlGenerator : public PageGenerator
virtual QString linkForNode(const Node *node, const Node *relative);
virtual QString refForAtom(Atom *atom, const Node *node);
+ QString fullQualification(const Node* n);
+
void writeDerivations(const ClassNode* cn, CodeMarker* marker);
void writeLocation(const Node* n, CodeMarker* marker);
void writeFunctions(const Section& s,
--
cgit v0.12