From 6f69f40b7bf8b638444b72aea4565611c0db4dc9 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Mon, 1 Mar 2010 12:58:30 +0100 Subject: Updated syncqt to use relative include paths on cygwin as well. Reviewed-by: TrustMe --- bin/syncqt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/syncqt b/bin/syncqt index 6fb21dd..be4af2a 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -356,12 +356,13 @@ sub fixPaths { #setup my $ret = $file; + $ret =~ s,/cygdrive/([a-zA-Z])/,$1:/,g; my $file_dir = dirname($file); if($file_dir eq ".") { $file_dir = getcwd(); $file_dir =~ s=\\=/=g; } - $file_dir =~ s,/cygdrive/([a-zA-Z])/,$1:,g; + $file_dir =~ s,/cygdrive/([a-zA-Z])/,$1:/,g; if($dir eq ".") { $dir = getcwd(); $dir =~ s=\\=/=g; -- cgit v0.12 From c14e9bb7d8bb86129983df96dc5f8926190f5b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Mon, 1 Mar 2010 13:35:50 +0100 Subject: doc: Fixed building documentation qml.qdocconf wasn't renamed yet. --- tools/qdoc3/test/qdeclarative.qdocconf | 80 ++++++++++++++++++++++++++++++++++ tools/qdoc3/test/qml.qdocconf | 80 ---------------------------------- 2 files changed, 80 insertions(+), 80 deletions(-) create mode 100644 tools/qdoc3/test/qdeclarative.qdocconf delete mode 100644 tools/qdoc3/test/qml.qdocconf diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf new file mode 100644 index 0000000..3b5d8dc --- /dev/null +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -0,0 +1,80 @@ +include(compat.qdocconf) +include(macros.qdocconf) +include(qt-cpp-ignore.qdocconf) +include(qt-html-templates.qdocconf) +include(qt-defines.qdocconf) + +project = Qml +description = Qml Reference Documentation +url = http://doc.qtsoftware.com/4.6 +qmlonly = true + +edition.Console.modules = QtCore QtDBus QtNetwork QtScript QtSql QtXml \ + QtXmlPatterns QtTest +edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtSql QtSvg \ + QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \ + QtDesigner QtAssistant QAxContainer Phonon \ + QAxServer QtUiTools QtTest QtDBus +edition.DesktopLight.modules = QtCore QtDBus QtGui Qt3SupportLight QtTest +edition.DesktopLight.groups = -graphicsview-api + +qhp.projects = Qml + +qhp.Qml.file = qml.qhp +qhp.Qml.namespace = com.trolltech.qml.460 +qhp.Qml.virtualFolder = qdoc +qhp.Qml.indexTitle = Qml Reference + +# Files not referenced in any qdoc file +# See also extraimages.HTML +qhp.Qml.extraFiles = classic.css \ + images/qt-logo.png + +qhp.Qml.filterAttributes = qt 4.6.0 qtrefdoc +qhp.Qml.customFilters.Qt.name = Qt 4.6.0 +qhp.Qml.customFilters.Qt.filterAttributes = qt 4.6.0 +qhp.Qml.subprojects = classes +qhp.Qml.subprojects.classes.title = Elements +qhp.Qml.subprojects.classes.indexTitle = Qml Elements +qhp.Qml.subprojects.classes.selectors = fake:qmlclass +qhp.Qml.subprojects.classes.sortPages = true + +language = Cpp + +headerdirs = $QT_SOURCE_TREE/src/declarative +sourcedirs = $QT_SOURCE_TREE/src/declarative \ + $QT_SOURCE_TREE/doc/src/declarative + +sources += $QT_SOURCE_TREE/doc/src/tutorials/declarative.qdoc + +sources.fileextensions = "*.cpp *.qdoc" +examples.fileextensions = "*.cpp *.h *.js *.qml" + +exampledirs = $QT_SOURCE_TREE/doc/src \ + $QT_SOURCE_TREE/examples \ + $QT_SOURCE_TREE/examples/tutorials \ + $QT_SOURCE_TREE \ + $QT_SOURCE_TREE/qmake/examples \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs +imagedirs = $QT_SOURCE_TREE/doc/src/images \ + $QT_SOURCE_TREE/examples \ + $QT_SOURCE_TREE/doc/src/declarative/pics +outputdir = $QT_BUILD_TREE/doc-build/html-qml +tagfile = $QT_BUILD_TREE/doc-build/html-qml/qt.tags +base = file:$QT_BUILD_TREE/doc/html-qml + +HTML.stylesheets = classic.css + +HTML.postheader = "\n" \ + "\n" \ + "\n" \ + "" \ + "\n" \ + "
" \ + "" \ + "  " \ + "" \ + "Home ·" \ + " " \ + "Elements" \ + "
" diff --git a/tools/qdoc3/test/qml.qdocconf b/tools/qdoc3/test/qml.qdocconf deleted file mode 100644 index 3b5d8dc..0000000 --- a/tools/qdoc3/test/qml.qdocconf +++ /dev/null @@ -1,80 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-html-templates.qdocconf) -include(qt-defines.qdocconf) - -project = Qml -description = Qml Reference Documentation -url = http://doc.qtsoftware.com/4.6 -qmlonly = true - -edition.Console.modules = QtCore QtDBus QtNetwork QtScript QtSql QtXml \ - QtXmlPatterns QtTest -edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtSql QtSvg \ - QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \ - QtDesigner QtAssistant QAxContainer Phonon \ - QAxServer QtUiTools QtTest QtDBus -edition.DesktopLight.modules = QtCore QtDBus QtGui Qt3SupportLight QtTest -edition.DesktopLight.groups = -graphicsview-api - -qhp.projects = Qml - -qhp.Qml.file = qml.qhp -qhp.Qml.namespace = com.trolltech.qml.460 -qhp.Qml.virtualFolder = qdoc -qhp.Qml.indexTitle = Qml Reference - -# Files not referenced in any qdoc file -# See also extraimages.HTML -qhp.Qml.extraFiles = classic.css \ - images/qt-logo.png - -qhp.Qml.filterAttributes = qt 4.6.0 qtrefdoc -qhp.Qml.customFilters.Qt.name = Qt 4.6.0 -qhp.Qml.customFilters.Qt.filterAttributes = qt 4.6.0 -qhp.Qml.subprojects = classes -qhp.Qml.subprojects.classes.title = Elements -qhp.Qml.subprojects.classes.indexTitle = Qml Elements -qhp.Qml.subprojects.classes.selectors = fake:qmlclass -qhp.Qml.subprojects.classes.sortPages = true - -language = Cpp - -headerdirs = $QT_SOURCE_TREE/src/declarative -sourcedirs = $QT_SOURCE_TREE/src/declarative \ - $QT_SOURCE_TREE/doc/src/declarative - -sources += $QT_SOURCE_TREE/doc/src/tutorials/declarative.qdoc - -sources.fileextensions = "*.cpp *.qdoc" -examples.fileextensions = "*.cpp *.h *.js *.qml" - -exampledirs = $QT_SOURCE_TREE/doc/src \ - $QT_SOURCE_TREE/examples \ - $QT_SOURCE_TREE/examples/tutorials \ - $QT_SOURCE_TREE \ - $QT_SOURCE_TREE/qmake/examples \ - $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QT_SOURCE_TREE/doc/src/images \ - $QT_SOURCE_TREE/examples \ - $QT_SOURCE_TREE/doc/src/declarative/pics -outputdir = $QT_BUILD_TREE/doc-build/html-qml -tagfile = $QT_BUILD_TREE/doc-build/html-qml/qt.tags -base = file:$QT_BUILD_TREE/doc/html-qml - -HTML.stylesheets = classic.css - -HTML.postheader = "\n" \ - "\n" \ - "\n" \ - "" \ - "\n" \ - "
" \ - "" \ - "  " \ - "" \ - "Home ·" \ - " " \ - "Elements" \ - "
" -- cgit v0.12 From dd4079c6c465c80104ff0ea1cda681ed7cc18310 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 1 Mar 2010 13:09:11 +0100 Subject: Mac: using Qt to write plugins disables quit for 3rd party application The reason is that qt_init always installs/overwrites apple event handlers. So if the 3rd party app had already installed an event handler for kAEQuit, then it will be removed when the Qt plugin is loaded. This patch checks (in the carbon case) if event handlers already exists before installing new ones, or, in the cocoa case, avoids installing apple event handlers if the AA_MacPluginApplication is set. In other words, handling quit etc is seen as the responsibility of the app, and not the plugin. Task-number: QTBUG-8087 Reviewed-by: prasanth --- src/gui/kernel/qapplication_mac.mm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index e511c3a..babfc72 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1222,9 +1222,16 @@ void qt_init(QApplicationPrivate *priv, int) #endif if (!app_proc_ae_handlerUPP) { app_proc_ae_handlerUPP = AEEventHandlerUPP(QApplicationPrivate::globalAppleEventProcessor); - for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i) - AEInstallEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id, - app_proc_ae_handlerUPP, SRefCon(qApp), false); + for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i) { + // Install apple event handler, but avoid overwriting an already + // existing handler (it means a 3rd party application has installed one): + SRefCon refCon = 0; + AEEventHandlerUPP current_handler = NULL; + AEGetEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id, ¤t_handler, &refCon, false); + if (!current_handler) + AEInstallEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id, + app_proc_ae_handlerUPP, SRefCon(qApp), false); + } } if (QApplicationPrivate::app_style) { @@ -2495,6 +2502,13 @@ void QApplicationPrivate::setupAppleEvents() // finished initialization, which appears to be just after [NSApplication run] has // started to execute. By setting up our apple events handlers this late, we override // the ones set up by NSApplication. + + // If Qt is used as a plugin, we let the 3rd party application handle events + // like quit and open file events. Otherwise, if we install our own handlers, we + // easily end up breaking functionallity the 3rd party application depend on: + if (QApplication::testAttribute(Qt::AA_MacPluginApplication)) + return; + QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) *newDelegate = [QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate]; NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager]; [eventManager setEventHandler:newDelegate andSelector:@selector(appleEventQuit:withReplyEvent:) -- cgit v0.12 From 4795583b42577259499b34da07077f501e45ce42 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Mon, 1 Mar 2010 13:53:29 +0100 Subject: compile fix for WinCE do not include headers of disabled modules Reviewed-by: Paul Olav Tvete --- src/declarative/util/qdeclarativeutilmodule.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp index 2b8c7de..1f85b89 100644 --- a/src/declarative/util/qdeclarativeutilmodule.cpp +++ b/src/declarative/util/qdeclarativeutilmodule.cpp @@ -70,7 +70,9 @@ #include "qdeclarativetransitionmanager_p_p.h" #include "qdeclarativetransition_p.h" #include "qdeclarativeview.h" +#ifndef QT_NO_XMLPATTERNS #include "qdeclarativexmllistmodel_p.h" +#endif #include "qnumberformat_p.h" #include "qperformancelog_p_p.h" -- cgit v0.12 From af134d9860d9e5af5b7e9a938191451922cea857 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 1 Mar 2010 10:16:02 +0100 Subject: qDetectCPUFeatures: compile fix with namespaces --- src/corelib/tools/qsimd_p.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 44c1798..724f3e0 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -116,11 +116,10 @@ enum CPUFeatures { NEON = 0x100 }; +Q_CORE_EXPORT uint qDetectCPUFeatures(); QT_END_NAMESPACE QT_END_HEADER -Q_CORE_EXPORT uint qDetectCPUFeatures(); - #endif // QSIMD_P_H -- cgit v0.12 From 454d4fa2fbefabb54f7f567aaf01f2c1faa165f4 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Mon, 1 Mar 2010 14:01:51 +0100 Subject: build fix for WinCE only use xmlpatterns if Qt is configured to build it Reviewed-by: Paul Olav Tvete --- tools/qml/qml.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 9c9c398..9b68dbc 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -41,9 +41,11 @@ INSTALLS += target wince* { QT += scripttools \ xml \ - xmlpatterns \ phonon + contains(QT_CONFIG, xmlpatterns) { + QT += xmlpatterns + } contains(QT_CONFIG, webkit) { QT += webkit } -- cgit v0.12 From 244d4d5610ce288503a73d0aa86f257dce4e74e6 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 1 Mar 2010 14:15:17 +0100 Subject: compile fix with namespaces --- src/declarative/qml/qdeclarativebinding_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index f66b9c7..ec5809d 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -130,8 +130,9 @@ protected: private: Q_DECLARE_PRIVATE(QDeclarativeBinding) }; -Q_DECLARE_METATYPE(QDeclarativeBinding*); QT_END_NAMESPACE +Q_DECLARE_METATYPE(QDeclarativeBinding*); + #endif // QDECLARATIVEBINDING_P_H -- cgit v0.12 From 72da039e54a62bf3a481fefc753e0e50ba75df57 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 1 Mar 2010 15:17:42 +0100 Subject: Added static method isValidColor to QColor. Reviewed-by: Gunnar Sletta --- src/gui/painting/qcolor.cpp | 28 +++++++++++++++++++++++++--- src/gui/painting/qcolor.h | 3 +++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index d6d288e..1b43161 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -532,25 +532,46 @@ QString QColor::name() const void QColor::setNamedColor(const QString &name) { + if (!setColorFromString(name)) + qWarning("QColor::setNamedColor: Unknown color name '%s'", name.toLatin1().constData()); +} + +/*! + Checks if the \a name is a valid color name. The algorithm used is the same as with + \a setNamedColor(). + + \return true if the color name is valid, false otherwise. + + \sa setNamedColor() +*/ +bool QColor::isValidColor(const QString &name) +{ + return QColor().setColorFromString(name); +} + +bool QColor::setColorFromString(const QString &name) +{ if (name.isEmpty()) { invalidate(); - return; + return false; } if (name.startsWith(QLatin1Char('#'))) { QRgb rgb; if (qt_get_hex_rgb(name.constData(), name.length(), &rgb)) { setRgb(rgb); + return true; } else { invalidate(); + return false; } - return; } #ifndef QT_NO_COLORNAMES QRgb rgb; if (qt_get_named_rgb(name.constData(), name.length(), &rgb)) { setRgba(rgb); + return true; } else #endif { @@ -561,11 +582,12 @@ void QColor::setNamedColor(const QString &name) && QX11Info::display() && XParseColor(QX11Info::display(), QX11Info::appColormap(), name.toLatin1().constData(), &result)) { setRgb(result.red >> 8, result.green >> 8, result.blue >> 8); + return true; } else #endif { - qWarning("QColor::setNamedColor: Unknown color name '%s'", name.toLatin1().constData()); invalidate(); + return false; } } } diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index 332dc25..0ac828d 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -225,6 +225,8 @@ public: QT3_SUPPORT uint pixel(int screen = -1) const; #endif + static bool isValidColor(const QString &name); + private: #ifndef QT3_SUPPORT // do not allow a spec to be used as an alpha value @@ -232,6 +234,7 @@ private: #endif void invalidate(); + bool setColorFromString(const QString &name); Spec cspec; union { -- cgit v0.12 From 52c486156287bdfb67ed3765952f5c5a2cd0c318 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 1 Mar 2010 15:20:24 +0100 Subject: Use QList::reserve() in QDataStream>>QList Reviewed-by: Denis Dzyubenko --- src/corelib/io/qdatastream.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index ec4ba2f..222ba8f 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -243,6 +243,7 @@ QDataStream& operator>>(QDataStream& s, QList& l) l.clear(); quint32 c; s >> c; + l.reserve(c); for(quint32 i = 0; i < c; ++i) { T t; -- cgit v0.12 From 2fa8c8d4ddc162297a05f2908e0d86eb2c738153 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 1 Mar 2010 15:36:00 +0100 Subject: Doc: Rephrase documentation for QColor::isValidColor and add \since 4.7. --- src/gui/painting/qcolor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 1b43161..0b735a2 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -537,11 +537,13 @@ void QColor::setNamedColor(const QString &name) } /*! - Checks if the \a name is a valid color name. The algorithm used is the same as with - \a setNamedColor(). + \since 4.7 - \return true if the color name is valid, false otherwise. + Returns true if the \a name is a valid color name and can + be used to construct a valid QColor object, otherwise returns + false. + The algorithm used is the same as with \a setNamedColor(). \sa setNamedColor() */ bool QColor::isValidColor(const QString &name) -- cgit v0.12 From 9d38d8005876d808f499591d1427b227f4b9764f Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 1 Mar 2010 11:11:30 +0100 Subject: Avoid conversion between JavaScriptCore String type and QString Use JSC::UString internally. Only when the public API demands it should a JSC::UString be converted to a QString. Reviewed-by: Jedrzej Nowacki --- src/script/api/qscriptengine.cpp | 10 +++++----- src/script/api/qscriptengine_p.h | 20 ++++++++++---------- src/script/api/qscriptvalue.cpp | 2 +- src/script/api/qscriptvalue_p.h | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index d2e96d1..a9d6fb1 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -563,7 +563,7 @@ JSC::JSValue JSC_HOST_CALL functionDisconnect(JSC::ExecState *exec, JSC::JSObjec slot = arg1; else { QScript::SaveFrameHelper saveFrame(engine, exec); - QString propertyName(QScriptEnginePrivate::toString(exec, arg1)); + JSC::UString propertyName = QScriptEnginePrivate::toString(exec, arg1); slot = QScriptEnginePrivate::property(exec, arg0, propertyName, QScriptValue::ResolvePrototype); } } @@ -645,7 +645,7 @@ JSC::JSValue JSC_HOST_CALL functionConnect(JSC::ExecState *exec, JSC::JSObject * slot = arg1; else { QScript::SaveFrameHelper saveFrame(engine, exec); - QString propertyName = QScriptEnginePrivate::toString(exec, arg1); + JSC::UString propertyName = QScriptEnginePrivate::toString(exec, arg1); slot = QScriptEnginePrivate::property(exec, arg0, propertyName, QScriptValue::ResolvePrototype); } } @@ -1580,9 +1580,9 @@ QRegExp QScriptEnginePrivate::toRegExp(JSC::ExecState *exec, JSC::JSValue value) { if (!isRegExp(value)) return QRegExp(); - QString pattern = toString(exec, property(exec, value, QLatin1String("source"), QScriptValue::ResolvePrototype)); + QString pattern = toString(exec, property(exec, value, "source", QScriptValue::ResolvePrototype)); Qt::CaseSensitivity kase = Qt::CaseSensitive; - if (toBool(exec, property(exec, value, QLatin1String("ignoreCase"), QScriptValue::ResolvePrototype))) + if (toBool(exec, property(exec, value, "ignoreCase", QScriptValue::ResolvePrototype))) kase = Qt::CaseInsensitive; return QRegExp(pattern, kase, QRegExp::RegExp2); } @@ -1637,7 +1637,7 @@ JSC::JSValue QScriptEnginePrivate::propertyHelper(JSC::ExecState *exec, JSC::JSV } if (!result && (resolveMode & QScriptValue::ResolveScope)) { // ### check if it's a function object and look in the scope chain - JSC::JSValue scope = property(exec, value, QString::fromLatin1("__qt_scope__"), QScriptValue::ResolveLocal); + JSC::JSValue scope = property(exec, value, "__qt_scope__", QScriptValue::ResolveLocal); if (isObject(scope)) result = property(exec, scope, id, resolveMode); } diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index d0d020a..a05e12c 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -165,7 +165,7 @@ public: static inline qint32 toInt32(JSC::ExecState *, JSC::JSValue); static inline quint32 toUInt32(JSC::ExecState *, JSC::JSValue); static inline quint16 toUInt16(JSC::ExecState *, JSC::JSValue); - static inline QString toString(JSC::ExecState *, JSC::JSValue); + static inline JSC::UString toString(JSC::ExecState *, JSC::JSValue); static inline QDateTime toDateTime(JSC::ExecState *, JSC::JSValue); #ifndef QT_NO_REGEXP @@ -181,8 +181,8 @@ public: static inline JSC::JSValue property(JSC::ExecState*, JSC::JSValue, quint32 index, int resolveMode = QScriptValue::ResolvePrototype); static JSC::JSValue propertyHelper(JSC::ExecState*, JSC::JSValue, quint32, int resolveMode); - static inline JSC::JSValue property(JSC::ExecState*, JSC::JSValue, const QString &, int resolveMode); - static inline void setProperty(JSC::ExecState*, JSC::JSValue object, const QString &name, JSC::JSValue, + static inline JSC::JSValue property(JSC::ExecState*, JSC::JSValue, const JSC::UString &, int resolveMode); + static inline void setProperty(JSC::ExecState*, JSC::JSValue object, const JSC::UString &name, JSC::JSValue, const QScriptValue::PropertyFlags &flags = QScriptValue::KeepExistingFlags); static void setProperty(JSC::ExecState*, JSC::JSValue object, const JSC::Identifier &id, JSC::JSValue, const QScriptValue::PropertyFlags &flags = QScriptValue::KeepExistingFlags); @@ -191,7 +191,7 @@ public: static QScriptValue::PropertyFlags propertyFlags(JSC::ExecState*, JSC::JSValue value, const JSC::Identifier &id, const QScriptValue::ResolveFlags &mode); static inline QScriptValue::PropertyFlags propertyFlags(JSC::ExecState*, JSC::JSValue value, - const QString &name, const QScriptValue::ResolveFlags &mode); + const JSC::UString &name, const QScriptValue::ResolveFlags &mode); static bool convertValue(JSC::ExecState*, JSC::JSValue value, int type, void *ptr); @@ -629,7 +629,7 @@ inline void QScriptValuePrivate::initFrom(const QString &value) engine->registerScriptValue(this); } -inline JSC::JSValue QScriptEnginePrivate::property(JSC::ExecState *exec, JSC::JSValue value, const QString &name, int resolveMode) +inline JSC::JSValue QScriptEnginePrivate::property(JSC::ExecState *exec, JSC::JSValue value, const JSC::UString &name, int resolveMode) { return property(exec, value, JSC::Identifier(exec, name), resolveMode); } @@ -655,13 +655,13 @@ inline JSC::JSValue QScriptEnginePrivate::property(JSC::ExecState *exec, JSC::JS } inline QScriptValue::PropertyFlags QScriptEnginePrivate::propertyFlags(JSC::ExecState *exec, JSC::JSValue value, - const QString &name, + const JSC::UString &name, const QScriptValue::ResolveFlags &mode) { return propertyFlags(exec, value, JSC::Identifier(exec, name), mode); } -inline void QScriptEnginePrivate::setProperty(JSC::ExecState *exec, JSC::JSValue objectValue, const QString &name, +inline void QScriptEnginePrivate::setProperty(JSC::ExecState *exec, JSC::JSValue objectValue, const JSC::UString &name, JSC::JSValue value, const QScriptValue::PropertyFlags &flags) { setProperty(exec, objectValue, JSC::Identifier(exec, name), value, flags); @@ -677,7 +677,7 @@ inline JSC::JSValue QScriptValuePrivate::property(quint32 index, int resolveMode return QScriptEnginePrivate::property(engine->currentFrame, jscValue, index, resolveMode); } -inline JSC::JSValue QScriptValuePrivate::property(const QString &name, int resolveMode) const +inline JSC::JSValue QScriptValuePrivate::property(const JSC::UString &name, int resolveMode) const { JSC::ExecState *exec = engine->currentFrame; return QScriptEnginePrivate::property(exec, jscValue, JSC::Identifier(exec, name), resolveMode); @@ -701,7 +701,7 @@ inline void QScriptValuePrivate::setProperty(quint32 index, const JSC::JSValue & QScriptEnginePrivate::setProperty(engine->currentFrame, jscValue, index, value, flags); } -inline void QScriptValuePrivate::setProperty(const QString &name, const JSC::JSValue &value, +inline void QScriptValuePrivate::setProperty(const JSC::UString &name, const JSC::JSValue &value, const QScriptValue::PropertyFlags &flags) { JSC::ExecState *exec = engine->currentFrame; @@ -919,7 +919,7 @@ inline quint16 QScriptEnginePrivate::toUInt16(JSC::ExecState *exec, JSC::JSValue return QScript::ToUInt16(toNumber(exec, value)); } -inline QString QScriptEnginePrivate::toString(JSC::ExecState *exec, JSC::JSValue value) +inline JSC::UString QScriptEnginePrivate::toString(JSC::ExecState *exec, JSC::JSValue value) { JSC::JSValue savedException; saveException(exec, &savedException); diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 7f1fdaa..414a45c 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -562,7 +562,7 @@ QScriptValue QScriptValue::scope() const if (!d || !d->isObject()) return QScriptValue(); // ### make hidden property - JSC::JSValue result = d->property(QLatin1String("__qt_scope__"), QScriptValue::ResolveLocal); + JSC::JSValue result = d->property("__qt_scope__", QScriptValue::ResolveLocal); return d->engine->scriptValueFromJSCValue(result); } diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 77b7330..089b923 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -88,8 +88,8 @@ public: inline JSC::JSValue property(const JSC::Identifier &id, int resolveMode) const; inline JSC::JSValue property(quint32 index, int resolveMode) const; - inline JSC::JSValue property(const QString &, int resolveMode) const; - inline void setProperty(const QString &name, const JSC::JSValue &value, + inline JSC::JSValue property(const JSC::UString &, int resolveMode) const; + inline void setProperty(const JSC::UString &name, const JSC::JSValue &value, const QScriptValue::PropertyFlags &flags); inline void setProperty(const JSC::Identifier &id, const JSC::JSValue &value, const QScriptValue::PropertyFlags &flags); -- cgit v0.12 From d628a467159b79c85885acb21510cb1e646a968b Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 1 Mar 2010 11:14:01 +0100 Subject: Perform latin1 conversion directly on JSC::UString This conversion needs to be as fast as possible since it's performed every time you access a QObject property from QtScript. Hence, we should avoid going via QString and instead do the conversion ourselves. Reviewed-by: Jedrzej Nowacki --- src/script/api/qscriptengine.cpp | 34 +++++++++++++++++----------------- src/script/api/qscriptengine_p.h | 18 ++++++++++++++++++ src/script/bridge/qscriptqobject.cpp | 22 +++++++++++----------- 3 files changed, 46 insertions(+), 28 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index a9d6fb1..9cd5c63 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -723,19 +723,19 @@ JSC::JSValue JSC_HOST_CALL functionQsTranslate(JSC::ExecState *exec, JSC::JSObje if ((args.size() > 4) && !args.at(4).isNumber()) return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): fifth argument (n) must be a number"); #ifndef QT_NO_QOBJECT - QString context(args.at(0).toString(exec)); + JSC::UString context = args.at(0).toString(exec); #endif - QString text(args.at(1).toString(exec)); + JSC::UString text = args.at(1).toString(exec); #ifndef QT_NO_QOBJECT - QString comment; + JSC::UString comment; if (args.size() > 2) comment = args.at(2).toString(exec); QCoreApplication::Encoding encoding = QCoreApplication::CodecForTr; if (args.size() > 3) { - QString encStr(args.at(3).toString(exec)); - if (encStr == QLatin1String("CodecForTr")) + JSC::UString encStr = args.at(3).toString(exec); + if (encStr == "CodecForTr") encoding = QCoreApplication::CodecForTr; - else if (encStr == QLatin1String("UnicodeUTF8")) + else if (encStr == "UnicodeUTF8") encoding = QCoreApplication::UnicodeUTF8; else return JSC::throwError(exec, JSC::GeneralError, QString::fromLatin1("qsTranslate(): invalid encoding '%s'").arg(encStr)); @@ -744,11 +744,11 @@ JSC::JSValue JSC_HOST_CALL functionQsTranslate(JSC::ExecState *exec, JSC::JSObje if (args.size() > 4) n = args.at(4).toInt32(exec); #endif - QString result; + JSC::UString result; #ifndef QT_NO_QOBJECT - result = QCoreApplication::translate(context.toLatin1().constData(), - text.toLatin1().constData(), - comment.toLatin1().constData(), + result = QCoreApplication::translate(QScript::convertToLatin1(context).constData(), + QScript::convertToLatin1(text).constData(), + QScript::convertToLatin1(comment).constData(), encoding, n); #else result = text; @@ -774,25 +774,25 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS if ((args.size() > 2) && !args.at(2).isNumber()) return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): third argument (n) must be a number"); #ifndef QT_NO_QOBJECT - QString context; + JSC::UString context; QScriptContext *ctx = QScriptEnginePrivate::contextForFrame(exec); if (ctx && ctx->parentContext()) context = QFileInfo(QScriptContextInfo(ctx->parentContext()).fileName()).baseName(); #endif - QString text(args.at(0).toString(exec)); + JSC::UString text = args.at(0).toString(exec); #ifndef QT_NO_QOBJECT - QString comment; + JSC::UString comment; if (args.size() > 1) comment = args.at(1).toString(exec); int n = -1; if (args.size() > 2) n = args.at(2).toInt32(exec); #endif - QString result; + JSC::UString result; #ifndef QT_NO_QOBJECT - result = QCoreApplication::translate(context.toLatin1().constData(), - text.toLatin1().constData(), - comment.toLatin1().constData(), + result = QCoreApplication::translate(QScript::convertToLatin1(context).constData(), + QScript::convertToLatin1(text).constData(), + QScript::convertToLatin1(comment).constData(), QCoreApplication::CodecForTr, n); #else result = text; diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index a05e12c..5166d89 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -123,6 +123,9 @@ namespace QScript inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec); bool isFunction(JSC::JSValue value); + inline void convertToLatin1_helper(const UChar *i, int length, char *s); + inline QByteArray convertToLatin1(const JSC::UString &str); + class UStringSourceProviderWithFeedback; struct GlobalClientData : public JSC::JSGlobalData::ClientData @@ -516,6 +519,21 @@ inline bool ToBool(const QString &value) return !value.isEmpty(); } +inline void convertToLatin1_helper(const UChar *i, int length, char *s) +{ + const UChar *e = i + length; + while (i != e) + *(s++) = (uchar) *(i++); + *s = '\0'; +} + +inline QByteArray convertToLatin1(const JSC::UString &str) +{ + QByteArray ba(str.size(), Qt::Uninitialized); + convertToLatin1_helper(str.data(), str.size(), ba.data()); + return ba; +} + } // namespace QScript inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(size_t size) diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 30e5a26..8d111f9 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -654,8 +654,8 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c matchDistance += 10; } } else { - QString sval = QScriptEnginePrivate::toString(exec, actual); - int ival = m.keyToValue(sval.toLatin1()); + JSC::UString sval = QScriptEnginePrivate::toString(exec, actual); + int ival = m.keyToValue(convertToLatin1(sval)); if (ival != -1) { qVariantSetValue(v, ival); converted = true; @@ -1168,7 +1168,7 @@ bool QObjectDelegate::getOwnPropertySlot(QScriptObject *object, JSC::ExecState * { //Note: this has to be kept in sync with getOwnPropertyDescriptor #ifndef QT_NO_PROPERTIES - QByteArray name = QString(propertyName.ustring()).toLatin1(); + QByteArray name = convertToLatin1(propertyName.ustring()); QObject *qobject = data->value; if (!qobject) { QString message = QString::fromLatin1("cannot access member `%0' of deleted QObject") @@ -1285,7 +1285,7 @@ bool QObjectDelegate::getOwnPropertyDescriptor(QScriptObject *object, JSC::ExecS { //Note: this has to be kept in sync with getOwnPropertySlot abd getPropertyAttributes #ifndef QT_NO_PROPERTIES - QByteArray name = QString(propertyName.ustring()).toLatin1(); + QByteArray name = convertToLatin1(propertyName.ustring()); QObject *qobject = data->value; if (!qobject) { QString message = QString::fromLatin1("cannot access member `%0' of deleted QObject") @@ -1419,7 +1419,7 @@ void QObjectDelegate::put(QScriptObject *object, JSC::ExecState* exec, JSC::JSValue value, JSC::PutPropertySlot &slot) { #ifndef QT_NO_PROPERTIES - QByteArray name = ((QString)propertyName.ustring()).toLatin1(); + QByteArray name = convertToLatin1(propertyName.ustring()); QObject *qobject = data->value; if (!qobject) { QString message = QString::fromLatin1("cannot access member `%0' of deleted QObject") @@ -1517,7 +1517,7 @@ bool QObjectDelegate::deleteProperty(QScriptObject *object, JSC::ExecState *exec bool checkDontDelete) { #ifndef QT_NO_PROPERTIES - QByteArray name = ((QString)propertyName.ustring()).toLatin1(); + QByteArray name = convertToLatin1(propertyName.ustring()); QObject *qobject = data->value; if (!qobject) { QString message = QString::fromLatin1("cannot access member `%0' of deleted QObject") @@ -1567,7 +1567,7 @@ bool QObjectDelegate::getPropertyAttributes(const QScriptObject *object, { #ifndef QT_NO_PROPERTIES //Note: this has to be kept in sync with getOwnPropertyDescriptor and getOwnPropertySlot - QByteArray name = ((QString)propertyName.ustring()).toLatin1(); + QByteArray name = convertToLatin1(propertyName.ustring()); QObject *qobject = data->value; if (!qobject) return false; @@ -1853,7 +1853,7 @@ bool QMetaObjectWrapperObject::getOwnPropertySlot( return true; } - QByteArray name = QString(propertyName.ustring()).toLatin1(); + QByteArray name = convertToLatin1(propertyName.ustring()); for (int i = 0; i < meta->enumeratorCount(); ++i) { QMetaEnum e = meta->enumerator(i); @@ -1881,7 +1881,7 @@ void QMetaObjectWrapperObject::put(JSC::ExecState* exec, const JSC::Identifier& } const QMetaObject *meta = data->value; if (meta) { - QByteArray name = QString(propertyName.ustring()).toLatin1(); + QByteArray name = convertToLatin1(propertyName.ustring()); for (int i = 0; i < meta->enumeratorCount(); ++i) { QMetaEnum e = meta->enumerator(i); for (int j = 0; j < e.keyCount(); ++j) { @@ -1901,7 +1901,7 @@ bool QMetaObjectWrapperObject::deleteProperty( return false; const QMetaObject *meta = data->value; if (meta) { - QByteArray name = QString(propertyName.ustring()).toLatin1(); + QByteArray name = convertToLatin1(propertyName.ustring()); for (int i = 0; i < meta->enumeratorCount(); ++i) { QMetaEnum e = meta->enumerator(i); for (int j = 0; j < e.keyCount(); ++j) { @@ -1923,7 +1923,7 @@ bool QMetaObjectWrapperObject::getPropertyAttributes(JSC::ExecState *exec, } const QMetaObject *meta = data->value; if (meta) { - QByteArray name = QString(propertyName.ustring()).toLatin1(); + QByteArray name = convertToLatin1(propertyName.ustring()); for (int i = 0; i < meta->enumeratorCount(); ++i) { QMetaEnum e = meta->enumerator(i); for (int j = 0; j < e.keyCount(); ++j) { -- cgit v0.12 From e24247b07c6450881094200e729390b676f911aa Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 1 Mar 2010 15:52:15 +0100 Subject: =?UTF-8?q?Interview=20Demo:=20Fix=20warning=20about=20pixmap=20le?= =?UTF-8?q?ak=20on=20X11.=20Reviewed-by:=20Trond=20Kjern=C3=A5sen=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demos/interview/model.cpp | 2 +- demos/interview/model.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/demos/interview/model.cpp b/demos/interview/model.cpp index 3f9548a..840bc60 100644 --- a/demos/interview/model.cpp +++ b/demos/interview/model.cpp @@ -45,6 +45,7 @@ Model::Model(int rows, int columns, QObject *parent) : QAbstractItemModel(parent), + services(QPixmap(":/images/services.png")), rc(rows), cc(columns), tree(new QVector(rows, Node(0))) { @@ -105,7 +106,6 @@ QVariant Model::data(const QModelIndex &index, int role) const QVariant Model::headerData(int section, Qt::Orientation orientation, int role) const { - static QIcon services(QPixmap(":/images/services.png")); if (role == Qt::DisplayRole) return QString::number(section); if (role == Qt::DecorationRole) diff --git a/demos/interview/model.h b/demos/interview/model.h index bad83a8..c7c15f7 100644 --- a/demos/interview/model.h +++ b/demos/interview/model.h @@ -44,6 +44,7 @@ #include #include +#include #include class Model : public QAbstractItemModel @@ -80,6 +81,7 @@ private: Node *parent(Node *child) const; int row(Node *node) const; + QIcon services; int rc, cc; QVector *tree; QFileIconProvider iconProvider; -- cgit v0.12 From 45d91603e65f78cb749bcc2c8949ef24048761df Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 1 Mar 2010 16:30:33 +0100 Subject: Doc: brief Qt Quick introduction on "What's New" page. --- doc/src/qt4-intro.qdoc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index cf53df0..c670c51 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -473,6 +473,29 @@ \section1 Declarative UI development with Qt Quick + Qt 4.7 introduces Quick, the Qt UI Creation Kit. that enables the creation + of dynamic user interfaces, easier and more effective than possible + with existing UI technologies. This UI Creation Kit consist of three + technologies: + + \list + \i QML is a declarative language oriented on JavaScript that utilizes + Qt's Meta-Object capabilities to enable designers and developers to + collaborate tightly and create animated and fluid user experiences, + using existing knowledge in script language and design. + + \i QtDeclarative is a C++ library that provides the underlying engine, + which translates the declarative description of the UI in QML into + items on a QGraphicsScene. The library also provides APIs to bind + custom C++ types and elements to QML, and to connect the QML UI with + the underlying application logic written in C++. + + \i Qt Creator has been improved to support interactive editing of + QML UIs through drag-and-drop. The text editor supports the QML + syntax and provides authoring assistance such as auto-completion, + error lookup, help lookup and easy preview of QML UI's. + \endlist + \section1 Network Bearer Management Bearer Management controls the connectivity state of the system. @@ -494,7 +517,7 @@ \section1 New Classes, Functions, Macros, etc. - Links to new classes, functions, macros, and other items + Links to new classes, elements, functions, macros, and other items introduced in Qt 4.7. \sincelist 4.7 -- cgit v0.12 From b281e39d8449ccc63020ba959404f77aba424de8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Mon, 1 Mar 2010 16:56:29 +0100 Subject: Fixed the close button of the find widget in Assistant Done with Christian Kandeler. --- tools/assistant/tools/assistant/findwidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/assistant/tools/assistant/findwidget.cpp b/tools/assistant/tools/assistant/findwidget.cpp index 2e40ab0..60318d4 100644 --- a/tools/assistant/tools/assistant/findwidget.cpp +++ b/tools/assistant/tools/assistant/findwidget.cpp @@ -72,6 +72,7 @@ FindWidget::FindWidget(QWidget *parent) toolClose = setupToolButton(QLatin1String(""), resourcePath + QLatin1String("/closetab.png")); hboxLayout->addWidget(toolClose); + connect(toolClose, SIGNAL(clicked()), SLOT(hide())); editFind = new QLineEdit(this); hboxLayout->addWidget(editFind); -- cgit v0.12 From a07ac42868df345994ee2a5d27ff79f2e3599ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Mon, 1 Mar 2010 16:56:51 +0100 Subject: Updated .gitignore with the new name of the qmlviewer --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 548e69e..7fe33b9 100644 --- a/.gitignore +++ b/.gitignore @@ -83,7 +83,7 @@ bin/kmap2qmap* bin/qlalr* bin/qmlconv* bin/qmldebugger* -bin/qmlviewer* +bin/qml* bin/qttracereplay* configure.cache config.status -- cgit v0.12 From a7196feb11d701dd486e66fd06cbc50d84c9b1bb Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Mon, 1 Mar 2010 17:03:00 +0100 Subject: typo for windows ce exclusion rule Reviewed-by: Paul Olav Tvete --- src/plugins/mediaservices/mediaservices.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/mediaservices/mediaservices.pro b/src/plugins/mediaservices/mediaservices.pro index d84b276..19d678b 100644 --- a/src/plugins/mediaservices/mediaservices.pro +++ b/src/plugins/mediaservices/mediaservices.pro @@ -1,7 +1,7 @@ TEMPLATE = subdirs contains(QT_CONFIG, mediaservice) { - win32:!wince: SUBDIRS += directshow + win32:!wince*: SUBDIRS += directshow mac: SUBDIRS += qt7 -- cgit v0.12