summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
0 files changed, 0 insertions, 0 deletions
puter in "PC Suite" mode, and run \c sisx target + with the \c QT_SISX_OPTIONS=-i, like this: - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 3 + \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 5 */ diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc index 489016d..ef46bf6 100644 --- a/doc/src/snippets/code/doc_src_installation.qdoc +++ b/doc/src/snippets/code/doc_src_installation.qdoc @@ -129,7 +129,7 @@ nmake //! [23] cd \Qt\%VERSION% -configure -platform win32-mwc -xplatform symbian-abld +configure -platform win32-g++ -xplatform symbian-abld //! [23] @@ -156,10 +156,10 @@ make release-armv5 //! [29] cd src\s60installs -createpackage -i qt_libs_armv5_urel.pkg +make sisx QT_SISX_OPTIONS=-i QT_SISX_CERTIFICATE= QT_SISX_KEY= //! [29] //! [30] cd embedded\fluidlauncher -createpackage -i fluidlauncher_armv5_urel.pkg +make sisx QT_SISX_OPTIONS=-i //! [30] diff --git a/doc/src/snippets/code/doc_src_s60-introduction.qdoc b/doc/src/snippets/code/doc_src_s60-introduction.qdoc index ff1d159..fa9fd45 100644 --- a/doc/src/snippets/code/doc_src_s60-introduction.qdoc +++ b/doc/src/snippets/code/doc_src_s60-introduction.qdoc @@ -8,9 +8,21 @@ //! [1] //! [2] - createpackage wiggly_gcce_udeb.pkg + qmake + make debug-winscw release-armv5 + make sisx //! [2] //! [3] - createpackage -i wiggly_gcce_udeb.pkg + make sisx QT_SISX_TARGET=debug-armv5 //! [3] + +//! [4] + set QT_SISX_TARGET=debug-armv5 + make sisx +//! [4] + +//! [5] + set QT_SISX_OPTIONS=-i + make sisx +//! [5] \ No newline at end of file diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 48fc8ef..3aa3c7b 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -1649,7 +1649,7 @@ void SymbianMakefileGenerator::writeSisxTargets(QTextStream &t) t << OK_SISX_TARGET ":" << endl; - QString pkgcommand = QString("\tcreatepackage.bat %1_template.%2 $(QT_SISX_TARGET) " \ + QString pkgcommand = QString("\tcreatepackage.bat $(QT_SISX_OPTIONS) %1_template.%2 $(QT_SISX_TARGET) " \ "$(QT_SISX_CERTIFICATE) $(QT_SISX_KEY) $(QT_SISX_PASSPHRASE)") .arg(fixedTarget) .arg("pkg"); -- cgit v0.12 From 7c2620578ba0698a14c1d4ff5c7a4e260f06ad31 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 28 Aug 2009 14:07:20 +0200 Subject: Attempting to make EGL compile again and fix some potential issues with flipped pixmaps on X11 --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 4 +++- src/opengl/qgl.cpp | 8 ++++++- src/opengl/qgl.h | 25 +++++++++++++--------- src/opengl/qgl_x11.cpp | 5 +++-- src/opengl/qgl_x11egl.cpp | 10 ++++++--- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index cc9b014..612ba1b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1104,7 +1104,9 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c QGLContext *ctx = d->ctx; glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); QGLTexture *texture = - ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption + | QGLContext::CanFlipNativePixmapBindOption); GLfloat top = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.top()) : src.top(); GLfloat bottom = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.bottom()) : src.bottom(); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 02991d9..b4c7e10 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1607,7 +1607,13 @@ Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg() would mirror the image and automatically generate mipmaps. This option helps preserve this default behavior. - \omitvalue MemoryManagedBindOption + \omitvalue CanFlipNativePixmapBindOption Used by x11 from pixmap to choose + wether or not it can bind the pixmap upside down or not. + + \omitvalue MemoryManagedBindOption Used by paint engines to + indicate that the pixmap should be memory managed along side with + the pixmap/image that it stems from, e.g. installing destruction + hooks in them. \omitvalue InternalBindOption */ diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 13ad668..96a8b08 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -289,16 +289,20 @@ public: virtual void swapBuffers() const; enum BindOption { - NoBindOption = 0x0000, - InvertedYBindOption = 0x0001, - MipmapBindOption = 0x0002, - PremultipliedAlphaBindOption = 0x0004, - LinearFilteringBindOption = 0x0008, - - MemoryManagedBindOption = 0x1000, // internal flag - - DefaultBindOption = LinearFilteringBindOption | InvertedYBindOption | MipmapBindOption, - InternalBindOption = MemoryManagedBindOption | PremultipliedAlphaBindOption + NoBindOption = 0x0000, + InvertedYBindOption = 0x0001, + MipmapBindOption = 0x0002, + PremultipliedAlphaBindOption = 0x0004, + LinearFilteringBindOption = 0x0008, + + MemoryManagedBindOption = 0x0010, // internal flag + CanFlipNativePixmapBindOption = 0x0020, // internal flag + + DefaultBindOption = LinearFilteringBindOption + | InvertedYBindOption + | MipmapBindOption, + InternalBindOption = MemoryManagedBindOption + | PremultipliedAlphaBindOption }; Q_DECLARE_FLAGS(BindOptions, BindOption) @@ -407,6 +411,7 @@ private: Q_DISABLE_COPY(QGLContext) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions); class Q_OPENGL_EXPORT QGLWidget : public QWidget { diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index aca60bc..a34ea37 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1633,7 +1633,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, // QGLContext::bindTexture() can't return an inverted texture, but QPainter::drawPixmap() can: - GLX_Y_INVERTED_EXT, options & QGLContext::InvertedYBindOption ? GLX_DONT_CARE : False, + GLX_Y_INVERTED_EXT, options & QGLContext::CanFlipNativePixmapBindOption ? GLX_DONT_CARE : False, XNone }; configList = glXChooseFBConfig(x11Info.display(), x11Info.screen(), configAttribs, &configCount); @@ -1694,8 +1694,9 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con glBindTexture(GL_TEXTURE_2D, textureId); - if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))); + if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))) options &= ~QGLContext::InvertedYBindOption; + QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); if (texture->options & QGLContext::InvertedYBindOption) pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index b982a19..f40cdc9 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -490,12 +490,13 @@ void QGLWidgetPrivate::recreateEglSurface(bool force) } -QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, const qint64 key, bool canInvert) +QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, const qint64 key, + QGLContext::BindOptions options) { Q_Q(QGLContext); // The EGL texture_from_pixmap has no facility to invert the y coordinate - if (!canInvert) + if (!(options & QGLContext::CanFlipNativePixmapBindOption)) return 0; Q_ASSERT(pd->classId() == QPixmapData::X11Class); @@ -623,7 +624,10 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, cons return 0; } - QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, canInvert, true); + // Always inverted because the opposite is not supported... + options |= QGLContext::InvertedYBindOption; + + QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; // We assume the cost of bound pixmaps is zero -- cgit v0.12 From 2be1a64592aee5dfbaf7c9834e188d38c1c602e5 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 28 Aug 2009 14:39:38 +0200 Subject: Fixed runtime warning in tst_QGraphicsProxyWidget::childPos. ungrabKeyboard was called on an item without checking whether it was a keyboard grabber. Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsscene.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 7dbc996..7fd471b 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -673,8 +673,8 @@ void QGraphicsScenePrivate::removePopup(QGraphicsWidget *widget, bool itemIsDyin if (focusItem && popupWidgets.isEmpty()) { QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); sendEvent(focusItem, &event); - } else { - ungrabKeyboard((QGraphicsItem *)widget, itemIsDying); + } else if (keyboardGrabberItems.contains(static_cast(widget))) { + ungrabKeyboard(static_cast(widget), itemIsDying); } if (!itemIsDying && widget->isVisible()) { widget->hide(); -- cgit v0.12 From e1ef9b44e1a36afdeea33f9c59fb126d267c3301 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Fri, 28 Aug 2009 15:02:25 +0200 Subject: Whitespaces & indentation cleanup in qobject Reviewed-by: trustme --- src/corelib/kernel/qobject.cpp | 49 +++++++++++++++++++++--------------------- src/corelib/kernel/qobject.h | 4 ++-- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 8abe28e..e080bd6 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -291,7 +291,7 @@ bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const QMutexLocker locker(signalSlotLock(q)); if (connectionLists) { if (signal_index < connectionLists->count()) { - const QObjectPrivate::Connection *c = + const QObjectPrivate::Connection *c = connectionLists->at(signal_index).first; while (c) { @@ -360,7 +360,7 @@ void QObjectPrivate::cleanConnectionLists() if (connectionLists->dirty && !connectionLists->inUse) { // remove broken connections for (int signal = -1; signal < connectionLists->count(); ++signal) { - QObjectPrivate::ConnectionList &connectionList = + QObjectPrivate::ConnectionList &connectionList = (*connectionLists)[signal]; // Set to the last entry in the connection list that was *not* @@ -383,8 +383,8 @@ void QObjectPrivate::cleanConnectionLists() } } - // Correct the connection list's last pointer. As - // conectionList.last could equal last, this could be a noop + // Correct the connection list's last pointer. + // As conectionList.last could equal last, this could be a noop connectionList.last = last; } connectionLists->dirty = false; @@ -906,7 +906,7 @@ QObject::~QObject() if (d->connectionLists) { ++d->connectionLists->inUse; for (int signal = -1; signal < d->connectionLists->count(); ++signal) { - QObjectPrivate::ConnectionList &connectionList = + QObjectPrivate::ConnectionList &connectionList = (*d->connectionLists)[signal]; while (QObjectPrivate::Connection *c = connectionList.first) { @@ -1171,7 +1171,7 @@ static QObject *qChildHelper(const char *objName, const char *inheritsClass, more than one, the first one found is returned. */ QObject* QObject::child(const char *objName, const char *inheritsClass, - bool recursiveSearch) const + bool recursiveSearch) const { Q_D(const QObject); return qChildHelper(objName, inheritsClass, recursiveSearch, d->children); @@ -1390,7 +1390,7 @@ bool QObject::eventFilter(QObject * /* watched */, QEvent * /* event */) /*! If \a block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). - If \a block is false, no such blocking will occur. + If \a block is false, no such blocking will occur. The return value is the previous value of signalsBlocked(). @@ -1682,12 +1682,12 @@ void QObject::killTimer(int id) #ifdef QT3_SUPPORT static void objSearch(QObjectList &result, - const QObjectList &list, - const char *inheritsClass, - bool onlyWidgets, - const char *objName, - QRegExp *rx, - bool recurse) + const QObjectList &list, + const char *inheritsClass, + bool onlyWidgets, + const char *objName, + QRegExp *rx, + bool recurse) { for (int i = 0; i < list.size(); ++i) { QObject *obj = list.at(i); @@ -1757,9 +1757,9 @@ static void objSearch(QObjectList &result, */ QObjectList QObject::queryList(const char *inheritsClass, - const char *objName, - bool regexpMatch, - bool recursiveSearch) const + const char *objName, + bool regexpMatch, + bool recursiveSearch) const { Q_D(const QObject); QObjectList list; @@ -1911,7 +1911,7 @@ QObjectList QObject::queryList(const char *inheritsClass, \internal */ void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re, - const QMetaObject &mo, QList *list) + const QMetaObject &mo, QList *list) { if (!parent || !list) return; @@ -2519,7 +2519,7 @@ int QObject::receivers(const char *signal) const QMutexLocker locker(signalSlotLock(this)); if (d->connectionLists) { if (signal_index < d->connectionLists->count()) { - const QObjectPrivate::Connection *c = + const QObjectPrivate::Connection *c = d->connectionLists->at(signal_index).first; while (c) { receivers += c->receiver ? 1 : 0; @@ -3011,7 +3011,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index, if (type & Qt::UniqueConnection) { QObjectConnectionListVector *connectionLists = QObjectPrivate::get(s)->connectionLists; if (connectionLists && connectionLists->count() > signal_index) { - const QObjectPrivate::Connection *c2 = + const QObjectPrivate::Connection *c2 = (*connectionLists)[signal_index].first; while (c2) { @@ -3082,7 +3082,7 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index, Same as the QMetaObject::disconnect, but \a signal_index must be the result of QObjectPrivate::signalIndex */ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, - const QObject *receiver, int method_index) + const QObject *receiver, int method_index) { if (!sender) return false; @@ -3105,7 +3105,7 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, if (signal_index < 0) { // remove from all connection lists for (signal_index = -1; signal_index < connectionLists->count(); ++signal_index) { - QObjectPrivate::Connection *c = + QObjectPrivate::Connection *c = (*connectionLists)[signal_index].first; while (c) { if (c->receiver @@ -3134,7 +3134,7 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, } } } else if (signal_index < connectionLists->count()) { - QObjectPrivate::Connection *c = + QObjectPrivate::Connection *c = (*connectionLists)[signal_index].first; while (c) { if (c->receiver @@ -3491,7 +3491,8 @@ int QObjectPrivate::signalIndex(const char *signalName) const \a signal_index must be the index returned by QObjectPrivate::signalIndex; */ -bool QObjectPrivate::isSignalConnected(int signal_index) const { +bool QObjectPrivate::isSignalConnected(int signal_index) const +{ if (signal_index < (int)sizeof(connectedSignals) * 8 && !qt_signal_spy_callback_set.signal_begin_callback && !qt_signal_spy_callback_set.signal_end_callback) { @@ -3721,7 +3722,7 @@ void QObject::dumpObjectInfo() qDebug(" signal: %s", signal.signature()); // receivers - const QObjectPrivate::Connection *c = + const QObjectPrivate::Connection *c = d->connectionLists->at(signal_index).first; while (c) { if (!c->receiver) { diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index aa538bc..d85faee 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -381,7 +381,7 @@ inline QList qFindChildren(const QObject *o, const QRegExp &re) #endif // Q_MOC_RUN -template inline const char * qobject_interface_iid() +template inline const char * qobject_interface_iid() { return 0; } template inline T qobject_cast_helper(QObject *object, T) @@ -465,7 +465,7 @@ inline T qobject_cast(const QObject *object) } -template inline const char * qobject_interface_iid() +template inline const char * qobject_interface_iid() { return 0; } #ifndef Q_MOC_RUN -- cgit v0.12 From 5a56da702779d9775f02d17e85c701494036ccf8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 28 Aug 2009 15:15:41 +0200 Subject: doc: Fixed several qdoc errors. --- src/corelib/tools/qscopedpointer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index ef6cc39..5296bae 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -170,7 +170,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn bool QScopedPointer::operator==(const QScopedPointer &other) const + \fn bool QScopedPointer::operator==(const QScopedPointer &other) const Equality operator. Returns true if the scoped pointer \a other is pointing to the same object as this pointer, otherwise returns false. @@ -178,7 +178,7 @@ QT_BEGIN_NAMESPACE /*! - \fn bool QScopedPointer::operator!=(const QScopedPointer &other) const + \fn bool QScopedPointer::operator!=(const QScopedPointer &other) const Inequality operator. Returns true if the scoped pointer \a other is not pointing to the same object as this pointer, otherwise returns false. -- cgit v0.12 From 8ef96fd9b2b1d505795ca9ec4cfd936a0bc096e3 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 28 Aug 2009 16:17:03 +0300 Subject: Added preprocess only option for createpackage.bat The prerocessing is needed by installer scripts. Reviewed-by: Miikka Heikkinen --- bin/createpackage.pl | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index b7f4682..af46e04 100644 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -23,14 +23,15 @@ sub Usage() { print "Usage: createpackage.pl [-i] templatepkg target-platform [certificate key [passphrase]]\n"; print "\n"; print "Where parameters are as follows:\n"; - print " [-i|install] = Install the package right away using PC suite\n"; - print " templatepkg = Name of .pkg file template\n"; - print " target = Either debug or release\n"; - print " platform = One of the supported platform\n"; - print " winscw | gcce | armv5 | armv6 | armv7\n"; - print " certificate = The certificate file used for signing\n"; - print " key = The certificate's private key file\n"; - print " passphrase = The certificate's private key file's passphrase\n"; + print " [-i|install] = Install the package right away using PC suite\n"; + print " [-p|preprocess] = Only preprocess the template .pkg file.\n"; + print " templatepkg = Name of .pkg file template\n"; + print " target = Either debug or release\n"; + print " platform = One of the supported platform\n"; + print " winscw | gcce | armv5 | armv6 | armv7\n"; + print " certificate = The certificate file used for signing\n"; + print " key = The certificate's private key file\n"; + print " passphrase = The certificate's private key file's passphrase\n"; print "\n"; print "For example:\n"; print " createpackage.pl fluidlauncher_template.pkg release-armv5\n"; @@ -44,7 +45,8 @@ sub Usage() { # Read given options my $install = ""; -unless (GetOptions('i|install' => \$install)){ +my $preprocessonly = ""; +unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly)){ Usage(); } @@ -136,6 +138,10 @@ open( OUTPUT, ">$pkgoutput" ) or die "Error '$pkgoutput' $!\n"; print OUTPUT $_; close OUTPUT; +if ($preprocessonly) { + exit; +} + # Create and sign SIS system ("makesis $pkgoutput $unsigned_sis_name"); system ("signsis $unsigned_sis_name $signed_sis_name $certificate $key $passphrase"); -- cgit v0.12 From 8d0b487437e731ff3f5f97779002a4ffb48d92ec Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 28 Aug 2009 15:19:24 +0200 Subject: Enable Q_OBJECT usage across DLL boundary on Symbian OS Symbian loader does not allow DLL import relocations in the data section. To workaround this, added an accessor function which can be used to get the class static metadata from the base class even if it is in another DLL. Changing the implementation for all platforms would cause a binary break, so it is only used for Symbian. The Q_NO_DATA_RELOCATION macro is used to configure this feature instead of Q_OS_SYMBIAN, because it is possible another platform may need the same fix and Symbian may eventually fix their DLL loader to support this feature. Task-number: 258893 Reviewed-by: Kent Hansen --- src/corelib/global/qglobal.h | 4 ++++ src/corelib/kernel/qmetaobject.cpp | 12 +++++++++++- src/corelib/kernel/qobjectdefs.h | 8 ++++++++ src/tools/moc/generator.cpp | 27 +++++++++++++++++++++------ 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 93cc30f..fbefe7a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2382,6 +2382,10 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); #endif #if defined(Q_OS_SYMBIAN) + +//Symbian does not support data imports from a DLL +#define Q_NO_DATA_RELOCATION + QT_END_NAMESPACE // forward declare std::exception #ifdef __cplusplus diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 3d26160..5771feb 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -613,16 +613,26 @@ static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, co if (strcmp(self->d.stringdata, name) == 0) return self; if (self->d.extradata) { +#ifdef Q_NO_DATA_RELOCATION + const QMetaObjectAccessor *e; + Q_ASSERT(priv(self->d.data)->revision >= 2); +#else const QMetaObject **e; if (priv(self->d.data)->revision < 2) { e = (const QMetaObject**)(self->d.extradata); - } else { + } else +#endif + { const QMetaObjectExtraData *extra = (const QMetaObjectExtraData*)(self->d.extradata); e = extra->objects; } if (e) { while (*e) { +#ifdef Q_NO_DATA_RELOCATION + if (const QMetaObject *m =QMetaObject_findMetaObject(&((*e)()), name)) +#else if (const QMetaObject *m =QMetaObject_findMetaObject((*e), name)) +#endif return m; ++e; } diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 421617a..3f990a3 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -150,6 +150,7 @@ inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} public: \ Q_OBJECT_CHECK \ static const QMetaObject staticMetaObject; \ + static const QMetaObject &getStaticMetaObject(); \ virtual const QMetaObject *metaObject() const; \ virtual void *qt_metacast(const char *); \ QT_TR_FUNCTIONS \ @@ -161,6 +162,7 @@ private: #define Q_GADGET \ public: \ static const QMetaObject staticMetaObject; \ + static const QMetaObject &getStaticMetaObject(); \ private: #else // Q_MOC_RUN #define slots slots @@ -444,9 +446,15 @@ struct Q_CORE_EXPORT QMetaObject }; +typedef const QMetaObject& (*QMetaObjectAccessor)(); + struct QMetaObjectExtraData { +#ifdef Q_NO_DATA_RELOCATION + const QMetaObjectAccessor *objects; +#else const QMetaObject **objects; +#endif int (*static_metacall)(QMetaObject::Call, int, void **); }; diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index cc6fa88..95e8386 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -302,13 +302,18 @@ void Generator::generateCode() } } if (!extraList.isEmpty()) { + fprintf(out, "#ifdef Q_NO_DATA_RELOCATION\n"); + fprintf(out, "static const QMetaObjectAccessor qt_meta_extradata_%s[] = {\n ", qualifiedClassNameIdentifier.constData()); + for (int i = 0; i < extraList.count(); ++i) { + fprintf(out, " %s::getStaticMetaObject,\n", extraList.at(i).constData()); + } + fprintf(out, "#else\n"); fprintf(out, "static const QMetaObject *qt_meta_extradata_%s[] = {\n ", qualifiedClassNameIdentifier.constData()); for (int i = 0; i < extraList.count(); ++i) { - if (i) - fprintf(out, ",\n "); - fprintf(out, " &%s::staticMetaObject", extraList.at(i).constData()); + fprintf(out, " &%s::staticMetaObject,\n", extraList.at(i).constData()); } - fprintf(out, ",0\n};\n\n"); + fprintf(out, "#endif //Q_NO_DATA_RELOCATION\n"); + fprintf(out, " 0\n};\n\n"); } if (isConstructible || !extraList.isEmpty()) { @@ -328,7 +333,6 @@ void Generator::generateCode() // // Finally create and initialize the static meta object // - if (isQt) fprintf(out, "const QMetaObject QObject::staticQtMetaObject = {\n"); else @@ -348,11 +352,22 @@ void Generator::generateCode() fprintf(out, "&qt_meta_extradata2_%s }\n", qualifiedClassNameIdentifier.constData()); fprintf(out, "};\n"); - if (isQt || !cdef->hasQObject) + if(isQt) + return; + +// +// Generate static meta object accessor (needed for symbian, because DLLs do not support data imports. +// + fprintf(out, "\n#ifdef Q_NO_DATA_RELOCATION\n"); + fprintf(out, "const QMetaObject &%s::getStaticMetaObject() { return staticMetaObject; }\n", cdef->qualified.constData()); + fprintf(out, "#endif //Q_NO_DATA_RELOCATION\n"); + + if (!cdef->hasQObject) return; fprintf(out, "\nconst QMetaObject *%s::metaObject() const\n{\n return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;\n}\n", cdef->qualified.constData()); + // // Generate smart cast function // -- cgit v0.12 From df66f388bb135d7f22632d7d98ffa0e4d8a417f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 28 Aug 2009 13:26:40 +0200 Subject: Fixed a problem where the InvertedYBindOption was always removed. Reviewed-by: Samuel --- src/opengl/qgl_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index aca60bc..733994e 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1694,7 +1694,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con glBindTexture(GL_TEXTURE_2D, textureId); - if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))); + if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))) options &= ~QGLContext::InvertedYBindOption; QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); if (texture->options & QGLContext::InvertedYBindOption) -- cgit v0.12 From 033725f5947d4a4e0c21f426664851b42b164d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 28 Aug 2009 13:28:43 +0200 Subject: Fixed QGLWidget::renderText() when using the GL 2 paint engine. QGLWidget::renderText() needs to respect the current depth and scissor tests that the user has set. Therefore we needs some special casing in the GL 2 paint engine to handle the custom depth testing. The private setRenderTextActive() has been added for this purpose. Reviewed-by: Samuel --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 85 +++++++++++++++++----- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 8 +- src/opengl/qgl.cpp | 36 ++++++++- src/opengl/qglframebufferobject.cpp | 2 +- 4 files changed, 108 insertions(+), 23 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index cc9b014..b5a6b1f 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -219,6 +219,11 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) pex->transferMode(BrushDrawingMode); +#ifndef QT_OPENGL_ES_2 + if (pex->inRenderText) + glPushAttrib(GL_ENABLE_BIT | GL_VIEWPORT_BIT | GL_SCISSOR_BIT); +#endif + glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); @@ -268,6 +273,11 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glViewport(0, 0, pex->width, pex->height); pex->updateDepthScissorTest(); + +#ifndef QT_OPENGL_ES_2 + if (pex->inRenderText) + glPopAttrib(); +#endif } void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) @@ -836,6 +846,11 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) glEnable(GL_STENCIL_TEST); prepareForDraw(currentBrush->isOpaque()); + +#ifndef QT_OPENGL_ES_2 + if (inRenderText) + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), zValueForRenderText()); +#endif composite(vertexCoordinateArray.boundingRect()); glDisable(GL_STENCIL_TEST); @@ -873,9 +888,21 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& ve glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d glDisable(GL_BLEND); +#ifndef QT_OPENGL_ES_2 + if (inRenderText) { + glPushAttrib(GL_ENABLE_BIT); + glDisable(GL_DEPTH_TEST); + } +#endif + // Draw the vertecies into the stencil buffer: drawVertexArrays(vertexArray, GL_TRIANGLE_FAN); +#ifndef QT_OPENGL_ES_2 + if (inRenderText) + glPopAttrib(); +#endif + // Enable color writes & disable stencil writes glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } @@ -981,9 +1008,19 @@ void QGL2PaintEngineExPrivate::drawVertexArrays(QGL2PEXVertexArray& vertexArray, glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR); } - - - +float QGL2PaintEngineExPrivate::zValueForRenderText() const +{ +#ifndef QT_OPENGL_ES_2 + // Get the z translation value from the model view matrix and + // transform it using the ortogonal projection with z-near = 0, + // and z-far = 1, which is used in QGLWidget::renderText() + GLdouble model[4][4]; + glGetDoublev(GL_MODELVIEW_MATRIX, &model[0][0]); + return -2 * model[3][2] - 1; +#else + return 0; +#endif +} /////////////////////////////////// Public Methods ////////////////////////////////////////// @@ -1002,8 +1039,8 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) if (brush.style() == Qt::NoBrush) return; - - ensureActive(); + if (!d->inRenderText) + ensureActive(); d->setBrush(&brush); d->fill(path); d->setBrush(&(state()->brush)); // reset back to the state's brush @@ -1154,7 +1191,8 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem { Q_D(QGL2PaintEngineEx); - ensureActive(); + if (!d->inRenderText) + ensureActive(); QOpenGL2PaintEngineState *s = state(); const QTextItemInt &ti = static_cast(textItem); @@ -1203,6 +1241,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte if (cache->width() == 0 || cache->height() == 0) return; + if (inRenderText) + transferMode(BrushDrawingMode); transferMode(TextDrawingMode); if (glyphType == QFontEngineGlyphCache::Raster_A8) @@ -1241,6 +1281,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte prepareForDraw(false); // Text always causes src pixels to be transparent +#ifndef QT_OPENGL_ES_2 + if (inRenderText) + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), zValueForRenderText()); +#endif + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::MaskTexture), QT_MASK_TEXTURE_UNIT); if (vertexCoordinateArray.data() != oldVertexCoordinateDataPtr) @@ -1286,12 +1331,6 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) glViewport(0, 0, d->width, d->height); -// glClearColor(0.0, 1.0, 0.0, 1.0); -// glClear(GL_COLOR_BUFFER_BIT); -// d->ctx->swapBuffers(); -// qDebug("You should see green now"); -// sleep(5); - d->brushTextureDirty = true; d->brushUniformsDirty = true; d->matrixDirty = true; @@ -1304,10 +1343,12 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->use_system_clip = !systemClip().isEmpty(); - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); - glDepthFunc(GL_LEQUAL); - glDepthMask(false); + if (!d->inRenderText) { + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDepthFunc(GL_LEQUAL); + glDepthMask(false); + } #if !defined(QT_OPENGL_ES_2) glDisable(GL_MULTISAMPLE); @@ -1612,7 +1653,11 @@ void QGL2PaintEngineExPrivate::regenerateDepthClip() void QGL2PaintEngineExPrivate::systemStateChanged() { Q_Q(QGL2PaintEngineEx); - use_system_clip = !systemClip.isEmpty(); + + if (q->paintDevice()->devType() == QInternal::Widget) + use_system_clip = false; + else + use_system_clip = !systemClip.isEmpty(); glDisable(GL_DEPTH_TEST); q->state()->depthTestEnabled = false; @@ -1728,6 +1773,12 @@ QPainterState *QGL2PaintEngineEx::createState(QPainterState *orig) const return s; } +void QGL2PaintEngineEx::setRenderTextActive(bool active) +{ + Q_D(QGL2PaintEngineEx); + d->inRenderText = active; +} + QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other) : QPainterState(other) { diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 66e7a51..68447bc 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -141,6 +141,8 @@ public: QPixmapFilter *createPixmapFilter(int type) const; + void setRenderTextActive(bool); + private: Q_DISABLE_COPY(QGL2PaintEngineEx) }; @@ -156,7 +158,8 @@ public: ctx(0), currentBrush(0), inverseScale(1), - shaderManager(0) + shaderManager(0), + inRenderText(false) { } ~QGL2PaintEngineExPrivate(); @@ -191,6 +194,8 @@ public: inline void useSimpleShader(); inline QColor premultiplyColor(QColor c, GLfloat opacity); + float zValueForRenderText() const; + QGL2PaintEngineEx* q; QGLDrawable drawable; int width, height; @@ -240,6 +245,7 @@ public: GLuint lastTexture; bool needsSync; + bool inRenderText; }; QT_END_NAMESPACE diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 8cf3b45..4324371 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1666,7 +1666,6 @@ QGLContext::QGLContext(const QGLFormat &format) QGLContext::~QGLContext() { - Q_D(QGLContext); // remove any textures cached in this context QGLTextureCache::instance()->removeContextTextures(this); QGLTextureCache::deleteIfEmpty(); // ### thread safety @@ -4073,6 +4072,10 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, bool auto_swap = autoBufferSwap(); QPaintEngine *engine = paintEngine(); +#ifndef QT_OPENGL_ES + if (engine->type() == QPaintEngine::OpenGL2) + static_cast(engine)->setRenderTextActive(true); +#endif QPainter *p; bool reuse_painter = false; if (engine->isActive()) { @@ -4098,6 +4101,13 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, setAutoBufferSwap(false); // disable glClear() as a result of QPainter::begin() d->glcx->d_func()->clear_on_painter_begin = false; + if (engine->type() == QPaintEngine::OpenGL2) { + qt_save_gl_state(); +#ifndef QT_OPENGL_ES_2 + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +#endif + } p = new QPainter(this); } @@ -4121,7 +4131,13 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, delete p; setAutoBufferSwap(auto_swap); d->glcx->d_func()->clear_on_painter_begin = true; + if (engine->type() == QPaintEngine::OpenGL2) + qt_restore_gl_state(); } +#ifndef QT_OPENGL_ES + if (engine->type() == QPaintEngine::OpenGL2) + static_cast(engine)->setRenderTextActive(false); +#endif } /*! \overload @@ -4154,6 +4170,10 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con win_y = height - win_y; // y is inverted QPaintEngine *engine = paintEngine(); +#ifndef QT_OPENGL_ES + if (engine->type() == QPaintEngine::OpenGL2) + static_cast(engine)->setRenderTextActive(true); +#endif QPainter *p; bool reuse_painter = false; #ifndef QT_OPENGL_ES @@ -4172,6 +4192,8 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con setAutoBufferSwap(false); // disable glClear() as a result of QPainter::begin() d->glcx->d_func()->clear_on_painter_begin = false; + if (engine->type() == QPaintEngine::OpenGL2) + qt_save_gl_state(); p = new QPainter(this); } @@ -4210,9 +4232,15 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con } else { p->end(); delete p; + if (engine->type() == QPaintEngine::OpenGL2) + qt_restore_gl_state(); setAutoBufferSwap(auto_swap); d->glcx->d_func()->clear_on_painter_begin = true; } +#ifndef QT_OPENGL_ES + if (engine->type() == QPaintEngine::OpenGL2) + static_cast(engine)->setRenderTextActive(false); +#endif } QGLFormat QGLWidget::format() const @@ -4443,10 +4471,10 @@ QPaintEngine *QGLWidget::paintEngine() const #elif defined(QT_OPENGL_ES_2) return qt_gl_2_engine(); #else - if (!qt_gl_preferGL2Engine()) - return qt_gl_engine(); - else + if (qt_gl_preferGL2Engine()) return qt_gl_2_engine(); + else + return qt_gl_engine(); #endif } diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 0db5659..2b38e3d 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -896,7 +896,7 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const return qt_buffer_2_engine(); #else Q_D(const QGLFramebufferObject); - if (d->ctx->d_func()->internal_context || qt_gl_preferGL2Engine()) + if (qt_gl_preferGL2Engine()) return qt_buffer_2_engine(); else return qt_buffer_engine(); -- cgit v0.12 From 81303731b56a0a7e36673d6eae874e1d7fd95d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 28 Aug 2009 15:43:54 +0200 Subject: Re-enabled the QPixmap cleanup hooks in QPixmap destructor. Reviewed-by: Gunnar --- src/gui/image/qpixmap.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 658b8e0..155474f 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -322,6 +322,8 @@ QPixmap::QPixmap(const char * const xpm[]) QPixmap::~QPixmap() { + if (data->is_cached && data->ref == 1) + QImagePixmapCleanupHooks::executePixmapHooks(this); } /*! -- cgit v0.12 From bd3cd571ac061b0ed0e8c001c90c4edeafae67d7 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 28 Aug 2009 15:45:58 +0200 Subject: Make it possible for autotests to check if JIT is enabled or not Currently there are some differences in behavior and availability of information between the interpreter and the JIT. This is now documented as expected failures in the relevant autotests. --- src/script/api/qscriptengine.cpp | 11 +++++++++ tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 24 +++++++++++--------- .../qscriptengineagent/tst_qscriptengineagent.cpp | 26 ++++++++++++++++++++++ 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 29044a9..46c6abb 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -3789,4 +3789,15 @@ QScriptSyntaxCheckResult &QScriptSyntaxCheckResult::operator=(const QScriptSynta return *this; } +#ifdef QT_BUILD_INTERNAL +Q_AUTOTEST_EXPORT bool qt_script_isJITEnabled() +{ +#if ENABLE(JIT) + return true; +#else + return false; +#endif +} +#endif + QT_END_NAMESPACE diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index a85c0bd..a09d314 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -50,6 +50,10 @@ Q_DECLARE_METATYPE(QScriptValueList) +QT_BEGIN_NAMESPACE +extern bool qt_script_isJITEnabled(); +QT_END_NAMESPACE + class tst_QScriptContext : public QObject { Q_OBJECT @@ -598,11 +602,10 @@ void tst_QScriptContext::backtrace_data() expected << "('hey') at -1" << "() at 3" -#ifdef ENABLE_JIT - << "foo(arg1 = 'hello', arg2 = 456) at testfile:2" -#else //### interpreter unfortunately does store information about line number for eval() - << "foo(arg1 = 'hello', arg2 = 456) at testfile:-1" -#endif + << QString::fromLatin1("foo(arg1 = 'hello', arg2 = 456) at testfile:%0") + // interpreter unfortunately doesn't provide line number for eval() + .arg(qt_script_isJITEnabled() ? 2 : -1); + expected << "() at testfile:4"; QTest::newRow("eval") << source << expected; @@ -661,11 +664,10 @@ void tst_QScriptContext::backtrace_data() expected << "('hey') at -1" << "() at 3" -#ifdef ENABLE_JIT - << "plop('hello', 456) at testfile:3" -#else //### interpreter unfortunately does store information about line number for eval() - << "plop('hello', 456) at testfile:-1" -#endif + << QString::fromLatin1("plop('hello', 456) at testfile:%0") + // interpreter unfortunately doesn't provide line number for eval() + .arg(qt_script_isJITEnabled() ? 3 : -1); + expected << "() at testfile:5"; QTest::newRow("eval in member") << source << expected; @@ -1009,6 +1011,8 @@ void tst_QScriptContext::calledAsConstructor() eng.evaluate("test();"); QVERIFY(!fun3.property("calledAsConstructor").toBool()); eng.evaluate("new test();"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "calledAsConstructor is not correctly set for JS functions when JIT is enabled", Continue); QVERIFY(fun3.property("calledAsConstructor").toBool()); } diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 886c70b..f515304 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -49,6 +49,10 @@ //TESTED_CLASS= //TESTED_FILES= +QT_BEGIN_NAMESPACE +extern bool qt_script_isJITEnabled(); +QT_END_NAMESPACE + class tst_QScriptEngineAgent : public QObject { Q_OBJECT @@ -557,6 +561,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCall() spy->clear(); QVERIFY(eng.evaluate("(function() { return 123; } )()").toNumber()==123); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -592,6 +598,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCallWithoutReturn() spy->clear(); eng.evaluate("(function() { var a = 123; } )()"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -634,6 +642,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionDefinition() QVERIFY(spy->at(1).value.isUndefined()); eng.evaluate("foo()"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 6); // evaluate() entry @@ -709,6 +719,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_native2() spy->clear(); eng.evaluate("nativeFunctionCallingArg(function() { return 123; })"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 6); // evaluate() entry @@ -797,6 +809,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_builtin() spy->clear(); eng.evaluate("'ciao'.toString()"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -1021,6 +1035,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_call() spy->clear(); fun.call(); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 2); // entry @@ -1575,6 +1591,8 @@ void tst_QScriptEngineAgent::exceptionThrowAndCatch() { spy->clear(); eng.evaluate("try { throw new Error('ciao'); } catch (e) { }"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 2); QCOMPARE(spy->at(0).type, ScriptEngineEvent::ExceptionThrow); @@ -1632,6 +1650,8 @@ void tst_QScriptEngineAgent::eventOrder_functionDefinition() QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit); eng.evaluate("foo(123)"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 13); // load QCOMPARE(spy->at(3).type, ScriptEngineEvent::ScriptLoad); @@ -1708,6 +1728,8 @@ void tst_QScriptEngineAgent::eventOrder_throwAndCatch() { spy->clear(); eng.evaluate("try { throw new Error('ciao') } catch (e) { void(e); }"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "One event is missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 12); // load QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); @@ -1752,6 +1774,8 @@ void tst_QScriptEngineAgent::eventOrder_functions() QCOMPARE(spy->count(), 6); eng.evaluate("foo(123)"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 21); // load @@ -1876,6 +1900,8 @@ void tst_QScriptEngineAgent::eventOrder_throwCatchFinally() { spy->clear(); eng.evaluate("try { throw 1; } catch(e) { i = e; } finally { i = 2; }"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "One event is missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 9); // load -- cgit v0.12 From c3df6e12309164a6fa0cf76546a354c5d59c5374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 28 Aug 2009 15:02:33 +0200 Subject: Fix wrong transform when drawing graphics item effect source. We are only interested in the difference between the original transform and the transform set on the painter we're about to use. --- src/gui/graphicsview/qgraphicsitem.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 8860677..765f76b 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10270,10 +10270,8 @@ void QGraphicsItemEffectSourcePrivate::draw(QPainter *painter) info->widget, info->opacity, info->effectTransform, info->wasDirtySceneTransform, info->drawItem); } else { - QTransform effectTransform = painter->worldTransform(); - effectTransform *= info->painter->worldTransform().inverted(); - if (info->effectTransform) - effectTransform *= *info->effectTransform; + QTransform effectTransform = info->painter->worldTransform().inverted(); + effectTransform *= painter->worldTransform(); scened->draw(item, painter, info->viewTransform, info->transformPtr, info->exposedRegion, info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform, info->drawItem); -- cgit v0.12 From d6d49aa56750359012cdf722df27b0a1c3e5b2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 28 Aug 2009 10:31:31 +0200 Subject: Add support for setting an opacity mask on QGraphicsOpacityEffect. Opacity masks enable you to make portions of an element transparent. More information about opacity masks here: http://msdn.microsoft.com/en-us/library/ms743320.aspx Reviewed-by: Samuel --- .../code/src_gui_effects_qgraphicseffect.cpp | 10 +++ src/gui/effects/qgraphicseffect.cpp | 93 ++++++++++++++++++++-- src/gui/effects/qgraphicseffect.h | 5 ++ src/gui/effects/qgraphicseffect_p.h | 4 +- 4 files changed, 106 insertions(+), 6 deletions(-) diff --git a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp index 6265c80..152b04f 100644 --- a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp +++ b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp @@ -31,3 +31,13 @@ MyGraphicsEffect::draw(QPainter *painter, QGraphicsEffectSource *source) } //! [1] +//! [2] +... +QLinearGradient alphaGradient(rect.topLeft(), rect.bottomLeft()); +alphaGradient.setColorAt(0.0, Qt::transparent); +alphaGradient.setColorAt(0.5, Qt::black); +alphaGradient.setColorAt(1.0, Qt::transparent); +QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect; +effect->setOpacityMask(alphaGradient); +... +//! [2] diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 5f64698..62ad44d 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -990,6 +990,8 @@ QGraphicsOpacityEffect::~QGraphicsOpacityEffect() fully transparent and 1.0 is fully opaque. By default, the opacity is 0.7. + + \sa setOpacityMask() */ qreal QGraphicsOpacityEffect::opacity() const { @@ -1017,6 +1019,45 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity) */ /*! + \property QGraphicsOpacityEffect::opacityMask + \brief the opacity mask of the effect. + + An opacity mask allows you apply opacity to portions of an element. + + For example: + + \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 2 + + There is no opacity mask by default. + + \sa setOpacity() +*/ +QBrush QGraphicsOpacityEffect::opacityMask() const +{ + Q_D(const QGraphicsOpacityEffect); + return d->opacityMask; +} + +void QGraphicsOpacityEffect::setOpacityMask(const QBrush &mask) +{ + Q_D(QGraphicsOpacityEffect); + if (d->opacityMask == mask) + return; + + d->opacityMask = mask; + d->hasOpacityMask = (mask.style() != Qt::NoBrush); + + emit opacityMaskChanged(mask); +} + +/*! + \fn void QGraphicsOpacityEffect::opacityMaskChanged(const QBrush &mask) + + This signal is emitted whenever the effect's opacity mask changes. + The \a mask parameter holds the effect's new opacity mask. +*/ + +/*! \reimp */ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *source) @@ -1039,13 +1080,55 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour QPoint offset; if (source->isPixmap()) { // No point in drawing in device coordinates (pixmap will be scaled anyways). - const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); - painter->drawPixmap(offset, pixmap); + if (!d->hasOpacityMask) { + const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); + painter->drawPixmap(offset, pixmap); + } else { + QRectF srcBrect = source->boundingRect(); + QPixmap pixmap(srcBrect.size().toSize()); + pixmap.fill(Qt::transparent); + + QPainter pixmapPainter(&pixmap); + pixmapPainter.setRenderHints(painter->renderHints()); + pixmapPainter.translate(-srcBrect.topLeft()); + source->draw(&pixmapPainter); + pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); + pixmapPainter.fillRect(srcBrect, d->opacityMask); + pixmapPainter.end(); + + painter->drawPixmap(srcBrect.topLeft(), pixmap); + } } else { // Draw pixmap in device coordinates to avoid pixmap scaling; - const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); - painter->setWorldTransform(QTransform()); - painter->drawPixmap(offset, pixmap); + if (!d->hasOpacityMask) { + const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); + painter->setWorldTransform(QTransform()); + painter->drawPixmap(offset, pixmap); + } else { + QTransform worldTransform = painter->worldTransform(); + + // Calculate source bounding rect in logical and device coordinates. + QRectF srcBrect = source->boundingRect(); + QRect srcDeviceBrect = worldTransform.mapRect(srcBrect).toAlignedRect(); + srcDeviceBrect &= source->deviceRect(); + + offset = srcDeviceBrect.topLeft(); + worldTransform *= QTransform::fromTranslate(-srcDeviceBrect.x(), -srcDeviceBrect.y()); + + QPixmap pixmap(srcDeviceBrect.size()); + pixmap.fill(Qt::transparent); + + QPainter pixmapPainter(&pixmap); + pixmapPainter.setRenderHints(painter->renderHints()); + pixmapPainter.setWorldTransform(worldTransform); + source->draw(&pixmapPainter); + pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); + pixmapPainter.fillRect(srcBrect, d->opacityMask); + pixmapPainter.end(); + + painter->setWorldTransform(QTransform()); + painter->drawPixmap(offset, pixmap); + } } painter->restore(); diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index fef6531..a53357b 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -46,6 +46,7 @@ #include #include #include +#include QT_BEGIN_HEADER @@ -274,17 +275,21 @@ class Q_GUI_EXPORT QGraphicsOpacityEffect: public QGraphicsEffect { Q_OBJECT Q_PROPERTY(int opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) + Q_PROPERTY(QBrush opacityMask READ opacityMask WRITE setOpacityMask NOTIFY opacityMaskChanged) public: QGraphicsOpacityEffect(QObject *parent = 0); ~QGraphicsOpacityEffect(); qreal opacity() const; + QBrush opacityMask() const; public Q_SLOTS: void setOpacity(qreal opacity); + void setOpacityMask(const QBrush &mask); Q_SIGNALS: void opacityChanged(qreal opacity); + void opacityMaskChanged(const QBrush &mask); protected: void draw(QPainter *painter, QGraphicsEffectSource *source); diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 6ce5cda..e0a77e7 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -164,10 +164,12 @@ class QGraphicsOpacityEffectPrivate : public QGraphicsEffectPrivate { Q_DECLARE_PUBLIC(QGraphicsOpacityEffect) public: - QGraphicsOpacityEffectPrivate() : opacity(qreal(0.7)) {} + QGraphicsOpacityEffectPrivate() : opacity(qreal(0.7)), hasOpacityMask(0) {} ~QGraphicsOpacityEffectPrivate() {} qreal opacity; + QBrush opacityMask; + uint hasOpacityMask : 1; }; QT_END_NAMESPACE -- cgit v0.12 From 78fdde630cb16086ef24d8e79adcf0f91a729ddb Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 28 Aug 2009 17:31:21 +0200 Subject: Add an autotest to check QPainter rendering to a QGLPixelBuffer works Reviewed-by: Trustme --- tests/auto/qgl/tst_qgl.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index ae31572..59779b0 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -70,6 +71,7 @@ private slots: void partialGLWidgetUpdates_data(); void partialGLWidgetUpdates(); void glWidgetRendering(); + void glPBufferRendering(); void glWidgetReparent(); void colormap(); }; @@ -630,6 +632,37 @@ void tst_QGL::partialGLWidgetUpdates() } +// This tests that rendering to a QGLPBuffer using QPainter works. +void tst_QGL::glPBufferRendering() +{ + if (!QGLPixelBuffer::hasOpenGLPbuffers()) + QSKIP("QGLPixelBuffer not supported on this platform", SkipSingle); + + QGLPixelBuffer* pbuf = new QGLPixelBuffer(128, 128); + + QPainter p; + bool begun = p.begin(pbuf); + QVERIFY(begun); + + QPaintEngine::Type engineType = p.paintEngine()->type(); + QVERIFY(engineType == QPaintEngine::OpenGL || engineType == QPaintEngine::OpenGL2); + + p.fillRect(0, 0, 128, 128, Qt::red); + p.fillRect(32, 32, 64, 64, Qt::blue); + p.end(); + + QImage fb = pbuf->toImage(); + delete pbuf; + + QImage reference(128, 128, fb.format()); + p.begin(&reference); + p.fillRect(0, 0, 128, 128, Qt::red); + p.fillRect(32, 32, 64, 64, Qt::blue); + p.end(); + + QCOMPARE(fb, reference); +} + class GLWidget : public QGLWidget { public: -- cgit v0.12 From 15144fab1010194b078c34157e8d208cfb625e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 28 Aug 2009 17:39:27 +0200 Subject: Don't call qFuzzyIsNull on every single frame in QGraphicsOpacityEffect. We only have to do it when the opacity changes (in ::setOpacity). Also, we cannot do the cut-off when the effect has an opacity mask set. --- src/gui/effects/qgraphicseffect.cpp | 8 ++++++-- src/gui/effects/qgraphicseffect_p.h | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 62ad44d..50644ff 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -1008,6 +1008,10 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity) return; d->opacity = opacity; + if ((d->isFullyTransparent = qFuzzyIsNull(d->opacity))) + d->isFullyOpaque = 0; + else + d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1); emit opacityChanged(opacity); } @@ -1065,11 +1069,11 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour Q_D(QGraphicsOpacityEffect); // Transparent; nothing to draw. - if (qFuzzyIsNull(d->opacity)) + if (d->isFullyTransparent) return; // Opaque; draw directly without going through a pixmap. - if (qFuzzyIsNull(d->opacity - 1)) { + if (d->isFullyOpaque && !d->hasOpacityMask) { source->draw(painter); return; } diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index e0a77e7..c902b67 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -164,11 +164,14 @@ class QGraphicsOpacityEffectPrivate : public QGraphicsEffectPrivate { Q_DECLARE_PUBLIC(QGraphicsOpacityEffect) public: - QGraphicsOpacityEffectPrivate() : opacity(qreal(0.7)), hasOpacityMask(0) {} + QGraphicsOpacityEffectPrivate() + : opacity(qreal(0.7)), isFullyTransparent(0), isFullyOpaque(0), hasOpacityMask(0) {} ~QGraphicsOpacityEffectPrivate() {} qreal opacity; QBrush opacityMask; + uint isFullyTransparent : 1; + uint isFullyOpaque : 1; uint hasOpacityMask : 1; }; -- cgit v0.12 From 7ef43dbeedc17eb6fe9b8615b815bd6f1e46babb Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 28 Aug 2009 17:47:11 +0200 Subject: Using QFocusFrame to visualize the focus. When using the keypad navigation, the focus state of a widget is supposed to be well visible. So it makes much sense to use QFocusFrame, which is able to paint a focus marker _around_ the widget. This change should fix the issue that with some S60 themes, the focus was invisible. Also, a lot of code is removed by this change. Task-number: 256470 Reviewed-by: Sami Merila modified: src/gui/styles/qs60style.cpp modified: src/gui/styles/qs60style.h modified: src/gui/styles/qs60style_p.h --- src/gui/styles/qs60style.cpp | 190 +++++++++++++++++-------------------------- src/gui/styles/qs60style.h | 2 + src/gui/styles/qs60style_p.h | 6 +- 3 files changed, 80 insertions(+), 118 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b05a1e9..12d4948 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -67,6 +67,7 @@ #include "qtoolbar.h" #include "qtoolbutton.h" #include "qtreeview.h" +#include "qfocusframe.h" #include "private/qtoolbarextension_p.h" #include "private/qcombobox_p.h" @@ -86,6 +87,8 @@ const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFl static const QByteArray propertyKeyLayouts = "layouts"; static const QByteArray propertyKeyCurrentlayout = "currentlayout"; +static const qreal goldenRatio = 1.618; + const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** {240,320,1,14,true,"QVGA Landscape Mirrored"}, @@ -508,11 +511,6 @@ void QS60StylePrivate::deleteBackground() } } -int QS60StylePrivate::focusRectPenWidth() -{ - return pixelMetric(QS60Style::PM_DefaultFrameWidth); -} - void QS60StylePrivate::setCurrentLayout(int index) { m_pmPointer = data[index]; @@ -950,13 +948,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom const QS60StylePrivate::SkinElements handleElement = horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical; QS60StylePrivate::drawSkinElement(handleElement, painter, sliderHandle, flags); - - if (optionSlider->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*optionSlider); - fropt.rect = subElementRect(SE_SliderFocusRect, optionSlider, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } } break; #endif // QT_NO_SLIDER @@ -991,17 +982,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom drawPrimitive(PE_IndicatorSpinDown, &buttonOption, painter, widget); painter->restore(); } - - if (cmb->subControls & SC_ComboBoxEditField) { - if (cmb->state & State_HasFocus && !cmb->editable) { - QStyleOptionFocusRect focus; - focus.QStyleOption::operator=(*cmb); - focus.rect = cmbxEditField; - focus.state |= State_FocusAtBorder; - focus.backgroundColor = cmb->palette.highlight().color(); - drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); - } - } } break; #endif // QT_NO_COMBOBOX @@ -1079,13 +1059,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } } } - if (toolBtn->state & State_HasFocus) { - QStyleOptionFocusRect fr; - fr.QStyleOption::operator=(*toolBtn); - const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget); - fr.rect.adjust(frameWidth, frameWidth, -frameWidth, -frameWidth); - drawPrimitive(PE_FrameFocusRect, &fr, painter, widget); - } if (toolBtn->features & QStyleOptionToolButton::Arrow) { QStyle::PrimitiveElement pe; @@ -1209,13 +1182,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom groupBox->palette, groupBox->state & State_Enabled, groupBox->text, textColor.isValid() ? QPalette::NoRole : QPalette::WindowText); painter->restore(); - - if (groupBox->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*groupBox); - fropt.rect = textRect; - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } } // Draw checkbox @@ -1249,12 +1215,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); drawControl(CE_PushButtonLabel, &subopt, painter, widget); - if (btn->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*btn); - fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } } break; case CE_PushButtonBevel: @@ -1612,18 +1572,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (verticalTabs) painter->restore(); - if (optionTab.state & State_HasFocus) { - const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); - const int leftBorder = optionTab.rect.left(); - const int rightBorder = optionTab.rect.right() - 1; - - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*tab); - fropt.rect.setRect(leftBorder + 1 + OFFSET, optionTab.rect.y() + OFFSET, - rightBorder - leftBorder - 2*OFFSET, optionTab.rect.height() - 2*OFFSET); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - painter->restore(); } break; @@ -1875,11 +1823,48 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } else if (qobject_cast(widget)) { QCommonStyle::drawControl(element, option, painter, widget); } - if (option->state & State_HasFocus) - drawPrimitive(PE_FrameFocusRect, option, painter, widget); break; case CE_MenuScroller: break; + case CE_FocusFrame: + { + // The pen width should nearly fill the layoutspacings around the widget + const int penWidth = + qMin(pixelMetric(QS60Style::PM_LayoutVerticalSpacing), pixelMetric(QS60Style::PM_LayoutHorizontalSpacing)) + - 2; // But keep 1 pixel distance to the focus widget and 1 pixel to the adjacent widgets + +#ifdef QT_KEYPAD_NAVIGATION + bool editFocus = false; + if (const QFocusFrame *focusFrame = qobject_cast(widget)) { + if (focusFrame->widget() && focusFrame->widget()->hasEditFocus()) + editFocus = true; + } + const qreal opacity = editFocus ? 0.65 : 0.45; // Trial and error factors. Feel free to improve. +#else + const qreal opacity = 0.5; +#endif + // Because of Qts coordinate system, we need to tweak the rect by .5 pixels, otherwise it gets blurred. + const qreal rectAdjustment = (penWidth % 2) ? -.5 : 0; + + // Make sure that the pen stroke is inside the rect + const QRectF adjustedRect = + QRectF(option->rect).adjusted( + rectAdjustment + penWidth, + rectAdjustment + penWidth, + -rectAdjustment - penWidth, + -rectAdjustment - penWidth + ); + + const qreal roundRectRadius = penWidth * goldenRatio; + + painter->save(); + painter->setRenderHint(QPainter::Antialiasing); + painter->setOpacity(opacity); + painter->setPen(QPen(option->palette.color(QPalette::Highlight), penWidth)); + painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); + painter->restore(); + } + break; default: QCommonStyle::drawControl(element, option, painter, widget); } @@ -1901,9 +1886,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit, painter, option->rect, flags); - - if (lineEdit->state & State_HasFocus) - drawPrimitive(PE_FrameFocusRect, lineEdit, painter, widget); } break; #endif // QT_NO_LINEEDIT @@ -2030,50 +2012,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif //QT_NO_COMBOBOX break; #endif //QT_NO_SPINBOX - case PE_FrameFocusRect: -// Calendar widget and combox both do not use styled itemDelegate - if (widget && !(false -#ifndef QT_NO_CALENDARWIDGET - || qobject_cast(widget->parent()) -#endif //QT_NO_CALENDARWIDGET -#ifndef QT_NO_COMBOBOX - || qobject_cast(widget) -#endif //QT_NO_COMBOBOX - )) { - // no focus selection for touch - if (option->state & State_HasFocus && !QS60StylePrivate::isTouchSupported()) { - painter->save(); - const int penWidth = QS60StylePrivate::focusRectPenWidth(); -#ifdef QT_KEYPAD_NAVIGATION - const Qt::PenStyle penStyle = widget->hasEditFocus() ? Qt::SolidLine :Qt::DashLine; - const qreal opacity = widget->hasEditFocus() ? 0.6 : 0.4; -#else - const Qt::PenStyle penStyle = Qt::SolidLine; - const qreal opacity = 0.5; -#endif - painter->setRenderHint(QPainter::Antialiasing); - painter->setOpacity(opacity); - // Because of Qts coordinate system, we need to tweak the rect by .5 pixels, otherwise it gets blurred. - const qreal rectAdjustment = penWidth % 2?.5:0; - // Also we try to stay inside the option->rect, with penWidth > 1. Therefore these +1/-1 - const QRectF adjustedRect = QRectF(option->rect).adjusted( - rectAdjustment + penWidth - 1, - rectAdjustment + penWidth - 1, - -rectAdjustment - penWidth + 1, - -rectAdjustment - penWidth + 1); - const qreal roundRectRadius = penWidth * 1.5; -#ifdef QT_KEYPAD_NAVIGATION - if (penStyle != Qt::SolidLine) { - painter->setPen(QPen(option->palette.color(QPalette::HighlightedText), penWidth, Qt::SolidLine)); - painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); - } -#endif - painter->setPen(QPen((option->palette.color(QPalette::Text), penWidth, penStyle))); - painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); - painter->restore(); - } - } - break; case PE_Widget: if (QS60StylePrivate::drawsOwnThemeBackground(widget) #ifndef QT_NO_COMBOBOX @@ -2118,8 +2056,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti Q_ASSERT(false); break; case PE_Frame: - if (const QStyleOptionFrameV3 *frame = qstyleoption_cast(option)) - drawPrimitive(PE_FrameFocusRect, frame, painter, widget); break; #ifndef QT_NO_ITEMVIEWS case PE_PanelItemViewItem: @@ -2668,16 +2604,6 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con } ret = visualRect(opt->direction, opt->rect, ret); break; - case SE_FrameContents: - if (QS60StylePrivate::isTouchSupported()) { - return QCommonStyle::subElementRect(element, opt, widget); - } else if (const QStyleOptionFrameV2 *f = qstyleoption_cast(opt)) { - // We shrink the frame contents by focusFrameWidth, so that we can draw the frame around it in keypad navigation mode. - const int frameWidth = QS60StylePrivate::focusRectPenWidth(); - ret = opt->rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); - ret = visualRect(opt->direction, opt->rect, ret); - } - break; default: ret = QCommonStyle::subElementRect(element, opt, widget); } @@ -2778,6 +2704,38 @@ QVariant QS60Style::styleProperty(const char *name) const return d->styleProperty_specific(name); } +bool QS60Style::event(QEvent *e) +{ +#ifdef QT_KEYPAD_NAVIGATION + if (QS60StylePrivate::isTouchSupported()) + return false; + Q_D(QS60Style); + switch (e->type()) { + case QEvent::FocusIn: + if (QWidget *focusWidget = QApplication::focusWidget()) { + if (!d->m_focusFrame) + d->m_focusFrame = new QFocusFrame(focusWidget); + d->m_focusFrame->setWidget(focusWidget); + } else if (d->m_focusFrame) { + d->m_focusFrame->setWidget(0); + } + break; + case QEvent::FocusOut: + if (d->m_focusFrame) + d->m_focusFrame->setWidget(0); + break; + case QEvent::EnterEditFocus: + case QEvent::LeaveEditFocus: + if (d->m_focusFrame) + d->m_focusFrame->update(); + break; + default: + break; + } +#endif + return false; +} + QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index a03803b..c01c40a 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -80,6 +80,8 @@ public: void setStyleProperty(const char *name, const QVariant &value); QVariant styleProperty(const char *name) const; + bool event(QEvent *e); + #ifndef Q_WS_S60 static QStringList partKeys(); static QStringList colorListKeys(); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 2e661c0..ed0abfa 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -292,6 +292,8 @@ public: }; }; +class QFocusFrame; + // Private class #ifdef Q_OS_SYMBIAN NONSHARABLE_CLASS (QS60StylePrivate) @@ -430,8 +432,6 @@ public: //access to theme palette static QPalette* themePalette(); - static int focusRectPenWidth(); - static const layoutHeader m_layoutHeaders[]; static const short data[][MAX_PIXELMETRICS]; @@ -499,6 +499,8 @@ private: // defined theme palette static QPalette *m_themePalette; QPalette m_originalPalette; + + QPointer m_focusFrame; }; QT_END_NAMESPACE -- cgit v0.12 From 9b6edd75d37b25d76349ba7b84677d4c9922cc58 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 28 Aug 2009 17:54:43 +0200 Subject: Revert "Using QFocusFrame to visualize the focus." It was not supposed to go into the master branch. This reverts commit 7ef43dbeedc17eb6fe9b8615b815bd6f1e46babb. modified: src/gui/styles/qs60style.cpp modified: src/gui/styles/qs60style.h modified: src/gui/styles/qs60style_p.h --- src/gui/styles/qs60style.cpp | 190 ++++++++++++++++++++++++++----------------- src/gui/styles/qs60style.h | 2 - src/gui/styles/qs60style_p.h | 6 +- 3 files changed, 118 insertions(+), 80 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 12d4948..b05a1e9 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -67,7 +67,6 @@ #include "qtoolbar.h" #include "qtoolbutton.h" #include "qtreeview.h" -#include "qfocusframe.h" #include "private/qtoolbarextension_p.h" #include "private/qcombobox_p.h" @@ -87,8 +86,6 @@ const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFl static const QByteArray propertyKeyLayouts = "layouts"; static const QByteArray propertyKeyCurrentlayout = "currentlayout"; -static const qreal goldenRatio = 1.618; - const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** {240,320,1,14,true,"QVGA Landscape Mirrored"}, @@ -511,6 +508,11 @@ void QS60StylePrivate::deleteBackground() } } +int QS60StylePrivate::focusRectPenWidth() +{ + return pixelMetric(QS60Style::PM_DefaultFrameWidth); +} + void QS60StylePrivate::setCurrentLayout(int index) { m_pmPointer = data[index]; @@ -948,6 +950,13 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom const QS60StylePrivate::SkinElements handleElement = horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical; QS60StylePrivate::drawSkinElement(handleElement, painter, sliderHandle, flags); + + if (optionSlider->state & State_HasFocus) { + QStyleOptionFocusRect fropt; + fropt.QStyleOption::operator=(*optionSlider); + fropt.rect = subElementRect(SE_SliderFocusRect, optionSlider, widget); + drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); + } } break; #endif // QT_NO_SLIDER @@ -982,6 +991,17 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom drawPrimitive(PE_IndicatorSpinDown, &buttonOption, painter, widget); painter->restore(); } + + if (cmb->subControls & SC_ComboBoxEditField) { + if (cmb->state & State_HasFocus && !cmb->editable) { + QStyleOptionFocusRect focus; + focus.QStyleOption::operator=(*cmb); + focus.rect = cmbxEditField; + focus.state |= State_FocusAtBorder; + focus.backgroundColor = cmb->palette.highlight().color(); + drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); + } + } } break; #endif // QT_NO_COMBOBOX @@ -1059,6 +1079,13 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } } } + if (toolBtn->state & State_HasFocus) { + QStyleOptionFocusRect fr; + fr.QStyleOption::operator=(*toolBtn); + const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget); + fr.rect.adjust(frameWidth, frameWidth, -frameWidth, -frameWidth); + drawPrimitive(PE_FrameFocusRect, &fr, painter, widget); + } if (toolBtn->features & QStyleOptionToolButton::Arrow) { QStyle::PrimitiveElement pe; @@ -1182,6 +1209,13 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom groupBox->palette, groupBox->state & State_Enabled, groupBox->text, textColor.isValid() ? QPalette::NoRole : QPalette::WindowText); painter->restore(); + + if (groupBox->state & State_HasFocus) { + QStyleOptionFocusRect fropt; + fropt.QStyleOption::operator=(*groupBox); + fropt.rect = textRect; + drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); + } } // Draw checkbox @@ -1215,6 +1249,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); drawControl(CE_PushButtonLabel, &subopt, painter, widget); + if (btn->state & State_HasFocus) { + QStyleOptionFocusRect fropt; + fropt.QStyleOption::operator=(*btn); + fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget); + drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); + } } break; case CE_PushButtonBevel: @@ -1572,6 +1612,18 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (verticalTabs) painter->restore(); + if (optionTab.state & State_HasFocus) { + const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); + const int leftBorder = optionTab.rect.left(); + const int rightBorder = optionTab.rect.right() - 1; + + QStyleOptionFocusRect fropt; + fropt.QStyleOption::operator=(*tab); + fropt.rect.setRect(leftBorder + 1 + OFFSET, optionTab.rect.y() + OFFSET, + rightBorder - leftBorder - 2*OFFSET, optionTab.rect.height() - 2*OFFSET); + drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); + } + painter->restore(); } break; @@ -1823,48 +1875,11 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } else if (qobject_cast(widget)) { QCommonStyle::drawControl(element, option, painter, widget); } + if (option->state & State_HasFocus) + drawPrimitive(PE_FrameFocusRect, option, painter, widget); break; case CE_MenuScroller: break; - case CE_FocusFrame: - { - // The pen width should nearly fill the layoutspacings around the widget - const int penWidth = - qMin(pixelMetric(QS60Style::PM_LayoutVerticalSpacing), pixelMetric(QS60Style::PM_LayoutHorizontalSpacing)) - - 2; // But keep 1 pixel distance to the focus widget and 1 pixel to the adjacent widgets - -#ifdef QT_KEYPAD_NAVIGATION - bool editFocus = false; - if (const QFocusFrame *focusFrame = qobject_cast(widget)) { - if (focusFrame->widget() && focusFrame->widget()->hasEditFocus()) - editFocus = true; - } - const qreal opacity = editFocus ? 0.65 : 0.45; // Trial and error factors. Feel free to improve. -#else - const qreal opacity = 0.5; -#endif - // Because of Qts coordinate system, we need to tweak the rect by .5 pixels, otherwise it gets blurred. - const qreal rectAdjustment = (penWidth % 2) ? -.5 : 0; - - // Make sure that the pen stroke is inside the rect - const QRectF adjustedRect = - QRectF(option->rect).adjusted( - rectAdjustment + penWidth, - rectAdjustment + penWidth, - -rectAdjustment - penWidth, - -rectAdjustment - penWidth - ); - - const qreal roundRectRadius = penWidth * goldenRatio; - - painter->save(); - painter->setRenderHint(QPainter::Antialiasing); - painter->setOpacity(opacity); - painter->setPen(QPen(option->palette.color(QPalette::Highlight), penWidth)); - painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); - painter->restore(); - } - break; default: QCommonStyle::drawControl(element, option, painter, widget); } @@ -1886,6 +1901,9 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit, painter, option->rect, flags); + + if (lineEdit->state & State_HasFocus) + drawPrimitive(PE_FrameFocusRect, lineEdit, painter, widget); } break; #endif // QT_NO_LINEEDIT @@ -2012,6 +2030,50 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif //QT_NO_COMBOBOX break; #endif //QT_NO_SPINBOX + case PE_FrameFocusRect: +// Calendar widget and combox both do not use styled itemDelegate + if (widget && !(false +#ifndef QT_NO_CALENDARWIDGET + || qobject_cast(widget->parent()) +#endif //QT_NO_CALENDARWIDGET +#ifndef QT_NO_COMBOBOX + || qobject_cast(widget) +#endif //QT_NO_COMBOBOX + )) { + // no focus selection for touch + if (option->state & State_HasFocus && !QS60StylePrivate::isTouchSupported()) { + painter->save(); + const int penWidth = QS60StylePrivate::focusRectPenWidth(); +#ifdef QT_KEYPAD_NAVIGATION + const Qt::PenStyle penStyle = widget->hasEditFocus() ? Qt::SolidLine :Qt::DashLine; + const qreal opacity = widget->hasEditFocus() ? 0.6 : 0.4; +#else + const Qt::PenStyle penStyle = Qt::SolidLine; + const qreal opacity = 0.5; +#endif + painter->setRenderHint(QPainter::Antialiasing); + painter->setOpacity(opacity); + // Because of Qts coordinate system, we need to tweak the rect by .5 pixels, otherwise it gets blurred. + const qreal rectAdjustment = penWidth % 2?.5:0; + // Also we try to stay inside the option->rect, with penWidth > 1. Therefore these +1/-1 + const QRectF adjustedRect = QRectF(option->rect).adjusted( + rectAdjustment + penWidth - 1, + rectAdjustment + penWidth - 1, + -rectAdjustment - penWidth + 1, + -rectAdjustment - penWidth + 1); + const qreal roundRectRadius = penWidth * 1.5; +#ifdef QT_KEYPAD_NAVIGATION + if (penStyle != Qt::SolidLine) { + painter->setPen(QPen(option->palette.color(QPalette::HighlightedText), penWidth, Qt::SolidLine)); + painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); + } +#endif + painter->setPen(QPen((option->palette.color(QPalette::Text), penWidth, penStyle))); + painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); + painter->restore(); + } + } + break; case PE_Widget: if (QS60StylePrivate::drawsOwnThemeBackground(widget) #ifndef QT_NO_COMBOBOX @@ -2056,6 +2118,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti Q_ASSERT(false); break; case PE_Frame: + if (const QStyleOptionFrameV3 *frame = qstyleoption_cast(option)) + drawPrimitive(PE_FrameFocusRect, frame, painter, widget); break; #ifndef QT_NO_ITEMVIEWS case PE_PanelItemViewItem: @@ -2604,6 +2668,16 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con } ret = visualRect(opt->direction, opt->rect, ret); break; + case SE_FrameContents: + if (QS60StylePrivate::isTouchSupported()) { + return QCommonStyle::subElementRect(element, opt, widget); + } else if (const QStyleOptionFrameV2 *f = qstyleoption_cast(opt)) { + // We shrink the frame contents by focusFrameWidth, so that we can draw the frame around it in keypad navigation mode. + const int frameWidth = QS60StylePrivate::focusRectPenWidth(); + ret = opt->rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); + ret = visualRect(opt->direction, opt->rect, ret); + } + break; default: ret = QCommonStyle::subElementRect(element, opt, widget); } @@ -2704,38 +2778,6 @@ QVariant QS60Style::styleProperty(const char *name) const return d->styleProperty_specific(name); } -bool QS60Style::event(QEvent *e) -{ -#ifdef QT_KEYPAD_NAVIGATION - if (QS60StylePrivate::isTouchSupported()) - return false; - Q_D(QS60Style); - switch (e->type()) { - case QEvent::FocusIn: - if (QWidget *focusWidget = QApplication::focusWidget()) { - if (!d->m_focusFrame) - d->m_focusFrame = new QFocusFrame(focusWidget); - d->m_focusFrame->setWidget(focusWidget); - } else if (d->m_focusFrame) { - d->m_focusFrame->setWidget(0); - } - break; - case QEvent::FocusOut: - if (d->m_focusFrame) - d->m_focusFrame->setWidget(0); - break; - case QEvent::EnterEditFocus: - case QEvent::LeaveEditFocus: - if (d->m_focusFrame) - d->m_focusFrame->update(); - break; - default: - break; - } -#endif - return false; -} - QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index c01c40a..a03803b 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -80,8 +80,6 @@ public: void setStyleProperty(const char *name, const QVariant &value); QVariant styleProperty(const char *name) const; - bool event(QEvent *e); - #ifndef Q_WS_S60 static QStringList partKeys(); static QStringList colorListKeys(); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index ed0abfa..2e661c0 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -292,8 +292,6 @@ public: }; }; -class QFocusFrame; - // Private class #ifdef Q_OS_SYMBIAN NONSHARABLE_CLASS (QS60StylePrivate) @@ -432,6 +430,8 @@ public: //access to theme palette static QPalette* themePalette(); + static int focusRectPenWidth(); + static const layoutHeader m_layoutHeaders[]; static const short data[][MAX_PIXELMETRICS]; @@ -499,8 +499,6 @@ private: // defined theme palette static QPalette *m_themePalette; QPalette m_originalPalette; - - QPointer m_focusFrame; }; QT_END_NAMESPACE -- cgit v0.12 From 7621eec3fb023c7e477080b57c0aba858627091b Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 28 Aug 2009 17:47:11 +0200 Subject: Using QFocusFrame to visualize the focus. When using the keypad navigation, the focus state of a widget is supposed to be well visible. So it makes much sense to use QFocusFrame, which is able to paint a focus marker _around_ the widget. This change should fix the issue that with some S60 themes, the focus was invisible. Also, a lot of code is removed by this change. Task-number: 256470 Reviewed-by: Sami Merila modified: src/gui/styles/qs60style.cpp modified: src/gui/styles/qs60style.h modified: src/gui/styles/qs60style_p.h --- src/gui/styles/qs60style.cpp | 190 +++++++++++++++++-------------------------- src/gui/styles/qs60style.h | 2 + src/gui/styles/qs60style_p.h | 6 +- 3 files changed, 80 insertions(+), 118 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b05a1e9..12d4948 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -67,6 +67,7 @@ #include "qtoolbar.h" #include "qtoolbutton.h" #include "qtreeview.h" +#include "qfocusframe.h" #include "private/qtoolbarextension_p.h" #include "private/qcombobox_p.h" @@ -86,6 +87,8 @@ const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFl static const QByteArray propertyKeyLayouts = "layouts"; static const QByteArray propertyKeyCurrentlayout = "currentlayout"; +static const qreal goldenRatio = 1.618; + const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** {240,320,1,14,true,"QVGA Landscape Mirrored"}, @@ -508,11 +511,6 @@ void QS60StylePrivate::deleteBackground() } } -int QS60StylePrivate::focusRectPenWidth() -{ - return pixelMetric(QS60Style::PM_DefaultFrameWidth); -} - void QS60StylePrivate::setCurrentLayout(int index) { m_pmPointer = data[index]; @@ -950,13 +948,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom const QS60StylePrivate::SkinElements handleElement = horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical; QS60StylePrivate::drawSkinElement(handleElement, painter, sliderHandle, flags); - - if (optionSlider->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*optionSlider); - fropt.rect = subElementRect(SE_SliderFocusRect, optionSlider, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } } break; #endif // QT_NO_SLIDER @@ -991,17 +982,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom drawPrimitive(PE_IndicatorSpinDown, &buttonOption, painter, widget); painter->restore(); } - - if (cmb->subControls & SC_ComboBoxEditField) { - if (cmb->state & State_HasFocus && !cmb->editable) { - QStyleOptionFocusRect focus; - focus.QStyleOption::operator=(*cmb); - focus.rect = cmbxEditField; - focus.state |= State_FocusAtBorder; - focus.backgroundColor = cmb->palette.highlight().color(); - drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); - } - } } break; #endif // QT_NO_COMBOBOX @@ -1079,13 +1059,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } } } - if (toolBtn->state & State_HasFocus) { - QStyleOptionFocusRect fr; - fr.QStyleOption::operator=(*toolBtn); - const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget); - fr.rect.adjust(frameWidth, frameWidth, -frameWidth, -frameWidth); - drawPrimitive(PE_FrameFocusRect, &fr, painter, widget); - } if (toolBtn->features & QStyleOptionToolButton::Arrow) { QStyle::PrimitiveElement pe; @@ -1209,13 +1182,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom groupBox->palette, groupBox->state & State_Enabled, groupBox->text, textColor.isValid() ? QPalette::NoRole : QPalette::WindowText); painter->restore(); - - if (groupBox->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*groupBox); - fropt.rect = textRect; - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } } // Draw checkbox @@ -1249,12 +1215,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); drawControl(CE_PushButtonLabel, &subopt, painter, widget); - if (btn->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*btn); - fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } } break; case CE_PushButtonBevel: @@ -1612,18 +1572,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (verticalTabs) painter->restore(); - if (optionTab.state & State_HasFocus) { - const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); - const int leftBorder = optionTab.rect.left(); - const int rightBorder = optionTab.rect.right() - 1; - - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*tab); - fropt.rect.setRect(leftBorder + 1 + OFFSET, optionTab.rect.y() + OFFSET, - rightBorder - leftBorder - 2*OFFSET, optionTab.rect.height() - 2*OFFSET); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - painter->restore(); } break; @@ -1875,11 +1823,48 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } else if (qobject_cast(widget)) { QCommonStyle::drawControl(element, option, painter, widget); } - if (option->state & State_HasFocus) - drawPrimitive(PE_FrameFocusRect, option, painter, widget); break; case CE_MenuScroller: break; + case CE_FocusFrame: + { + // The pen width should nearly fill the layoutspacings around the widget + const int penWidth = + qMin(pixelMetric(QS60Style::PM_LayoutVerticalSpacing), pixelMetric(QS60Style::PM_LayoutHorizontalSpacing)) + - 2; // But keep 1 pixel distance to the focus widget and 1 pixel to the adjacent widgets + +#ifdef QT_KEYPAD_NAVIGATION + bool editFocus = false; + if (const QFocusFrame *focusFrame = qobject_cast(widget)) { + if (focusFrame->widget() && focusFrame->widget()->hasEditFocus()) + editFocus = true; + } + const qreal opacity = editFocus ? 0.65 : 0.45; // Trial and error factors. Feel free to improve. +#else + const qreal opacity = 0.5; +#endif + // Because of Qts coordinate system, we need to tweak the rect by .5 pixels, otherwise it gets blurred. + const qreal rectAdjustment = (penWidth % 2) ? -.5 : 0; + + // Make sure that the pen stroke is inside the rect + const QRectF adjustedRect = + QRectF(option->rect).adjusted( + rectAdjustment + penWidth, + rectAdjustment + penWidth, + -rectAdjustment - penWidth, + -rectAdjustment - penWidth + ); + + const qreal roundRectRadius = penWidth * goldenRatio; + + painter->save(); + painter->setRenderHint(QPainter::Antialiasing); + painter->setOpacity(opacity); + painter->setPen(QPen(option->palette.color(QPalette::Highlight), penWidth)); + painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); + painter->restore(); + } + break; default: QCommonStyle::drawControl(element, option, painter, widget); } @@ -1901,9 +1886,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit, painter, option->rect, flags); - - if (lineEdit->state & State_HasFocus) - drawPrimitive(PE_FrameFocusRect, lineEdit, painter, widget); } break; #endif // QT_NO_LINEEDIT @@ -2030,50 +2012,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif //QT_NO_COMBOBOX break; #endif //QT_NO_SPINBOX - case PE_FrameFocusRect: -// Calendar widget and combox both do not use styled itemDelegate - if (widget && !(false -#ifndef QT_NO_CALENDARWIDGET - || qobject_cast(widget->parent()) -#endif //QT_NO_CALENDARWIDGET -#ifndef QT_NO_COMBOBOX - || qobject_cast(widget) -#endif //QT_NO_COMBOBOX - )) { - // no focus selection for touch - if (option->state & State_HasFocus && !QS60StylePrivate::isTouchSupported()) { - painter->save(); - const int penWidth = QS60StylePrivate::focusRectPenWidth(); -#ifdef QT_KEYPAD_NAVIGATION - const Qt::PenStyle penStyle = widget->hasEditFocus() ? Qt::SolidLine :Qt::DashLine; - const qreal opacity = widget->hasEditFocus() ? 0.6 : 0.4; -#else - const Qt::PenStyle penStyle = Qt::SolidLine; - const qreal opacity = 0.5; -#endif - painter->setRenderHint(QPainter::Antialiasing); - painter->setOpacity(opacity); - // Because of Qts coordinate system, we need to tweak the rect by .5 pixels, otherwise it gets blurred. - const qreal rectAdjustment = penWidth % 2?.5:0; - // Also we try to stay inside the option->rect, with penWidth > 1. Therefore these +1/-1 - const QRectF adjustedRect = QRectF(option->rect).adjusted( - rectAdjustment + penWidth - 1, - rectAdjustment + penWidth - 1, - -rectAdjustment - penWidth + 1, - -rectAdjustment - penWidth + 1); - const qreal roundRectRadius = penWidth * 1.5; -#ifdef QT_KEYPAD_NAVIGATION - if (penStyle != Qt::SolidLine) { - painter->setPen(QPen(option->palette.color(QPalette::HighlightedText), penWidth, Qt::SolidLine)); - painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); - } -#endif - painter->setPen(QPen((option->palette.color(QPalette::Text), penWidth, penStyle))); - painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); - painter->restore(); - } - } - break; case PE_Widget: if (QS60StylePrivate::drawsOwnThemeBackground(widget) #ifndef QT_NO_COMBOBOX @@ -2118,8 +2056,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti Q_ASSERT(false); break; case PE_Frame: - if (const QStyleOptionFrameV3 *frame = qstyleoption_cast(option)) - drawPrimitive(PE_FrameFocusRect, frame, painter, widget); break; #ifndef QT_NO_ITEMVIEWS case PE_PanelItemViewItem: @@ -2668,16 +2604,6 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con } ret = visualRect(opt->direction, opt->rect, ret); break; - case SE_FrameContents: - if (QS60StylePrivate::isTouchSupported()) { - return QCommonStyle::subElementRect(element, opt, widget); - } else if (const QStyleOptionFrameV2 *f = qstyleoption_cast(opt)) { - // We shrink the frame contents by focusFrameWidth, so that we can draw the frame around it in keypad navigation mode. - const int frameWidth = QS60StylePrivate::focusRectPenWidth(); - ret = opt->rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); - ret = visualRect(opt->direction, opt->rect, ret); - } - break; default: ret = QCommonStyle::subElementRect(element, opt, widget); } @@ -2778,6 +2704,38 @@ QVariant QS60Style::styleProperty(const char *name) const return d->styleProperty_specific(name); } +bool QS60Style::event(QEvent *e) +{ +#ifdef QT_KEYPAD_NAVIGATION + if (QS60StylePrivate::isTouchSupported()) + return false; + Q_D(QS60Style); + switch (e->type()) { + case QEvent::FocusIn: + if (QWidget *focusWidget = QApplication::focusWidget()) { + if (!d->m_focusFrame) + d->m_focusFrame = new QFocusFrame(focusWidget); + d->m_focusFrame->setWidget(focusWidget); + } else if (d->m_focusFrame) { + d->m_focusFrame->setWidget(0); + } + break; + case QEvent::FocusOut: + if (d->m_focusFrame) + d->m_focusFrame->setWidget(0); + break; + case QEvent::EnterEditFocus: + case QEvent::LeaveEditFocus: + if (d->m_focusFrame) + d->m_focusFrame->update(); + break; + default: + break; + } +#endif + return false; +} + QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index a03803b..c01c40a 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -80,6 +80,8 @@ public: void setStyleProperty(const char *name, const QVariant &value); QVariant styleProperty(const char *name) const; + bool event(QEvent *e); + #ifndef Q_WS_S60 static QStringList partKeys(); static QStringList colorListKeys(); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 2e661c0..ed0abfa 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -292,6 +292,8 @@ public: }; }; +class QFocusFrame; + // Private class #ifdef Q_OS_SYMBIAN NONSHARABLE_CLASS (QS60StylePrivate) @@ -430,8 +432,6 @@ public: //access to theme palette static QPalette* themePalette(); - static int focusRectPenWidth(); - static const layoutHeader m_layoutHeaders[]; static const short data[][MAX_PIXELMETRICS]; @@ -499,6 +499,8 @@ private: // defined theme palette static QPalette *m_themePalette; QPalette m_originalPalette; + + QPointer m_focusFrame; }; QT_END_NAMESPACE -- cgit v0.12 From 31affef31b3743a23cf6f099d6a8f72b371586b4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 28 Aug 2009 17:57:42 +0200 Subject: Mark the QSharedPointer with Qt::Uninitialized explicit That ensures we don't create ambiguities. QSharedPointer shouldn't have any implicit constructors. Suggested-By: Olivier Goffart --- src/corelib/tools/qsharedpointer_impl.h | 2 +- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 90ca34f..e4f7ba9 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -511,7 +511,7 @@ public: QWeakPointer toWeakRef() const; protected: - inline QSharedPointer(Qt::Initialization i) : BaseClass(i) {} + inline explicit QSharedPointer(Qt::Initialization i) : BaseClass(i) {} public: static inline QSharedPointer create() diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 93f5b6e..d3df376 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -548,6 +548,13 @@ class OtherObject: public QObject void tst_QSharedPointer::qobjectWeakManagement() { { + QWeakPointer weak; + weak = QWeakPointer(); + QVERIFY(weak.isNull()); + QVERIFY(!weak.data()); + } + + { QObject *obj = new QObject; QWeakPointer weak(obj); QVERIFY(!weak.isNull()); @@ -1661,6 +1668,11 @@ void tst_QSharedPointer::invalidConstructs_data() << "QObject *ptr = new QObject;\n" "QWeakPointer weak = ptr;\n" // this makes the object unmanaged "QSharedPointer shared(ptr);\n"; + + QTest::newRow("shared-pointer-implicit-from-uninitialized") + << &QTest::QExternalTest::tryCompileFail + << "Data *ptr = 0;\n" + "QSharedPointer weakptr = Qt::Uninitialized;\n"; } void tst_QSharedPointer::invalidConstructs() -- cgit v0.12 From 761793aec914f4af5b3145400091c58b74c37ebf Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 28 Aug 2009 19:07:49 +0200 Subject: Removing an obviously obsolete LIBS includion workaround. Reviewed-By: Trustme --- src/gui/styles/styles.pri | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 70ac6cb..7e725c0 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -168,8 +168,6 @@ contains( styles, s60 ):contains(QT_CONFIG, s60) { SOURCES += styles/qs60style.cpp symbian { SOURCES += styles/qs60style_s60.cpp - # TODO: fix the following LIBS hack. Line 1 is for armv5, 2 for winscw - LIBS += aknicon aknskins aknskinsrv fontutils LIBS += -laknicon -laknskins -laknskinsrv -lfontutils } else { SOURCES += styles/qs60style_simulated.cpp -- cgit v0.12 From 93232a4283cf2fc1e64fe63f70ac3fb0250c8b23 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Fri, 28 Aug 2009 18:23:05 +0200 Subject: QMetaObjectPrivate: refactor internal disconnect to avoid duplicate code Reviewed-by: ogoffart --- src/corelib/kernel/qmetaobject_p.h | 5 ++- src/corelib/kernel/qobject.cpp | 91 ++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 49 deletions(-) diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index d843deb..fdf36f3 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -102,6 +102,7 @@ enum MetaObjectFlags { DynamicMetaObject = 0x01 }; +class QMutex; struct QMetaObjectPrivate { @@ -127,7 +128,9 @@ struct QMetaObjectPrivate int type = 0, int *types = 0); static bool disconnect(const QObject *sender, int signal_index, const QObject *receiver, int method_index); - + static inline bool disconnectHelper(QObjectPrivate::Connection *c, + const QObject *receiver, int method_index, + QMutex *senderMutex); }; #ifndef UTILS_H diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index e080bd6..6a451d5 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3079,6 +3079,43 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index, } /*! \internal + Helper function to remove the connection from the senders list and setting the receivers to 0 + */ +bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c, + const QObject *receiver, int method_index, + QMutex *senderMutex) +{ + bool success = false; + while (c) { + if (c->receiver + && (receiver == 0 || (c->receiver == receiver + && (method_index < 0 || c->method == method_index)))) { + bool needToUnlock = false; + QMutex *receiverMutex = 0; + if (!receiver) { + receiverMutex = signalSlotLock(c->receiver); + // need to relock this receiver and sender in the correct order + needToUnlock = QOrderedMutexLocker::relock(senderMutex, receiverMutex); + } + if (c->receiver) { + *c->prev = c->next; + if (c->next) + c->next->prev = c->prev; + } + + if (needToUnlock) + receiverMutex->unlock(); + + c->receiver = 0; + + success = true; + } + c = c->nextConnectionList; + } + return success; +} + +/*! \internal Same as the QMetaObject::disconnect, but \a signal_index must be the result of QObjectPrivate::signalIndex */ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, @@ -3088,7 +3125,6 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, return false; QObject *s = const_cast(sender); - QObject *r = const_cast(receiver); QMutex *senderMutex = signalSlotLock(sender); QMutex *receiverMutex = receiver ? signalSlotLock(receiver) : 0; @@ -3107,58 +3143,17 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, for (signal_index = -1; signal_index < connectionLists->count(); ++signal_index) { QObjectPrivate::Connection *c = (*connectionLists)[signal_index].first; - while (c) { - if (c->receiver - && (r == 0 || (c->receiver == r - && (method_index < 0 || c->method == method_index)))) { - QMutex *m = signalSlotLock(c->receiver); - bool needToUnlock = false; - if (!receiverMutex && senderMutex != m) { - // need to relock this receiver and sender in the correct order - needToUnlock = QOrderedMutexLocker::relock(senderMutex, m); - } - if (c->receiver) { - *c->prev = c->next; - if (c->next) c->next->prev = c->prev; - } - - if (needToUnlock) - m->unlock(); - - c->receiver = 0; - - success = true; - connectionLists->dirty = true; - } - c = c->nextConnectionList; + if (disconnectHelper(c, receiver, method_index, senderMutex)) { + success = true; + connectionLists->dirty = true; } } } else if (signal_index < connectionLists->count()) { QObjectPrivate::Connection *c = (*connectionLists)[signal_index].first; - while (c) { - if (c->receiver - && (r == 0 || (c->receiver == r - && (method_index < 0 || c->method == method_index)))) { - QMutex *m = signalSlotLock(c->receiver); - bool needToUnlock = false; - if (!receiverMutex && senderMutex != m) { - // need to relock this receiver and sender in the correct order - needToUnlock = QOrderedMutexLocker::relock(senderMutex, m); - } - if (c->receiver) { - *c->prev = c->next; - if (c->next) c->next->prev = c->prev; - } - - if (needToUnlock) - m->unlock(); - c->receiver = 0; - - success = true; - connectionLists->dirty = true; - } - c = c->nextConnectionList; + if (disconnectHelper(c, receiver, method_index, senderMutex)) { + success = true; + connectionLists->dirty = true; } } -- cgit v0.12 From 850a179f0f879a37302780148dd1900fc5a69d3b Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 28 Aug 2009 19:49:40 +0200 Subject: Added a default theme for the simulated S60 style Reviewed-By: Trustme --- src/gui/styles/images/defaults60theme.blob | Bin 0 -> 74127 bytes src/gui/styles/qs60style_simulated.cpp | 3 +-- src/gui/styles/qstyle_s60_simulated.qrc | 2 +- src/gui/styles/styles.pri | 1 + 4 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 src/gui/styles/images/defaults60theme.blob diff --git a/src/gui/styles/images/defaults60theme.blob b/src/gui/styles/images/defaults60theme.blob new file mode 100644 index 0000000..f3a5952 Binary files /dev/null and b/src/gui/styles/images/defaults60theme.blob differ diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 350ef51..2d185bd 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -366,8 +366,7 @@ QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCate QS60Style::QS60Style() : QCommonStyle(*new QS60StylePrivate) { - // Assume, that the resource system has a ':/s60Stylethemes/Default.blob' - const QString defaultBlob = QString::fromLatin1(":/s60Stylethemes/Default.blob"); + const QString defaultBlob = QString::fromLatin1(":/trolltech/styles/s60style/images/defaults60theme.blob"); if (QFile::exists(defaultBlob)) loadS60ThemeFromBlob(defaultBlob); } diff --git a/src/gui/styles/qstyle_s60_simulated.qrc b/src/gui/styles/qstyle_s60_simulated.qrc index 72aab9e..969732e 100644 --- a/src/gui/styles/qstyle_s60_simulated.qrc +++ b/src/gui/styles/qstyle_s60_simulated.qrc @@ -1,6 +1,6 @@ - images/s60themes.dat + images/defaults60theme.blob diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 7e725c0..767ade0 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -171,6 +171,7 @@ contains( styles, s60 ):contains(QT_CONFIG, s60) { LIBS += -laknicon -laknskins -laknskinsrv -lfontutils } else { SOURCES += styles/qs60style_simulated.cpp + RESOURCES += styles/qstyle_s60_simulated.qrc } } else { DEFINES += QT_NO_STYLE_S60 -- cgit v0.12 From bdb8379d84218c55d573ecef8c3fa13fa57f0bc7 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 28 Aug 2009 19:51:22 +0200 Subject: Warning -- --- src/gui/styles/qs60style.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 12d4948..3230c17 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2732,6 +2732,8 @@ bool QS60Style::event(QEvent *e) default: break; } +#else + Q_UNUSED(e) #endif return false; } -- cgit v0.12 From d23863952b0c13ccd8b2989d24153d94b3d3f83d Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 28 Aug 2009 23:16:29 +0200 Subject: trivial: make moc compile again --- src/corelib/kernel/qmetaobject_p.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index fdf36f3..572e727 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -122,6 +122,7 @@ struct QMetaObjectPrivate static int indexOfSignalRelative(const QMetaObject **baseObject, const char* name); static int originalClone(const QMetaObject *obj, int local_method_index); +#ifndef QT_NO_QOBJECT //defined in qobject.cpp static bool connect(const QObject *sender, int signal_index, const QObject *receiver, int method_index, @@ -131,6 +132,7 @@ struct QMetaObjectPrivate static inline bool disconnectHelper(QObjectPrivate::Connection *c, const QObject *receiver, int method_index, QMutex *senderMutex); +#endif }; #ifndef UTILS_H -- cgit v0.12 From be1140bf0040963b50a5b80be123245c98833b96 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 31 Aug 2009 09:56:12 +1000 Subject: Destroy EGL window surface when direct VG surface is deleted OpenVG window surfaces were leaking because the QVGEGLWindowSurfaceDirect destructor was previously not cleaning up the EGLSurface object. Reviewed-by: trustme --- src/openvg/qwindowsurface_vgegl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index ae91bb2..ba711b7 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -618,6 +618,12 @@ QVGEGLWindowSurfaceDirect::QVGEGLWindowSurfaceDirect(QWindowSurface *win) QVGEGLWindowSurfaceDirect::~QVGEGLWindowSurfaceDirect() { + destroyPaintEngine(); + if (context) { + if (windowSurface != EGL_NO_SURFACE) + qt_vg_destroy_surface(context, windowSurface); + qt_vg_destroy_context(context); + } } QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget) -- cgit v0.12 From 4aec7f5a065ed84f93f01088d5b394950c23646d Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 31 Aug 2009 09:56:57 +1000 Subject: Fixes race condition on reopening an ODBC connection. Original code was keeping it's own (out of date) copy of the handles. It now includes a pointer to the driver private, and asks that what the handles are instead. --- src/sql/drivers/odbc/qsql_odbc.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 06ee3e1..43658f7 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -126,8 +126,8 @@ private: class QODBCPrivate { public: - QODBCPrivate() - : hEnv(0), hDbc(0), hStmt(0), useSchema(false), hasSQLFetchScroll(true) + QODBCPrivate(QODBCDriverPrivate *dpp) + : hStmt(0), useSchema(false), hasSQLFetchScroll(true), driverPrivate(dpp) { unicode = false; } @@ -135,8 +135,8 @@ public: inline void clearValues() { fieldCache.fill(QVariant()); fieldCacheIdx = 0; } - SQLHANDLE hEnv; - SQLHANDLE hDbc; + SQLHANDLE dpEnv() const { return driverPrivate ? driverPrivate->hEnv : 0;} + SQLHANDLE dpDbc() const { return driverPrivate ? driverPrivate->hDbc : 0;} SQLHANDLE hStmt; uint unicode :1; @@ -147,6 +147,7 @@ public: int fieldCacheIdx; int disconnectCount; bool hasSQLFetchScroll; + QODBCDriverPrivate *driverPrivate; bool isStmtHandleValid(const QSqlDriver *driver); void updateStmtHandleState(const QSqlDriver *driver); @@ -208,8 +209,8 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode static QString qODBCWarn(const QODBCPrivate* odbc, int *nativeCode = 0) { - return (qWarnODBCHandle(SQL_HANDLE_ENV, odbc->hEnv) + QLatin1Char(' ') - + qWarnODBCHandle(SQL_HANDLE_DBC, odbc->hDbc) + QLatin1Char(' ') + return (qWarnODBCHandle(SQL_HANDLE_ENV, odbc->dpEnv()) + QLatin1Char(' ') + + qWarnODBCHandle(SQL_HANDLE_DBC, odbc->dpDbc()) + QLatin1Char(' ') + qWarnODBCHandle(SQL_HANDLE_STMT, odbc->hStmt, nativeCode)); } @@ -247,6 +248,7 @@ static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type, template static QVariant::Type qDecodeODBCType(SQLSMALLINT sqltype, const T* p, bool isSigned = true) { + Q_UNUSED(p); QVariant::Type type = QVariant::Invalid; switch (sqltype) { case SQL_DECIMAL: @@ -799,9 +801,7 @@ QString QODBCDriverPrivate::adjustCase(const QString &identifier) const QODBCResult::QODBCResult(const QODBCDriver * db, QODBCDriverPrivate* p) : QSqlResult(db) { - d = new QODBCPrivate(); - d->hEnv = p->hEnv; - d->hDbc = p->hDbc; + d = new QODBCPrivate(p); d->unicode = p->unicode; d->useSchema = p->useSchema; d->disconnectCount = p->disconnectCount; @@ -839,7 +839,7 @@ bool QODBCResult::reset (const QString& query) } } r = SQLAllocHandle(SQL_HANDLE_STMT, - d->hDbc, + d->dpDbc(), &d->hStmt); if (r != SQL_SUCCESS) { qSqlWarning(QLatin1String("QODBCResult::reset: Unable to allocate statement handle"), d); @@ -1180,7 +1180,7 @@ bool QODBCResult::prepare(const QString& query) } } r = SQLAllocHandle(SQL_HANDLE_STMT, - d->hDbc, + d->dpDbc(), &d->hStmt); if (r != SQL_SUCCESS) { qSqlWarning(QLatin1String("QODBCResult::prepare: Unable to allocate statement handle"), d); -- cgit v0.12 From 528106b2ffa39b8f0a2bc4d1b4e23419eaf454ca Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 31 Aug 2009 10:44:26 +1000 Subject: Remove QGLShader from its QGLShaderProgram when it is destroyed Reviewed-by: Samuel --- src/opengl/qglshaderprogram.cpp | 24 ++++++++++++++++++++---- src/opengl/qglshaderprogram.h | 3 +++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index b07fb3b..6e3ea88 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -701,6 +701,7 @@ public: , linked(false) , inited(false) , hasPartialShaders(false) + , removingShaders(false) , vertexShader(0) , fragmentShader(0) { @@ -716,6 +717,7 @@ public: bool linked; bool inited; bool hasPartialShaders; + bool removingShaders; QString log; QList shaders; QList anonShaders; @@ -813,6 +815,7 @@ bool QGLShaderProgram::addShader(QGLShader *shader) } d->linked = false; // Program needs to be relinked. d->shaders.append(shader); + connect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed())); return true; } else { return false; @@ -917,12 +920,14 @@ bool QGLShaderProgram::addShaderFromFile */ void QGLShaderProgram::removeShader(QGLShader *shader) { - if (d->program && shader && shader->d->shader) { + if (d->program && shader && shader->d->shader) glDetachShader(d->program, shader->d->shader); - d->linked = false; // Program needs to be relinked. + d->linked = false; // Program needs to be relinked. + if (shader) { + d->shaders.removeAll(shader); + d->anonShaders.removeAll(shader); + disconnect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed())); } - d->shaders.removeAll(shader); - d->anonShaders.removeAll(shader); } /*! @@ -946,6 +951,7 @@ QList QGLShaderProgram::shaders() const */ void QGLShaderProgram::removeAllShaders() { + d->removingShaders = true; foreach (QGLShader *shader, d->shaders) { if (d->program && shader && shader->d->shader) glDetachShader(d->program, shader->d->shader); @@ -957,6 +963,7 @@ void QGLShaderProgram::removeAllShaders() d->shaders.clear(); d->anonShaders.clear(); d->linked = false; // Program needs to be relinked. + d->removingShaders = false; } #if defined(QT_OPENGL_ES_2) @@ -2977,6 +2984,15 @@ bool QGLShaderProgram::hasShaderPrograms(const QGLContext *context) #endif } +/*! + \internal +*/ +void QGLShaderProgram::shaderDestroyed() +{ + QGLShader *shader = qobject_cast(sender()); + if (shader && !d->removingShaders) + removeShader(shader); +} #endif diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index d747679..8d6efab 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -282,6 +282,9 @@ public: static bool hasShaderPrograms(const QGLContext *context = 0); +private Q_SLOTS: + void shaderDestroyed(); + private: QGLShaderProgramPrivate *d; -- cgit v0.12 From 46403d21e1cfd5b4b89244067a4111d5c2c0ff1a Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 31 Aug 2009 10:52:12 +1000 Subject: Move QGLShareContextScope to qgl_p.h so other things can use it. Reviewed-by: trustme --- src/opengl/qgl_p.h | 40 ++++++++++++++++++++++++++++++++++++++++ src/opengl/qpixmapdata_gl.cpp | 37 ------------------------------------- 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 6905199..5496819 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -533,6 +533,46 @@ private: FreeFunc free; }; +// Temporarily make a context current if not already current or +// shared with the current contex. The previous context is made +// current when the object goes out of scope. +class Q_OPENGL_EXPORT QGLShareContextScope +{ +public: + QGLShareContextScope(const QGLContext *ctx) + : m_oldContext(0) + { + QGLContext *currentContext = const_cast(QGLContext::currentContext()); + if (currentContext != ctx && !qgl_share_reg()->checkSharing(ctx, currentContext)) { + m_oldContext = currentContext; + m_ctx = const_cast(ctx); + m_ctx->makeCurrent(); + } else { + m_ctx = currentContext; + } + } + + operator QGLContext *() + { + return m_ctx; + } + + QGLContext *operator->() + { + return m_ctx; + } + + ~QGLShareContextScope() + { + if (m_oldContext) + m_oldContext->makeCurrent(); + } + +private: + QGLContext *m_oldContext; + QGLContext *m_ctx; +}; + QT_END_NAMESPACE #endif // QGL_P_H diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index c193f12..e18f98b 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -132,43 +132,6 @@ void QGLFramebufferObjectPool::release(QGLFramebufferObject *fbo) m_fbos << fbo; } -class QGLShareContextScope -{ -public: - QGLShareContextScope(const QGLContext *ctx) - : m_oldContext(0) - { - QGLContext *currentContext = const_cast(QGLContext::currentContext()); - if (currentContext != ctx && !qgl_share_reg()->checkSharing(ctx, currentContext)) { - m_oldContext = currentContext; - m_ctx = const_cast(ctx); - m_ctx->makeCurrent(); - } else { - m_ctx = currentContext; - } - } - - operator QGLContext *() - { - return m_ctx; - } - - QGLContext *operator->() - { - return m_ctx; - } - - ~QGLShareContextScope() - { - if (m_oldContext) - m_oldContext->makeCurrent(); - } - -private: - QGLContext *m_oldContext; - QGLContext *m_ctx; -}; - static int qt_gl_pixmap_serial = 0; QGLPixmapData::QGLPixmapData(PixelType type) -- cgit v0.12 From 6f1ff3ec69cc6365d61fccf80e97f9afa317395d Mon Sep 17 00:00:00 2001 From: Peter Yard Date: Mon, 31 Aug 2009 12:40:23 +1000 Subject: Added doc link to point to Assistant doc table of collection file values. Fix for task 259252. --- tools/assistant/lib/qhelpenginecore.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/assistant/lib/qhelpenginecore.cpp b/tools/assistant/lib/qhelpenginecore.cpp index 3f8bc02..e642295 100644 --- a/tools/assistant/lib/qhelpenginecore.cpp +++ b/tools/assistant/lib/qhelpenginecore.cpp @@ -175,6 +175,14 @@ void QHelpEngineCorePrivate::errorReceived(const QString &msg) This class does not offer any GUI components or functionality for indices or contents. If you need one of those use QHelpEngine instead. + + When creating a custom help viewer the viewer can be +configured by writing a custom collection file which could contain various +keywords to be used to configure the help engine. These keywords and values +and their meaning can be found in the help information for +\l{assistant-custom-help-viewer.html#creating-a-custom-help-collection-file +}{creating a custom help collection file} for +Assistant. */ /*! -- cgit v0.12 From 3b74c6350ab789c31a938df0807c8c9399bc4fcb Mon Sep 17 00:00:00 2001 From: Keith Isdale Date: Mon, 31 Aug 2009 13:58:40 +1000 Subject: Correct grammatical in documentation for QNetworkDiskCache::expire() The text: When the current size of the cache is greater then the maximumCacheSize() should read When the current size of the cache is greater than the maximumCacheSize() Task-number: 260496 Reviewed-by: Zheng Liu (George) --- src/network/access/qnetworkdiskcache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 167f5d5..21d52c8 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -466,7 +466,7 @@ void QNetworkDiskCache::setMaximumCacheSize(qint64 size) Cleans the cache so that its size is under the maximum cache size. Returns the current size of the cache. - When the current size of the cache is greater then the maximumCacheSize() + When the current size of the cache is greater than the maximumCacheSize() older cache files are removed until the total size is less then 90% of maximumCacheSize() starting with the oldest ones first using the file creation date to determine how old a cache file is. -- cgit v0.12 From 8d636ab46ccfc3ab37083f947a7c184df47ddcb9 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 31 Aug 2009 15:07:12 +1000 Subject: Adds ability to open sqlite databases readonly. Changes opening of sqlite to open_v2, and adds a new connection option. Reviewed-by: Justin McPherson --- src/sql/drivers/sqlite/qsql_sqlite.cpp | 24 ++++++++++++++++++------ src/sql/kernel/qsqldatabase.cpp | 1 + 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 81afbf9..1b5c9c5 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -502,15 +502,27 @@ static int qGetSqliteTimeout(QString opts) enum { DefaultTimeout = 5000 }; opts.remove(QLatin1Char(' ')); - if (opts.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) { - bool ok; - int nt = opts.mid(21).toInt(&ok); - if (ok) - return nt; + foreach(QString option, opts.split(QLatin1Char(';'))) { + if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) { + bool ok; + int nt = option.mid(21).toInt(&ok); + if (ok) + return nt; + } } return DefaultTimeout; } +static int qGetSqliteOpenMode(QString opts) +{ + opts.remove(QLatin1Char(' ')); + foreach(QString option, opts.split(QLatin1Char(';'))) { + if (option == QLatin1String("QSQLITE_OPEN_READONLY"))) + return SQLITE_OPEN_READONLY; + } + return SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; +} + /* SQLite dbs have no user name, passwords, hosts or ports. just file names. @@ -523,7 +535,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c if (db.isEmpty()) return false; - if (sqlite3_open16(db.constData(), &d->access) == SQLITE_OK) { + if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, qGetSqliteOpenMode(conOpts), NULL) == SQLITE_OK) { sqlite3_busy_timeout(d->access, qGetSqliteTimeout(conOpts)); setOpen(true); setOpenError(false); diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index d155c03..16bd05b 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -1263,6 +1263,7 @@ QSqlRecord QSqlDatabase::record(const QString& tablename) const \i \list \i QSQLITE_BUSY_TIMEOUT + \i QSQLITE_OPEN_READONLY \endlist \i -- cgit v0.12 From 72f277c3340ad4c6182bd203d21832b9fdace78f Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 31 Aug 2009 15:24:05 +1000 Subject: Fixes compile for my last change. --- src/sql/drivers/sqlite/qsql_sqlite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 1b5c9c5..db7950d 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -517,7 +517,7 @@ static int qGetSqliteOpenMode(QString opts) { opts.remove(QLatin1Char(' ')); foreach(QString option, opts.split(QLatin1Char(';'))) { - if (option == QLatin1String("QSQLITE_OPEN_READONLY"))) + if (option == QLatin1String("QSQLITE_OPEN_READONLY")) return SQLITE_OPEN_READONLY; } return SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; -- cgit v0.12 From 10c3a3bf11d6bbd8f8e99028ecab41acb89b7273 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 31 Aug 2009 15:26:12 +1000 Subject: Fix license headers. Reviewed-by: Trust Me --- doc/src/snippets/qxmlquery/bindingExample.cpp | 41 +++++++++++++++ doc/src/snippets/signalmapper/filereader.cpp | 41 +++++++++++++++ doc/src/snippets/signalmapper/main.cpp | 41 +++++++++++++++ src/xmlpatterns/parser/qquerytransformparser.cpp | 61 ---------------------- .../xmlpatternsxqts/lib/tests/XMLWriterTest.cpp | 41 --------------- 5 files changed, 123 insertions(+), 102 deletions(-) diff --git a/doc/src/snippets/qxmlquery/bindingExample.cpp b/doc/src/snippets/qxmlquery/bindingExample.cpp index 8ed9974..15905cd 100644 --- a/doc/src/snippets/qxmlquery/bindingExample.cpp +++ b/doc/src/snippets/qxmlquery/bindingExample.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + //! [0] QBuffer device; device.setData(myQString.toUtf8()); diff --git a/doc/src/snippets/signalmapper/filereader.cpp b/doc/src/snippets/signalmapper/filereader.cpp index 8732dab..c25a8a7 100644 --- a/doc/src/snippets/signalmapper/filereader.cpp +++ b/doc/src/snippets/signalmapper/filereader.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include #include "filereader.h" diff --git a/doc/src/snippets/signalmapper/main.cpp b/doc/src/snippets/signalmapper/main.cpp index ebc601b..744b0b3 100644 --- a/doc/src/snippets/signalmapper/main.cpp +++ b/doc/src/snippets/signalmapper/main.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include #include "filereader.h" diff --git a/src/xmlpatterns/parser/qquerytransformparser.cpp b/src/xmlpatterns/parser/qquerytransformparser.cpp index 4a960c3..d2cfbf3 100644 --- a/src/xmlpatterns/parser/qquerytransformparser.cpp +++ b/src/xmlpatterns/parser/qquerytransformparser.cpp @@ -39,16 +39,6 @@ ** ****************************************************************************/ -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - /* A Bison parser, made by GNU Bison 2.3a. */ /* Skeleton implementation for Bison's Yacc-like parsers in C @@ -123,57 +113,6 @@ /* Line 164 of yacc.c. */ #line 22 "querytransformparser.ypp" -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtXmlPatterns 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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - #include #include diff --git a/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp b/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp index 1f603ff..15b7e0b 100644 --- a/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp +++ b/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp @@ -38,47 +38,6 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Patternist project on Trolltech Labs. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. -** $QT_END_LICENSE$ -** -*************************************************************************** - */ #include -- cgit v0.12 From a78c47247ecf67ea8a406bb394d2837e4c18cdc8 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 31 Aug 2009 09:07:17 +0300 Subject: Added QContextMenuEvent sending to widget in Symbian. The event construction without sending does nothing, sending constructed event possibly dissappeared due to bad merge or something. So here it comes again... Task-number: 260222 Reviewed-by: TrustMe --- src/gui/kernel/qapplication_s60.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 648a5d5..87cf82e 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -351,7 +351,8 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons bool res = sendMouseEvent(alienWidget, &mEvent); #if !defined(QT_NO_CONTEXTMENU) - QContextMenuEvent e2(QContextMenuEvent::Mouse, widgetPos, globalPos, mEvent.modifiers()); + QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, mEvent.modifiers()); + qt_sendSpontaneousEvent(alienWidget, &contextMenuEvent); #endif m_previousEventLongTap = true; -- cgit v0.12 From cdb689777841e40d6b017f3e57bcce62992c10b6 Mon Sep 17 00:00:00 2001 From: Keith Isdale Date: Mon, 31 Aug 2009 17:18:10 +1000 Subject: Update the qmake autotest: re MSVC test failure findMocs and findDeps When MSVC is used the default DESTDIR makes use a release/debug suffix. For these tests DESTDIR needs to be "."/ Minor code cleanup was done whilst correcting these effected .pro files Reviewed-by: Lincoln Ramsay --- tests/auto/qmake/testdata/findDeps/findDeps.pro | 7 ++----- tests/auto/qmake/testdata/findMocs/findMocs.pro | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/auto/qmake/testdata/findDeps/findDeps.pro b/tests/auto/qmake/testdata/findDeps/findDeps.pro index e0a2b86..43577b5 100644 --- a/tests/auto/qmake/testdata/findDeps/findDeps.pro +++ b/tests/auto/qmake/testdata/findDeps/findDeps.pro @@ -1,11 +1,8 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Thu Mar 12 11:08:20 2009 -###################################################################### - TEMPLATE = app -TARGET = +TARGET = findDeps DEPENDPATH += . INCLUDEPATH += . +DESTDIR = ./ # Input HEADERS += object1.h \ diff --git a/tests/auto/qmake/testdata/findMocs/findMocs.pro b/tests/auto/qmake/testdata/findMocs/findMocs.pro index daa3c7f..1469b4c 100644 --- a/tests/auto/qmake/testdata/findMocs/findMocs.pro +++ b/tests/auto/qmake/testdata/findMocs/findMocs.pro @@ -1,11 +1,8 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Wed Mar 11 16:11:09 2009 -###################################################################### - TEMPLATE = app -TARGET = +TARGET = findMocs DEPENDPATH += . INCLUDEPATH += . +DESTDIR = ./ # Input HEADERS += object1.h object2.h object3.h object4.h object5.h object6.h object7.h -- cgit v0.12 From 3f44ecdaa7366a69545f331a20988f7753158123 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 31 Aug 2009 10:38:16 +0300 Subject: Removed hard-coded sqlite3 deployment statement - used PKG conditions. Before this change Qt did not install to device which had sqlite3 already in ROM. Since we now install the sqlite3 only if it is not on any drive, the installation works also with preinstalled sqlite. Even better appraoch would be to use embedded SIS file for sqlite, since that would allow sqlite3 upgrade without upgrading the whole Qt. However we yet don't have such SIS, but once we get one from Symbian this needs to be further changed. Task-number: 258858 Reviewed-by: Miikka Heikkinen --- src/s60installs/s60installs.pro | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 0314958..d691dd5 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -25,17 +25,13 @@ symbian: { qts60plugin_5_0.dll - # TODO: This should be conditional in PKG file, see commented code below - # However we don't yet have such mechanism in place - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - contains(CONFIG, system-sqlite): qtlibraries.sources += sqlite3.dll - } - - #; EXISTS statement does not resolve !. Lets check the most common drives - #IF NOT EXISTS("c:\sys\bin\sqlite3.dll") AND NOT EXISTS("e:\sys\bin\sqlite3.dll") AND NOT EXISTS("z:\sys\bin\sqlite3.dll") - #"\Epoc32\release\armv5\UREL\sqlite3.dll"-"!:\sys\bin\sqlite3.dll" - #ENDIF - + sqlitedeployment = \ + "; EXISTS statement does not resolve!. Lets check the most common drives" \ + "IF NOT EXISTS(\"c:\\sys\\bin\\sqlite3.dll\") AND NOT EXISTS(\"e:\\sys\\bin\\sqlite3.dll\") AND NOT EXISTS(\"z:\\sys\\bin\\sqlite3.dll\")" \ + "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\"-\"!:\\sys\\bin\\sqlite3.dll\"" \ + "ENDIF" + qtlibraries.pkg_postrules = sqlitedeployment + qtlibraries.path = /sys/bin vendorinfo = \ -- cgit v0.12 From 01ee1740290ad192f98bb1d3d24e419e08be5806 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 31 Aug 2009 10:45:05 +0300 Subject: Trivial change to comment. Reviewed-by: TrustMe --- src/s60installs/s60installs.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index d691dd5..390cc11 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -6,6 +6,7 @@ symbian: { SUBDIRS= # WARNING: Changing TARGET name will break Symbian SISX upgrade functionality + # DO NOT TOUCH TARGET VARIABLE IF YOU ARE NOT SURE WHAT YOU ARE DOING TARGET = "Qt for S60" TARGET.UID3 = 0x2001E61C VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} -- cgit v0.12 From 10e3f11057218dac621087980bc37db464838941 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 31 Aug 2009 10:46:01 +0300 Subject: Fixed createpackage to use lowercase target to be Linux compliant. All S60 SDK paths in Linux are lowercase. Reviewed-by: TrustMe --- bin/createpackage.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index af46e04..a180864 100644 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -52,7 +52,7 @@ unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly) # Read params to variables my $templatepkg = $ARGV[0]; -my $targetplatform = uc $ARGV[1]; +my $targetplatform = lc $ARGV[1]; my @tmpvalues = split('-', $targetplatform); my $target = $tmpvalues[0]; -- cgit v0.12 From 9f7fd4923e04b3a5022e1f9b60ec1823918aefac Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Sat, 29 Aug 2009 18:04:18 +0200 Subject: Benchmark test for QSvgRenderer. Right now mostly testing the constructor and the parser. The only SVG to be tested so far is tiger.svg, i.e. the famous Tiger head converted from tiger.eps found in GPL-ed Ghostscript. Reviewed-by: Kim --- tests/benchmarks/qsvgrenderer/data/tiger.svg | 730 +++++++++++++++++++++ tests/benchmarks/qsvgrenderer/qsvgrenderer.pro | 9 + tests/benchmarks/qsvgrenderer/qsvgrenderer.qrc | 6 + tests/benchmarks/qsvgrenderer/tst_qsvgrenderer.cpp | 103 +++ 4 files changed, 848 insertions(+) create mode 100644 tests/benchmarks/qsvgrenderer/data/tiger.svg create mode 100644 tests/benchmarks/qsvgrenderer/qsvgrenderer.pro create mode 100644 tests/benchmarks/qsvgrenderer/qsvgrenderer.qrc create mode 100644 tests/benchmarks/qsvgrenderer/tst_qsvgrenderer.cpp diff --git a/tests/benchmarks/qsvgrenderer/data/tiger.svg b/tests/benchmarks/qsvgrenderer/data/tiger.svg new file mode 100644 index 0000000..983e570 --- /dev/null +++ b/tests/benchmarks/qsvgrenderer/data/tiger.svg @@ -0,0 +1,730 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/qsvgrenderer/qsvgrenderer.pro b/tests/benchmarks/qsvgrenderer/qsvgrenderer.pro new file mode 100644 index 0000000..8222a09 --- /dev/null +++ b/tests/benchmarks/qsvgrenderer/qsvgrenderer.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qsvgrenderer + +SOURCES += tst_qsvgrenderer.cpp +RESOURCES += qsvgrenderer.qrc + +QT += svg + diff --git a/tests/benchmarks/qsvgrenderer/qsvgrenderer.qrc b/tests/benchmarks/qsvgrenderer/qsvgrenderer.qrc new file mode 100644 index 0000000..bdf4a31 --- /dev/null +++ b/tests/benchmarks/qsvgrenderer/qsvgrenderer.qrc @@ -0,0 +1,6 @@ + + + data/tiger.svg + + + diff --git a/tests/benchmarks/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/benchmarks/qsvgrenderer/tst_qsvgrenderer.cpp new file mode 100644 index 0000000..2f01dfa --- /dev/null +++ b/tests/benchmarks/qsvgrenderer/tst_qsvgrenderer.cpp @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include + +//TESTED_FILES= + +class tst_QSvgRenderer : public QObject +{ + Q_OBJECT + +public: + tst_QSvgRenderer(); + virtual ~tst_QSvgRenderer(); + +public slots: + void init(); + void cleanup(); + +private slots: + void construct(); + void load(); +}; + +tst_QSvgRenderer::tst_QSvgRenderer() +{ +} + +tst_QSvgRenderer::~tst_QSvgRenderer() +{ +} + +void tst_QSvgRenderer::init() +{ +} + +void tst_QSvgRenderer::cleanup() +{ +} + +void tst_QSvgRenderer::construct() +{ + QBENCHMARK { + QSvgRenderer renderer; + } +} + +void tst_QSvgRenderer::load() +{ + QFile file(":/data/tiger.svg"); + if (!file.open(QFile::ReadOnly)) + QFAIL("Can not open tiger.svg"); + QByteArray data = file.readAll(); + QSvgRenderer renderer; + + QBENCHMARK { + renderer.load(data); + } +} + +QTEST_MAIN(tst_QSvgRenderer) +#include "tst_qsvgrenderer.moc" -- cgit v0.12 From 8529d7e3ace4994cd2caf563bb437f2c5c38bcee Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 28 Aug 2009 18:35:43 +0200 Subject: Add an opt-in QWeakPointer::operator->. To use this, you must add #define QWEAKPOINTER_ENABLE_ARROW to your .cpp before #including any headers. Be careful about adding this to .h files. Reviewed-by: Olivier Goffart --- src/corelib/tools/qsharedpointer_impl.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index e4f7ba9..a4282e1 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -626,6 +626,10 @@ public: inline QSharedPointer toStrongRef() const { return QSharedPointer(*this); } +#if defined(QWEAKPOINTER_ENABLE_ARROW) + inline T *operator->() const { return data(); } +#endif + private: #if defined(Q_NO_TEMPLATE_FRIENDS) -- cgit v0.12 From 624ea78d71dca5112272597f9f1ee165c2275c5c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 29 Aug 2009 11:54:22 +0200 Subject: Autotest: add some D-Bus tests sending complex structs and lists of them --- tests/auto/qdbusmarshall/common.h | 35 ++++++++++++++++++++++++++ tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp | 18 +++++++++++++ 2 files changed, 53 insertions(+) diff --git a/tests/auto/qdbusmarshall/common.h b/tests/auto/qdbusmarshall/common.h index 9df1e01..bdc9f09 100644 --- a/tests/auto/qdbusmarshall/common.h +++ b/tests/auto/qdbusmarshall/common.h @@ -103,6 +103,34 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, MyStruct &ms) return arg; } +struct MyVariantMapStruct +{ + QString s; + QVariantMap map; + + inline bool operator==(const MyVariantMapStruct &other) const + { return s == other.s && map == other.map; } +}; +Q_DECLARE_METATYPE(MyVariantMapStruct) +Q_DECLARE_METATYPE(QList) + +QDBusArgument &operator<<(QDBusArgument &arg, const MyVariantMapStruct &ms) +{ + arg.beginStructure(); + arg << ms.s << ms.map; + arg.endStructure(); + return arg; +} + +const QDBusArgument &operator>>(const QDBusArgument &arg, MyVariantMapStruct &ms) +{ + arg.beginStructure(); + arg >> ms.s >> ms.map; + arg.endStructure(); + return arg; +} + + void commonInit() { qDBusRegisterMetaType >(); @@ -127,6 +155,8 @@ void commonInit() qDBusRegisterMetaType >(); qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType >(); } #ifdef USE_PRIVATE_CODE #include "private/qdbusintrospection_p.h" @@ -476,6 +506,11 @@ bool compareToArgument(const QDBusArgument &arg, const QVariant &v2) else if (id == qMetaTypeId()) return compare(arg, v2); + + else if (id == qMetaTypeId()) + return compare(arg, v2); + else if (id == qMetaTypeId >()) + return compare >(arg, v2); } qWarning() << "Unexpected QVariant type" << v2.userType() diff --git a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp index 6e66393..b209aef 100644 --- a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp +++ b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp @@ -492,6 +492,24 @@ void tst_QDBusMarshall::sendStructs_data() QTest::newRow("time") << QVariant(time) << "(iiii)" << "[Argument: (iiii) 12, 25, 0, 0]"; QTest::newRow("datetime") << QVariant(QDateTime(date, time)) << "((iii)(iiii)i)" << "[Argument: ((iii)(iiii)i) [Argument: (iii) 2006, 6, 18], [Argument: (iiii) 12, 25, 0, 0], 0]"; + + MyStruct ms = { 1, "Hello, World" }; + QTest::newRow("int-string") << qVariantFromValue(ms) << "(is)" << "[Argument: (is) 1, \"Hello, World\"]"; + + MyVariantMapStruct mvms = { "Hello, World", QVariantMap() }; + QTest::newRow("string-variantmap") << qVariantFromValue(mvms) << "(sa{sv})" << "[Argument: (sa{sv}) \"Hello, World\", [Argument: a{sv} {}]]"; + + // use only basic types, otherwise comparison will fail + mvms.map["int"] = 42; + mvms.map["uint"] = 42u; + mvms.map["short"] = qVariantFromValue(-47); + mvms.map["bytearray"] = QByteArray("Hello, world"); + QTest::newRow("string-variantmap2") << qVariantFromValue(mvms) << "(sa{sv})" << "[Argument: (sa{sv}) \"Hello, World\", [Argument: a{sv} {\"bytearray\" = [Variant(QByteArray): {72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100}], \"int\" = [Variant(int): 42], \"short\" = [Variant(short): -47], \"uint\" = [Variant(uint): 42]}]]"; + + QList list; + QTest::newRow("empty-list-of-string-variantmap") << qVariantFromValue(list) << "a(sa{sv})" << "[Argument: a(sa{sv}) {}]"; + list << mvms; + QTest::newRow("list-of-string-variantmap") << qVariantFromValue(list) << "a(sa{sv})" << "[Argument: a(sa{sv}) {[Argument: (sa{sv}) \"Hello, World\", [Argument: a{sv} {\"bytearray\" = [Variant(QByteArray): {72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100}], \"int\" = [Variant(int): 42], \"short\" = [Variant(short): -47], \"uint\" = [Variant(uint): 42]}]]}]"; } void tst_QDBusMarshall::sendComplex_data() -- cgit v0.12 From 37da3aefc073ea3a27c8bb5293b27faa4dcb5cc0 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Fri, 28 Aug 2009 16:52:54 +0200 Subject: No need for the namespaced version in QSvgAttributes::value(). We do not really use this function with proper namespace URI, so let us get rid of the function. Reviewed-by: Kim --- src/svg/qsvghandler.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 5b778d2..44f5b6d 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -82,7 +82,6 @@ struct QSvgAttributes QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHandler *handler); QStringRef value(const QLatin1String &name) const; - QStringRef value(const QString &namespaceUri, const QLatin1String &name) const; QXmlStreamAttributes m_xmlAttributes; QVector m_cssAttributes; @@ -110,20 +109,6 @@ QStringRef QSvgAttributes::value(const QLatin1String &name) const return v; } -QStringRef QSvgAttributes::value(const QString &namespaceUri, const QLatin1String &name) const -{ - QStringRef v = m_xmlAttributes.value(namespaceUri, name); - if (v.isEmpty()) { - for (int i = 0; i < m_cssAttributes.count(); ++i) { - if (m_cssAttributes.at(i).name == name) { - v = m_cssAttributes.at(i).value; - break; - } - } - } - return v; -} - static inline QString someId(const QXmlStreamAttributes &attributes) { QString id = attributes.value(QLatin1String("id")).toString(); @@ -2698,9 +2683,9 @@ static bool parseStopNode(QSvgStyleProperty *parent, QSvgGradientStyle *style = static_cast(parent); - QString offsetStr = attrs.value(QString(), QLatin1String("offset")).toString(); - QString colorStr = attrs.value(QString(), QLatin1String("stop-color")).toString(); - QString opacityStr = attrs.value(QString(), QLatin1String("stop-opacity")).toString(); + QString offsetStr = attrs.value(QLatin1String("offset")).toString(); + QString colorStr = attrs.value(QLatin1String("stop-color")).toString(); + QString opacityStr = attrs.value(QLatin1String("stop-opacity")).toString(); QColor color; bool ok = true; -- cgit v0.12 From 68dc7ed9338eb555eb78d9993490434284bdc223 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 31 Aug 2009 10:39:05 +0200 Subject: doc: Fixed several qdoc errors. --- src/gui/image/qpixmap_s60.cpp | 12 ++++++------ src/gui/kernel/qapplication_s60.cpp | 21 +++++++++++++++++---- src/gui/styles/qcommonstyle.cpp | 4 +--- src/gui/styles/qs60style.cpp | 31 +++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 13 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index a796066..e00bf26 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -189,15 +189,15 @@ CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const } /*! -\since 4.6 + \since 4.6 -Returns a QPixmap that is equivalent to the \c CFbsBitmap by copying the data. -If the CFbsBitmap is not valid or is compressed in memory, this function will -return a null QPixmap. + Returns a QPixmap that is equivalent to the \c CFbsBitmap \a bitmap + by copying the data. If the CFbsBitmap is not valid or is compressed + in memory, this function will return a null QPixmap. -\warning This function is only available on Symbian OS. + \warning This function is only available on Symbian OS. -\sa toSymbianCFbsBitmap(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} + \sa toSymbianCFbsBitmap(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} */ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 87cf82e..14ed48d 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -972,6 +972,12 @@ void QApplication::beep() beep=NULL; } +/*! \fn int QApplication::s60ProcessEvent(TWsEvent *event) + This function does the core processing of individual s60 + \a{event}s. It returns 1 if the event was handled, 0 if + the \a event was not handled, and -1 if the event was + not handled because the event handle was not in the map. + */ int QApplication::s60ProcessEvent(TWsEvent *event) { bool handled = s60EventFilter(event); @@ -1058,17 +1064,21 @@ int QApplication::s60ProcessEvent(TWsEvent *event) return 0; } +/*! + Returns false. Does nothing with the TWsEvent \a aEvent. + */ bool QApplication::s60EventFilter(TWsEvent * /* aEvent */) { return false; } /*! - Handles commands which are typically handled by CAknAppUi::HandleCommandL() - Qts Ui integration into Symbian is partially achieved by deriving from CAknAppUi. - Currently, exit, menu and softkey commands are handled + Handles \a{command}s which are typically handled by + CAknAppUi::HandleCommandL(). Qts Ui integration into Symbian is + partially achieved by deriving from CAknAppUi. Currently, exit, + menu and softkey commands are handled. - \sa s60EventFilter(), s60ProcessEvent() + \sa s60EventFilter(), s60ProcessEvent() */ void QApplication::symbianHandleCommand(int command) { @@ -1096,6 +1106,9 @@ void QApplication::symbianHandleCommand(int command) } } +/*! + Handles the resource change specified by \a type. + */ void QApplication::symbianResourceChange(int type) { switch (type) { diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index ee9827e..e902d96 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -127,9 +127,7 @@ QCommonStyle::QCommonStyle(QCommonStylePrivate &dd) { } /*! - \overload - - Destroys the style + Destroys the style. */ QCommonStyle::~QCommonStyle() { } diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 3230c17..bd27c8d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -886,6 +886,10 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag \sa QMacStyle, QWindowsStyle, QWindowsXPStyle, QWindowsVistaStyle, QPlastiqueStyle, QCleanlooksStyle, QMotifStyle */ + +/*! + Destroys the style. +*/ QS60Style::~QS60Style() { } @@ -2450,6 +2454,9 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple return ret; } +/*! + \reimp +*/ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, const QWidget *widget) const { QRect ret; @@ -2610,6 +2617,9 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con return ret; } +/*! + \reimp + */ void QS60Style::polish(QWidget *widget) { Q_D(const QS60Style); @@ -2645,6 +2655,9 @@ void QS60Style::polish(QWidget *widget) d->setFont(widget); } +/*! + \reimp + */ void QS60Style::unpolish(QWidget *widget) { if (false @@ -2676,6 +2689,9 @@ void QS60Style::unpolish(QWidget *widget) QCommonStyle::unpolish(widget); } +/*! + \reimp + */ void QS60Style::polish(QApplication *application) { Q_D(QS60Style); @@ -2683,6 +2699,9 @@ void QS60Style::polish(QApplication *application) d->setThemePalette(application); } +/*! + \reimp + */ void QS60Style::unpolish(QApplication *application) { Q_UNUSED(application) @@ -2692,18 +2711,27 @@ void QS60Style::unpolish(QApplication *application) QApplicationPrivate::setSystemPalette(d->m_originalPalette); } +/*! + Sets the style property \a name to the \a value. + */ void QS60Style::setStyleProperty(const char *name, const QVariant &value) { Q_D(QS60Style); d->setStyleProperty_specific(name, value); } +/*! + Returns the value of style property \a name. + */ QVariant QS60Style::styleProperty(const char *name) const { Q_D(const QS60Style); return d->styleProperty_specific(name); } +/*! + \reimp + */ bool QS60Style::event(QEvent *e) { #ifdef QT_KEYPAD_NAVIGATION @@ -2738,6 +2766,9 @@ bool QS60Style::event(QEvent *e) return false; } +/*! + \internal + */ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { -- cgit v0.12 From e42379ebf53a41807791ee243bcebb83c3e2faed Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 31 Aug 2009 10:15:35 +0200 Subject: implement functionExit() callbacks on the JIT The return value is not reported (we need a separate callback for that, just like in the interpreter), but that isn't important to get our tools (i.e. the debugger) working. --- src/script/api/qscriptengineagent.cpp | 11 ++++++ src/script/api/qscriptengineagent_p.h | 7 +--- .../qscriptengineagent/tst_qscriptengineagent.cpp | 44 +++++++++++++++------- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index 193ee21..cf60bcb 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -142,6 +142,17 @@ void QScriptEngineAgentPrivate::detach() JSC::Debugger::detach(engine->originalGlobalObject()); } +void QScriptEngineAgentPrivate::returnEvent(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno) +{ + Q_UNUSED(frame); + Q_UNUSED(lineno); +#if ENABLE(JIT) + functionExit(JSC::JSValue(), sourceID); +#else + Q_UNUSED(sourceID); +#endif +} + void QScriptEngineAgentPrivate::exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler) { JSC::CallFrame *oldFrame = engine->currentFrame; diff --git a/src/script/api/qscriptengineagent_p.h b/src/script/api/qscriptengineagent_p.h index 9ef1eaf..ba49af5 100644 --- a/src/script/api/qscriptengineagent_p.h +++ b/src/script/api/qscriptengineagent_p.h @@ -110,12 +110,7 @@ public: q_ptr->contextPush(); q_ptr->functionEntry(sourceID); }; - virtual void returnEvent(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno) - { - Q_UNUSED(frame); - Q_UNUSED(sourceID); - Q_UNUSED(lineno); - } + virtual void returnEvent(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno); virtual void willExecuteProgram(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno) { Q_UNUSED(frame); diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index f515304..2504951 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -561,8 +561,6 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCall() spy->clear(); QVERIFY(eng.evaluate("(function() { return 123; } )()").toNumber()==123); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -576,7 +574,11 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCall() // anonymous function exit QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(2).value.isNumber()); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QCOMPARE(spy->at(2).value.toNumber(), qsreal(123)); // evaluate() exit @@ -598,8 +600,6 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCallWithoutReturn() spy->clear(); eng.evaluate("(function() { var a = 123; } )()"); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -642,8 +642,6 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionDefinition() QVERIFY(spy->at(1).value.isUndefined()); eng.evaluate("foo()"); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 6); // evaluate() entry @@ -657,7 +655,11 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionDefinition() // foo() exit QCOMPARE(spy->at(4).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(4).scriptId, spy->at(0).scriptId); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(4).value.isNumber()); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QCOMPARE(spy->at(4).value.toNumber(), qsreal(456)); // evaluate() exit @@ -719,8 +721,6 @@ void tst_QScriptEngineAgent::functionEntryAndExit_native2() spy->clear(); eng.evaluate("nativeFunctionCallingArg(function() { return 123; })"); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 6); // evaluate() entry @@ -1035,8 +1035,6 @@ void tst_QScriptEngineAgent::functionEntryAndExit_call() spy->clear(); fun.call(); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 2); // entry @@ -1046,7 +1044,11 @@ void tst_QScriptEngineAgent::functionEntryAndExit_call() // exit QCOMPARE(spy->at(1).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(1).value.isNumber()); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QCOMPARE(spy->at(1).value.toNumber(), qsreal(123)); } delete spy; @@ -1650,8 +1652,6 @@ void tst_QScriptEngineAgent::eventOrder_functionDefinition() QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit); eng.evaluate("foo(123)"); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 13); // load QCOMPARE(spy->at(3).type, ScriptEngineEvent::ScriptLoad); @@ -1774,8 +1774,6 @@ void tst_QScriptEngineAgent::eventOrder_functions() QCOMPARE(spy->count(), 6); eng.evaluate("foo(123)"); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 21); // load @@ -1803,12 +1801,16 @@ void tst_QScriptEngineAgent::eventOrder_functions() // bar() exit QCOMPARE(spy->at(15).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(15).scriptId, spy->at(3).scriptId); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(15).value.isNumber()); // restore context QCOMPARE(spy->at(16).type, ScriptEngineEvent::ContextPop); // foo() exit QCOMPARE(spy->at(17).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(17).scriptId, spy->at(0).scriptId); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(17).value.isNumber()); // restore context QCOMPARE(spy->at(18).type, ScriptEngineEvent::ContextPop); @@ -1873,21 +1875,33 @@ void tst_QScriptEngineAgent::eventOrder_functions() // bar() exit QCOMPARE(spy->at(39).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(39).scriptId, spy->at(21).scriptId); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(39).value.isError()); // restore context QCOMPARE(spy->at(40).type, ScriptEngineEvent::ContextPop); // foo() exit QCOMPARE(spy->at(41).type, ScriptEngineEvent::FunctionExit); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "script ID for function exit is not correct when JIT is enabled", Continue); QCOMPARE(spy->at(41).scriptId, spy->at(0).scriptId); QVERIFY(spy->at(41).value.isError()); // restore context QCOMPARE(spy->at(42).type, ScriptEngineEvent::ContextPop); // evaluate() exit QCOMPARE(spy->at(43).type, ScriptEngineEvent::FunctionExit); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "script ID for function exit is not correct when JIT is enabled", Continue); QCOMPARE(spy->at(43).scriptId, spy->at(26).scriptId); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue); QVERIFY(spy->at(43).value.isError()); // unload + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "wrong event type when JIT is enabled", Continue); QCOMPARE(spy->at(44).type, ScriptEngineEvent::ScriptUnload); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "wrong script ID when JIT is enabled", Continue); QCOMPARE(spy->at(44).scriptId, spy->at(25).scriptId); } delete spy; @@ -1946,6 +1960,8 @@ void tst_QScriptEngineAgent::eventOrder_signalsHandling() emit testSignal(123); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "too many events reported when JIT is enabled", Abort); QCOMPARE(spy->count(), 14); // new context QCOMPARE(spy->at(4).type, ScriptEngineEvent::ContextPush); -- cgit v0.12 From bc8574e03e8aa493393e84675c6d177fc00f12fb Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 31 Aug 2009 10:34:14 +0200 Subject: make sure hasInstance() is always invoked for custom script objects Need to specify the OverridesHasInstance flag, otherwise the JIT will do the standard hasInstance implementation instead of calling our virtual function. This makes the QScriptClass::extension() autotest pass. --- src/script/bridge/qscriptobject_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/bridge/qscriptobject_p.h b/src/script/bridge/qscriptobject_p.h index 3ae7146..c427202 100644 --- a/src/script/bridge/qscriptobject_p.h +++ b/src/script/bridge/qscriptobject_p.h @@ -99,7 +99,7 @@ public: static WTF::PassRefPtr createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::ImplementsHasInstance)); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::ImplementsHasInstance | JSC::OverridesHasInstance)); } JSC::JSValue data() const; -- cgit v0.12 From 174bef24f10242b042dad626f8b68a95bdfb7ac7 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 31 Aug 2009 10:38:44 +0200 Subject: don't disable the JIT for qtscript AKA, enable it on platforms where it's supported. --- src/script/script.pro | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/script/script.pro b/src/script/script.pro index 301386d..a03b652 100644 --- a/src/script/script.pro +++ b/src/script/script.pro @@ -13,8 +13,6 @@ include(../qbase.pri) # Disable a few warnings on Windows. win32-msvc*: QMAKE_CXXFLAGS += -wd4291 -wd4344 -wd4503 -wd4800 -wd4819 -wd4996 -wd4396 -wd4099 -# disable JIT for now -DEFINES += ENABLE_JIT=0 # FIXME: shared the statically built JavaScriptCore # Fetch the base WebKit directory from the WEBKITDIR environment variable; -- cgit v0.12 From 3216fe93a400980ec9d1a4eeafa1c700db56ded2 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 31 Aug 2009 11:08:23 +0200 Subject: fix crash due to double deletion Needed due to commit 3636e666528b72de79f8c7012690bb9e279f0863 --- src/script/api/qscriptvalue.cpp | 1 - tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index d5aaed7..eb0460a 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -2431,7 +2431,6 @@ void QScriptValue::setScriptClass(QScriptClass *scriptClass) QScriptObject *scriptObject = static_cast(JSC::asObject(d->jscValue)); QScriptObjectDelegate *delegate = scriptObject->delegate(); if (!delegate || (delegate->type() != QScriptObjectDelegate::ClassObject)) { - delete delegate; delegate = new QScript::ClassObjectDelegate(scriptClass); scriptObject->setDelegate(delegate); } diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 1c09693..beba26a 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2243,9 +2243,31 @@ void tst_QScriptValue::getSetScriptClass() obj.setScriptClass(&testClass); QEXPECT_FAIL("", "With JSC back-end, the class of a plain object created in JS can't be changed", Continue); QCOMPARE(obj.scriptClass(), (QScriptClass*)&testClass); + QTest::ignoreMessage(QtWarningMsg, "QScriptValue::setScriptClass() failed: cannot change class of non-QScriptObject"); obj.setScriptClass(0); QCOMPARE(obj.scriptClass(), (QScriptClass*)0); } + // object that already has a(n internal) class + { + QScriptValue obj = eng.newVariant(QUrl("http://example.com")); + QVERIFY(obj.isVariant()); + QCOMPARE(obj.scriptClass(), (QScriptClass*)0); + obj.setScriptClass(&testClass); + QCOMPARE(obj.scriptClass(), &testClass); + QVERIFY(obj.isObject()); + QVERIFY(!obj.isVariant()); + QVERIFY(!obj.toVariant().isValid()); + } + { + QScriptValue obj = eng.newQObject(this); + QVERIFY(obj.isQObject()); + QCOMPARE(obj.scriptClass(), (QScriptClass*)0); + obj.setScriptClass(&testClass); + QCOMPARE(obj.scriptClass(), &testClass); + QVERIFY(obj.isObject()); + QVERIFY(!obj.isQObject()); + QVERIFY(obj.toQObject() == 0); + } } static QScriptValue getArg(QScriptContext *ctx, QScriptEngine *) -- cgit v0.12 From 7f1d1eaeb1dbe7b0951e4b3c47b27c7dc95eb7c1 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Fri, 28 Aug 2009 17:26:32 +0200 Subject: Preemptively parse the necessary attributes in QSvgAttributes. Previously, retrieving an attribute value requires a two-stage lookup, first in the XML attributes and (if it is found there) in the CSS attributes. Both look-ups requires a number of iterations and comparisons, which have to be carried out for every value look-up. This patch changes it so that iterations and comparisons need to be done only once, namely at the beginning. This requires us to store several SVG attributes needed by the parsing routine, but since they are just QStringRefs, the increase in the heap usage is really minimal and even not reported by Valgrind's Massif. Also, now we don't need to hold the XML attributes anymore. The loading of tiger.svg (tests/benchmarks/qsvgrenderer) is reduced from 101.2 millions instructions to 96.5. The biggest gain is however obvious from the time spent in QSvgAttributes::parseStyle(QSvgNode*, QSvgAttributes, QSvgHandler*) which goes down from 16.7 millions instructions to 6.9 millions, i.e. 2.4x faster. Even with the new extra overhead in the QSvgAttributes constructor, QSvgAttributes::parseStyle(QSvgNode*, QXmlStreamAttributes, QSvgHandler*) goes down from 23.5 millions instructions to 18.4 millions, i.e. 1.3x faster. Reviewed-by: Kim --- src/svg/qsvghandler.cpp | 252 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 195 insertions(+), 57 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 44f5b6d..2076fff 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -77,49 +77,187 @@ double qstrtod(const char *s00, char const **se, bool *ok); static bool parsePathDataFast(const QStringRef &data, QPainterPath &path); +static inline QString someId(const QXmlStreamAttributes &attributes) +{ + QString id = attributes.value(QLatin1String("id")).toString(); + if (id.isEmpty()) + id = attributes.value(QLatin1String("xml:id")).toString(); + return id; +} + struct QSvgAttributes { QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHandler *handler); - QStringRef value(const QLatin1String &name) const; + QString id; + + QStringRef color; + QStringRef colorOpacity; + QStringRef fill; + QStringRef fillRule; + QStringRef fillOpacity; + QStringRef stroke; + QStringRef strokeDashArray; + QStringRef strokeDashOffset; + QStringRef strokeLineCap; + QStringRef strokeLineJoin; + QStringRef strokeMiterLimit; + QStringRef strokeOpacity; + QStringRef strokeWidth; + QStringRef vectorEffect; + QStringRef fontFamily; + QStringRef fontSize; + QStringRef fontStyle; + QStringRef fontWeight; + QStringRef fontVariant; + QStringRef textAnchor; + QStringRef transform; + QStringRef visibility; + QStringRef opacity; + QStringRef compOp; + QStringRef display; + QStringRef offset; + QStringRef stopColor; + QStringRef stopOpacity; - QXmlStreamAttributes m_xmlAttributes; QVector m_cssAttributes; }; QSvgAttributes::QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHandler *handler) - : m_xmlAttributes(xmlAttributes) { + id = someId(xmlAttributes); QStringRef style = xmlAttributes.value(QLatin1String("style")); - if (!style.isEmpty()) + if (!style.isEmpty()) { handler->parseCSStoXMLAttrs(style.toString(), &m_cssAttributes); -} - -QStringRef QSvgAttributes::value(const QLatin1String &name) const -{ - QStringRef v = m_xmlAttributes.value(name); - if (v.isEmpty()) { - for (int i = 0; i < m_cssAttributes.count(); ++i) { - if (m_cssAttributes.at(i).name == name) { - v = m_cssAttributes.at(i).value; - break; - } + for (int j = 0; j < m_cssAttributes.count(); ++j) { + const QSvgCssAttribute &attribute = m_cssAttributes.at(j ); + QStringRef name = attribute.name; + QStringRef value = attribute.value; + if (name == QLatin1String("color")) + color = value; + if (name == QLatin1String("color-opacity")) + colorOpacity = value; + if (name == QLatin1String("fill")) + fill = value; + if (name == QLatin1String("fill-rule")) + fillRule = value; + if (name == QLatin1String("fill-opacity")) + fillOpacity = value; + if (name == QLatin1String("stroke")) + stroke = value; + if (name == QLatin1String("stroke-dasharray")) + strokeDashArray = value; + if (name == QLatin1String("stroke-dashoffset")) + strokeDashOffset = value; + if (name == QLatin1String("stroke-linecap")) + strokeLineCap = value; + if (name == QLatin1String("stroke-linejoin")) + strokeLineJoin = value; + if (name == QLatin1String("stroke-miterlimit")) + strokeMiterLimit = value; + if (name == QLatin1String("stroke-opacity")) + strokeOpacity = value; + if (name == QLatin1String("stroke-width")) + strokeWidth = value; + if (name == QLatin1String("vector-effect")) + vectorEffect = value; + if (name == QLatin1String("font-family")) + fontFamily = value; + if (name == QLatin1String("font-size")) + fontSize = value; + if (name == QLatin1String("font-style")) + fontStyle = value; + if (name == QLatin1String("font-weight")) + fontWeight = value; + if (name == QLatin1String("font-variant")) + fontVariant = value; + if (name == QLatin1String("text-anchor")) + textAnchor = value; + if (name == QLatin1String("transform")) + transform = value; + if (name == QLatin1String("visibility")) + visibility = value; + if (name == QLatin1String("opacity")) + opacity = value; + if (name == QLatin1String("comp-op")) + compOp = value; + if (name == QLatin1String("display")) + display = value; + if (name == QLatin1String("offset")) + offset = value; + if (name == QLatin1String("stop-color")) + stopColor = value; + if (name == QLatin1String("stop-opacity")) + stopOpacity = value; } } - return v; -} -static inline QString someId(const QXmlStreamAttributes &attributes) -{ - QString id = attributes.value(QLatin1String("id")).toString(); - if (id.isEmpty()) - id = attributes.value(QLatin1String("xml:id")).toString(); - return id; -} -static inline QString someId(const QSvgAttributes &attributes) -{ return someId(attributes.m_xmlAttributes); } + for (int i = 0; i < xmlAttributes.count(); ++i) { + const QXmlStreamAttribute &attribute = xmlAttributes.at(i); + QStringRef name = attribute.qualifiedName(); + QStringRef value = attribute.value(); + if (name == QLatin1String("color")) + color = value; + if (name == QLatin1String("color-opacity")) + colorOpacity = value; + if (name == QLatin1String("fill")) + fill = value; + if (name == QLatin1String("fill-rule")) + fillRule = value; + if (name == QLatin1String("fill-opacity")) + fillOpacity = value; + if (name == QLatin1String("stroke")) + stroke = value; + if (name == QLatin1String("stroke-dasharray")) + strokeDashArray = value; + if (name == QLatin1String("stroke-dashoffset")) + strokeDashOffset = value; + if (name == QLatin1String("stroke-linecap")) + strokeLineCap = value; + if (name == QLatin1String("stroke-linejoin")) + strokeLineJoin = value; + if (name == QLatin1String("stroke-miterlimit")) + strokeMiterLimit = value; + if (name == QLatin1String("stroke-opacity")) + strokeOpacity = value; + if (name == QLatin1String("stroke-width")) + strokeWidth = value; + if (name == QLatin1String("vector-effect")) + vectorEffect = value; + if (name == QLatin1String("font-family")) + fontFamily = value; + if (name == QLatin1String("font-size")) + fontSize = value; + if (name == QLatin1String("font-style")) + fontStyle = value; + if (name == QLatin1String("font-weight")) + fontWeight = value; + if (name == QLatin1String("font-variant")) + fontVariant = value; + if (name == QLatin1String("text-anchor")) + textAnchor = value; + if (name == QLatin1String("transform")) + transform = value; + if (name == QLatin1String("visibility")) + visibility = value; + if (name == QLatin1String("opacity")) + opacity = value; + if (name == QLatin1String("comp-op")) + compOp = value; + if (name == QLatin1String("display")) + display = value; + if (name == QLatin1String("offset")) + offset = value; + if (name == QLatin1String("stop-color")) + stopColor = value; + if (name == QLatin1String("stop-opacity")) + stopOpacity = value; + } +} +static inline QString someId(const QSvgAttributes &attributes) +{ return attributes.id; } static const char * QSvgStyleSelector_nodeString[] = { "svg", @@ -602,8 +740,8 @@ static void parseColor(QSvgNode *, const QSvgAttributes &attributes, QSvgHandler *handler) { - QString colorStr = attributes.value(QLatin1String("color")).toString(); - QString opacity = attributes.value(QLatin1String("color-opacity")).toString(); + QString colorStr = attributes.color.toString(); + QString opacity = attributes.colorOpacity.toString(); QColor color; if (constructColor(colorStr, opacity, color, handler)) { handler->pushColor(color); @@ -627,9 +765,9 @@ static void parseBrush(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *handler) { - QString value = attributes.value(QLatin1String("fill")).toString(); - QString fillRule = attributes.value(QLatin1String("fill-rule")).toString(); - QString opacity = attributes.value(QLatin1String("fill-opacity")).toString(); + QString value = attributes.fill.toString(); + QString fillRule = attributes.fillRule.toString(); + QString opacity = attributes.fillOpacity.toString(); QString myId = someId(attributes); if (!value.isEmpty() || !fillRule.isEmpty() || !opacity.isEmpty()) { @@ -806,15 +944,15 @@ static void parsePen(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *handler) { - QString value = attributes.value(QLatin1String("stroke")).toString(); - QString dashArray = attributes.value(QLatin1String("stroke-dasharray")).toString(); - QString dashOffset = attributes.value(QLatin1String("stroke-dashoffset")).toString(); - QString linecap = attributes.value(QLatin1String("stroke-linecap")).toString(); - QString linejoin = attributes.value(QLatin1String("stroke-linejoin")).toString(); - QString miterlimit = attributes.value(QLatin1String("stroke-miterlimit")).toString(); - QString opacity = attributes.value(QLatin1String("stroke-opacity")).toString(); - QString width = attributes.value(QLatin1String("stroke-width")).toString(); - QString vectorEffect = attributes.value(QLatin1String("vector-effect")).toString(); + QString value = attributes.stroke.toString(); + QString dashArray = attributes.strokeDashArray.toString(); + QString dashOffset = attributes.strokeDashOffset.toString(); + QString linecap = attributes.strokeLineCap.toString(); + QString linejoin = attributes.strokeLineJoin.toString(); + QString miterlimit = attributes.strokeMiterLimit.toString(); + QString opacity = attributes.strokeOpacity.toString(); + QString width = attributes.strokeWidth.toString(); + QString vectorEffect = attributes.vectorEffect.toString(); QString myId = someId(attributes); //qDebug()<<"Node "<type()<<", attrs are "<parent(); if (parent && (value.isEmpty() || value == QT_INHERIT)) @@ -1666,7 +1804,7 @@ static void parseOpacity(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *) { - const QString value = attributes.value(QLatin1String("opacity")).toString().trimmed(); + const QString value = attributes.opacity.toString().trimmed(); bool ok = false; qreal op = value.toDouble(&ok); @@ -1739,7 +1877,7 @@ static void parseCompOp(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *) { - QString value = attributes.value(QLatin1String("comp-op")).toString(); + QString value = attributes.compOp.toString(); value = value.trimmed(); if (!value.isEmpty()) { @@ -1794,7 +1932,7 @@ static void parseOthers(QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *) { - QString displayStr = attributes.value(QLatin1String("display")).toString(); + QString displayStr = attributes.display.toString(); displayStr = displayStr.trimmed(); if (!displayStr.isEmpty()) { @@ -2663,8 +2801,7 @@ static bool parseStopNode(QSvgStyleProperty *parent, cssNode.ptr = &anim; QVector decls = handler->selector()->declarationsForNode(cssNode); - QSvgAttributes attrs(attributes, handler); - + QXmlStreamAttributes xmlAttr = attributes; for (int i = 0; i < decls.count(); ++i) { const QCss::Declaration &decl = decls.at(i); @@ -2678,14 +2815,15 @@ static bool parseStopNode(QSvgStyleProperty *parent, valueStr.prepend(QLatin1String("url(")); valueStr.append(QLatin1Char(')')); } - attrs.m_xmlAttributes.append(QString(), decl.d->property, valueStr); + xmlAttr.append(QString(), decl.d->property, valueStr); } + QSvgAttributes attrs(xmlAttr, handler); QSvgGradientStyle *style = static_cast(parent); - QString offsetStr = attrs.value(QLatin1String("offset")).toString(); - QString colorStr = attrs.value(QLatin1String("stop-color")).toString(); - QString opacityStr = attrs.value(QLatin1String("stop-opacity")).toString(); + QString offsetStr = attrs.offset.toString(); + QString colorStr = attrs.stopColor.toString(); + QString opacityStr = attrs.stopOpacity.toString(); QColor color; bool ok = true; -- cgit v0.12 From f6863745919c3ddf66734ca2045a9b5086835af1 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Mon, 31 Aug 2009 11:20:52 +0200 Subject: Fix QSslCertificate::alternateSubjectNames() memory leak Task-number: 258964 Merge-request: 1382 Reviewed-by: Peter Hartmann --- src/network/ssl/qsslcertificate.cpp | 2 +- src/network/ssl/qsslsocket_openssl_symbols.cpp | 2 ++ src/network/ssl/qsslsocket_openssl_symbols_p.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 8d855b1..7b5653d 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -387,7 +387,7 @@ QMultiMap QSslCertificate::alternateSubje else if (genName->type == GEN_EMAIL) result.insert(QSsl::EmailEntry, altName); } - q_sk_free((STACK*)altNames); + q_sk_pop_free((STACK*)altNames, q_sk_free); } return result; diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index be5c93c..91cef69 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -144,6 +144,7 @@ DEFINEFUNC(int, RAND_status, void, DUMMYARG, return -1, return) DEFINEFUNC(void, RSA_free, RSA *a, a, return, DUMMYARG) DEFINEFUNC(void, sk_free, STACK *a, a, return, DUMMYARG) DEFINEFUNC(int, sk_num, STACK *a, a, return -1, return) +DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(STACK*), b, return, DUMMYARG) #if OPENSSL_VERSION_NUMBER >= 0x10000000L DEFINEFUNC2(void *, sk_value, STACK *a, a, int b, b, return 0, return) #else @@ -650,6 +651,7 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(RSA_free) RESOLVEFUNC(sk_free) RESOLVEFUNC(sk_num) + RESOLVEFUNC(sk_pop_free) RESOLVEFUNC(sk_value) RESOLVEFUNC(SSL_CIPHER_description) RESOLVEFUNC(SSL_CTX_check_private_key) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 8c7acd7..38f92d4 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -256,6 +256,7 @@ int q_RAND_status(); void q_RSA_free(RSA *a); void q_sk_free(STACK *a); int q_sk_num(STACK *a); +void q_sk_pop_free(STACK *a, void (*b)(STACK *)); #if OPENSSL_VERSION_NUMBER >= 0x10000000L void * q_sk_value(STACK *a, int b); #else -- cgit v0.12 From 266f578ebe20b9885421effec0a91f9c025fd11e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 31 Aug 2009 11:47:18 +0200 Subject: Add license headers Reviewed-by: trustme --- config.tests/unix/egl/egl.cpp | 41 +++++++++++++++++++++++++++++++ config.tests/unix/egl4gles1/egl4gles1.cpp | 41 +++++++++++++++++++++++++++++++ config.tests/unix/shivavg/shivavg.cpp | 41 +++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) diff --git a/config.tests/unix/egl/egl.cpp b/config.tests/unix/egl/egl.cpp index 0c7f32c..ce3287d 100644 --- a/config.tests/unix/egl/egl.cpp +++ b/config.tests/unix/egl/egl.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include int main(int, char **) diff --git a/config.tests/unix/egl4gles1/egl4gles1.cpp b/config.tests/unix/egl4gles1/egl4gles1.cpp index c1acb90..0c409c2 100644 --- a/config.tests/unix/egl4gles1/egl4gles1.cpp +++ b/config.tests/unix/egl4gles1/egl4gles1.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as publi