From c7d39e1335775979d43833d0b7f6c32cef898424 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 26 Mar 2010 14:09:26 +0100 Subject: uic3: -extract: Write XPM-images correctly. Add magic header '/* XPM */' and turn off wrapping of lines that broke image readers. Add a command line option to activate line-wrapping in case someone exclusively wants to use the extracted images for embedding in code. Also do line-wrapping in case images are embedded into the ui-file. Note: The current versions of MSVC do not seem to have a limitation of line lengths any more. Task-number: QTBUG-9207 Reviewed-by: Jarek Kobus --- src/tools/uic/cpp/cppextractimages.cpp | 2 +- src/tools/uic/cpp/cppwriteicondata.cpp | 12 ++++++++---- src/tools/uic/cpp/cppwriteicondata.h | 3 ++- src/tools/uic/option.h | 2 ++ src/tools/uic3/converter.cpp | 1 + src/tools/uic3/form.cpp | 1 + src/tools/uic3/main.cpp | 3 +++ src/tools/uic3/ui3reader.h | 3 ++- tests/auto/uic/baseline/config_fromuic3.ui.h | 1 + tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h | 1 + 10 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/tools/uic/cpp/cppextractimages.cpp b/src/tools/uic/cpp/cppextractimages.cpp index d452168..52c1b9d 100644 --- a/src/tools/uic/cpp/cppextractimages.cpp +++ b/src/tools/uic/cpp/cppextractimages.cpp @@ -134,7 +134,7 @@ void ExtractImages::acceptImage(DomImage *image) QTextStream *imageOut = new QTextStream(&f); imageOut->setCodec(QTextCodec::codecForName("UTF-8")); - CPP::WriteIconData::writeImage(*imageOut, QString(), image); + CPP::WriteIconData::writeImage(*imageOut, QString(), m_option.limitXPM_LineLength, image); delete imageOut; } else { CPP::WriteIconData::writeImage(f, image); diff --git a/src/tools/uic/cpp/cppwriteicondata.cpp b/src/tools/uic/cpp/cppwriteicondata.cpp index 81ef56b..7e4b5c8 100644 --- a/src/tools/uic/cpp/cppwriteicondata.cpp +++ b/src/tools/uic/cpp/cppwriteicondata.cpp @@ -114,10 +114,12 @@ void WriteIconData::acceptImages(DomImages *images) void WriteIconData::acceptImage(DomImage *image) { - writeImage(output, option.indent, image); + // Limit line length when writing code. + writeImage(output, option.indent, true, image); } -void WriteIconData::writeImage(QTextStream &output, const QString &indent, DomImage *image) +void WriteIconData::writeImage(QTextStream &output, const QString &indent, + bool limitXPM_LineLength, const DomImage *image) { QString img = image->attributeName() + QLatin1String("_data"); QString data = image->elementData()->text(); @@ -133,7 +135,8 @@ void WriteIconData::writeImage(QTextStream &output, const QString &indent, DomIm int a = 0; int column = 0; bool inQuote = false; - output << indent << "static const char* const " << img << "[] = { \n"; + output << indent << "/* XPM */\n" + << indent << "static const char* const " << img << "[] = { \n"; while (baunzip[a] != '\"') a++; for (; a < (int) length; a++) { @@ -144,7 +147,8 @@ void WriteIconData::writeImage(QTextStream &output, const QString &indent, DomIm inQuote = !inQuote; } - if (column++ >= 511 && inQuote) { + column++; + if (limitXPM_LineLength && column >= 512 && inQuote) { output << "\"\n\""; // be nice with MSVC & Co. column = 1; } diff --git a/src/tools/uic/cpp/cppwriteicondata.h b/src/tools/uic/cpp/cppwriteicondata.h index 40d56bc..42cfab0 100644 --- a/src/tools/uic/cpp/cppwriteicondata.h +++ b/src/tools/uic/cpp/cppwriteicondata.h @@ -64,7 +64,8 @@ public: void acceptImages(DomImages *images); void acceptImage(DomImage *image); - static void writeImage(QTextStream &output, const QString &indent, DomImage *image); + static void writeImage(QTextStream &output, const QString &indent, + bool limitXPM_LineLength, const DomImage *image); static void writeImage(QIODevice &output, DomImage *image); private: diff --git a/src/tools/uic/option.h b/src/tools/uic/option.h index f1198a0..8556728 100644 --- a/src/tools/uic/option.h +++ b/src/tools/uic/option.h @@ -61,6 +61,7 @@ struct Option unsigned int autoConnection : 1; unsigned int dependencies : 1; unsigned int extractImages : 1; + unsigned int limitXPM_LineLength : 1; unsigned int implicitIncludes: 1; Generator generator; @@ -85,6 +86,7 @@ struct Option autoConnection(1), dependencies(0), extractImages(0), + limitXPM_LineLength(0), implicitIncludes(1), generator(CppGenerator), prefix(QLatin1String("Ui_")) diff --git a/src/tools/uic3/converter.cpp b/src/tools/uic3/converter.cpp index e1b4b38..2ee939d 100644 --- a/src/tools/uic3/converter.cpp +++ b/src/tools/uic3/converter.cpp @@ -518,6 +518,7 @@ DomUI *Ui3Reader::generateUi4(const QDomElement &widget) if (m_extractImages) { Option opt; opt.extractImages = m_extractImages; + opt.limitXPM_LineLength = (m_options & LimitXPM_LineLength) ? 1 : 0; opt.qrcOutputFile = m_qrcOutputFile; CPP::ExtractImages(opt).acceptUI(ui); diff --git a/src/tools/uic3/form.cpp b/src/tools/uic3/form.cpp index df1314f..9df644a 100644 --- a/src/tools/uic3/form.cpp +++ b/src/tools/uic3/form.cpp @@ -256,6 +256,7 @@ void Ui3Reader::createFormDecl(const QDomElement &e) d.option().headerProtection = false; d.option().copyrightHeader = false; d.option().extractImages = m_extractImages; + d.option().limitXPM_LineLength = (m_options & LimitXPM_LineLength) ? 1 : 0; d.option().qrcOutputFile = m_qrcOutputFile; d.option().implicitIncludes = (m_options & ImplicitIncludes) ? 1 : 0; if (trmacro.size()) diff --git a/src/tools/uic3/main.cpp b/src/tools/uic3/main.cpp index 1ebb76a..d7657b1 100644 --- a/src/tools/uic3/main.cpp +++ b/src/tools/uic3/main.cpp @@ -149,6 +149,8 @@ int runUic3(int argc, char * argv[]) readerOptions &= ~Ui3Reader::CustomWidgetForwardDeclarations; } else if (opt == "layout-names") { readerOptions |= Ui3Reader::PreserveLayoutNames; + } else if (opt == "limit-xpm-linelength") { + readerOptions |= Ui3Reader::LimitXPM_LineLength; } else if (opt == "nounload") { // skip } else if (opt == "convert") { @@ -251,6 +253,7 @@ int runUic3(int argc, char * argv[]) "Options:\n" "\t-o file Write output to file rather than stdout\n" "\t-extract qrcFile Create resource file and extract embedded images into \"image\" dir\n" + "\t-limit-xpm-linelength Limit the line length of XPM files for -extract.\n" "\t-pch file Add #include \"file\" as the first statement in implementation\n" "\t-nofwd Omit forward declarations of custom classes\n" "\t-layout-names Preserve layout names of Qt Designer 3\n" diff --git a/src/tools/uic3/ui3reader.h b/src/tools/uic3/ui3reader.h index 144ef05..abe323e 100644 --- a/src/tools/uic3/ui3reader.h +++ b/src/tools/uic3/ui3reader.h @@ -68,7 +68,8 @@ typedef QList > ColorGroup; class Ui3Reader { public: - enum Options { CustomWidgetForwardDeclarations = 0x1, ImplicitIncludes = 0x2, PreserveLayoutNames = 0x4 }; + enum Options { CustomWidgetForwardDeclarations = 0x1, ImplicitIncludes = 0x2, + PreserveLayoutNames = 0x4, LimitXPM_LineLength = 0x8 }; explicit Ui3Reader(QTextStream &stream, unsigned options); ~Ui3Reader(); diff --git a/tests/auto/uic/baseline/config_fromuic3.ui.h b/tests/auto/uic/baseline/config_fromuic3.ui.h index c77b303..7e0189e 100644 --- a/tests/auto/uic/baseline/config_fromuic3.ui.h +++ b/tests/auto/uic/baseline/config_fromuic3.ui.h @@ -670,6 +670,7 @@ protected: }; static QPixmap qt_get_icon(IconID id) { + /* XPM */ static const char* const image0_data[] = { "22 22 2 1", ". c None", diff --git a/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h b/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h index 50cc4c8..40485ac 100644 --- a/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h +++ b/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h @@ -439,6 +439,7 @@ protected: }; static QPixmap qt_get_icon(IconID id) { + /* XPM */ static const char* const image0_data[] = { "22 22 2 1", ". c None", -- cgit v0.12 From 5de7a8578cf5ac563d8b17b2e1eadde06e469d8e Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 18 Mar 2010 23:00:09 +0900 Subject: Fix compile error with QT_NO_TEXTHTMLPARSER in QtGui Merge-request: 528 Reviewed-by: Zeno Albisser --- src/gui/text/qstatictext.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 1fabf12..798ae37 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -553,8 +553,11 @@ void QStaticTextPrivate::paintText(const QPointF &pos, QPainter *p) } else { QTextDocument document; document.setDefaultFont(font); +#ifndef QT_NO_TEXTHTMLPARSER document.setHtml(text); - +#else + document.setPlainText(text); +#endif QRectF rect = maximumSize.isValid() ? QRectF(pos, maximumSize) : QRectF(); document.adjustSize(); p->save(); -- cgit v0.12 From 6829ee30f02f162bbb399000c853c8d680f8f8de Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 26 Mar 2010 14:55:27 +0100 Subject: Compile on Maemo 5 qmake for Maemo 5 needs to be bootstrapped with an older gcc, which doesn't like foreach() in templates. Use a traditional for loop to iterate over the container instead. --- qmake/generators/symbian/symbian_makefile.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qmake/generators/symbian/symbian_makefile.h b/qmake/generators/symbian/symbian_makefile.h index f9d3c24..289f9ae 100644 --- a/qmake/generators/symbian/symbian_makefile.h +++ b/qmake/generators/symbian/symbian_makefile.h @@ -71,8 +71,9 @@ public: if (targetType == TypeExe) { generatePkg = true; } else { - foreach(QString item, this->project->values("DEPLOYMENT")) { - if (!this->project->values(item + ".sources").isEmpty()) { + const QStringList deployments = this->project->values("DEPLOYMENT"); + for (int i = 0; i < deployments.count(); ++i) { + if (!this->project->values(deployments.at(i) + ".sources").isEmpty()) { generatePkg = true; break; } -- cgit v0.12 From 61b488a965eebc52104243dce21eaeb203cfecae Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 26 Mar 2010 13:59:26 +0100 Subject: QtScript: Make sure the old identifier table is restored Use a shim to take care of that. --- src/script/api/qscriptengine.cpp | 2 +- src/script/api/qscriptengine_p.h | 1 - src/script/api/qscriptstring.cpp | 6 +++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index b322523..a393ead 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -915,7 +915,7 @@ QScriptEnginePrivate::QScriptEnginePrivate() QScriptEnginePrivate::~QScriptEnginePrivate() { - JSC::setCurrentIdentifierTable(globalData->identifierTable); + QScript::APIShim shim(this); //disconnect all loadedScripts and generate all jsc::debugger::scriptUnload events QHash::const_iterator it; diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 70ab7c9..5c2007f 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -798,7 +798,6 @@ inline void QScriptEnginePrivate::unregisterScriptString(QScriptStringPrivate *v registeredScriptStrings = value->next; value->prev = 0; value->next = 0; - JSC::setCurrentIdentifierTable(globalData->identifierTable); } inline QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame) diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp index 7978b61..d0b0ffd 100644 --- a/src/script/api/qscriptstring.cpp +++ b/src/script/api/qscriptstring.cpp @@ -92,8 +92,12 @@ QScriptString::~QScriptString() d->ref.ref(); // avoid deletion break; case QScriptStringPrivate::HeapAllocated: - if (d->engine && (d->ref == 1)) + if (d->engine && (d->ref == 1)) { + // Make sure the identifier is removed from the correct engine. + QScript::APIShim(d->engine); + d->identifier = JSC::Identifier(); d->engine->unregisterScriptString(d); + } break; } } -- cgit v0.12 From 7a11acd536d84ad22ef98a0fdbdb4322a55efafb Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 26 Mar 2010 14:00:02 +0100 Subject: QtScript: Add yet more missing API shims - for QScriptEngine and QScriptContext; we don't control what the JSC functions are doing, so it's better to have shims than not to have them (which can cause something to blow up), even if they might not be strictly necessary as of this writing. - for QScriptDeclarativeClass; otherwise the identifiers might be created/destroyed in the wrong engine. - for QScriptValueIterator destructor; otherwise the identifiers might be destroyed in the wrong engine. This is an attempt to fix a crash in Bauhaus, but it might still be crashing (i.e. still some shims missing, somewhere) ;( --- src/script/api/qscriptcontext.cpp | 14 ++++++++++++++ src/script/api/qscriptengine.cpp | 28 +++++++++++++++++++++++++++ src/script/api/qscriptvalueiterator.cpp | 6 ++++++ src/script/bridge/qscriptdeclarativeclass.cpp | 21 ++++++++++++++++---- 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp index b1732ee..639af80 100644 --- a/src/script/api/qscriptcontext.cpp +++ b/src/script/api/qscriptcontext.cpp @@ -161,6 +161,7 @@ QScriptContext::QScriptContext() QScriptValue QScriptContext::throwValue(const QScriptValue &value) { JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); JSC::JSValue jscValue = QScript::scriptEngineFromExec(frame)->scriptValueToJSCValue(value); frame->setException(jscValue); return value; @@ -183,6 +184,7 @@ QScriptValue QScriptContext::throwValue(const QScriptValue &value) QScriptValue QScriptContext::throwError(Error error, const QString &text) { JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); JSC::ErrorType jscError = JSC::GeneralError; switch (error) { case UnknownError: @@ -218,6 +220,7 @@ QScriptValue QScriptContext::throwError(Error error, const QString &text) QScriptValue QScriptContext::throwError(const QString &text) { JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); JSC::JSObject *result = JSC::throwError(frame, JSC::GeneralError, text); return QScript::scriptEngineFromExec(frame)->scriptValueFromJSCValue(result); } @@ -265,6 +268,7 @@ QScriptValue QScriptContext::argument(int index) const QScriptValue QScriptContext::callee() const { const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); return QScript::scriptEngineFromExec(frame)->scriptValueFromJSCValue(frame->callee()); } @@ -286,6 +290,7 @@ QScriptValue QScriptContext::callee() const QScriptValue QScriptContext::argumentsObject() const { JSC::CallFrame *frame = const_cast(QScriptEnginePrivate::frameForContext(this)); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); if (frame == frame->lexicalGlobalObject()->globalExec()) { // context doesn't have arguments. return an empty object @@ -322,6 +327,7 @@ QScriptValue QScriptContext::argumentsObject() const bool QScriptContext::isCalledAsConstructor() const { JSC::CallFrame *frame = const_cast(QScriptEnginePrivate::frameForContext(this)); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); //For native functions, look up flags. uint flags = QScriptEnginePrivate::contextFlags(frame); @@ -355,6 +361,7 @@ bool QScriptContext::isCalledAsConstructor() const QScriptContext *QScriptContext::parentContext() const { const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); JSC::CallFrame *callerFrame = frame->callerFrame()->removeHostCallFrameFlag(); return QScriptEnginePrivate::contextForFrame(callerFrame); } @@ -412,6 +419,7 @@ void QScriptContext::setReturnValue(const QScriptValue &result) QScriptValue QScriptContext::activationObject() const { JSC::CallFrame *frame = const_cast(QScriptEnginePrivate::frameForContext(this)); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); JSC::JSObject *result = 0; uint flags = QScriptEnginePrivate::contextFlags(frame); @@ -477,6 +485,7 @@ void QScriptContext::setActivationObject(const QScriptValue &activation) } JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); JSC::JSObject *object = JSC::asObject(engine->scriptValueToJSCValue(activation)); if (object == engine->originalGlobalObjectProxy) object = engine->originalGlobalObject(); @@ -521,6 +530,7 @@ QScriptValue QScriptContext::thisObject() const { JSC::CallFrame *frame = const_cast(QScriptEnginePrivate::frameForContext(this)); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); JSC::JSValue result = engine->thisForContext(frame); if (!result || result.isNull()) result = frame->globalThisValue(); @@ -536,6 +546,7 @@ QScriptValue QScriptContext::thisObject() const void QScriptContext::setThisObject(const QScriptValue &thisObject) { JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); + QScript::APIShim shim(QScript::scriptEngineFromExec(frame)); if (!thisObject.isObject()) return; if (thisObject.engine() != engine()) { @@ -662,6 +673,7 @@ QScriptValueList QScriptContext::scopeChain() const activationObject(); //ensure the creation of the normal scope for native context const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); QScriptValueList result; JSC::ScopeChainNode *node = frame->scopeChain(); JSC::ScopeChainIterator it(node); @@ -700,6 +712,7 @@ void QScriptContext::pushScope(const QScriptValue &object) } JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); JSC::JSObject *jscObject = JSC::asObject(engine->scriptValueToJSCValue(object)); if (jscObject == engine->originalGlobalObjectProxy) jscObject = engine->originalGlobalObject(); @@ -733,6 +746,7 @@ QScriptValue QScriptContext::popScope() JSC::ScopeChainNode *scope = frame->scopeChain(); Q_ASSERT(scope != 0); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); QScriptValue result = engine->scriptValueFromJSCValue(scope->object); if (!scope->next) { // We cannot have a null scope chain, so just zap the object pointer. diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index a393ead..3e5249a 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1899,6 +1899,7 @@ QScriptEngine::~QScriptEngine() QScriptValue QScriptEngine::globalObject() const { Q_D(const QScriptEngine); + QScript::APIShim shim(const_cast(d)); JSC::JSObject *result = d->globalObject(); return const_cast(d)->scriptValueFromJSCValue(result); } @@ -1920,6 +1921,7 @@ void QScriptEngine::setGlobalObject(const QScriptValue &object) Q_D(QScriptEngine); if (!object.isObject()) return; + QScript::APIShim shim(d); JSC::JSObject *jscObject = JSC::asObject(d->scriptValueToJSCValue(object)); d->setGlobalObject(jscObject); } @@ -1976,6 +1978,7 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, int length) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::ExecState* exec = d->currentFrame; JSC::JSValue function = new (exec)QScript::FunctionWrapper(exec, length, JSC::Identifier(exec, ""), fun); QScriptValue result = d->scriptValueFromJSCValue(function); @@ -1999,6 +2002,7 @@ extern QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax); QScriptValue QScriptEngine::newRegExp(const QRegExp ®exp) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newRegExp(d->currentFrame, regexp)); } @@ -2017,6 +2021,7 @@ QScriptValue QScriptEngine::newRegExp(const QRegExp ®exp) QScriptValue QScriptEngine::newVariant(const QVariant &value) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newVariant(value)); } @@ -2050,6 +2055,7 @@ QScriptValue QScriptEngine::newVariant(const QScriptValue &object, const QVariant &value) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::JSValue jsObject = d->scriptValueToJSCValue(object); return d->scriptValueFromJSCValue(d->newVariant(jsObject, value)); } @@ -2081,6 +2087,7 @@ QScriptValue QScriptEngine::newQObject(QObject *object, ValueOwnership ownership const QObjectWrapOptions &options) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::JSValue jscQObject = d->newQObject(object, ownership, options); return d->scriptValueFromJSCValue(jscQObject); } @@ -2117,8 +2124,10 @@ QScriptValue QScriptEngine::newQObject(const QScriptValue &scriptObject, ValueOwnership ownership, const QObjectWrapOptions &options) { + Q_D(QScriptEngine); if (!scriptObject.isObject()) return newQObject(qtObject, ownership, options); + QScript::APIShim shim(d); JSC::JSObject *jscObject = JSC::asObject(QScriptValuePrivate::get(scriptObject)->jscValue); if (!jscObject->inherits(&QScriptObject::info)) { qWarning("QScriptEngine::newQObject(): changing class of non-QScriptObject not supported"); @@ -2149,6 +2158,7 @@ QScriptValue QScriptEngine::newQObject(const QScriptValue &scriptObject, QScriptValue QScriptEngine::newObject() { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newObject()); } @@ -2170,6 +2180,7 @@ QScriptValue QScriptEngine::newObject(QScriptClass *scriptClass, const QScriptValue &data) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::ExecState* exec = d->currentFrame; QScriptObject *result = new (exec) QScriptObject(d->scriptObjectStructure); result->setDelegate(new QScript::ClassObjectDelegate(scriptClass)); @@ -2237,6 +2248,7 @@ QScriptValue QScriptEngine::newActivationObject() QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, int length) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::ExecState* exec = d->currentFrame; JSC::JSValue function = new (exec)QScript::FunctionWrapper(exec, length, JSC::Identifier(exec, ""), fun); QScriptValue result = d->scriptValueFromJSCValue(function); @@ -2254,6 +2266,7 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, in QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionWithArgSignature fun, void *arg) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::ExecState* exec = d->currentFrame; JSC::JSValue function = new (exec)QScript::FunctionWithArgWrapper(exec, /*length=*/0, JSC::Identifier(exec, ""), fun, arg); QScriptValue result = d->scriptValueFromJSCValue(function); @@ -2272,6 +2285,7 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionWithArgSignature QScriptValue QScriptEngine::newArray(uint length) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newArray(d->currentFrame, length)); } @@ -2285,6 +2299,7 @@ QScriptValue QScriptEngine::newArray(uint length) QScriptValue QScriptEngine::newRegExp(const QString &pattern, const QString &flags) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newRegExp(d->currentFrame, pattern, flags)); } @@ -2296,6 +2311,7 @@ QScriptValue QScriptEngine::newRegExp(const QString &pattern, const QString &fla QScriptValue QScriptEngine::newDate(qsreal value) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newDate(d->currentFrame, value)); } @@ -2307,6 +2323,7 @@ QScriptValue QScriptEngine::newDate(qsreal value) QScriptValue QScriptEngine::newDate(const QDateTime &value) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->newDate(d->currentFrame, value)); } @@ -2330,6 +2347,7 @@ QScriptValue QScriptEngine::newQMetaObject( const QMetaObject *metaObject, const QScriptValue &ctor) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::JSValue jscCtor = d->scriptValueToJSCValue(ctor); JSC::JSValue jscQMetaObject = d->newQMetaObject(metaObject, jscCtor); return d->scriptValueFromJSCValue(jscQMetaObject); @@ -2582,6 +2600,7 @@ QScriptContext *QScriptEngine::currentContext() const QScriptContext *QScriptEngine::pushContext() { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::CallFrame* newFrame = d->pushContext(d->currentFrame, d->currentFrame->globalData().dynamicGlobalObject, JSC::ArgList(), /*callee = */0); @@ -2673,6 +2692,7 @@ void QScriptEngine::popContext() if (agent()) agent()->contextPop(); Q_D(QScriptEngine); + QScript::APIShim shim(d); if (d->currentFrame->returnPC() != 0 || d->currentFrame->codeBlock() != 0 || !currentContext()->parentContext()) { qWarning("QScriptEngine::popContext() doesn't match with pushContext()"); @@ -2868,6 +2888,7 @@ void QScriptEngine::setDefaultPrototype(int metaTypeId, const QScriptValue &prot QScriptValue QScriptEngine::create(int type, const void *ptr) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return d->scriptValueFromJSCValue(d->create(d->currentFrame, type, ptr)); } @@ -3277,6 +3298,7 @@ bool QScriptEnginePrivate::hasDemarshalFunction(int type) const bool QScriptEngine::convert(const QScriptValue &value, int type, void *ptr) { Q_D(QScriptEngine); + QScript::APIShim shim(d); return QScriptEnginePrivate::convertValue(d->currentFrame, d->scriptValueToJSCValue(value), type, ptr); } @@ -3309,6 +3331,7 @@ void QScriptEngine::registerCustomType(int type, MarshalFunction mf, const QScriptValue &prototype) { Q_D(QScriptEngine); + QScript::APIShim shim(d); QScriptTypeInfo *info = d->m_typeInfos.value(type); if (!info) { info = new QScriptTypeInfo(); @@ -3341,6 +3364,7 @@ void QScriptEngine::registerCustomType(int type, MarshalFunction mf, void QScriptEngine::installTranslatorFunctions(const QScriptValue &object) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::ExecState* exec = d->currentFrame; JSC::JSValue jscObject = d->scriptValueToJSCValue(object); JSC::JSGlobalObject *glob = d->originalGlobalObject(); @@ -3374,6 +3398,7 @@ QScriptValue QScriptEngine::importExtension(const QString &extension) Q_UNUSED(extension); #else Q_D(QScriptEngine); + QScript::APIShim shim(d); if (d->importedExtensions.contains(extension)) return undefinedValue(); // already imported @@ -4014,6 +4039,7 @@ bool qScriptConnect(QObject *sender, const char *signal, if (receiver.isObject() && (receiver.engine() != function.engine())) return false; QScriptEnginePrivate *engine = QScriptEnginePrivate::get(function.engine()); + QScript::APIShim shim(engine); JSC::JSValue jscReceiver = engine->scriptValueToJSCValue(receiver); JSC::JSValue jscFunction = engine->scriptValueToJSCValue(function); return engine->scriptConnect(sender, signal, jscReceiver, jscFunction, @@ -4040,6 +4066,7 @@ bool qScriptDisconnect(QObject *sender, const char *signal, if (receiver.isObject() && (receiver.engine() != function.engine())) return false; QScriptEnginePrivate *engine = QScriptEnginePrivate::get(function.engine()); + QScript::APIShim shim(engine); JSC::JSValue jscReceiver = engine->scriptValueToJSCValue(receiver); JSC::JSValue jscFunction = engine->scriptValueToJSCValue(function); return engine->scriptDisconnect(sender, signal, jscReceiver, jscFunction); @@ -4145,6 +4172,7 @@ QScriptString QScriptEngine::toStringHandle(const QString &str) QScriptValue QScriptEngine::toObject(const QScriptValue &value) { Q_D(QScriptEngine); + QScript::APIShim shim(d); JSC::JSValue jscValue = d->scriptValueToJSCValue(value); if (!jscValue || jscValue.isUndefined() || jscValue.isNull()) return QScriptValue(); diff --git a/src/script/api/qscriptvalueiterator.cpp b/src/script/api/qscriptvalueiterator.cpp index 7fd7093..c58c046 100644 --- a/src/script/api/qscriptvalueiterator.cpp +++ b/src/script/api/qscriptvalueiterator.cpp @@ -139,6 +139,12 @@ QScriptValueIterator::QScriptValueIterator(const QScriptValue &object) */ QScriptValueIterator::~QScriptValueIterator() { + Q_D(QScriptValueIterator); + if (d && d->engine()) { + // Make sure identifiers are removed from the correct engine. + QScript::APIShim shim(d->engine()); + d->propertyNames.clear(); + } } /*! diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp index acfb2a4..c72eb94 100644 --- a/src/script/bridge/qscriptdeclarativeclass.cpp +++ b/src/script/bridge/qscriptdeclarativeclass.cpp @@ -148,9 +148,12 @@ QScriptDeclarativeClass::PersistentIdentifier::PersistentIdentifier() QScriptDeclarativeClass::PersistentIdentifier::~PersistentIdentifier() { - if (engine) - JSC::setCurrentIdentifierTable(engine->globalData->identifierTable); - ((JSC::Identifier &)d).JSC::Identifier::~Identifier(); + if (engine) { + QScript::APIShim shim(engine); + ((JSC::Identifier &)d).JSC::Identifier::~Identifier(); + } else { + ((JSC::Identifier &)d).JSC::Identifier::~Identifier(); + } } QScriptDeclarativeClass::PersistentIdentifier::PersistentIdentifier(const PersistentIdentifier &other) @@ -184,7 +187,8 @@ QScriptValue QScriptDeclarativeClass::newObject(QScriptEngine *engine, Q_ASSERT(engine); Q_ASSERT(scriptClass); - QScriptEnginePrivate *p = static_cast(QObjectPrivate::get(engine)); + QScriptEnginePrivate *p = static_cast(QObjectPrivate::get(engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; QScriptObject *result = new (exec) QScriptObject(p->scriptObjectStructure); @@ -201,6 +205,7 @@ QScriptDeclarativeClass::newObjectValue(QScriptEngine *engine, Q_ASSERT(scriptClass); QScriptEnginePrivate *p = static_cast(QObjectPrivate::get(engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; QScriptObject *result = new (exec) QScriptObject(p->scriptObjectStructure); @@ -231,6 +236,7 @@ QScriptValue QScriptDeclarativeClass::function(const QScriptValue &v, const Iden if (!d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast(object)); @@ -254,6 +260,7 @@ QScriptValue QScriptDeclarativeClass::property(const QScriptValue &v, const Iden if (!d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast(object)); @@ -277,6 +284,7 @@ QScriptDeclarativeClass::functionValue(const QScriptValue &v, const Identifier & if (!d->isObject()) return Value(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast(object)); @@ -301,6 +309,7 @@ QScriptDeclarativeClass::propertyValue(const QScriptValue &v, const Identifier & if (!d->isObject()) return Value(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast(object)); @@ -326,6 +335,7 @@ QScriptValue QScriptDeclarativeClass::scopeChainValue(QScriptContext *context, i context->activationObject(); //ensure the creation of the normal scope for native context const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(context); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); JSC::ScopeChainNode *node = frame->scopeChain(); JSC::ScopeChainIterator it(node); @@ -386,6 +396,7 @@ QScriptContext * QScriptDeclarativeClass::pushCleanContext(QScriptEngine *engine return 0; QScriptEnginePrivate *d = QScriptEnginePrivate::get(engine); + QScript::APIShim shim(d); JSC::CallFrame* newFrame = d->pushContext(d->currentFrame, d->currentFrame->globalData().dynamicGlobalObject, @@ -421,6 +432,7 @@ QScriptDeclarativeClass::createPersistentIdentifier(const QString &str) { QScriptEnginePrivate *p = static_cast(QObjectPrivate::get(d_ptr->engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; PersistentIdentifier rv(p); @@ -434,6 +446,7 @@ QScriptDeclarativeClass::createPersistentIdentifier(const Identifier &id) { QScriptEnginePrivate *p = static_cast(QObjectPrivate::get(d_ptr->engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; PersistentIdentifier rv(p); -- cgit v0.12 From f681d8e2ebf774f69f92359d33ff80dd13c1bf87 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 26 Mar 2010 15:05:07 +0100 Subject: Unskip test that used to crash After updating JavaScriptCore for 4.7 it no longer crashes. --- tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp index a3dfd6c..5f9a578 100644 --- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp +++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp @@ -255,10 +255,6 @@ tst_Suite::tst_Suite() addTestExclusion("string-case", "V8-specific behavior? (Doesn't pass on SpiderMonkey either)"); -#ifdef Q_CC_MINGW - addTestExclusion("date$", "QTBUG-7698: Date.prototype.setMonth() crashes on win32-g++"); -#endif - #ifdef Q_OS_WINCE addTestExclusion("deep-recursion", "Demands too much memory on WinCE"); addTestExclusion("nested-repetition-count-overflow", "Demands too much memory on WinCE"); -- cgit v0.12 From 392aaba04d8eda52ec7f6c36c31bcd23b0458140 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 26 Mar 2010 16:44:41 +0100 Subject: Remove QGuard. This class is no longer in use by QtDeclarative. Task-number: QT-3031 Reviewed-by: Bradley T. Hughes --- src/corelib/kernel/kernel.pri | 1 - src/corelib/kernel/qguard_p.h | 157 ----------------------------------------- src/corelib/kernel/qobject.cpp | 9 --- src/corelib/kernel/qobject_p.h | 31 +------- 4 files changed, 1 insertion(+), 197 deletions(-) delete mode 100644 src/corelib/kernel/qguard_p.h diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index d0dad49..1851e04 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -33,7 +33,6 @@ HEADERS += \ kernel/qsystemsemaphore.h \ kernel/qsystemsemaphore_p.h \ kernel/qfunctions_p.h \ - kernel/qguard_p.h \ kernel/qmath.h SOURCES += \ diff --git a/src/corelib/kernel/qguard_p.h b/src/corelib/kernel/qguard_p.h deleted file mode 100644 index 0f7fd94..0000000 --- a/src/corelib/kernel/qguard_p.h +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGUARD_P_H -#define QGUARD_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -#include "QtCore/qglobal.h" - -QT_BEGIN_NAMESPACE - -class QObject; -template -class QGuard -{ - QObject *o; - QGuard *next; - QGuard **prev; - friend void q_guard_addGuard(QGuard *); - friend void q_guard_removeGuard(QGuard *); - friend class QObjectPrivate; -public: - inline QGuard(); - inline QGuard(T *); - inline QGuard(const QGuard &); - inline virtual ~QGuard(); - - inline QGuard &operator=(const QGuard &o); - inline QGuard &operator=(T *); - - inline bool isNull() const - { return !o; } - - inline T* operator->() const - { return static_cast(const_cast(o)); } - inline T& operator*() const - { return *static_cast(const_cast(o)); } - inline operator T*() const - { return static_cast(const_cast(o)); } - inline T* data() const - { return static_cast(const_cast(o)); } - -protected: - virtual void objectDestroyed(T *) {} -}; - -QT_END_NAMESPACE - -#include "private/qobject_p.h" - -QT_BEGIN_NAMESPACE - -inline void q_guard_addGuard(QGuard *); -inline void q_guard_removeGuard(QGuard *); - -template -QGuard::QGuard() -: o(0), next(0), prev(0) -{ -} - -template -QGuard::QGuard(T *g) -: o(g), next(0), prev(0) -{ - if (o) q_guard_addGuard(reinterpret_cast *>(this)); -} - -template -QGuard::QGuard(const QGuard &g) -: o(g.o), next(0), prev(0) -{ - if (o) q_guard_addGuard(reinterpret_cast *>(this)); -} - -template -QGuard::~QGuard() -{ - if (prev) q_guard_removeGuard(reinterpret_cast *>(this)); - o = 0; -} - -template -QGuard &QGuard::operator=(const QGuard &g) -{ - if (g.o != o) { - if (prev) - q_guard_removeGuard(reinterpret_cast *>(this)); - o = g.o; - if (o) q_guard_addGuard(reinterpret_cast *>(this)); - } - return *this; -} - -template -inline QGuard &QGuard::operator=(T *g) -{ - if (g != o) { - if (prev) - q_guard_removeGuard(reinterpret_cast *>(this)); - o = g; - if (o) q_guard_addGuard(reinterpret_cast *>(this)); - } - return *this; -} - -QT_END_NAMESPACE - -#endif // QGUARD_P_H diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 68f34ca..dbc6be2 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -496,15 +496,6 @@ void QMetaObject::changeGuard(QObject **ptr, QObject *o) void QObjectPrivate::clearGuards(QObject *object) { QObjectPrivate *priv = QObjectPrivate::get(object); - QGuard *guard = priv->extraData ? priv->extraData->objectGuards : 0; - while (guard) { - QGuard *g = guard; - guard = guard->next; - g->o = 0; - g->prev = 0; - g->next = 0; - g->objectDestroyed(object); - } if (!priv->hasGuards) return; diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 20e3da1..3b59abb 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -60,7 +60,6 @@ #include "QtCore/qvector.h" #include "QtCore/qreadwritelock.h" #include "QtCore/qvariant.h" -#include "private/qguard_p.h" QT_BEGIN_NAMESPACE @@ -100,13 +99,12 @@ class Q_CORE_EXPORT QObjectPrivate : public QObjectData public: struct ExtraData { - ExtraData() : objectGuards(0) {} + ExtraData() {} #ifndef QT_NO_USERDATA QVector userData; #endif QList propertyNames; QList propertyValues; - QGuard *objectGuards; //linked list handle of QGuards }; struct Connection @@ -224,33 +222,6 @@ inline bool QObjectPrivate::isSignalConnected(uint signal_index) const } -inline void q_guard_addGuard(QGuard *g) -{ - QObjectPrivate *p = QObjectPrivate::get(g->o); - if (p->wasDeleted) { - qWarning("QGuard: cannot add guard to deleted object"); - g->o = 0; - return; - } - - if (!p->extraData) - p->extraData = new QObjectPrivate::ExtraData; - - g->next = p->extraData->objectGuards; - p->extraData->objectGuards = g; - g->prev = &p->extraData->objectGuards; - if (g->next) - g->next->prev = &g->next; -} - -inline void q_guard_removeGuard(QGuard *g) -{ - if (g->next) g->next->prev = g->prev; - *g->prev = g->next; - g->next = 0; - g->prev = 0; -} - Q_DECLARE_TYPEINFO(QObjectPrivate::Connection, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(QObjectPrivate::Sender, Q_MOVABLE_TYPE); -- cgit v0.12 From e69e397cee5ac1ce1bd6a1bca559e5607bb4258a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 27 Mar 2010 08:33:48 +0100 Subject: Autotests: oops, remove last traces of QGuard --- .../tst_qdeclarativeproperty.cpp | 137 ++++---- tests/auto/qguard/qguard.pro | 2 - tests/auto/qguard/tst_qguard.cpp | 350 --------------------- 3 files changed, 68 insertions(+), 421 deletions(-) delete mode 100644 tests/auto/qguard/qguard.pro delete mode 100644 tests/auto/qguard/tst_qguard.cpp diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index 56166f2..7d51bb6 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -138,9 +137,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty() { QDeclarativeProperty prop; - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -169,10 +168,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -234,9 +233,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() { QDeclarativeProperty prop(&object); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -265,10 +264,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -279,10 +278,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() { QDeclarativeProperty prop(&dobject); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -312,11 +311,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, ":-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -333,9 +332,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&object, QString("defaultProperty")); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -364,10 +363,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -378,10 +377,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&dobject, QString("defaultProperty")); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -411,11 +410,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, ":-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -426,10 +425,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&dobject, QString("onClicked")); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -458,12 +457,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -473,10 +472,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() { QDeclarativeProperty prop(&dobject, QString("onPropertyWithNotifyChanged")); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -505,12 +504,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -526,9 +525,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() { QDeclarativeProperty prop(&object, engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -557,10 +556,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -571,10 +570,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() { QDeclarativeProperty prop(&dobject, engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -604,11 +603,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, ":-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -625,9 +624,9 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&object, QString("defaultProperty"), engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -656,10 +655,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -670,10 +669,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&dobject, QString("defaultProperty"), engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -703,11 +702,11 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, ":-1: Unable to assign null to int"); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding != 0); - QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data()); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression == 0); QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -718,10 +717,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&dobject, QString("onClicked"), engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -750,12 +749,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); @@ -765,10 +764,10 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() { QDeclarativeProperty prop(&dobject, QString("onPropertyWithNotifyChanged"), engine.rootContext()); - QGuard binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); - binding->setTarget(prop); + QWeakPointer binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding.data()->setTarget(prop); QVERIFY(binding != 0); - QGuard expression(new QDeclarativeExpression()); + QWeakPointer expression(new QDeclarativeExpression()); QVERIFY(expression != 0); QObject *obj = new QObject; @@ -797,12 +796,12 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0); QVERIFY(binding == 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); - QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression.data()) == 0); QVERIFY(expression != 0); - QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression.data()); QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); diff --git a/tests/auto/qguard/qguard.pro b/tests/auto/qguard/qguard.pro deleted file mode 100644 index f249dde..0000000 --- a/tests/auto/qguard/qguard.pro +++ /dev/null @@ -1,2 +0,0 @@ -load(qttest_p4) -SOURCES += tst_qguard.cpp diff --git a/tests/auto/qguard/tst_qguard.cpp b/tests/auto/qguard/tst_qguard.cpp deleted file mode 100644 index 465ad0e..0000000 --- a/tests/auto/qguard/tst_qguard.cpp +++ /dev/null @@ -1,350 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// NOTE: This is identical to the QPointer autotest - -#include - -#include -#include -#include -#include - -class tst_QGuard : public QObject -{ - Q_OBJECT -public: - tst_QGuard(); - ~tst_QGuard(); - - inline tst_QGuard *me() const - { return const_cast(this); } - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); -private slots: - void constructors(); - void destructor(); - void assignment_operators(); - void equality_operators(); - void isNull(); - void dereference_operators(); - void disconnect(); - void castDuringDestruction(); - void data() const; - void dataSignature() const; -}; - -tst_QGuard::tst_QGuard() -{ } - -tst_QGuard::~tst_QGuard() -{ } - -void tst_QGuard::initTestCase() -{ } - -void tst_QGuard::cleanupTestCase() -{ } - -void tst_QGuard::init() -{ } - -void tst_QGuard::cleanup() -{ } - -void tst_QGuard::constructors() -{ - QGuard p1; - QGuard p2(this); - QGuard p3(p2); - QCOMPARE(p1, QGuard(0)); - QCOMPARE(p2, QGuard(this)); - QCOMPARE(p3, QGuard(this)); -} - -void tst_QGuard::destructor() -{ - QObject *object = new QObject; - QGuard p = object; - QCOMPARE(p, QGuard(object)); - delete object; - QCOMPARE(p, QGuard(0)); -} - -void tst_QGuard::assignment_operators() -{ - QGuard p1; - QGuard p2; - - p1 = this; - p2 = p1; - - QCOMPARE(p1, QGuard(this)); - QCOMPARE(p2, QGuard(this)); - QCOMPARE(p1, QGuard(p2)); - - p1 = 0; - p2 = p1; - QCOMPARE(p1, QGuard(0)); - QCOMPARE(p2, QGuard(0)); - QCOMPARE(p1, QGuard(p2)); - - QObject *object = new QObject; - - p1 = object; - p2 = p1; - QCOMPARE(p1, QGuard(object)); - QCOMPARE(p2, QGuard(object)); - QCOMPARE(p1, QGuard(p2)); - - delete object; - QCOMPARE(p1, QGuard(0)); - QCOMPARE(p2, QGuard(0)); - QCOMPARE(p1, QGuard(p2)); -} - -void tst_QGuard::equality_operators() -{ - QGuard p1; - QGuard p2; - - QVERIFY(p1 == p2); - - QObject *object = 0; - QWidget *widget = 0; - - p1 = object; - QVERIFY(p1 == p2); - QVERIFY(p1 == object); - p2 = object; - QVERIFY(p2 == p1); - QVERIFY(p2 == object); - - p1 = this; - QVERIFY(p1 != p2); - p2 = p1; - QVERIFY(p1 == p2); - - // compare to zero - p1 = 0; - QVERIFY(p1 == 0); - QVERIFY(0 == p1); - QVERIFY(p2 != 0); - QVERIFY(0 != p2); - QVERIFY(p1 == object); - QVERIFY(object == p1); - QVERIFY(p2 != object); - QVERIFY(object != p2); - QVERIFY(p1 == widget); - QVERIFY(widget == p1); - QVERIFY(p2 != widget); - QVERIFY(widget != p2); -} - -void tst_QGuard::isNull() -{ - QGuard p1; - QVERIFY(p1.isNull()); - p1 = this; - QVERIFY(!p1.isNull()); - p1 = 0; - QVERIFY(p1.isNull()); -} - -void tst_QGuard::dereference_operators() -{ - QGuard p1 = this; - - QObject *object = p1->me(); - QVERIFY(object == this); - - QObject &ref = *p1; - QVERIFY(&ref == this); - - object = static_cast(p1); - QVERIFY(object == this); -} - -void tst_QGuard::disconnect() -{ - QGuard p1 = new QObject; - QVERIFY(!p1.isNull()); - p1->disconnect(); - QVERIFY(!p1.isNull()); - delete static_cast(p1); - QVERIFY(p1.isNull()); -} - -class ChildObject : public QObject -{ - QGuard guardedPointer; - -public: - ChildObject(QObject *parent) - : QObject(parent), guardedPointer(parent) - { } - ~ChildObject(); -}; - -ChildObject::~ChildObject() -{ - QCOMPARE(static_cast(guardedPointer), static_cast(0)); - QCOMPARE(qobject_cast(guardedPointer), static_cast(0)); -} - -class ChildWidget : public QWidget -{ - QGuard guardedPointer; - -public: - ChildWidget(QWidget *parent) - : QWidget(parent), guardedPointer(parent) - { } - ~ChildWidget(); -}; - -ChildWidget::~ChildWidget() -{ - QCOMPARE(static_cast(guardedPointer), static_cast(0)); - QCOMPARE(qobject_cast(guardedPointer), static_cast(0)); -} - -class DerivedChild; - -class DerivedParent : public QObject -{ - Q_OBJECT - - DerivedChild *derivedChild; - -public: - DerivedParent(); - ~DerivedParent(); -}; - -class DerivedChild : public QObject -{ - Q_OBJECT - - DerivedParent *parentPointer; - QGuard guardedParentPointer; - -public: - DerivedChild(DerivedParent *parent) - : QObject(parent), parentPointer(parent), guardedParentPointer(parent) - { } - ~DerivedChild(); -}; - -DerivedParent::DerivedParent() - : QObject() -{ - derivedChild = new DerivedChild(this); -} - -DerivedParent::~DerivedParent() -{ - delete derivedChild; -} - -DerivedChild::~DerivedChild() -{ - QCOMPARE(static_cast(guardedParentPointer), parentPointer); - QCOMPARE(qobject_cast(guardedParentPointer), parentPointer); -} - -void tst_QGuard::castDuringDestruction() -{ - { - QObject *parentObject = new QObject(); - (void) new ChildObject(parentObject); - delete parentObject; - } - - { - QWidget *parentWidget = new QWidget(); - (void) new ChildWidget(parentWidget); - delete parentWidget; - } - - { - delete new DerivedParent(); - } -} - -void tst_QGuard::data() const -{ - /* Check value of a default constructed object. */ - { - QGuard p; - QCOMPARE(p.data(), static_cast(0)); - } - - /* Check value of a default constructed object. */ - { - QObject *const object = new QObject(); - QGuard p(object); - QCOMPARE(p.data(), object); - } -} - -void tst_QGuard::dataSignature() const -{ - /* data() should be const. */ - { - const QGuard p; - p.data(); - } - - /* The return type should be T. */ - { - const QGuard p; - /* If the types differs, the QCOMPARE will fail to instansiate. */ - QCOMPARE(p.data(), static_cast(0)); - } -} - -QTEST_MAIN(tst_QGuard) -#include "tst_qguard.moc" -- cgit v0.12 From caada5afef099b0ba7ecedb8a08ef0ecc7b5802d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 27 Mar 2010 18:30:37 +0100 Subject: Autotest: oops, fix oops: remove qguard from auto.pro --- tests/auto/gui.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro index 10a760c..a8fd2b4 100644 --- a/tests/auto/gui.pro +++ b/tests/auto/gui.pro @@ -78,7 +78,6 @@ SUBDIRS=\ qgraphicswidget \ qgridlayout \ qgroupbox \ - qguard \ qguivariant \ qheaderview \ qhelpcontentmodel \ -- cgit v0.12 From dcb055cde3a8d31e52a2d2143f14ca8662859541 Mon Sep 17 00:00:00 2001 From: John Brooks Date: Sat, 27 Mar 2010 11:35:27 -0600 Subject: Trivial fix to JavaScriptCore to fix building with MSVC 2010 Reviewed-By: Thiago Macieira --- .../javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h | 4 ++-- src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h index 35fb7e4..2ecf0d3 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h @@ -143,14 +143,14 @@ namespace JSC { if (!specificValue) { TransitionTable::iterator find = table()->find(key); if (find == table()->end()) - table()->add(key, Transition(structure, 0)); + table()->add(key, Transition(structure, (Structure*)0)); else find->second.first = structure; } else { // If we're adding a transition to a specific value, then there cannot be // an existing transition ASSERT(!table()->contains(key)); - table()->add(key, Transition(0, structure)); + table()->add(key, Transition((Structure*)0, structure)); } } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h index 0fa7b73..f39560a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h @@ -143,14 +143,14 @@ namespace JSC { if (!specificValue) { TransitionTable::iterator find = table()->find(key); if (find == table()->end()) - table()->add(key, Transition(structure, 0)); + table()->add(key, Transition(structure, (Structure*)0)); else find->second.first = structure; } else { // If we're adding a transition to a specific value, then there cannot be // an existing transition ASSERT(!table()->contains(key)); - table()->add(key, Transition(0, structure)); + table()->add(key, Transition((Structure*)0, structure)); } } -- cgit v0.12 From a078587d6a0a3fc514d5395984b0c6e2efa76e9d Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Sun, 28 Mar 2010 21:22:11 +0200 Subject: Fixed a typo in the QDoubleValidotor doc. Reviewed-by: trustme --- src/gui/widgets/qvalidator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qvalidator.cpp b/src/gui/widgets/qvalidator.cpp index 0b5cc5a..b75db45 100644 --- a/src/gui/widgets/qvalidator.cpp +++ b/src/gui/widgets/qvalidator.cpp @@ -523,7 +523,7 @@ public: In addition, QDoubleValidator is always guaranteed to accept a number formatted according to the "C" locale. QDoubleValidator will not accept - numbers with thousand-seperators. + numbers with thousand-separators. \sa QIntValidator, QRegExpValidator, {Line Edits Example} */ -- cgit v0.12 From 1eb54209adca3ed93426598c1dcf51ca4ba675be Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 29 Mar 2010 13:34:36 +0200 Subject: QNAM HTTP: Fix invoking a method when being destructed right now Reviewed-by: Thiago Macieira --- src/network/access/qhttpnetworkconnectionchannel.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 1d8224c..0b97cbe 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -648,7 +648,8 @@ void QHttpNetworkConnectionChannel::allDone() close(); QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } else if (alreadyPipelinedRequests.isEmpty()) { - QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + if (qobject_cast(connection)) + QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } } @@ -753,7 +754,8 @@ void QHttpNetworkConnectionChannel::handleStatus() } break; default: - QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + if (qobject_cast(connection)) + QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } } @@ -801,7 +803,8 @@ void QHttpNetworkConnectionChannel::closeAndResendCurrentRequest() requeueCurrentlyPipelinedRequests(); close(); resendCurrent = true; - QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + if (qobject_cast(connection)) + QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } bool QHttpNetworkConnectionChannel::isSocketBusy() const -- cgit v0.12 From 0e73e97548be067035dd5038b329abd50ecb3bf3 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 29 Mar 2010 14:22:43 +0200 Subject: Support EtchDisabledText with spin box on Windows style Reviewed-by: ogoffart Task-number: QTBUG-7525 --- src/gui/styles/qwindowsstyle.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 60c06ca..1653baa 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -3105,7 +3105,9 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On), ©.palette.brush(QPalette::Button)); copy.rect.adjust(4, 1, -5, -1); - if (!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) ) { + if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) + && proxy()->styleHint(SH_EtchDisabledText, opt, widget) ) + { QStyleOptionSpinBox lightCopy = copy; lightCopy.rect.adjust(1, 1, 1, 1); lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light()); @@ -3138,7 +3140,9 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On), ©.palette.brush(QPalette::Button)); copy.rect.adjust(4, 0, -5, -1); - if (!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) ) { + if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) + && proxy()->styleHint(SH_EtchDisabledText, opt, widget) ) + { QStyleOptionSpinBox lightCopy = copy; lightCopy.rect.adjust(1, 1, 1, 1); lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light()); -- cgit v0.12 From e1a1c2336c7344736f072bc29573662f6cb85f3e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 29 Mar 2010 14:46:05 +0200 Subject: scan some more file types by default - java & jui - js, qs & qml Task-number: QTBUG-9429 --- tools/linguist/lupdate/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 0003baa..e252780 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -409,7 +409,7 @@ static void processProjects( int main(int argc, char **argv) { QCoreApplication app(argc, argv); - m_defaultExtensions = QLatin1String("ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx"); + m_defaultExtensions = QLatin1String("java,jui,ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx,js,qs,qml"); QStringList args = app.arguments(); QStringList tsFileNames; -- cgit v0.12 From 5daac41683e679d869c586e8bdf9f184fd1e3557 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 29 Mar 2010 14:46:16 +0200 Subject: jui files are no c++ ... --- tools/linguist/lupdate/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index e252780..6c9157a 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -634,6 +634,7 @@ int main(int argc, char **argv) sourceFiles << fn; if (!fn.endsWith(QLatin1String(".java")) + && !fn.endsWith(QLatin1String(".jui")) && !fn.endsWith(QLatin1String(".ui")) && !fn.endsWith(QLatin1String(".js")) && !fn.endsWith(QLatin1String(".qs")) -- cgit v0.12 From 97b2272e91e25418f63328c681cef54bdc1e43ff Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Mar 2010 14:06:12 +0200 Subject: Update PLATFORM(SPARC64) to CPU(SPARC64) --- src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h index 5b655e8..85c8743 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h @@ -239,7 +239,7 @@ inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Bar inline int atomicIncrement(int volatile* addend) { return android_atomic_inc(addend); } inline int atomicDecrement(int volatile* addend) { return android_atomic_dec(addend); } -#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !defined(__SYMBIAN32__) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc +#elif COMPILER(GCC) && !CPU(SPARC64) && !defined(__SYMBIAN32__) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; } -- cgit v0.12 From cc5ae1831e54702f7bb8477ab3b14ab9832c064c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Mar 2010 14:25:16 +0200 Subject: Ensure that we return QPair in all cases. Fixes a compilation failure on AIX. Reviewed-By: Marius Storm-Olsen --- src/corelib/tools/qelapsedtimer_unix.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp index 85d7fa8..1a7bc71 100644 --- a/src/corelib/tools/qelapsedtimer_unix.cpp +++ b/src/corelib/tools/qelapsedtimer_unix.cpp @@ -97,19 +97,19 @@ static inline QPair do_gettime() #if (_POSIX_MONOTONIC_CLOCK-0 > 0) timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return qMakePair(ts.tv_sec, ts.tv_nsec); + return qMakePair(ts.tv_sec, ts.tv_nsec); #else # if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) if (QElapsedTimer::isMonotonic()) { timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return qMakePair(ts.tv_sec, ts.tv_nsec); + return qMakePair(ts.tv_sec, ts.tv_nsec); } # endif // use gettimeofday timeval tv; ::gettimeofday(&tv, 0); - return qMakePair(tv.tv_sec, tv.tv_usec); + return qMakePair(tv.tv_sec, tv.tv_usec); #endif } -- cgit v0.12 From 1a6d4970793f0696bf54a85346a12e83b6d03013 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Mar 2010 14:29:09 +0200 Subject: Fix compilation with Sun CC: "node.cpp", line 1337: Error: There is extra text on this line. Reviewed-by: Trust Me --- tools/qdoc3/node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index bd37443..ef75f6e 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1334,7 +1334,7 @@ QString QmlClassNode::fileBase() const void QmlClassNode::addInheritedBy(const QString& base, Node* sub) { inheritedBy.insert(base,sub); -#ifdef DEBUG_MULTIPLE-QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES qDebug() << "QmlClassNode::addInheritedBy(): insert" << base << sub->name() << inheritedBy.size(); #endif } -- cgit v0.12 From ec0fe5bb327f2533dcbb35855ca0d2a7f9a85581 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Mar 2010 15:10:14 +0200 Subject: Fix compilation on HP-UXi: _SC_MONOTONIC_CLOCK isn't defined Reviewed-by: Trust Me --- src/corelib/tools/qelapsedtimer_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp index 1a7bc71..2c4ea58 100644 --- a/src/corelib/tools/qelapsedtimer_unix.cpp +++ b/src/corelib/tools/qelapsedtimer_unix.cpp @@ -74,7 +74,7 @@ bool QElapsedTimer::isMonotonic() static int returnValue = 0; if (returnValue == 0) { -# if (_POSIX_MONOTONIC_CLOCK-0 < 0) +# if (_POSIX_MONOTONIC_CLOCK-0 < 0) || !defined(_SC_MONOTONIC_CLOCK) returnValue = -1; # elif (_POSIX_MONOTONIC_CLOCK == 0) // detect if the system support monotonic timers -- cgit v0.12 From b3eac3f43b087ee7939a607cd8a6e5ed398f6716 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 29 Mar 2010 16:22:52 +0200 Subject: Fix QComboBox ignoring foreground role in some styles Basically all styles using SH_Combobox_Popup would not previously respect the foreground role set. We need to set it for multiple color roles since styles sometimes interpret them differently. Reviewed-by: ogoffart Task-number: QTBUG-8796 --- src/gui/widgets/qcombobox.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index c16f18a..b1a27f2 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -108,7 +108,15 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt const QModelIndex &index) const { QStyleOptionMenuItem menuOption; - menuOption.palette = option.palette.resolve(QApplication::palette("QMenu")); + + QPalette resolvedpalette = option.palette.resolve(QApplication::palette("QMenu")); + QVariant value = index.data(Qt::ForegroundRole); + if (qVariantCanConvert(value)) { + resolvedpalette.setBrush(QPalette::WindowText, qvariant_cast(value)); + resolvedpalette.setBrush(QPalette::ButtonText, qvariant_cast(value)); + resolvedpalette.setBrush(QPalette::Text, qvariant_cast(value)); + } + menuOption.palette = resolvedpalette; menuOption.state = QStyle::State_None; if (mCombo->window()->isActiveWindow()) menuOption.state = QStyle::State_Active; -- cgit v0.12 From ffd4c014747f6842b9103d67204b5b54626bf876 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 29 Mar 2010 18:47:50 +0200 Subject: Do not override alternate background color in Plastique This palette tweak is no longer needed now that we set alternate row color on application startup. It also breaks on systems such as GNOME and KDE where you can configure this color. Reviewed-by: ogoffart Task-number: QTBUG-6516 --- src/gui/styles/qplastiquestyle.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 4ae9f79..fbb5e4d 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -5846,7 +5846,6 @@ void QPlastiqueStyle::polish(QApplication *app) void QPlastiqueStyle::polish(QPalette &pal) { QWindowsStyle::polish(pal); - pal.setBrush(QPalette::AlternateBase, pal.base().color().darker(110)); #ifdef Q_WS_MAC pal.setBrush(QPalette::Shadow, Qt::black); #endif -- cgit v0.12 From 0d7a0b1bf2ab50621ed662a3e178d2ad5add4114 Mon Sep 17 00:00:00 2001 From: Wolfgang Beck Date: Tue, 30 Mar 2010 11:53:42 +1000 Subject: MONILITY-645 Merging bearer header. --- src/network/bearer/qnetworkconfigmanager.h | 23 ++++++++++++++++----- src/network/bearer/qnetworkconfiguration.h | 30 ++++++++++++++++++++++------ src/network/bearer/qnetworksession.h | 28 +++++++++++++++++++------- src/plugins/bearer/nativewifi/platformdefs.h | 4 ++++ src/plugins/bearer/platformdefs_win.h | 4 ++++ 5 files changed, 71 insertions(+), 18 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index bb4d8a0..19951f8 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -42,17 +42,26 @@ #ifndef QNETWORKCONFIGURATIONMANAGER_H #define QNETWORKCONFIGURATIONMANAGER_H +#ifdef QT_MOBILITY_BEARER +# include "qmobilityglobal.h" +#endif + #include #include QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Network) +#ifndef QT_MOBILITY_BEARER + QT_BEGIN_NAMESPACE + #define QNetworkConfigurationManagerExport Q_NETWORK_EXPORT + QT_MODULE(Network) +#else + QTM_BEGIN_NAMESPACE + #define QNetworkConfigurationManagerExport Q_BEARER_EXPORT +#endif class QNetworkConfigurationManagerPrivate; -class Q_NETWORK_EXPORT QNetworkConfigurationManager : public QObject +class QNetworkConfigurationManagerExport QNetworkConfigurationManager : public QObject { Q_OBJECT @@ -94,7 +103,11 @@ Q_SIGNALS: Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkConfigurationManager::Capabilities) -QT_END_NAMESPACE +#ifndef QT_MOBILITY_BEARER + QT_END_NAMESPACE +#else + QTM_END_NAMESPACE +#endif QT_END_HEADER diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index dad6198..3b49d0a 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -42,19 +42,33 @@ #ifndef QNETWORKCONFIGURATION_H #define QNETWORKCONFIGURATION_H -#include +#ifndef QT_MOBILITY_BEARER +# include +#else +# include "qmobilityglobal.h" +#endif + #include #include #include -QT_BEGIN_HEADER +#if defined(Q_OS_WIN) && defined(interface) +#undef interface +#endif -QT_BEGIN_NAMESPACE +QT_BEGIN_HEADER -QT_MODULE(Network) +#ifndef QT_MOBILITY_BEARER + QT_BEGIN_NAMESPACE + QT_MODULE(Network) + #define QNetworkConfigurationExport Q_NETWORK_EXPORT +#else + QTM_BEGIN_NAMESPACE + #define QNetworkConfigurationExport Q_BEARER_EXPORT +#endif class QNetworkConfigurationPrivate; -class Q_NETWORK_EXPORT QNetworkConfiguration +class QNetworkConfigurationExport QNetworkConfiguration { public: QNetworkConfiguration(); @@ -108,7 +122,11 @@ private: QExplicitlySharedDataPointer d; }; -QT_END_NAMESPACE +#ifndef QT_MOBILITY_BEARER + QT_END_NAMESPACE +#else + QTM_END_NAMESPACE +#endif QT_END_HEADER diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 596f527..2681d1f 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -54,12 +54,19 @@ QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Network) +#ifndef QT_MOBILITY_BEARER + #include + QT_BEGIN_NAMESPACE + QT_MODULE(Network) + #define QNetworkSessionExport Q_NETWORK_EXPORT +#else + #include "qmobilityglobal.h" + QTM_BEGIN_NAMESPACE + #define QNetworkSessionExport Q_BEARER_EXPORT +#endif class QNetworkSessionPrivate; -class Q_NETWORK_EXPORT QNetworkSession : public QObject +class QNetworkSessionExport QNetworkSession : public QObject { Q_OBJECT public: @@ -80,8 +87,11 @@ public: OperationNotSupportedError, InvalidConfigurationError }; - - explicit QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); +#ifndef QT_MOBILITY_BEARER + QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); +#else + explicit QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); +#endif virtual ~QNetworkSession(); bool isOpen() const; @@ -131,7 +141,11 @@ private: friend class QNetworkSessionPrivate; }; -QT_END_NAMESPACE +#ifndef QT_MOBILITY_BEARER + QT_END_NAMESPACE +#else + QTM_END_NAMESPACE +#endif QT_END_HEADER diff --git a/src/plugins/bearer/nativewifi/platformdefs.h b/src/plugins/bearer/nativewifi/platformdefs.h index 57ae852..d67525a 100644 --- a/src/plugins/bearer/nativewifi/platformdefs.h +++ b/src/plugins/bearer/nativewifi/platformdefs.h @@ -52,6 +52,8 @@ #define WLAN_AVAILABLE_NETWORK_HAS_PROFILE 2 #define DOT11_SSID_MAX_LENGTH 32 +QT_BEGIN_NAMESPACE + struct WLAN_NOTIFICATION_DATA { DWORD NotificationSource; DWORD NotificationCode; @@ -319,4 +321,6 @@ extern WlanScanProto local_WlanScan; extern WlanFreeMemoryProto local_WlanFreeMemory; extern WlanCloseHandleProto local_WlanCloseHandle; +QT_END_NAMESPACE + #endif // PLATFORMDEFS_H diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h index 37d099c..1a10ba7 100644 --- a/src/plugins/bearer/platformdefs_win.h +++ b/src/plugins/bearer/platformdefs_win.h @@ -47,6 +47,8 @@ #undef interface #include +QT_BEGIN_NAMESPACE + #ifndef NS_NLA #define NS_NLA 15 @@ -131,4 +133,6 @@ enum NDIS_PHYSICAL_MEDIUM { #define IOCTL_NDIS_QUERY_GLOBAL_STATS \ CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, 0, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) +QT_END_NAMESPACE + #endif -- cgit v0.12 From b353f98da10f4b8b80f6be70951f147d580999e8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 30 Mar 2010 14:33:12 +1000 Subject: Fix compile error on mingw. Compile error seems to be going back and forth between mingw and wince compilers. Prefer correctness and portability over brevity by initializing each field of the struct one-by-one to guarantee portability between compilers. Reviewed-by: Lincoln Ramsay --- src/corelib/io/qwindowspipewriter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp index eb42c20..3eb2411 100644 --- a/src/corelib/io/qwindowspipewriter.cpp +++ b/src/corelib/io/qwindowspipewriter.cpp @@ -100,7 +100,10 @@ qint64 QWindowsPipeWriter::write(const char *ptr, qint64 maxlen) void QWindowsPipeWriter::run() { - OVERLAPPED overl = {0, 0, {{ 0 }}, 0}; + OVERLAPPED overl; + overl.Internal = 0; + overl.InternalHigh = 0; + overl.Pointer = 0; overl.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); forever { lock.lock(); -- cgit v0.12 From 2d9260e863ff2e3a5bb77d37b2b9b90072bce825 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 30 Mar 2010 13:03:10 +0200 Subject: qdoc: Added
elements to some html output for class references. Task: QTBUG-9504 --- tools/qdoc3/codemarker.cpp | 2 +- tools/qdoc3/codemarker.h | 24 +++++++++++--- tools/qdoc3/cppcodemarker.cpp | 76 ++++++++++++++++++++++++++++--------------- tools/qdoc3/htmlgenerator.cpp | 8 ++++- tools/qdoc3/qscodemarker.cpp | 18 +++++----- 5 files changed, 86 insertions(+), 42 deletions(-) diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index 15f2c2d..818a91f 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -457,7 +457,7 @@ bool CodeMarker::insertReimpFunc(FastSection& fs, Node* node, Status status) void CodeMarker::append(QList
& sectionList, const FastSection& fs) { if (!fs.isEmpty()) { - Section section(fs.name,fs.singularMember,fs.pluralMember); + Section section(fs.name,fs.divClass,fs.singularMember,fs.pluralMember); section.members = fs.memberMap.values(); section.reimpMembers = fs.reimpMemberMap.values(); section.inherited = fs.inherited; diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index 1b21753..aab8a9c 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -58,6 +58,7 @@ class Tree; struct Section { QString name; + QString divClass; QString singularMember; QString pluralMember; NodeList members; @@ -66,9 +67,11 @@ struct Section Section() { } Section(const QString& name0, + const QString& divClass0, const QString& singularMember0, const QString& pluralMember0) - : name(name0), + : name(name0), + divClass(divClass0), singularMember(singularMember0), pluralMember(pluralMember0) { } void appendMember(Node* node) { members.append(node); } @@ -79,6 +82,7 @@ struct FastSection { const InnerNode *innerNode; QString name; + QString divClass; QString singularMember; QString pluralMember; QMap memberMap; @@ -86,20 +90,30 @@ struct FastSection QList > inherited; FastSection(const InnerNode *innerNode0, - const QString& name0 = "", - const QString& singularMember0 = "member", - const QString& pluralMember0 = "members") + const QString& name0, + const QString& divClass0, + const QString& singularMember0, + const QString& pluralMember0) : innerNode(innerNode0), name(name0), + divClass(divClass0), singularMember(singularMember0), pluralMember(pluralMember0) { } bool isEmpty() const { - return (memberMap.isEmpty() && inherited.isEmpty() && + return (memberMap.isEmpty() && + inherited.isEmpty() && reimpMemberMap.isEmpty()); } }; +#if 0 + const QString& name0 = "", + const QString& divClass0 = "", + const QString& singularMember0 = "member", + const QString& pluralMember0 = "members") +#endif + class CodeMarker { public: diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 3ff6ebe..c4ee054 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -482,55 +482,66 @@ QList
CppCodeMarker::sections(const InnerNode *inner, if (style == Summary) { FastSection privateFunctions(classe, "Private Functions", + "", "private function", "private functions"); - FastSection privateSlots(classe, "Private Slots", "private slot", "private slots"); - FastSection privateTypes(classe, "Private Types", "private type", "private types"); + FastSection privateSlots(classe, "Private Slots", "", "private slot", "private slots"); + FastSection privateTypes(classe, "Private Types", "", "private type", "private types"); FastSection protectedFunctions(classe, "Protected Functions", + "", "protected function", "protected functions"); FastSection protectedSlots(classe, "Protected Slots", + "", "protected slot", "protected slots"); FastSection protectedTypes(classe, "Protected Types", + "", "protected type", "protected types"); FastSection protectedVariables(classe, "Protected Variables", + "", "protected type", "protected variables"); FastSection publicFunctions(classe, "Public Functions", + "", "public function", "public functions"); - FastSection publicSignals(classe, "Signals", "signal", "signals"); - FastSection publicSlots(classe, "Public Slots", "public slot", "public slots"); - FastSection publicTypes(classe, "Public Types", "public type", "public types"); + FastSection publicSignals(classe, "Signals", "", "signal", "signals"); + FastSection publicSlots(classe, "Public Slots", "", "public slot", "public slots"); + FastSection publicTypes(classe, "Public Types", "", "public type", "public types"); FastSection publicVariables(classe, "Public Variables", - "public type", + "", + "public variable", "public variables"); - FastSection properties(classe, "Properties", "property", "properties"); + FastSection properties(classe, "Properties", "", "property", "properties"); FastSection relatedNonMembers(classe, "Related Non-Members", + "", "related non-member", "related non-members"); FastSection staticPrivateMembers(classe, "Static Private Members", + "", "static private member", "static private members"); FastSection staticProtectedMembers(classe, "Static Protected Members", + "", "static protected member", "static protected members"); FastSection staticPublicMembers(classe, "Static Public Members", + "", "static public member", "static public members"); - FastSection macros(inner, "Macros", "macro", "macros"); + FastSection macros(inner, "Macros", "", "macro", "macros"); NodeList::ConstIterator r = classe->relatedNodes().begin(); while (r != classe->relatedNodes().end()) { @@ -666,12 +677,12 @@ QList
CppCodeMarker::sections(const InnerNode *inner, append(sections, macros); } else if (style == Detailed) { - FastSection memberFunctions(classe,"Member Function Documentation"); - FastSection memberTypes(classe,"Member Type Documentation"); - FastSection memberVariables(classe,"Member Variable Documentation"); - FastSection properties(classe,"Property Documentation"); - FastSection relatedNonMembers(classe,"Related Non-Members"); - FastSection macros(classe,"Macro Documentation"); + FastSection memberFunctions(classe,"Member Function Documentation","func","member","members"); + FastSection memberTypes(classe,"Member Type Documentation","types","member","members"); + FastSection memberVariables(classe,"Member Variable Documentation","vars","member","members"); + FastSection properties(classe,"Property Documentation","prop","member","members"); + FastSection relatedNonMembers(classe,"Related Non-Members","relnonmem","member","members"); + FastSection macros(classe,"Macro Documentation","macros","member","members"); NodeList::ConstIterator r = classe->relatedNodes().begin(); while (r != classe->relatedNodes().end()) { @@ -717,7 +728,7 @@ QList
CppCodeMarker::sections(const InnerNode *inner, append(sections, macros); } else { - FastSection all(classe); + FastSection all(classe,"","","member","members"); QStack stack; stack.push(classe); @@ -747,25 +758,29 @@ QList
CppCodeMarker::sections(const InnerNode *inner, if (style == Summary || style == Detailed) { FastSection namespaces(inner, "Namespaces", + style == Detailed ? "nmspace" : "", "namespace", "namespaces"); FastSection classes(inner, "Classes", + style == Detailed ? "classes" : "", "class", "classes"); FastSection types(inner, - style == Summary ? - "Types" : "Type Documentation", + style == Summary ? "Types" : "Type Documentation", + style == Detailed ? "types" : "", "type", "types"); FastSection functions(inner, style == Summary ? "Functions" : "Function Documentation", + style == Detailed ? "func" : "", "function", "functions"); FastSection macros(inner, style == Summary ? "Macros" : "Macro Documentation", + style == Detailed ? "macros" : "", "macro", "macros"); @@ -1116,26 +1131,32 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, if (style == Summary) { FastSection qmlproperties(qmlClassNode, "Properties", + "", "property", "properties"); FastSection qmlattachedproperties(qmlClassNode, "Attached Properties", + "", "property", "properties"); FastSection qmlsignals(qmlClassNode, - "Signals", - "signal", - "signals"); + "Signals", + "", + "signal", + "signals"); FastSection qmlattachedsignals(qmlClassNode, "Attached Signals", + "", "signal", "signals"); FastSection qmlmethods(qmlClassNode, "Methods", + "", "method", "methods"); FastSection qmlattachedmethods(qmlClassNode, "Attached Methods", + "", "method", "methods"); @@ -1179,12 +1200,15 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, append(sections,qmlattachedmethods); } else if (style == Detailed) { - FastSection qmlproperties(qmlClassNode, "Property Documentation"); - FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation"); - FastSection qmlsignals(qmlClassNode,"Signal Documentation"); - FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation"); - FastSection qmlmethods(qmlClassNode,"Method Documentation"); - FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation"); + FastSection qmlproperties(qmlClassNode, "Property Documentation","qmlprop","member","members"); + FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation","qmlattprop", + "member","members"); + FastSection qmlsignals(qmlClassNode,"Signal Documentation","qmlsig","member","members"); + FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation","qmlattsig", + "member","members"); + FastSection qmlmethods(qmlClassNode,"Method Documentation","qmlmeth","member","members"); + FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation","qmlattmeth", + "member","members"); NodeList::ConstIterator c = qmlClassNode->childNodes().begin(); while (c != qmlClassNode->childNodes().end()) { if ((*c)->subType() == Node::QmlPropertyGroup) { diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index cd3da3e..fb9fa95 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -696,7 +696,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, QList
sections; QList
::ConstIterator s; for (int i=0; idoc().isEmpty()) { out() << "
\n" + << "
\n" << "

" << "Detailed Description" << "

\n"; generateBody(inner, marker); + out() << "
\n"; generateAlsoList(inner, marker); } @@ -1365,6 +1367,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, s = sections.begin(); while (s != sections.end()) { out() << "
\n"; + if (!(*s).divClass.isEmpty()) + out() << "
\n"; out() << "

" << protectEnc((*s).name) << "

\n"; NodeList::ConstIterator m = (*s).members.begin(); @@ -1414,6 +1418,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, } ++m; } + if (!(*s).divClass.isEmpty()) + out() << "
\n"; ++s; } generateFooter(inner); diff --git a/tools/qdoc3/qscodemarker.cpp b/tools/qdoc3/qscodemarker.cpp index 89c9c5c..d4b8e80 100644 --- a/tools/qdoc3/qscodemarker.cpp +++ b/tools/qdoc3/qscodemarker.cpp @@ -279,11 +279,11 @@ QList
QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle sty const ClassNode *classe = static_cast(inner); if ( style == Summary ) { - FastSection enums(classe, "Enums", "enum", "enums"); - FastSection functions(classe, "Functions", "function", "functions"); - FastSection readOnlyProperties(classe, "Read-Only Properties", "property", "properties"); - FastSection signalz(classe, "Signals", "signal", "signals"); - FastSection writableProperties(classe, "Writable Properties", "property", "properties"); + FastSection enums(classe, "Enums", "", "enum", "enums"); + FastSection functions(classe, "Functions", "", "function", "functions"); + FastSection readOnlyProperties(classe, "", "Read-Only Properties", "property", "properties"); + FastSection signalz(classe, "Signals", "", "signal", "signals"); + FastSection writableProperties(classe, "", "Writable Properties", "property", "properties"); QStack stack; stack.push( classe ); @@ -328,9 +328,9 @@ QList
QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle sty append( sections, functions ); append( sections, signalz ); } else if ( style == Detailed ) { - FastSection enums( classe, "Enum Documentation" ); - FastSection functionsAndSignals( classe, "Function and Signal Documentation" ); - FastSection properties( classe, "Property Documentation" ); + FastSection enums( classe, "Enum Documentation", "", "member", "members"); + FastSection functionsAndSignals( classe, "Function and Signal Documentation", "", "member", "members"); + FastSection properties( classe, "Property Documentation", "", "member", "members"); NodeList::ConstIterator c = classe->childNodes().begin(); while ( c != classe->childNodes().end() ) { @@ -349,7 +349,7 @@ QList
QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle sty append( sections, properties ); append( sections, functionsAndSignals ); } else { // ( style == SeparateList ) - FastSection all( classe ); + FastSection all(classe, "", "", "member", "members"); QStack stack; stack.push( classe ); -- cgit v0.12