diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-17 13:32:40 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-17 13:32:40 (GMT) |
commit | 0610902bcd722605f10840a6a3d1600e1e07f771 (patch) | |
tree | d23cf33f3b318224c539899140aa79fd7f104bfb | |
parent | 08c6a3485b236b53ac925a404f01a077147cd556 (diff) | |
parent | 68a2073cca205d8a6c4a44305045e1ac64f664f0 (diff) | |
download | Qt-0610902bcd722605f10840a6a3d1600e1e07f771.zip Qt-0610902bcd722605f10840a6a3d1600e1e07f771.tar.gz Qt-0610902bcd722605f10840a6a3d1600e1e07f771.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
doc: Added more DITA output to the XML generator
Usefully convert from QtScript object/array to QVariant
document QSslSocket::systemCaCertificates() change in changelog
Implement QIODevice::peek() using read() + ungetBlock().
Allocate the memory for QtFontSize when count > 1
doc: Added more DITA output to the XML generator
Defer allocation of GIF decoding tables/stack.
Make sure only started gestures can cause cancellations
Updated JavaScriptCore from /home/khansen/dev/qtwebkit-qtscript-integration to javascriptcore-snapshot-16062010 ( 8b2d3443afca194f8ac50a63151dc9d19a150582 )
qmake: Fix CONFIG += exceptions_off with the MSVC project generator.
Fix some kind of race condition while using remote commands.
Work around ICE in Intel C++ Compiler 11.1.072
Reduce the memory consumption of QtFontStyle
26 files changed, 623 insertions, 67 deletions
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. 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); 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 <simon.hausmann@nokia.com>, Kent Hansen <kent.hansen@nokia.com> + + 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 <kent.hansen@nokia.com> 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<char*>(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 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}; 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 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. diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index ff29462..139139f 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) || count == 1) { QtFontSize *newPixelSizes = (QtFontSize *) realloc(pixelSizes, (((count+8) >> 3) << 3) * sizeof(QtFontSize)); diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp index 591e40b..129a11b 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(); 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<QVariantList *>(ptr) = variantListFromArray(exec, value); + *reinterpret_cast<QVariantList *>(ptr) = variantListFromArray(exec, JSC::asArray(value)); return true; } break; case QMetaType::QVariantMap: if (isObject(value)) { - *reinterpret_cast<QVariantMap *>(ptr) = variantMapFromObject(exec, value); + *reinterpret_cast<QVariantMap *>(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<intptr_t, QScript::UStringSourceProviderWithFeedback*> loadedScripts; QScriptValue m_currentException; + QSet<JSC::JSObject*> visitedConversionObjects; + #ifndef QT_NO_QOBJECT QHash<QObject*, QScript::QObjectData*> 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<QDeclarativeWorkerScript*>(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<int> myInvokableWithListOfIntArg(const QList<int> &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<QString>("program"); + QTest::addColumn<QVariantList>("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<QString>("program"); + QTest::addColumn<QVariantMap>("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<QString>("program"); + QTest::addColumn<QVariant>("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)(); 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<HelpPage*> (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: diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 197bc13..5f10885 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(); // <cxxClassAccessSpecifier> + if (cn->isAbstract()) { + writer.writeStartElement(CXXCLASSABSTRACT); + writer.writeAttribute("name","abstract"); + writer.writeAttribute("value","abstract"); + writer.writeEndElement(); // </cxxClassAbstract> + } writeDerivations(cn, marker); writeLocation(cn, marker); writer.writeEndElement(); // <cxxClassDefinition> @@ -1452,6 +1457,26 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writer.writeEndElement(); // </apiDesc> writer.writeEndElement(); // </cxxClassDetail> + + 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(); // </cxxClass> } @@ -4475,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<RelatedClass>::ConstIterator r; @@ -4502,19 +4552,168 @@ 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(); // </cxxClassDeclarationFile> - writer.writeStartElement(CXXCLASSDECLARATIONFILELINE); + writer.writeAttribute("value",n->location().filePath()); + writer.writeEndElement(); // </cxx<s2>DeclarationFile> + writer.writeStartElement(s3); writer.writeAttribute("name","lineNumber"); QString lineNr; - writer.writeAttribute("value",lineNr.setNum(cn->location().lineNo())); - writer.writeEndElement(); // </cxxClassDeclarationFileLine> - writer.writeEndElement(); // </cxxClassApiItemLocation> + writer.writeAttribute("value",lineNr.setNum(n->location().lineNo())); + writer.writeEndElement(); // </cxx<s3>DeclarationFileLine> + writer.writeEndElement(); // </cxx<s1>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<const FunctionNode*>(*m); + QString name = fn->name(); + writer.writeStartElement(CXXFUNCTION); + writeGuidAttribute(name); + writer.writeStartElement(APINAME); + writer.writeCharacters(name); + writer.writeEndElement(); // </apiName> + generateBrief(fn,marker); + writer.writeStartElement(CXXFUNCTIONDETAIL); + writer.writeStartElement(CXXFUNCTIONDEFINITION); + writer.writeStartElement(CXXFUNCTIONACCESSSPECIFIER); + writer.writeAttribute("value",fn->accessString()); + writer.writeEndElement(); // <cxxFunctionAccessSpecifier> + + if (fn->isStatic()) { + writer.writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC); + writer.writeAttribute("name","static"); + writer.writeAttribute("value","static"); + writer.writeEndElement(); // <cxxFunctionStorageClassSpecifierStatic> + } + + if (fn->isConst()) { + writer.writeStartElement(CXXFUNCTIONCONST); + writer.writeAttribute("name","const"); + writer.writeAttribute("value","const"); + writer.writeEndElement(); // <cxxFunctionConst> + } + + if (fn->virtualness() != FunctionNode::NonVirtual) { + writer.writeStartElement(CXXFUNCTIONVIRTUAL); + writer.writeAttribute("name","virtual"); + writer.writeAttribute("value","virtual"); + writer.writeEndElement(); // <cxxFunctionVirtual> + if (fn->virtualness() == FunctionNode::PureVirtual) { + writer.writeStartElement(CXXFUNCTIONPUREVIRTUAL); + writer.writeAttribute("name","pure virtual"); + writer.writeAttribute("value","pure virtual"); + writer.writeEndElement(); // <cxxFunctionPureVirtual> + } + } + + if (fn->name() == cn->name()) { + writer.writeStartElement(CXXFUNCTIONCONSTRUCTOR); + writer.writeAttribute("name","constructor"); + writer.writeAttribute("value","constructor"); + writer.writeEndElement(); // <cxxFunctionConstructor> + } + else if (fn->name()[0] == QChar('~')) { + writer.writeStartElement(CXXFUNCTIONDESTRUCTOR); + writer.writeAttribute("name","destructor"); + writer.writeAttribute("value","destructor"); + writer.writeEndElement(); // <cxxFunctionDestructor> + } + else { + writer.writeStartElement(CXXFUNCTIONDECLAREDTYPE); + writer.writeCharacters(fn->returnType()); + writer.writeEndElement(); // <cxxFunctionDeclaredType> + } + QString fq = fullQualification(fn); + if (!fq.isEmpty()) { + writer.writeStartElement(CXXFUNCTIONSCOPEDNAME); + writer.writeCharacters(fq); + writer.writeEndElement(); // <cxxFunctionScopedName> + } + writer.writeStartElement(CXXFUNCTIONPROTOTYPE); + writer.writeCharacters(fn->signature(true)); + writer.writeEndElement(); // <cxxFunctionPrototype> + + 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(); // <cxxFunctionNameLookup> + + writeLocation(fn, marker); + writer.writeEndElement(); // <cxxFunctionDefinition> + writer.writeStartElement(APIDESC); + + if (!fn->doc().isEmpty()) { + generateBody(fn, marker); + // generateAlsoList(inner, marker); + } + + writer.writeEndElement(); // </apiDesc> + writer.writeEndElement(); // </cxxFunctionDetail> + writer.writeEndElement(); // </cxxFunction> + + 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..71304b3 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -110,8 +110,28 @@ 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 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<RelatedClass> bas; QList<RelatedClass> 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); |