From 6b8e0e831093f35fe5e47633c1a0abd22e6811b0 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 21 Aug 2009 15:28:51 +0300 Subject: Review inspired fixes to Symbian file engine - Refactored symbian specific public method out of qfsfileengine.h into a static method. - Utilized PathInfo class for getting home, root, and temp paths. - Cosmetic changes. Reviewed-by: Janne Koskinen --- src/corelib/io/io.pri | 1 + src/corelib/io/qdir.cpp | 3 +- src/corelib/io/qfile.cpp | 2 +- src/corelib/io/qfsfileengine.h | 3 -- src/corelib/io/qfsfileengine_unix.cpp | 99 ++++++++++++++++++++--------------- src/corelib/io/qtemporaryfile.cpp | 4 +- 6 files changed, 62 insertions(+), 50 deletions(-) diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index b49554e..e58e4ad 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -89,5 +89,6 @@ win32 { symbian { SOURCES += io/qfilesystemwatcher_symbian.cpp HEADERS += io/qfilesystemwatcher_symbian_p.h + contains(QT_CONFIG, s60): LIBS += -lplatformenv } } diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 91d41f1..9c96b8a 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1930,8 +1930,7 @@ QString QDir::currentPath() Under non-Windows operating systems the \c HOME environment variable is used if it exists, otherwise the path returned by the - rootPath() function is used, except in Symbian, where c:\\data is - returned. + rootPath(). \sa home(), currentPath(), rootPath(), tempPath() */ diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 5e1a5e7..a4b5ebc 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -747,7 +747,7 @@ QFile::rename(const QString &newName) if (error) { out.remove(); } else { - fileEngine()->setFileName(newName); + fileEngine()->setFileName(newName); setPermissions(permissions()); unsetError(); setFileName(newName); diff --git a/src/corelib/io/qfsfileengine.h b/src/corelib/io/qfsfileengine.h index f6db91c..9be8a4c 100644 --- a/src/corelib/io/qfsfileengine.h +++ b/src/corelib/io/qfsfileengine.h @@ -83,9 +83,6 @@ public: FileFlags fileFlags(FileFlags type) const; bool setPermissions(uint perms); QString fileName(FileName file) const; -#ifdef Q_OS_SYMBIAN - QString fileNameSymbian(FileName file) const; -#endif uint ownerId(FileOwner) const; QString owner(FileOwner) const; QDateTime fileTime(FileTime time) const; diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 620d82f..2a58356 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -60,6 +60,7 @@ #if defined(Q_OS_SYMBIAN) # include # include +# include # include "private/qcore_symbian_p.h" #endif #include @@ -79,9 +80,9 @@ QT_BEGIN_NAMESPACE static bool isRelativePathSymbian(const QString& fileName) { return !(fileName.startsWith(QLatin1Char('/')) - || (fileName.length() >= 2 - && ((fileName.at(0).isLetter() && fileName.at(1) == QLatin1Char(':')) - || (fileName.at(0) == QLatin1Char('/') && fileName.at(1) == QLatin1Char('/'))))); + || (fileName.length() >= 2 + && ((fileName.at(0).isLetter() && fileName.at(1) == QLatin1Char(':')) + || (fileName.at(0) == QLatin1Char('/') && fileName.at(1) == QLatin1Char('/'))))); } #endif @@ -573,11 +574,10 @@ QString QFSFileEngine::currentPath(const QString &) QString QFSFileEngine::homePath() { - QString home = QFile::decodeName(qgetenv("HOME")); #if defined(Q_OS_SYMBIAN) - if (home.isEmpty()) - home = QLatin1String("C:/Data"); + QString home = rootPath(); #else + QString home = QFile::decodeName(qgetenv("HOME")); if (home.isNull()) home = rootPath(); #endif @@ -587,7 +587,13 @@ QString QFSFileEngine::homePath() QString QFSFileEngine::rootPath() { #if defined(Q_OS_SYMBIAN) - return QString::fromLatin1("C:/"); +# ifdef Q_WS_S60 + TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); + return QDir::cleanPath(QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath))); +# else +# warning No fallback implementation of QFSFileEngine::rootPath() + return QString(); +# endif #else return QString::fromLatin1("/"); #endif @@ -596,12 +602,18 @@ QString QFSFileEngine::rootPath() QString QFSFileEngine::tempPath() { #ifdef Q_OS_SYMBIAN - QString temp = QDir::currentPath().left(2); - temp += QString::fromLatin1( "/system/temp/"); +# ifdef Q_WS_S60 + TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); + QString temp = QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath)); + temp += QString::fromLatin1( "temp/"); +# else +# warning No fallback implementation of QFSFileEngine::tempPath() + return QString(); +# endif #else - QString temp = QFile::decodeName(qgetenv("TMPDIR")); - if (temp.isEmpty()) - temp = QString::fromLatin1("/tmp/"); + QString temp = QFile::decodeName(qgetenv("TMPDIR")); + if (temp.isEmpty()) + temp = QString::fromLatin1("/tmp/"); #endif return temp; } @@ -794,7 +806,8 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const ret |= ExistsFlag; #if defined(Q_OS_SYMBIAN) if (d->filePath == QLatin1String("/") - || (d->filePath.at(0).isLetter() && d->filePath.mid(1,d->filePath.length()) == QLatin1String(":/"))) + || (d->filePath.at(0).isLetter() + && d->filePath.mid(1,d->filePath.length()) == QLatin1String(":/"))) ret |= RootFlag; // In Symbian, all symlinks have hidden attribute for some reason; @@ -823,11 +836,12 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const } #ifdef Q_OS_SYMBIAN -QString QFSFileEngine::fileNameSymbian(FileName file) const +static QString symbianFileName(QAbstractFileEngine::FileName file, const QFSFileEngine *engine, + const QFSFileEnginePrivate * const d) { - Q_D(const QFSFileEngine); - if(file == BaseName) { - int slash = d->filePath.lastIndexOf(QLatin1Char('/')); + const QLatin1Char slashChar('/'); + if(file == QAbstractFileEngine::BaseName) { + int slash = d->filePath.lastIndexOf(slashChar); if(slash == -1) { int colon = d->filePath.lastIndexOf(QLatin1Char(':')); if(colon != -1) @@ -835,11 +849,11 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const return d->filePath; } return d->filePath.mid(slash + 1); - } else if(file == PathName) { + } else if(file == QAbstractFileEngine::PathName) { if(!d->filePath.size()) return d->filePath; - int slash = d->filePath.lastIndexOf(QLatin1Char('/')); + int slash = d->filePath.lastIndexOf(slashChar); if(slash == -1) { if(d->filePath.length() >= 2 && d->filePath.at(1) == QLatin1Char(':')) return d->filePath.left(2); @@ -851,26 +865,26 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const slash++; return d->filePath.left(slash); } - } else if(file == AbsoluteName || file == AbsolutePathName) { + } else if(file == QAbstractFileEngine::AbsoluteName || file == QAbstractFileEngine::AbsolutePathName) { QString ret; - if (!isRelativePath()) { + if (!isRelativePathSymbian(d->filePath)) { if (d->filePath.size() > 2 && d->filePath.at(1) == QLatin1Char(':') - && d->filePath.at(2) != QLatin1Char('/') || // It's a drive-relative path, so Z:a.txt -> Z:\currentpath\a.txt - d->filePath.startsWith(QLatin1Char('/')) // It's a absolute path to the current drive, so \a.txt -> Z:\a.txt + && d->filePath.at(2) != slashChar || // It's a drive-relative path, so Z:a.txt -> Z:\currentpath\a.txt + d->filePath.startsWith(slashChar) // It's a absolute path to the current drive, so \a.txt -> Z:\a.txt ) { ret = QString(QDir::currentPath().left(2) + QDir::fromNativeSeparators(d->filePath)); } else { ret = d->filePath; } } else { - ret = QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + d->filePath); + ret = QDir::cleanPath(QDir::currentPath() + slashChar + d->filePath); } // The path should be absolute at this point. // From the docs : // Absolute paths begin with the directory separator "/" // (optionally preceded by a drive specification under Windows). - if (ret.at(0) != QLatin1Char('/')) { + if (ret.at(0) != slashChar) { Q_ASSERT(ret.length() >= 2); Q_ASSERT(ret.at(0).isLetter()); Q_ASSERT(ret.at(1) == QLatin1Char(':')); @@ -879,23 +893,23 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const ret[0] = ret.at(0).toUpper(); } - if (file == AbsolutePathName) { - int slash = ret.lastIndexOf(QLatin1Char('/')); + if (file == QAbstractFileEngine::AbsolutePathName) { + int slash = ret.lastIndexOf(slashChar); if (slash < 0) return ret; - else if (ret.at(0) != QLatin1Char('/') && slash == 2) + else if (ret.at(0) != slashChar && slash == 2) return ret.left(3); // include the slash else return ret.left(slash > 0 ? slash : 1); } return ret; - } else if(file == CanonicalName || file == CanonicalPathName) { - if (!(fileFlags(ExistsFlag) & ExistsFlag)) + } else if(file == QAbstractFileEngine::CanonicalName || file == QAbstractFileEngine::CanonicalPathName) { + if (!(engine->fileFlags(QAbstractFileEngine::ExistsFlag) & QAbstractFileEngine::ExistsFlag)) return QString(); - QString ret = QFSFileEnginePrivate::canonicalized(fileName(AbsoluteName)); - if (!ret.isEmpty() && file == CanonicalPathName) { - int slash = ret.lastIndexOf(QLatin1Char('/')); + QString ret = QFSFileEnginePrivate::canonicalized(symbianFileName(QAbstractFileEngine::AbsoluteName, engine, d)); + if (!ret.isEmpty() && file == QAbstractFileEngine::CanonicalPathName) { + int slash = ret.lastIndexOf(slashChar); if (slash == -1) ret = QDir::fromNativeSeparators(QDir::currentPath()); else if (slash == 0) @@ -903,7 +917,7 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const ret = ret.left(slash); } return ret; - } else if(file == LinkName) { + } else if(file == QAbstractFileEngine::LinkName) { if (d->isSymlink()) { char s[PATH_MAX+1]; int len = readlink(d->nativeFilePath.constData(), s, PATH_MAX); @@ -913,20 +927,20 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const if (isRelativePathSymbian(ret)) { if (!isRelativePathSymbian(d->filePath)) { - ret.prepend(d->filePath.left(d->filePath.lastIndexOf(QLatin1Char('/'))) - + QLatin1Char('/')); + ret.prepend(d->filePath.left(d->filePath.lastIndexOf(slashChar)) + + slashChar); } else { - ret.prepend(QDir::currentPath() + QLatin1Char('/')); + ret.prepend(QDir::currentPath() + slashChar); } } ret = QDir::cleanPath(ret); - if (ret.size() > 1 && ret.endsWith(QLatin1Char('/'))) + if (ret.size() > 1 && ret.endsWith(slashChar)) ret.chop(1); return ret; } } return QString(); - } else if(file == BundleName) { + } else if(file == QAbstractFileEngine::BundleName) { return QString(); } return d->filePath; @@ -935,10 +949,10 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const QString QFSFileEngine::fileName(FileName file) const { -#ifdef Q_OS_SYMBIAN - return fileNameSymbian(file); -#endif Q_D(const QFSFileEngine); +#ifdef Q_OS_SYMBIAN + return symbianFileName(file, this, d); +#else if (file == BundleName) { #if !defined(QWS) && defined(Q_OS_MAC) QCFType url = CFURLCreateWithFileSystemPath(0, QCFString(d->filePath), @@ -1072,6 +1086,7 @@ QString QFSFileEngine::fileName(FileName file) const return QString(); } return d->filePath; +#endif // Q_OS_SYMBIAN } bool QFSFileEngine::isRelativePath() const diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index d76e99b..3db0564 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -515,8 +515,8 @@ QTemporaryFile::QTemporaryFile() Q_D(QTemporaryFile); d->templateName = QDir::tempPath() + QLatin1String("/qt_temp.XXXXXX"); #ifdef Q_OS_SYMBIAN - //Just for verify that folder really exist on hardware - fileEngine()->mkdir( QDir::tempPath(), true ); + //Just to verify that folder really exist on hardware + fileEngine()->mkdir(QDir::tempPath(), true); #endif } -- cgit v0.12 From 7d5713b5c9e3372ebbe5302ecb8278af548a9943 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 21 Aug 2009 15:31:51 +0300 Subject: Review inspired changes to Symbian file system watcher - Added retry to failed notification request. - Removed superfluous New method. - Cosmetic changes. Reviewed-by: Janne Koskinen --- src/corelib/io/qfilesystemwatcher_symbian.cpp | 83 ++++++++++++++------------- src/corelib/io/qfilesystemwatcher_symbian_p.h | 30 +++++----- 2 files changed, 58 insertions(+), 55 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp index 72b8b83..45bb752 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian.cpp +++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp @@ -51,22 +51,17 @@ QT_BEGIN_NAMESPACE -CNotifyChangeEvent* CNotifyChangeEvent::New(RFs &fs, const TDesC& file, - QSymbianFileSystemWatcherEngine* e, bool aIsDir) -{ - CNotifyChangeEvent* self = new CNotifyChangeEvent(fs, file, e, aIsDir); - return self; -} - -CNotifyChangeEvent::CNotifyChangeEvent(RFs &fs, const TDesC& file, - QSymbianFileSystemWatcherEngine* e, bool aIsDir, TInt aPriority) : +QNotifyChangeEvent::QNotifyChangeEvent(RFs &fs, const TDesC &file, + QSymbianFileSystemWatcherEngine *e, bool aIsDir, + TInt aPriority) : CActive(aPriority), isDir(aIsDir), fsSession(fs), watchedPath(file), - engine(e) + engine(e), + failureCount(0) { - if(isDir) { + if (isDir) { fsSession.NotifyChange(ENotifyEntry, iStatus, file); } else { fsSession.NotifyChange(ENotifyAll, iStatus, file); @@ -75,33 +70,43 @@ CNotifyChangeEvent::CNotifyChangeEvent(RFs &fs, const TDesC& file, SetActive(); } -CNotifyChangeEvent::~CNotifyChangeEvent() +QNotifyChangeEvent::~QNotifyChangeEvent() { Cancel(); } -void CNotifyChangeEvent::RunL() +void QNotifyChangeEvent::RunL() { - if (iStatus.Int() == KErrNone) { - if(isDir) { + if(iStatus.Int() == KErrNone) { + failureCount = 0; + } else { + qWarning("QNotifyChangeEvent::RunL() - Failed to order change notifications: %d", iStatus.Int()); + failureCount++; + } + + // Re-request failed notification once, but if it won't start working, + // we can't do much besides just not request any more notifications. + if (failureCount < 2) { + if (isDir) { fsSession.NotifyChange(ENotifyEntry, iStatus, watchedPath); } else { fsSession.NotifyChange(ENotifyAll, iStatus, watchedPath); } SetActive(); - QT_TRYCATCH_LEAVING(engine->emitPathChanged(this)); - } else { - qWarning("CNotifyChangeEvent::RunL() - Failed to order change notifications: %d", iStatus.Int()); + + if (!failureCount) { + QT_TRYCATCH_LEAVING(engine->emitPathChanged(this)); + } } } -void CNotifyChangeEvent::DoCancel() +void QNotifyChangeEvent::DoCancel() { fsSession.NotifyChangeCancel(iStatus); } QSymbianFileSystemWatcherEngine::QSymbianFileSystemWatcherEngine() : - watcherStarted(false) + watcherStarted(false) { moveToThread(this); } @@ -111,8 +116,8 @@ QSymbianFileSystemWatcherEngine::~QSymbianFileSystemWatcherEngine() stop(); } -QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths, - QStringList *files, QStringList *directories) +QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths, QStringList *files, + QStringList *directories) { QMutexLocker locker(&mutex); QStringList p = paths; @@ -141,15 +146,15 @@ QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths, // Use absolute filepath as relative paths seem to have some issues. QString filePath = fi.absoluteFilePath(); - if(isDir && filePath.at(filePath.size()-1) != QChar(L'/')) { + if (isDir && filePath.at(filePath.size() - 1) != QChar(L'/')) { filePath += QChar(L'/'); } currentEvent = NULL; QMetaObject::invokeMethod(this, - "addNativeListener", - Qt::QueuedConnection, - Q_ARG(QString, filePath)); + "addNativeListener", + Qt::QueuedConnection, + Q_ARG(QString, filePath)); syncCondition.wait(&mutex); @@ -160,9 +165,9 @@ QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths, it.remove(); if (isDir) - directories->append(path); - else - files->append(path); + directories->append(path); + else + files->append(path); } } @@ -170,7 +175,8 @@ QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths, } QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &paths, - QStringList *files, QStringList *directories) + QStringList *files, + QStringList *directories) { QMutexLocker locker(&mutex); @@ -185,8 +191,8 @@ QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &path activeObjectToPath.remove(currentEvent); QMetaObject::invokeMethod(this, - "removeNativeListener", - Qt::QueuedConnection); + "removeNativeListener", + Qt::QueuedConnection); syncCondition.wait(&mutex); @@ -202,18 +208,17 @@ QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &path return p; } -void QSymbianFileSystemWatcherEngine::emitPathChanged(CNotifyChangeEvent *e) +void QSymbianFileSystemWatcherEngine::emitPathChanged(QNotifyChangeEvent *e) { QMutexLocker locker(&mutex); QString path = activeObjectToPath.value(e); QFileInfo fi(path); - if (e->isDir) { + if (e->isDir) emit directoryChanged(path, !fi.exists()); - } else { + else emit fileChanged(path, !fi.exists()); - } } void QSymbianFileSystemWatcherEngine::stop() @@ -228,9 +233,7 @@ bool QSymbianFileSystemWatcherEngine::startWatcher() bool retval = true; if (!watcherStarted) { -#if defined(Q_OS_SYMBIAN) setStackSize(0x5000); -#endif start(); syncCondition.wait(&mutex); @@ -257,7 +260,7 @@ void QSymbianFileSystemWatcherEngine::run() if (errorCode == KErrNone) { exec(); - foreach(CNotifyChangeEvent* e, activeObjectToPath.keys()) { + foreach(QNotifyChangeEvent *e, activeObjectToPath.keys()) { e->Cancel(); delete e; } @@ -273,7 +276,7 @@ void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directory QMutexLocker locker(&mutex); QString nativeDir(QDir::toNativeSeparators(directoryPath)); TPtrC ptr(qt_QString2TPtrC(nativeDir)); - currentEvent = CNotifyChangeEvent::New(fsSession, ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive)); + currentEvent = new QNotifyChangeEvent(fsSession, ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive)); syncCondition.wakeOne(); } diff --git a/src/corelib/io/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qfilesystemwatcher_symbian_p.h index a1bd607..2b75bed 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian_p.h +++ b/src/corelib/io/qfilesystemwatcher_symbian_p.h @@ -54,12 +54,13 @@ // #include "qfilesystemwatcher_p.h" + +#ifndef QT_NO_FILESYSTEMWATCHER + #include "qhash.h" #include "qmutex.h" #include "qwaitcondition.h" -#ifndef QT_NO_FILESYSTEMWATCHER - #include #include @@ -67,14 +68,12 @@ QT_BEGIN_NAMESPACE class QSymbianFileSystemWatcherEngine; -class CNotifyChangeEvent : public CActive +class QNotifyChangeEvent : public CActive { public: - CNotifyChangeEvent(RFs &fsSession, const TDesC& file, QSymbianFileSystemWatcherEngine* engine, - bool aIsDir, TInt aPriority = EPriorityStandard); - ~CNotifyChangeEvent(); - static CNotifyChangeEvent* New(RFs &fsSession, const TDesC& file, - QSymbianFileSystemWatcherEngine* engine, bool aIsDir); + QNotifyChangeEvent(RFs &fsSession, const TDesC &file, QSymbianFileSystemWatcherEngine *engine, + bool aIsDir, TInt aPriority = EPriorityStandard); + ~QNotifyChangeEvent(); bool isDir; @@ -85,6 +84,8 @@ private: RFs &fsSession; TPath watchedPath; QSymbianFileSystemWatcherEngine *engine; + + int failureCount; }; class QSymbianFileSystemWatcherEngine : public QFileSystemWatcherEngine @@ -95,10 +96,9 @@ public: QSymbianFileSystemWatcherEngine(); ~QSymbianFileSystemWatcherEngine(); - QStringList addPaths(const QStringList &paths, QStringList *files, - QStringList *directories); + QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories); QStringList removePaths(const QStringList &paths, QStringList *files, - QStringList *directories); + QStringList *directories); void stop(); @@ -110,18 +110,18 @@ public Q_SLOTS: void removeNativeListener(); private: - friend class CNotifyChangeEvent; - void emitPathChanged(CNotifyChangeEvent *e); + friend class QNotifyChangeEvent; + void emitPathChanged(QNotifyChangeEvent *e); bool startWatcher(); RFs fsSession; - QHash activeObjectToPath; + QHash activeObjectToPath; QMutex mutex; QWaitCondition syncCondition; int errorCode; bool watcherStarted; - CNotifyChangeEvent *currentEvent; + QNotifyChangeEvent *currentEvent; }; #endif // QT_NO_FILESYSTEMWATCHER -- cgit v0.12 From 7669f91c33328505fbe52f4913bd3f8745b76d31 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 21 Aug 2009 15:39:57 +0300 Subject: Review inspired changes to Symbian QProcess - Renamed two classes to conform to Qt conventions - Cosmetic changes. Reviewed-by: Janne Koskinen --- src/corelib/io/qprocess.cpp | 5 +- src/corelib/io/qprocess_symbian.cpp | 340 ++++++++++++++++++------------------ 2 files changed, 175 insertions(+), 170 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 18ed676..06204cc 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -265,7 +265,7 @@ void QProcessPrivate::Channel::clear() \snippet doc/src/snippets/process/process.cpp 0 - \section1 Notes for Windows Users + \section1 Notes for Windows Users Some Windows commands (for example, \c dir) are not provided by separate applications, but by the command interpreter itself. @@ -1759,9 +1759,6 @@ void QProcess::terminate() On Windows, kill() uses TerminateProcess, and on Unix and Mac OS X, the SIGKILL signal is sent to the process. - \note Killing running processes from other processes will typically - cause a panic in Symbian due to platform security. - \sa terminate() */ void QProcess::kill() diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index a8c72d3..5b00ed0 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -100,15 +100,15 @@ class QProcessManager; // Active object to listen for child process death -class CProcessActive : public CActive +class QProcessActive : public CActive { public: - static CProcessActive* construct(QProcess* process, - RProcess** proc, - int serial, - int deathPipe); + static QProcessActive *construct(QProcess *process, + RProcess **proc, + int serial, + int deathPipe); - virtual ~CProcessActive(); + virtual ~QProcessActive(); void start(); void stop(); @@ -117,32 +117,32 @@ public: protected: - // From CActive + // Inherited from CActive void RunL(); TInt RunError(TInt aError); void DoCancel(); - CProcessActive(); + QProcessActive(); private: - QProcess* process; - RProcess** pproc; + QProcess *process; + RProcess **pproc; int serial; int deathPipe; bool errorValue; }; // Active object to communicate synchronously with process manager thread -class CProcessManagerMediator : public CActive +class QProcessManagerMediator : public CActive { public: - static CProcessManagerMediator* construct(); + static QProcessManagerMediator *construct(); - virtual ~CProcessManagerMediator(); + virtual ~QProcessManagerMediator(); - bool add(CProcessActive* processObserver); - void remove(CProcessActive* processObserver); + bool add(QProcessActive *processObserver); + void remove(QProcessActive *processObserver); void terminate(); protected: @@ -154,23 +154,28 @@ protected: ETerminate }; - // From CActive + // Inherited from CActive void RunL(); TInt RunError(TInt aError); void DoCancel(); - CProcessManagerMediator(); + QProcessManagerMediator(); - bool notify(CProcessActive* processObserver, Commands command); + bool notify(QProcessActive *processObserver, Commands command); private: - CProcessActive* currentObserver; + QProcessActive *currentObserver; Commands currentCommand; RThread processManagerThread; }; -// Process manager manages child process death listeners +// Process manager manages child process death listeners. +// +// Note: Because QProcess can be used outside event loop, we cannot be guaranteed +// an active scheduler exists for us to add our process death listener objects. +// We can't just install active scheduler on the calling thread, as that would block it +// if we want to actually use it, so a separate manager thread is required. class QProcessManager { public: @@ -179,50 +184,55 @@ public: void startThread(); - TInt run(void* param); + TInt run(void *param); bool add(QProcess *process); void remove(QProcess *process); - inline void setMediator(CProcessManagerMediator* newMediator) {mediator = newMediator;}; + inline void setMediator(QProcessManagerMediator *newMediator) { + mediator = newMediator; + }; private: - inline void lock() {managerMutex.Wait();}; - inline void unlock() {managerMutex.Signal();}; + inline void lock() { + managerMutex.Wait(); + }; + inline void unlock() { + managerMutex.Signal(); + }; - QMap children; - CProcessManagerMediator* mediator; + QMap children; + QProcessManagerMediator *mediator; RMutex managerMutex; bool threadStarted; RThread managerThread; }; -static bool qt_rprocess_running(RProcess* proc) +static bool qt_rprocess_running(RProcess *proc) { - if(proc && proc->Handle()) { + if (proc && proc->Handle()) { TExitType et = proc->ExitType(); - if (et == EExitPending) { + if (et == EExitPending) return true; - } } return false; } -static void qt_create_symbian_commandline(const QStringList &arguments, QString& commandLine) +static void qt_create_symbian_commandline(const QStringList &arguments, QString &commandLine) { - for (int i=0; i0 && tmp.at(i-1) == QLatin1Char('\\')) { + while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\')) { --i; endQuote += QLatin1String("\\"); } @@ -235,12 +245,11 @@ static void qt_create_symbian_commandline(const QStringList &arguments, QString& static TInt qt_create_symbian_process(RProcess **proc, const QString &programName, const QStringList &arguments) { - RProcess* newProc = NULL; + RProcess *newProc = NULL; newProc = new RProcess(); - if (!newProc) { + if (!newProc) return KErrNoMemory; - } QString commandLine; qt_create_symbian_commandline(arguments, commandLine); @@ -250,31 +259,32 @@ static TInt qt_create_symbian_process(RProcess **proc, const QString &programNam TInt err = newProc->Create(program_ptr, cmdline_ptr); - if (err == KErrNotFound){ + if (err == KErrNotFound) { // Strip path from program name and try again (i.e. try from default location "\sys\bin") int index = programName.lastIndexOf(QChar('\\')); int index2 = programName.lastIndexOf(QChar('/')); index = qMax(index, index2); - if(index != -1 && programName.length() >= index){ + if (index != -1 && programName.length() >= index) { QString strippedName; - strippedName = programName.mid(index+1); - QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Process '%s' not found, try stripped version '%s'", qPrintable(programName), qPrintable(strippedName)); + strippedName = programName.mid(index + 1); + QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Executable '%s' not found, trying stripped version '%s'", + qPrintable(programName), qPrintable(strippedName)); TPtrC stripped_ptr(reinterpret_cast(strippedName.constData())); err = newProc->Create(stripped_ptr, cmdline_ptr); if (err != KErrNone) { - QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Unable to create process '%s': %d", qPrintable(strippedName), err); + QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Unable to create process '%s': %d", + qPrintable(strippedName), err); } } } - if (err == KErrNone) { + if (err == KErrNone) *proc = newProc; - } else { + else delete newProc; - } return err; } @@ -326,19 +336,19 @@ static void qt_create_pipe(int *pipe) } // Called from ProcessManagerThread -CProcessActive* CProcessActive::construct(QProcess* process, - RProcess** proc, +QProcessActive *QProcessActive::construct(QProcess *process, + RProcess **proc, int serial, int deathPipe) { QPROCESS_ASSERT((process || proc || *proc), - EProcessActiveNullParameter, - "CProcessActive::construct(): process (0x%x), proc (0x%x) or *proc == NULL, not creating an instance", process, proc) + EProcessActiveNullParameter, + "QProcessActive::construct(): process (0x%x), proc (0x%x) or *proc == NULL, not creating an instance", process, proc) - CProcessActive* newInstance = new CProcessActive(); + QProcessActive *newInstance = new QProcessActive(); if (!newInstance) { - QPROCESS_DEBUG_PRINT("CProcessActive::construct(): Failed to create new instance"); + QPROCESS_DEBUG_PRINT("QProcessActive::construct(): Failed to create new instance"); } else { newInstance->process = process; newInstance->pproc = proc; @@ -351,29 +361,29 @@ CProcessActive* CProcessActive::construct(QProcess* process, } // Called from ProcessManagerThread -CProcessActive::CProcessActive() - : CActive(CActive::EPriorityStandard) +QProcessActive::QProcessActive() + : CActive(CActive::EPriorityStandard) { // Nothing to do } // Called from ProcessManagerThread -CProcessActive::~CProcessActive() +QProcessActive::~QProcessActive() { process = NULL; pproc = NULL; } // Called from ProcessManagerThread -void CProcessActive::start() +void QProcessActive::start() { if (qt_rprocess_running(*pproc)) { CActiveScheduler::Add(this); (*pproc)->Logon(iStatus); SetActive(); - QPROCESS_DEBUG_PRINT("CProcessActive::start(): Started monitoring for process exit."); + QPROCESS_DEBUG_PRINT("QProcessActive::start(): Started monitoring for process exit."); } else { - QPROCESS_DEBUG_PRINT("CProcessActive::start(): Process doesn't exist or is already dead"); + QPROCESS_DEBUG_PRINT("QProcessActive::start(): Process doesn't exist or is already dead"); // Assume process has already died qt_native_write(deathPipe, "", 1); errorValue = true; @@ -381,56 +391,56 @@ void CProcessActive::start() } // Called from ProcessManagerThread -void CProcessActive::stop() +void QProcessActive::stop() { - QPROCESS_DEBUG_PRINT("CProcessActive::stop()"); + QPROCESS_DEBUG_PRINT("QProcessActive::stop()"); // Remove this from scheduler (also cancels the request) Deque(); } -bool CProcessActive::error() +bool QProcessActive::error() { return errorValue; } // Called from ProcessManagerThread -void CProcessActive::RunL() +void QProcessActive::RunL() { // If this method gets executed, the monitored process has died // Notify main thread qt_native_write(deathPipe, "", 1); - QPROCESS_DEBUG_PRINT("CProcessActive::RunL() sending death notice to %d", deathPipe); + QPROCESS_DEBUG_PRINT("QProcessActive::RunL() sending death notice to %d", deathPipe); } // Called from ProcessManagerThread -TInt CProcessActive::RunError(TInt aError) +TInt QProcessActive::RunError(TInt aError) { Q_UNUSED(aError); // Handle RunL leave (should never happen) - QPROCESS_ASSERT(0, EProcessActiveRunError, "CProcessActive::RunError(): Should never get here!") + QPROCESS_ASSERT(0, EProcessActiveRunError, "QProcessActive::RunError(): Should never get here!") return 0; } // Called from ProcessManagerThread -void CProcessActive::DoCancel() +void QProcessActive::DoCancel() { - QPROCESS_DEBUG_PRINT("CProcessActive::DoCancel()"); + QPROCESS_DEBUG_PRINT("QProcessActive::DoCancel()"); if (qt_rprocess_running(*pproc)) { (*pproc)->LogonCancel(iStatus); - QPROCESS_DEBUG_PRINT("CProcessActive::DoCancel(): Stopped monitoring for process exit."); + QPROCESS_DEBUG_PRINT("QProcessActive::DoCancel(): Stopped monitoring for process exit."); } else { - QPROCESS_DEBUG_PRINT("CProcessActive::DoCancel(): Process doesn't exist"); + QPROCESS_DEBUG_PRINT("QProcessActive::DoCancel(): Process doesn't exist"); } } // Called from ProcessManagerThread -CProcessManagerMediator* CProcessManagerMediator::construct() +QProcessManagerMediator *QProcessManagerMediator::construct() { - CProcessManagerMediator* newInstance = new CProcessManagerMediator; + QProcessManagerMediator *newInstance = new QProcessManagerMediator; TInt err(KErrNone); newInstance->currentCommand = ENoCommand; @@ -439,77 +449,77 @@ CProcessManagerMediator* CProcessManagerMediator::construct() if (newInstance) { err = newInstance->processManagerThread.Open(newInstance->processManagerThread.Id()); QPROCESS_ASSERT((err == KErrNone), - EProcessManagerMediatorThreadOpenFailed, - "CProcessManagerMediator::construct(): Failed to open processManagerThread (err:%d)", err) + EProcessManagerMediatorThreadOpenFailed, + "QProcessManagerMediator::construct(): Failed to open processManagerThread (err:%d)", err) } else { QPROCESS_ASSERT(0, - EProcessManagerMediatorCreationFailed, - "CProcessManagerMediator::construct(): Failed to open construct mediator") + EProcessManagerMediatorCreationFailed, + "QProcessManagerMediator::construct(): Failed to open construct mediator") } // Activate mediator CActiveScheduler::Add(newInstance); newInstance->iStatus = KRequestPending; newInstance->SetActive(); - QPROCESS_DEBUG_PRINT("CProcessManagerMediator::construct(): new instance successfully created and activated"); + QPROCESS_DEBUG_PRINT("QProcessManagerMediator::construct(): new instance successfully created and activated"); return newInstance; } // Called from ProcessManagerThread -CProcessManagerMediator::CProcessManagerMediator() - : CActive(CActive::EPriorityStandard) +QProcessManagerMediator::QProcessManagerMediator() + : CActive(CActive::EPriorityStandard) { // Nothing to do } // Called from ProcessManagerThread -CProcessManagerMediator::~CProcessManagerMediator() +QProcessManagerMediator::~QProcessManagerMediator() { processManagerThread.Close(); - currentCommand = ENoCommand; + currentCommand = ENoCommand; currentObserver = NULL; } // Called from main thread -bool CProcessManagerMediator::add(CProcessActive* processObserver) +bool QProcessManagerMediator::add(QProcessActive *processObserver) { - QPROCESS_DEBUG_PRINT("CProcessManagerMediator::add()"); + QPROCESS_DEBUG_PRINT("QProcessManagerMediator::add()"); return notify(processObserver, EAdd); } // Called from main thread -void CProcessManagerMediator::remove(CProcessActive* processObserver) +void QProcessManagerMediator::remove(QProcessActive *processObserver) { - QPROCESS_DEBUG_PRINT("CProcessManagerMediator::remove()"); + QPROCESS_DEBUG_PRINT("QProcessManagerMediator::remove()"); notify(processObserver, ERemove); } // Called from main thread -void CProcessManagerMediator::terminate() +void QProcessManagerMediator::terminate() { - QPROCESS_DEBUG_PRINT("CProcessManagerMediator::terminate()"); + QPROCESS_DEBUG_PRINT("QProcessManagerMediator::terminate()"); notify(NULL, ETerminate); } // Called from main thread -bool CProcessManagerMediator::notify(CProcessActive* processObserver, Commands command) +bool QProcessManagerMediator::notify(QProcessActive *processObserver, Commands command) { bool success(true); - QPROCESS_DEBUG_PRINT("CProcessManagerMediator::Notify(): Command: %d, processObserver: 0x%x", command, processObserver); + QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): Command: %d, processObserver: 0x%x", command, processObserver); QPROCESS_ASSERT((command == ETerminate || processObserver), - EProcessManagerMediatorNullObserver, - "CProcessManagerMediator::Notify(): NULL processObserver not allowed for command: %d", command) + EProcessManagerMediatorNullObserver, + "QProcessManagerMediator::Notify(): NULL processObserver not allowed for command: %d", command) QPROCESS_ASSERT(IsActive(), - EProcessManagerMediatorInactive, - "CProcessManagerMediator::Notify(): Mediator is not active!") + EProcessManagerMediatorInactive, + "QProcessManagerMediator::Notify(): Mediator is not active!") - QPROCESS_ASSERT(iStatus==KRequestPending, - EProcessManagerMediatorNotPending, - "CProcessManagerMediator::Notify(): Mediator request not pending!") + QPROCESS_ASSERT(iStatus == KRequestPending, + EProcessManagerMediatorNotPending, + "QProcessManagerMediator::Notify(): Mediator request not pending!") currentObserver = processObserver; currentCommand = command; @@ -519,16 +529,16 @@ bool CProcessManagerMediator::notify(CProcessActive* processObserver, Commands c processManagerThread.Rendezvous(pmStatus); // Complete request -> RunL will run in the process manager thread - TRequestStatus* status = &iStatus; + TRequestStatus *status = &iStatus; processManagerThread.RequestComplete(status, command); - QPROCESS_DEBUG_PRINT("CProcessManagerMediator::Notify(): Waiting process manager to complete..."); + QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): Waiting process manager to complete..."); User::WaitForRequest(pmStatus); - QPROCESS_DEBUG_PRINT("CProcessManagerMediator::Notify(): Wait over"); + QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): Wait over"); if (currentObserver) { success = !(currentObserver->error()); - QPROCESS_DEBUG_PRINT("CProcessManagerMediator::Notify(): success = %d", success); + QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): success = %d", success); } currentObserver = NULL; @@ -538,25 +548,25 @@ bool CProcessManagerMediator::notify(CProcessActive* processObserver, Commands c } // Called from ProcessManagerThread -void CProcessManagerMediator::RunL() +void QProcessManagerMediator::RunL() { - QPROCESS_DEBUG_PRINT("CProcessManagerMediator::RunL(): currentCommand: %d, iStatus: %d", currentCommand, iStatus.Int()); + QPROCESS_DEBUG_PRINT("QProcessManagerMediator::RunL(): currentCommand: %d, iStatus: %d", currentCommand, iStatus.Int()); switch (currentCommand) { - case EAdd: - currentObserver->start(); - break; - case ERemove: - currentObserver->stop(); - break; - case ETerminate: - Deque(); - CActiveScheduler::Stop(); - return; - default: - QPROCESS_ASSERT(0, - EProcessManagerMediatorInvalidCmd, - "CProcessManagerMediator::RunL(): Invalid command!") - break; + case EAdd: + currentObserver->start(); + break; + case ERemove: + currentObserver->stop(); + break; + case ETerminate: + Deque(); + CActiveScheduler::Stop(); + return; + default: + QPROCESS_ASSERT(0, + EProcessManagerMediatorInvalidCmd, + "QProcessManagerMediator::RunL(): Invalid command!") + break; } iStatus = KRequestPending; @@ -567,44 +577,44 @@ void CProcessManagerMediator::RunL() } // Called from ProcessManagerThread -TInt CProcessManagerMediator::RunError(TInt aError) +TInt QProcessManagerMediator::RunError(TInt aError) { Q_UNUSED(aError); // Handle RunL leave (should never happen) QPROCESS_ASSERT(0, - EProcessManagerMediatorRunError, - "CProcessManagerMediator::RunError(): Should never get here!") + EProcessManagerMediatorRunError, + "QProcessManagerMediator::RunError(): Should never get here!") return 0; } // Called from ProcessManagerThread -void CProcessManagerMediator::DoCancel() +void QProcessManagerMediator::DoCancel() { - QPROCESS_DEBUG_PRINT("CProcessManagerMediator::DoCancel()"); - TRequestStatus* status = &iStatus; + QPROCESS_DEBUG_PRINT("QProcessManagerMediator::DoCancel()"); + TRequestStatus *status = &iStatus; processManagerThread.RequestComplete(status, KErrCancel); } Q_GLOBAL_STATIC(QProcessManager, processManager) -TInt processManagerThreadFunction(TAny* param) +TInt processManagerThreadFunction(TAny *param) { QPROCESS_ASSERT(param, - EProcessManagerNullParam, - "processManagerThreadFunction(): NULL param") + EProcessManagerNullParam, + "processManagerThreadFunction(): NULL param") - QProcessManager* manager = reinterpret_cast(param); + QProcessManager *manager = reinterpret_cast(param); - CActiveScheduler* scheduler = new CQtActiveScheduler(); + CActiveScheduler *scheduler = new CQtActiveScheduler(); QPROCESS_ASSERT(scheduler, - EProcessManagerSchedulerCreationFail, - "processManagerThreadFunction(): Scheduler creation failed") + EProcessManagerSchedulerCreationFail, + "processManagerThreadFunction(): Scheduler creation failed") CActiveScheduler::Install(scheduler); //Creating mediator also adds it to scheduler and activates it. Failure will panic. - manager->setMediator(CProcessManagerMediator::construct()); + manager->setMediator(QProcessManagerMediator::construct()); RThread::Rendezvous(KErrNone); CActiveScheduler::Start(); @@ -616,13 +626,13 @@ TInt processManagerThreadFunction(TAny* param) } QProcessManager::QProcessManager() - : mediator(NULL), threadStarted(false) + : mediator(NULL), threadStarted(false) { TInt err = managerMutex.CreateLocal(); QPROCESS_ASSERT(err == KErrNone, - EProcessManagerMutexCreationFail, - "QProcessManager::QProcessManager(): Failed to create new managerMutex (err: %d)", err) + EProcessManagerMutexCreationFail, + "QProcessManager::QProcessManager(): Failed to create new managerMutex (err: %d)", err) } QProcessManager::~QProcessManager() @@ -630,10 +640,10 @@ QProcessManager::~QProcessManager() QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager()"); // Cancel death listening for all child processes if (mediator) { - QMap::Iterator it = children.begin(); + QMap::Iterator it = children.begin(); while (it != children.end()) { // Remove all monitors - CProcessActive *active = it.value(); + QProcessActive *active = it.value(); mediator->remove(active); QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager() removed listening for a process"); @@ -647,7 +657,7 @@ QProcessManager::~QProcessManager() qDeleteAll(children.values()); children.clear(); - managerThread.Close(); + managerThread.Close(); managerMutex.Close(); } @@ -664,8 +674,8 @@ void QProcessManager::startThread() EOwnerProcess); QPROCESS_ASSERT(err == KErrNone, - EProcessManagerThreadCreationFail, - "QProcessManager::startThread(): Failed to create new managerThread (err:%d)", err) + EProcessManagerThreadCreationFail, + "QProcessManager::startThread(): Failed to create new managerThread (err:%d)", err) threadStarted = true; @@ -684,8 +694,8 @@ static QBasicAtomicInt idCounter = Q_BASIC_ATOMIC_INITIALIZER(1); bool QProcessManager::add(QProcess *process) { QPROCESS_ASSERT(process, - EProcessManagerNullParam, - "QProcessManager::add(): Failed to add CProcessActive to ProcessManager - NULL process") + EProcessManagerNullParam, + "QProcessManager::add(): Failed to add QProcessActive to ProcessManager - NULL process") lock(); @@ -694,19 +704,19 @@ bool QProcessManager::add(QProcess *process) QPROCESS_DEBUG_PRINT("QProcessManager::add(): serial: %d, deathPipe: %d - %d, symbianProcess: 0x%x", serial, process->d_func()->deathPipe[0], process->d_func()->deathPipe[1], process->d_func()->symbianProcess); - CProcessActive* newActive = - CProcessActive::construct(process, + QProcessActive *newActive = + QProcessActive::construct(process, &(process->d_func()->symbianProcess), serial, process->d_func()->deathPipe[1]); - if (newActive){ + if (newActive) { if (mediator->add(newActive)) { children.insert(serial, newActive); unlock(); return true; } else { - QPROCESS_DEBUG_PRINT("QProcessManager::add(): Failed to add CProcessActive to ProcessManager"); + QPROCESS_DEBUG_PRINT("QProcessManager::add(): Failed to add QProcessActive to ProcessManager"); delete newActive; } } @@ -719,13 +729,13 @@ bool QProcessManager::add(QProcess *process) void QProcessManager::remove(QProcess *process) { QPROCESS_ASSERT(process, - EProcessManagerNullParam, - "QProcessManager::remove(): Failed to remove CProcessActive from ProcessManager - NULL process") + EProcessManagerNullParam, + "QProcessManager::remove(): Failed to remove QProcessActive from ProcessManager - NULL process") lock(); int serial = process->d_func()->serial; - CProcessActive *active = children.value(serial); + QProcessActive *active = children.value(serial); if (!active) { unlock(); return; @@ -825,13 +835,13 @@ bool QProcessPrivate::processStarted() qint64 QProcessPrivate::bytesAvailableFromStdout() const { - // In Symbian, zero bytes are always available + // In Symbian, stdout is not supported return 0; } qint64 QProcessPrivate::bytesAvailableFromStderr() const { - // In Symbian, zero bytes are always available + // In Symbian, stderr is not supported return 0; } @@ -839,7 +849,7 @@ qint64 QProcessPrivate::readFromStdout(char *data, qint64 maxlen) { Q_UNUSED(data); Q_UNUSED(maxlen); - // In Symbian, zero bytes are always read + // In Symbian, stdout is not supported return 0; } @@ -847,7 +857,7 @@ qint64 QProcessPrivate::readFromStderr(char *data, qint64 maxlen) { Q_UNUSED(data); Q_UNUSED(maxlen); - // In Symbian, zero bytes are always read + // In Symbian, stderr is not supported return 0; } @@ -855,14 +865,14 @@ qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen) { Q_UNUSED(data); Q_UNUSED(maxlen); - // In Symbian, zero bytes are always written + // In Symbian, stdin is not supported return 0; } void QProcessPrivate::terminateProcess() { - // Not allowed by platform security - will panic kern-exec 46 if process has been started. - // Works if process is not yet started. + // Needs PowerMgmt capability if process has been started; will panic kern-exec 46 otherwise. + // Always works if process is not yet started. if (qt_rprocess_running(symbianProcess)) { symbianProcess->Terminate(0); } else { @@ -872,8 +882,8 @@ void QProcessPrivate::terminateProcess() void QProcessPrivate::killProcess() { - // Not allowed by platform security - will panic kern-exec 46 if process has been started. - // Works if process is not yet started. + // Needs PowerMgmt capability if process has been started; will panic kern-exec 46 otherwise. + // Always works if process is not yet started. if (qt_rprocess_running(symbianProcess)) { symbianProcess->Kill(0); } else { @@ -926,9 +936,8 @@ bool QProcessPrivate::waitForFinished(int msecs) User::WaitForRequest(logonStatus, timerStatus); QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed"); - if (timerStatus == KErrNone) { + if (timerStatus == KErrNone) timeoutOccurred = true; - } timer.Cancel(); timer.Close(); @@ -941,11 +950,11 @@ bool QProcessPrivate::waitForFinished(int msecs) QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished(), qt_rprocess_running returned false"); } - if (timeoutOccurred) { - processError = QProcess::Timedout; - q->setErrorString(QLatin1String(QT_TRANSLATE_NOOP(QProcess, "Process operation timed out"))); - return false; - } + if (timeoutOccurred) { + processError = QProcess::Timedout; + q->setErrorString(QLatin1String(QT_TRANSLATE_NOOP(QProcess, "Process operation timed out"))); + return false; + } _q_processDied(); @@ -1007,14 +1016,13 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a QPROCESS_DEBUG_PRINT("QProcessPrivate::startDetached()"); Q_UNUSED(workingDirectory); - RProcess* newProc = NULL; + RProcess *newProc = NULL; TInt err = qt_create_symbian_process(&newProc, program, arguments); if (err == KErrNone) { - if (pid) { + if (pid) *pid = (qint64)newProc->Id(); - } newProc->Resume(); newProc->Close(); -- cgit v0.12 From 6dade01b24f3fd314cb6ec9c2979348e78740a52 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Mon, 24 Aug 2009 09:25:46 +0200 Subject: Make the singleton file server session independent of QCoreApplication After review comments, changed the file server session from a member of QCoreApplication to a Q_GLOBAL_STATIC, because some applications will want to access files before constructing the QApplication. Reviewed-By: Janne Anttila --- src/corelib/io/qfilesystemwatcher_symbian.cpp | 3 +-- src/corelib/io/qfsfileengine_unix.cpp | 7 +++--- src/corelib/kernel/qcore_symbian_p.cpp | 31 +++++++++++++++++++++++++++ src/corelib/kernel/qcore_symbian_p.h | 3 +++ src/corelib/kernel/qcoreapplication.cpp | 23 +------------------- src/corelib/kernel/qcoreapplication_p.h | 7 ------ src/gui/kernel/qclipboard_s60.cpp | 6 +++--- 7 files changed, 42 insertions(+), 38 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp index b920952..730786f 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian.cpp +++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp @@ -44,7 +44,6 @@ #include "qfileinfo.h" #include "qdebug.h" #include "private/qcore_symbian_p.h" -#include "private/qcoreapplication_p.h" #include #ifndef QT_NO_FILESYSTEMWATCHER @@ -271,7 +270,7 @@ void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directory QMutexLocker locker(&mutex); QString nativeDir(QDir::toNativeSeparators(directoryPath)); TPtrC ptr(qt_QString2TPtrC(nativeDir)); - currentEvent = CNotifyChangeEvent::New(QCoreApplicationPrivate::fsSession(), ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive)); + currentEvent = CNotifyChangeEvent::New(qt_s60GetRFs(), ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive)); syncCondition.wakeOne(); } diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 4ee5c68..62edb0e 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -61,7 +61,6 @@ # include # include # include "private/qcore_symbian_p.h" -# include "private/qcoreapplication_p.h" #endif #include #if !defined(QWS) && defined(Q_OS_MAC) @@ -401,7 +400,7 @@ bool QFSFileEngine::copy(const QString &newName) { #if defined(Q_OS_SYMBIAN) Q_D(QFSFileEngine); - RFs& rfs = QCoreApplicationPrivate::fsSession(); + RFs rfs = qt_s60GetRFs(); CFileMan* fm = NULL; QString oldNative(QDir::toNativeSeparators(d->filePath)); TPtrC oldPtr(qt_QString2TPtrC(oldNative)); @@ -608,7 +607,7 @@ QFileInfoList QFSFileEngine::drives() QFileInfoList ret; #if defined(Q_OS_SYMBIAN) TDriveList driveList; - RFs &rfs = QCoreApplicationPrivate::fsSession(); + RFs rfs = qt_s60GetRFs(); TInt err = rfs.DriveList(driveList); if (err == KErrNone) { for (char i = 0; i < KMaxDrives; i++) { @@ -660,7 +659,7 @@ bool QFSFileEnginePrivate::isSymlink() const static bool _q_isSymbianHidden(const QString &path, bool isDir) { bool retval = false; - RFs rfs = QCoreApplicationPrivate::fsSession(); + RFs rfs = qt_s60GetRFs(); QFileInfo fi(path); QString absPath = fi.absoluteFilePath(); if (isDir && absPath.at(absPath.size()-1) != QChar('/')) { diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index a7d2694..957b92c 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -175,5 +175,36 @@ Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal) return qt_s60_plugin_resolver()->resolve(ordinal); } +/*! +\internal +Provides global access to a shared RFs. +*/ +class QS60RFsSession +{ +public: + QS60RFsSession() { + qt_symbian_throwIfError(iFs.Connect()); + qt_symbian_throwIfError(iFs.ShareProtected()); + } + + ~QS60RFsSession() { + iFs.Close(); + } + + RFs& GetRFs() { + return iFs; + } + +private: + + RFs iFs; +}; + +Q_GLOBAL_STATIC(QS60RFsSession, qt_s60_RFsSession); + +Q_CORE_EXPORT RFs& qt_s60GetRFs() +{ + return qt_s60_RFsSession()->GetRFs(); +} QT_END_NAMESPACE diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h index 2a81b99..60bf95e 100644 --- a/src/corelib/kernel/qcore_symbian_p.h +++ b/src/corelib/kernel/qcore_symbian_p.h @@ -58,6 +58,7 @@ #include #include #include +#include QT_BEGIN_HEADER @@ -136,6 +137,8 @@ enum S60PluginFuncOrdinals Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal); +Q_CORE_EXPORT RFs& qt_s60GetRFs(); + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 74b5140..dd3027b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -271,12 +271,6 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv) qt_application_thread_id = QThread::currentThreadId(); #endif -#ifdef Q_OS_SYMBIAN - if(KErrNone != fileServerSession.Connect()) - qFatal("FATAL: QCoreApplicationPrivate can't connect to file server"); - fileServerSession.ShareProtected(); //makes the handle ok for multithreading and IPC -#endif - // note: this call to QThread::currentThread() may end up setting theMainThread! if (QThread::currentThread() != theMainThread) qWarning("WARNING: QApplication was not created in the main() thread."); @@ -284,9 +278,6 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv) QCoreApplicationPrivate::~QCoreApplicationPrivate() { -#ifdef Q_OS_SYMBIAN - fileServerSession.Close(); -#endif if (threadData) { #ifndef QT_NO_THREAD void *data = &threadData->tls; @@ -825,18 +816,6 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event) return receiver->event(event); } -#ifdef Q_OS_SYMBIAN -/*!\internal - - Accessor for shared global file server session - */ -RFs QCoreApplicationPrivate::fileServerSession; -RFs& QCoreApplicationPrivate::fsSession() -{ - return fileServerSession; -} -#endif - /*! Returns true if an application object has not been created yet; otherwise returns false. @@ -2193,7 +2172,7 @@ QStringList QCoreApplication::libraryPaths() if (tempPath.at(tempPath.length() - 1) != QChar('\\')) { tempPath += QChar('\\'); } - RFs& fs = QCoreApplicationPrivate::fsSession(); + RFs& fs = qt_s60GetRFs(); TPtrC tempPathPtr(reinterpret_cast (tempPath.constData())); TFindFile finder(fs); TInt err = finder.FindByDir(tempPathPtr, tempPathPtr); diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 1adb837..6c30ce8 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -90,10 +90,6 @@ public: static QString macMenuBarName(); #endif -#ifdef Q_OS_SYMBIAN - static RFs& fsSession(); -#endif - static QThread *theMainThread; static QThread *mainThread(); static bool checkInstance(const char *method); @@ -126,9 +122,6 @@ public: static uint attribs; static inline bool testAttribute(uint flag) { return attribs & (1 << flag); } -#ifdef Q_OS_SYMBIAN - static RFs fileServerSession; //this should be moved into a symbian file engine if/when one is written -#endif }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index 26ea844..9a2629c 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -49,7 +49,7 @@ #include "qbuffer.h" #include "qwidget.h" #include "qevent.h" -#include "private/qapplication_p.h" +#include "private/qcore_symbian_p.h" #include // Symbian's clipboard @@ -194,7 +194,7 @@ const QMimeData* QClipboard::mimeData(Mode mode) const if (d) { TRAPD(err,{ - RFs& fs = QCoreApplicationPrivate::fsSession(); + RFs fs = qt_s60GetRFs(); CClipboard* cb = CClipboard::NewForReadingLC(fs); Q_ASSERT(cb); RStoreReadStream stream; @@ -220,7 +220,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) if (d) { TRAPD(err,{ - RFs& fs = QCoreApplicationPrivate::fsSession(); + RFs fs = qt_s60GetRFs(); CClipboard* cb = CClipboard::NewForWritingLC(fs); RStoreWriteStream stream; TStreamId stid = stream.CreateLC(cb->Store()); -- cgit v0.12 From 6d2a500a32fd3e0536420708c845bbb2799c92d1 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 24 Aug 2009 12:47:43 +0300 Subject: Removed unnecessary Q_OS_SYMBIAN ifdefs Q_OS_UNIX branch of ifdef is ok to execute in homePath and tempPath cases of QDir autotest for Symbian. Q_OS_SYMBIAN branch was never even entered for Symbian builds. Reviewed-by: TrustMe --- tests/auto/qdir/tst_qdir.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index 13e8c95..c00ca7a 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -1262,7 +1262,7 @@ void tst_QDir::homePath() #ifdef Q_OS_UNIX if (strHome.length() > 1) // root dir = "/" QVERIFY(!strHome.endsWith('/')); -#elif defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) +#elif defined(Q_OS_WIN) if (strHome.length() > 3) // root dir = "c:/"; "//" is not really valid... QVERIFY(!strHome.endsWith('/')); #endif @@ -1286,7 +1286,7 @@ void tst_QDir::tempPath() #ifdef Q_OS_UNIX if (path.length() > 1) // root dir = "/" QVERIFY(!path.endsWith('/')); -#elif defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) +#elif defined(Q_OS_WIN) if (path.length() > 3) // root dir = "c:/"; "//" is not really valid... QVERIFY(!path.endsWith('/')); #endif -- cgit v0.12 From 702a4a7babaefb80dfbf1915d5fb51239c3788db Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 24 Aug 2009 13:46:42 +0300 Subject: Made examples to compile for Symbian with -no-script configure flag. Reviewed-by: TrustMe --- examples/examples.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/examples.pro b/examples/examples.pro index f756801..31a99bf 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -34,7 +34,6 @@ symbian: SUBDIRS = \ widgets \ draganddrop \ mainwindows \ - script \ sql \ uitools \ xml -- cgit v0.12 From 67a4940fb21b3836d79ed0d377d9c2470de39c48 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 24 Aug 2009 13:52:53 +0300 Subject: Removed some 'illegal empty declaration' warnings from Symbian build Reviewed-by: TrustMe --- src/gui/effects/qgraphicseffect.h | 6 +++--- src/multimedia/audio/qaudio.h | 6 +++--- src/multimedia/audio/qaudiodeviceid.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index 99d8548..d4dba4c 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -80,8 +80,8 @@ protected: QGraphicsEffectSource(QGraphicsEffectSourcePrivate &dd, QObject *parent = 0); private: - Q_DECLARE_PRIVATE(QGraphicsEffectSource); - Q_DISABLE_COPY(QGraphicsEffectSource); + Q_DECLARE_PRIVATE(QGraphicsEffectSource) + Q_DISABLE_COPY(QGraphicsEffectSource) friend class QGraphicsEffect; friend class QGraphicsEffectPrivate; friend class QGraphicsScenePrivate; @@ -103,7 +103,7 @@ public: SourceBoundingRectChanged = 0x4, SourceInvalidated = 0x8 }; - Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag); + Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag) QGraphicsEffect(QObject *parent = 0); virtual ~QGraphicsEffect(); diff --git a/src/multimedia/audio/qaudio.h b/src/multimedia/audio/qaudio.h index bf5495c..5b7ca3b 100644 --- a/src/multimedia/audio/qaudio.h +++ b/src/multimedia/audio/qaudio.h @@ -64,8 +64,8 @@ QT_END_NAMESPACE QT_END_HEADER -Q_DECLARE_METATYPE(QAudio::Error); -Q_DECLARE_METATYPE(QAudio::State); -Q_DECLARE_METATYPE(QAudio::Mode); +Q_DECLARE_METATYPE(QAudio::Error) +Q_DECLARE_METATYPE(QAudio::State) +Q_DECLARE_METATYPE(QAudio::Mode) #endif // QAUDIO_H diff --git a/src/multimedia/audio/qaudiodeviceid.h b/src/multimedia/audio/qaudiodeviceid.h index 984283f..5d842fe 100644 --- a/src/multimedia/audio/qaudiodeviceid.h +++ b/src/multimedia/audio/qaudiodeviceid.h @@ -88,7 +88,7 @@ QT_END_NAMESPACE QT_END_HEADER -Q_DECLARE_METATYPE(QAudioDeviceId); +Q_DECLARE_METATYPE(QAudioDeviceId) #endif // QAUDIODEVICEID_H -- cgit v0.12 From f049061a7b479c957240ec8e4fd91d1e9463b071 Mon Sep 17 00:00:00 2001 From: Iain Date: Mon, 24 Aug 2009 15:12:15 +0100 Subject: Update QtCore and QtGui EABI DEF files with recent symbol changes Reviewed-by: Jason Barron --- src/s60installs/eabi/QtCoreu.def | 41 ++++++-- src/s60installs/eabi/QtGuiu.def | 220 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 241 insertions(+), 20 deletions(-) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 21ed411..0ef2f8c 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -3191,7 +3191,7 @@ EXPORTS _ZN11QFinalStateD0Ev @ 3190 NONAME _ZN11QFinalStateD1Ev @ 3191 NONAME _ZN11QFinalStateD2Ev @ 3192 NONAME - _ZN11QMetaObject11isConnectedEP7QObjecti @ 3193 NONAME + _ZN11QMetaObject11isConnectedEP7QObjecti @ 3193 NONAME ABSENT _ZN11QMetaObject8metacallEP7QObjectNS_4CallEiPPv @ 3194 NONAME _ZN12QEasingCurve12setAmplitudeEf @ 3195 NONAME _ZN12QEasingCurve12setOvershootEf @ 3196 NONAME @@ -3320,7 +3320,7 @@ EXPORTS _ZN16QEventTransition11qt_metacastEPKc @ 3319 NONAME _ZN16QEventTransition12onTransitionEP6QEvent @ 3320 NONAME _ZN16QEventTransition12setEventTypeEN6QEvent4TypeE @ 3321 NONAME - _ZN16QEventTransition14setEventObjectEP7QObject @ 3322 NONAME + _ZN16QEventTransition14setEventObjectEP7QObject @ 3322 NONAME ABSENT _ZN16QEventTransition16staticMetaObjectE @ 3323 NONAME DATA 16 _ZN16QEventTransition5eventEP6QEvent @ 3324 NONAME _ZN16QEventTransition9eventTestEP6QEvent @ 3325 NONAME @@ -3547,8 +3547,8 @@ EXPORTS _ZN6QStateD2Ev @ 3546 NONAME _ZN7QStringC1EiN2Qt14InitializationE @ 3547 NONAME _ZN7QStringC2EiN2Qt14InitializationE @ 3548 NONAME - _ZN8QProcess18setEnvironmentHashERK5QHashI7QStringS1_E @ 3549 NONAME - _ZN8QProcess21systemEnvironmentHashEv @ 3550 NONAME + _ZN8QProcess18setEnvironmentHashERK5QHashI7QStringS1_E @ 3549 NONAME ABSENT + _ZN8QProcess21systemEnvironmentHashEv @ 3550 NONAME ABSENT _ZN9QConfFileD1Ev @ 3551 NONAME _ZN9QConfFileD2Ev @ 3552 NONAME _ZN9QTimeLine14setEasingCurveERK12QEasingCurve @ 3553 NONAME @@ -3588,7 +3588,7 @@ EXPORTS _ZNK15QPauseAnimation10metaObjectEv @ 3587 NONAME _ZNK15QPauseAnimation8durationEv @ 3588 NONAME _ZNK16QEventTransition10metaObjectEv @ 3589 NONAME - _ZNK16QEventTransition11eventObjectEv @ 3590 NONAME + _ZNK16QEventTransition11eventObjectEv @ 3590 NONAME ABSENT _ZNK16QEventTransition9eventTypeEv @ 3591 NONAME _ZNK17QSignalTransition10metaObjectEv @ 3592 NONAME _ZNK17QSignalTransition12senderObjectEv @ 3593 NONAME @@ -3643,7 +3643,7 @@ EXPORTS _ZNK6QState12initialStateEv @ 3642 NONAME _ZNK6QState9childModeEv @ 3643 NONAME _ZNK7QPointF15manhattanLengthEv @ 3644 NONAME - _ZNK8QProcess15environmentHashEv @ 3645 NONAME + _ZNK8QProcess15environmentHashEv @ 3645 NONAME ABSENT _ZNK8QVariant6toRealEPb @ 3646 NONAME _ZNK8QVariant7toFloatEPb @ 3647 NONAME _ZNK9QTimeLine11easingCurveEv @ 3648 NONAME @@ -3694,4 +3694,33 @@ EXPORTS _ZTV26QAbstractTransitionPrivate @ 3693 NONAME _ZTV6QState @ 3694 NONAME _Zls6QDebugRK12QEasingCurve @ 3695 NONAME + _Z12qt_s60GetRFsv @ 3696 NONAME + _Z21qt_regexp_toCanonicalRK7QStringN7QRegExp13PatternSyntaxE @ 3697 NONAME + _ZN16QEventTransition14setEventSourceEP7QObject @ 3698 NONAME + _ZN16QXmlStreamReader15readElementTextENS_24ReadElementTextBehaviourE @ 3699 NONAME + _ZN16QXmlStreamReader18skipCurrentElementEv @ 3700 NONAME + _ZN16QXmlStreamReader20readNextStartElementEv @ 3701 NONAME + _ZN19QProcessEnvironment17systemEnvironmentEv @ 3702 NONAME + _ZN19QProcessEnvironment5clearEv @ 3703 NONAME + _ZN19QProcessEnvironment6insertERK7QStringS2_ @ 3704 NONAME + _ZN19QProcessEnvironment6removeERK7QString @ 3705 NONAME + _ZN19QProcessEnvironmentC1ERKS_ @ 3706 NONAME + _ZN19QProcessEnvironmentC1Ev @ 3707 NONAME + _ZN19QProcessEnvironmentC2ERKS_ @ 3708 NONAME + _ZN19QProcessEnvironmentC2Ev @ 3709 NONAME + _ZN19QProcessEnvironmentD1Ev @ 3710 NONAME + _ZN19QProcessEnvironmentD2Ev @ 3711 NONAME + _ZN19QProcessEnvironmentaSERKS_ @ 3712 NONAME + _ZN8QProcess21setProcessEnvironmentERK19QProcessEnvironment @ 3713 NONAME + _ZN8QVariantC1EiPKvj @ 3714 NONAME + _ZN8QVariantC2EiPKvj @ 3715 NONAME + _ZNK14QObjectPrivate11signalIndexEPKc @ 3716 NONAME + _ZNK14QObjectPrivate17isSignalConnectedEi @ 3717 NONAME + _ZNK16QEventTransition11eventSourceEv @ 3718 NONAME + _ZNK19QProcessEnvironment12toStringListEv @ 3719 NONAME + _ZNK19QProcessEnvironment5valueERK7QStringS2_ @ 3720 NONAME + _ZNK19QProcessEnvironment7isEmptyEv @ 3721 NONAME + _ZNK19QProcessEnvironment8containsERK7QString @ 3722 NONAME + _ZNK19QProcessEnvironmenteqERKS_ @ 3723 NONAME + _ZNK8QProcess18processEnvironmentEv @ 3724 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index c8ccec3..0019187 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4532,7 +4532,7 @@ EXPORTS _ZN20QGraphicsEllipseItemD1Ev @ 4531 NONAME _ZN20QGraphicsEllipseItemD2Ev @ 4532 NONAME _ZN20QGraphicsItemPrivate12remapItemPosEP6QEventP13QGraphicsItem @ 4533 NONAME - _ZN20QGraphicsItemPrivate12resolveDepthEi @ 4534 NONAME + _ZN20QGraphicsItemPrivate12resolveDepthEi @ 4534 NONAME ABSENT _ZN20QGraphicsItemPrivate12setPosHelperERK7QPointF @ 4535 NONAME _ZN20QGraphicsItemPrivate12updateHelperERK6QRectFbb @ 4536 NONAME ABSENT _ZN20QGraphicsItemPrivate16fullUpdateHelperEbbb @ 4537 NONAME ABSENT @@ -4991,7 +4991,7 @@ EXPORTS _ZN23QImageTextureGlyphCache17resizeTextureDataEii @ 4990 NONAME ABSENT _ZN23QPixmapDropShadowFilter11qt_metacallEN11QMetaObject4CallEiPPv @ 4991 NONAME _ZN23QPixmapDropShadowFilter11qt_metacastEPKc @ 4992 NONAME - _ZN23QPixmapDropShadowFilter13setBlurRadiusEf @ 4993 NONAME + _ZN23QPixmapDropShadowFilter13setBlurRadiusEf @ 4993 NONAME ABSENT _ZN23QPixmapDropShadowFilter16staticMetaObjectE @ 4994 NONAME DATA 16 _ZN23QPixmapDropShadowFilter8setColorERK6QColor @ 4995 NONAME _ZN23QPixmapDropShadowFilter9setOffsetERK7QPointF @ 4996 NONAME @@ -11671,8 +11671,8 @@ EXPORTS _ZN11QPanGesture16staticMetaObjectE @ 11670 NONAME DATA 16 _ZN11QPanGesture5eventEP6QEvent @ 11671 NONAME _ZN11QPanGesture5resetEv @ 11672 NONAME - _ZN11QPanGestureC1EP7QWidget @ 11673 NONAME - _ZN11QPanGestureC2EP7QWidget @ 11674 NONAME + _ZN11QPanGestureC1EP7QWidget @ 11673 NONAME ABSENT + _ZN11QPanGestureC2EP7QWidget @ 11674 NONAME ABSENT _ZN11QPixmapData6scrollEiiRK5QRect @ 11675 NONAME _ZN11QProxyStyle11qt_metacallEN11QMetaObject4CallEiPPv @ 11676 NONAME _ZN11QProxyStyle11qt_metacastEPKc @ 11677 NONAME @@ -11802,15 +11802,15 @@ EXPORTS _ZN13QPinchGesture16staticMetaObjectE @ 11801 NONAME DATA 16 _ZN13QPinchGesture5eventEP6QEvent @ 11802 NONAME _ZN13QPinchGesture5resetEv @ 11803 NONAME - _ZN13QPinchGestureC1EP7QWidget @ 11804 NONAME - _ZN13QPinchGestureC2EP7QWidget @ 11805 NONAME + _ZN13QPinchGestureC1EP7QWidget @ 11804 NONAME ABSENT + _ZN13QPinchGestureC2EP7QWidget @ 11805 NONAME ABSENT _ZN14QDesktopWidget18screenCountChangedEi @ 11806 NONAME _ZN14QGraphicsScale11qt_metacallEN11QMetaObject4CallEiPPv @ 11807 NONAME _ZN14QGraphicsScale11qt_metacastEPKc @ 11808 NONAME _ZN14QGraphicsScale12scaleChangedEv @ 11809 NONAME _ZN14QGraphicsScale13originChangedEv @ 11810 NONAME _ZN14QGraphicsScale16staticMetaObjectE @ 11811 NONAME DATA 16 - _ZN14QGraphicsScale9setOriginERK7QPointF @ 11812 NONAME + _ZN14QGraphicsScale9setOriginERK7QPointF @ 11812 NONAME ABSENT _ZN14QGraphicsScale9setXScaleEf @ 11813 NONAME _ZN14QGraphicsScale9setYScaleEf @ 11814 NONAME _ZN14QGraphicsScaleC1EP7QObject @ 11815 NONAME @@ -11856,7 +11856,7 @@ EXPORTS _ZN17QGraphicsRotation7setAxisEN2Qt4AxisE @ 11855 NONAME _ZN17QGraphicsRotation7setAxisERK9QVector3D @ 11856 NONAME _ZN17QGraphicsRotation8setAngleEf @ 11857 NONAME - _ZN17QGraphicsRotation9setOriginERK7QPointF @ 11858 NONAME + _ZN17QGraphicsRotation9setOriginERK7QPointF @ 11858 NONAME ABSENT _ZN17QGraphicsRotationC1EP7QObject @ 11859 NONAME _ZN17QGraphicsRotationC2EP7QObject @ 11860 NONAME _ZN17QGraphicsRotationD0Ev @ 11861 NONAME @@ -12048,8 +12048,8 @@ EXPORTS _ZN8QGesture8finishedEv @ 12047 NONAME _ZN8QGesture9cancelledEv @ 12048 NONAME _ZN8QGesture9triggeredEv @ 12049 NONAME - _ZN8QGestureC2EP7QObject @ 12050 NONAME - _ZN8QGestureC2ER15QGesturePrivateP7QObject @ 12051 NONAME + _ZN8QGestureC2EP7QObject @ 12050 NONAME ABSENT + _ZN8QGestureC2ER15QGesturePrivateP7QObject @ 12051 NONAME ABSENT _ZN8QGestureD0Ev @ 12052 NONAME _ZN8QGestureD1Ev @ 12053 NONAME _ZN8QGestureD2Ev @ 12054 NONAME @@ -12084,7 +12084,7 @@ EXPORTS _ZNK10QCompleter15maxVisibleItemsEv @ 12083 NONAME _ZNK10QMatrix4x410transposedEv @ 12084 NONAME _ZNK10QMatrix4x411determinantEv @ 12085 NONAME - _ZNK10QMatrix4x411toTransformEv @ 12086 NONAME + _ZNK10QMatrix4x411toTransformEv @ 12086 NONAME ABSENT _ZNK10QMatrix4x412normalMatrixEv @ 12087 NONAME _ZNK10QMatrix4x412toValueArrayEPf @ 12088 NONAME _ZNK10QMatrix4x418extractTranslationEv @ 12089 NONAME @@ -12177,7 +12177,7 @@ EXPORTS _ZNK14QGraphicsScale6originEv @ 12176 NONAME _ZNK14QGraphicsScale6xScaleEv @ 12177 NONAME _ZNK14QGraphicsScale6yScaleEv @ 12178 NONAME - _ZNK14QGraphicsScale7applyToEP10QTransform @ 12179 NONAME + _ZNK14QGraphicsScale7applyToEP10QTransform @ 12179 NONAME ABSENT _ZNK14QGraphicsScene5itemsEN2Qt9SortOrderE @ 12180 NONAME _ZNK14QGraphicsScene5itemsERK12QPainterPathN2Qt17ItemSelectionModeENS3_9SortOrderERK10QTransform @ 12181 NONAME _ZNK14QGraphicsScene5itemsERK6QRectFN2Qt17ItemSelectionModeENS3_9SortOrderERK10QTransform @ 12182 NONAME @@ -12194,9 +12194,9 @@ EXPORTS _ZNK17QGraphicsRotation4axisEv @ 12193 NONAME _ZNK17QGraphicsRotation5angleEv @ 12194 NONAME _ZNK17QGraphicsRotation6originEv @ 12195 NONAME - _ZNK17QGraphicsRotation7applyToEP10QTransform @ 12196 NONAME + _ZNK17QGraphicsRotation7applyToEP10QTransform @ 12196 NONAME ABSENT _ZNK18QGraphicsTransform10metaObjectEv @ 12197 NONAME - _ZNK18QGraphicsTransform9transformEv @ 12198 NONAME + _ZNK18QGraphicsTransform9transformEv @ 12198 NONAME ABSENT _ZNK18QTextureGlyphCache18textureMapForGlyphEj @ 12199 NONAME _ZNK19QDockAreaLayoutInfo12hasFixedSizeEv @ 12200 NONAME _ZNK19QDockAreaLayoutInfo13separatorRectERK5QListIiE @ 12201 NONAME @@ -12318,4 +12318,196 @@ EXPORTS _ZrsR11QDataStreamR9QVector2D @ 12317 NONAME _ZrsR11QDataStreamR9QVector3D @ 12318 NONAME _ZrsR11QDataStreamR9QVector4D @ 12319 NONAME + _ZN11QPanGestureC1EP7QWidgetP7QObject @ 12320 NONAME + _ZN11QPanGestureC2EP7QWidgetP7QObject @ 12321 NONAME + _ZN13QGraphicsItem17setGraphicsEffectEP15QGraphicsEffect @ 12322 NONAME + _ZN13QPinchGestureC1EP7QWidgetP7QObject @ 12323 NONAME + _ZN13QPinchGestureC2EP7QWidgetP7QObject @ 12324 NONAME + _ZN14QGraphicsScale9setOriginERK9QVector3D @ 12325 NONAME + _ZN14QGraphicsScale9setZScaleEf @ 12326 NONAME + _ZN15QGraphicsEffect10setEnabledEb @ 12327 NONAME + _ZN15QGraphicsEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 12328 NONAME + _ZN15QGraphicsEffect11qt_metacastEPKc @ 12329 NONAME + _ZN15QGraphicsEffect13sourceChangedE6QFlagsINS_10ChangeFlagEE @ 12330 NONAME + _ZN15QGraphicsEffect14enabledChangedEb @ 12331 NONAME + _ZN15QGraphicsEffect16staticMetaObjectE @ 12332 NONAME DATA 16 + _ZN15QGraphicsEffect18updateBoundingRectEv @ 12333 NONAME + _ZN15QGraphicsEffectC2EP7QObject @ 12334 NONAME + _ZN15QGraphicsEffectC2ER22QGraphicsEffectPrivateP7QObject @ 12335 NONAME + _ZN15QGraphicsEffectD0Ev @ 12336 NONAME + _ZN15QGraphicsEffectD1Ev @ 12337 NONAME + _ZN15QGraphicsEffectD2Ev @ 12338 NONAME + _ZN17QGraphicsRotation9setOriginERK9QVector3D @ 12339 NONAME + _ZN17QPixmapBlurFilter10setQualityEN2Qt18TransformationModeE @ 12340 NONAME + _ZN17QPixmapBlurFilter11qt_metacallEN11QMetaObject4CallEiPPv @ 12341 NONAME + _ZN17QPixmapBlurFilter11qt_metacastEPKc @ 12342 NONAME + _ZN17QPixmapBlurFilter16staticMetaObjectE @ 12343 NONAME DATA 16 + _ZN17QPixmapBlurFilter9setRadiusEi @ 12344 NONAME + _ZN17QPixmapBlurFilterC1EP7QObject @ 12345 NONAME + _ZN17QPixmapBlurFilterC2EP7QObject @ 12346 NONAME + _ZN17QPixmapBlurFilterD0Ev @ 12347 NONAME + _ZN17QPixmapBlurFilterD1Ev @ 12348 NONAME + _ZN17QPixmapBlurFilterD2Ev @ 12349 NONAME + _ZN19QGraphicsBlurEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 12350 NONAME + _ZN19QGraphicsBlurEffect11qt_metacastEPKc @ 12351 NONAME + _ZN19QGraphicsBlurEffect13setBlurRadiusEi @ 12352 NONAME + _ZN19QGraphicsBlurEffect16staticMetaObjectE @ 12353 NONAME DATA 16 + _ZN19QGraphicsBlurEffect17blurRadiusChangedEi @ 12354 NONAME + _ZN19QGraphicsBlurEffect4drawEP8QPainterP21QGraphicsEffectSource @ 12355 NONAME + _ZN19QGraphicsBlurEffectC1EP7QObject @ 12356 NONAME + _ZN19QGraphicsBlurEffectC2EP7QObject @ 12357 NONAME + _ZN19QGraphicsBlurEffectD0Ev @ 12358 NONAME + _ZN19QGraphicsBlurEffectD1Ev @ 12359 NONAME + _ZN19QGraphicsBlurEffectD2Ev @ 12360 NONAME + _ZN20QGraphicsItemPrivate12resolveDepthEv @ 12361 NONAME + _ZN20QGraphicsItemPrivate26invalidateDepthRecursivelyEv @ 12362 NONAME + _ZN21QGraphicsAnchorLayout10invalidateEv @ 12363 NONAME + _ZN21QGraphicsAnchorLayout10setSpacingEf @ 12364 NONAME + _ZN21QGraphicsAnchorLayout11setGeometryERK6QRectF @ 12365 NONAME + _ZN21QGraphicsAnchorLayout12removeAnchorEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_ @ 12366 NONAME + _ZN21QGraphicsAnchorLayout16addCornerAnchorsEP19QGraphicsLayoutItemN2Qt6CornerES1_S3_ @ 12367 NONAME + _ZN21QGraphicsAnchorLayout16setAnchorSpacingEPK19QGraphicsLayoutItemN2Qt11AnchorPointES2_S4_f @ 12368 NONAME + _ZN21QGraphicsAnchorLayout18setVerticalSpacingEf @ 12369 NONAME + _ZN21QGraphicsAnchorLayout18unsetAnchorSpacingEPK19QGraphicsLayoutItemN2Qt11AnchorPointES2_S4_ @ 12370 NONAME + _ZN21QGraphicsAnchorLayout20setHorizontalSpacingEf @ 12371 NONAME + _ZN21QGraphicsAnchorLayout8removeAtEi @ 12372 NONAME + _ZN21QGraphicsAnchorLayout9addAnchorEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_ @ 12373 NONAME + _ZN21QGraphicsAnchorLayoutC1EP19QGraphicsLayoutItem @ 12374 NONAME + _ZN21QGraphicsAnchorLayoutC2EP19QGraphicsLayoutItem @ 12375 NONAME + _ZN21QGraphicsAnchorLayoutD0Ev @ 12376 NONAME + _ZN21QGraphicsAnchorLayoutD1Ev @ 12377 NONAME + _ZN21QGraphicsAnchorLayoutD2Ev @ 12378 NONAME + _ZN21QGraphicsEffectSource11qt_metacallEN11QMetaObject4CallEiPPv @ 12379 NONAME + _ZN21QGraphicsEffectSource11qt_metacastEPKc @ 12380 NONAME + _ZN21QGraphicsEffectSource16staticMetaObjectE @ 12381 NONAME DATA 16 + _ZN21QGraphicsEffectSource4drawEP8QPainter @ 12382 NONAME + _ZN21QGraphicsEffectSource6updateEv @ 12383 NONAME + _ZN21QGraphicsEffectSourceC1ER28QGraphicsEffectSourcePrivateP7QObject @ 12384 NONAME + _ZN21QGraphicsEffectSourceC2ER28QGraphicsEffectSourcePrivateP7QObject @ 12385 NONAME + _ZN21QGraphicsEffectSourceD0Ev @ 12386 NONAME + _ZN21QGraphicsEffectSourceD1Ev @ 12387 NONAME + _ZN21QGraphicsEffectSourceD2Ev @ 12388 NONAME + _ZN23QGraphicsColorizeEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 12389 NONAME + _ZN23QGraphicsColorizeEffect11qt_metacastEPKc @ 12390 NONAME + _ZN23QGraphicsColorizeEffect12colorChangedERK6QColor @ 12391 NONAME + _ZN23QGraphicsColorizeEffect16staticMetaObjectE @ 12392 NONAME DATA 16 + _ZN23QGraphicsColorizeEffect4drawEP8QPainterP21QGraphicsEffectSource @ 12393 NONAME + _ZN23QGraphicsColorizeEffect8setColorERK6QColor @ 12394 NONAME + _ZN23QGraphicsColorizeEffectC1EP7QObject @ 12395 NONAME + _ZN23QGraphicsColorizeEffectC2EP7QObject @ 12396 NONAME + _ZN23QGraphicsColorizeEffectD0Ev @ 12397 NONAME + _ZN23QGraphicsColorizeEffectD1Ev @ 12398 NONAME + _ZN23QGraphicsColorizeEffectD2Ev @ 12399 NONAME + _ZN23QGraphicsPixelizeEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 12400 NONAME + _ZN23QGraphicsPixelizeEffect11qt_metacastEPKc @ 12401 NONAME + _ZN23QGraphicsPixelizeEffect12setPixelSizeEi @ 12402 NONAME + _ZN23QGraphicsPixelizeEffect16pixelSizeChangedEi @ 12403 NONAME + _ZN23QGraphicsPixelizeEffect16staticMetaObjectE @ 12404 NONAME DATA 16 + _ZN23QGraphicsPixelizeEffect4drawEP8QPainterP21QGraphicsEffectSource @ 12405 NONAME + _ZN23QGraphicsPixelizeEffectC1EP7QObject @ 12406 NONAME + _ZN23QGraphicsPixelizeEffectC2EP7QObject @ 12407 NONAME + _ZN23QGraphicsPixelizeEffectD0Ev @ 12408 NONAME + _ZN23QGraphicsPixelizeEffectD1Ev @ 12409 NONAME + _ZN23QGraphicsPixelizeEffectD2Ev @ 12410 NONAME + _ZN23QPixmapDropShadowFilter13setBlurRadiusEi @ 12411 NONAME + _ZN24QGraphicsGrayscaleEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 12412 NONAME + _ZN24QGraphicsGrayscaleEffect11qt_metacastEPKc @ 12413 NONAME + _ZN24QGraphicsGrayscaleEffect16staticMetaObjectE @ 12414 NONAME DATA 16 + _ZN24QGraphicsGrayscaleEffect4drawEP8QPainterP21QGraphicsEffectSource @ 12415 NONAME + _ZN24QGraphicsGrayscaleEffectC1EP7QObject @ 12416 NONAME + _ZN24QGraphicsGrayscaleEffectC2EP7QObject @ 12417 NONAME + _ZN24QGraphicsGrayscaleEffectD0Ev @ 12418 NONAME + _ZN24QGraphicsGrayscaleEffectD1Ev @ 12419 NONAME + _ZN24QGraphicsGrayscaleEffectD2Ev @ 12420 NONAME + _ZN25QGraphicsDropShadowEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 12421 NONAME + _ZN25QGraphicsDropShadowEffect11qt_metacastEPKc @ 12422 NONAME + _ZN25QGraphicsDropShadowEffect12colorChangedERK6QColor @ 12423 NONAME + _ZN25QGraphicsDropShadowEffect13offsetChangedERK7QPointF @ 12424 NONAME + _ZN25QGraphicsDropShadowEffect13setBlurRadiusEi @ 12425 NONAME + _ZN25QGraphicsDropShadowEffect16staticMetaObjectE @ 12426 NONAME DATA 16 + _ZN25QGraphicsDropShadowEffect17blurRadiusChangedEi @ 12427 NONAME + _ZN25QGraphicsDropShadowEffect4drawEP8QPainterP21QGraphicsEffectSource @ 12428 NONAME + _ZN25QGraphicsDropShadowEffect8setColorERK6QColor @ 12429 NONAME + _ZN25QGraphicsDropShadowEffect9setOffsetERK7QPointF @ 12430 NONAME + _ZN25QGraphicsDropShadowEffectC1EP7QObject @ 12431 NONAME + _ZN25QGraphicsDropShadowEffectC2EP7QObject @ 12432 NONAME + _ZN25QGraphicsDropShadowEffectD0Ev @ 12433 NONAME + _ZN25QGraphicsDropShadowEffectD1Ev @ 12434 NONAME + _ZN25QGraphicsDropShadowEffectD2Ev @ 12435 NONAME + _ZN7QWidget17setGraphicsEffectEP15QGraphicsEffect @ 12436 NONAME + _ZN8QGesture16setGestureTargetEP7QObject @ 12437 NONAME + _ZN8QGestureC2EP7QObjectS1_ @ 12438 NONAME + _ZN8QGestureC2ER15QGesturePrivateP7QObjectS3_ @ 12439 NONAME + _ZNK10QMatrix4x411toTransformEf @ 12440 NONAME + _ZNK10QMatrix4x4cv8QVariantEv @ 12441 NONAME + _ZNK11QQuaternioncv8QVariantEv @ 12442 NONAME + _ZNK13QGraphicsItem14graphicsEffectEv @ 12443 NONAME + _ZNK14QGraphicsScale6zScaleEv @ 12444 NONAME + _ZNK14QGraphicsScale7applyToEP10QMatrix4x4 @ 12445 NONAME + _ZNK15QGraphicsEffect10metaObjectEv @ 12446 NONAME + _ZNK15QGraphicsEffect12boundingRectEv @ 12447 NONAME + _ZNK15QGraphicsEffect15boundingRectForERK6QRectF @ 12448 NONAME + _ZNK15QGraphicsEffect6sourceEv @ 12449 NONAME + _ZNK15QGraphicsEffect9isEnabledEv @ 12450 NONAME + _ZNK17QGraphicsRotation7applyToEP10QMatrix4x4 @ 12451 NONAME + _ZNK17QPixmapBlurFilter10metaObjectEv @ 12452 NONAME + _ZNK17QPixmapBlurFilter15boundingRectForERK6QRectF @ 12453 NONAME + _ZNK17QPixmapBlurFilter4drawEP8QPainterRK7QPointFRK7QPixmapRK6QRectF @ 12454 NONAME + _ZNK17QPixmapBlurFilter6radiusEv @ 12455 NONAME + _ZNK17QPixmapBlurFilter7qualityEv @ 12456 NONAME + _ZNK19QGraphicsBlurEffect10blurRadiusEv @ 12457 NONAME + _ZNK19QGraphicsBlurEffect10metaObjectEv @ 12458 NONAME + _ZNK19QGraphicsBlurEffect15boundingRectForERK6QRectF @ 12459 NONAME + _ZNK20QGraphicsItemPrivate21effectiveBoundingRectEv @ 12460 NONAME + _ZNK20QGraphicsItemPrivate26sceneEffectiveBoundingRectEv @ 12461 NONAME + _ZNK20QGraphicsItemPrivate5depthEv @ 12462 NONAME + _ZNK21QGraphicsAnchorLayout13anchorSpacingEPK19QGraphicsLayoutItemN2Qt11AnchorPointES2_S4_ @ 12463 NONAME + _ZNK21QGraphicsAnchorLayout15verticalSpacingEv @ 12464 NONAME + _ZNK21QGraphicsAnchorLayout17horizontalSpacingEv @ 12465 NONAME + _ZNK21QGraphicsAnchorLayout5countEv @ 12466 NONAME + _ZNK21QGraphicsAnchorLayout6itemAtEi @ 12467 NONAME + _ZNK21QGraphicsAnchorLayout8sizeHintEN2Qt8SizeHintERK6QSizeF @ 12468 NONAME + _ZNK21QGraphicsEffectSource10deviceRectEv @ 12469 NONAME + _ZNK21QGraphicsEffectSource10metaObjectEv @ 12470 NONAME + _ZNK21QGraphicsEffectSource11styleOptionEv @ 12471 NONAME + _ZNK21QGraphicsEffectSource12boundingRectEN2Qt16CoordinateSystemE @ 12472 NONAME + _ZNK21QGraphicsEffectSource12graphicsItemEv @ 12473 NONAME + _ZNK21QGraphicsEffectSource6pixmapEN2Qt16CoordinateSystemEP6QPoint @ 12474 NONAME + _ZNK21QGraphicsEffectSource6widgetEv @ 12475 NONAME + _ZNK21QGraphicsEffectSource8isPixmapEv @ 12476 NONAME + _ZNK23QGraphicsColorizeEffect10metaObjectEv @ 12477 NONAME + _ZNK23QGraphicsColorizeEffect5colorEv @ 12478 NONAME + _ZNK23QGraphicsPixelizeEffect10metaObjectEv @ 12479 NONAME + _ZNK23QGraphicsPixelizeEffect9pixelSizeEv @ 12480 NONAME + _ZNK24QGraphicsGrayscaleEffect10metaObjectEv @ 12481 NONAME + _ZNK25QGraphicsDropShadowEffect10blurRadiusEv @ 12482 NONAME + _ZNK25QGraphicsDropShadowEffect10metaObjectEv @ 12483 NONAME + _ZNK25QGraphicsDropShadowEffect15boundingRectForERK6QRectF @ 12484 NONAME + _ZNK25QGraphicsDropShadowEffect5colorEv @ 12485 NONAME + _ZNK25QGraphicsDropShadowEffect6offsetEv @ 12486 NONAME + _ZNK7QWidget14graphicsEffectEv @ 12487 NONAME + _ZNK8QGesture13gestureTargetEv @ 12488 NONAME + _ZNK9QVector2Dcv8QVariantEv @ 12489 NONAME + _ZNK9QVector3Dcv8QVariantEv @ 12490 NONAME + _ZNK9QVector4Dcv8QVariantEv @ 12491 NONAME + _ZTI15QGraphicsEffect @ 12492 NONAME + _ZTI17QPixmapBlurFilter @ 12493 NONAME + _ZTI19QGraphicsBlurEffect @ 12494 NONAME + _ZTI21QGraphicsAnchorLayout @ 12495 NONAME + _ZTI21QGraphicsEffectSource @ 12496 NONAME + _ZTI22QGraphicsEffectPrivate @ 12497 NONAME + _ZTI23QGraphicsColorizeEffect @ 12498 NONAME + _ZTI23QGraphicsPixelizeEffect @ 12499 NONAME + _ZTI24QGraphicsGrayscaleEffect @ 12500 NONAME + _ZTI25QGraphicsDropShadowEffect @ 12501 NONAME + _ZTV15QGraphicsEffect @ 12502 NONAME + _ZTV17QPixmapBlurFilter @ 12503 NONAME + _ZTV19QGraphicsBlurEffect @ 12504 NONAME + _ZTV21QGraphicsAnchorLayout @ 12505 NONAME + _ZTV21QGraphicsEffectSource @ 12506 NONAME + _ZTV22QGraphicsEffectPrivate @ 12507 NONAME + _ZTV23QGraphicsColorizeEffect @ 12508 NONAME + _ZTV23QGraphicsPixelizeEffect @ 12509 NONAME + _ZTV24QGraphicsGrayscaleEffect @ 12510 NONAME + _ZTV25QGraphicsDropShadowEffect @ 12511 NONAME -- cgit v0.12 From 7c04a404e5ba63cd9c8bdf1e3c891e796adf2c39 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 25 Aug 2009 12:59:14 +1000 Subject: Don't dereference VGImage's that come from QVGPixmapData TexturePattern brushes were sometimes turning all black with OpenVG. This was due to the vgDestroyImage() destroying the cached VGImage in the QVGPixmapData. We only need to use vgDestroyImage() if the QPixmap is not backed up by a QVGPixmapData (bitmaps and pixmaps from other paint engines). Reviewed-by: Sarah Smith --- src/openvg/qpaintengine_vg.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 5669f45..d2c7b8b 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1091,6 +1091,7 @@ VGPaintType QVGPaintEnginePrivate::setBrush // The brush is a texture specified by a QPixmap/QImage. QPixmapData *pd = brush.texture().pixmapData(); VGImage vgImg; + bool deref = false; if (pd->pixelType() == QPixmapData::BitmapType) { // Colorize bitmaps using the brush color and opacity. QColor color = brush.color(); @@ -1098,15 +1099,21 @@ VGPaintType QVGPaintEnginePrivate::setBrush color.setAlphaF(color.alphaF() * opacity); QImage image = colorizeBitmap(*(pd->buffer()), color); vgImg = toVGImage(image); + deref = true; } else if (opacity == 1.0) { if (pd->classId() == QPixmapData::OpenVGClass) { QVGPixmapData *vgpd = static_cast(pd); vgImg = vgpd->toVGImage(); } else { vgImg = toVGImage(*(pd->buffer())); + deref = true; } + } else if (pd->classId() == QPixmapData::OpenVGClass) { + QVGPixmapData *vgpd = static_cast(pd); + vgImg = vgpd->toVGImage(opacity); } else { vgImg = toVGImageWithOpacity(*(pd->buffer()), opacity); + deref = true; } if (vgImg == VG_INVALID_HANDLE) break; @@ -1114,7 +1121,8 @@ VGPaintType QVGPaintEnginePrivate::setBrush vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN); vgSetParameteri(paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_REPEAT); vgPaintPattern(paint, vgImg); - vgDestroyImage(vgImg); // Will stay valid until pattern is destroyed. + if (deref) + vgDestroyImage(vgImg); // Will be valid until pattern is destroyed. return VG_PAINT_TYPE_PATTERN; } -- cgit v0.12 From 48887beb4586eaac81b217dd710c43854f350b25 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 25 Aug 2009 13:12:28 +1000 Subject: Fixed compile of cetest. Broken in two different ways by the QtScript-JavaScriptCore integration and the S60 integration. Reviewed-by: Michael Goddard --- tools/qtestlib/wince/cetest/bootstrapped.pri | 5 ++++- tools/qtestlib/wince/cetest/cetest.pro | 3 +-- tools/qtestlib/wince/cetest/qmake_include.pri | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/qtestlib/wince/cetest/bootstrapped.pri b/tools/qtestlib/wince/cetest/bootstrapped.pri index 3a0ce24..b9c4b2b 100644 --- a/tools/qtestlib/wince/cetest/bootstrapped.pri +++ b/tools/qtestlib/wince/cetest/bootstrapped.pri @@ -36,4 +36,7 @@ SOURCES += \ $$QT_SOURCE_TREE/src/corelib/tools/qbitarray.cpp \ $$QT_SOURCE_TREE/src/corelib/kernel/qmetatype.cpp \ $$QT_SOURCE_TREE/src/corelib/kernel/qvariant.cpp \ - $$QT_SOURCE_TREE/src/corelib/codecs/qutfcodec.cpp + $$QT_SOURCE_TREE/src/corelib/codecs/qutfcodec.cpp \ + $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.cpp \ + $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils.cpp + diff --git a/tools/qtestlib/wince/cetest/cetest.pro b/tools/qtestlib/wince/cetest/cetest.pro index a6b79da..5cd52cf 100644 --- a/tools/qtestlib/wince/cetest/cetest.pro +++ b/tools/qtestlib/wince/cetest/cetest.pro @@ -18,9 +18,9 @@ DEFINES += QT_BUILD_QMAKE QT_BOOTSTRAPPED QT_NO_CODECS QT_LITE_UNICODE QT INCLUDEPATH = \ $$QT_SOURCE_TREE/tools/qtestlib/ce/cetest \ $$QT_SOURCE_TREE/qmake \ + $$QT_SOURCE_TREE/qmake/generators/symbian \ $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ - $$QT_BUILD_TREE/include/QtScript \ $$QT_BUILD_TREE/src/corelib/global DEPENDPATH += $$QT_BUILD_TREE/src/corelib/tools $$QT_BUILD_TREE/src/corelib/io @@ -51,4 +51,3 @@ isEmpty(QT_CE_RAPI_INC) { include(qmake_include.pri) include(bootstrapped.pri) -include($$QT_SOURCE_TREE/src/script/script.pri) diff --git a/tools/qtestlib/wince/cetest/qmake_include.pri b/tools/qtestlib/wince/cetest/qmake_include.pri index 3831634..aa32653 100644 --- a/tools/qtestlib/wince/cetest/qmake_include.pri +++ b/tools/qtestlib/wince/cetest/qmake_include.pri @@ -4,4 +4,6 @@ HEADERS += \ SOURCES += \ $$QT_SOURCE_TREE/qmake/option.cpp \ $$QT_SOURCE_TREE/qmake/project.cpp \ - $$QT_SOURCE_TREE/qmake/property.cpp + $$QT_SOURCE_TREE/qmake/property.cpp \ + $$QT_SOURCE_TREE/qmake/generators/symbian/initprojectdeploy_symbian.cpp + -- cgit v0.12 From fb698edb1e996719c98285c16ed881f42ddfbd77 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 25 Aug 2009 13:49:53 +1000 Subject: Restore old behaviour if qdoc3 is built without $QT_BUILD_TREE set. Third time lucky. The first attempt broke source package builds, because $$QT_BUILD_TREE is not set if you just run qmake on qdoc3.pro, causing the generated Makefile to try to build /bin/qdoc3. The second attempt caused similar problems if you weren't building qdoc3 at least three levels below the root directory, plus the generated makefile had the target "../../bin/qdoc3" instead of "qdoc3". Reviewed-by: Lincoln Ramsay --- tools/qdoc3/qdoc3.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 99edcf4..bacef3f 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -7,7 +7,7 @@ DEFINES += QT_NO_CAST_TO_ASCII QT = core xml CONFIG += console CONFIG -= debug_and_release_target -DESTDIR = ../../bin +!isEmpty(QT_BUILD_TREE):DESTDIR = $$QT_BUILD_TREE/bin #CONFIG += debug build_all:!build_pass { CONFIG -= build_all -- cgit v0.12 From 0634c73e702f8c592b84d95b4c8f19a89067c1fc Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 25 Aug 2009 08:03:22 +0200 Subject: Remove the 'script' sub-directory from the symbian scope. Now that QtScript is an optional module there is a chance that it is not built so don't try to explicitly force it to compile these examples. Reviewed-by: Aleksandar Babic --- examples/examples.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/examples.pro b/examples/examples.pro index 6658fd3..7acd67b 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -34,7 +34,6 @@ symbian: SUBDIRS = \ widgets \ draganddrop \ mainwindows \ - script \ sql \ uitools \ xml -- cgit v0.12 From e1309dcfe2b61beb7c3ab23a0250382043dc9168 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 24 Aug 2009 17:20:47 +0200 Subject: qsystemtrayicon_win.cpp fix determination of NOTIFYICONDATA struct size Now, that we define _WIN32_WINNT as 0x0500, we have no access to guidItem in NOTIFYICONDATA. Thus, we cannot determine NOTIFYICONDATAW_V2_SIZE. But in this case, NOTIFYICONDATAW_V2_SIZE is the same as sizeof(NOTIFYICONDATA). On Windows CE exists only one version of this struct anyway. Reviewed-By: mauricek --- src/gui/util/qsystemtrayicon_win.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp index 56872ac..465c1d8 100644 --- a/src/gui/util/qsystemtrayicon_win.cpp +++ b/src/gui/util/qsystemtrayicon_win.cpp @@ -132,14 +132,10 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object) : hIcon(0), q(object), ignoreNextMouseRelease(false) { -#ifdef Q_OS_WINCE - notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, szTip[64]); // NOTIFYICONDATAW_V1_SIZE; - maxTipLength = 64; -#elif WINVER <= 0x0500 notifyIconSize = sizeof(NOTIFYICONDATA); +#ifdef Q_OS_WINCE maxTipLength = 64; #else - notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, guidItem); // NOTIFYICONDATAW_V2_SIZE; maxTipLength = 128; #endif -- cgit v0.12 From 2e6c1f12babf1d36d1aa80bce7baeadc0e651cda Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 25 Aug 2009 08:10:44 +0200 Subject: unneeded WINVER check in qapplication_win.cpp removed Reviewed-by: TrustMe --- src/gui/kernel/qapplication_win.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index b2cde4d..76a3b1e 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1808,7 +1808,6 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam case APPCOMMAND_VOLUME_UP: key = Qt::Key_VolumeUp; break; -#if defined(WINVER) && WINVER >= 0x0501 // Commands new in Windows XP case APPCOMMAND_HELP: key = Qt::Key_Help; @@ -1822,7 +1821,6 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam case APPCOMMAND_MEDIA_PLAY: key = Qt::Key_MediaPlay; break; -#endif default: break; } -- cgit v0.12 From 1908002e9b7cbd9c3ebdec061e842bd6296b1edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Tue, 25 Aug 2009 10:12:07 +0200 Subject: Silence linkerSupportsFlag test output. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 49b2e86..3f3e55a 100755 --- a/configure +++ b/configure @@ -115,7 +115,7 @@ linkerSupportsFlag() safe_flag=`shellEscape "$flag"` lflags=$lflags,$safe_flag done - compilerSupportsFlag "$lflags" + compilerSupportsFlag "$lflags" >/dev/null 2>&1 } #------------------------------------------------------------------------------- -- cgit v0.12 From 042f15fefd19584c546cb55f24c4c79c4d76529c Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 25 Aug 2009 10:26:35 +0200 Subject: Carbon: pan gesture keeps breaking wheel events Solution: remove pan gestures from all scroll areas in Qt. I do this for Mac now, but I will strongly suggest that we do this on Win as well, as there is currently no way to override the panning behaviour, and this works against the intention of scroll areas. --- src/gui/widgets/qabstractscrollarea.cpp | 5 +++++ src/gui/widgets/qabstractscrollarea.h | 3 +++ src/gui/widgets/qabstractscrollarea_p.h | 2 +- src/gui/widgets/qplaintextedit.cpp | 8 ++++++++ src/gui/widgets/qplaintextedit.h | 4 ++++ src/gui/widgets/qplaintextedit_p.h | 6 ++++-- 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 28435ef..1b4d41b 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -51,7 +51,10 @@ #include "qdebug.h" #include "qboxlayout.h" #include "qpainter.h" + +#ifdef Q_WS_WIN #include "qstandardgestures.h" +#endif #include "qabstractscrollarea_p.h" #include @@ -1344,6 +1347,7 @@ void QAbstractScrollArea::setupViewport(QWidget *viewport) Q_UNUSED(viewport); } +#ifdef Q_WS_WIN void QAbstractScrollAreaPrivate::_q_gestureTriggered() { Q_Q(QAbstractScrollArea); @@ -1362,6 +1366,7 @@ void QAbstractScrollAreaPrivate::_q_gestureTriggered() vbar->setValue(newY); } } +#endif QT_END_NAMESPACE diff --git a/src/gui/widgets/qabstractscrollarea.h b/src/gui/widgets/qabstractscrollarea.h index 0a3e9c5..0625458 100644 --- a/src/gui/widgets/qabstractscrollarea.h +++ b/src/gui/widgets/qabstractscrollarea.h @@ -128,7 +128,10 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_hslide(int)) Q_PRIVATE_SLOT(d_func(), void _q_vslide(int)) Q_PRIVATE_SLOT(d_func(), void _q_showOrHideScrollBars()) + +#ifdef Q_WS_WIN Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered()) +#endif friend class QStyleSheetStyle; friend class QWidgetPrivate; diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index a5acdd1..4362ce9 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -101,9 +101,9 @@ public: { return q_func()->viewportEvent(event); } QScopedPointer viewportFilter; - virtual void _q_gestureTriggered(); #ifdef Q_WS_WIN QPanGesture *panGesture; + virtual void _q_gestureTriggered(); bool singleFingerPanEnabled; void setSingleFingerPanEnabled(bool on = true); #endif diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 03c36d7..e025876 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -66,7 +66,9 @@ #include #include +#ifdef Q_WS_WIN #include +#endif #include @@ -792,8 +794,10 @@ void QPlainTextEditPrivate::init(const QString &txt) viewport->setCursor(Qt::IBeamCursor); #endif originalOffsetY = 0; +#ifdef Q_WS_WIN panGesture = new QPanGesture(q); QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered())); +#endif } void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) @@ -2918,6 +2922,8 @@ QAbstractTextDocumentLayout::PaintContext QPlainTextEdit::getPaintContext() cons (\a available is true) or unavailable (\a available is false). */ +#ifdef Q_WS_WIN + void QPlainTextEditPrivate::_q_gestureTriggered() { Q_Q(QPlainTextEdit); @@ -2942,6 +2948,8 @@ void QPlainTextEditPrivate::_q_gestureTriggered() } } +#endif + QT_END_NAMESPACE #include "moc_qplaintextedit.cpp" diff --git a/src/gui/widgets/qplaintextedit.h b/src/gui/widgets/qplaintextedit.h index c9652ae..5ec3ed8 100644 --- a/src/gui/widgets/qplaintextedit.h +++ b/src/gui/widgets/qplaintextedit.h @@ -269,7 +269,11 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars()) Q_PRIVATE_SLOT(d_func(), void _q_verticalScrollbarActionTriggered(int)) Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged()) + +#ifdef Q_WS_WIN Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered()) +#endif + friend class QPlainTextEditControl; }; diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/gui/widgets/qplaintextedit_p.h index 608f3cf..e93302c 100644 --- a/src/gui/widgets/qplaintextedit_p.h +++ b/src/gui/widgets/qplaintextedit_p.h @@ -176,12 +176,14 @@ public: #endif void _q_cursorPositionChanged(); - void _q_modificationChanged(bool); - void _q_gestureTriggered(); int originalOffsetY; + +#ifdef Q_WS_WIN + void _q_gestureTriggered(); QPanGesture *panGesture; +#endif }; QT_END_NAMESPACE -- cgit v0.12 From 3636e666528b72de79f8c7012690bb9e279f0863 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 24 Aug 2009 18:57:06 +0200 Subject: Fix memory leak in QScriptEngine::newQObject Do not reset the delegate and the prototype when reusing existing wrapper. Reviewed-by: Kent Hansen --- src/script/api/qscriptengine.cpp | 14 ++++++-------- src/script/bridge/qscriptobject.cpp | 2 ++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 631175a..033d92e 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1180,14 +1180,14 @@ JSC::JSValue QScriptEnginePrivate::newQObject( bool preferExisting = (options & QScriptEngine::PreferExistingWrapperObject) != 0; QScriptEngine::QObjectWrapOptions opt = options & ~QScriptEngine::PreferExistingWrapperObject; QScriptObject *result = 0; - if (preferExisting) + if (preferExisting) { result = data->findWrapper(ownership, opt); - if (!result) { - result = new (exec) QScriptObject(qobjectWrapperObjectStructure); - if (preferExisting) - data->registerWrapper(result, ownership, opt); + if (result) + return result; } - Q_ASSERT(result != 0); + result = new (exec) QScriptObject(qobjectWrapperObjectStructure); + if (preferExisting) + data->registerWrapper(result, ownership, opt); result->setDelegate(new QScript::QObjectDelegate(object, ownership, options)); /*if (setDefaultPrototype)*/ { const QMetaObject *meta = object->metaObject(); @@ -1635,7 +1635,6 @@ QScriptValue QScriptEngine::newVariant(const QScriptValue &object, } QScriptObject *jscScriptObject = static_cast(jscObject); if (!object.isVariant()) { - delete jscScriptObject->delegate(); jscScriptObject->setDelegate(new QScript::QVariantDelegate(value)); } else { QScriptValuePrivate::get(object)->setVariantValue(value); @@ -1713,7 +1712,6 @@ QScriptValue QScriptEngine::newQObject(const QScriptValue &scriptObject, } QScriptObject *jscScriptObject = static_cast(jscObject); if (!scriptObject.isQObject()) { - delete jscScriptObject->delegate(); jscScriptObject->setDelegate(new QScript::QObjectDelegate(qtObject, ownership, options)); } else { QScript::QObjectDelegate *delegate = static_cast(jscScriptObject->delegate()); diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp index 2022baf..e59c542 100644 --- a/src/script/bridge/qscriptobject.cpp +++ b/src/script/bridge/qscriptobject.cpp @@ -95,6 +95,8 @@ void QScriptObject::setDelegate(QScriptObjectDelegate *delegate) { if (!d) d = new Data(); + else + delete d->delegate; d->delegate = delegate; } -- cgit v0.12 From 5e43eb85043395655155edb5206de15024e3fb71 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 24 Aug 2009 20:29:35 +0200 Subject: Memory leak in QBrush QScopedPointer would not cleanup the old object if it is the same as the new one. But operator= does increment the reference count even if they were the same Reviewed-by: Harald Fernengel --- src/gui/painting/qbrush.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index a52a270..b7179a4 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -625,7 +625,7 @@ void QBrush::detach(Qt::BrushStyle newStyle) QBrush &QBrush::operator=(const QBrush &b) { - if (this == &b) + if (d == b.d) return *this; b.d->ref.ref(); -- cgit v0.12 From a5a215eefff176eda3b1bb97ee70abfbab20f054 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 25 Aug 2009 09:45:20 +0200 Subject: Memory leak in QScriptEngineAgent. The documentation of the agent constructor specify that the agant is owned by the engine. Even if the agent is not set to the engine Reviewed-by: Kent Hansen --- src/script/api/qscriptengine.cpp | 3 --- src/script/api/qscriptengineagent.cpp | 1 + tests/auto/qscriptengine/tst_qscriptengine.cpp | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 033d92e..f4e9594 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -3585,9 +3585,6 @@ void QScriptEngine::setAgent(QScriptEngineAgent *agent) QScriptEngineAgentPrivate::get(d->activeAgent)->detach(); d->activeAgent = agent; if (agent) { - int index = d->ownedAgents.indexOf(agent); - if (index == -1) - d->ownedAgents.append(agent); QScriptEngineAgentPrivate::get(agent)->attach(); } } diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index b18f29d..193ee21 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -213,6 +213,7 @@ QScriptEngineAgent::QScriptEngineAgent(QScriptEngine *engine) { d_ptr->q_ptr = this; d_ptr->engine = QScriptEnginePrivate::get(engine); + d_ptr->engine->ownedAgents.append(this); } /*! diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 0c67987..df74144 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -3913,6 +3913,7 @@ void tst_QScriptEngine::getSetAgent() TestAgent *agent = new TestAgent(&eng); QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::setAgent(): cannot set agent belonging to different engine"); eng2.setAgent(agent); + QCOMPARE(eng2.agent(), (QScriptEngineAgent*)0); } } -- cgit v0.12 From f729015e1f44065b1b1911b65ba3fddd35d5545b Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 25 Aug 2009 10:34:57 +0200 Subject: QMenu: make no active action when the mouse leaves the menu Task-number: 260111 --- src/gui/widgets/qmenu.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 69ccae5..92d1271 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -2779,6 +2779,8 @@ void QMenu::leaveEvent(QEvent *) d->sloppyAction = 0; if (!d->sloppyRegion.isEmpty()) d->sloppyRegion = QRegion(); + if (!d->activeMenu && d->currentAction) + setActiveAction(0); } /*! -- cgit v0.12 From 3b39bce54231edb1845b42a1e914029dcb494c94 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 25 Aug 2009 09:59:41 +0200 Subject: Fix valgrind warning (use of uninitialized) in JavaScriptCore Reviewed-by: Kent Hansen --- src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp index 4b943c2..596d89a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp @@ -1261,6 +1261,7 @@ CodeBlock::CodeBlock(ScopeNode* ownerNode) #endif , m_needsFullScopeChain(false) , m_usesEval(false) + , m_usesArguments(false) , m_isNumericCompareFunction(false) , m_codeType(NativeCode) , m_source(0) @@ -1283,6 +1284,7 @@ CodeBlock::CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtrneedsActivation()) , m_usesEval(ownerNode->usesEval()) + , m_usesArguments(ownerNode->usesArguments()) , m_isNumericCompareFunction(false) , m_codeType(codeType) , m_source(sourceProvider) -- cgit v0.12 From 0e9b080a8ff44a86f30be5f3a7c5ac0c8722dbb5 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 25 Aug 2009 10:54:07 +0200 Subject: Another memoryleak in QScriptEngine QScriptValuePrivate released by garbage collector later in ~QScriptEnginePrivate (when destroying the agents) would be added to the freelist and not be released Reviewed-by: Kent Hansen --- src/script/api/qscriptengine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index f4e9594..c14e38a 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -836,11 +836,6 @@ QScriptEnginePrivate::QScriptEnginePrivate() QScriptEnginePrivate::~QScriptEnginePrivate() { - while (freeScriptValues) { - QScriptValuePrivate *p = freeScriptValues; - freeScriptValues = p->next; - qFree(p); - } while (!ownedAgents.isEmpty()) delete ownedAgents.takeFirst(); detachAllRegisteredScriptValues(); @@ -849,6 +844,11 @@ QScriptEnginePrivate::~QScriptEnginePrivate() JSC::JSLock lock(false); globalData->heap.destroy(); globalData->deref(); + while (freeScriptValues) { + QScriptValuePrivate *p = freeScriptValues; + freeScriptValues = p->next; + qFree(p); + } } QScriptValue QScriptEnginePrivate::scriptValueFromVariant(const QVariant &v) -- cgit v0.12 From 913d75047dd5aa4a8e1d9b51a58c7be7e75f3d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 25 Aug 2009 10:58:45 +0200 Subject: Remove semi-colon from Q_XXX macros in qgraphicseffect.h Some compilers don't like them and fail to compile. --- src/gui/effects/qgraphicseffect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index a50ee29..fef6531 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -137,7 +137,7 @@ private: friend class QWidget; friend class QWidgetPrivate; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsEffect::ChangeFlags); +Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsEffect::ChangeFlags) class QGraphicsGrayscaleEffectPrivate; class Q_GUI_EXPORT QGraphicsGrayscaleEffect: public QGraphicsEffect -- cgit v0.12 From f29e1bc7b7a593ef65defa3543b0feea455c7cdb Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 24 Aug 2009 15:40:35 +0200 Subject: Cocoa: bugfix for autocads plugin project Seems like the QMacNativeWidget was almost not testet at all. It all breaks down when embedding QLineEdits (with respect to focus). This is a first patch that fixes this issue. --- src/gui/kernel/qcocoaview_mac.mm | 9 +++++++++ src/gui/kernel/qwidget.cpp | 4 ++++ src/gui/kernel/qwidget_mac.mm | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 5a0209d..5ab7ed2 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -976,6 +976,15 @@ extern "C" { return qwidget->focusPolicy() != Qt::NoFocus; } +- (BOOL)resignFirstResponder +{ + // Seems like the following test only triggers if this + // view is inside a QMacNativeWidget: + if (qwidget == QApplication::focusWidget()) + QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason); + return YES; +} + - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal { Q_UNUSED(isLocal); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 5e720df..6ffac2c 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -6231,6 +6231,10 @@ bool QWidget::isActiveWindow() const if(qt_mac_is_macdrawer(tlw) && tlw->parentWidget() && tlw->parentWidget()->isActiveWindow()) return true; + + extern bool qt_mac_insideKeyWindow(const QWidget *); //qwidget_mac.cpp + if (QApplication::testAttribute(Qt::AA_MacPluginApplication) && qt_mac_insideKeyWindow(tlw)) + return true; #endif if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) { if(tlw->windowType() == Qt::Tool && diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index ea5a53e..53d1b6e 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -301,6 +301,14 @@ bool qt_mac_is_macdrawer(const QWidget *w) return (w && w->parentWidget() && w->windowType() == Qt::Drawer); } +bool qt_mac_insideKeyWindow(const QWidget *w) +{ +#ifdef QT_MAC_USE_COCOA + return [[reinterpret_cast(w->winId()) window] isKeyWindow]; +#endif + return false; +} + bool qt_mac_set_drawer_preferred_edge(QWidget *w, Qt::DockWidgetArea where) //users of Qt for Mac OS X can use this.. { if(!qt_mac_is_macdrawer(w)) -- cgit v0.12 From ba60e4bedde9c8ef002289ebe60d25ad95f20707 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 25 Aug 2009 11:24:31 +0200 Subject: Mac: When using Qt as a plugin app, menubars does not work It seems like we don't respect the Qt::AA_MacPluginApplication attribute. Setting this attribute means that the native application should control the menu bar. This patch does a check for this, and leaves the menubar alone if its set. We could consider allowing menubars if the Qt::AA_DontUseNativeMenuBar is set (those should placed inside the window) Reviewed-by: msorvig --- src/gui/widgets/qmenu_mac.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index d59e1c9..d9c1283 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -728,6 +728,9 @@ bool qt_mac_menubar_is_open() void qt_mac_clear_menubar() { + if (QApplication::testAttribute(Qt::AA_MacPluginApplication)) + return; + #ifndef QT_MAC_USE_COCOA MenuRef clear_menu = 0; if (CreateNewMenu(0, 0, &clear_menu) == noErr) { @@ -1918,6 +1921,9 @@ static void cancelAllMenuTracking() */ bool QMenuBar::macUpdateMenuBar() { + if (QApplication::testAttribute(Qt::AA_MacPluginApplication)) + return false; + cancelAllMenuTracking(); QMenuBar *mb = 0; //find a menu bar -- cgit v0.12 From 59d974cfd899832dc88c0183582147162bf721be Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 25 Aug 2009 11:59:38 +0200 Subject: Some cleanups after code review. Some minor harmless fixes after feedback from code review. Reviewed-by: Espen Riskedal --- src/gui/widgets/qabstractslider.cpp | 2 -- src/gui/widgets/qlineedit.cpp | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 58edfde..52538e0 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -687,9 +687,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) Q_D(QAbstractSlider); e->ignore(); if (e->orientation() != d->orientation && !rect().contains(e->pos())) - { return; - } static qreal offset = 0; static QAbstractSlider *offset_owner = 0; if (offset_owner != this){ diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 6b73e21..299ecfc 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1395,8 +1395,7 @@ bool QLineEdit::event(QEvent * e) if (e->type() == QEvent::EnterEditFocus) { end(false); d->setCursorVisible(true); - int cft = QApplication::cursorFlashTime(); - d->control->setCursorBlinkPeriod(cft/2); + d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()/2); } else if (e->type() == QEvent::LeaveEditFocus) { d->setCursorVisible(false); d->control->setCursorBlinkPeriod(0); @@ -1691,8 +1690,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e) #ifdef QT_KEYPAD_NAVIGATION if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)){ #endif - int cft = QApplication::cursorFlashTime(); - d->control->setCursorBlinkPeriod(cft/2); + d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()/2); QStyleOptionFrameV2 opt; initStyleOption(&opt); if((!hasSelectedText() && d->control->preeditAreaText().isEmpty()) -- cgit v0.12 From 2aeeda9b82440dbcb3564c185003288b83f49683 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 25 Aug 2009 12:13:11 +0200 Subject: Added missing variable initialization in QSvgStrokeStyle ctor. The bug this commit fixes was introduced by commit 28ac217b04abaa4d226e43e402c14a88539fca3b. Reviewed-by: Trond --- src/svg/qsvghandler.cpp | 6 +++--- src/svg/qsvgstyle.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index b2a2cb8..5b778d2 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -3299,7 +3299,7 @@ bool QSvgHandler::startElement(const QString &localName, m_style = prop; m_nodes.top()->appendStyleProperty(prop, someId(attributes), true); } else { - qWarning("Couldn't parse node: %s", qPrintable(localName)); + qWarning("Could not parse node: %s", qPrintable(localName)); } } else if (StyleParseMethod method = findStyleUtilFactoryMethod(localName)) { if (m_style) { @@ -3366,7 +3366,7 @@ bool QSvgHandler::endElement(const QStringRef &localName) if (style->type() == QSvgStyleProperty::SOLID_COLOR || style->type() == QSvgStyleProperty::GRADIENT) fill->setFillStyle(reinterpret_cast(style)); } else { - qWarning("Couldn't resolve property : %s",qPrintable(id)); + qWarning("Could not resolve property : %s",qPrintable(id)); fill->setBrush(QBrush(Qt::NoBrush)); } } @@ -3378,7 +3378,7 @@ bool QSvgHandler::endElement(const QStringRef &localName) if (style->type() == QSvgStyleProperty::SOLID_COLOR || style->type() == QSvgStyleProperty::GRADIENT) stroke->setStyle(reinterpret_cast(style)); } else { - qWarning("Couldn't resolve property : %s",qPrintable(id)); + qWarning("Could not resolve property : %s",qPrintable(id)); stroke->setStroke(QBrush(Qt::NoBrush)); } } diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index 6922ad9..13a0d30 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -274,10 +274,12 @@ void QSvgFontStyle::revert(QPainter *p, QSvgExtraStates &states) QSvgStrokeStyle::QSvgStrokeStyle() : m_strokeOpacity(1.0) , m_oldStrokeOpacity(0.0) - , m_vectorEffect(0) - , m_oldVectorEffect(0) , m_strokeDashOffset(0) , m_oldStrokeDashOffset(0) + , m_style(0) + , m_gradientResolved(1) + , m_vectorEffect(0) + , m_oldVectorEffect(0) , m_strokeSet(0) , m_strokeDashArraySet(0) , m_strokeDashOffsetSet(0) -- cgit v0.12 From 8a7700ffb5e4959e788861e4862ebc1a7a3ad3b1 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 25 Aug 2009 12:42:43 +0200 Subject: ItemViews: selection not well kept when new rows appear Task-number: 260134 Reviewed-by: ogoffart --- src/gui/itemviews/qitemselectionmodel.cpp | 11 ++++---- .../tst_qitemselectionmodel.cpp | 33 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index 8414460..8eb9e21 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -734,14 +734,15 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged() if (ranges.isEmpty() && currentSelection.count() == 1) { QItemSelectionRange range = currentSelection.first(); QModelIndex parent = range.parent(); - if (range.top() == 0 + tableRowCount = model->rowCount(parent); + tableColCount = model->columnCount(parent); + if (tableRowCount * tableColCount > 100 + && range.top() == 0 && range.left() == 0 - && range.bottom() == model->rowCount(parent) - 1 - && range.right() == model->columnCount(parent) - 1) { + && range.bottom() == tableRowCount - 1 + && range.right() == tableColCount - 1) { tableSelected = true; tableParent = parent; - tableColCount = model->columnCount(parent); - tableRowCount = model->rowCount(parent); return; } } diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp index 5806ca9..595c757 100644 --- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -91,6 +91,7 @@ private slots: void task119433_isRowSelected(); void task252069_rowIntersectsSelection(); void task232634_childrenDeselectionSignal(); + void task260134_layoutChangedWithAllSelected(); private: QAbstractItemModel *model; @@ -2241,5 +2242,37 @@ void tst_QItemSelectionModel::task232634_childrenDeselectionSignal() QVERIFY(selectionModel.selection().contains(sel2)); } +void tst_QItemSelectionModel::task260134_layoutChangedWithAllSelected() +{ + QStringListModel model( QStringList() << "foo" << "bar" << "foo2"); + QSortFilterProxyModel proxy; + proxy.setSourceModel(&model); + QItemSelectionModel selection(&proxy); + + + QCOMPARE(model.rowCount(), 3); + QCOMPARE(proxy.rowCount(), 3); + proxy.setFilterRegExp( QRegExp("f")); + QCOMPARE(proxy.rowCount(), 2); + + QList indexList; + indexList << proxy.index(0,0) << proxy.index(1,0); + selection.select( QItemSelection(indexList.first(), indexList.last()), QItemSelectionModel::Select); + + //let's check the selection hasn't changed + QCOMPARE(selection.selectedIndexes().count(), indexList.count()); + foreach(QPersistentModelIndex index, indexList) + QVERIFY(selection.isSelected(index)); + + proxy.setFilterRegExp(QRegExp()); + QCOMPARE(proxy.rowCount(), 3); + + //let's check the selection hasn't changed + QCOMPARE(selection.selectedIndexes().count(), indexList.count()); + foreach(QPersistentModelIndex index, indexList) + QVERIFY(selection.isSelected(index)); +} + + QTEST_MAIN(tst_QItemSelectionModel) #include "tst_qitemselectionmodel.moc" -- cgit v0.12 From f8acf3b9a9398eabef98be7007fd6766574a788a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 25 Aug 2009 13:35:45 +0200 Subject: Fix taskbar in plasma Author: Kim --- src/svg/qsvgnode.cpp | 2 ++ src/svg/qsvgstyle_p.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/svg/qsvgnode.cpp b/src/svg/qsvgnode.cpp index 5f323b1..de5a568 100644 --- a/src/svg/qsvgnode.cpp +++ b/src/svg/qsvgnode.cpp @@ -322,6 +322,8 @@ qreal QSvgNode::strokeWidth() const styleProperty(QSvgStyleProperty::STROKE)); if (!stroke) return 0; + if (stroke->stroke().brush().style() == Qt::NoBrush) + return 0; return stroke->width(); } diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h index 1cff561..f358bc1 100644 --- a/src/svg/qsvgstyle_p.h +++ b/src/svg/qsvgstyle_p.h @@ -508,6 +508,11 @@ public: return m_gradientResolved; } + QPen stroke() const + { + return m_stroke; + } + private: // stroke v v 'inherit' | // stroke-dasharray v v 'inherit' | -- cgit v0.12 From f384dd306c022aa70015133be3a7b4d4c8bb1121 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 25 Aug 2009 13:33:15 +0200 Subject: Make sure we use layoutDirection from the widget and not always the app Task-number: 259331 --- src/gui/styles/qcleanlooksstyle.cpp | 4 ++-- src/gui/styles/qcommonstyle.cpp | 18 ++++++++++-------- src/gui/styles/qplastiquestyle.cpp | 2 +- src/gui/styles/qstylesheetstyle.cpp | 8 ++++---- src/gui/styles/qwindowsstyle.cpp | 6 +++--- src/gui/styles/qwindowsxpstyle.cpp | 2 +- src/gui/widgets/qcommandlinkbutton.cpp | 4 +++- src/gui/widgets/qdatetimeedit.cpp | 1 - src/gui/widgets/qdatetimeedit_p.h | 1 - src/gui/widgets/qmainwindowlayout.cpp | 2 +- src/gui/widgets/qmenu.cpp | 6 +++--- src/gui/widgets/qmenubar.cpp | 8 ++++---- src/gui/widgets/qtoolbar.cpp | 8 ++++---- src/gui/widgets/qtoolbarextension.cpp | 6 ++++-- 14 files changed, 40 insertions(+), 36 deletions(-) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 0a82c9c..426ebfd 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -1499,7 +1499,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o default: break; } - if (QApplication::layoutDirection() == Qt::RightToLeft) { //reverse layout changes the order of Beginning/end + if (toolbar->direction == Qt::RightToLeft) { //reverse layout changes the order of Beginning/end bool tmp = paintLeftBorder; paintRightBorder=paintLeftBorder; paintLeftBorder=tmp; @@ -4323,7 +4323,7 @@ QRect QCleanlooksStyle::subElementRect(SubElement sr, const QStyleOption *opt, c if (verticalTitleBar) { r.adjust(0, 0, 0, -4); } else { - if (QApplication::layoutDirection() == Qt::LeftToRight) + if (opt->direction == Qt::LeftToRight) r.adjust(4, 0, 0, 0); else r.adjust(0, 0, -4, 0); diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index d4488ec..2dab9b3 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -564,7 +564,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q p->translate(opt->rect.x(), opt->rect.y()); if (opt->state & State_Horizontal) { int x = opt->rect.width() / 3; - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (opt->direction == Qt::RightToLeft) x -= 2; if (opt->rect.height() > 4) { qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4, @@ -5224,6 +5224,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti Q_UNUSED(sp); #else QPixmap pixmap; + const bool rtl = (option && option->direction == Qt::RightToLeft) || !option && QApplication::isRightToLeft(); if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (sp) { @@ -5382,7 +5383,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti switch (sp) { #ifndef QT_NO_IMAGEFORMAT_XPM case SP_ToolBarHorizontalExtensionButton: - if (QApplication::layoutDirection() == Qt::RightToLeft) { + if (rtl) { QImage im(tb_extension_arrow_h_xpm); im = im.convertToFormat(QImage::Format_ARGB32).mirrored(true, false); return QPixmap::fromImage(im); @@ -5398,11 +5399,11 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti #ifndef QT_NO_IMAGEFORMAT_PNG case SP_CommandLink: case SP_ArrowForward: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return proxy()->standardPixmap(SP_ArrowLeft, option, widget); return proxy()->standardPixmap(SP_ArrowRight, option, widget); case SP_ArrowBack: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return proxy()->standardPixmap(SP_ArrowRight, option, widget); return proxy()->standardPixmap(SP_ArrowLeft, option, widget); case SP_ArrowLeft: @@ -5513,6 +5514,7 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons const QWidget *widget) const { QIcon icon; + const bool rtl = (option && option->direction == Qt::RightToLeft) || !option && QApplication::isRightToLeft(); if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (standardIcon) { case SP_DirHomeIcon: @@ -5637,11 +5639,11 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons icon = QIcon::fromTheme(QLatin1String("edit-clear")); break; case SP_ArrowForward: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return standardIconImplementation(SP_ArrowLeft, option, widget); return standardIconImplementation(SP_ArrowRight, option, widget); case SP_ArrowBack: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return standardIconImplementation(SP_ArrowRight, option, widget); return standardIconImplementation(SP_ArrowLeft, option, widget); case SP_FileLinkIcon: @@ -5865,11 +5867,11 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-no-128.png")); break; case SP_ArrowForward: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return standardIconImplementation(SP_ArrowLeft, option, widget); return standardIconImplementation(SP_ArrowRight, option, widget); case SP_ArrowBack: - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (rtl) return standardIconImplementation(SP_ArrowRight, option, widget); return standardIconImplementation(SP_ArrowLeft, option, widget); case SP_ArrowLeft: diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 04559dc..0c3c2a3 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -3749,7 +3749,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode); QRect iconRect(editRect); iconRect.setWidth(comboBox->iconSize.width() + 5); - iconRect = alignedRect(QApplication::layoutDirection(), + iconRect = alignedRect(comboBox->direction, Qt::AlignLeft | Qt::AlignVCenter, iconRect.size(), editRect); painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 8ac811c..7acb3a6 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3196,7 +3196,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC if (subRule.hasDrawable()) { QRect rect = subRule.boxRect(subControlRect(CC_MdiControls, opt, control, w), Margin); subRule.drawRule(p, rect); - QIcon icon = standardIcon(subControlIcon(layoutButton)); + QIcon icon = standardIcon(subControlIcon(layoutButton), opt); icon.paint(p, subRule.contentsRect(rect), Qt::AlignCenter); } else { optCopy.subControls |= control; @@ -3643,9 +3643,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); QRect iconRect(editRect); iconRect.setWidth(cb->iconSize.width()); - iconRect = alignedRect(QApplication::layoutDirection(), - Qt::AlignLeft | Qt::AlignVCenter, - iconRect.size(), editRect); + iconRect = alignedRect(cb->direction, + Qt::AlignLeft | Qt::AlignVCenter, + iconRect.size(), editRect); drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap); if (cb->direction == Qt::RightToLeft) diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index e558844..8097a3d 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -1261,7 +1261,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, p->translate(opt->rect.x(), opt->rect.y()); if (opt->state & State_Horizontal) { int x = opt->rect.width() / 2 - 4; - if (QApplication::layoutDirection() == Qt::RightToLeft) + if (opt->direction == Qt::RightToLeft) x -= 2; if (opt->rect.height() > 4) { qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4, @@ -2312,7 +2312,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai default: break; } - if(QApplication::layoutDirection() == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end + if(opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end bool tmp = paintLeftBorder; paintRightBorder=paintLeftBorder; paintLeftBorder=tmp; @@ -2564,7 +2564,7 @@ QRect QWindowsStyle::subElementRect(SubElement sr, const QStyleOption *opt, cons if (verticalTitleBar) { r.adjust(0, 0, 0, -m); } else { - if (QApplication::layoutDirection() == Qt::LeftToRight) + if (opt->direction == Qt::LeftToRight) r.adjust(m, 0, 0, 0); else r.adjust(0, 0, -m, 0); diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 0e08730..e365873 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -2331,7 +2331,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op bool hasIcon = (ico.cacheKey() != QApplication::windowIcon().cacheKey()); if (hasIcon) { QPixmap pxIco = ico.pixmap(titleHeight); - if (!verticalTitleBar && QApplication::layoutDirection() == Qt::RightToLeft) + if (!verticalTitleBar && dwOpt->direction == Qt::RightToLeft) p->drawPixmap(rect.width() - titleHeight - pxIco.width(), rect.bottom() - titleHeight - 2, pxIco); else p->drawPixmap(fw, rect.bottom() - titleHeight - 2, pxIco); diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp index 206221f..fd69f55 100644 --- a/src/gui/widgets/qcommandlinkbutton.cpp +++ b/src/gui/widgets/qcommandlinkbutton.cpp @@ -205,7 +205,9 @@ void QCommandLinkButtonPrivate::init() q->setSizePolicy(policy); q->setIconSize(QSize(20, 20)); - q->setIcon(q->style()->standardIcon(QStyle::SP_CommandLink)); + QStyleOptionButton opt; + q->initStyleOption(&opt); + q->setIcon(q->style()->standardIcon(QStyle::SP_CommandLink, &opt)); } // Calculates the height of the description text based on widget width diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 5a9c7e1..d1ebdf4 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -1643,7 +1643,6 @@ QDateTimeEditPrivate::QDateTimeEditPrivate() cachedDay = -1; currentSectionIndex = FirstSectionIndex; - layoutDirection = QApplication::layoutDirection(); first.type = FirstSection; last.type = LastSection; none.type = NoSection; diff --git a/src/gui/widgets/qdatetimeedit_p.h b/src/gui/widgets/qdatetimeedit_p.h index 7b29e51..33c09c0 100644 --- a/src/gui/widgets/qdatetimeedit_p.h +++ b/src/gui/widgets/qdatetimeedit_p.h @@ -132,7 +132,6 @@ public: mutable bool cacheGuard; QString defaultDateFormat, defaultTimeFormat, defaultDateTimeFormat, unreversedFormat; - Qt::LayoutDirection layoutDirection; mutable QVariant conflictGuard; bool hasHadFocus, formatExplicitlySet, calendarPopup; QStyle::StateFlag arrowState; diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 529a225..0ea9b56 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1463,7 +1463,7 @@ void QMainWindowLayout::setGeometry(const QRect &_r) QSize(r.width(), statusbar->heightForWidth(r.width())) .expandedTo(statusbar->minimumSize())); sbr.moveBottom(r.bottom()); - QRect vr = QStyle::visualRect(QApplication::layoutDirection(), _r, sbr); + QRect vr = QStyle::visualRect(parentWidget()->layoutDirection(), _r, sbr); statusbar->setGeometry(vr); r.setBottom(sbr.top() - 1); } diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 92d1271..f0f425f 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1832,7 +1832,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) if (adjustToDesktop) { //handle popup falling "off screen" - if (QApplication::layoutDirection() == Qt::RightToLeft) { + if (isRightToLeft()) { if(snapToMouse) //position flowing left from the mouse pos.setX(mouse.x()-size.width()); @@ -1870,9 +1870,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } setGeometry(QRect(pos, size)); #ifndef QT_NO_EFFECTS - int hGuess = QApplication::layoutDirection() == Qt::RightToLeft ? QEffects::LeftScroll : QEffects::RightScroll; + int hGuess = isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll; int vGuess = QEffects::DownScroll; - if (QApplication::layoutDirection() == Qt::RightToLeft) { + if (isRightToLeft()) { if ((snapToMouse && (pos.x() + size.width()/2 > mouse.x())) || (qobject_cast(d->causedPopup.widget) && pos.x() + size.width()/2 > d->causedPopup.widget->x())) hGuess = QEffects::RightScroll; diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 0967f71..6633f2a 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -132,7 +132,7 @@ QRect QMenuBarPrivate::menuRect(bool extVisible) const result.adjust(hmargin, 0, -hmargin, 0); if (extVisible) { - if (q->layoutDirection() == Qt::RightToLeft) + if (q->isRightToLeft()) result.setLeft(result.left() + extension->sizeHint().width()); else result.setWidth(result.width() - extension->sizeHint().width()); @@ -140,7 +140,7 @@ QRect QMenuBarPrivate::menuRect(bool extVisible) const if (leftWidget && leftWidget->isVisible()) { QSize sz = leftWidget->sizeHint(); - if (q->layoutDirection() == Qt::RightToLeft) + if (q->isRightToLeft()) result.setRight(result.right() - sz.width()); else result.setLeft(result.left() + sz.width()); @@ -148,7 +148,7 @@ QRect QMenuBarPrivate::menuRect(bool extVisible) const if (rightWidget && rightWidget->isVisible()) { QSize sz = rightWidget->sizeHint(); - if (q->layoutDirection() == Qt::RightToLeft) + if (q->isRightToLeft()) result.setLeft(result.left() + sz.width()); else result.setRight(result.right() - sz.width()); @@ -245,7 +245,7 @@ void QMenuBarPrivate::updateGeometries() pop->addActions(hiddenActions); int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q); - int x = q->layoutDirection() == Qt::RightToLeft + int x = q->isRightToLeft() ? menuRect.left() - extension->sizeHint().width() + 1 : menuRect.right(); extension->setGeometry(x, vmargin, extension->sizeHint().width(), menuRect.height() - vmargin*2); diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index ef0847b..bf44ea1 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -205,7 +205,7 @@ void QToolBarPrivate::initDrag(const QPoint &pos) state->moving = false; state->widgetItem = 0; - if (q->layoutDirection() == Qt::RightToLeft) + if (q->isRightToLeft()) state->pressPos = QPoint(q->width() - state->pressPos.x(), state->pressPos.y()); } @@ -359,7 +359,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) QPoint pos = event->globalPos(); // if we are right-to-left, we move so as to keep the right edge the same distance // from the mouse - if (q->layoutDirection() == Qt::LeftToRight) + if (q->isLeftToRight()) pos -= state->pressPos; else pos += QPoint(state->pressPos.x() - q->width(), -state->pressPos.y()); @@ -369,14 +369,14 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) } else if (state->moving) { const QPoint rtl(q->width() - state->pressPos.x(), state->pressPos.y()); //for RTL - const QPoint globalPressPos = q->mapToGlobal(q->layoutDirection() == Qt::RightToLeft ? rtl : state->pressPos); + const QPoint globalPressPos = q->mapToGlobal(q->isRightToLeft() ? rtl : state->pressPos); int pos = 0; QPoint delta = event->globalPos() - globalPressPos; if (orientation == Qt::Vertical) { pos = q->y() + delta.y(); } else { - if (q->layoutDirection() == Qt::RightToLeft) { + if (q->isRightToLeft()) { pos = win->width() - q->width() - q->x() - delta.x(); } else { pos = q->x() + delta.x(); diff --git a/src/gui/widgets/qtoolbarextension.cpp b/src/gui/widgets/qtoolbarextension.cpp index 1f1186c..6a70326 100644 --- a/src/gui/widgets/qtoolbarextension.cpp +++ b/src/gui/widgets/qtoolbarextension.cpp @@ -61,10 +61,12 @@ QToolBarExtension::QToolBarExtension(QWidget *parent) void QToolBarExtension::setOrientation(Qt::Orientation o) { + QStyleOption opt; + opt.init(this); if (o == Qt::Horizontal) { - setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton)); + setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, &opt)); } else { - setIcon(style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton)); + setIcon(style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton, &opt)); } } -- cgit v0.12 From 1666247307a70bbf180a9e63bb546029994bd194 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 25 Aug 2009 13:29:10 +0200 Subject: Mac: respect Qt::AA_MacPluginApplication and disable native menubar Adding a second patch to this problem. This patch hooks into an earlier stage in the 'use native' detection --- src/gui/widgets/qmenu_mac.mm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index d9c1283..47a8042 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -1757,14 +1757,16 @@ void QMenuBarPrivate::macCreateMenuBar(QWidget *parent) { Q_Q(QMenuBar); - static int checkEnv = -1; + static int dontUseNativeMenuBar = -1; // We call the isNativeMenuBar function here - // becasue that will make sure that local overrides + // because that will make sure that local overrides // are dealt with correctly. bool qt_mac_no_native_menubar = !q->isNativeMenuBar(); - if (qt_mac_no_native_menubar == false && checkEnv < 0) { - checkEnv = !qgetenv("QT_MAC_NO_NATIVE_MENUBAR").isEmpty(); - QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, checkEnv); + if (qt_mac_no_native_menubar == false && dontUseNativeMenuBar < 0) { + bool isPlugin = QApplication::testAttribute(Qt::AA_MacPluginApplication); + bool environmentSaysNo = !qgetenv("QT_MAC_NO_NATIVE_MENUBAR").isEmpty(); + dontUseNativeMenuBar = isPlugin || environmentSaysNo; + QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, dontUseNativeMenuBar); qt_mac_no_native_menubar = !q->isNativeMenuBar(); } if (!qt_mac_no_native_menubar) { @@ -1921,9 +1923,6 @@ static void cancelAllMenuTracking() */ bool QMenuBar::macUpdateMenuBar() { - if (QApplication::testAttribute(Qt::AA_MacPluginApplication)) - return false; - cancelAllMenuTracking(); QMenuBar *mb = 0; //find a menu bar -- cgit v0.12 From a8087d61442acb8cfbc90b79bdd10ad192c6c06a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 25 Aug 2009 13:48:13 +0200 Subject: Fix the default painter state in QSvgTinyDocument::draw Fix the eyes border in plasma Author: Kim --- src/svg/qsvgtinydocument.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp index ba610e7..d7cbcb2 100644 --- a/src/svg/qsvgtinydocument.cpp +++ b/src/svg/qsvgtinydocument.cpp @@ -283,7 +283,9 @@ void QSvgTinyDocument::draw(QPainter *p, const QString &id, QTransform originalTransform = p->worldTransform(); //XXX set default style on the painter - p->setPen(Qt::NoPen); + QPen pen(QBrush(Qt::NoBrush), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); + pen.setMiterLimit(4); + p->setPen(pen); p->setBrush(Qt::black); p->setRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::SmoothPixmapTransform); -- cgit v0.12 From b9ea05481c1628a701910f3749db12e785d5229c Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 25 Aug 2009 13:13:46 +0200 Subject: Removed redundant QLocale code from QCoeFepInputContext. We export one extra private symbol from QtCore instead, and use that. RevBy: Miikka Heikkinen --- src/corelib/kernel/qcore_symbian_p.h | 3 + src/corelib/tools/qlocale_symbian.cpp | 6 +- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 95 ++----------------------- 3 files changed, 11 insertions(+), 93 deletions(-) diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h index 6d3616f..a7f71a7 100644 --- a/src/corelib/kernel/qcore_symbian_p.h +++ b/src/corelib/kernel/qcore_symbian_p.h @@ -145,6 +145,9 @@ Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal); Q_CORE_EXPORT RFs& qt_s60GetRFs(); +// Defined in qlocale_symbian.cpp. +Q_CORE_EXPORT QByteArray qt_symbianLocaleName(int code); + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index a534560..3103ba1 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -156,7 +156,7 @@ static const symbianToISO symbian_to_iso_list[] = { /*! Returns ISO name corresponding to the Symbian locale code \a sys_fmt. */ -static QByteArray symbianLocaleName(int code) +QByteArray qt_symbianLocaleName(int code) { //Number of Symbian to ISO locale mappings static const int symbian_to_iso_count @@ -797,7 +797,7 @@ QLocale QSystemLocale::fallbackLocale() const } TLanguage lang = User::Language(); - QString locale = symbianLocaleName(lang); + QString locale = qt_symbianLocaleName(lang); return QLocale(locale); } @@ -853,7 +853,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case LanguageId: case CountryId: { TLanguage language = User::Language(); - QString locale = symbianLocaleName(language); + QString locale = qt_symbianLocaleName(language); QLocale::Language lang; QLocale::Country cntry; getLangAndCountry(locale, lang, cntry); diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 7c7bce3..09eda67 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -44,6 +44,7 @@ #include "qcoefepinputcontext_p.h" #include #include +#include #include @@ -139,100 +140,14 @@ void QCoeFepInputContext::widgetDestroyed(QWidget *w) } } -/*! - Definition of struct for mapping Symbian to ISO locale - ### REMOVE - See below. -*/ -struct symbianToISO { - int symbian_language; - char iso_name[8]; -}; - -/*! - Mapping from Symbian to ISO locale - ### REMOVE - This was taken from the preliminary QLocale port to S60, and should be - removed once that is finished. -*/ -static const symbianToISO symbian_to_iso_list[] = { - { ELangEnglish, "en_GB" }, - { ELangFrench, "fr_FR" }, - { ELangGerman, "de_DE" }, - { ELangSpanish, "es_ES" }, - { ELangItalian, "it_IT" }, - { ELangSwedish, "sv_SE" }, - { ELangDanish, "da_DK" }, - { ELangNorwegian, "no_NO" }, - { ELangFinnish, "fi_FI" }, - { ELangAmerican, "en_US" }, - { ELangPortuguese, "pt_PT" }, - { ELangTurkish, "tr_TR" }, - { ELangIcelandic, "is_IS" }, - { ELangRussian, "ru_RU" }, - { ELangHungarian, "hu_HU" }, - { ELangDutch, "nl_NL" }, - { ELangBelgianFlemish, "nl_BE" }, - { ELangCzech, "cs_CZ" }, - { ELangSlovak, "sk_SK" }, - { ELangPolish, "pl_PL" }, - { ELangSlovenian, "sl_SI" }, - { ELangTaiwanChinese, "zh_TW" }, - { ELangHongKongChinese, "zh_HK" }, - { ELangPrcChinese, "zh_CN" }, - { ELangJapanese, "ja_JP" }, - { ELangThai, "th_TH" }, - { ELangArabic, "ar_AE" }, - { ELangTagalog, "tl_PH" }, - { ELangBulgarian, "bg_BG" }, - { ELangCatalan, "ca_ES" }, - { ELangCroatian, "hr_HR" }, - { ELangEstonian, "et_EE" }, - { ELangFarsi, "fa_IR" }, - { ELangCanadianFrench, "fr_CA" }, - { ELangGreek, "el_GR" }, - { ELangHebrew, "he_IL" }, - { ELangHindi, "hi_IN" }, - { ELangIndonesian, "id_ID" }, - { ELangLatvian, "lv_LV" }, - { ELangLithuanian, "lt_LT" }, - { ELangMalay, "ms_MY" }, - { ELangBrazilianPortuguese, "pt_BR" }, - { ELangRomanian, "ro_RO" }, - { ELangSerbian, "sr_YU" }, - { ELangLatinAmericanSpanish, "es" }, - { ELangUkrainian, "uk_UA" }, - { ELangUrdu, "ur_PK" }, // India/Pakistan - { ELangVietnamese, "vi_VN" }, -#ifdef __E32LANG_H__ -// 5.0 - { ELangBasque, "eu_ES" }, - { ELangGalician, "gl_ES" }, -#endif - //{ ELangEnglish_Apac, "en" }, - //{ ELangEnglish_Taiwan, "en_TW" }, - //{ ELangEnglish_HongKong, "en_HK" }, - //{ ELangEnglish_Prc, "en_CN" }, - //{ ELangEnglish_Japan, "en_JP"}, - //{ ELangEnglish_Thailand, "en_TH" }, - //{ ELangMalay_Apac, "ms" } -}; - -/*! - Number of Symbian to ISO locale mappings - ### Remove. - See comment for array above. -*/ -static const int symbian_to_iso_count - = sizeof(symbian_to_iso_list)/sizeof(symbianToISO); - QString QCoeFepInputContext::language() { TLanguage lang = m_fepState->LocalLanguage(); - if (lang < symbian_to_iso_count) { - return QLatin1String(symbian_to_iso_list[lang].iso_name); + const QByteArray localeName = qt_symbianLocaleName(lang); + if (!localeName.isEmpty()) { + return QString::fromLatin1(localeName); } else { - return QLatin1String("C"); + return QString::fromLatin1("C"); } } -- cgit v0.12 From 7b6aa6a27096543cbc6bd23253b949de49c37023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 25 Aug 2009 14:15:50 +0200 Subject: doc: qdoc warning about signal not found. QPoint -> QPointF --- src/gui/effects/qgraphicseffect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index ab02999..fbd53b0 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -762,7 +762,7 @@ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset) } /*! - \fn void QGraphicsDropShadowEffect::offsetChanged(const QPoint &offset) + \fn void QGraphicsDropShadowEffect::offsetChanged(const QPointF &offset) This signal is emitted whenever the effect's shadow offset changes. */ -- cgit v0.12 From 2dc48f29aa9c24306ef28f3434573b8b4b5cbafb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 25 Aug 2009 14:25:41 +0200 Subject: Removed library added by mistake in 91e1f75992a5fa720ad748d8487a44b5a242ca2d --- .../webkit/JavaScriptCore/libJavaScriptCore.la | 28 ---------------------- 1 file changed, 28 deletions(-) delete mode 100644 src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la diff --git a/src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la b/src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la deleted file mode 100644 index 0cd4a3c..0000000 --- a/src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la +++ /dev/null @@ -1,28 +0,0 @@ -# libJavaScriptCore.la - a libtool library file -# Generated by qmake/libtool (2.01a) (Qt 4.6.0) on: Tue May 5 15:53:20 2009 -# The name that we can dlopen(3). -dlname='' - -# Names of this library. -library_names=' ' - -# The name of the static archive. -old_library='libJavaScriptCore.a' - -# Libraries that this one depends upon. -dependency_libs='-L/home/kdpalara/dev/qt/lib -lQtGui -L/home/kdpalara/dev/qt/lib -L/usr/X11R6/lib -pthread -lpng -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -lpthread -ldl ' - -# Version information for libJavaScriptCore.la -current=46 -age=0 -revision=0 - -# Is this an already installed library. -installed=yes - -# Files to dlopen/dlpreopen. -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/kdpalara/dev/qt/lib' -- cgit v0.12 From 4580f41b44faee6f66f781d252107bb07d537273 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 25 Aug 2009 14:19:28 +0200 Subject: Fix memory leak in QLineEdit We must not forget to delete the control Reviewed-by: Paul --- src/gui/widgets/qlineedit_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h index 3ab10fc..3521dcb 100644 --- a/src/gui/widgets/qlineedit_p.h +++ b/src/gui/widgets/qlineedit_p.h @@ -84,6 +84,7 @@ public: ~QLineEditPrivate() { + delete control; } QLineControl *control; -- cgit v0.12 From 93ba0035f4eadfaf7217d95f18a442d418a064b8 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 25 Aug 2009 14:28:55 +0200 Subject: QListView:: visualRect would return incorrect values Especially when the widget was not yet shown. Sometimes the rectangle for an item would get truncated to the size of the viewport. That should not happen: we only want to expand it to take the whole height or width of the viewport. Task-number: 243335 Reviewed-by: ogoffart --- src/gui/itemviews/qlistview.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 3e9db3b..de2f493 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1715,8 +1715,7 @@ QRect QListViewPrivate::mapToViewport(const QRect &rect, bool extend) const QRect result = extend ? commonListView->mapToViewport(rect) : rect; int dx = -q->horizontalOffset(); int dy = -q->verticalOffset(); - result.adjust(dx, dy, dx, dy); - return result; + return result.adjusted(dx, dy, dx, dy); } QModelIndex QListViewPrivate::closestIndex(const QRect &target, @@ -2287,15 +2286,14 @@ QRect QListModeViewBase::mapToViewport(const QRect &rect) const if (isWrapping()) return rect; // If the listview is in "listbox-mode", the items are as wide as the view. + // But we don't shrink the items. QRect result = rect; - QSize vsize = viewport()->size(); - QSize csize = contentsSize; if (flow() == QListView::TopToBottom) { result.setLeft(spacing()); - result.setWidth(qMax(csize.width(), vsize.width()) - 2 * spacing()); + result.setWidth(qMax(rect.width(), qMax(contentsSize.width(), viewport()->width()) - 2 * spacing())); } else { // LeftToRight result.setTop(spacing()); - result.setHeight(qMax(csize.height(), vsize.height()) - 2 * spacing()); + result.setHeight(qMax(rect.height(), qMax(contentsSize.height(), viewport()->height()) - 2 * spacing())); } return result; } -- cgit v0.12 From 1cc4ed833f75bc363507bcb7db235bff16785d88 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 25 Aug 2009 14:42:30 +0200 Subject: Fix use of uninitialized memory in QLineEdit Reviewed-by: Thierry --- src/gui/widgets/qlinecontrol_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 721d990..adea742 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -78,10 +78,10 @@ class Q_GUI_EXPORT QLineControl : public QObject public: QLineControl(const QString &txt = QString()) - : m_cursor(0), m_preeditCursor(0), m_layoutDirection(Qt::LeftToRight), + : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LeftToRight), m_hideCursor(false), m_separator(0), m_readOnly(0), m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0), - m_validInput(1), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0), + m_validInput(1), m_blinkStatus(0), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0), m_ascent(0), m_maxLength(32767), m_lastCursorPos(-1), m_tripleClickTimer(0), m_maskData(0), m_modifiedState(0), m_undoState(0), m_selstart(0), m_selend(0), m_passwordEchoEditing(false) @@ -262,10 +262,10 @@ private: uint m_textDirty : 1; uint m_selDirty : 1; uint m_validInput : 1; + uint m_blinkStatus : 1; int m_blinkPeriod; // 0 for non-blinking cursor int m_blinkTimer; int m_deleteAllTimer; - int m_blinkStatus; int m_ascent; int m_maxLength; int m_lastCursorPos; -- cgit v0.12 From 48489988521b818bda8d76e60cb272508e91b490 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 25 Aug 2009 15:36:37 +0200 Subject: animations: make sure setCurrentTime is called on all animations The problem was we were iterating over the list of running animations. And when calling setCurrentTime() on one of them they just unregister themselves from the timer and we would miss some of them. Reviewed-by: leo --- src/corelib/animation/qabstractanimation.cpp | 7 ++- .../qpropertyanimation/tst_qpropertyanimation.cpp | 50 ++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index efe1fb0..617f4db 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -200,8 +200,11 @@ void QUnifiedTimer::timerEvent(QTimerEvent *event) } } else if (event->timerId() == animationTimer.timerId()) { const int delta = lastTick - oldLastTick; - for (int i = 0; i < animations.count(); ++i) { - QAbstractAnimation *animation = animations.at(i); + //we copy the list so that if it is changed we still get to + //call setCurrentTime on all animations. + const QList currentAnimations = animations; + for (int i = 0; i < currentAnimations.count(); ++i) { + QAbstractAnimation *animation = currentAnimations.at(i); int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); animation->setCurrentTime(elapsed); diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 3ff177a..04cfe1a 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -114,6 +114,7 @@ private slots: void updateOnSetKeyValues(); void restart(); void valueChanged(); + void twoAnimations(); }; tst_QPropertyAnimation::tst_QPropertyAnimation() @@ -1079,6 +1080,55 @@ void tst_QPropertyAnimation::valueChanged() } } +//this class will help us make sure that 2 animations started +//at the same time also end at the same time +class MySyncObject : public MyErrorObject +{ + Q_OBJECT +public: + MySyncObject() : anim(this, "ole") + { + anim.setEndValue(1000); + } +public slots: + void checkAnimationFinished() + { + QCOMPARE(anim.state(), QAbstractAnimation::Stopped); + QCOMPARE(ole(), 1000); + } + +public: + QPropertyAnimation anim; +}; + +void tst_QPropertyAnimation::twoAnimations() +{ + MySyncObject o1, o2; + o1.setOle(0); + o2.setOle(0); + + //when the animation in o1 is finished + //the animation in o2 should stop around the same time + //We use a queued connection to check just after the tick from the common timer + //the other way is true too + QObject::connect(&o1.anim, SIGNAL(finished()), + &o2, SLOT(checkAnimationFinished()), Qt::QueuedConnection); + QObject::connect(&o2.anim, SIGNAL(finished()), + &o1, SLOT(checkAnimationFinished()), Qt::QueuedConnection); + + o1.anim.start(); + o2.anim.start(); + + QTest::qWait(o1.anim.duration() + 50); + QCOMPARE(o1.anim.state(), QAbstractAnimation::Stopped); + QCOMPARE(o2.anim.state(), QAbstractAnimation::Stopped); + + QCOMPARE(o1.ole(), 1000); + QCOMPARE(o2.ole(), 1000); + +} + + QTEST_MAIN(tst_QPropertyAnimation) -- cgit v0.12 From f393f7f45b22990ed22308a912b7a00cc7ddd78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 25 Aug 2009 14:07:52 +0200 Subject: Micro-optimization in QPainterPath::toFillPolygons QRectF::intersects was optimized as part of the Falcon project, and is now a bit faster than the inline version used here (drawing of dashed lines was measured to take 16% less time). Reviewed-by: Lars Knoll --- src/gui/painting/qpainterpath.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index eb8b964..a10c4cd 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1520,12 +1520,6 @@ QList QPainterPath::toSubpathPolygons(const QMatrix &matrix) const return toSubpathPolygons(QTransform(matrix)); } -static inline bool rect_intersects(const QRectF &r1, const QRectF &r2) -{ - return qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) - && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()); -} - /*! Converts the path into a list of polygons using the QTransform \a matrix, and returns the list. @@ -1578,7 +1572,7 @@ QList QPainterPath::toFillPolygons(const QTransform &matrix) const continue; QRectF cbounds = bounds.at(j); for (int i=0; i Date: Tue, 25 Aug 2009 10:31:26 +0200 Subject: Removed warnings / debug output in the GL 2 engine / pixmap filter code. Reviewed-by: Tom --- src/opengl/gl2paintengineex/qglengineshadermanager.cpp | 2 +- src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 1 - src/opengl/qpixmapdata_gl.cpp | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 795c8b0..e6b1994 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -161,7 +161,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) #if defined(QT_DEBUG) // Check that all the elements have been filled: for (int i = 0; i < TotalShaderCount; ++i) { - if (i != CustomImageSrcFragmentShader && qglEngineShaderSourceCode[i] == 0) { + if (qglEngineShaderSourceCode[i] == 0) { int enumIndex = staticMetaObject.indexOfEnumerator("ShaderName"); QMetaEnum m = staticMetaObject.enumerator(enumIndex); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 1ee75df..d5241a8 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -361,7 +361,6 @@ public: MainFragmentShader, ImageSrcFragmentShader, - CustomSrcFragmentShader, ImageSrcWithPatternFragmentShader, NonPremultipliedImageSrcFragmentShader, CustomImageSrcFragmentShader, diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index a441a23..80e99a0 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -108,7 +108,6 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize if (sz != fboSize) { delete candidate; - qDebug() << "Resizing fbo in pool:" << sz; candidate = new QGLFramebufferObject(sz, requestFormat); } @@ -117,7 +116,6 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize } if (!chosen) { - qDebug() << "Creating new fbo in pool:" << requestSize; chosen = new QGLFramebufferObject(requestSize, requestFormat); } -- cgit v0.12 From 22e2ba1e5e3345b99f41b62b9984ca6871579122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 25 Aug 2009 16:22:09 +0200 Subject: Fixed documentation and use of incorrect entry point for custom shaders. The entry point has been changed to be customShader, taking source image and texture coordinates as parameters. Reviewed-by: Tom --- examples/effects/customshader/customshadereffect.cpp | 4 +--- src/opengl/qglpixmapfilter.cpp | 2 +- src/opengl/qgraphicsshadereffect.cpp | 19 ++++++++----------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/examples/effects/customshader/customshadereffect.cpp b/examples/effects/customshader/customshadereffect.cpp index 58e2f3d..08e4324 100644 --- a/examples/effects/customshader/customshadereffect.cpp +++ b/examples/effects/customshader/customshadereffect.cpp @@ -43,10 +43,8 @@ #include static char const colorizeShaderCode[] = - "varying highp vec2 textureCoords;\n" - "uniform sampler2D imageTexture;\n" "uniform lowp vec4 effectColor;\n" - "lowp vec4 srcPixel() {\n" + "mediump vec4 customShader(sampler2D imageTexture, vec2 textureCoords) {\n" " vec4 src = texture2D(imageTexture, textureCoords);\n" " float gray = dot(src.rgb, vec3(0.212671, 0.715160, 0.072169));\n" " vec4 colorize = 1.0-((1.0-gray)*(1.0-effectColor));\n" diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 29f6440..e1ee61a 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -418,7 +418,7 @@ QByteArray QGLPixmapBlurFilter::generateBlurShader(int radius, bool gaussianBlur source.append("uniform highp vec4 clip;\n"); } - source.append("mediump vec4 customShader(sampler2D src, vec2 srcCoords) {\n"); + source.append("lowp vec4 customShader(sampler2D src, vec2 srcCoords) {\n"); QVector sampleOffsets; QVector weights; diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp index 22e1db8..d3f52f6 100644 --- a/src/opengl/qgraphicsshadereffect.cpp +++ b/src/opengl/qgraphicsshadereffect.cpp @@ -63,7 +63,9 @@ QT_BEGIN_NAMESPACE The specific effect is defined by a fragment of GLSL source code supplied to setPixelShaderFragment(). This source code must define a - function called \c{srcPixel()} that returns the source pixel value + function with the signature + \c{lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords)} + that returns the source pixel value to use in the paint engine's shader program. The shader fragment is linked with the regular shader code used by the GL2 paint engine to construct a complete QGLShaderProgram. @@ -74,10 +76,8 @@ QT_BEGIN_NAMESPACE \code static char const colorizeShaderCode[] = - "varying highp vec2 textureCoords;\n" - "uniform sampler2D imageTexture;\n" "uniform lowp vec4 effectColor;\n" - "lowp vec4 srcPixel() {\n" + "lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords) {\n" " vec4 src = texture2D(imageTexture, textureCoords);\n" " float gray = dot(src.rgb, vec3(0.212671, 0.715160, 0.072169));\n" " vec4 colorize = 1.0-((1.0-gray)*(1.0-effectColor));\n" @@ -130,9 +130,7 @@ QT_BEGIN_NAMESPACE */ static const char qglslDefaultImageFragmentShader[] = "\ - varying highp vec2 textureCoords; \ - uniform sampler2D imageTexture; \ - lowp vec4 srcPixel() { \ + lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords) { \ return texture2D(imageTexture, textureCoords); \ }\n"; @@ -216,15 +214,14 @@ QByteArray QGraphicsShaderEffect::pixelShaderFragment() const Sets the source code for the pixel shader fragment for this shader effect to \a code. - The \a code must define a GLSL function called \c{srcPixel()} + The \a code must define a GLSL function with the signature + \c{lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords)} that returns the source pixel value to use in the paint engine's shader program. The following is the default pixel shader fragment, which draws a pixmap with no effect applied: \code - varying highp vec2 textureCoords; - uniform sampler2D imageTexture; - lowp vec4 srcPixel() { + lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords) { return texture2D(imageTexture, textureCoords); } \endcode -- cgit v0.12 From 1adc5dbd8f9561b3fbf38759ba5abdca9f3a490b Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 25 Aug 2009 16:40:08 +0200 Subject: QWidgetanimator: the animations are children of the widget they animate This will remove a false pmemleak under valgrind. Reviewed-by: ogoffart --- src/gui/widgets/qwidgetanimator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp index beb6be2..972e07b 100644 --- a/src/gui/widgets/qwidgetanimator.cpp +++ b/src/gui/widgets/qwidgetanimator.cpp @@ -93,7 +93,7 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry) return; - QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry"); + QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry", widget); anim->setDuration(animate ? 200 : 0); anim->setEasingCurve(QEasingCurve::InOutQuad); anim->setEndValue(final_geometry); -- cgit v0.12 From e5db8cdccdb032d82b5562abded95d1dbd743264 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 25 Aug 2009 16:46:36 +0200 Subject: Fix a leak in the stylesheet text Also include some spaces fix --- tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index cbeaebb..60d9787 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -831,7 +831,7 @@ void tst_QStyleSheetStyle::hoverColors() QDialog frame; QLayout* layout = new QGridLayout; - QLineEdit* dummy = new QLineEdit; + QLineEdit* dummy = new QLineEdit; widget->setStyleSheet("*:hover { border:none; background: #e8ff66; color: #ff0084 }"); @@ -1210,6 +1210,7 @@ void tst_QStyleSheetStyle::proxyStyle() QTest::qWait(100); delete w; delete proxy; + delete newProxy; } void tst_QStyleSheetStyle::dialogButtonBox() @@ -1400,7 +1401,7 @@ void tst_QStyleSheetStyle::opaquePaintEvent() QWidget tl; QWidget cl(&tl); cl.setAttribute(Qt::WA_OpaquePaintEvent, true); - cl.setAutoFillBackground(true); + cl.setAutoFillBackground(true); cl.setStyleSheet(stylesheet); cl.ensurePolished(); QCOMPARE(cl.testAttribute(Qt::WA_OpaquePaintEvent), !transparent); @@ -1415,7 +1416,7 @@ void tst_QStyleSheetStyle::task188195_baseBackground() tree.show(); QTest::qWait(20); QImage image(tree.width(), tree.height(), QImage::Format_ARGB32); - + tree.render(&image); QVERIFY(testForColors(image, tree.palette().base().color())); QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51))); -- cgit v0.12 From 5396b8e11ac6e802fdcb9ff0ad6ef2cd64aea260 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 25 Aug 2009 17:02:33 +0200 Subject: QTableWidget didn't repaint a cell after takeItem The problem was that the mode was not emitting dataChanged. Note: This still needs to be autotested. Task-number: 234641 Reviewed-by: ogoffart --- src/gui/itemviews/qtablewidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp index d44c11c..b7c9703 100644 --- a/src/gui/itemviews/qtablewidget.cpp +++ b/src/gui/itemviews/qtablewidget.cpp @@ -226,6 +226,8 @@ QTableWidgetItem *QTableModel::takeItem(int row, int column) itm->view = 0; itm->d->id = -1; tableItems[i] = 0; + QModelIndex ind = index(itm); + emit dataChanged(ind, ind); } return itm; } -- cgit v0.12 From ad339905faf25e0f960ae554367b971b2e5c7731 Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Tue, 25 Aug 2009 17:35:11 +0200 Subject: Doc - Reviewing documentation for QGraphicsEffect and QGraphicsEffectSource Reviewed-By: TrustMe --- src/gui/effects/qgraphicseffect.cpp | 54 ++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index fbd53b0..3274f4d 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -41,23 +41,24 @@ /*! \class QGraphicsEffect - \brief The QGraphicsEffect class is the base class for all graphics effects. + \brief The QGraphicsEffect class is the base class for all graphics + effects. \since 4.6 \ingroup multimedia \ingroup graphicsview-api Effects alter the appearance of elements by hooking into the rendering - pipeline and operating between the source (e.g., a QGraphicsPixmapItem), + pipeline and operating between the source (e.g., a QGraphicsPixmapItem) and the destination device (e.g., QGraphicsView's viewport). Effects can be - disabled by calling setEnabled(); if the effect is disabled, the source is - rendered directly. + disabled by calling setEnabled(false). If effects are disabled, the source + is rendered directly. - If you want to add a visual effect to a e.g. a QGraphicsItem, you can either use - one of the standard effects, or create your own effect by making a subclass - of QGraphicsEffect. The effect can then be installed on the item by calling - QGraphicsItem::setGraphicsEffect. + To add a visual effect to a QGraphicsItem, for example, you can use one of + the standard effects, or alternately, create your own effect by creating a + subclass of QGraphicsEffect. The effect can then be installed on the item + using QGraphicsItem::setGraphicsEffect(). - Qt provides several standard effects, including: + Qt provides the following standard effects: \list \o QGraphicsGrayScaleEffect - renders the item in shades of gray @@ -69,19 +70,24 @@ \o QGrahicsShaderEffect - renders the item with a pixel shader fragment \endlist - If all you want is to add an effect to an item, you should visit the - documentation for the specific effect to learn more about how each effect - can be used. - If you want to create your own custom effect, you can start by creating a - subclass of QGraphicsEffect (or any of the existing effects), and - reimplement the virtual function draw(). This function is called whenever - the effect needs to redraw. draw() has two arguments: the painter, and a - pointer to the source (QGraphicsEffectSource). The source provides extra - context information, such as a pointer to the item that is rendering the - effect, any cached pixmap data, and the device rect bounds. See the draw() - documentation for more details. You can also get a pointer to the current - source by calling source(). + For more information on how to use each effect, refer to the specific + effect's documentation. + + To create your own custom effect, create a subclass of QGraphicsEffect (or + any other existing effects) and reimplement the virtual function draw(). + This function is called whenever the effect needs to redraw. The draw() + function accepts two arguments: the painter and a pointer to the source + (QGraphicsEffectSource). The source provides extra context information, + such as a pointer to the item that is rendering the effect, any cached + pixmap data, or the device rect bounds. For more information, refer to the + documenation for draw(). To obtain a pointer to the current source, simply + call source(). + + If your effect changes, use update() to request for a redraw. If your + custom effect changes the bounding rectangle of the source, e.g., a radial + glow effect may need to apply an extra margin, + If your effect changes, you can call update() to request a redraw. If your custom effect changes the bounding rectangle of the source (e.g., a radial @@ -107,11 +113,11 @@ QT_BEGIN_NAMESPACE /*! \class QGraphicsEffectSource - \brief The QGraphicsEffectSource represents the source of which a QGraphicsEffect - is installed on. + \brief The QGraphicsEffectSource represents the source on which a + QGraphicsEffect is installed on. \since 4.6 - When a QGraphicsEffect is installed on e.g. a QGraphicsItem, this class will act as + When a QGraphicsEffect is installed on a QGraphicsItem, for example, this class will act as a wrapper around QGraphicsItem. E.g. calling update() is effectively the same as calling QGraphicsItem::update(). -- cgit v0.12 From 7aefaa2d4c4f192e033ec3323e2e2368af833248 Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Tue, 25 Aug 2009 17:38:02 +0200 Subject: Doc - Removed a trailing whitespace and more cleanups Reviewed-By: TrustMe --- src/gui/effects/qgraphicseffect.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 3274f4d..a6aef52 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -80,23 +80,18 @@ function accepts two arguments: the painter and a pointer to the source (QGraphicsEffectSource). The source provides extra context information, such as a pointer to the item that is rendering the effect, any cached - pixmap data, or the device rect bounds. For more information, refer to the - documenation for draw(). To obtain a pointer to the current source, simply - call source(). + pixmap data, or the device rectangle bounds. For more information, refer to + the documenation for draw(). To obtain a pointer to the current source, + simply call source(). If your effect changes, use update() to request for a redraw. If your custom effect changes the bounding rectangle of the source, e.g., a radial - glow effect may need to apply an extra margin, - - - If your effect changes, you can call update() to request a redraw. If your - custom effect changes the bounding rectangle of the source (e.g., a radial - glow effect may need to apply an extra margin), you can reimplement the + glow effect may need to apply an extra margin, you can reimplement the virtual boundingRectFor() function, and call updateBoundingRect() to notify the framework whenever this rectangle changes. The virtual sourceBoundingRectChanged() function is called to notify the effects that - the source's bounding rectangle has changed (e.g., if the source is a - QGraphicsRectItem, then if the rectangle parameters have changed). + the source's bounding rectangle has changed - e.g., if the source is a + QGraphicsRectItem and its rectangle parameters have changed. \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect(), QGraphicsEffectSource -- cgit v0.12 From 3d885b2c75d4854266e6552d2659505f132acd00 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 25 Aug 2009 11:18:31 -0700 Subject: Refactor QDirectFBPaintDevice/QDirectFBPixmapData Move format into QDirectFBPaintDevice. Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbpaintdevice.cpp | 17 +++------- .../gfxdrivers/directfb/qdirectfbpaintdevice.h | 1 + .../gfxdrivers/directfb/qdirectfbpixmap.cpp | 34 ++++++++++---------- src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h | 3 +- .../gfxdrivers/directfb/qdirectfbscreen.cpp | 36 ++++++++++++++++++++++ src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 1 + .../gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 8 +++++ .../gfxdrivers/directfb/qdirectfbwindowsurface.h | 1 + 8 files changed, 70 insertions(+), 31 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index 3979a8c..f45f256 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -47,7 +47,8 @@ QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr) : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr), - bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0) + bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), + imageFormat(QImage::Format_Invalid) {} QDirectFBPaintDevice::~QDirectFBPaintDevice() @@ -56,13 +57,11 @@ QDirectFBPaintDevice::~QDirectFBPaintDevice() delete engine; } - IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const { return dfbSurface; } - void QDirectFBPaintDevice::lockDirectFB(DFBSurfaceLockFlags flags) { if (!(lockFlgs & flags)) { @@ -77,7 +76,6 @@ void QDirectFBPaintDevice::lockDirectFB(DFBSurfaceLockFlags flags) } } - void QDirectFBPaintDevice::unlockDirectFB() { if (!lockedImage || !QDirectFBScreen::instance()) @@ -90,19 +88,16 @@ void QDirectFBPaintDevice::unlockDirectFB() lockFlgs = DFBSurfaceLockFlags(0); } - void *QDirectFBPaintDevice::memory() const { return mem; } - QImage::Format QDirectFBPaintDevice::format() const { - return QDirectFBScreen::getImageFormat(dfbSurface); + return imageFormat; } - int QDirectFBPaintDevice::bytesPerLine() const { if (bpl == -1) { @@ -143,11 +138,9 @@ int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmDpiY: return (dotsPerMeterY() * 254) / 10000; // 0.0254 meters-per-inch case QPaintDevice::PdmDepth: - DFBSurfacePixelFormat format; - dfbSurface->GetPixelFormat(dfbSurface, &format); - return QDirectFBScreen::depth(format); + return QDirectFBScreen::depth(imageFormat); case QPaintDevice::PdmNumColors: { - if (lockedImage) + if (lockedImage) return lockedImage->numColors(); DFBResult result; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h index 688fd7b..48761b2 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h @@ -89,6 +89,7 @@ protected: DFBSurfaceLockFlags lockFlgs; uchar *mem; QDirectFBPaintEngine *engine; + QImage::Format imageFormat; private: Q_DISABLE_COPY(QDirectFBPaintDevice); }; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 7cacdd9..7231dd5 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -51,7 +51,7 @@ static int global_ser_no = 0; QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType) : QPixmapData(pixelType, DirectFBClass), QDirectFBPaintDevice(screen), - format(QImage::Format_Invalid), alpha(false) + alpha(false) { setSerialNumber(0); } @@ -70,11 +70,11 @@ void QDirectFBPixmapData::resize(int width, int height) return; } - format = screen->pixelFormat(); + imageFormat = screen->pixelFormat(); dfbSurface = screen->createDFBSurface(QSize(width, height), - format, + imageFormat, QDirectFBScreen::TrackSurface); - d = screen->depth(); + d = QDirectFBScreen::depth(imageFormat); alpha = false; if (!dfbSurface) { invalidate(); @@ -85,7 +85,6 @@ void QDirectFBPixmapData::resize(int width, int height) w = width; h = height; is_null = (w <= 0 || h <= 0); - d = metric(QPaintDevice::PdmDepth); setSerialNumber(++global_ser_no); } @@ -183,13 +182,13 @@ void QDirectFBPixmapData::fromImage(const QImage &image, #endif ) { alpha = true; - format = screen->alphaPixmapFormat(); + imageFormat = screen->alphaPixmapFormat(); } else { alpha = false; - format = screen->pixelFormat(); + imageFormat = screen->pixelFormat(); } - dfbSurface = screen->createDFBSurface(image, format, QDirectFBScreen::TrackSurface|QDirectFBScreen::NoPreallocated); + dfbSurface = screen->createDFBSurface(image, imageFormat, QDirectFBScreen::TrackSurface|QDirectFBScreen::NoPreallocated); if (!dfbSurface) { qWarning("QDirectFBPixmapData::fromImage()"); invalidate(); @@ -198,7 +197,7 @@ void QDirectFBPixmapData::fromImage(const QImage &image, w = image.width(); h = image.height(); is_null = (w <= 0 || h <= 0); - d = metric(QPaintDevice::PdmDepth); + d = QDirectFBScreen::depth(imageFormat); setSerialNumber(++global_ser_no); #ifdef QT_NO_DIRECTFB_OPAQUE_DETECTION Q_UNUSED(flags); @@ -216,12 +215,12 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) const QDirectFBPixmapData *otherData = static_cast(data); IDirectFBSurface *src = otherData->directFBSurface(); alpha = data->hasAlphaChannel(); - format = (alpha - ? QDirectFBScreen::instance()->alphaPixmapFormat() - : QDirectFBScreen::instance()->pixelFormat()); + imageFormat = (alpha + ? QDirectFBScreen::instance()->alphaPixmapFormat() + : QDirectFBScreen::instance()->pixelFormat()); - dfbSurface = screen->createDFBSurface(rect.size(), format, + dfbSurface = screen->createDFBSurface(rect.size(), imageFormat, QDirectFBScreen::TrackSurface); if (!dfbSurface) { qWarning("QDirectFBPixmapData::copy()"); @@ -279,11 +278,12 @@ void QDirectFBPixmapData::fill(const QColor &color) alpha = (color.alpha() < 255); - if (alpha && ::isOpaqueFormat(format)) { + if (alpha && ::isOpaqueFormat(imageFormat)) { QSize size; dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight()); screen->releaseDFBSurface(dfbSurface); - format = screen->alphaPixmapFormat(); + imageFormat = screen->alphaPixmapFormat(); + d = QDirectFBScreen::depth(imageFormat); dfbSurface = screen->createDFBSurface(size, screen->alphaPixmapFormat(), QDirectFBScreen::TrackSurface); setSerialNumber(++global_ser_no); if (!dfbSurface) { @@ -324,7 +324,7 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, flags = DSBLIT_BLEND_ALPHACHANNEL; } data->dfbSurface = screen->createDFBSurface(size, - format, + imageFormat, QDirectFBScreen::TrackSurface); if (flags & DSBLIT_BLEND_ALPHACHANNEL) { data->dfbSurface->Clear(data->dfbSurface, 0, 0, 0, 0); @@ -411,6 +411,6 @@ void QDirectFBPixmapData::invalidate() alpha = false; d = w = h = 0; is_null = true; - format = QImage::Format_Invalid; + imageFormat = QImage::Format_Invalid; } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index 2300174..c8dda0c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -74,12 +74,11 @@ public: QImage *buffer(DFBSurfaceLockFlags lockFlags); // Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice - inline QImage::Format pixelFormat() const { return format; } + inline QImage::Format pixelFormat() const { return imageFormat; } static bool hasAlphaChannel(const QImage &img); inline bool hasAlphaChannel() const { return alpha; } private: void invalidate(); - QImage::Format format; bool alpha; }; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index bb614a2..ecd4aba 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -658,6 +658,42 @@ int QDirectFBScreen::depth(DFBSurfacePixelFormat format) return 0; } +int QDirectFBScreen::depth(QImage::Format format) +{ + int depth = 0; + switch(format) { + case QImage::Format_Invalid: + case QImage::NImageFormats: + Q_ASSERT(false); + case QImage::Format_Mono: + case QImage::Format_MonoLSB: + depth = 1; + break; + case QImage::Format_Indexed8: + depth = 8; + break; + case QImage::Format_RGB32: + case QImage::Format_ARGB32: + case QImage::Format_ARGB32_Premultiplied: + depth = 32; + break; + case QImage::Format_RGB555: + case QImage::Format_RGB16: + case QImage::Format_RGB444: + case QImage::Format_ARGB4444_Premultiplied: + depth = 16; + break; + case QImage::Format_RGB666: + case QImage::Format_ARGB6666_Premultiplied: + case QImage::Format_ARGB8565_Premultiplied: + case QImage::Format_ARGB8555_Premultiplied: + case QImage::Format_RGB888: + depth = 24; + break; + } + return depth; +} + void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args) { QRegExp flipRegexp(QLatin1String("^flip=([\\w,]*)$")); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 4cae076..e8da283 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -169,6 +169,7 @@ public: using QScreen::depth; static int depth(DFBSurfacePixelFormat format); + static int depth(QImage::Format format); static DFBSurfacePixelFormat getSurfacePixelFormat(QImage::Format format); static DFBSurfaceDescription getSurfaceDescription(const uint *buffer, diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 7569a18..83affa7 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -144,6 +144,7 @@ void QDirectFBWindowSurface::createWindow() dfbSurface->Release(dfbSurface); dfbWindow->GetSurface(dfbWindow, &dfbSurface); + updateFormat(); } #endif // QT_NO_DIRECTFB_WM @@ -179,6 +180,7 @@ static DFBResult setGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const void QDirectFBWindowSurface::setGeometry(const QRect &rect) { + IDirectFBSurface *oldSurface = dfbSurface; #ifdef QT_NO_DIRECTFB_WM IDirectFBSurface *primarySurface = screen->primarySurface(); Q_ASSERT(primarySurface); @@ -236,6 +238,8 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) if (result != DFB_OK) DirectFBErrorFatal("QDirectFBWindowSurface::setGeometry()", result); } + if (oldSurface != dfbSurface) + updateFormat(); QWSWindowSurface::setGeometry(rect); } @@ -462,3 +466,7 @@ QImage *QDirectFBWindowSurface::buffer(const QWidget *widget) return img; } +void QDirectFBWindowSurface::updateFormat() +{ + imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; +} diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index 2c4bcdf..0da3a98 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -90,6 +90,7 @@ public: QImage *buffer(const QWidget *widget); private: + void updateFormat(); #ifdef QT_DIRECTFB_WM void createWindow(); IDirectFBWindow *dfbWindow; -- cgit v0.12 From 9dc0914b30a3266be586e1dece931bcdb2f21e49 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 25 Aug 2009 11:19:59 -0700 Subject: Optimize QDirectFBPaintDevice::bytesPerLine If we actually need it locked we'll probably need it locked for read|write. Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index f45f256..6abf0ff 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -104,7 +104,7 @@ int QDirectFBPaintDevice::bytesPerLine() const // Can only get the stride when we lock the surface Q_ASSERT(!lockedImage); QDirectFBPaintDevice* that = const_cast(this); - that->lockDirectFB(DSLF_READ); + that->lockDirectFB(DSLF_READ|DSLF_WRITE); Q_ASSERT(bpl != -1); } return bpl; -- cgit v0.12 From dc4e9f4bb91237b26b82e27310eda6808786ce36 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 24 Aug 2009 08:19:07 -0700 Subject: Implement support for DirectFB image providers Reimplement QPixmapData::fromFile/fromData to load images using IDirectFBImage providers. This functionality might be accelerated on embedded boards and could have potentially large performance enhancements. Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/directfb.pro | 1 + .../gfxdrivers/directfb/qdirectfbpixmap.cpp | 155 +++++++++++++++++++++ src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h | 9 ++ src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 11 +- 4 files changed, 172 insertions(+), 4 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index 5c60b2f..f01d8b1 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -6,6 +6,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers # These defines might be necessary if your DirectFB driver doesn't # support all of the DirectFB API. # +#DEFINES += QT_DIRECTFB_IMAGEPROVIDER #DEFINES += QT_DIRECTFB_IMAGECACHE #DEFINES += QT_NO_DIRECTFB_WM #DEFINES += QT_NO_DIRECTFB_LAYER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 7231dd5..caa973f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -45,6 +45,7 @@ #include "qdirectfbpaintengine.h" #include +#include #include static int global_ser_no = 0; @@ -167,6 +168,160 @@ bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) #endif } +#ifdef QT_DIRECTFB_IMAGEPROVIDER +bool QDirectFBPixmapData::fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags) +{ + if (flags == Qt::AutoColor) { + if (filename.startsWith(QLatin1Char(':'))) { // resource + QFile file(filename); + if (!file.open(QIODevice::ReadOnly)) + return false; + const QByteArray data = file.readAll(); + file.close(); + return fromData(reinterpret_cast(data.constData()), data.size(), format, flags); + } else { + DFBDataBufferDescription description; + description.flags = DBDESC_FILE; + const QByteArray fileNameData = filename.toLocal8Bit(); + description.file = fileNameData.constData(); + if (fromDataBufferDescription(description)) { + return true; + } + // fall back to Qt + } + } + return QPixmapData::fromFile(filename, format, flags); +} + +bool QDirectFBPixmapData::fromData(const uchar *buffer, uint len, const char *format, + Qt::ImageConversionFlags flags) +{ + if (flags == Qt::AutoColor) { + DFBDataBufferDescription description; + description.flags = DBDESC_MEMORY; + description.memory.data = buffer; + description.memory.length = len; + if (fromDataBufferDescription(description)) + return true; + // fall back to Qt + } + return QPixmapData::fromData(buffer, len, format, flags); +} + +template class QDirectFBPointer +{ +public: + QDirectFBPointer(T *tt = 0) : t(tt) {} + ~QDirectFBPointer() { if (t) t->Release(t); } + + inline T* operator->() { return t; } + inline operator T*() { return t; } + + inline T** operator&() { return &t; } + inline bool operator!() const { return !t; } + inline T *data() { return t; } + inline const T *data() const { return t; } + + T *t; +}; + +bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescription &dataBufferDescription) +{ + IDirectFB *dfb = screen->dfb(); + Q_ASSERT(dfb); + QDirectFBPointer dataBuffer; + DFBResult result = DFB_OK; + if ((result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, &dataBuffer)) != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromDataBufferDescription()", result); + return false; + } + + QDirectFBPointer provider; + if ((result = dataBuffer->CreateImageProvider(dataBuffer, &provider)) != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't create image provider", result); + return false; + } + + DFBSurfaceDescription surfaceDescription; + if ((result = provider->GetSurfaceDescription(provider, &surfaceDescription)) != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result); + return false; + } + + QDirectFBPointer surfaceFromDescription = screen->createDFBSurface(surfaceDescription, QDirectFBScreen::DontTrackSurface, &result); + if (!surfaceFromDescription) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't create surface", result); + return false; + } + + result = provider->RenderTo(provider, surfaceFromDescription, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result); + return false; + } + + DFBImageDescription imageDescription; + result = provider->GetImageDescription(provider, &imageDescription); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't get image description", result); + return false; + } + + alpha = imageDescription.caps & (DICAPS_ALPHACHANNEL|DICAPS_COLORKEY); + imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); + + dfbSurface = screen->createDFBSurface(QSize(surfaceDescription.width, surfaceDescription.height), + imageFormat, QDirectFBScreen::TrackSurface); + if (alpha) + dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); + + DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; + if (imageDescription.caps & DICAPS_COLORKEY) { + blittingFlags |= DSBLIT_SRC_COLORKEY; + result = surfaceFromDescription->SetSrcColorKey(surfaceFromDescription, + imageDescription.colorkey_r, + imageDescription.colorkey_g, + imageDescription.colorkey_b); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't set src color key", result); + invalidate(); // release dfbSurface + return false; + } + } + if (imageDescription.caps & DICAPS_ALPHACHANNEL) { + blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL; + } + result = dfbSurface->SetBlittingFlags(dfbSurface, blittingFlags); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't set blitting flags", result); + invalidate(); // release dfbSurface + return false; + } + + result = dfbSurface->Blit(dfbSurface, surfaceFromDescription, 0, 0, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't blit to surface", result); + invalidate(); // release dfbSurface + return false; + } + if (blittingFlags != DSBLIT_NOFX) { + dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); + } + + + w = surfaceDescription.width; + h = surfaceDescription.height; + is_null = (w <= 0 || h <= 0); + d = QDirectFBScreen::depth(imageFormat); + setSerialNumber(++global_ser_no); +#if (Q_DIRECTFB_VERSION >= 0x010000) + dfbSurface->ReleaseSource(dfbSurface); +#endif + return true; +} + +#endif void QDirectFBPixmapData::fromImage(const QImage &image, Qt::ImageConversionFlags flags) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index c8dda0c..f0ae2f8 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -62,6 +62,12 @@ public: // Re-implemented from QPixmapData: virtual void resize(int width, int height); virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags); +#ifdef QT_DIRECTFB_IMAGEPROVIDER + virtual bool fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags); + virtual bool fromData(const uchar *buffer, uint len, const char *format, + Qt::ImageConversionFlags flags); +#endif virtual void copy(const QPixmapData *data, const QRect &rect); virtual void fill(const QColor &color); virtual QPixmap transformed(const QTransform &matrix, @@ -78,6 +84,9 @@ public: static bool hasAlphaChannel(const QImage &img); inline bool hasAlphaChannel() const { return alpha; } private: +#ifdef QT_DIRECTFB_IMAGEPROVIDER + bool fromDataBufferDescription(const DFBDataBufferDescription &dataBuffer); +#endif void invalidate(); bool alpha; }; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index e8da283..c61cde7 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -59,6 +59,9 @@ QT_MODULE(Gui) #if !defined QT_DIRECTFB_IMAGECACHE && !defined QT_NO_DIRECTFB_IMAGECACHE #define QT_NO_DIRECTFB_IMAGECACHE #endif +#if !defined QT_DIRECTFB_IMAGEPROVIDER && !defined QT_NO_DIRECTFB_IMAGEPROVIDER +#define QT_NO_DIRECTFB_IMAGEPROVIDER +#endif #if !defined QT_NO_DIRECTFB_PALETTE && !defined QT_DIRECTFB_PALETTE #define QT_DIRECTFB_PALETTE #endif @@ -162,6 +165,10 @@ public: QImage::Format format, SurfaceCreationOptions options, DFBResult *result = 0); + IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc, + SurfaceCreationOptions options, + DFBResult *result); + void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags, const QRegion ®ion, const QPoint &offset); void releaseDFBSurface(IDirectFBSurface *surface); @@ -188,11 +195,7 @@ public: static uchar *lockSurface(IDirectFBSurface *surface, uint flags, int *bpl = 0); private: - IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc, - SurfaceCreationOptions options, - DFBResult *result); QDirectFBScreenPrivate *d_ptr; - friend class SurfaceCache; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::SurfaceCreationOptions); -- cgit v0.12 From 6a546cadf18b2c73d32868d84a8e3edc4455d508 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 24 Aug 2009 08:34:08 -0700 Subject: Implement support for keeping image provider alive If you define QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE we make sure atleast one IDirectFBImageProvider is alive at all times. Apparently this is refcounted by DirectFB on atleast one implementation and there's considerable overhead involved when releasing the last/creating the first image provider. Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/directfb.pro | 1 + .../gfxdrivers/directfb/qdirectfbpixmap.cpp | 8 ++++++- .../gfxdrivers/directfb/qdirectfbscreen.cpp | 25 ++++++++++++++++++++++ src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 9 ++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index f01d8b1..055e7cd 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -7,6 +7,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers # support all of the DirectFB API. # #DEFINES += QT_DIRECTFB_IMAGEPROVIDER +#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE #DEFINES += QT_DIRECTFB_IMAGECACHE #DEFINES += QT_NO_DIRECTFB_WM #DEFINES += QT_NO_DIRECTFB_LAYER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index caa973f..70a6e02 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -237,12 +237,18 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti return false; } +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + IDirectFBImageProvider *provider = 0; +#else QDirectFBPointer provider; +#endif if ((result = dataBuffer->CreateImageProvider(dataBuffer, &provider)) != DFB_OK) { DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't create image provider", result); return false; } - +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + screen->setDirectFBImageProvider(provider); +#endif DFBSurfaceDescription surfaceDescription; if ((result = provider->GetSurfaceDescription(provider, &surfaceDescription)) != DFB_OK) { DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index ecd4aba..3911178 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -87,6 +87,9 @@ public: #ifndef QT_NO_DIRECTFB_KEYBOARD QDirectFBKeyboardHandler *keyboard; #endif +#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + IDirectFBImageProvider *imageProvider; +#endif QColor backgroundColor; QDirectFBScreen *q; }; @@ -109,6 +112,9 @@ QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr) #ifndef QT_NO_DIRECTFB_KEYBOARD , keyboard(0) #endif +#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + , imageProvider(0) +#endif , q(qptr) { #ifndef QT_NO_QWS_SIGNALHANDLER @@ -128,6 +134,10 @@ QDirectFBScreenPrivate::~QDirectFBScreenPrivate() #ifndef QT_NO_DIRECTFB_KEYBOARD delete keyboard; #endif +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + if (imageProvider) + imageProvider->Release(imageProvider); +#endif for (QSet::const_iterator it = allocatedSurfaces.begin(); it != allocatedSurfaces.end(); ++it) { (*it)->Release(*it); @@ -1097,6 +1107,10 @@ bool QDirectFBScreen::connect(const QString &displaySpec) void QDirectFBScreen::disconnect() { +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + if (d_ptr->imageProvider) + d_ptr->imageProvider->Release(d_ptr->imageProvider); +#endif #ifdef QT_NO_DIRECTFB_WM d_ptr->primarySurface->Release(d_ptr->primarySurface); d_ptr->primarySurface = 0; @@ -1375,4 +1389,15 @@ void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags } } +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE +void QDirectFBScreen::setDirectFBImageProvider(IDirectFBImageProvider *provider) +{ + Q_ASSERT(provider); + if (d_ptr->imageProvider) + d_ptr->imageProvider->Release(d_ptr->imageProvider); + d_ptr->imageProvider = provider; +} +#endif + + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index c61cde7..19f032e 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -62,6 +62,9 @@ QT_MODULE(Gui) #if !defined QT_DIRECTFB_IMAGEPROVIDER && !defined QT_NO_DIRECTFB_IMAGEPROVIDER #define QT_NO_DIRECTFB_IMAGEPROVIDER #endif +#if !defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && !defined QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE +#define QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE +#endif #if !defined QT_NO_DIRECTFB_PALETTE && !defined QT_DIRECTFB_PALETTE #define QT_DIRECTFB_PALETTE #endif @@ -80,6 +83,9 @@ QT_MODULE(Gui) #if defined QT_NO_DIRECTFB_LAYER && defined QT_DIRECTFB_WM #error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM #endif +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && defined QT_NO_DIRECTFB_IMAGEPROVIDER +#error QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE requires QT_DIRECTFB_IMAGEPROVIDER to be defined +#endif #define Q_DIRECTFB_VERSION ((DIRECTFB_MAJOR_VERSION << 16) | (DIRECTFB_MINOR_VERION << 8) | DIRECTFB_MICRO_VERSION) @@ -194,6 +200,9 @@ public: #endif static uchar *lockSurface(IDirectFBSurface *surface, uint flags, int *bpl = 0); +#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + void setDirectFBImageProvider(IDirectFBImageProvider *provider); +#endif private: QDirectFBScreenPrivate *d_ptr; }; -- cgit v0.12 From eb5928444ad35c3b9005498228e5a8a8a6bd3b60 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 18 Aug 2009 07:58:14 -0700 Subject: Render cursor with a window in dfb if desired Some DFB implementations do not support rendering the cursor using the intended interfaces. In these cases one can define QT_DIRECTFB_WINDOW_AS_CURSOR and use a window to render the cursor. Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/directfb.pro | 1 + .../gfxdrivers/directfb/qdirectfbscreen.cpp | 166 ++++++++++++++++++++- src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 8 + 3 files changed, 171 insertions(+), 4 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index 055e7cd..5876df1 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -6,6 +6,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers # These defines might be necessary if your DirectFB driver doesn't # support all of the DirectFB API. # +#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR #DEFINES += QT_DIRECTFB_IMAGEPROVIDER #DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE #DEFINES += QT_DIRECTFB_IMAGECACHE diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 3911178..dbe8926 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -494,7 +494,15 @@ void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface, #endif // QT_NO_DIRECTFB_PALETTE -#if !defined(QT_NO_DIRECTFB_LAYER) && !defined(QT_NO_QWS_CURSOR) +#ifndef QT_NO_QWS_CURSOR +#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR +#define QT_DIRECTFB_CURSOR +#elif defined QT_DIRECTFB_LAYER +#define QT_DIRECTFB_CURSOR +#endif +#endif + +#if defined QT_DIRECTFB_CURSOR class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor { public: @@ -504,6 +512,11 @@ public: virtual void show(); virtual void hide(); private: +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR + ~QDirectFBScreenCursor(); + bool createWindow(); + IDirectFBWindow *window; +#endif IDirectFBDisplayLayer *layer; }; @@ -519,12 +532,95 @@ QDirectFBScreenCursor::QDirectFBScreenCursor() enable = false; hwaccel = true; supportsAlpha = true; +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR + window = 0; + DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set cooperative level", result); + } + result = layer->SetCursorOpacity(layer, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set cursor opacity", result); + } + + result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set cooperative level", result); + } +#endif +} + +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR +QDirectFBScreenCursor::~QDirectFBScreenCursor() +{ + if (window) { + window->Release(window); + window = 0; + } +} + +bool QDirectFBScreenCursor::createWindow() +{ + Q_ASSERT(!window); + Q_ASSERT(!cursor.isNull()); + DFBWindowDescription description; + memset(&description, 0, sizeof(DFBWindowDescription)); + description.flags = DWDESC_POSX|DWDESC_POSY|DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_CAPS|DWDESC_OPTIONS|DWDESC_PIXELFORMAT|DWDESC_SURFACE_CAPS; + description.width = cursor.width(); + description.height = cursor.height(); + description.posx = pos.x() - hotspot.x(); + description.posy = pos.y() - hotspot.y(); + description.options = DWOP_GHOST|DWOP_ALPHACHANNEL; + description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER; + const QImage::Format format = QDirectFBScreen::instance()->alphaPixmapFormat(); + description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); + if (QDirectFBScreen::isPremultiplied(format)) + description.surface_caps = DSCAPS_PREMULTIPLIED; + + DFBResult result = layer->CreateWindow(layer, &description, &window); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::createWindow: Unable to create window", result); + return false; + } + result = window->SetOpacity(window, 255); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::createWindow: Unable to set opacity ", result); + return false; + } + + result = window->SetStackingClass(window, DWSC_UPPER); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::createWindow: Unable to set stacking class ", result); + return false; + } + + result = window->RaiseToTop(window); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::createWindow: Unable to raise window ", result); + return false; + } + + return true; } +#endif void QDirectFBScreenCursor::move(int x, int y) { pos = QPoint(x, y); +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR + if (window) { + const QPoint p = pos - hotspot; + DFBResult result = window->MoveTo(window, p.x(), p.y()); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::move: Unable to move window", result); + } + } +#else layer->WarpCursor(layer, x, y); +#endif } void QDirectFBScreenCursor::hide() @@ -532,6 +628,7 @@ void QDirectFBScreenCursor::hide() if (enable) { enable = false; DFBResult result; +#ifndef QT_DIRECTFB_WINDOW_AS_CURSOR result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); if (result != DFB_OK) { DirectFBError("QDirectFBScreenCursor::hide: " @@ -547,6 +644,15 @@ void QDirectFBScreenCursor::hide() DirectFBError("QDirectFBScreenCursor::hide: " "Unable to set cooperative level", result); } +#else + if (window) { + result = window->SetOpacity(window, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set window opacity", result); + } + } +#endif } } @@ -560,7 +666,13 @@ void QDirectFBScreenCursor::show() DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cooperative level", result); } - result = layer->SetCursorOpacity(layer, 255); + result = layer->SetCursorOpacity(layer, +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR + 0 +#else + 255 +#endif + ); if (result != DFB_OK) { DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cursor shape", result); @@ -570,6 +682,15 @@ void QDirectFBScreenCursor::show() DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cooperative level", result); } +#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR + if (window) { + DFBResult result = window->SetOpacity(window, 255); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::show: " + "Unable to set window opacity", result); + } + } +#endif } } @@ -593,6 +714,7 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty) DirectFBError("QDirectFBScreenCursor::set: Unable to create surface", result); return; } +#ifndef QT_DIRECTFB_WINDOW_AS_CURSOR result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); if (result != DFB_OK) { DirectFBError("QDirectFBScreenCursor::show: " @@ -603,17 +725,53 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty) DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cursor shape", result); } - surface->Release(surface); result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); if (result != DFB_OK) { DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cooperative level", result); } +#else + if (window || createWindow()) { + QSize windowSize; + result = window->GetSize(window, &windowSize.rwidth(), &windowSize.rheight()); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: " + "Unable to get window size", result); + } + result = window->Resize(window, size.width(), size.height()); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to resize window", result); + } + + IDirectFBSurface *windowSurface; + result = window->GetSurface(window, &windowSurface); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to get window surface", result); + } else { + result = windowSurface->Clear(windowSurface, 0, 0, 0, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to clear surface", result); + } + + result = windowSurface->Blit(windowSurface, surface, 0, 0, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to blit to surface", result); + } + } + result = windowSurface->Flip(windowSurface, 0, DSFLIP_NONE); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to flip window", result); + } + + windowSurface->Release(windowSurface); + } +#endif + surface->Release(surface); show(); } } -#endif // QT_NO_DIRECTFB_LAYER +#endif // QT_DIRECTFB_CURSOR QDirectFBScreen::QDirectFBScreen(int display_id) : QScreen(display_id, DirectFBClass), d_ptr(new QDirectFBScreenPrivate(this)) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 19f032e..7768380 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -65,6 +65,9 @@ QT_MODULE(Gui) #if !defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && !defined QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE #define QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE #endif +#if !defined QT_DIRECTFB_WINDOW_AS_CURSOR && !defined QT_NO_DIRECTFB_WINDOW_AS_CURSOR +#define QT_NO_DIRECTFB_WINDOW_AS_CURSOR +#endif #if !defined QT_NO_DIRECTFB_PALETTE && !defined QT_DIRECTFB_PALETTE #define QT_DIRECTFB_PALETTE #endif @@ -86,6 +89,9 @@ QT_MODULE(Gui) #if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && defined QT_NO_DIRECTFB_IMAGEPROVIDER #error QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE requires QT_DIRECTFB_IMAGEPROVIDER to be defined #endif +#if defined QT_DIRECTFB_WINDOW_AS_CURSOR && defined QT_NO_DIRECTFB_WM +#error QT_DIRECTFB_WINDOW_AS_CURSOR requires QT_DIRECTFB_WM to be defined +#endif #define Q_DIRECTFB_VERSION ((DIRECTFB_MAJOR_VERSION << 16) | (DIRECTFB_MINOR_VERION << 8) | DIRECTFB_MICRO_VERSION) @@ -98,6 +104,8 @@ QT_MODULE(Gui) DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBInputDeviceCapabilities); DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowDescriptionFlags); +DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowCapabilities); +DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowOptions); DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceDescriptionFlags); DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceCapabilities); DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceLockFlags); -- cgit v0.12 From a5f41541caea7f19d5259a48e2de8db8144e3373 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 25 Aug 2009 14:32:48 -0700 Subject: Ensure that windows are double buffered in DFB Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 83affa7..2f240fb 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -124,7 +124,7 @@ void QDirectFBWindowSurface::createWindow() qFatal("QDirectFBWindowSurface: Unable to get primary display layer!"); DFBWindowDescription description; - description.caps = DWCAPS_NODECORATION; + description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER; description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT; description.surface_caps = DSCAPS_NONE; -- cgit v0.12 From 1470504e15662acf37bacc58359527f88efc43ab Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 25 Aug 2009 14:37:59 -0700 Subject: Make IDirectFBImageProvider enabled by default To prevent using IDirectFBImageProviders one can define QT_NO_DIRECTFB_IMAGEPROVIDER Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/directfb.pro | 2 +- src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index 5876df1..c5da3df 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -7,7 +7,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers # support all of the DirectFB API. # #DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR -#DEFINES += QT_DIRECTFB_IMAGEPROVIDER +#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER #DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE #DEFINES += QT_DIRECTFB_IMAGECACHE #DEFINES += QT_NO_DIRECTFB_WM diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 7768380..8ec91c7 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -59,8 +59,8 @@ QT_MODULE(Gui) #if !defined QT_DIRECTFB_IMAGECACHE && !defined QT_NO_DIRECTFB_IMAGECACHE #define QT_NO_DIRECTFB_IMAGECACHE #endif -#if !defined QT_DIRECTFB_IMAGEPROVIDER && !defined QT_NO_DIRECTFB_IMAGEPROVIDER -#define QT_NO_DIRECTFB_IMAGEPROVIDER +#if !defined QT_DIRECTFB_NO_IMAGEPROVIDER && !defined QT_DIRECTFB_IMAGEPROVIDER +#define QT_DIRECTFB_IMAGEPROVIDER #endif #if !defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && !defined QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE #define QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE -- cgit v0.12 From c3a8485e91cc86e9e886712acb1b9a70d96382e9 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 26 Aug 2009 14:32:25 +1000 Subject: Fix another minor copy'n'paste error from QLineControl refactoring Had left the cursor flash time as half the QApplication cursor flash time by mistake. The new function sets the whole period and not just the time between toggling cursor visibility. Reviewed-by: Trust Me --- src/gui/widgets/qlineedit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 299ecfc..f36a995 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1395,7 +1395,7 @@ bool QLineEdit::event(QEvent * e) if (e->type() == QEvent::EnterEditFocus) { end(false); d->setCursorVisible(true); - d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()/2); + d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); } else if (e->type() == QEvent::LeaveEditFocus) { d->setCursorVisible(false); d->control->setCursorBlinkPeriod(0); @@ -1690,7 +1690,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e) #ifdef QT_KEYPAD_NAVIGATION if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)){ #endif - d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()/2); + d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); QStyleOptionFrameV2 opt; initStyleOption(&opt); if((!hasSelectedText() && d->control->preeditAreaText().isEmpty()) -- cgit v0.12 From 466c908681d25031cc89d49fccd7a90a4414ecbf Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 26 Aug 2009 08:55:37 +0200 Subject: Cocoa, the menus can be disabled after a modal dialog Why this happends is a bit blurry. From before, I know that cocoa is a bit buggy regarding setting a menu item hidden or not. The solution back then resulted in the function syncNSMenuItemEnabled in qmenu_mac.mm. This patch basically applies the same (silly) trick; disabling the menuitem before enabling it. This seems to force an update to the menu items enabled state. For the record: this is not a fix that I embrace. I hope we can remove it again some day. See task for how to reproduce. Task: 259600 Rev-By: alexis --- src/gui/widgets/qmenu_mac.mm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 47a8042..8e28abe 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -607,6 +607,13 @@ static inline void syncNSMenuItemVisiblity(NSMenuItem *menuItem, bool actionVisi [menuItem setHidden:!actionVisibility]; } +static inline void syncNSMenuItemEnabled(NSMenuItem *menuItem, bool enabled) +{ + [menuItem setEnabled:NO]; + [menuItem setEnabled:YES]; + [menuItem setEnabled:enabled]; +} + static inline void syncMenuBarItemsVisiblity(const QMenuBarPrivate::QMacMenuBarPrivate *mac_menubar) { const QList &menubarActions = mac_menubar->actionItems; @@ -659,12 +666,12 @@ void qt_mac_set_modal_state_helper_recursive(OSMenuRef menu, OSMenuRef merge, bo // The item should follow what the QAction has. if ([item tag]) { QAction *action = reinterpret_cast([item tag]); - [item setEnabled:action->isEnabled()]; + syncNSMenuItemEnabled(item, action->isEnabled()); } else { - [item setEnabled:YES]; + syncNSMenuItemEnabled(item, YES); } } else { - [item setEnabled:NO]; + syncNSMenuItemEnabled(item, NO); } } } -- cgit v0.12 From 82917af38936d4ea33bc7fd2310c1361ebf2ac73 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 26 Aug 2009 09:26:43 +0200 Subject: compile fix with namespaces 13 pairs missing... --- src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp | 4 +++- src/multimedia/audio/qaudiodeviceinfo_alsa_p.h | 4 ++++ src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 3 +++ src/multimedia/audio/qaudiodeviceinfo_win32_p.h | 4 ++++ src/multimedia/audio/qaudioinput_alsa_p.cpp | 3 +++ src/multimedia/audio/qaudioinput_alsa_p.h | 4 ++++ src/multimedia/audio/qaudioinput_win32_p.cpp | 3 +++ src/multimedia/audio/qaudioinput_win32_p.h | 4 ++++ src/multimedia/audio/qaudiooutput_alsa_p.cpp | 4 ++++ src/multimedia/audio/qaudiooutput_alsa_p.h | 4 ++++ src/multimedia/audio/qaudiooutput_win32_p.cpp | 4 ++++ src/multimedia/audio/qaudiooutput_win32_p.h | 4 ++++ src/multimedia/video/qimagevideobuffer.cpp | 4 ++++ 13 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index f155770..d903f81 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -52,6 +52,8 @@ #include "qaudiodeviceinfo_alsa_p.h" +QT_BEGIN_NAMESPACE + QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray dev, QAudio::Mode mode) { handle = 0; @@ -391,4 +393,4 @@ QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice() return QByteArray("default"); } - +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h index ca8179f..5f17b71 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h @@ -65,6 +65,8 @@ #include #include +QT_BEGIN_NAMESPACE + const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; @@ -109,5 +111,7 @@ private: snd_pcm_hw_params_t *params; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index 58e7f8b..21b0e9c 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -55,6 +55,8 @@ #include #include "qaudiodeviceinfo_win32_p.h" +QT_BEGIN_NAMESPACE + // For mingw toolchain mmsystem.h only defines half the defines, so add if needed. #ifndef WAVE_FORMAT_44M08 #define WAVE_FORMAT_44M08 0x00000100 @@ -376,3 +378,4 @@ QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() return QByteArray("default"); } +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h index 9e0d1ea..f5f575b 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h @@ -63,6 +63,8 @@ #include +QT_BEGIN_NAMESPACE + const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; @@ -105,4 +107,6 @@ private: QList typez; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index 595c9df..0b3d337 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -53,6 +53,8 @@ #include #include "qaudioinput_alsa_p.h" +QT_BEGIN_NAMESPACE + //#define DEBUG_AUDIO 1 QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): @@ -686,3 +688,4 @@ void InputPrivate::trigger() emit readyRead(); } +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h index 3f7c85e..400157e 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -67,6 +67,8 @@ #include #include +QT_BEGIN_NAMESPACE + class InputPrivate; class QAudioInputPrivate : public QAbstractAudioInput @@ -148,4 +150,6 @@ private: QAudioInputPrivate *audioDevice; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 6da80ee..fd6984f 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -53,6 +53,8 @@ #include "qaudioinput_win32_p.h" +QT_BEGIN_NAMESPACE + //#define DEBUG_AUDIO 1 static CRITICAL_SECTION waveInCriticalSection; @@ -539,3 +541,4 @@ void InputPrivate::trigger() emit readyRead(); } +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h index 7f7b823..f14ce96 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.h +++ b/src/multimedia/audio/qaudioinput_win32_p.h @@ -68,6 +68,8 @@ #include +QT_BEGIN_NAMESPACE + class QAudioInputPrivate : public QAbstractAudioInput { Q_OBJECT @@ -149,4 +151,6 @@ private: QAudioInputPrivate *audioDevice; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index 5997d31..a5ac177 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -53,6 +53,8 @@ #include #include "qaudiooutput_alsa_p.h" +QT_BEGIN_NAMESPACE + //#define DEBUG_AUDIO 1 QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): @@ -704,3 +706,5 @@ qint64 OutputPrivate::writeData(const char* data, qint64 len) return written; } + +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h index 295927b..068428d 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.h +++ b/src/multimedia/audio/qaudiooutput_alsa_p.h @@ -66,6 +66,8 @@ #include #include +QT_BEGIN_NAMESPACE + class OutputPrivate; class QAudioOutputPrivate : public QAbstractAudioOutput @@ -156,4 +158,6 @@ private: QAudioOutputPrivate *audioDevice; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index bace4a6..99229df 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -54,6 +54,8 @@ //#define DEBUG_AUDIO 1 +QT_BEGIN_NAMESPACE + static CRITICAL_SECTION waveOutCriticalSection; QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): @@ -502,3 +504,5 @@ qint64 OutputPrivate::writeData(const char* data, qint64 len) } return written; } + +QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index c6c025f..3906d9d 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -67,6 +67,8 @@ #include +QT_BEGIN_NAMESPACE + class QAudioOutputPrivate : public QAbstractAudioOutput { Q_OBJECT @@ -149,4 +151,6 @@ private: QAudioOutputPrivate *audioDevice; }; +QT_END_NAMESPACE + #endif diff --git a/src/multimedia/video/qimagevideobuffer.cpp b/src/multimedia/video/qimagevideobuffer.cpp index d63f145..6af0c41 100644 --- a/src/multimedia/video/qimagevideobuffer.cpp +++ b/src/multimedia/video/qimagevideobuffer.cpp @@ -46,6 +46,8 @@ #include #include +QT_BEGIN_NAMESPACE + class QImageVideoBufferPrivate : public QAbstractVideoBufferPrivate { public: @@ -100,3 +102,5 @@ void QImageVideoBuffer::unmap() d->mapMode = NotMapped; } + +QT_END_NAMESPACE -- cgit v0.12 From 4806174aeff4d7c600f6be20649153bf0e997953 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 26 Aug 2009 09:31:45 +0200 Subject: QLineEdit: reenable the delete action from the context menu We now need to connect to the slot in the QLineControl and not to the slot of the QLineEdit (the QLineEdit slot is now also removed). Reviewed-by: Alan Alpert --- src/gui/widgets/qlinecontrol_p.h | 2 +- src/gui/widgets/qlineedit.cpp | 2 +- src/gui/widgets/qlineedit.h | 1 - src/gui/widgets/qlineedit_p.cpp | 8 -------- src/gui/widgets/qlineedit_p.h | 2 -- tests/auto/qlineedit/tst_qlineedit.cpp | 27 +++++++++++++++++++++++++++ 6 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index adea742..0db6279 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -349,7 +349,7 @@ Q_SIGNALS: protected: virtual void timerEvent(QTimerEvent *event); -private slots: +private Q_SLOTS: void _q_clipboardChanged(); void _q_deleteSelected(); diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index f36a995..059aaf1 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -2002,7 +2002,7 @@ QMenu *QLineEdit::createStandardContextMenu() action = popup->addAction(QLineEdit::tr("Delete")); action->setEnabled(!d->control->isReadOnly() && !d->control->text().isEmpty() && d->control->hasSelectedText()); - connect(action, SIGNAL(triggered()), SLOT(_q_deleteSelected())); + connect(action, SIGNAL(triggered()), d->control, SLOT(_q_deleteSelected())); popup->addSeparator(); diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h index 03d4376..cd37ad0 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/gui/widgets/qlineedit.h @@ -267,7 +267,6 @@ private: Q_DISABLE_COPY(QLineEdit) Q_DECLARE_PRIVATE(QLineEdit) Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate()) - Q_PRIVATE_SLOT(d_func(), void _q_deleteSelected()) Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int)) #ifndef QT_NO_COMPLETER diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index cec34da..4218630 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -93,10 +93,6 @@ void QLineEditPrivate::_q_completionHighlighted(QString newText) #endif // QT_NO_COMPLETER -void QLineEditPrivate::_q_clipboardChanged() -{ -} - void QLineEditPrivate::_q_handleWindowActivate() { Q_Q(QLineEdit); @@ -104,10 +100,6 @@ void QLineEditPrivate::_q_handleWindowActivate() control->deselect(); } -void QLineEditPrivate::_q_deleteSelected() -{ -} - void QLineEditPrivate::_q_textEdited(const QString &text) { Q_Q(QLineEdit); diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h index 3521dcb..260bc19 100644 --- a/src/gui/widgets/qlineedit_p.h +++ b/src/gui/widgets/qlineedit_p.h @@ -122,9 +122,7 @@ public: QRect adjustedContentsRect() const; - void _q_clipboardChanged(); void _q_handleWindowActivate(); - void _q_deleteSelected(); void _q_textEdited(const QString &); void _q_cursorPositionChanged(int, int); #ifdef QT_KEYPAD_NAVIGATION diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 1616154..93aa64c 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -190,6 +190,7 @@ private slots: void selectedText(); void hasSelectedText(); + void deleteSelectedText(); void textChangedAndTextEdited(); void returnPressed(); @@ -2054,6 +2055,32 @@ void tst_QLineEdit::hasSelectedText() DEPENDS_ON("selectedText"); } +void tst_QLineEdit::deleteSelectedText() +{ + const QString text = QString::fromLatin1("bar"); + QLineEdit edit( text ); + QCOMPARE(edit.text(), text); + + edit.selectAll(); + + QTest::keyClick(&edit, Qt::Key_Delete, 0); + QVERIFY(edit.text().isEmpty()); + + edit.setText(text); + edit.selectAll(); + + QMenu *menu = edit.createStandardContextMenu(); + for (int i = 0; i < menu->actions().count(); ++i) { + QAction *current = menu->actions().at(i); + if (current->text() == QLineEdit::tr("Delete")) { + current->trigger(); //this will delete the whole text selected + QVERIFY(edit.text().isEmpty()); + } + } + +} + + void tst_QLineEdit::textChangedAndTextEdited() { changed_count = 0; -- cgit v0.12 From e692a4044e161c46e6b145d2f3874a0b7b929b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 26 Aug 2009 10:29:11 +0200 Subject: Fixed clipping bug in GL 2 paint engine (visible in arthur demos). QVectorPath::hints() is not a strict bit field, and thus can not be anded with RectangleHint. Instead, QVectorPath::shape() should be directly compared with RectangleHint to check if the vector path is a rectangle or not. In this case the first four points of a regular painter path were treated as a rectangle with dire consequences. Reviewed-by: Tom --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 2901c1e..136a078 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1499,7 +1499,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) if (op == Qt::ReplaceClip && !d->hasClipOperations()) op = Qt::IntersectClip; - if (!path.isEmpty() && op == Qt::IntersectClip && (path.hints() & QVectorPath::RectangleHint)) { + if (!path.isEmpty() && op == Qt::IntersectClip && (path.shape() == QVectorPath::RectangleHint)) { const QPointF* const points = reinterpret_cast(path.points()); QRectF rect(points[0], points[2]); -- cgit v0.12 From 1e87709059dcf10e41c0781d4b97ce143543e4a4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 26 Aug 2009 10:25:19 +0200 Subject: Make QWS compile with namespaces Reviewed-by: hjk --- src/gui/embedded/qkbd_defaultmap_qws_p.h | 2 ++ src/gui/embedded/qkbd_qws_p.h | 4 ++++ src/gui/embedded/qkbdqnx_qws.cpp | 5 +++++ src/gui/embedded/qlock.cpp | 11 +++++++++-- src/gui/embedded/qmousetslib_qws.h | 2 +- src/gui/embedded/qscreen_qws.h | 4 ++-- src/gui/embedded/qscreenlinuxfb_qws.cpp | 6 +++--- src/gui/embedded/qscreenlinuxfb_qws.h | 8 +++++--- src/gui/embedded/qscreenproxy_qws.cpp | 3 +++ src/gui/embedded/qscreenqnx_qws.cpp | 3 +++ src/gui/embedded/qsoundqss_qws.cpp | 4 ++-- src/gui/embedded/qwsutils_qws.h | 12 ++++++------ src/gui/image/qpixmap_qws.cpp | 5 +++++ src/gui/inputmethod/qwsinputcontext_qws.cpp | 16 ++++++++-------- src/gui/kernel/qapplication_qws.cpp | 9 ++++----- src/gui/kernel/qsound_qws.cpp | 4 ++-- src/gui/text/qfontengine_qpf.cpp | 3 ++- 17 files changed, 66 insertions(+), 35 deletions(-) diff --git a/src/gui/embedded/qkbd_defaultmap_qws_p.h b/src/gui/embedded/qkbd_defaultmap_qws_p.h index 2903492..a6c2d25 100644 --- a/src/gui/embedded/qkbd_defaultmap_qws_p.h +++ b/src/gui/embedded/qkbd_defaultmap_qws_p.h @@ -53,6 +53,8 @@ // We mean it. // +// no QT_BEGIN_NAMESPACE, since we include it internally... + const QWSKeyboard::Mapping QWSKbPrivate::s_keymap_default[] = { { 1, 0xffff, 0x01000000, 0x00, 0x00, 0x0000 }, { 2, 0x0031, 0x00000031, 0x00, 0x00, 0x0000 }, diff --git a/src/gui/embedded/qkbd_qws_p.h b/src/gui/embedded/qkbd_qws_p.h index df7ce1b..5af8f7c 100644 --- a/src/gui/embedded/qkbd_qws_p.h +++ b/src/gui/embedded/qkbd_qws_p.h @@ -55,6 +55,8 @@ #include +QT_BEGIN_NAMESPACE + namespace QWSKeyboard { const quint32 FileMagic = 0x514d4150; // 'QMAP' @@ -127,4 +129,6 @@ inline QDataStream &operator<<(QDataStream &ds, const QWSKeyboard::Composing &c) } #endif // QT_NO_DATASTREAM +QT_END_NAMESPACE + #endif // QWSKEYBOARD_H diff --git a/src/gui/embedded/qkbdqnx_qws.cpp b/src/gui/embedded/qkbdqnx_qws.cpp index 4f0b9de..6e147dd 100644 --- a/src/gui/embedded/qkbdqnx_qws.cpp +++ b/src/gui/embedded/qkbdqnx_qws.cpp @@ -49,6 +49,9 @@ #include "qplatformdefs.h" #include + +QT_BEGIN_NAMESPACE + /*! \class QWSQnxKeyboardHandler \preliminary @@ -229,3 +232,5 @@ void QWSQnxKeyboardHandler::socketActivated() // (on QNX, isPress is not set when the key event is repeated). processKeyEvent(unicode, key, modifiers, isPress || isRepeat, isRepeat); } + +QT_END_NAMESPACE diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp index c32e9b5..9f2d3b8 100644 --- a/src/gui/embedded/qlock.cpp +++ b/src/gui/embedded/qlock.cpp @@ -41,10 +41,11 @@ #include "qlock_p.h" -QT_BEGIN_NAMESPACE #ifdef QT_NO_QWS_MULTIPROCESS +QT_BEGIN_NAMESPACE + /* no multiprocess - use a dummy */ QLock::QLock(const QString & /*filename*/, char /*id*/, bool /*create*/) @@ -77,6 +78,8 @@ bool QLock::locked() const return data; } +QT_END_NAMESPACE + #else // QT_NO_QWS_MULTIPROCESS #include "qwssignalhandler_p.h" @@ -110,6 +113,9 @@ union semun { #include // overrides QT_OPEN + +QT_BEGIN_NAMESPACE + #define MAX_LOCKS 200 // maximum simultaneous read locks class QLockData @@ -324,6 +330,7 @@ bool QLock::locked() const return (data->count > 0); } +QT_END_NAMESPACE + #endif // QT_NO_QWS_MULTIPROCESS -QT_END_NAMESPACE diff --git a/src/gui/embedded/qmousetslib_qws.h b/src/gui/embedded/qmousetslib_qws.h index 4dd39b5..71672f0 100644 --- a/src/gui/embedded/qmousetslib_qws.h +++ b/src/gui/embedded/qmousetslib_qws.h @@ -73,8 +73,8 @@ protected: }; -QT_END_NAMESPACE #endif // QT_NO_QWS_MOUSE_TSLIB +QT_END_NAMESPACE QT_END_HEADER #endif // QMOUSETSLIB_QWS_H diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h index 275e83f..307c2fd 100644 --- a/src/gui/embedded/qscreen_qws.h +++ b/src/gui/embedded/qscreen_qws.h @@ -50,6 +50,8 @@ #include #include +struct fb_cmap; + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -169,8 +171,6 @@ private: #endif // QT_NO_QWS_CURSOR -struct fb_cmap; - // A (used) chunk of offscreen memory class QPoolEntry diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp index 69e5808..1679ef2 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.cpp +++ b/src/gui/embedded/qscreenlinuxfb_qws.cpp @@ -291,8 +291,8 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY); } - fb_fix_screeninfo finfo; - fb_var_screeninfo vinfo; + ::fb_fix_screeninfo finfo; + ::fb_var_screeninfo vinfo; //####################### // Shut up Valgrind memset(&vinfo, 0, sizeof(vinfo)); @@ -429,7 +429,7 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; int loopc; - fb_cmap startcmap; + ::fb_cmap startcmap; startcmap.start=0; startcmap.len=screencols; startcmap.red=(unsigned short int *) diff --git a/src/gui/embedded/qscreenlinuxfb_qws.h b/src/gui/embedded/qscreenlinuxfb_qws.h index eb47848..e3c712a 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.h +++ b/src/gui/embedded/qscreenlinuxfb_qws.h @@ -44,6 +44,11 @@ #include +struct fb_cmap; +struct fb_var_screeninfo; +struct fb_fix_screeninfo; + + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -70,9 +75,6 @@ public: }; -struct fb_cmap; -struct fb_var_screeninfo; -struct fb_fix_screeninfo; class QLinuxFbScreenPrivate; class Q_GUI_EXPORT QLinuxFbScreen : public QScreen diff --git a/src/gui/embedded/qscreenproxy_qws.cpp b/src/gui/embedded/qscreenproxy_qws.cpp index b566dc0..b87fdd1 100644 --- a/src/gui/embedded/qscreenproxy_qws.cpp +++ b/src/gui/embedded/qscreenproxy_qws.cpp @@ -45,6 +45,7 @@ #include +QT_BEGIN_NAMESPACE #ifndef QT_NO_QWS_CURSOR /*! @@ -629,4 +630,6 @@ QRegion QProxyScreen::region() const return QScreen::region(); } +QT_END_NAMESPACE + #endif // QT_NO_QWS_PROXYSCREEN diff --git a/src/gui/embedded/qscreenqnx_qws.cpp b/src/gui/embedded/qscreenqnx_qws.cpp index 70f6d6b..77fe13e 100644 --- a/src/gui/embedded/qscreenqnx_qws.cpp +++ b/src/gui/embedded/qscreenqnx_qws.cpp @@ -44,6 +44,8 @@ #include +QT_BEGIN_NAMESPACE + // This struct holds all the pointers to QNX's internals struct QQnxScreenContext { @@ -445,3 +447,4 @@ void QQnxScreen::exposeRegion(QRegion r, int changing) gf_draw_end(d->context); } +QT_END_NAMESPACE diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp index 2f5f39a..811943a 100644 --- a/src/gui/embedded/qsoundqss_qws.cpp +++ b/src/gui/embedded/qsoundqss_qws.cpp @@ -67,10 +67,10 @@ #include -QT_BEGIN_NAMESPACE - extern int errno; +QT_BEGIN_NAMESPACE + #define QT_QWS_SOUND_16BIT 1 // or 0, or undefined for always 0 #define QT_QWS_SOUND_STEREO 1 // or 0, or undefined for always 0 diff --git a/src/gui/embedded/qwsutils_qws.h b/src/gui/embedded/qwsutils_qws.h index 23e0104..fe959ef 100644 --- a/src/gui/embedded/qwsutils_qws.h +++ b/src/gui/embedded/qwsutils_qws.h @@ -44,6 +44,12 @@ #include +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + #ifndef QT_NO_SXE #define QWS_SOCK_BASE QUnixSocket #define QWS_SOCK_SERVER_BASE QUnixSocketServer @@ -58,12 +64,6 @@ class QTcpServer; class QWSSocket; class QWSServerSocket; -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - /******************************************************************** * * Convenient socket functions diff --git a/src/gui/image/qpixmap_qws.cpp b/src/gui/image/qpixmap_qws.cpp index e549900..a6c70a7 100644 --- a/src/gui/image/qpixmap_qws.cpp +++ b/src/gui/image/qpixmap_qws.cpp @@ -48,6 +48,9 @@ #include #include + +QT_BEGIN_NAMESPACE + QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) { QWidget *widget = QWidget::find(window); @@ -148,3 +151,5 @@ int QPixmap::qwsBytesPerLine() const return 0; } + +QT_END_NAMESPACE diff --git a/src/gui/inputmethod/qwsinputcontext_qws.cpp b/src/gui/inputmethod/qwsinputcontext_qws.cpp index 5d92e1c..371ff1d 100644 --- a/src/gui/inputmethod/qwsinputcontext_qws.cpp +++ b/src/gui/inputmethod/qwsinputcontext_qws.cpp @@ -111,8 +111,8 @@ void QWSInputContext::setFocusWidget( QWidget *w ) void QWSInputContext::widgetDestroyed(QWidget *w) { - if (w == ::activeWidget) - ::activeWidget = 0; + if (w == QT_PREPEND_NAMESPACE(activeWidget)) + QT_PREPEND_NAMESPACE(activeWidget) = 0; QInputContext::widgetDestroyed(w); } @@ -138,13 +138,13 @@ void QWSInputContext::mouseHandler( int x, QMouseEvent *event) QWidget *QWSInputContext::activeWidget() { - return ::activeWidget; + return QT_PREPEND_NAMESPACE(activeWidget); } bool QWSInputContext::isComposing() const { - return ::activeWidget != 0; + return QT_PREPEND_NAMESPACE(activeWidget) != 0; } bool QWSInputContext::translateIMQueryEvent(QWidget *w, const QWSIMQueryEvent *e) @@ -182,8 +182,8 @@ bool QWSInputContext::translateIMEvent(QWidget *w, const QWSIMEvent *e) stream >> preedit; stream >> commit; - if (preedit.isEmpty() && ::activeWidget) - w = ::activeWidget; + if (preedit.isEmpty() && QT_PREPEND_NAMESPACE(activeWidget)) + w = QT_PREPEND_NAMESPACE(activeWidget); QInputContext *qic = w->inputContext(); if (!qic) @@ -213,9 +213,9 @@ bool QWSInputContext::translateIMEvent(QWidget *w, const QWSIMEvent *e) #endif if (preedit.isEmpty()) - ::activeWidget = 0; + QT_PREPEND_NAMESPACE(activeWidget) = 0; else - ::activeWidget = w; + QT_PREPEND_NAMESPACE(activeWidget) = w; QInputMethodEvent ime(preedit, attrs); diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index f7a7ab0..5340ae9 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -72,6 +72,7 @@ //#include "qwsregionmanager_qws.h" #include "qwindowsystem_qws.h" #include "private/qwindowsystem_p.h" +#include "qdecorationfactory_qws.h" #include "qwsdisplay_qws.h" #include "private/qwsdisplay_qws_p.h" @@ -122,6 +123,8 @@ #endif #endif +QT_BEGIN_NAMESPACE + #ifndef QT_NO_DIRECTPAINTER class QDirectPainter; extern void qt_directpainter_region(QDirectPainter *dp, const QRegion &alloc, int type); @@ -161,13 +164,9 @@ int qt_servershmid = -1; bool qws_overrideCursor = false; #ifndef QT_NO_QWS_MANAGER -#include "qdecorationfactory_qws.h" extern Q_GUI_EXPORT QWSServer *qwsServer; -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE static QDecoration *qws_decoration = 0; #endif @@ -2371,7 +2370,7 @@ void qt_cleanup() QString QApplicationPrivate::appName() const // get application name { - return ::appName; + return QT_PREPEND_NAMESPACE(appName); } /***************************************************************************** diff --git a/src/gui/kernel/qsound_qws.cpp b/src/gui/kernel/qsound_qws.cpp index fa32dcd..83e9c5e 100644 --- a/src/gui/kernel/qsound_qws.cpp +++ b/src/gui/kernel/qsound_qws.cpp @@ -53,16 +53,16 @@ #include "qhash.h" #include "qfileinfo.h" -#ifdef MEDIA_SERVER #include "qbytearray.h" #include "quuid.h" #include "qdatastream.h" #include "qcopchannel_qws.h" #include "qbuffer.h" + QT_BEGIN_NAMESPACE -QT_USE_NAMESPACE +#ifdef MEDIA_SERVER #define SERVER_CHANNEL "QPE/MediaServer" diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index e05a502..05dea6e 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -66,9 +66,10 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_QWS_QPF2 -QT_BEGIN_INCLUDE_NAMESPACE #include "qpfutil.cpp" +QT_BEGIN_INCLUDE_NAMESPACE + #if defined(Q_WS_QWS) # include "private/qwscommand_qws_p.h" # include "qwsdisplay_qws.h" -- cgit v0.12 From 54226926faa44ec532efd0745e0ff64781202844 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 26 Aug 2009 10:56:49 +0200 Subject: Regression found in 4.5.2 and 4.6: artifacts when scrolling during animation. Auto-test submitted. Task-number: 259503 Reviewed-by: bnilsen --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 60 ++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 505f9a4..3b6e8a7 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -217,6 +217,7 @@ private slots: void task245469_itemsAtPointWithClip(); void task253415_reconnectUpdateSceneOnSceneChanged(); void task255529_transformationAnchorMouseAndViewportMargins(); + void task259503_scrollingArtifacts(); }; void tst_QGraphicsView::initTestCase() @@ -3663,6 +3664,65 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins() QVERIFY(qAbs(newMouseScenePos.y() - mouseScenePos.y()) < slack); } +void tst_QGraphicsView::task259503_scrollingArtifacts() +{ + QGraphicsScene scene(0, 0, 800, 600); + + QGraphicsRectItem card; + card.setRect(0, 0, 50, 50); + card.setPen(QPen(Qt::darkRed)); + card.setBrush(QBrush(Qt::cyan)); + card.setZValue(2.0); + card.setPos(300, 300); + scene.addItem(&card); + + class SAGraphicsView: public QGraphicsView + { + public: + SAGraphicsView(QGraphicsScene *scene) + : QGraphicsView(scene) + , itSTimeToTest(false) + { + setViewportUpdateMode( QGraphicsView::MinimalViewportUpdate ); + resize(QSize(640, 480)); + } + + QRegion updateRegion; + bool itSTimeToTest; + + void paintEvent(QPaintEvent *event) + { + QGraphicsView::paintEvent(event); + + if (itSTimeToTest) + { + qDebug() << event->region(); + qDebug() << updateRegion; + QCOMPARE(event->region(), updateRegion); + } + } + }; + + SAGraphicsView view(&scene); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + + int hsbValue = view.horizontalScrollBar()->value(); + view.horizontalScrollBar()->setValue(hsbValue / 2); + QTest::qWait(10); + view.horizontalScrollBar()->setValue(0); + QTest::qWait(10); + + QRect itemDeviceBoundingRect = card.deviceTransform(view.viewportTransform()).mapRect(card.boundingRect()).toRect(); + itemDeviceBoundingRect.adjust(-2, -2, 2, 2); + view.updateRegion = itemDeviceBoundingRect; + view.updateRegion += itemDeviceBoundingRect.translated(-100, 0); + view.itSTimeToTest = true; + card.setPos(200, 300); + QTest::qWait(10); +} QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" -- cgit v0.12 From 6eb08228397400be1141611dd96cdad12161d016 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 26 Aug 2009 10:18:10 +0200 Subject: Skip the 'symbian' tests on other platforms. Add "requires(symbian)" to the .pro file so this test will not be executed on other platforms. Reviewed-by: Rohan McGovern --- tests/auto/symbian/qsymbiantests.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/symbian/qsymbiantests.pro b/tests/auto/symbian/qsymbiantests.pro index 648335e..a752c86 100644 --- a/tests/auto/symbian/qsymbiantests.pro +++ b/tests/auto/symbian/qsymbiantests.pro @@ -1,2 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qmainexceptions orientationchange \ No newline at end of file +SUBDIRS = qmainexceptions orientationchange + +requires(symbian) -- cgit v0.12 From 01255c3b33de2f72ff0b8802e8bea0ea79998f00 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 26 Aug 2009 10:21:10 +0200 Subject: Make the 'effects' examples compile when qreal == float. All of the types supplied to qBound() must be the same and in the case where qreal is typedef'ed to a float, this is not the case because the outer 2 arguments are considered doubles. We explicitly cast them to qreal to guarantee they are all the same type. Reviewed-by: bnilsen --- examples/effects/blurpicker/blureffect.cpp | 2 +- examples/effects/customshader/blureffect.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/effects/blurpicker/blureffect.cpp b/examples/effects/blurpicker/blureffect.cpp index f0fde49..0b806aa 100644 --- a/examples/effects/blurpicker/blureffect.cpp +++ b/examples/effects/blurpicker/blureffect.cpp @@ -52,7 +52,7 @@ BlurEffect::BlurEffect(QGraphicsItem *item) void BlurEffect::adjustForItem() { qreal y = m_baseLine - item->pos().y(); - qreal radius = qBound(0.0, y / 32, 16.0); + qreal radius = qBound(qreal(0.0), y / 32, qreal(16.0)); setBlurRadius(radius); } diff --git a/examples/effects/customshader/blureffect.cpp b/examples/effects/customshader/blureffect.cpp index 8e2a1fe..9923324 100644 --- a/examples/effects/customshader/blureffect.cpp +++ b/examples/effects/customshader/blureffect.cpp @@ -52,7 +52,7 @@ BlurEffect::BlurEffect(QGraphicsItem *item) void BlurEffect::adjustForItem() { qreal y = m_baseLine - item->pos().y(); - qreal radius = qBound(0.0, y / 32, 16.0); + qreal radius = qBound(qreal(0.0), y / 32, qreal(16.0)); setBlurRadius(radius); } -- cgit v0.12 From d95d33e67129eaa843fc0582abfe2f25ce87847d Mon Sep 17 00:00:00 2001 From: Frank Osterfeld Date: Wed, 26 Aug 2009 10:53:35 +0200 Subject: QXmlSimpleReader: fix crash Don't crash when parsing "" (unmatched "< tag followed by "foo:") using QDomDocument::setContent together with a QXmlSimpleReader with the "http://xml.org/sax/features/namespaces" feature enabled. Fixes task tracker issue 254700. See there for a test case. Merge-request: 1322 Reviewed-by: Peter Hartmann --- src/xml/dom/qdom.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 7709c28..ac6ba37 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -7406,7 +7406,9 @@ bool QDomHandler::startElement(const QString& nsURI, const QString&, const QStri } else { n = doc->createElement(qName); } - n->setLocation(locator->lineNumber(), locator->columnNumber()); + + if (n) + n->setLocation(locator->lineNumber(), locator->columnNumber()); node->appendChild(n); node = n; @@ -7426,7 +7428,7 @@ bool QDomHandler::startElement(const QString& nsURI, const QString&, const QStri bool QDomHandler::endElement(const QString&, const QString&, const QString&) { - if (node == doc) + if (!node || node == doc) return false; node = node->parent(); -- cgit v0.12 From 796d7cc7dd96cea9875afe2e9cf814e8cb192aa1 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 26 Aug 2009 11:24:41 +0200 Subject: remove some platform-specific expected failures in JS testsuite These might work with the new JavaScriptCore-based back-end. Will re-add any expected failures once the autotest results are in from the platforms tested on Pulse. --- .../qscriptjstestsuite/tst_qscriptjstestsuite.cpp | 47 ---------------------- 1 file changed, 47 deletions(-) diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp index f77738f..56b7df8 100644 --- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp +++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp @@ -400,7 +400,6 @@ tst_Suite::tst_Suite() } QString willFixInNextReleaseMessage = QString::fromLatin1("Will fix in next release"); - QString brokenOnSomePlatformsMessage = QString::fromLatin1("Doesn't behave the same on all platforms"); QString fromCharCodeMessage = QString::fromLatin1("Test is wrong?"); for (int i = 4256; i < 4294; ++i) { addExpectedFailure("ecma/String/15.5.4.11-2.js", QString::fromLatin1("var s = new String( String.fromCharCode(%0) ); s.toLowerCase().charCodeAt(0)").arg(i), fromCharCodeMessage); @@ -418,61 +417,15 @@ tst_Suite::tst_Suite() addExpectedFailure("ecma/extensions/15.1.2.1-1.js", "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", willFixInNextReleaseMessage); addExpectedFailure("ecma/GlobalObject/15.1.2.2-1.js", "var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS", willFixInNextReleaseMessage); - addSkip("ecma/GlobalObject/15.1.2.2-2.js", "parseInt(s,36)", brokenOnSomePlatformsMessage); - addExpectedFailure("ecma/GlobalObject/15.1.2.3-1.js", "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", willFixInNextReleaseMessage); addExpectedFailure("ecma/GlobalObject/15.1.2.4.js", "var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS", willFixInNextReleaseMessage); addExpectedFailure("ecma/GlobalObject/15.1.2.5-1.js", "var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS", willFixInNextReleaseMessage); addExpectedFailure("ecma/GlobalObject/15.1.2.6.js", "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS", willFixInNextReleaseMessage); addExpectedFailure("ecma/GlobalObject/15.1.2.7.js", "var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS", willFixInNextReleaseMessage); - // qstrtod() has problems parsing reaaaaally big numbers -- they come out as NaN rather than Infinity or Number.MAX_VALUE - addSkip("ecma/TypeConversion/9.3.1-3.js", "parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity", brokenOnSomePlatformsMessage); - addSkip("ecma/TypeConversion/9.3.1-3.js", "parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308", brokenOnSomePlatformsMessage); - addSkip("ecma/TypeConversion/9.3.1-3.js", "parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity", brokenOnSomePlatformsMessage); - addSkip("ecma/TypeConversion/9.3.1-3.js", "parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308", brokenOnSomePlatformsMessage); - addSkip("ecma/TypeConversion/9.3.1-3.js", "parseInt(s,36)", brokenOnSomePlatformsMessage); - -#if defined(Q_OS_SOLARIS) - addExpectedFailure("ecma/Math/15.8.2.2.js", "Math.acos(11.00000001)", "Fails on Solaris"); - addExpectedFailure("ecma/Math/15.8.2.3.js", "Math.asin(-1.000001)", "Fails on Solaris"); -#endif - addExpectedFailure(QRegExp(), "NO TESTS EXIST", willFixInNextReleaseMessage); - addExpectedFailure("ecma_2/RegExp/multiline-001.js", "/.*[y]$/m.exec(ivory-billed\ndowny\nhairy\nacorn\nyellow-bellied sapsucker\nnorthern flicker\npileated\n)", willFixInNextReleaseMessage); - addExpectedFailure("ecma_2/RegExp/multiline-001.js", "/.*[d]$/m.exec(ivory-billed\ndowny\nhairy\nacorn\nyellow-bellied sapsucker\nnorthern flicker\npileated\n)", willFixInNextReleaseMessage); - addExpectedFailure("ecma_2/String/match-002.js", "//.toString()", willFixInNextReleaseMessage); - -#if defined(Q_WS_WIN) - addExpectedFailure(QRegExp(), "VAR1 = 0; VAR2= Infinity; VAR1 %= VAR2;VAR1", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "VAR1 = -0; VAR2= Infinity; VAR1 %= VAR2;VAR1", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "VAR1 = 0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "VAR1 = -0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "VAR1 = 1; VAR2= Infinity; VAR1 %= VAR2;VAR1", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "VAR1 = -1; VAR2= Infinity; VAR1 %= VAR2;VAR1", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "VAR1 = -1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "VAR1 = 1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "1 % Number.NEGATIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "1 % Number.POSITIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "-1 % Number.POSITIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "-1 % Number.NEGATIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "Number.MAX_VALUE % Number.NEGATIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "Number.MAX_VALUE % Number.POSITIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "-Number.MAX_VALUE % Number.POSITIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "-Number.MAX_VALUE % Number.NEGATIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "0 % Number.POSITIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "0 % Number.NEGATIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "-0 % Number.POSITIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "-0 % Number.NEGATIVE_INFINITY", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "Math.atan2(Infinity, Infinity)", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "Math.atan2(Infinity, -Infinity)", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "Math.atan2(-Infinity, Infinity)", willFixInNextReleaseMessage); - addExpectedFailure(QRegExp(), "Math.atan2(-Infinity, -Infinity)", willFixInNextReleaseMessage); -#endif - addExpectedFailure("ecma_3/Array/15.4.5.1-01.js", "15.4.5.1 - array.length coverage", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/ExecutionContexts/10.1.4-1.js", "Expected to be able to delete x", willFixInNextReleaseMessage); addExpectedFailure("ecma_3/extensions/regress-228087-002.js", "Section 1 of test - \nregexp = /{1.*}/g\n" -- cgit v0.12 From dad83c695e968d7c9fb0be2f4636cf14d34fb8a1 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 26 Aug 2009 11:25:08 +0200 Subject: fix warnings on Windows CE Lots of warnings in the qreal == float case. Some Q_UNUSED added. Reviewed-by: thartman --- src/corelib/io/qfsfileengine_win.cpp | 2 ++ src/gui/effects/qgraphicseffect_p.h | 2 +- src/gui/graphicsview/qsimplex_p.cpp | 2 +- src/gui/kernel/qwidget.cpp | 5 ++++- src/gui/widgets/qmenu.cpp | 2 ++ src/gui/widgets/qplaintextedit.cpp | 2 +- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index a8de17b..e1fc804 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -1289,6 +1289,8 @@ static QString readSymLink(const QString &link) qFree(rdb); CloseHandle(handle); } +#else + Q_UNUSED(link); #endif // Q_OS_WINCE return result; } diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 175bd99..6ce5cda 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -164,7 +164,7 @@ class QGraphicsOpacityEffectPrivate : public QGraphicsEffectPrivate { Q_DECLARE_PUBLIC(QGraphicsOpacityEffect) public: - QGraphicsOpacityEffectPrivate() : opacity(0.7) {} + QGraphicsOpacityEffectPrivate() : opacity(qreal(0.7)) {} ~QGraphicsOpacityEffectPrivate() {} qreal opacity; diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp index dbd8d4f..30a7d5d 100644 --- a/src/gui/graphicsview/qsimplex_p.cpp +++ b/src/gui/graphicsview/qsimplex_p.cpp @@ -293,7 +293,7 @@ int QSimplex::findPivotColumn() int QSimplex::pivotRowForColumn(int column) { - qreal min = 999999999999.0; // ### + qreal min = qreal(999999999999.0); // ### int minIndex = -1; for (int i = 1; i < rows; ++i) { diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 6ffac2c..7e88e9f 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -971,7 +971,10 @@ struct QWidgetExceptionCleaner /* this cleans up when the constructor throws an exception */ static inline void cleanup(QWidget *that, QWidgetPrivate *d) { -#ifndef QT_NO_EXCEPTIONS +#ifdef QT_NO_EXCEPTIONS + Q_UNUSED(that); + Q_UNUSED(d); +#else QWidgetPrivate::allWidgets->remove(that); if (d->focus_next != that) { if (d->focus_next) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index f0f425f..4734d22 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -368,7 +368,9 @@ QRect QMenuPrivate::actionRect(QAction *act) const return actionRects.at(index); } +#if defined(Q_WS_MAC) static const qreal MenuFadeTimeInSec = 0.150; +#endif void QMenuPrivate::hideUpToMenuBar() { diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index e025876..4ea18f8 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -379,7 +379,7 @@ void QPlainTextDocumentLayout::layoutBlock(const QTextBlock &block) tl->beginLayout(); qreal availableWidth = d->width; if (availableWidth <= 0) { - availableWidth = INT_MAX; // similar to text edit with pageSize.width == 0 + availableWidth = qreal(INT_MAX); // similar to text edit with pageSize.width == 0 } availableWidth -= 2*margin + extraMargin; while (1) { -- cgit v0.12 From 62e3fc09211f0739f37672c18fc19b1a18bbbf62 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 26 Aug 2009 11:53:30 +0200 Subject: Fix "We mean it." comments in graphicsview --- src/gui/graphicsview/qgraphicsitem_p.h | 4 ++-- src/gui/graphicsview/qgraphicslayout_p.h | 4 ++-- src/gui/graphicsview/qgraphicslayoutitem_p.h | 4 ++-- src/gui/graphicsview/qgraphicsproxywidget_p.h | 4 ++-- src/gui/graphicsview/qgraphicsscene_p.h | 4 ++-- src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h | 4 ++-- src/gui/graphicsview/qgraphicssceneindex_p.h | 4 ++-- src/gui/graphicsview/qgraphicstransform_p.h | 4 ++-- src/gui/graphicsview/qgraphicsview_p.h | 4 ++-- src/gui/graphicsview/qgraphicswidget_p.h | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 11f6f53..bf5d832 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicslayout_p.h b/src/gui/graphicsview/qgraphicslayout_p.h index 2ad853b..0e43b55 100644 --- a/src/gui/graphicsview/qgraphicslayout_p.h +++ b/src/gui/graphicsview/qgraphicslayout_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicslayoutitem_p.h b/src/gui/graphicsview/qgraphicslayoutitem_p.h index 5bda3ca..4d9a8c9 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem_p.h +++ b/src/gui/graphicsview/qgraphicslayoutitem_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicsproxywidget_p.h b/src/gui/graphicsview/qgraphicsproxywidget_p.h index e2be89c..04fe40a 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget_p.h +++ b/src/gui/graphicsview/qgraphicsproxywidget_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 4b8791e..ffef1c7 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 27c499d..5cc8449 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -44,8 +44,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index d922036..00e5f89 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicstransform_p.h b/src/gui/graphicsview/qgraphicstransform_p.h index 2c563e4..c9b95fd 100644 --- a/src/gui/graphicsview/qgraphicstransform_p.h +++ b/src/gui/graphicsview/qgraphicstransform_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index bdf5ddd..a40dfdc 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index 0e1fe46..1ee79e1 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -47,8 +47,8 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // -- cgit v0.12 From 9f5b3ad02302dd7e0ec06aa6a73c61bd2c8f287d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Wed, 26 Aug 2009 12:01:57 +0200 Subject: Fixed compilation on gcc 3.3 and mutex locker lifetime This fixes the lifetime of the mutex locker, since before it would already be destroyed on the next line. Reviewed-by: Olivier Goffart --- src/corelib/kernel/qobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 2117a2d..ddfc44f 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2459,7 +2459,7 @@ QObject *QObject::sender() const { Q_D(const QObject); - QMutexLocker(signalSlotLock(this)); + QMutexLocker locker(signalSlotLock(this)); if (!d->currentSender) return 0; -- cgit v0.12 From ce737d384897640725ff8b646632a108b7308cec Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 26 Aug 2009 20:29:16 +1000 Subject: Fix license headers. Reviewed-by: Trust Me --- tests/auto/mediaobject/dummy/audiooutput.h | 41 ++++++++++++++++++++++ tests/auto/mediaobject/dummy/backend.h | 41 ++++++++++++++++++++++ tests/auto/mediaobject/dummy/mediaobject.h | 41 ++++++++++++++++++++++ tests/auto/mediaobject/dummy/videowidget.h | 41 ++++++++++++++++++++++ .../xmlpatternsview/view/FunctionSignaturesView.h | 41 ---------------------- tests/auto/xmlpatternsview/view/MainWindow.h | 41 ---------------------- tests/auto/xmlpatternsview/view/TestCaseView.h | 41 ---------------------- tests/auto/xmlpatternsview/view/TestResultView.h | 41 ---------------------- tests/auto/xmlpatternsview/view/TreeSortFilter.h | 41 ---------------------- tests/auto/xmlpatternsview/view/UserTestCase.h | 41 ---------------------- tests/auto/xmlpatternsview/view/XDTItemItem.h | 41 ---------------------- tests/auto/xmlpatternsxqts/lib/TestGroup.h | 41 ---------------------- 12 files changed, 164 insertions(+), 328 deletions(-) diff --git a/tests/auto/mediaobject/dummy/audiooutput.h b/tests/auto/mediaobject/dummy/audiooutput.h index 39efb55..47fb9f0 100644 --- a/tests/auto/mediaobject/dummy/audiooutput.h +++ b/tests/auto/mediaobject/dummy/audiooutput.h @@ -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 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$ +** +****************************************************************************/ + #ifndef PHONON_DUMMY_AUDIOOUTPUT_H #define PHONON_DUMMY_AUDIOOUTPUT_H diff --git a/tests/auto/mediaobject/dummy/backend.h b/tests/auto/mediaobject/dummy/backend.h index 20af216..b7302dd 100644 --- a/tests/auto/mediaobject/dummy/backend.h +++ b/tests/auto/mediaobject/dummy/backend.h @@ -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 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$ +** +****************************************************************************/ + #ifndef PHONON_DUMMY_BACKEND_H #define PHONON_DUMMY_BACKEND_H diff --git a/tests/auto/mediaobject/dummy/mediaobject.h b/tests/auto/mediaobject/dummy/mediaobject.h index a87b32f..e4c7978 100644 --- a/tests/auto/mediaobject/dummy/mediaobject.h +++ b/tests/auto/mediaobject/dummy/mediaobject.h @@ -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 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$ +** +****************************************************************************/ + #ifndef PHONON_DUMMY_MEDIAOBJECT_H #define PHONON_DUMMY_MEDIAOBJECT_H diff --git a/tests/auto/mediaobject/dummy/videowidget.h b/tests/auto/mediaobject/dummy/videowidget.h index 2e5a2b8..a8416f9 100644 --- a/tests/auto/mediaobject/dummy/videowidget.h +++ b/tests/auto/mediaobject/dummy/videowidget.h @@ -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 test sutie 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$ +** +****************************************************************************/ + #ifndef PHONON_DUMMY_VIDEOWIDGET_H #define PHONON_DUMMY_VIDEOWIDGET_H diff --git a/tests/auto/xmlpatternsview/view/FunctionSignaturesView.h b/tests/auto/xmlpatternsview/view/FunctionSignaturesView.h index ff02f21..8ccd346 100644 --- a/tests/auto/xmlpatternsview/view/FunctionSignaturesView.h +++ b/tests/auto/xmlpatternsview/view/FunctionSignaturesView.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_FunctionSignaturesView_H #define PatternistSDK_FunctionSignaturesView_H diff --git a/tests/auto/xmlpatternsview/view/MainWindow.h b/tests/auto/xmlpatternsview/view/MainWindow.h index 71bfec2..9aa1d1a 100644 --- a/tests/auto/xmlpatternsview/view/MainWindow.h +++ b/tests/auto/xmlpatternsview/view/MainWindow.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_MainWindow_H #define PatternistSDK_MainWindow_H diff --git a/tests/auto/xmlpatternsview/view/TestCaseView.h b/tests/auto/xmlpatternsview/view/TestCaseView.h index 601422d..9329242 100644 --- a/tests/auto/xmlpatternsview/view/TestCaseView.h +++ b/tests/auto/xmlpatternsview/view/TestCaseView.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_TestCaseView_H #define PatternistSDK_TestCaseView_H diff --git a/tests/auto/xmlpatternsview/view/TestResultView.h b/tests/auto/xmlpatternsview/view/TestResultView.h index 6f5583f..006c690 100644 --- a/tests/auto/xmlpatternsview/view/TestResultView.h +++ b/tests/auto/xmlpatternsview/view/TestResultView.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_TestResultView_H #define PatternistSDK_TestResultView_H diff --git a/tests/auto/xmlpatternsview/view/TreeSortFilter.h b/tests/auto/xmlpatternsview/view/TreeSortFilter.h index c6d9432..a083b0a 100644 --- a/tests/auto/xmlpatternsview/view/TreeSortFilter.h +++ b/tests/auto/xmlpatternsview/view/TreeSortFilter.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_TreeSortFilter_H #define PatternistSDK_TreeSortFilter_H diff --git a/tests/auto/xmlpatternsview/view/UserTestCase.h b/tests/auto/xmlpatternsview/view/UserTestCase.h index 8da081a..39ef38e 100644 --- a/tests/auto/xmlpatternsview/view/UserTestCase.h +++ b/tests/auto/xmlpatternsview/view/UserTestCase.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_UserTestCase_H #define PatternistSDK_UserTestCase_H diff --git a/tests/auto/xmlpatternsview/view/XDTItemItem.h b/tests/auto/xmlpatternsview/view/XDTItemItem.h index 0e0f06e..240d1bb 100644 --- a/tests/auto/xmlpatternsview/view/XDTItemItem.h +++ b/tests/auto/xmlpatternsview/view/XDTItemItem.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_XDTItemItem_H #define PatternistSDK_XDTItemItem_H diff --git a/tests/auto/xmlpatternsxqts/lib/TestGroup.h b/tests/auto/xmlpatternsxqts/lib/TestGroup.h index 6946fac..8c5cbf6 100644 --- a/tests/auto/xmlpatternsxqts/lib/TestGroup.h +++ b/tests/auto/xmlpatternsxqts/lib/TestGroup.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_TestGroup_H #define PatternistSDK_TestGroup_H -- cgit v0.12 From 04c67e5330626853b9277b88e92a79bb7837990b Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 26 Aug 2009 20:49:22 +1000 Subject: Fix duplicated license headers. Reviewed-by: Trust Me --- tests/auto/xmlpatternsxqts/lib/ErrorHandler.h | 41 ---------------------- tests/auto/xmlpatternsxqts/lib/ErrorItem.h | 41 ---------------------- tests/auto/xmlpatternsxqts/lib/ExitCode.h | 41 ---------------------- tests/auto/xmlpatternsxqts/lib/ExpressionInfo.h | 41 ---------------------- tests/auto/xmlpatternsxqts/lib/TestContainer.h | 41 ---------------------- tests/auto/xmlpatternsxqts/lib/TestItem.h | 41 ---------------------- tests/auto/xmlpatternsxqts/lib/TestSuite.h | 41 ---------------------- tests/auto/xmlpatternsxqts/lib/TestSuiteResult.h | 41 ---------------------- tests/auto/xmlpatternsxqts/lib/TreeItem.h | 41 ---------------------- tests/auto/xmlpatternsxqts/lib/TreeModel.h | 41 ---------------------- .../xmlpatternsxqts/lib/XSLTTestSuiteHandler.h | 41 ---------------------- .../auto/xmlpatternsxqts/lib/tests/XMLWriterTest.h | 41 ---------------------- 12 files changed, 492 deletions(-) diff --git a/tests/auto/xmlpatternsxqts/lib/ErrorHandler.h b/tests/auto/xmlpatternsxqts/lib/ErrorHandler.h index c056ac4..81f4c73 100644 --- a/tests/auto/xmlpatternsxqts/lib/ErrorHandler.h +++ b/tests/auto/xmlpatternsxqts/lib/ErrorHandler.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_ErrorHandler_H #define PatternistSDK_ErrorHandler_H diff --git a/tests/auto/xmlpatternsxqts/lib/ErrorItem.h b/tests/auto/xmlpatternsxqts/lib/ErrorItem.h index f8cfa63..be28892 100644 --- a/tests/auto/xmlpatternsxqts/lib/ErrorItem.h +++ b/tests/auto/xmlpatternsxqts/lib/ErrorItem.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_ErrorItem_H #define PatternistSDK_ErrorItem_H diff --git a/tests/auto/xmlpatternsxqts/lib/ExitCode.h b/tests/auto/xmlpatternsxqts/lib/ExitCode.h index daed618..c23bd4b 100644 --- a/tests/auto/xmlpatternsxqts/lib/ExitCode.h +++ b/tests/auto/xmlpatternsxqts/lib/ExitCode.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_ExitCode_H #define PatternistSDK_ExitCode_H diff --git a/tests/auto/xmlpatternsxqts/lib/ExpressionInfo.h b/tests/auto/xmlpatternsxqts/lib/ExpressionInfo.h index 3877674..973f347 100644 --- a/tests/auto/xmlpatternsxqts/lib/ExpressionInfo.h +++ b/tests/auto/xmlpatternsxqts/lib/ExpressionInfo.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_ExpressionInfo_H #define PatternistSDK_ExpressionInfo_H diff --git a/tests/auto/xmlpatternsxqts/lib/TestContainer.h b/tests/auto/xmlpatternsxqts/lib/TestContainer.h index 91a8641..9ed87bf 100644 --- a/tests/auto/xmlpatternsxqts/lib/TestContainer.h +++ b/tests/auto/xmlpatternsxqts/lib/TestContainer.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_TestContainer_H #define PatternistSDK_TestContainer_H diff --git a/tests/auto/xmlpatternsxqts/lib/TestItem.h b/tests/auto/xmlpatternsxqts/lib/TestItem.h index 6d151b8..4266480 100644 --- a/tests/auto/xmlpatternsxqts/lib/TestItem.h +++ b/tests/auto/xmlpatternsxqts/lib/TestItem.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_TestItem_H #define PatternistSDK_TestItem_H diff --git a/tests/auto/xmlpatternsxqts/lib/TestSuite.h b/tests/auto/xmlpatternsxqts/lib/TestSuite.h index 638caad..70aefc0 100644 --- a/tests/auto/xmlpatternsxqts/lib/TestSuite.h +++ b/tests/auto/xmlpatternsxqts/lib/TestSuite.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_TestSuite_H #define PatternistSDK_TestSuite_H diff --git a/tests/auto/xmlpatternsxqts/lib/TestSuiteResult.h b/tests/auto/xmlpatternsxqts/lib/TestSuiteResult.h index 492f4ae..62d204e 100644 --- a/tests/auto/xmlpatternsxqts/lib/TestSuiteResult.h +++ b/tests/auto/xmlpatternsxqts/lib/TestSuiteResult.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_TestSuiteResult_H #define PatternistSDK_TestSuiteResult_H diff --git a/tests/auto/xmlpatternsxqts/lib/TreeItem.h b/tests/auto/xmlpatternsxqts/lib/TreeItem.h index bebc7d3..9275828 100644 --- a/tests/auto/xmlpatternsxqts/lib/TreeItem.h +++ b/tests/auto/xmlpatternsxqts/lib/TreeItem.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_TreeItem_H #define PatternistSDK_TreeItem_H diff --git a/tests/auto/xmlpatternsxqts/lib/TreeModel.h b/tests/auto/xmlpatternsxqts/lib/TreeModel.h index 39a3173..181f25e 100644 --- a/tests/auto/xmlpatternsxqts/lib/TreeModel.h +++ b/tests/auto/xmlpatternsxqts/lib/TreeModel.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_TreeModel_H #define PatternistSDK_TreeModel_H diff --git a/tests/auto/xmlpatternsxqts/lib/XSLTTestSuiteHandler.h b/tests/auto/xmlpatternsxqts/lib/XSLTTestSuiteHandler.h index eb9d604..8447cff 100644 --- a/tests/auto/xmlpatternsxqts/lib/XSLTTestSuiteHandler.h +++ b/tests/auto/xmlpatternsxqts/lib/XSLTTestSuiteHandler.h @@ -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 Qt 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$ -** -*************************************************************************** -*/ #ifndef PatternistSDK_XSLTTestSuiteHandler_H #define PatternistSDK_XSLTTestSuiteHandler_H diff --git a/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.h b/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.h index 5314a10..b8ff3ad 100644 --- a/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.h +++ b/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.h @@ -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 Qt 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$ -** -*************************************************************************** - */ #ifndef PatternistSDK_XMLWriterTest_H #define PatternistSDK_XMLWriterTest_H -- cgit v0.12 From b5ae51f7b9a127b10034aa76dd631ac94eb75347 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 26 Aug 2009 12:14:10 +0200 Subject: Fix warning. The member need to be initialized in the same order as in which they are declared Reviewed-by: Thierry --- src/gui/kernel/qwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7e88e9f..62d0848 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -187,6 +187,9 @@ QWidgetPrivate::QWidgetPrivate(int version) , extraPaintEngine(0) , polished(0) , graphicsEffect(0) +#if !defined(QT_NO_IM) + , imHints(Qt::ImhNone) +#endif , inheritedFontResolveMask(0) , inheritedPaletteResolveMask(0) , leftmargin(0) @@ -217,7 +220,6 @@ QWidgetPrivate::QWidgetPrivate(int version) , window_event(0) , qd_hd(0) #endif - ,imHints(Qt::ImhNone) { if (!qApp) { qFatal("QWidget: Must construct a QApplication before a QPaintDevice"); -- cgit v0.12 From 7d40a2ad8ba95fd7c6b51107d2d98aad0e22ca9e Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Wed, 26 Aug 2009 13:03:43 +0200 Subject: Doc - Completed review of documentation for the QGraphicsEffect group of classes Reviewed-By: TrustMe --- src/gui/effects/qgraphicseffect.cpp | 172 ++++++++++++++++++++---------------- 1 file changed, 95 insertions(+), 77 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index a6aef52..9ed01df 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -112,12 +112,12 @@ QT_BEGIN_NAMESPACE QGraphicsEffect is installed on. \since 4.6 - When a QGraphicsEffect is installed on a QGraphicsItem, for example, this class will act as - a wrapper around QGraphicsItem. E.g. calling update() is effectively the same as - calling QGraphicsItem::update(). + When a QGraphicsEffect is installed on a QGraphicsItem, for example, this + class will act as a wrapper around QGraphicsItem. Then, calling update() is + effectively the same as calling QGraphicsItem::update(). - It also provides a pixmap() function which creates a pixmap with the source - painted into it. + QGraphicsEffectSource also provides a pixmap() function which creates a + pixmap with the source painted into it. \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect. */ @@ -131,10 +131,11 @@ QGraphicsEffectSource::~QGraphicsEffectSource() /*! Returns the bounds of the current painter's device. - This function is useful when you e.g. want to draw something in device coordinates - and want to make sure the size of the pixmap is not bigger than the device's size. + This function is useful when you want to draw something in device + coordinates and ensure the size of the pixmap is not bigger than the size + of the device. - Note that calling QGraphicsEffectSource::pixmap(Qt::DeviceCoordinates) always returns + Calling QGraphicsEffectSource::pixmap(Qt::DeviceCoordinates) always returns a pixmap which is bound to the device's size. \sa pixmap() @@ -145,7 +146,7 @@ QRect QGraphicsEffectSource::deviceRect() const } /*! - Returns the bounding rectangle of the source mapped to the \a system specified. + Returns the bounding rectangle of the source mapped to the given \a system. \sa draw() */ @@ -155,8 +156,8 @@ QRectF QGraphicsEffectSource::boundingRect(Qt::CoordinateSystem system) const } /*! - Returns a pointer to the item if this source is a QGraphicsItem; - otherwise returns 0; + Returns a pointer to the item if this source is a QGraphicsItem; otherwise + returns 0. \sa widget() */ @@ -166,8 +167,8 @@ const QGraphicsItem *QGraphicsEffectSource::graphicsItem() const } /*! - Returns a pointer to the widget if this source is a QWidget; - otherwise returns 0; + Returns a pointer to the widget if this source is a QWidget; otherwis + returns 0. \sa graphicsItem() */ @@ -177,8 +178,8 @@ const QWidget *QGraphicsEffectSource::widget() const } /*! - Returns a pointer to the style options (used when drawing the source) - if available; otherwise returns 0. + Returns a pointer to the style options (used when drawing the source) if + available; otherwise returns 0. \sa graphicsItem(), widget() */ @@ -188,9 +189,10 @@ const QStyleOption *QGraphicsEffectSource::styleOption() const } /*! - Draws the source using the \a painter specified. + Draws the source using the given \a painter. This function should only be called from QGraphicsEffect::draw(). + For example: \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 0 @@ -204,10 +206,11 @@ void QGraphicsEffectSource::draw(QPainter *painter) } /*! - Schedules a redraw of the source. You can call this function whenever the - source needs to be redrawn. + Schedules a redraw of the source. Call this function whenever the source + needs to be redrawn. - \sa QGraphicsEffect::updateBoundingRect(), QWidget::update(), QGraphicsItem::update(), + \sa QGraphicsEffect::updateBoundingRect(), QWidget::update(), + QGraphicsItem::update(), */ void QGraphicsEffectSource::update() { @@ -215,11 +218,12 @@ void QGraphicsEffectSource::update() } /*! - Returns true if the source effectively is a pixmap, e.g. a QGraphicsPixmapItem. + Returns true if the source effectively is a pixmap, e.g., a + QGraphicsPixmapItem. - This function is useful for optimization purposes, e.g. there's no point in - drawing the source in device coordinates to avoid pixmap scaling if this function - returns true; the source pixmap will be scaled anyways. + This function is useful for optimization purposes. For instance, there's no + point in drawing the source in device coordinates to avoid pixmap scaling + if this function returns true - the source pixmap will be scaled anyways. */ bool QGraphicsEffectSource::isPixmap() const { @@ -227,13 +231,14 @@ bool QGraphicsEffectSource::isPixmap() const } /*! - Returns a pixmap with the source painted into it. The \a system specifies which - coordinate system to be used for the source. The optional out parameter - \a offset returns the offset of which the pixmap should be painted - at using the current painter. + Returns a pixmap with the source painted into it. + + The \a system specifies which coordinate system to be used for the source. + The optional \a offset parameter returns the offset where the pixmap should + be painted at using the current painter. - Note that the returned pixmap is bound to the current painter's device - rect when the specified \a system is Qt::DeviceCoordinates. + The returned pixmap is bound to the current painter's device rectangle when + \a system is Qt::DeviceCoordinates. \sa QGraphicsEffect::draw(), boundingRect(), deviceRect() */ @@ -268,9 +273,9 @@ QGraphicsEffect::~QGraphicsEffect() } /*! - Returns the bounding rectangle for this effect (i.e., the bounding + Returns the bounding rectangle for this effect, i.e., the bounding rectangle of the source, adjusted by any margins applied by the effect - itself). + itself. \sa boundingRectFor(), updateBoundingRect() */ @@ -300,11 +305,13 @@ QRectF QGraphicsEffect::boundingRectFor(const QRectF &rect) const \brief whether the effect is enabled or not. If an effect is disabled, the source will be rendered with as normal, with - no interference from the effect. If the effect is enabled (default), the - source will be rendered with the effect applied. + no interference from the effect. If the effect is enabled, the source will + be rendered with the effect applied. - This property is provided so that you can disable certain effects on slow - platforms, in order to ensure that the user interface is responsive. + This property is enabled by default. + + Using this property, you can disable certain effects on slow platforms, in + order to ensure that the user interface is responsive. \sa enabledChanged() */ @@ -347,7 +354,7 @@ QGraphicsEffectSource *QGraphicsEffect::source() const } /*! - This function notifies the effect framework that the effect's bounding + This function notifies the effect framework when the effect's bounding rectangle has changed. As a custom effect author, you must call this function whenever you change any parameters that will cause the virtual boundingRectFor() function to return a different value. @@ -365,17 +372,19 @@ void QGraphicsEffect::updateBoundingRect() \fn virtual void QGraphicsEffect::draw(QPainter *painter, QGraphicsEffectSource *source) = 0 - This pure virtual function draws the effect and is called whenever the source() - needs to be drawn. + This pure virtual function draws the effect and is called whenever the + source() needs to be drawn. - Reimplement this function in a QGraphicsEffect subclass to provide the effect's - drawing implementation, using \a painter. The \a source parameter is provided - for convenience; its value is the same as source(). Example: + Reimplement this function in a QGraphicsEffect subclass to provide the + effect's drawing implementation, using \a painter. The \a source parameter + is provided for convenience; its value is the same as source(). + + For example: \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 1 - Note that this function should not be called explicitly by the user, since it's - meant for re-implementation purposes only. + This function should not be called explicitly by the user, since it is + meant for reimplementation purposes only. \sa QGraphicsEffectSource */ @@ -387,7 +396,8 @@ void QGraphicsEffect::updateBoundingRect() \value SourceAttached The effect is installed on a source. \value SourceDetached The effect is uninstalled on a source. - \value SourceBoundingRectChanged The bounding rect of the source has changed. + \value SourceBoundingRectChanged The bounding rect of the source has + changed. \value SourceInvalidated The visual appearance of the source has changed. */ @@ -410,7 +420,8 @@ void QGraphicsEffect::sourceChanged(ChangeFlags flags) A grayscale effect renders the source in shades of gray. - \sa QGraphicsColorizeEffect + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, + QGraphicsColorizeEffect, QGraphicsOpacityEffect */ QGraphicsGrayscaleEffect::QGraphicsGrayscaleEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsGrayscaleEffectPrivate, parent) @@ -446,12 +457,13 @@ void QGraphicsGrayscaleEffect::draw(QPainter *painter, QGraphicsEffectSource *so \brief The QGraphicsColorizeEffect provides a colorize effect. \since 4.6 - A colorize effect renders the source with a tint of its color(). The - color can be modified using the setColor() function. + A colorize effect renders the source with a tint of its color(). The color + can be modified using the setColor() function. By default, the color is light blue (QColor(0, 0, 192)). - \sa QGraphicsGrayscaleEffect + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, + QGraphicsGrayscaleEffect, QGraphicsOpacityEffect */ QGraphicsColorizeEffect::QGraphicsColorizeEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsColorizeEffectPrivate, parent) @@ -474,7 +486,7 @@ QColor QGraphicsColorizeEffect::color() const } /*! - Sets the color to the \a color specified. + Sets the color to the given \a color. \sa color(), colorChanged() */ @@ -518,13 +530,14 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou \brief The QGraphicsPixelizeEffect provides a pixelize effect. \since 4.6 - A pixelize effect renders the source in lower resolution. This effect - is useful for reducing details, in e.g. a censorship. The resolution - can be modified using the setPixelSize() function. + A pixelize effect renders the source in lower resolution. This effect is + useful for reducing details, like censorship. The resolution can be + modified using the setPixelSize() function. By default, the pixel size is 3. - \sa QGraphicsBlurEffect + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsGrayscaleEffect, + QGraphicsColorizeEffect, QGraphicsOpacityEffect */ QGraphicsPixelizeEffect::QGraphicsPixelizeEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsPixelizeEffectPrivate, parent) @@ -547,11 +560,10 @@ int QGraphicsPixelizeEffect::pixelSize() const } /*! - Sets the size of a pixel to the \a size specified. + Sets the size of a pixel to the given \a size. - Setting the \a size to e.g. 2 means two pixels in the source will - be used to represent one pixel. Using a bigger size results in - lower resolution. + Setting \a size to 2 means two pixels in the source will be used to + represent one pixel. Using a bigger size results in lower resolution. \sa pixelSize(), pixelSizeChanged() */ @@ -628,13 +640,14 @@ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou \since 4.6 A blur effect blurs the source. This effect is useful for reducing details, - e.g. when the source loses focus and you want to draw attention to other + such as when the source loses focus and you want to draw attention to other elements. The level of detail can be modified using the setBlurRadius() function. By default, the blur radius is 5 pixels. - \sa QGraphicsPixelizeEffect + \sa QGraphicsDropShadowEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, + QGraphicsColorizeEffect, QGraphicsOpacityEffect */ QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent) @@ -657,10 +670,10 @@ int QGraphicsBlurEffect::blurRadius() const } /*! - Sets the blur radius to the \a radius specified. + Sets the blur radius to the given \a radius. - Using a smaller radius results in a sharper appearance, whereas a - bigger radius results in a more blurry appearance. + Using a smaller radius results in a sharper appearance, whereas a bigger + radius results in a more blurred appearance. \sa blurRadius(), blurRadiusChanged() */ @@ -717,14 +730,17 @@ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) \since 4.6 A drop shadow effect renders the source with a drop shadow. The color of - the drop shadow can be modified using the setColor() function, the drop - shadow offset can be modified using the setOffset function, and the blur - radius of the drop shadow can be changed through the setBlurRadius() + the drop shadow can be modified using the setColor() function. The drop + shadow offset can be modified using the setOffset() function and the blur + radius of the drop shadow can be changed with the setBlurRadius() function. By default, the drop shadow is a semi-transparent dark gray - (QColor(63, 63, 63, 180)) shadow, blurred with a radius of 1 at an - offset of 8 pixels towards the lower right. + (QColor(63, 63, 63, 180)) shadow, blurred with a radius of 1 at an offset + of 8 pixels towards the lower right. + + \sa QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, + QGraphicsColorizeEffect, QGraphicsOpacityEffect */ QGraphicsDropShadowEffect::QGraphicsDropShadowEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsDropShadowEffectPrivate, parent) @@ -747,7 +763,7 @@ QPointF QGraphicsDropShadowEffect::offset() const } /*! - Sets the shadow offset in pixels to the \a offset specified. + Sets the shadow offset in pixels to the given \a offset. \sa offset(), setBlurRadius(), setColor(), offsetChanged() */ @@ -783,8 +799,8 @@ int QGraphicsDropShadowEffect::blurRadius() const Sets the radius in pixels of the blur on the drop shadow to the \a blurRadius specified. - Using a smaller radius results in a sharper shadow, whereas using - a bigger radius results in a more blurry shadow. + Using a smaller radius results in a sharper shadow, whereas using a bigger + radius results in a more blurred shadow. \sa blurRadius(), setColor(), setOffset(), blurRadiusChanged() */ @@ -817,7 +833,7 @@ QColor QGraphicsDropShadowEffect::color() const } /*! - Sets the color of the drop shadow to the \a color specified. + Sets the color of the drop shadow to the given \a color. \sa color(), setOffset(), setBlurRadius(), colorChanged() */ @@ -872,11 +888,14 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *s \brief The QGraphicsOpacityEffect class provides an opacity effect. \since 4.6 - An opacity effects renders the source with an opacity. This effect is useful - for making the source semi-transparent, in e.g. a fade-in/fade-out sequence. - The opacity can be modified using the setOpacity() function. + An opacity effect renders the source with an opacity. This effect is useful + for making the source semi-transparent, similar to a fade-in/fade-out + sequence. The opacity can be modified using the setOpacity() function. By default, the opacity is 0.7. + + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, + QGraphicsGrayscaleEffect, QGraphicsColorizeEffect */ QGraphicsOpacityEffect::QGraphicsOpacityEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsOpacityEffectPrivate, parent) @@ -899,9 +918,8 @@ qreal QGraphicsOpacityEffect::opacity() const } /*! - Sets the opacity to the \a opacity specified. The value should be in - the range 0.0 to 1.0, where 0.0 is fully transparent and 1.0 is - fully opaque. + Sets the opacity to the given \a opacity. The value should be in the range + of 0.0 to 1.0, where 0.0 is fully transparent and 1.0 is fully opaque. \sa opacity(), opacityChanged() */ -- cgit v0.12 From 4a9f155f6159281c58f3ad1bd9fdbab274d8dc6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 26 Aug 2009 13:08:41 +0200 Subject: Update auto-test after 97cec103793a4b9aae8337ffc2ce9a2bd98fb5fc We replaced the convolution filter in the drop shadow effect with a blur filter; we have to update the test accordingly. --- tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp | 43 ++++++++++++++------------ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp b/tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp index 410d868..66c6693 100644 --- a/tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp +++ b/tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp @@ -342,39 +342,44 @@ void tst_QPixmapFilter::dropShadowBoundingRectFor() QPixmapDropShadowFilter filter; filter.setBlurRadius(0); - QCOMPARE(filter.blurRadius(), 0.0); + QCOMPARE(filter.blurRadius(), 0); + + const QRectF rect1(0, 0, 50, 50); + const QRectF rect2(30, 20, 10, 40); + const QRectF rect3(2.2, 6.3, 11.4, 47.5); filter.setOffset(QPointF(0,0)); - QCOMPARE(filter.boundingRectFor(QRectF(0, 0, 50, 50)), QRectF(0, 0, 50, 50)); - QCOMPARE(filter.boundingRectFor(QRectF(30, 20, 10, 40)), QRectF(30, 20, 10, 40)); - QCOMPARE(filter.boundingRectFor(QRectF(2.2, 6.3, 11.4, 47.5)), QRectF(2.2, 6.3, 11.4, 47.5)); + QCOMPARE(filter.boundingRectFor(rect1), rect1); + QCOMPARE(filter.boundingRectFor(rect2), rect2); + QCOMPARE(filter.boundingRectFor(rect3), rect3); filter.setOffset(QPointF(1,1)); QCOMPARE(filter.offset(), QPointF(1, 1)); - QCOMPARE(filter.boundingRectFor(QRectF(0, 0, 50, 50)), QRectF(0, 0, 51, 51)); - QCOMPARE(filter.boundingRectFor(QRectF(30, 20, 10, 40)), QRectF(30, 20, 11, 41)); - QCOMPARE(filter.boundingRectFor(QRectF(2.2, 6.3, 11.4, 47.5)), QRectF(2.2, 6.3, 12.4, 48.5)); + QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(0, 0, 1, 1)); + QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(0, 0, 1, 1)); + QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(0, 0, 1, 1)); filter.setOffset(QPointF(-1,-1)); - QCOMPARE(filter.boundingRectFor(QRectF(0, 0, 50, 50)), QRectF(-1, -1, 51, 51)); - QCOMPARE(filter.boundingRectFor(QRectF(30, 20, 10, 40)), QRectF(29, 19, 11, 41)); - QCOMPARE(filter.boundingRectFor(QRectF(2.2, 6.3, 11.4, 47.5)), QRectF(1.2, 5.3, 12.4, 48.5)); + QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(-1, -1, 0, 0)); + QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(-1, -1, 0, 0)); + QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-1, -1, 0, 0)); filter.setBlurRadius(2); filter.setOffset(QPointF(0,0)); - QCOMPARE(filter.boundingRectFor(QRectF(0, 0, 50, 50)), QRectF(-2, -2, 54, 54)); - QCOMPARE(filter.boundingRectFor(QRectF(30, 20, 10, 40)), QRectF(28, 18, 14, 44)); - QCOMPARE(filter.boundingRectFor(QRectF(2.2, 6.3, 11.4, 47.5)), QRectF(0.2, 4.3, 15.4, 51.5)); + int delta = 2 * 2; + QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(-delta, -delta, delta, delta)); + QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(-delta, -delta, delta, delta)); + QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-delta, -delta, delta, delta)); filter.setOffset(QPointF(1,1)); - QCOMPARE(filter.boundingRectFor(QRectF(0, 0, 50, 50)), QRectF(-1, -1, 54, 54)); - QCOMPARE(filter.boundingRectFor(QRectF(30, 20, 10, 40)), QRectF(29, 19, 14, 44)); - QCOMPARE(filter.boundingRectFor(QRectF(2.2, 6.3, 11.4, 47.5)), QRectF(1.2, 5.3, 15.4, 51.5)); + QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(-delta + 1, -delta + 1, delta + 1, delta + 1)); + QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(-delta + 1, -delta + 1, delta + 1, delta + 1)); + QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-delta + 1, -delta + 1, delta + 1, delta + 1)); filter.setOffset(QPointF(-10,-10)); - QCOMPARE(filter.boundingRectFor(QRectF(0, 0, 50, 50)), QRectF(-12, -12, 62, 62)); - QCOMPARE(filter.boundingRectFor(QRectF(30, 20, 10, 40)), QRectF(18, 8, 22, 52)); - QCOMPARE(filter.boundingRectFor(QRectF(2.2, 6.3, 11.4, 47.5)), QRectF(-9.8, -5.7, 23.4, 59.5)); + QCOMPARE(filter.boundingRectFor(rect1), rect1.adjusted(-delta - 10, -delta - 10, 0, 0)); + QCOMPARE(filter.boundingRectFor(rect2), rect2.adjusted(-delta - 10, -delta - 10, 0, 0)); + QCOMPARE(filter.boundingRectFor(rect3), rect3.adjusted(-delta - 10, -delta - 10, 0, 0)); } -- cgit v0.12 From 878569545a06a904635b273c862a0c41dba298e2 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 26 Aug 2009 13:09:17 +0200 Subject: Removing FONT_OUTLINE_TWEAK from the deform demo That -no obsolete- tweak was mainly there because S60FontEngine was originally not returning glyph outlines. Task-number: 259979 Reviewed-by: jbarron modified: demos/deform/pathdeform.cpp --- demos/deform/pathdeform.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/demos/deform/pathdeform.cpp b/demos/deform/pathdeform.cpp index 5530010..07c7829 100644 --- a/demos/deform/pathdeform.cpp +++ b/demos/deform/pathdeform.cpp @@ -53,11 +53,6 @@ #include #include -#if defined(Q_OS_SYMBIAN) -// TODO: Remove all FONT_OUTLINE_TWEAK related code as soon as the S60FontEngine can deliver outlines -#define FONT_OUTLINE_TWEAK -#endif - PathDeformControls::PathDeformControls(QWidget *parent, PathDeformRenderer* renderer, bool smallScreen) : QWidget(parent) { @@ -246,13 +241,6 @@ void PathDeformControls::layoutForSmallScreen() QRect screen_size = QApplication::desktop()->screenGeometry(); radiusSlider->setValue(qMin(screen_size.width(), screen_size.height())/5); -#ifdef FONT_OUTLINE_TWEAK - radiusSlider->setValue(qMin(screen_size.width(), screen_size.height())/7); - fontSizeLabel->setText("Qt Logo Size:"); - m_renderer->setText("A"); // Any Letter would be fine - fontSizeSlider->setValue(100); -#endif - m_renderer->setText(tr("Qt")); } -- cgit v0.12 From 5a22a926f8f10597a431036533550f05fdf52d85 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 26 Aug 2009 13:34:42 +0200 Subject: implement proxying of JSObject::putWithAttributes() on Global Object Otherwise the property is stored on the wrong object (the proxy). This fix makes the Qt bindings generated by qtscriptgenerator work again. --- src/script/bridge/qscriptglobalobject.cpp | 9 +++++++++ src/script/bridge/qscriptglobalobject_p.h | 4 ++++ tests/auto/qscriptengine/tst_qscriptengine.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/src/script/bridge/qscriptglobalobject.cpp b/src/script/bridge/qscriptglobalobject.cpp index c929e12..3fa5879 100644 --- a/src/script/bridge/qscriptglobalobject.cpp +++ b/src/script/bridge/qscriptglobalobject.cpp @@ -100,6 +100,15 @@ void GlobalObject::put(JSC::ExecState* exec, const JSC::Identifier& propertyName JSC::JSGlobalObject::put(exec, propertyName, value, slot); } +void GlobalObject::putWithAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName, + JSC::JSValue value, unsigned attributes) +{ + if (customGlobalObject) + customGlobalObject->putWithAttributes(exec, propertyName, value, attributes); + else + JSC::JSGlobalObject::putWithAttributes(exec, propertyName, value, attributes); +} + bool GlobalObject::deleteProperty(JSC::ExecState* exec, const JSC::Identifier& propertyName, bool checkDontDelete) { diff --git a/src/script/bridge/qscriptglobalobject_p.h b/src/script/bridge/qscriptglobalobject_p.h index eff24a2..11b1482 100644 --- a/src/script/bridge/qscriptglobalobject_p.h +++ b/src/script/bridge/qscriptglobalobject_p.h @@ -74,6 +74,8 @@ public: JSC::PropertySlot&); virtual void put(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); + virtual void putWithAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName, + JSC::JSValue value, unsigned attributes); virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier& propertyName, bool checkDontDelete = true); @@ -115,6 +117,8 @@ public: virtual void put(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot& slot) { originalGlobalObject->JSC::JSGlobalObject::put(exec, propertyName, value, slot); } + virtual void putWithAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue value, unsigned attributes) + { originalGlobalObject->JSC::JSGlobalObject::putWithAttributes(exec, propertyName, value, attributes); } virtual bool deleteProperty(JSC::ExecState* exec, const JSC::Identifier& propertyName, bool checkDontDelete = true) { return originalGlobalObject->JSC::JSGlobalObject::deleteProperty(exec, propertyName, checkDontDelete); } diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index df74144..b0ba922 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1107,6 +1107,31 @@ void tst_QScriptEngine::globalObjectProperties() } } QVERIFY(remainingNames.isEmpty()); + + // create property with no attributes + { + QString name = QString::fromLatin1("foo"); + QVERIFY(!global.property(name).isValid()); + QScriptValue val(123); + global.setProperty(name, val); + QVERIFY(global.property(name).equals(val)); + QVERIFY(global.propertyFlags(name) == 0); + global.setProperty(name, QScriptValue()); + QVERIFY(!global.property(name).isValid()); + } + // create property with attributes + { + QString name = QString::fromLatin1("bar"); + QVERIFY(!global.property(name).isValid()); + QScriptValue val(QString::fromLatin1("ciao")); + QScriptValue::PropertyFlags flags = QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration; + global.setProperty(name, val, flags); + QVERIFY(global.property(name).equals(val)); + QEXPECT_FAIL("", "custom Global Object properties don't retain attributes", Continue); + QCOMPARE(global.propertyFlags(name), flags); + global.setProperty(name, QScriptValue()); + QVERIFY(!global.property(name).isValid()); + } } void tst_QScriptEngine::globalObjectGetterSetterProperty() -- cgit v0.12 From de3939532af08c37e709d1bae8cf50a57d6f63be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 26 Aug 2009 10:54:33 +0200 Subject: Added missing precision specifiers to custom shader effect. The precision specifiers need to be there on OpenGL ES 2.0. Reviewed-by: Tom --- examples/effects/customshader/customshadereffect.cpp | 2 +- src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 2 +- src/opengl/gl2paintengineex/qglengineshadersource_p.h | 2 +- src/opengl/qglpixmapfilter.cpp | 2 +- src/opengl/qgraphicsshadereffect.cpp | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/effects/customshader/customshadereffect.cpp b/examples/effects/customshader/customshadereffect.cpp index 08e4324..69fdb15 100644 --- a/examples/effects/customshader/customshadereffect.cpp +++ b/examples/effects/customshader/customshadereffect.cpp @@ -44,7 +44,7 @@ static char const colorizeShaderCode[] = "uniform lowp vec4 effectColor;\n" - "mediump vec4 customShader(sampler2D imageTexture, vec2 textureCoords) {\n" + "mediump vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) {\n" " vec4 src = texture2D(imageTexture, textureCoords);\n" " float gray = dot(src.rgb, vec3(0.212671, 0.715160, 0.072169));\n" " vec4 colorize = 1.0-((1.0-gray)*(1.0-effectColor));\n" diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index d5241a8..ace6b63 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -209,7 +209,7 @@ (QGLCustomShaderStage). The shader will implement a pre-defined method name which Qt's fragment pipeline will call: - lowp vec4 customShader(sampler2d src, vec2 srcCoords) + lowp vec4 customShader(lowp sampler2d imageTexture, highp vec2 textureCoords) The provided src and srcCoords parameters can be used to sample from the source image. diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index cf930f3..a8e2e72 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -293,7 +293,7 @@ static const char* const qglslImageSrcFragmentShader = "\ static const char* const qglslCustomSrcFragmentShader = "\ varying highp vec2 textureCoords; \ uniform sampler2D imageTexture; \ - lowp vec4 customShader(sampler2D texture, vec2 coords); \ + lowp vec4 customShader(lowp sampler2D texture, highp vec2 coords); \ lowp vec4 srcPixel() { \ return customShader(imageTexture, textureCoords); \ }"; diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index e1ee61a..df7811e 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -418,7 +418,7 @@ QByteArray QGLPixmapBlurFilter::generateBlurShader(int radius, bool gaussianBlur source.append("uniform highp vec4 clip;\n"); } - source.append("lowp vec4 customShader(sampler2D src, vec2 srcCoords) {\n"); + source.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n"); QVector sampleOffsets; QVector weights; diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp index d3f52f6..5e37d62 100644 --- a/src/opengl/qgraphicsshadereffect.cpp +++ b/src/opengl/qgraphicsshadereffect.cpp @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE The specific effect is defined by a fragment of GLSL source code supplied to setPixelShaderFragment(). This source code must define a function with the signature - \c{lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords)} + \c{lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords)} that returns the source pixel value to use in the paint engine's shader program. The shader fragment is linked with the regular shader code used by the GL2 paint engine @@ -77,7 +77,7 @@ QT_BEGIN_NAMESPACE \code static char const colorizeShaderCode[] = "uniform lowp vec4 effectColor;\n" - "lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords) {\n" + "lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) {\n" " vec4 src = texture2D(imageTexture, textureCoords);\n" " float gray = dot(src.rgb, vec3(0.212671, 0.715160, 0.072169));\n" " vec4 colorize = 1.0-((1.0-gray)*(1.0-effectColor));\n" @@ -130,7 +130,7 @@ QT_BEGIN_NAMESPACE */ static const char qglslDefaultImageFragmentShader[] = "\ - lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords) { \ + lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) { \ return texture2D(imageTexture, textureCoords); \ }\n"; @@ -215,13 +215,13 @@ QByteArray QGraphicsShaderEffect::pixelShaderFragment() const this shader effect to \a code. The \a code must define a GLSL function with the signature - \c{lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords)} + \c{lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords)} that returns the source pixel value to use in the paint engine's shader program. The following is the default pixel shader fragment, which draws a pixmap with no effect applied: \code - lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords) { + lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) { return texture2D(imageTexture, textureCoords); } \endcode -- cgit v0.12 From e9ffb5b0918e800edfba6b697c7a14ef6c7fa8e1 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 26 Aug 2009 13:57:29 +0200 Subject: fix performance issue with QScriptValue::propertyFlags() Calling QScriptEngine::toStringHandle() is dead slow, so don't call it; use JSC::Identifier directly. This is the same issue as was fixed for setProperty() in commit a8574172dd5e6bc11cf6f69b6fad5a063549e88d. --- src/script/api/qscriptvalue.cpp | 65 ++++++++++++---------- src/script/api/qscriptvalue_p.h | 2 + tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 1 + tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp | 12 ++++ 4 files changed, 52 insertions(+), 28 deletions(-) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 1d08676..984ad1b 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -393,6 +393,37 @@ void QScriptValuePrivate::setProperty(const JSC::Identifier &id, const QScriptVa } } +QScriptValue::PropertyFlags QScriptValuePrivate::propertyFlags(const JSC::Identifier &id, + const QScriptValue::ResolveFlags &mode) const +{ + JSC::ExecState *exec = engine->currentFrame; + JSC::JSObject *object = JSC::asObject(jscValue); + unsigned attribs = 0; + if (!object->getPropertyAttributes(exec, id, attribs)) { + if ((mode & QScriptValue::ResolvePrototype) && object->prototype() && object->prototype().isObject()) { + QScriptValue proto = engine->scriptValueFromJSCValue(object->prototype()); + return QScriptValuePrivate::get(proto)->propertyFlags(id, mode); + } + return 0; + } + QScriptValue::PropertyFlags result = 0; + if (attribs & JSC::ReadOnly) + result |= QScriptValue::ReadOnly; + if (attribs & JSC::DontEnum) + result |= QScriptValue::SkipInEnumeration; + if (attribs & JSC::DontDelete) + result |= QScriptValue::Undeletable; + //We cannot rely on attribs JSC::Setter/Getter because they are not necesserly set by JSC (bug?) + if (attribs & JSC::Getter || !object->lookupGetter(exec, id).isUndefinedOrNull()) + result |= QScriptValue::PropertyGetter; + if (attribs & JSC::Setter || !object->lookupSetter(exec, id).isUndefinedOrNull()) + result |= QScriptValue::PropertySetter; + if (attribs & QScript::QObjectMemberAttribute) + result |= QScriptValue::QObjectMember; + result |= QScriptValue::PropertyFlag(attribs & QScriptValue::UserRange); + return result; +} + QVariant &QScriptValuePrivate::variantValue() const { Q_ASSERT(jscValue.isObject(&QScriptObject::info)); @@ -1817,9 +1848,11 @@ void QScriptValue::setProperty(const QScriptString &name, QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QString &name, const ResolveFlags &mode) const { - if (!isObject()) + Q_D(const QScriptValue); + if (!d || !d->isJSC() || !d->jscValue.isObject()) return 0; - return propertyFlags(engine()->toStringHandle(name), mode); + JSC::ExecState *exec = d->engine->currentFrame; + return d->propertyFlags(JSC::Identifier(exec, name), mode); } @@ -1835,33 +1868,9 @@ QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QScriptString &nam const ResolveFlags &mode) const { Q_D(const QScriptValue); - if (!isObject()) - return 0; - JSC::ExecState *exec = d->engine->currentFrame; - JSC::JSObject *object = JSC::asObject(d->jscValue); - JSC::Identifier id = name.d_ptr->identifier; - unsigned attribs = 0; - if (!object->getPropertyAttributes(exec, id, attribs)) { - if ((mode & QScriptValue::ResolvePrototype) && object->prototype()) - return d->engine->scriptValueFromJSCValue(object->prototype()).propertyFlags(name, mode); + if (!d || !d->isJSC() || !d->jscValue.isObject() || !name.isValid()) return 0; - } - QScriptValue::PropertyFlags result = 0; - if (attribs & JSC::ReadOnly) - result |= QScriptValue::ReadOnly; - if (attribs & JSC::DontEnum) - result |= QScriptValue::SkipInEnumeration; - if (attribs & JSC::DontDelete) - result |= QScriptValue::Undeletable; - //We cannot rely on attribs JSC::Setter/Getter because they are not necesserly set by JSC (bug?) - if (attribs & JSC::Getter || !object->lookupGetter(exec, id).isUndefinedOrNull()) - result |= QScriptValue::PropertyGetter; - if (attribs & JSC::Setter || !object->lookupSetter(exec, id).isUndefinedOrNull()) - result |= QScriptValue::PropertySetter; - if (attribs & QScript::QObjectMemberAttribute) - result |= QScriptValue::QObjectMember; - result |= QScriptValue::PropertyFlag(attribs & QScriptValue::UserRange); - return result; + return d->propertyFlags(name.d_ptr->identifier, mode); } /*! diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 3e952af..c440013 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -104,6 +104,8 @@ public: inline QScriptValue property(const QString &, int resolveMode) const; void setProperty(const JSC::Identifier &id, const QScriptValue &value, const QScriptValue::PropertyFlags &flags); + QScriptValue::PropertyFlags propertyFlags( + const JSC::Identifier &id, const QScriptValue::ResolveFlags &mode) const; void detachFromEngine(); diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 3f231f2..e712017 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2106,6 +2106,7 @@ void tst_QScriptValue::getSetProperty() object.setProperty(foo, num); QVERIFY(object.property(foo).strictlyEquals(num)); QVERIFY(object.property("foo").strictlyEquals(num)); + QVERIFY(object.propertyFlags(foo) == 0); } void tst_QScriptValue::getSetPrototype() diff --git a/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp b/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp index 904674e..b637591 100644 --- a/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp @@ -68,6 +68,7 @@ private slots: void toQObject(); void property(); void setProperty(); + void propertyFlags(); }; tst_QScriptValue::tst_QScriptValue() @@ -189,5 +190,16 @@ void tst_QScriptValue::setProperty() } } +void tst_QScriptValue::propertyFlags() +{ + QScriptEngine engine; + QScriptValue obj = engine.newObject(); + QString propertyName = QString::fromLatin1("foo"); + obj.setProperty(propertyName, 123, QScriptValue::SkipInEnumeration | QScriptValue::ReadOnly); + QBENCHMARK { + (void)obj.propertyFlags(propertyName); + } +} + QTEST_MAIN(tst_QScriptValue) #include "tst_qscriptvalue.moc" -- cgit v0.12 From b5f00cdc0a63ea598d7af908240f0de5ac141262 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 26 Aug 2009 13:49:42 +0200 Subject: QToolbar now collapses when dragged Previously it wouldn't and the layout could appear to be broken. Task-number: 248817 Reviewed-by: Gabriel De Dietrich --- src/gui/widgets/qtoolbar.cpp | 2 +- src/gui/widgets/qtoolbarlayout.cpp | 4 ++-- src/gui/widgets/qtoolbarlayout_p.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index bf44ea1..89e6d7a 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -391,7 +391,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) void QToolBarPrivate::unplug(const QRect &_r) { Q_Q(QToolBar); - + layout->setExpanded(false, false); QRect r = _r; r.moveTopLeft(q->mapToGlobal(QPoint(0, 0))); setWindowState(true, true, r); diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp index d3c5b4b..1f2ca60 100644 --- a/src/gui/widgets/qtoolbarlayout.cpp +++ b/src/gui/widgets/qtoolbarlayout.cpp @@ -642,7 +642,7 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const return result; } -void QToolBarLayout::setExpanded(bool exp) +void QToolBarLayout::setExpanded(bool exp, bool animated) { if (exp == expanded) return; @@ -665,7 +665,7 @@ void QToolBarLayout::setExpanded(bool exp) layoutActions(rect.size()); } } - layout->layoutState.toolBarAreaLayout.apply(true); + layout->layoutState.toolBarAreaLayout.apply(animated); } } diff --git a/src/gui/widgets/qtoolbarlayout_p.h b/src/gui/widgets/qtoolbarlayout_p.h index fe81d2f..bb40e215 100644 --- a/src/gui/widgets/qtoolbarlayout_p.h +++ b/src/gui/widgets/qtoolbarlayout_p.h @@ -111,8 +111,8 @@ public: void updateMarginAndSpacing(); bool hasExpandFlag() const; -public slots: - void setExpanded(bool b); +public Q_SLOTS: + void setExpanded(bool b, bool animated = true); private: QList items; -- cgit v0.12 From d0f31c800b90a57c622d5d0d41b6fc3c2f9f9b49 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Wed, 26 Aug 2009 14:13:17 +0200 Subject: Fixes typo in doc and missing return in anchor layout Reviewed-by: janarve --- src/gui/graphicsview/qgraphicsanchorlayout.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 2894c59..b088f12 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -65,8 +65,9 @@ automatically added to the layout, and if items are removed, all their anchors will be automatically removed - \section1 Size Hints and Size Policies in QGraphicsLinearLayout - QGraphicsLinearLayout respects each item's size hints and size policies. However it does + \section1 Size Hints and Size Policies in QGraphicsAnchorLayout + + QGraphicsAnchorLayout respects each item's size hints and size policies. However it does not respect stretch factors currently. This might change in the future, so please refrain from using stretch factors in anchor layout to avoid any future regressions. @@ -228,6 +229,7 @@ void QGraphicsAnchorLayout::setAnchorSpacing(const QGraphicsLayoutItem *firstIte if (!d->setAnchorSize(firstItem, firstEdge, secondItem, secondEdge, &spacing)) { qWarning("setAnchorSpacing: The anchor does not exist."); + return; } invalidate(); } -- cgit v0.12 From 38d04ac09a3916ad33489e0d60e87c32f86fd117 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Wed, 26 Aug 2009 14:07:25 +0200 Subject: Fix column number in QScriptEngineAgent with JIT enabled Column number in executed JS source code is correctly passed to debugger. Few autotest were repaired. Reviewed-by: Kent Hansen --- src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index b669dfa..8371229 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -763,6 +763,7 @@ void JIT::emit_op_debug(Instruction* currentInstruction) stubCall.addArgument(Imm32(currentInstruction[1].u.operand)); stubCall.addArgument(Imm32(currentInstruction[2].u.operand)); stubCall.addArgument(Imm32(currentInstruction[3].u.operand)); + stubCall.addArgument(Imm32(currentInstruction[4].u.operand)); stubCall.call(); } -- cgit v0.12 From 2eaf970b886c4c5c70fbc8d3081f8b572d0cfdf5 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 26 Aug 2009 14:24:37 +0200 Subject: Remove superfluous '.data()' call from dashStroker. The extra ".data()" call is not needed here because QScopedPointer overloads operator!() to do the right thing here. Reviewed-by: Eskil Blomfeldt --- src/gui/painting/qpaintengine_raster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 72bb164..5f6e1d6 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -791,7 +791,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen) if(pen_style == Qt::SolidLine) { s->stroker = &d->basicStroker; } else if (pen_style != Qt::NoPen) { - if (!d->dashStroker.data()) + if (!d->dashStroker) d->dashStroker.reset(new QDashStroker(&d->basicStroker)); if (pen.isCosmetic()) { d->dashStroker->setClipRect(d->deviceRect); -- cgit v0.12 From a49d181c2700123a0c9af922c86b89914b402e9d Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 26 Aug 2009 11:26:53 +0200 Subject: Compile fix for mingw --- src/3rdparty/phonon/ds9/backend.h | 2 +- src/3rdparty/phonon/ds9/mediaobject.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/3rdparty/phonon/ds9/backend.h b/src/3rdparty/phonon/ds9/backend.h index 9b2c2a2..8b020c2 100644 --- a/src/3rdparty/phonon/ds9/backend.h +++ b/src/3rdparty/phonon/ds9/backend.h @@ -64,7 +64,7 @@ namespace Phonon Filter getAudioOutputFilter(int index) const; - static QMutex *Backend::directShowMutex(); + static QMutex *directShowMutex(); Q_SIGNALS: void objectDescriptionChanged(ObjectDescriptionType); diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index 579517f..e42dff9 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -21,9 +21,7 @@ along with this library. If not, see . #include #include -#ifndef Q_CC_MSVC #include -#endif //Q_CC_MSVC #include #include #include -- cgit v0.12 From b69a8a9f6a88f6da971fd18641cfac26cc1035f5 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 26 Aug 2009 14:38:48 +0200 Subject: Revert "qglobal.h now has the definition for WINVER" This reverts commit f7ebdd380d16a7be9713930b5ab41c32e996dcdb. defining WINVER in qglobal.h is about to be reverted. --- src/corelib/global/qt_windows.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h index 6e3f242..dd722f9 100644 --- a/src/corelib/global/qt_windows.h +++ b/src/corelib/global/qt_windows.h @@ -53,6 +53,13 @@ #endif #endif +#if defined(Q_CC_MINGW) +// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation +#ifndef WINVER +#define WINVER 0x500 +#endif +#endif + #include #ifdef _WIN32_WCE -- cgit v0.12 From f607562328a7c7f9ee0c7048aba365dcea042b4f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 26 Aug 2009 14:39:29 +0200 Subject: Doc: Noted a limitation in using slashes in settings section names. Task-number: 254511 Reviewed-by: Trust Me --- src/corelib/io/qsettings.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 8612e03..db0c696 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2118,12 +2118,12 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, Custom types registered using qRegisterMetaType() and qRegisterMetaTypeStreamOperators() can be stored using QSettings. - \section1 Key Syntax + \section1 Section and Key Syntax Setting keys can contain any Unicode characters. The Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses case-sensitive keys. To - avoid portability problems, follow these two simple rules: + avoid portability problems, follow these simple rules: \list 1 \o Always refer to the same key using the same case. For example, @@ -2134,7 +2134,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, example, if you have a key called "MainWindow", don't try to save another key as "mainwindow". - \o Do not use slashes ('/' and '\\') in key names; the + \o Do not use slashes ('/' and '\\') in section or key names; the backslash character is used to separate sub keys (see below). On windows '\\' are converted by QSettings to '/', which makes them identical. -- cgit v0.12 From eb39ecce531f67b4f8b791f76796ab9010c9e745 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 26 Aug 2009 14:59:51 +0200 Subject: Avoid undefined text metrics when GetTextMetrics() in QFontEngineWin If GetTextMetrics() should fail, the results are undefined. When the undefined data are used, e.g. when painting text, this can cause a crash. To avoid the crash and make it clear that the metrics cannot be retrieved, we zero out the entire structure. Task-number: 251172 Reviewed-by: gunnar --- src/gui/text/qfontengine_win.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 173b822..7a9d958 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -327,8 +327,10 @@ QFontEngineWin::QFontEngineWin(const QString &name, HFONT _hfont, bool stockFont BOOL res = GetTextMetrics(hdc, &tm); fontDef.fixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH); - if (!res) + if (!res) { qErrnoWarning("QFontEngineWin: GetTextMetrics failed"); + ZeroMemory(&tm, sizeof(TEXTMETRIC)); + } cache_cost = tm.tmHeight * tm.tmAveCharWidth * 2000; getCMap(); -- cgit v0.12 From 42ff4d0a4c5af1f4e136f5772706367f1775c4bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 26 Aug 2009 15:05:25 +0200 Subject: doc: fixes qdoc warnings/errors related to the Graphics Effect framework. Reviewed-by: Kavindra --- src/gui/effects/qgraphicseffect.cpp | 206 +++++++++++++++++++++++------------ src/gui/kernel/qwidget.cpp | 9 ++ src/opengl/qgraphicsshadereffect.cpp | 2 +- 3 files changed, 145 insertions(+), 72 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 9ed01df..0289914 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -108,7 +108,7 @@ QT_BEGIN_NAMESPACE /*! \class QGraphicsEffectSource - \brief The QGraphicsEffectSource represents the source on which a + \brief The QGraphicsEffectSource class represents the source on which a QGraphicsEffect is installed on. \since 4.6 @@ -119,12 +119,19 @@ QT_BEGIN_NAMESPACE QGraphicsEffectSource also provides a pixmap() function which creates a pixmap with the source painted into it. - \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect. + \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect(). +*/ + +/*! + \internal */ QGraphicsEffectSource::QGraphicsEffectSource(QGraphicsEffectSourcePrivate &dd, QObject *parent) : QObject(dd, parent) {} +/*! + Destroys the effect source. +*/ QGraphicsEffectSource::~QGraphicsEffectSource() {} @@ -167,8 +174,8 @@ const QGraphicsItem *QGraphicsEffectSource::graphicsItem() const } /*! - Returns a pointer to the widget if this source is a QWidget; otherwis - returns 0. + Returns a pointer to the widget if this source is a QWidget; otherwise + returns 0. \sa graphicsItem() */ @@ -199,7 +206,6 @@ const QStyleOption *QGraphicsEffectSource::styleOption() const \sa QGraphicsEffect::draw() */ - void QGraphicsEffectSource::draw(QPainter *painter) { d_func()->draw(painter); @@ -312,8 +318,6 @@ QRectF QGraphicsEffect::boundingRectFor(const QRectF &rect) const Using this property, you can disable certain effects on slow platforms, in order to ensure that the user interface is responsive. - - \sa enabledChanged() */ bool QGraphicsEffect::isEnabled() const { @@ -337,6 +341,7 @@ void QGraphicsEffect::setEnabled(bool enable) \fn void QGraphicsEffect::enabledChanged(bool enabled) This signal is emitted whenever the effect is enabled or disabled. + The \a enabled parameter holds the effects's new enabled state. \sa isEnabled() */ @@ -423,15 +428,26 @@ void QGraphicsEffect::sourceChanged(ChangeFlags flags) \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect */ + +/*! + Constructs a new QGraphicsGrayscale instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsGrayscaleEffect::QGraphicsGrayscaleEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsGrayscaleEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsGrayscaleEffect::~QGraphicsGrayscaleEffect() { } +/*! + \reimp +*/ void QGraphicsGrayscaleEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsGrayscaleEffect); @@ -454,7 +470,7 @@ void QGraphicsGrayscaleEffect::draw(QPainter *painter, QGraphicsEffectSource *so /*! \class QGraphicsColorizeEffect - \brief The QGraphicsColorizeEffect provides a colorize effect. + \brief The QGraphicsColorizeEffect class provides a colorize effect. \since 4.6 A colorize effect renders the source with a tint of its color(). The color @@ -465,31 +481,35 @@ void QGraphicsGrayscaleEffect::draw(QPainter *painter, QGraphicsEffectSource *so \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, QGraphicsOpacityEffect */ + +/*! + Constructs a new QGraphicsColorizeEffect instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsColorizeEffect::QGraphicsColorizeEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsColorizeEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsColorizeEffect::~QGraphicsColorizeEffect() { } /*! - Returns the color. + \property QGraphicsColorizeEffect::color + \brief the color of the effect. - \sa setColor(), colorChanged() -*/ + By default, the color is light blue (QColor(0, 0, 192)). +*/; QColor QGraphicsColorizeEffect::color() const { Q_D(const QGraphicsColorizeEffect); return d->filter->color(); } -/*! - Sets the color to the given \a color. - - \sa color(), colorChanged() -*/ void QGraphicsColorizeEffect::setColor(const QColor &color) { Q_D(QGraphicsColorizeEffect); @@ -504,8 +524,12 @@ void QGraphicsColorizeEffect::setColor(const QColor &color) \fn void QGraphicsColorizeEffect::colorChanged(const QColor &color) This signal is emitted whenever the effect's color changes. + The \a color parameter holds the effect's new color. */ +/*! + \reimp +*/ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsColorizeEffect); @@ -527,7 +551,7 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou /*! \class QGraphicsPixelizeEffect - \brief The QGraphicsPixelizeEffect provides a pixelize effect. + \brief The QGraphicsPixelizeEffect class provides a pixelize effect. \since 4.6 A pixelize effect renders the source in lower resolution. This effect is @@ -539,19 +563,31 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsGrayscaleEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect */ + +/*! + Constructs a new QGraphicsPixelizeEffect instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsPixelizeEffect::QGraphicsPixelizeEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsPixelizeEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsPixelizeEffect::~QGraphicsPixelizeEffect() { } /*! - Returns the size of a pixel. + \property QGraphicsPixelizeEffect::pixelSize + \brief the size of a pixel in the effect. - \sa setPixelSize(), pixelSizeChanged() + Setting the pixel size to 2 means two pixels in the source will be used to + represent one pixel. Using a bigger size results in lower resolution. + + By default, the pixel size is 3. */ int QGraphicsPixelizeEffect::pixelSize() const { @@ -559,14 +595,6 @@ int QGraphicsPixelizeEffect::pixelSize() const return d->pixelSize; } -/*! - Sets the size of a pixel to the given \a size. - - Setting \a size to 2 means two pixels in the source will be used to - represent one pixel. Using a bigger size results in lower resolution. - - \sa pixelSize(), pixelSizeChanged() -*/ void QGraphicsPixelizeEffect::setPixelSize(int size) { Q_D(QGraphicsPixelizeEffect); @@ -581,6 +609,7 @@ void QGraphicsPixelizeEffect::setPixelSize(int size) \fn void QGraphicsPixelizeEffect::pixelSizeChanged(int size) This signal is emitted whenever the effect's pixel size changes. + The \a size parameter holds the effect's new pixel size. */ static inline void pixelize(QImage *image, int pixelSize) @@ -604,6 +633,9 @@ static inline void pixelize(QImage *image, int pixelSize) } } +/*! + \reimp +*/ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsPixelizeEffect); @@ -636,7 +668,7 @@ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou /*! \class QGraphicsBlurEffect - \brief The QGraphicsBlurEffect provides a blur effect. + \brief The QGraphicsBlurEffect class provides a blur effect. \since 4.6 A blur effect blurs the source. This effect is useful for reducing details, @@ -649,19 +681,31 @@ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou \sa QGraphicsDropShadowEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect */ + +/*! + Constructs a new QGraphicsBlurEffect instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsBlurEffect::~QGraphicsBlurEffect() { } /*! - Returns the blur radius. + \property QGraphicsBlurEffect::blurRadius + \brief the blur radius of the effect. + + Using a smaller radius results in a sharper appearance, whereas a bigger + radius results in a more blurred appearance. - \sa setBlurRadius(), blurRadiusChanged() + By default, the blur radius is 5 pixels. */ int QGraphicsBlurEffect::blurRadius() const { @@ -669,14 +713,6 @@ int QGraphicsBlurEffect::blurRadius() const return d->filter->radius(); } -/*! - Sets the blur radius to the given \a radius. - - Using a smaller radius results in a sharper appearance, whereas a bigger - radius results in a more blurred appearance. - - \sa blurRadius(), blurRadiusChanged() -*/ void QGraphicsBlurEffect::setBlurRadius(int radius) { Q_D(QGraphicsBlurEffect); @@ -692,14 +728,21 @@ void QGraphicsBlurEffect::setBlurRadius(int radius) \fn void QGraphicsBlurEffect::blurRadiusChanged(int radius) This signal is emitted whenever the effect's blur radius changes. + The \a radius parameter holds the effect's new blur radius. */ +/*! + \reimp +*/ QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const { Q_D(const QGraphicsBlurEffect); return d->filter->boundingRectFor(rect); } +/*! + \reimp +*/ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsBlurEffect); @@ -742,19 +785,30 @@ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) \sa QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect */ + +/*! + Constructs a new QGraphicsDropShadowEffect instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsDropShadowEffect::QGraphicsDropShadowEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsDropShadowEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect() { } /*! - Returns the shadow offset in pixels. + \property QGraphicsDropShadowEffect::offset + \brief the shadow offset in pixels. - \sa setOffset(), blurRadius(), color(), offsetChanged() + By default, the offset is 8 pixels towards the lower right. + + \sa blurRadius(), color() */ QPointF QGraphicsDropShadowEffect::offset() const { @@ -762,11 +816,6 @@ QPointF QGraphicsDropShadowEffect::offset() const return d->filter->offset(); } -/*! - Sets the shadow offset in pixels to the given \a offset. - - \sa offset(), setBlurRadius(), setColor(), offsetChanged() -*/ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset) { Q_D(QGraphicsDropShadowEffect); @@ -782,12 +831,19 @@ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset) \fn void QGraphicsDropShadowEffect::offsetChanged(const QPointF &offset) This signal is emitted whenever the effect's shadow offset changes. + The \a offset parameter holds the effect's new shadow offset. */ /*! - Returns the radius in pixels of the blur on the drop shadow. + \property QGraphicsDropShadowEffect::blurRadius + \brief the blur radius in pixels of the drop shadow. + + Using a smaller radius results in a sharper shadow, whereas using a bigger + radius results in a more blurred shadow. + + By default, the blur radius is 1 pixel. - \sa setBlurRadius(), color(), offset(), blurRadiusChanged() + \sa color(), offset(). */ int QGraphicsDropShadowEffect::blurRadius() const { @@ -795,15 +851,6 @@ int QGraphicsDropShadowEffect::blurRadius() const return d->filter->blurRadius(); } -/*! - Sets the radius in pixels of the blur on the drop shadow to the - \a blurRadius specified. - - Using a smaller radius results in a sharper shadow, whereas using a bigger - radius results in a more blurred shadow. - - \sa blurRadius(), setColor(), setOffset(), blurRadiusChanged() -*/ void QGraphicsDropShadowEffect::setBlurRadius(int blurRadius) { Q_D(QGraphicsDropShadowEffect); @@ -819,12 +866,17 @@ void QGraphicsDropShadowEffect::setBlurRadius(int blurRadius) \fn void QGraphicsDropShadowEffect::blurRadiusChanged(int blurRadius) This signal is emitted whenever the effect's blur radius changes. + The \a blurRadius parameter holds the effect's new blur radius. */ /*! - Returns the color of the drop shadow. + \property QGraphicsDropShadowEffect::color + \brief the color of the drop shadow. + + By default, the drop color is a semi-transparent dark gray + (QColor(63, 63, 63, 180)). - \sa setColor, offset(), blurRadius(), colorChanged() + \sa offset(), blurRadius() */ QColor QGraphicsDropShadowEffect::color() const { @@ -832,11 +884,6 @@ QColor QGraphicsDropShadowEffect::color() const return d->filter->color(); } -/*! - Sets the color of the drop shadow to the given \a color. - - \sa color(), setOffset(), setBlurRadius(), colorChanged() -*/ void QGraphicsDropShadowEffect::setColor(const QColor &color) { Q_D(QGraphicsDropShadowEffect); @@ -851,14 +898,21 @@ void QGraphicsDropShadowEffect::setColor(const QColor &color) \fn void QGraphicsDropShadowEffect::colorChanged(const QColor &color) This signal is emitted whenever the effect's color changes. + The \a color parameter holds the effect's new color. */ +/*! + \reimp +*/ QRectF QGraphicsDropShadowEffect::boundingRectFor(const QRectF &rect) const { Q_D(const QGraphicsDropShadowEffect); return d->filter->boundingRectFor(rect); } +/*! + \reimp +*/ void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsDropShadowEffect); @@ -897,19 +951,31 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *s \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, QGraphicsColorizeEffect */ + +/*! + Constructs a new QGraphicsOpacityEffect instance. + The \a parent parameter is passed to QGraphicsEffect's constructor. +*/ QGraphicsOpacityEffect::QGraphicsOpacityEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsOpacityEffectPrivate, parent) { } +/*! + Destroys the effect. +*/ QGraphicsOpacityEffect::~QGraphicsOpacityEffect() { } /*! - Returns the opacity. + \property QGraphicsOpacityEffect::opacity + \brief the opacity of the effect. + + The value should be in the range of 0.0 to 1.0, where 0.0 is + fully transparent and 1.0 is fully opaque. - \sa setOpacity(), opacityChanged() + By default, the opacity is 0.7. */ qreal QGraphicsOpacityEffect::opacity() const { @@ -917,12 +983,6 @@ qreal QGraphicsOpacityEffect::opacity() const return d->opacity; } -/*! - Sets the opacity to the given \a opacity. The value should be in the range - of 0.0 to 1.0, where 0.0 is fully transparent and 1.0 is fully opaque. - - \sa opacity(), opacityChanged() -*/ void QGraphicsOpacityEffect::setOpacity(qreal opacity) { Q_D(QGraphicsOpacityEffect); @@ -939,8 +999,12 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity) \fn void QGraphicsOpacityEffect::opacityChanged(qreal opacity) This signal is emitted whenever the effect's opacity changes. + The \a opacity parameter holds the effect's new opacity. */ +/*! + \reimp +*/ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *source) { Q_D(QGraphicsOpacityEffect); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 62d0848..d39044a 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4970,6 +4970,13 @@ void QWidgetPrivate::setSoftKeys_sys(const QList &softkeys) } #endif // !defined(Q_OS_SYMBIAN) +/*! + Returns a pointer to this widget's effect if it has one; otherwise 0. + + \since 4.6 + + \sa setGraphicsEffect() +*/ QGraphicsEffect *QWidget::graphicsEffect() const { Q_D(const QWidget); @@ -4987,6 +4994,8 @@ QGraphicsEffect *QWidget::graphicsEffect() const \note This function will apply the effect on itself and all its children. \since 4.6 + + \sa graphicsEffect() */ void QWidget::setGraphicsEffect(QGraphicsEffect *effect) { diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp index 5e37d62..e8cc7a1 100644 --- a/src/opengl/qgraphicsshadereffect.cpp +++ b/src/opengl/qgraphicsshadereffect.cpp @@ -126,7 +126,7 @@ QT_BEGIN_NAMESPACE the drawItem() method will draw its item argument directly with no effect applied. - \sa QGrapicsEffect + \sa QGraphicsEffect */ static const char qglslDefaultImageFragmentShader[] = "\ -- cgit v0.12 From d973b81e10b499982b5a7484fc09a6bcd1cf9295 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 26 Aug 2009 13:35:16 +0200 Subject: More test for QByteArray::fromBase64 that tests invalid input --- tests/auto/qbytearray/tst_qbytearray.cpp | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp index 4ec02bc..7951864 100644 --- a/tests/auto/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/qbytearray/tst_qbytearray.cpp @@ -90,6 +90,8 @@ private slots: void split(); void base64_data(); void base64(); + void fromBase64_data(); + void fromBase64(); void qvsnprintf(); void qstrlen(); void qstrnlen(); @@ -460,6 +462,10 @@ void tst_QByteArray::base64_data() for (int i = 0; i < 256; ++i) ba[i] = i; QTest::newRow("f") << ba << QByteArray("AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w=="); + + QTest::newRow("g") << QByteArray("foo\0bar", 7) << QByteArray("Zm9vAGJhcg=="); + QTest::newRow("h") << QByteArray("f\xd1oo\x9cbar") << QByteArray("ZtFvb7py"); + QTest::newRow("i") << QByteArray("\"\0\0\0\0\0\0\"", 8) << QByteArray("IgAAAAAAACI="); } @@ -475,6 +481,54 @@ void tst_QByteArray::base64() QCOMPARE(arr64, base64); } +//different from the previous test as the input are invalid +void tst_QByteArray::fromBase64_data() +{ + QTest::addColumn("rawdata"); + QTest::addColumn("base64"); + + QTest::newRow("1") << QByteArray("") << QByteArray(" "); + QTest::newRow("2") << QByteArray("1") << QByteArray("MQ"); + QTest::newRow("3") << QByteArray("12") << QByteArray("MTI "); + QTest::newRow("4") << QByteArray("123") << QByteArray("M=TIz"); + QTest::newRow("5") << QByteArray("1234") << QByteArray("MTI zN A "); + QTest::newRow("6") << QByteArray("\n") << QByteArray("Cg"); + QTest::newRow("7") << QByteArray("a\n") << QByteArray("======YQo="); + QTest::newRow("8") << QByteArray("ab\n") << QByteArray("Y\nWIK"); + QTest::newRow("9") << QByteArray("abc\n") << QByteArray("YWJjCg=="); + QTest::newRow("a") << QByteArray("abcd\n") << QByteArray("YWJ\1j\x9cZAo="); + QTest::newRow("b") << QByteArray("abcde\n") << QByteArray("YW JjZ\n G\tUK"); + QTest::newRow("c") << QByteArray("abcdef\n") << QByteArray("YWJjZGVmCg="); + QTest::newRow("d") << QByteArray("abcdefg\n") << QByteArray("YWJ\rjZGVmZwo"); + QTest::newRow("e") << QByteArray("abcdefgh\n") << QByteArray("YWJjZGVmZ2gK"); + + QByteArray ba; + ba.resize(256); + for (int i = 0; i < 256; ++i) + ba[i] = i; + QTest::newRow("f") << ba << QByteArray("AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Nj\n" + "c4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1u\n" + "b3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpa\n" + "anqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd\n" + "3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w== "); + + + QTest::newRow("g") << QByteArray("foo\0bar", 7) << QByteArray("Zm9vAGJhcg"); + QTest::newRow("h") << QByteArray("f\xd1oo\x9cbar") << QByteArray("ZtFv\0b7py", 9); + QTest::newRow("i") << QByteArray("\"\0\0\0\0\0\0\"", 8) << QByteArray("IgAAAAAAACI"); + +} + + +void tst_QByteArray::fromBase64() +{ + QFETCH(QByteArray, rawdata); + QFETCH(QByteArray, base64); + + QByteArray arr = QByteArray::fromBase64(base64); + QCOMPARE(arr, rawdata); +} + void tst_QByteArray::qvsnprintf() { char buf[20]; -- cgit v0.12 From 3d1cf992b28ffa9f3b18414bddd24865075fd953 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 26 Aug 2009 15:09:09 +0200 Subject: tst_QObject: test that we connect to the right signals when there is overloards This test would not pass if we sorted the signals by alphabetical order in the moc (in order to do a binary search) --- tests/auto/qobject/tst_qobject.cpp | 94 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 3 deletions(-) diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index a08f620..65dc742 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -120,6 +120,7 @@ private slots: void uniqConnection(); void interfaceIid(); void deleteQObjectWhenDeletingEvent(); + void overloads(); protected: }; @@ -2903,11 +2904,11 @@ void tst_QObject::uniqConnection() void tst_QObject::interfaceIid() { - QCOMPARE(QByteArray(qobject_interface_iid()), + QCOMPARE(QByteArray(qobject_interface_iid()), QByteArray(Bleh_iid)); - QCOMPARE(QByteArray(qobject_interface_iid()), + QCOMPARE(QByteArray(qobject_interface_iid()), QByteArray("com.qtest.foobar")); - QCOMPARE(QByteArray(qobject_interface_iid()), + QCOMPARE(QByteArray(qobject_interface_iid()), QByteArray()); } @@ -2927,6 +2928,93 @@ void tst_QObject::deleteQObjectWhenDeletingEvent() QCoreApplication::removePostedEvents(&o); // here you would get a deadlock } +class OverloadObject : public QObject +{ + friend class tst_QObject; + Q_OBJECT + signals: + void sig(int i, char c, qreal m = 12) const; + void sig(int i, int j = 12); + void sig(QObject *o, QObject *p, QObject *q = 0, QObject *r = 0) const; + void other(int a = 0); + void sig(QObject *o, OverloadObject *p = 0, QObject *q = 0, QObject *r = 0); + void sig(double r = 0.5); + public slots: + void slo(int i, int j = 43) + { + s_num += 1; + i1_num = i; + i2_num = j; + } + void slo(QObject *o, QObject *p = qApp, QObject *q = qApp, QObject *r = qApp) + { + s_num += 10; + o1_obj = o; + o2_obj = p; + o3_obj = q; + o4_obj = r; + } + void slo() + { + s_num += 100; + } + + public: + int s_num; + int i1_num; + int i2_num; + QObject *o1_obj; + QObject *o2_obj; + QObject *o3_obj; + QObject *o4_obj; +}; + +void tst_QObject::overloads() +{ + OverloadObject obj1; + OverloadObject obj2; + QObject obj3; + obj1.s_num = 0; + obj2.s_num = 0; + + connect (&obj1, SIGNAL(sig(int)) , &obj1, SLOT(slo(int))); + connect (&obj1, SIGNAL(sig(QObject *, QObject *, QObject *)) , &obj1, SLOT(slo(QObject * , QObject *, QObject *))); + + connect (&obj1, SIGNAL(sig(QObject *, QObject *, QObject *, QObject *)) , &obj2, SLOT(slo(QObject * , QObject *, QObject *))); + connect (&obj1, SIGNAL(sig(QObject *)) , &obj2, SLOT(slo())); + connect (&obj1, SIGNAL(sig(int, int)) , &obj2, SLOT(slo(int, int))); + + emit obj1.sig(0.5); //connected to nothing + emit obj1.sig(1, 'a'); //connected to nothing + QCOMPARE(obj1.s_num, 0); + QCOMPARE(obj2.s_num, 0); + + emit obj1.sig(1); //this signal is connected + QCOMPARE(obj1.s_num, 1); + QCOMPARE(obj1.i1_num, 1); + QCOMPARE(obj1.i2_num, 43); //default argument of the slot + + QCOMPARE(obj2.s_num, 1); + QCOMPARE(obj2.i1_num, 1); + QCOMPARE(obj2.i2_num, 12); //default argument of the signal + + + emit obj1.sig(&obj2); //this signal is conencted to obj2 + QCOMPARE(obj1.s_num, 1); + QCOMPARE(obj2.s_num, 101); + emit obj1.sig(&obj2, &obj3); //this signal is connected + QCOMPARE(obj1.s_num, 11); + QCOMPARE(obj1.o1_obj, &obj2); + QCOMPARE(obj1.o2_obj, &obj3); + QCOMPARE(obj1.o3_obj, (QObject *)0); //default arg of the signal + QCOMPARE(obj1.o4_obj, qApp); //default arg of the slot + + QCOMPARE(obj2.s_num, 111); + QCOMPARE(obj2.o1_obj, &obj2); + QCOMPARE(obj2.o2_obj, &obj3); + QCOMPARE(obj2.o3_obj, (QObject *)0); //default arg of the signal + QCOMPARE(obj2.o4_obj, qApp); //default arg of the slot +} QTEST_MAIN(tst_QObject) #include "tst_qobject.moc" -- cgit v0.12 From 25c7f57c21dd22eaa38b4b511aa754a1be711bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 26 Aug 2009 15:09:34 +0200 Subject: Remove Graphics View dependency from QGraphicsShaderEffect. Graphics effects are no longer in the Graphics View module. --- src/opengl/qgraphicsshadereffect.cpp | 4 ---- src/opengl/qgraphicsshadereffect.h | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp index e8cc7a1..293413c 100644 --- a/src/opengl/qgraphicsshadereffect.cpp +++ b/src/opengl/qgraphicsshadereffect.cpp @@ -51,8 +51,6 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - /*! \class QGraphicsShaderEffect \brief The QGraphicsShaderEffect class is the base class for creating @@ -313,6 +311,4 @@ void QGraphicsShaderEffect::setUniforms(QGLShaderProgram *program) Q_UNUSED(program); } -#endif // QT_NO_GRAPHICSVIEW - QT_END_NAMESPACE diff --git a/src/opengl/qgraphicsshadereffect.h b/src/opengl/qgraphicsshadereffect.h index c4637d7..672973b 100644 --- a/src/opengl/qgraphicsshadereffect.h +++ b/src/opengl/qgraphicsshadereffect.h @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(OpenGL) -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - class QGLShaderProgram; class QGLCustomShaderEffectStage; class QGraphicsShaderEffectPrivate; @@ -78,8 +76,6 @@ private: friend class QGLCustomShaderEffectStage; }; -#endif // QT_NO_GRAPHICSVIEW - QT_END_NAMESPACE QT_END_HEADER -- cgit v0.12 From 88ecc8c8250505129ccff2660c60412996e2fd85 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 26 Aug 2009 15:30:48 +0200 Subject: QAbstractItemView sometimes doesn't allow changing the selection If you do a selection with the mouse and react to selectionChanged by changing the selection. Those changes would be overwritten by QAbstractItemView::mouseReleaseEvent. It is useless to set the selection on mouse release. We already do that on mouse press. Task-number: 250683 Reviewed-by: ogoffart --- src/gui/itemviews/qabstractitemview.cpp | 3 --- tests/auto/qtreeview/tst_qtreeview.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index bca5df7..ccc57d7 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1661,9 +1661,6 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event) EditTrigger trigger = (selectedClicked ? SelectedClicked : NoEditTriggers); bool edited = edit(index, trigger, event); - if (d->selectionModel) - d->selectionModel->select(index, selectionCommand(index, event)); - setState(NoState); if (click) { diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index d28c3c3..44185e7 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -232,6 +232,7 @@ private slots: void task250683_wrongSectionSize(); void task239271_addRowsWithFirstColumnHidden(); void task254234_proxySort(); + void task248022_changeSelection(); }; class QtTestModel: public QAbstractItemModel @@ -3435,5 +3436,33 @@ void tst_QTreeView::task254234_proxySort() QCOMPARE(view.model()->data(view.model()->index(1,1)).toString(), QString::fromLatin1("g")); } +class TreeView : public QTreeView +{ + Q_OBJECT +public slots: + void handleSelectionChanged() + { + //let's select the last item + QModelIndex idx = model()->index(0, 0); + selectionModel()->select(QItemSelection(idx, idx), QItemSelectionModel::Select); + disconnect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(handleSelectionChanged())); + } +}; + +void tst_QTreeView::task248022_changeSelection() +{ + //we check that changing the selection between the mouse press and the mouse release + //works correctly + TreeView view; + QStringList list = QStringList() << "1" << "2"; + QStringListModel model(list); + view.setSelectionMode(QAbstractItemView::ExtendedSelection); + view.setModel(&model); + view.connect(view.selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(handleSelectionChanged())); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.visualRect(model.index(1)).center()); + QCOMPARE(view.selectionModel()->selectedIndexes().count(), list.count()); +} + + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" -- cgit v0.12 From 478f18e37a04849f4577ded7ba60d8360b6c5c90 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 26 Aug 2009 15:38:45 +0200 Subject: QMainWindow: adding autotest for the size of the central widget It just ensures that the central widget gets its correct size (ie. sizehint) when a menu bar is present. --- tests/auto/qmainwindow/tst_qmainwindow.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index e118c65..9156e5e 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -106,6 +106,7 @@ private slots: void isSeparator(); void setCursor(); void addToolbarAfterShow(); + void centralWidgetSize(); }; // Testing get/set functions @@ -1336,6 +1337,19 @@ public: } }; +class MyWidget : public QWidget +{ +public: + MyWidget(QWidget *parent = 0) : QWidget(parent) + { + } + + QSize sizeHint() const + { + return QSize(200, 200); + } +}; + void tst_QMainWindow::hideBeforeLayout() { QMainWindow win; @@ -1650,6 +1664,18 @@ void tst_QMainWindow::addToolbarAfterShow() QVERIFY(!toolBar.isHidden()); } +void tst_QMainWindow::centralWidgetSize() +{ + QMainWindow mainWindow; + mainWindow.menuBar()->addMenu("menu"); + + MyWidget widget; + mainWindow.setCentralWidget(&widget); + + mainWindow.show(); + QTest::qWait(100); + QCOMPARE(widget.size(), widget.sizeHint()); +} QTEST_MAIN(tst_QMainWindow) -- cgit v0.12 From 5ef11e48dd3bd8a6d51028128ee957aba27b0100 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 26 Aug 2009 16:04:21 +0200 Subject: Doc: Added a performance section to the Graphics View overview. Task-number: 253749 Reviewed-by: Trust Me --- doc/src/frameworks-technologies/graphicsview.qdoc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/src/frameworks-technologies/graphicsview.qdoc b/doc/src/frameworks-technologies/graphicsview.qdoc index 8d7ea2c..397cb19 100644 --- a/doc/src/frameworks-technologies/graphicsview.qdoc +++ b/doc/src/frameworks-technologies/graphicsview.qdoc @@ -551,4 +551,24 @@ the widget is transformed resolution independently, allowing the fonts and style to stay crisp when zoomed in. (Note that the effect of resolution independence depends on the style.) + + \section1 Performance + + \section2 Floating Point Instructions + + In order to accurately and quickly apply transformations and effects to + items, Graphics View is built with the assumption that the user's hardware + is able to provide reasonable performance for floating point instructions. + + Many workstations and desktop computers are equipped with suitable hardware + to accelerate this kind of computation, but some embedded devices may only + provide libraries to handle mathematical operations or emulate floating + point instructions in software. + + As a result, certain kinds of effects may be slower than expected on certain + devices. It may be possible to compensate for this performance hit by making + optimizations in other areas; for example, by using \l{#OpenGL Rendering}{OpenGL} + to render a scene. However, any such optimizations may themselves cause a + reduction in performance if they also rely on the presence of floating point + hardware. */ -- cgit v0.12 From 5be87d57602d72c225943f052783c1053cd3d81a Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 26 Aug 2009 16:02:30 +0200 Subject: don't crash when attempting to access properties of a JS Object that belonged to a deleted script engine When the engine is deleted, the JSValue is invalidated, but the QScriptValue's type will still be QScriptValuePrivate::JSC. Use a new helper function, isObject(), that checks both that the value is of type JSC _and_ that it is valid, before calling JSValue::isObject() (JSValue::isObject() assumes that the value is valid). --- src/script/api/qscriptvalue.cpp | 47 ++++++++++++++-------------- src/script/api/qscriptvalue_p.h | 6 ++++ tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 2 ++ 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 984ad1b..7fd1efe 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -278,7 +278,7 @@ qsreal ToInteger(qsreal n) QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolveMode) const { - Q_ASSERT(isJSC()); + Q_ASSERT(isObject()); JSC::ExecState *exec = engine->currentFrame; JSC::JSObject *object = jscValue.getObject(); JSC::PropertySlot slot(const_cast(object)); @@ -301,7 +301,7 @@ QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolv QScriptValue QScriptValuePrivate::property(quint32 index, int resolveMode) const { - Q_ASSERT(isJSC()); + Q_ASSERT(isObject()); JSC::ExecState *exec = engine->currentFrame; JSC::JSObject *object = jscValue.getObject(); JSC::PropertySlot slot(const_cast(object)); @@ -784,7 +784,7 @@ QScriptValue &QScriptValue::operator=(const QScriptValue &other) bool QScriptValue::isError() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return false; return d->jscValue.isObject(&JSC::ErrorInstance::info); } @@ -798,7 +798,7 @@ bool QScriptValue::isError() const bool QScriptValue::isArray() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return false; return d->jscValue.isObject(&JSC::JSArray::info); } @@ -812,7 +812,7 @@ bool QScriptValue::isArray() const bool QScriptValue::isDate() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return false; return d->jscValue.isObject(&JSC::DateInstance::info); } @@ -826,7 +826,7 @@ bool QScriptValue::isDate() const bool QScriptValue::isRegExp() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return false; return d->jscValue.isObject(&JSC::RegExpObject::info); } @@ -841,7 +841,7 @@ bool QScriptValue::isRegExp() const QScriptValue QScriptValue::prototype() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return QScriptValue(); return d->engine->scriptValueFromJSCValue(JSC::asObject(d->jscValue)->prototype()); } @@ -860,7 +860,7 @@ QScriptValue QScriptValue::prototype() const void QScriptValue::setPrototype(const QScriptValue &prototype) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return; if (prototype.isValid() && prototype.engine() && (prototype.engine() != engine())) { @@ -890,7 +890,7 @@ void QScriptValue::setPrototype(const QScriptValue &prototype) QScriptValue QScriptValue::scope() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return QScriptValue(); // ### make hidden property return d->property(QLatin1String("__qt_scope__"), QScriptValue::ResolveLocal); @@ -902,7 +902,7 @@ QScriptValue QScriptValue::scope() const void QScriptValue::setScope(const QScriptValue &scope) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return; if (scope.isValid() && scope.engine() && (scope.engine() != engine())) { @@ -934,7 +934,7 @@ void QScriptValue::setScope(const QScriptValue &scope) bool QScriptValue::instanceOf(const QScriptValue &other) const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject() || !other.isObject()) + if (!d || !d->isObject() || !other.isObject()) return false; if (other.engine() != engine()) { qWarning("QScriptValue::instanceof: " @@ -1693,7 +1693,7 @@ void QScriptValue::setProperty(const QString &name, const QScriptValue &value, const PropertyFlags &flags) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return; JSC::ExecState *exec = d->engine->currentFrame; d->setProperty(JSC::Identifier(exec, name), value, flags); @@ -1718,7 +1718,7 @@ QScriptValue QScriptValue::property(const QString &name, const ResolveFlags &mode) const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return QScriptValue(); return d->property(name, mode); } @@ -1740,7 +1740,7 @@ QScriptValue QScriptValue::property(quint32 arrayIndex, const ResolveFlags &mode) const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return QScriptValue(); return d->property(arrayIndex, mode); } @@ -1761,7 +1761,7 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value, const PropertyFlags &flags) { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return; if (value.engine() && (value.engine() != engine())) { qWarning("QScriptValue::setProperty() failed: " @@ -1811,7 +1811,7 @@ QScriptValue QScriptValue::property(const QScriptString &name, const ResolveFlags &mode) const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject() || !name.isValid()) + if (!d || !d->isObject() || !name.isValid()) return QScriptValue(); return d->property(name.d_ptr->identifier, mode); } @@ -1834,7 +1834,7 @@ void QScriptValue::setProperty(const QScriptString &name, const PropertyFlags &flags) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject() || !name.isValid()) + if (!d || !d->isObject() || !name.isValid()) return; d->setProperty(name.d_ptr->identifier, value, flags); } @@ -1849,7 +1849,7 @@ QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QString &name, const ResolveFlags &mode) const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return 0; JSC::ExecState *exec = d->engine->currentFrame; return d->propertyFlags(JSC::Identifier(exec, name), mode); @@ -1868,7 +1868,7 @@ QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QScriptString &nam const ResolveFlags &mode) const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject() || !name.isValid()) + if (!d || !d->isObject() || !name.isValid()) return 0; return d->propertyFlags(name.d_ptr->identifier, mode); } @@ -2272,7 +2272,7 @@ bool QScriptValue::isUndefined() const bool QScriptValue::isObject() const { Q_D(const QScriptValue); - return d && d->isJSC() && d->jscValue.isObject(); + return d && d->isObject(); } /*! @@ -2319,10 +2319,9 @@ bool QScriptValue::isQObject() const bool QScriptValue::isQMetaObject() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return false; return JSC::asObject(d->jscValue)->isObject(&QScript::QMetaObjectWrapperObject::info); - return false; } /*! @@ -2346,7 +2345,7 @@ bool QScriptValue::isValid() const QScriptValue QScriptValue::data() const { Q_D(const QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return QScriptValue(); if (d->jscValue.isObject(&QScriptObject::info)) { QScriptObject *scriptObject = static_cast(JSC::asObject(d->jscValue)); @@ -2368,7 +2367,7 @@ QScriptValue QScriptValue::data() const void QScriptValue::setData(const QScriptValue &data) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject()) + if (!d || !d->isObject()) return; JSC::JSValue other = d->engine->scriptValueToJSCValue(data); if (d->jscValue.isObject(&QScriptObject::info)) { diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index c440013..6d57d32 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -85,6 +85,7 @@ public: inline void initFrom(const QString &value); inline bool isJSC() const; + inline bool isObject() const; QVariant &variantValue() const; void setVariantValue(const QVariant &value); @@ -144,6 +145,11 @@ inline bool QScriptValuePrivate::isJSC() const return (type == JSC); } +inline bool QScriptValuePrivate::isObject() const +{ + return isJSC() && jscValue && jscValue.isObject(); +} + // Rest of inline functions implemented in qscriptengine_p.h QT_END_NAMESPACE diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index e712017..b125965 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -3278,6 +3278,8 @@ void tst_QScriptValue::engineDeleted() QVERIFY(v4.engine() == 0); QVERIFY(v5.isValid()); QVERIFY(v5.engine() == 0); + + QVERIFY(!v3.property("foo").isValid()); } void tst_QScriptValue::valueOfWithClosure() -- cgit v0.12 From fad842cebeab8cba78141edd10756a51885f448b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 23 Jul 2009 11:04:25 +0100 Subject: Add move API to QAbstractItemModel. This adds the function beginMoveRows, endMoveRows, beginMoveColumns, endMoveColumns Reviewed-by: Olivier Goffart Acknowledged-by: Thierry Merge-request: 972 --- src/corelib/kernel/qabstractitemmodel.cpp | 327 ++++++++ src/corelib/kernel/qabstractitemmodel.h | 13 + src/corelib/kernel/qabstractitemmodel_p.h | 7 + tests/auto/qabstractitemmodel/dynamictreemodel.cpp | 245 ++++++ tests/auto/qabstractitemmodel/dynamictreemodel.h | 141 ++++ .../auto/qabstractitemmodel/qabstractitemmodel.pro | 5 +- .../qabstractitemmodel/tst_qabstractitemmodel.cpp | 841 ++++++++++++++++++++- 7 files changed, 1577 insertions(+), 2 deletions(-) create mode 100644 tests/auto/qabstractitemmodel/dynamictreemodel.cpp create mode 100644 tests/auto/qabstractitemmodel/dynamictreemodel.h diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 3b7059b..fb0afcc 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -599,6 +599,118 @@ void QAbstractItemModelPrivate::rowsInserted(const QModelIndex &parent, } } +void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation) +{ + Q_Q(QAbstractItemModel); + QVector persistent_moved_explicitly; + QVector persistent_moved_in_source; + QVector persistent_moved_in_destination; + + QHash::const_iterator it; + const QHash::const_iterator begin = persistent.indexes.constBegin(); + const QHash::const_iterator end = persistent.indexes.constEnd(); + + const bool sameParent = (srcParent == destinationParent); + const bool movingUp = (srcFirst > destinationChild); + + for ( it = begin; it != end; ++it) { + QPersistentModelIndexData *data = *it; + const QModelIndex &index = data->index; + const QModelIndex &parent = index.parent(); + const bool isSourceIndex = (parent == srcParent); + const bool isDestinationIndex = (parent == destinationParent); + + int childPosition; + if (orientation == Qt::Vertical) + childPosition = index.row(); + else + childPosition = index.column(); + + if (!index.isValid() || !(isSourceIndex || isDestinationIndex ) ) + continue; + + if (!sameParent && isDestinationIndex) { + if (childPosition >= destinationChild) + persistent_moved_in_destination.append(data); + continue; + } + + if (sameParent && movingUp && childPosition < destinationChild) + continue; + + if (sameParent && !movingUp && childPosition < srcFirst ) + continue; + + if (!sameParent && childPosition < srcFirst) + continue; + + if (sameParent && (childPosition > srcLast) && (childPosition >= destinationChild )) + continue; + + if ((childPosition <= srcLast) && (childPosition >= srcFirst)) { + persistent_moved_explicitly.append(data); + } else { + persistent_moved_in_source.append(data); + } + } + persistent.moved.push(persistent_moved_explicitly); + persistent.moved.push(persistent_moved_in_source); + persistent.moved.push(persistent_moved_in_destination); +} + +/*! + \internal + + Moves persistent indexes \a indexes by amount \a change. The change will be either a change in row value or a change in + column value depending on the value of \a orientation. The indexes may also be moved to a different parent if \a parent + differs from the existing parent for the index. +*/ +void QAbstractItemModelPrivate::movePersistentIndexes(QVector indexes, int change, const QModelIndex &parent, Qt::Orientation orientation) +{ + QVector::const_iterator it; + const QVector::const_iterator begin = indexes.constBegin(); + const QVector::const_iterator end = indexes.constEnd(); + + for (it = begin; it != end; ++it) + { + QPersistentModelIndexData *data = *it; + + int row = data->index.row(); + int column = data->index.column(); + + if (Qt::Vertical == orientation) + row += change; + else + column += change; + + persistent.indexes.erase(persistent.indexes.find(data->index)); + data->index = q_func()->index(row, column, parent); + if (data->index.isValid()) { + persistent.insertMultiAtEnd(data->index, data); + } else { + qWarning() << "QAbstractItemModel::endMoveRows: Invalid index (" << row << "," << column << ") in model" << q_func(); + } + } +} + +void QAbstractItemModelPrivate::itemsMoved(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation) +{ + QVector moved_in_destination = persistent.moved.pop(); + QVector moved_in_source = persistent.moved.pop(); + QVector moved_explicitly = persistent.moved.pop(); + + const bool sameParent = (sourceParent == destinationParent); + const bool movingUp = (sourceFirst > destinationChild); + + const int explicit_change = (!sameParent || movingUp) ? destinationChild - sourceFirst : destinationChild - sourceLast - 1 ; + const int source_change = (!sameParent || !movingUp) ? -1*(sourceLast - sourceFirst + 1) : sourceLast - sourceFirst + 1 ; + const int destination_change = sourceLast - sourceFirst + 1; + + movePersistentIndexes(moved_explicitly, explicit_change, destinationParent, orientation); + movePersistentIndexes(moved_in_source, source_change, sourceParent, orientation); + movePersistentIndexes(moved_in_destination, destination_change, destinationParent, orientation); +} + void QAbstractItemModelPrivate::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last) { @@ -1370,6 +1482,36 @@ QAbstractItemModel::~QAbstractItemModel() */ /*! + \fn void QAbstractItemModel::rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) + + This signal is emitted after rows have been moved within the + model. The items between \a sourceStart and \a sourceEnd + inclusive, under the given \a sourceParent item have been moved to \a destinationParent + starting at the row \a destinationRow. + + \bold{Note:} Components connected to this signal use it to adapt to changes + in the model's dimensions. It can only be emitted by the QAbstractItemModel + implementation, and cannot be explicitly emitted in subclass code. + + \sa beginMoveRows() +*/ + +/*! + \fn void QAbstractItemModel::rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) + + This signal is emitted just before rows are moved within the + model. The items that will be moved are those between \a sourceStart and \a sourceEnd + inclusive, under the given \a sourceParent item. They will be moved to \a destinationParent + starting at the row \a destinationRow. + + \bold{Note:} Components connected to this signal use it to adapt to changes + in the model's dimensions. It can only be emitted by the QAbstractItemModel + implementation, and cannot be explicitly emitted in subclass code. + + \sa beginMoveRows() +*/ + +/*! \fn void QAbstractItemModel::columnsInserted(const QModelIndex &parent, int start, int end) This signal is emitted after columns have been inserted into the model. The @@ -2284,6 +2426,116 @@ void QAbstractItemModel::endRemoveRows() } /*! + Returns whether a move operation is valid. + + A move operation is not allowed if it moves a continuous range of rows to a destination within + itself, or if it attempts to move a row to one of its own descendants. + + \internal +*/ +bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int start, int end, const QModelIndex &destinationParent, int destinationStart, Qt::Orientation orientation) +{ + Q_Q(QAbstractItemModel); + // Don't move the range within itself. + if ( ( destinationParent == srcParent ) + && ( destinationStart >= start ) + && ( destinationStart <= end + 1) ) + return false; + + QModelIndex destinationAncestor = destinationParent; + int pos = (Qt::Vertical == orientation) ? destinationAncestor.row() : destinationAncestor.column(); + forever { + if (destinationAncestor == srcParent) { + if (pos >= start && pos <= end) + return false; + break; + } + + if (!destinationAncestor.isValid()) + break; + + pos = (Qt::Vertical == orientation) ? destinationAncestor.row() : destinationAncestor.column(); + destinationAncestor = destinationAncestor.parent(); + } + + return true; +} + +/*! + Begins a row move operation. + + When reimplementing a subclass, this method simplifies moving entities + in your model. This method is responsible for moving persistent indexes + in the model, which you would otherwise be required to do yourself. + + Using beginMoveRows and endMoveRows is an alternative to emitting + layoutAboutToBeChanged and layoutChanged directly along with changePersistentIndexes. + layoutAboutToBeChanged is emitted by this method for compatibility reasons. + + The \a sourceParent index corresponds to the parent from which the + rows are moved; \a sourceFirst and \a sourceLast are the row numbers of the + rows to be moved. The \a destinationParent index corresponds to the parent into which + the rows are moved. The \a destinationRow is the row to which the rows will be moved. + That is, the index at row \a sourceFirst in \a sourceParent will become row \a destinationRow + in \a destinationParent. Its siblings will be moved correspondingly. + + Note that \a sourceParent and \a destinationParent may be the same, in which case you must + ensure that the \a destinationRow is not within the range of \a sourceFirst and \a sourceLast. + You must also ensure that you do not attempt to move a row to one of its own chilren or ancestors. + This method returns false if either condition is true, in which case you should abort your move operation. + + \sa endMoveRows() + + \since 4.6 +*/ +bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) +{ + Q_ASSERT(sourceFirst >= 0); + Q_ASSERT(sourceLast >= sourceFirst); + Q_ASSERT(destinationChild >= 0); + Q_D(QAbstractItemModel); + + if (!d->allowMove(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical)) { + return false; + } + + d->changes.push(QAbstractItemModelPrivate::Change(sourceParent, sourceFirst, sourceLast)); + int destinationLast = destinationChild + (sourceLast - sourceFirst); + d->changes.push(QAbstractItemModelPrivate::Change(destinationParent, destinationChild, destinationLast)); + + d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical); + emit rowsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild); + emit layoutAboutToBeChanged(); + return true; +} + +/*! + Ends a row move operation. + + When implementing a subclass, you must call this + function \e after moving data within the model's underlying data + store. + + layoutChanged is emitted by this method for compatibility reasons. + + \sa beginMoveRows() + + \since 4.6 +*/ +void QAbstractItemModel::endMoveRows() +{ + Q_D(QAbstractItemModel); + + QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); + QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); + + d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Vertical); + + emit rowsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first); + emit layoutChanged(); +} + +/*! Begins a column insertion operation. When reimplementing insertColumns() in a subclass, you must call this @@ -2406,6 +2658,81 @@ void QAbstractItemModel::endRemoveColumns() } /*! + Begins a column move operation. + + When reimplementing a subclass, this method simplifies moving entities + in your model. This method is responsible for moving persistent indexes + in the model, which you would otherwise be required to do yourself. + + Using beginMoveColumns and endMoveColumns is an alternative to emitting + layoutAboutToBeChanged and layoutChanged directly along with changePersistentIndexes. + layoutAboutToBeChanged is emitted by this method for compatibility reasons. + + The \a sourceParent index corresponds to the parent from which the + columns are moved; \a sourceFirst and \a sourceLast are the column numbers of the + columns to be moved. The \a destinationParent index corresponds to the parent into which + the columns are moved. The \a destinationColumn is the column to which the columns will be moved. + That is, the index at column \a sourceFirst in \a sourceParent will become column \a destinationColumn + in \a destinationParent. Its siblings will be moved correspondingly. + + Note that \a sourceParent and \a destinationParent may be the same, in which case you must + ensure that the \a destinationColumn is not within the range of \a sourceFirst and \a sourceLast. + You must also ensure that you do not attempt to move a row to one of its own chilren or ancestors. + This method returns false if either condition is true, in which case you should abort your move operation. + + \sa endMoveColumns() + + \since 4.6 +*/ +bool QAbstractItemModel::beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) +{ + Q_ASSERT(sourceFirst >= 0); + Q_ASSERT(sourceLast >= sourceFirst); + Q_ASSERT(destinationChild >= 0); + Q_D(QAbstractItemModel); + + if (!d->allowMove(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Horizontal)) { + return false; + } + + d->changes.push(QAbstractItemModelPrivate::Change(sourceParent, sourceFirst, sourceLast)); + int destinationLast = destinationChild + (sourceLast - sourceFirst); + d->changes.push(QAbstractItemModelPrivate::Change(destinationParent, destinationChild, destinationLast)); + + d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Horizontal); + + emit columnsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild); + emit layoutAboutToBeChanged(); + return true; +} + +/*! + Ends a column move operation. + + When implementing a subclass, you must call this + function \e after moving data within the model's underlying data + store. + + layoutChanged is emitted by this method for compatibility reasons. + + \sa beginMoveColumns() + + \since 4.6 +*/ +void QAbstractItemModel::endMoveColumns() +{ + Q_D(QAbstractItemModel); + + QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); + QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); + + d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Horizontal); + + emit columnsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first); + emit layoutChanged(); +} + +/*! Resets the model to its original state in any attached views. The view to which the model is attached to will be reset as well. diff --git a/src/corelib/kernel/qabstractitemmodel.h b/src/corelib/kernel/qabstractitemmodel.h index 00f6cb2..b47e4cb 100644 --- a/src/corelib/kernel/qabstractitemmodel.h +++ b/src/corelib/kernel/qabstractitemmodel.h @@ -252,6 +252,13 @@ private: // can only be emitted by QAbstractItemModel void modelAboutToBeReset(); void modelReset(); + void rowsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow ); + void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row ); + + void columnsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn ); + void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column ); + + public Q_SLOTS: virtual bool submit(); virtual void revert(); @@ -272,12 +279,18 @@ protected: void beginRemoveRows(const QModelIndex &parent, int first, int last); void endRemoveRows(); + bool beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow); + void endMoveRows(); + void beginInsertColumns(const QModelIndex &parent, int first, int last); void endInsertColumns(); void beginRemoveColumns(const QModelIndex &parent, int first, int last); void endRemoveColumns(); + bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn); + void endMoveColumns(); + void reset(); void changePersistentIndex(const QModelIndex &from, const QModelIndex &to); diff --git a/src/corelib/kernel/qabstractitemmodel_p.h b/src/corelib/kernel/qabstractitemmodel_p.h index e81e627..aae3cba 100644 --- a/src/corelib/kernel/qabstractitemmodel_p.h +++ b/src/corelib/kernel/qabstractitemmodel_p.h @@ -80,6 +80,7 @@ class Q_CORE_EXPORT QAbstractItemModelPrivate : public QObjectPrivate public: QAbstractItemModelPrivate() : QObjectPrivate(), supportedDragActions(-1), roleNames(defaultRoleNames()) {} void removePersistentIndexData(QPersistentModelIndexData *data); + void movePersistentIndexes(QVector indexes, int change, const QModelIndex &parent, Qt::Orientation orientation); void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last); void rowsInserted(const QModelIndex &parent, int first, int last); void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); @@ -91,6 +92,10 @@ public: static QAbstractItemModel *staticEmptyModel(); static bool variantLessThan(const QVariant &v1, const QVariant &v2); + void itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation); + void itemsMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation); + bool allowMove(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation); + inline QModelIndex createIndex(int row, int column, void *data = 0) const { return q_func()->createIndex(row, column, data); } @@ -132,6 +137,8 @@ public: Change(const QModelIndex &p, int f, int l) : parent(p), first(f), last(l) {} QModelIndex parent; int first, last; + + bool isValid() { return first >= 0 && last >= 0; } }; QStack changes; diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp b/tests/auto/qabstractitemmodel/dynamictreemodel.cpp new file mode 100644 index 0000000..6c3e0cb --- /dev/null +++ b/tests/auto/qabstractitemmodel/dynamictreemodel.cpp @@ -0,0 +1,245 @@ +/* + Copyright (c) 2009 Stephen Kelly + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +#include "dynamictreemodel.h" + +#include +#include +#include + +#include + +#include + +DynamicTreeModel::DynamicTreeModel(QObject *parent) + : QAbstractItemModel(parent), + nextId(1) +{ +} + +QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &parent) const +{ +// if (column != 0) +// return QModelIndex(); + + + if ( column < 0 || row < 0 ) + return QModelIndex(); + + QList > childIdColumns = m_childItems.value(parent.internalId()); + + + if (childIdColumns.size() == 0) + return QModelIndex(); + + if (column >= childIdColumns.size()) + return QModelIndex(); + + QList rowIds = childIdColumns.at(column); + + if ( row >= rowIds.size()) + return QModelIndex(); + + qint64 id = rowIds.at(row); + + return createIndex(row, column, reinterpret_cast(id)); + +} + +qint64 DynamicTreeModel::findParentId(qint64 searchId) const +{ + if (searchId <= 0) + return -1; + + QHashIterator > > i(m_childItems); + while (i.hasNext()) + { + i.next(); + QListIterator > j(i.value()); + while (j.hasNext()) + { + QList l = j.next(); + if (l.contains(searchId)) + { + return i.key(); + } + } + } + return -1; +} + +QModelIndex DynamicTreeModel::parent(const QModelIndex &index) const +{ + if (!index.isValid()) + return QModelIndex(); + + qint64 searchId = index.internalId(); + qint64 parentId = findParentId(searchId); + // Will never happen for valid index, but what the hey... + if (parentId <= 0) + return QModelIndex(); + + qint64 grandParentId = findParentId(parentId); + if (grandParentId < 0) + grandParentId = 0; + + int column = 0; + QList childList = m_childItems.value(grandParentId).at(column); + + int row = childList.indexOf(parentId); + + return createIndex(row, column, reinterpret_cast(parentId)); + +} + +int DynamicTreeModel::rowCount(const QModelIndex &index ) const +{ + QList > cols = m_childItems.value(index.internalId()); + + if (cols.size() == 0 ) + return 0; + + if (index.column() > 0) + return 0; + + return cols.at(0).size(); +} + +int DynamicTreeModel::columnCount(const QModelIndex &index ) const +{ +// Q_UNUSED(index); + return m_childItems.value(index.internalId()).size(); +} + +QVariant DynamicTreeModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + if (Qt::DisplayRole == role) + { + return m_items.value(index.internalId()); + } + return QVariant(); +} + +void DynamicTreeModel::clear() +{ + m_items.clear(); + m_childItems.clear(); + nextId = 1; + reset(); +} + + +ModelChangeCommand::ModelChangeCommand( DynamicTreeModel *model, QObject *parent ) + : QObject(parent), m_model(model), m_numCols(1), m_startRow(-1), m_endRow(-1) +{ + +} + +QModelIndex ModelChangeCommand::findIndex(QList rows) +{ + const int col = 0; + QModelIndex parent = QModelIndex(); + QListIterator i(rows); + while (i.hasNext()) + { + parent = m_model->index(i.next(), col, parent); + Q_ASSERT(parent.isValid()); + } + return parent; +} + +ModelInsertCommand::ModelInsertCommand(DynamicTreeModel *model, QObject *parent ) + : ModelChangeCommand(model, parent) +{ + +} + +void ModelInsertCommand::doCommand() +{ + QModelIndex parent = findIndex(m_rowNumbers); + m_model->beginInsertRows(parent, m_startRow, m_endRow); + qint64 parentId = parent.internalId(); + for (int row = m_startRow; row <= m_endRow; row++) + { + for(int col = 0; col < m_numCols; col++ ) + { + if (m_model->m_childItems[parentId].size() <= col) + { + m_model->m_childItems[parentId].append(QList()); + } +// QString name = QUuid::createUuid().toString(); + qint64 id = m_model->newId(); + QString name = QString::number(id); + + m_model->m_items.insert(id, name); + m_model->m_childItems[parentId][col].insert(row, id); + + } + } + m_model->endInsertRows(); +} + + +ModelMoveCommand::ModelMoveCommand(DynamicTreeModel *model, QObject *parent) + : ModelChangeCommand(model, parent) +{ + +} + +void ModelMoveCommand::doCommand() +{ + QModelIndex srcParent = findIndex(m_rowNumbers); + QModelIndex destParent = findIndex(m_destRowNumbers); + + if (!m_model->beginMoveRows(srcParent, m_startRow, m_endRow, destParent, m_destRow)) + { + return; + } + + for (int column = 0; column < m_numCols; ++column) + { + QList l = m_model->m_childItems.value(srcParent.internalId())[column].mid(m_startRow, m_endRow - m_startRow + 1 ); + + for (int i = m_startRow; i <= m_endRow ; i++) + { + m_model->m_childItems[srcParent.internalId()][column].removeAt(m_startRow); + } + int d; + if (m_destRow < m_startRow) + d = m_destRow; + else + { + if (srcParent == destParent) + d = m_destRow - (m_endRow - m_startRow + 1); + else + d = m_destRow - (m_endRow - m_startRow) + 1; + } + + foreach(const qint64 id, l) + { + m_model->m_childItems[destParent.internalId()][column].insert(d++, id); + } + } + + m_model->endMoveRows(); +} + diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.h b/tests/auto/qabstractitemmodel/dynamictreemodel.h new file mode 100644 index 0000000..88e293c --- /dev/null +++ b/tests/auto/qabstractitemmodel/dynamictreemodel.h @@ -0,0 +1,141 @@ +/* + Copyright (c) 2009 Stephen Kelly + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +#ifndef DYNAMICTREEMODEL_H +#define DYNAMICTREEMODEL_H + +#include + +#include +#include + +#include + +#include + +template class QList; + +class DynamicTreeModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + DynamicTreeModel(QObject *parent = 0); + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + int rowCount(const QModelIndex &index = QModelIndex()) const; + int columnCount(const QModelIndex &index = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + + void clear(); + +protected slots: + + /** + Finds the parent id of the string with id @p searchId. + + Returns -1 if not found. + */ + qint64 findParentId(qint64 searchId) const; + +private: + QHash m_items; + QHash > > m_childItems; + qint64 nextId; + qint64 newId() { return nextId++; }; + + QModelIndex m_nextParentIndex; + int m_nextRow; + + int m_depth; + int maxDepth; + + friend class ModelInsertCommand; + friend class ModelMoveCommand; + +}; + + +class ModelChangeCommand : public QObject +{ + Q_OBJECT +public: + + ModelChangeCommand( DynamicTreeModel *model, QObject *parent = 0 ); + + virtual ~ModelChangeCommand() {} + + void setAncestorRowNumbers(QList rowNumbers) { m_rowNumbers = rowNumbers; } + + QModelIndex findIndex(QList rows); + + void setStartRow(int row) { m_startRow = row; } + + void setEndRow(int row) { m_endRow = row; } + + void setNumCols(int cols) { m_numCols = cols; } + + virtual void doCommand() = 0; + +protected: + DynamicTreeModel* m_model; + QList m_rowNumbers; + int m_numCols; + int m_startRow; + int m_endRow; + +}; + +typedef QList ModelChangeCommandList; + +class ModelInsertCommand : public ModelChangeCommand +{ + Q_OBJECT + +public: + + ModelInsertCommand(DynamicTreeModel *model, QObject *parent = 0 ); + virtual ~ModelInsertCommand() {} + + virtual void doCommand(); +}; + +class ModelMoveCommand : public ModelChangeCommand +{ + Q_OBJECT +public: + ModelMoveCommand(DynamicTreeModel *model, QObject *parent); + + virtual ~ModelMoveCommand() {} + + virtual void doCommand(); + + void setDestAncestors( QList rows ) { m_destRowNumbers = rows; } + + void setDestRow(int row) { m_destRow = row; } + +protected: + QList m_destRowNumbers; + int m_destRow; +}; + + +#endif diff --git a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro index 5ad1020..84ed5a2 100644 --- a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro +++ b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro @@ -1,3 +1,6 @@ load(qttest_p4) -SOURCES += tst_qabstractitemmodel.cpp +SOURCES += tst_qabstractitemmodel.cpp dynamictreemodel.cpp +HEADERS += dynamictreemodel.h + QT = core + diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp index e99ce06..9c83474 100644 --- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -46,6 +46,10 @@ //TESTED_CLASS=QAbstractListModel QAbstractTableModel //TESTED_FILES= +#include "dynamictreemodel.h" + +Q_DECLARE_METATYPE(QModelIndex) + /*! Note that this doesn't test models, but any functionality that QAbstractItemModel shoudl provide */ @@ -86,6 +90,30 @@ private slots: void complexChangesWithPersistent(); + void testMoveSameParentUp_data(); + void testMoveSameParentUp(); + + void testMoveSameParentDown_data(); + void testMoveSameParentDown(); + + void testMoveToGrandParent_data(); + void testMoveToGrandParent(); + + void testMoveToSibling_data(); + void testMoveToSibling(); + + void testMoveToUncle_data(); + void testMoveToUncle(); + + void testMoveToDescendants(); + + void testMoveWithinOwnRange_data(); + void testMoveWithinOwnRange(); + + +private: + DynamicTreeModel *m_model; + }; /*! @@ -242,7 +270,20 @@ void tst_QAbstractItemModel::cleanupTestCase() void tst_QAbstractItemModel::init() { - + m_model = new DynamicTreeModel(this); + + ModelInsertCommand *insertCommand = new ModelInsertCommand(m_model, this); + insertCommand->setNumCols(4); + insertCommand->setStartRow(0); + insertCommand->setEndRow(9); + insertCommand->doCommand(); + + insertCommand = new ModelInsertCommand(m_model, this); + insertCommand->setAncestorRowNumbers(QList() << 5); + insertCommand->setNumCols(4); + insertCommand->setStartRow(0); + insertCommand->setEndRow(9); + insertCommand->doCommand(); } void tst_QAbstractItemModel::cleanup() @@ -815,5 +856,803 @@ void tst_QAbstractItemModel::complexChangesWithPersistent() } +void tst_QAbstractItemModel::testMoveSameParentDown_data() +{ + QTest::addColumn("startRow"); + QTest::addColumn("endRow"); + QTest::addColumn("destRow"); + + // Move from the start to the middle + QTest::newRow("move01") << 0 << 2 << 8; + // Move from the start to the end + QTest::newRow("move02") << 0 << 2 << 10; + // Move from the middle to the middle + QTest::newRow("move03") << 3 << 5 << 8; + // Move from the middle to the end + QTest::newRow("move04") << 3 << 5 << 10; +} + +void tst_QAbstractItemModel::testMoveSameParentDown() +{ + QFETCH( int, startRow); + QFETCH( int, endRow); + QFETCH( int, destRow); + + QList persistentList; + QModelIndexList indexList; + + for (int column = 0; column < m_model->columnCount(); ++column) + { + for (int row= 0; row < m_model->rowCount(); ++row) + { + QModelIndex idx = m_model->index(row, column); + QVERIFY(idx.isValid()); + indexList << idx; + persistentList << QPersistentModelIndex(idx); + } + } + + QModelIndex parent = m_model->index(5, 0); + for (int column = 0; column < m_model->columnCount(); ++column) + { + for (int row= 0; row < m_model->rowCount(parent); ++row) + { + QModelIndex idx = m_model->index(row, column, parent); + QVERIFY(idx.isValid()); + indexList << idx; + persistentList << QPersistentModelIndex(idx); + } + } + + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + + ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); + moveCommand->setNumCols(4); + moveCommand->setStartRow(startRow); + moveCommand->setEndRow(endRow); + moveCommand->setDestRow(destRow); + moveCommand->doCommand(); + + QVariantList beforeSignal = beforeSpy.takeAt(0); + QVariantList afterSignal = afterSpy.takeAt(0); + + QCOMPARE(beforeSignal.size(), 5); + QCOMPARE(beforeSignal.at(0).value(), QModelIndex()); + QCOMPARE(beforeSignal.at(1).toInt(), startRow); + QCOMPARE(beforeSignal.at(2).toInt(), endRow); + QCOMPARE(beforeSignal.at(3).value(), QModelIndex()); + QCOMPARE(beforeSignal.at(4).toInt(), destRow); + + QCOMPARE(afterSignal.size(), 5); + QCOMPARE(afterSignal.at(0).value(), QModelIndex()); + QCOMPARE(afterSignal.at(1).toInt(), startRow); + QCOMPARE(afterSignal.at(2).toInt(), endRow); + QCOMPARE(afterSignal.at(3).value(), QModelIndex()); + QCOMPARE(afterSignal.at(4).toInt(), destRow); + + for (int i = 0; i < indexList.size(); i++) + { + QModelIndex idx = indexList.at(i); + QModelIndex persistentIndex = persistentList.at(i); + if (idx.parent() == QModelIndex()) + { + int row = idx.row(); + if ( row >= startRow) + { + if (row <= endRow) + { + QCOMPARE(row + destRow - endRow - 1, persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + QCOMPARE(idx.parent(), persistentIndex.parent()); + QCOMPARE(idx.model(), persistentIndex.model()); + } else if ( row < destRow) + { + QCOMPARE(row - (endRow - startRow + 1), persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + QCOMPARE(idx.parent(), persistentIndex.parent()); + QCOMPARE(idx.model(), persistentIndex.model()); + } else + { + QCOMPARE(idx, persistentIndex); + } + } else + { + QCOMPARE(idx, persistentIndex); + } + } else + { + QCOMPARE(idx, persistentIndex); + } + } +} + +void tst_QAbstractItemModel::testMoveSameParentUp_data() +{ + QTest::addColumn("startRow"); + QTest::addColumn("endRow"); + QTest::addColumn("destRow"); + + // Move from the middle to the start + QTest::newRow("move01") << 5 << 7 << 0; + // Move from the end to the start + QTest::newRow("move02") << 8 << 9 << 0; + // Move from the middle to the middle + QTest::newRow("move03") << 5 << 7 << 2; + // Move from the end to the middle + QTest::newRow("move04") << 8 << 9 << 5; +} + +void tst_QAbstractItemModel::testMoveSameParentUp() +{ + + QFETCH( int, startRow); + QFETCH( int, endRow); + QFETCH( int, destRow); + + QList persistentList; + QModelIndexList indexList; + + for (int column = 0; column < m_model->columnCount(); ++column) + { + for (int row= 0; row < m_model->rowCount(); ++row) + { + QModelIndex idx = m_model->index(row, column); + QVERIFY(idx.isValid()); + indexList << idx; + persistentList << QPersistentModelIndex(idx); + } + } + + QModelIndex parent = m_model->index(2, 0); + for (int column = 0; column < m_model->columnCount(); ++column) + { + for (int row= 0; row < m_model->rowCount(parent); ++row) + { + QModelIndex idx = m_model->index(row, column, parent); + QVERIFY(idx.isValid()); + indexList << idx; + persistentList << QPersistentModelIndex(idx); + } + } + + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + + + ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); + moveCommand->setNumCols(4); + moveCommand->setStartRow(startRow); + moveCommand->setEndRow(endRow); + moveCommand->setDestRow(destRow); + moveCommand->doCommand(); + + QVariantList beforeSignal = beforeSpy.takeAt(0); + QVariantList afterSignal = afterSpy.takeAt(0); + + QCOMPARE(beforeSignal.size(), 5); + QCOMPARE(beforeSignal.at(0).value(), QModelIndex()); + QCOMPARE(beforeSignal.at(1).toInt(), startRow); + QCOMPARE(beforeSignal.at(2).toInt(), endRow); + QCOMPARE(beforeSignal.at(3).value(), QModelIndex()); + QCOMPARE(beforeSignal.at(4).toInt(), destRow); + + QCOMPARE(afterSignal.size(), 5); + QCOMPARE(afterSignal.at(0).value(), QModelIndex()); + QCOMPARE(afterSignal.at(1).toInt(), startRow); + QCOMPARE(afterSignal.at(2).toInt(), endRow); + QCOMPARE(afterSignal.at(3).value(), QModelIndex()); + QCOMPARE(afterSignal.at(4).toInt(), destRow); + + + for (int i = 0; i < indexList.size(); i++) + { + QModelIndex idx = indexList.at(i); + QModelIndex persistentIndex = persistentList.at(i); + if (idx.parent() == QModelIndex()) + { + int row = idx.row(); + if ( row >= destRow) + { + if (row < startRow) + { + QCOMPARE(row + endRow - startRow + 1, persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + QCOMPARE(idx.parent(), persistentIndex.parent()); + QCOMPARE(idx.model(), persistentIndex.model()); + } else if ( row <= endRow) + { + QCOMPARE(row + destRow - startRow, persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + QCOMPARE(idx.parent(), persistentIndex.parent()); + QCOMPARE(idx.model(), persistentIndex.model()); + } else + { + QCOMPARE(idx, persistentIndex); + } + } else + { + QCOMPARE(idx, persistentIndex); + } + } else + { + QCOMPARE(idx, persistentIndex); + } + } +} + +void tst_QAbstractItemModel::testMoveToGrandParent_data() +{ + QTest::addColumn("startRow"); + QTest::addColumn("endRow"); + QTest::addColumn("destRow"); + + // Move from the start to the middle + QTest::newRow("move01") << 0 << 2 << 8; + // Move from the start to the end + QTest::newRow("move02") << 0 << 2 << 10; + // Move from the middle to the middle + QTest::newRow("move03") << 3 << 5 << 8; + // Move from the middle to the end + QTest::newRow("move04") << 3 << 5 << 10; + + // Move from the middle to the start + QTest::newRow("move05") << 5 << 7 << 0; + // Move from the end to the start + QTest::newRow("move06") << 8 << 9 << 0; + // Move from the middle to the middle + QTest::newRow("move07") << 5 << 7 << 2; + // Move from the end to the middle + QTest::newRow("move08") << 8 << 9 << 5; + + // Moving to the same row in a different parent doesn't confuse things. + QTest::newRow("move09") << 8 << 8 << 8; + + // Moving to the row of my parent and its neighbours doesn't confuse things + QTest::newRow("move09") << 8 << 8 << 4; + QTest::newRow("move10") << 8 << 8 << 5; + QTest::newRow("move11") << 8 << 8 << 6; + + // Moving everything from one parent to another + QTest::newRow("move12") << 0 << 9 << 10; +} + +void tst_QAbstractItemModel::testMoveToGrandParent() +{ + + QFETCH( int, startRow); + QFETCH( int, endRow); + QFETCH( int, destRow); + + QList persistentList; + QModelIndexList indexList; + QModelIndexList parentsList; + + for (int column = 0; column < m_model->columnCount(); ++column) + { + for (int row= 0; row < m_model->rowCount(); ++row) + { + QModelIndex idx = m_model->index(row, column); + QVERIFY(idx.isValid()); + indexList << idx; + parentsList << idx.parent(); + persistentList << QPersistentModelIndex(idx); + } + } + + QModelIndex sourceIndex = m_model->index(5, 0); + for (int column = 0; column < m_model->columnCount(); ++column) + { + for (int row= 0; row < m_model->rowCount(sourceIndex); ++row) + { + QModelIndex idx = m_model->index(row, column, sourceIndex); + QVERIFY(idx.isValid()); + indexList << idx; + parentsList << idx.parent(); + persistentList << QPersistentModelIndex(idx); + } + } + + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + + + ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); + moveCommand->setAncestorRowNumbers(QList() << 5); + moveCommand->setNumCols(4); + moveCommand->setStartRow(startRow); + moveCommand->setEndRow(endRow); + moveCommand->setDestRow(destRow); + moveCommand->doCommand(); + + QVariantList beforeSignal = beforeSpy.takeAt(0); + QVariantList afterSignal = afterSpy.takeAt(0); + + QCOMPARE(beforeSignal.size(), 5); + QCOMPARE(beforeSignal.at(0).value(), sourceIndex); + QCOMPARE(beforeSignal.at(1).toInt(), startRow); + QCOMPARE(beforeSignal.at(2).toInt(), endRow); + QCOMPARE(beforeSignal.at(3).value(), QModelIndex()); + QCOMPARE(beforeSignal.at(4).toInt(), destRow); + + QCOMPARE(afterSignal.size(), 5); + QCOMPARE(afterSignal.at(0).value(), sourceIndex); + QCOMPARE(afterSignal.at(1).toInt(), startRow); + QCOMPARE(afterSignal.at(2).toInt(), endRow); + QCOMPARE(afterSignal.at(3).value(), QModelIndex()); + QCOMPARE(afterSignal.at(4).toInt(), destRow); + + for (int i = 0; i < indexList.size(); i++) + { + QModelIndex idx = indexList.at(i); + QModelIndex idxParent = parentsList.at(i); + QModelIndex persistentIndex = persistentList.at(i); + int row = idx.row(); + if (idxParent == QModelIndex()) + { + if ( row >= destRow) + { + QCOMPARE(row + endRow - startRow + 1, persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + QCOMPARE(idxParent, persistentIndex.parent()); + QCOMPARE(idx.model(), persistentIndex.model()); + } else + { + QCOMPARE(idx, persistentIndex); + } + } else + { + if (row < startRow) + { + QCOMPARE(idx, persistentIndex); + } else if (row <= endRow) + { + QCOMPARE(row + destRow - startRow, persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + QCOMPARE(QModelIndex(), persistentIndex.parent()); + QCOMPARE(idx.model(), persistentIndex.model()); + } else { + QCOMPARE(row - (endRow - startRow + 1), persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + + if (idxParent.row() >= destRow) + { + QModelIndex adjustedParent; + adjustedParent = idxParent.sibling( idxParent.row() + endRow - startRow + 1, idxParent.column()); + QCOMPARE(adjustedParent, persistentIndex.parent()); + } else + { + QCOMPARE(idxParent, persistentIndex.parent()); + } + QCOMPARE(idx.model(), persistentIndex.model()); + } + } + } +} + +void tst_QAbstractItemModel::testMoveToSibling_data() +{ + QTest::addColumn("startRow"); + QTest::addColumn("endRow"); + QTest::addColumn("destRow"); + + // Move from the start to the middle + QTest::newRow("move01") << 0 << 2 << 8; + // Move from the start to the end + QTest::newRow("move02") << 0 << 2 << 10; + // Move from the middle to the middle + QTest::newRow("move03") << 2 << 4 << 8; + // Move from the middle to the end + QTest::newRow("move04") << 2 << 4 << 10; + + // Move from the middle to the start + QTest::newRow("move05") << 8 << 8 << 0; + // Move from the end to the start + QTest::newRow("move06") << 8 << 9 << 0; + // Move from the middle to the middle + QTest::newRow("move07") << 6 << 8 << 2; + // Move from the end to the middle + QTest::newRow("move08") << 8 << 9 << 5; + + // Moving to the same row in a different parent doesn't confuse things. + QTest::newRow("move09") << 8 << 8 << 8; + + // Moving to the row of my target and its neighbours doesn't confuse things + QTest::newRow("move09") << 8 << 8 << 4; + QTest::newRow("move10") << 8 << 8 << 5; + QTest::newRow("move11") << 8 << 8 << 6; +} + +void tst_QAbstractItemModel::testMoveToSibling() +{ + + QFETCH( int, startRow); + QFETCH( int, endRow); + QFETCH( int, destRow); + + QList persistentList; + QModelIndexList indexList; + QModelIndexList parentsList; + + const int column = 0; + + for (int i= 0; i < m_model->rowCount(); ++i) + { + QModelIndex idx = m_model->index(i, column); + QVERIFY(idx.isValid()); + indexList << idx; + parentsList << idx.parent(); + persistentList << QPersistentModelIndex(idx); + } + + QModelIndex destIndex = m_model->index(5, 0); + QModelIndex sourceIndex; + for (int i= 0; i < m_model->rowCount(destIndex); ++i) + { + QModelIndex idx = m_model->index(i, column, destIndex); + QVERIFY(idx.isValid()); + indexList << idx; + parentsList << idx.parent(); + persistentList << QPersistentModelIndex(idx); + } + + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + + + ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); + moveCommand->setNumCols(4); + moveCommand->setStartRow(startRow); + moveCommand->setEndRow(endRow); + moveCommand->setDestAncestors(QList() << 5); + moveCommand->setDestRow(destRow); + moveCommand->doCommand(); + + QVariantList beforeSignal = beforeSpy.takeAt(0); + QVariantList afterSignal = afterSpy.takeAt(0); + + QCOMPARE(beforeSignal.size(), 5); + QCOMPARE(beforeSignal.at(0).value(), sourceIndex); + QCOMPARE(beforeSignal.at(1).toInt(), startRow); + QCOMPARE(beforeSignal.at(2).toInt(), endRow); + QCOMPARE(beforeSignal.at(3).value(), destIndex); + QCOMPARE(beforeSignal.at(4).toInt(), destRow); + + QCOMPARE(afterSignal.size(), 5); + QCOMPARE(afterSignal.at(0).value(), sourceIndex); + QCOMPARE(afterSignal.at(1).toInt(), startRow); + QCOMPARE(afterSignal.at(2).toInt(), endRow); + QCOMPARE(afterSignal.at(3).value(), destIndex); + QCOMPARE(afterSignal.at(4).toInt(), destRow); + + for (int i = 0; i < indexList.size(); i++) + { + QModelIndex idx = indexList.at(i); + QModelIndex idxParent = parentsList.at(i); + QModelIndex persistentIndex = persistentList.at(i); + + QModelIndex adjustedDestination = destIndex.sibling(destIndex.row() - (endRow - startRow + 1), destIndex.column()); + int row = idx.row(); + if (idxParent == destIndex) + { + if ( row >= destRow) + { + QCOMPARE(row + endRow - startRow + 1, persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + if (idxParent.row() > startRow) + { + QCOMPARE(adjustedDestination, persistentIndex.parent()); + } else { + QCOMPARE(destIndex, persistentIndex.parent()); + } + QCOMPARE(idx.model(), persistentIndex.model()); + } else + { + QCOMPARE(idx, persistentIndex); + } + } else + { + if (row < startRow) + { + QCOMPARE(idx, persistentIndex); + } else if (row <= endRow) + { + QCOMPARE(row + destRow - startRow, persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + if (destIndex.row() > startRow) + { + QCOMPARE(adjustedDestination, persistentIndex.parent()); + } else { + QCOMPARE(destIndex, persistentIndex.parent()); + } + + QCOMPARE(idx.model(), persistentIndex.model()); + + } else { + QCOMPARE(row - (endRow - startRow + 1), persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + QCOMPARE(idxParent, persistentIndex.parent()); + QCOMPARE(idx.model(), persistentIndex.model()); + } + } + } +} + +void tst_QAbstractItemModel::testMoveToUncle_data() +{ + + QTest::addColumn("startRow"); + QTest::addColumn("endRow"); + QTest::addColumn("destRow"); + + // Move from the start to the middle + QTest::newRow("move01") << 0 << 2 << 8; + // Move from the start to the end + QTest::newRow("move02") << 0 << 2 << 10; + // Move from the middle to the middle + QTest::newRow("move03") << 3 << 5 << 8; + // Move from the middle to the end + QTest::newRow("move04") << 3 << 5 << 10; + + // Move from the middle to the start + QTest::newRow("move05") << 5 << 7 << 0; + // Move from the end to the start + QTest::newRow("move06") << 8 << 9 << 0; + // Move from the middle to the middle + QTest::newRow("move07") << 5 << 7 << 2; + // Move from the end to the middle + QTest::newRow("move08") << 8 << 9 << 5; + + // Moving to the same row in a different parent doesn't confuse things. + QTest::newRow("move09") << 8 << 8 << 8; + + // Moving to the row of my parent and its neighbours doesn't confuse things + QTest::newRow("move09") << 8 << 8 << 4; + QTest::newRow("move10") << 8 << 8 << 5; + QTest::newRow("move11") << 8 << 8 << 6; + + // Moving everything from one parent to another + QTest::newRow("move12") << 0 << 9 << 10; +} + +void tst_QAbstractItemModel::testMoveToUncle() +{ + // Need to have some extra rows available. + ModelInsertCommand *insertCommand = new ModelInsertCommand(m_model, this); + insertCommand->setAncestorRowNumbers(QList() << 9); + insertCommand->setNumCols(4); + insertCommand->setStartRow(0); + insertCommand->setEndRow(9); + insertCommand->doCommand(); + + QFETCH( int, startRow); + QFETCH( int, endRow); + QFETCH( int, destRow); + + QList persistentList; + QModelIndexList indexList; + QModelIndexList parentsList; + + const int column = 0; + + QModelIndex sourceIndex = m_model->index(9, 0); + for (int i= 0; i < m_model->rowCount(sourceIndex); ++i) + { + QModelIndex idx = m_model->index(i, column, sourceIndex); + QVERIFY(idx.isValid()); + indexList << idx; + parentsList << idx.parent(); + persistentList << QPersistentModelIndex(idx); + } + + QModelIndex destIndex = m_model->index(5, 0); + for (int i= 0; i < m_model->rowCount(destIndex); ++i) + { + QModelIndex idx = m_model->index(i, column, destIndex); + QVERIFY(idx.isValid()); + indexList << idx; + parentsList << idx.parent(); + persistentList << QPersistentModelIndex(idx); + } + + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + + ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); + moveCommand->setAncestorRowNumbers(QList() << 9); + moveCommand->setNumCols(4); + moveCommand->setStartRow(startRow); + moveCommand->setEndRow(endRow); + moveCommand->setDestAncestors(QList() << 5); + moveCommand->setDestRow(destRow); + moveCommand->doCommand(); + + QVariantList beforeSignal = beforeSpy.takeAt(0); + QVariantList afterSignal = afterSpy.takeAt(0); + + QCOMPARE(beforeSignal.size(), 5); + QCOMPARE(beforeSignal.at(0).value(), sourceIndex); + QCOMPARE(beforeSignal.at(1).toInt(), startRow); + QCOMPARE(beforeSignal.at(2).toInt(), endRow); + QCOMPARE(beforeSignal.at(3).value(), destIndex); + QCOMPARE(beforeSignal.at(4).toInt(), destRow); + + QCOMPARE(afterSignal.size(), 5); + QCOMPARE(afterSignal.at(0).value(), sourceIndex); + QCOMPARE(afterSignal.at(1).toInt(), startRow); + QCOMPARE(afterSignal.at(2).toInt(), endRow); + QCOMPARE(afterSignal.at(3).value(), destIndex); + QCOMPARE(afterSignal.at(4).toInt(), destRow); + + for (int i = 0; i < indexList.size(); i++) + { + QModelIndex idx = indexList.at(i); + QModelIndex idxParent = parentsList.at(i); + QModelIndex persistentIndex = persistentList.at(i); + + int row = idx.row(); + if (idxParent == destIndex) + { + if ( row >= destRow) + { + QCOMPARE(row + endRow - startRow + 1, persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + QCOMPARE(destIndex, persistentIndex.parent()); + QCOMPARE(idx.model(), persistentIndex.model()); + } else + { + QCOMPARE(idx, persistentIndex); + } + } else + { + if (row < startRow) + { + QCOMPARE(idx, persistentIndex); + } else if (row <= endRow) + { + QCOMPARE(row + destRow - startRow, persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + QCOMPARE(destIndex, persistentIndex.parent()); + QCOMPARE(idx.model(), persistentIndex.model()); + + } else { + QCOMPARE(row - (endRow - startRow + 1), persistentIndex.row() ); + QCOMPARE(idx.column(), persistentIndex.column()); + QCOMPARE(idxParent, persistentIndex.parent()); + QCOMPARE(idx.model(), persistentIndex.model()); + } + } + } +} + +void tst_QAbstractItemModel::testMoveToDescendants() +{ + // Attempt to move a row to its ancestors depth rows deep. + const int depth = 6; + + // Need to have some extra rows available in a tree. + QList rows; + ModelInsertCommand *insertCommand; + for (int i = 0; i < depth; i++) + { + insertCommand = new ModelInsertCommand(m_model, this); + insertCommand->setAncestorRowNumbers(rows); + insertCommand->setNumCols(4); + insertCommand->setStartRow(0); + insertCommand->setEndRow(9); + insertCommand->doCommand(); + rows << 9; + } + + QList persistentList; + QModelIndexList indexList; + QModelIndexList parentsList; + + const int column = 0; + + QModelIndex sourceIndex = m_model->index(9, 0); + for (int i= 0; i < m_model->rowCount(sourceIndex); ++i) + { + QModelIndex idx = m_model->index(i, column, sourceIndex); + QVERIFY(idx.isValid()); + indexList << idx; + parentsList << idx.parent(); + persistentList << QPersistentModelIndex(idx); + } + + QModelIndex destIndex = m_model->index(5, 0); + for (int i= 0; i < m_model->rowCount(destIndex); ++i) + { + QModelIndex idx = m_model->index(i, column, destIndex); + QVERIFY(idx.isValid()); + indexList << idx; + parentsList << idx.parent(); + persistentList << QPersistentModelIndex(idx); + } + + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + + ModelMoveCommand *moveCommand; + QList ancestors; + while (ancestors.size() < depth) + { + ancestors << 9; + for (int row = 0; row <= 9; row++) + { + moveCommand = new ModelMoveCommand(m_model, this); + moveCommand->setNumCols(4); + moveCommand->setStartRow(9); + moveCommand->setEndRow(9); + moveCommand->setDestAncestors(ancestors); + moveCommand->setDestRow(row); + moveCommand->doCommand(); + + QVERIFY(beforeSpy.size() == 0); + QVERIFY(afterSpy.size() == 0); + } + } +} + +void tst_QAbstractItemModel::testMoveWithinOwnRange_data() +{ + QTest::addColumn("startRow"); + QTest::addColumn("endRow"); + QTest::addColumn("destRow"); + + QTest::newRow("move01") << 0 << 0 << 0; + QTest::newRow("move02") << 0 << 0 << 1; + QTest::newRow("move03") << 0 << 5 << 0; + QTest::newRow("move04") << 0 << 5 << 1; + QTest::newRow("move05") << 0 << 5 << 2; + QTest::newRow("move06") << 0 << 5 << 3; + QTest::newRow("move07") << 0 << 5 << 4; + QTest::newRow("move08") << 0 << 5 << 5; + QTest::newRow("move09") << 0 << 5 << 6; + QTest::newRow("move08") << 3 << 5 << 5; + QTest::newRow("move08") << 3 << 5 << 6; + QTest::newRow("move09") << 4 << 5 << 5; + QTest::newRow("move10") << 4 << 5 << 6; + QTest::newRow("move11") << 5 << 5 << 5; + QTest::newRow("move12") << 5 << 5 << 6; + QTest::newRow("move13") << 5 << 9 << 9; + QTest::newRow("move14") << 5 << 9 << 10; + QTest::newRow("move15") << 6 << 9 << 9; + QTest::newRow("move16") << 6 << 9 << 10; + QTest::newRow("move17") << 7 << 9 << 9; + QTest::newRow("move18") << 7 << 9 << 10; + QTest::newRow("move19") << 8 << 9 << 9; + QTest::newRow("move20") << 8 << 9 << 10; + QTest::newRow("move21") << 9 << 9 << 9; + QTest::newRow("move22") << 0 << 9 << 10; + +} + +void tst_QAbstractItemModel::testMoveWithinOwnRange() +{ + + QFETCH( int, startRow); + QFETCH( int, endRow); + QFETCH( int, destRow); + + + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + + ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); + moveCommand->setNumCols(4); + moveCommand->setStartRow(startRow); + moveCommand->setEndRow(endRow); + moveCommand->setDestRow(destRow); + moveCommand->doCommand(); + + QVERIFY(beforeSpy.size() == 0); + QVERIFY(afterSpy.size() == 0); + + +} + + + QTEST_MAIN(tst_QAbstractItemModel) #include "tst_qabstractitemmodel.moc" -- cgit v0.12 From 98f62f60605bec8ba152e56dd32308e9a5afb5c4 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 26 Aug 2009 16:41:40 +0200 Subject: Fix build of autotest on MSVC Reviewed-by: ogoffart --- tests/auto/qobject/tst_qobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 65dc742..b20c0e0 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -2933,7 +2933,7 @@ class OverloadObject : public QObject friend class tst_QObject; Q_OBJECT signals: - void sig(int i, char c, qreal m = 12) const; + void sig(int i, char c, qreal m = 12); void sig(int i, int j = 12); void sig(QObject *o, QObject *p, QObject *q = 0, QObject *r = 0) const; void other(int a = 0); -- cgit v0.12 From ca57a8122970ed408f50fed05f77d3a973676165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 26 Aug 2009 17:00:12 +0200 Subject: doc: Misspelled class names. --- src/gui/effects/qgraphicseffect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 0289914..f620878 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -61,13 +61,13 @@ Qt provides the following standard effects: \list - \o QGraphicsGrayScaleEffect - renders the item in shades of gray + \o QGraphicsGrayscaleEffect - renders the item in shades of gray \o QGraphicsColorizeEffect - renders the item in shades of any given color \o QGraphicsPixelizeEffect - pixelizes the item with any pixel size \o QGraphicsBlurEffect - blurs the item by a given radius \o QGraphicsDropShadowEffect - renders a dropshadow behind the item \o QGraphicsOpacityEffect - renders the item with an opacity - \o QGrahicsShaderEffect - renders the item with a pixel shader fragment + \o QGraphicsShaderEffect - renders the item with a pixel shader fragment \endlist -- cgit v0.12 From 6682b9915d80238ce97594909074aef974a74279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 26 Aug 2009 14:50:18 +0200 Subject: Improved QPainter API for allowing native painting in GL / VG. Previously we were using QPaintEngine::syncState() which is not ideal naming-wise, since it actually prepares for native painting instead of syncing the painter's state to native state. Reviewed-by: Trond --- dist/changes-4.6.0 | 11 ++-- examples/opengl/hellogl_es2/glwidget.cpp | 4 +- examples/openvg/star/starwidget.cpp | 4 +- src/gui/painting/qpaintengineex_p.h | 3 ++ src/gui/painting/qpainter.cpp | 39 ++++++++++++++ src/gui/painting/qpainter.h | 3 ++ .../gl2paintengineex/qpaintengineex_opengl2.cpp | 8 ++- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 4 +- src/opengl/qglpixmapfilter.cpp | 1 - src/openvg/qpaintengine_vg.cpp | 63 +++++++++++----------- src/openvg/qpaintengine_vg_p.h | 3 +- 11 files changed, 100 insertions(+), 43 deletions(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 8c2c2c8..194d670 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -49,10 +49,13 @@ information about a particular change. this is that Nokia focuses on OpenGL for desktop hardware accelerated rendering. - - When mixing OpenGL and QPainter calls you need to first call syncState() - on the paint engine, for example "painter->paintEngine()->syncState()". - This is to ensure that the engine flushes any pending drawing and sets up - the GL modelview/projection matrices properly. + - When mixing OpenGL and QPainter calls you need to surround your custom + OpenGL calls with QPainter::beginNativePainting() and + QPainter::endNativePainting(). + This is to ensure that the paint engine flushes any pending drawing and sets + up the GL modelview/projection matrices properly before you can issue custom + OpenGL calls, and to let the paint engine synchronize to the painter state + before resuming regular QPainter based drawing. - Graphics View has undergone heavy optimization work, and as a result of this work, the following behavior changes were introduced. diff --git a/examples/opengl/hellogl_es2/glwidget.cpp b/examples/opengl/hellogl_es2/glwidget.cpp index 9a2a83e..50a7797 100644 --- a/examples/opengl/hellogl_es2/glwidget.cpp +++ b/examples/opengl/hellogl_es2/glwidget.cpp @@ -266,7 +266,7 @@ void GLWidget::paintGL() QPainter painter; painter.begin(this); - painter.paintEngine()->syncState(); + painter.beginNativePainting(); glClearColor(0.1f, 0.1f, 0.2f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -302,6 +302,8 @@ void GLWidget::paintGL() glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); + painter.endNativePainting(); + if (m_showBubbles) foreach (Bubble *bubble, bubbles) { bubble->drawBubble(&painter); diff --git a/examples/openvg/star/starwidget.cpp b/examples/openvg/star/starwidget.cpp index 1a64fc9..ab11bdb 100644 --- a/examples/openvg/star/starwidget.cpp +++ b/examples/openvg/star/starwidget.cpp @@ -91,7 +91,7 @@ void StarWidget::paintEvent(QPaintEvent *) // Flush the state changes to the OpenVG implementation // and prepare to perform raw OpenVG calls. - painter.paintEngine()->syncState(); + painter.beginNativePainting(); // Cache the path if we haven't already. if (path == VG_INVALID_HANDLE) { @@ -109,7 +109,7 @@ void StarWidget::paintEvent(QPaintEvent *) vgDrawPath(path, VG_FILL_PATH | VG_STROKE_PATH); // Restore normal QPainter operations. - painter.paintEngine()->syncState(); + painter.endNativePainting(); painter.end(); } diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index cf3aad7..1ba2153 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -204,6 +204,9 @@ public: virtual void sync() {} + virtual void beginNativePainting() {} + virtual void endNativePainting() {} + virtual QPixmapFilter *createPixmapFilter(int /*type*/) const { return 0; } protected: diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index e1a6e80..cba4ad9 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1889,6 +1889,45 @@ QPaintEngine *QPainter::paintEngine() const return d->engine; } +/*! + Flushes the painting pipeline and prepares for the user issuing + native painting commands. Must be followed by a call to + endNativePainting(). + + \sa endNativePainting() +*/ +void QPainter::beginNativePainting() +{ + Q_D(QPainter); + if (!d->engine) { + qWarning("QPainter::beginNativePainting: Painter not active"); + return; + } + + if (d->extended) + d->extended->beginNativePainting(); +} + +/*! + Restores the painter after manually issuing native painting commands. + Lets the painter restore any native state that it relies on before + calling any other painter commands. + + \sa beginNativePainting() +*/ +void QPainter::endNativePainting() +{ + Q_D(const QPainter); + if (!d->engine) { + qWarning("QPainter::beginNativePainting: Painter not active"); + return; + } + + if (d->extended) + d->extended->endNativePainting(); + else + d->engine->syncState(); +} /*! Returns the font metrics for the painter if the painter is diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index 14d1cf8..1bb97c6 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -423,6 +423,9 @@ public: static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = 0); static void restoreRedirected(const QPaintDevice *device); + void beginNativePainting(); + void endNativePainting(); + #ifdef QT3_SUPPORT inline QT3_SUPPORT void setBackgroundColor(const QColor &color) { setBackground(color); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 136a078..ca33101 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -675,7 +675,7 @@ void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& s glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } -void QGL2PaintEngineEx::sync() +void QGL2PaintEngineEx::beginNativePainting() { Q_D(QGL2PaintEngineEx); ensureActive(); @@ -721,6 +721,12 @@ void QGL2PaintEngineEx::sync() d->needsSync = true; } +void QGL2PaintEngineEx::endNativePainting() +{ + Q_D(QGL2PaintEngineEx); + d->needsSync = true; +} + const QGLContext *QGL2PaintEngineEx::context() { Q_D(QGL2PaintEngineEx); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 7b734e3..2eec4d5 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -133,7 +133,9 @@ public: inline const QOpenGL2PaintEngineState *state() const { return static_cast(QPaintEngineEx::state()); } - virtual void sync(); + + void beginNativePainting(); + void endNativePainting(); const QGLContext* context(); diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index df7811e..83fddd1 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -338,7 +338,6 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); - engine->syncState(); painter->save(); // ensure GL_LINEAR filtering is used diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index d2c7b8b..09eb646 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3072,43 +3072,42 @@ void QVGPaintEngine::setState(QPainterState *s) } } -// Called from QPaintEngine::syncState() to force a state flush. -// This should be called before and after raw VG operations. -void QVGPaintEngine::updateState(const QPaintEngineState &state) +void QVGPaintEngine::beginNativePainting() { - Q_UNUSED(state); Q_D(QVGPaintEngine); - if (!(d->rawVG)) { - // About to enter raw VG mode: flush pending changes and make - // sure that all matrices are set to the current transformation. - QVGPainterState *s = this->state(); - d->ensurePen(s->pen); - d->ensureBrush(s->brush); - d->ensurePathTransform(); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, d->imageTransform); + // About to enter raw VG mode: flush pending changes and make + // sure that all matrices are set to the current transformation. + QVGPainterState *s = this->state(); + d->ensurePen(s->pen); + d->ensureBrush(s->brush); + d->ensurePathTransform(); + d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, d->imageTransform); #if !defined(QVG_NO_DRAW_GLYPHS) - d->setTransform(VG_MATRIX_GLYPH_USER_TO_SURFACE, d->pathTransform); + d->setTransform(VG_MATRIX_GLYPH_USER_TO_SURFACE, d->pathTransform); #endif - d->rawVG = true; - } else { - // Exiting raw VG mode: force all state values to be - // explicitly set on the VG engine to undo any changes - // that were made by the raw VG function calls. - QPaintEngine::DirtyFlags dirty = d->dirty; - d->clearModes(); - d->forcePenChange = true; - d->forceBrushChange = true; - d->penType = (VGPaintType)0; - d->brushType = (VGPaintType)0; - d->clearColor = QColor(); - d->fillPaint = d->brushPaint; - restoreState(QPaintEngine::AllDirty); - d->dirty = dirty; - d->rawVG = false; - vgSetPaint(d->penPaint, VG_STROKE_PATH); - vgSetPaint(d->brushPaint, VG_FILL_PATH); - } + d->rawVG = true; +} + +void QVGPaintEngine::endNativePainting() +{ + Q_D(QVGPaintEngine); + // Exiting raw VG mode: force all state values to be + // explicitly set on the VG engine to undo any changes + // that were made by the raw VG function calls. + QPaintEngine::DirtyFlags dirty = d->dirty; + d->clearModes(); + d->forcePenChange = true; + d->forceBrushChange = true; + d->penType = (VGPaintType)0; + d->brushType = (VGPaintType)0; + d->clearColor = QColor(); + d->fillPaint = d->brushPaint; + restoreState(QPaintEngine::AllDirty); + d->dirty = dirty; + d->rawVG = false; + vgSetPaint(d->penPaint, VG_STROKE_PATH); + vgSetPaint(d->brushPaint, VG_FILL_PATH); } QPixmapFilter *QVGPaintEngine::createPixmapFilter(int type) const diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index 469ec9e..f0a7838 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -140,7 +140,8 @@ public: QVGPainterState *state() { return static_cast(QPaintEngineEx::state()); } const QVGPainterState *state() const { return static_cast(QPaintEngineEx::state()); } - void updateState(const QPaintEngineState &state); + void beginNativePainting(); + void endNativePainting(); QPixmapFilter *createPixmapFilter(int type) const; -- cgit v0.12 From 629e464f2774fc1893760888e676d8e073da5d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 26 Aug 2009 15:20:47 +0200 Subject: Improved GLSL precision specifiers in GL 2 engine. The recommended specifiers are lowp for colors / normal vectors, mediump for texture coordinates when a limited range is sufficient, and highp for generic texture coordinates and vertex coordinates / transformation matrices. We used to use mediump for texture coordinate in some places, but since we don't control the texturing scenarios we need to handle the worst case, which is zooming in on part of a large texture (2048x2048) with bilinear filtering. To properly handle this case without color banding mediump is probably not sufficient, so we'll use highp for texture coordinates. Reviewed-by: Tom --- .../gl2paintengineex/qglengineshadersource_p.h | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index a8e2e72..cd3cf57 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -73,8 +73,8 @@ static const char* const qglslMainVertexShader = "\ }"; static const char* const qglslMainWithTexCoordsVertexShader = "\ - attribute mediump vec2 textureCoordArray; \ - varying mediump vec2 textureCoords; \ + attribute highp vec2 textureCoordArray; \ + varying highp vec2 textureCoords; \ uniform highp float depth;\ void setPosition();\ void main(void) \ @@ -105,9 +105,9 @@ static const char* const qglslPositionWithPatternBrushVertexShader = "\ attribute highp vec4 vertexCoordsArray; \ uniform highp mat4 pmvMatrix; \ uniform mediump vec2 halfViewportSize; \ - uniform mediump vec2 invertedTextureSize; \ - uniform mediump mat3 brushTransform; \ - varying mediump vec2 patternTexCoords; \ + uniform highp vec2 invertedTextureSize; \ + uniform highp mat3 brushTransform; \ + varying highp vec2 patternTexCoords; \ void setPosition(void) { \ gl_Position = pmvMatrix * vertexCoordsArray;\ gl_Position.xy = gl_Position.xy / gl_Position.w; \ @@ -124,9 +124,9 @@ static const char* const qglslAffinePositionWithPatternBrushVertexShader = qglslPositionWithPatternBrushVertexShader; static const char* const qglslPatternBrushSrcFragmentShader = "\ - uniform sampler2D brushTexture;\ + uniform lowp sampler2D brushTexture;\ uniform lowp vec4 patternColor; \ - varying mediump vec2 patternTexCoords;\ + varying highp vec2 patternTexCoords;\ lowp vec4 srcPixel() { \ return patternColor * (1.0 - texture2D(brushTexture, patternTexCoords).r); \ }\n"; @@ -139,7 +139,7 @@ static const char* const qglslPositionWithLinearGradientBrushVertexShader = "\ uniform mediump vec2 halfViewportSize; \ uniform highp vec3 linearData; \ uniform highp mat3 brushTransform; \ - varying mediump float index ; \ + varying mediump float index; \ void setPosition() { \ gl_Position = pmvMatrix * vertexCoordsArray;\ gl_Position.xy = gl_Position.xy / gl_Position.w; \ @@ -155,7 +155,7 @@ static const char* const qglslAffinePositionWithLinearGradientBrushVertexShader = qglslPositionWithLinearGradientBrushVertexShader; static const char* const qglslLinearGradientBrushSrcFragmentShader = "\ - uniform sampler2D brushTexture; \ + uniform lowp sampler2D brushTexture; \ varying mediump float index; \ lowp vec4 srcPixel() { \ mediump vec2 val = vec2(index, 0.5); \ @@ -187,7 +187,7 @@ static const char* const qglslAffinePositionWithConicalGradientBrushVertexShader static const char* const qglslConicalGradientBrushSrcFragmentShader = "\n\ #define INVERSE_2PI 0.1591549430918953358 \n\ - uniform sampler2D brushTexture; \n\ + uniform lowp sampler2D brushTexture; \n\ uniform mediump float angle; \ varying highp vec2 A; \ lowp vec4 srcPixel() { \ @@ -226,7 +226,7 @@ static const char* const qglslAffinePositionWithRadialGradientBrushVertexShader = qglslPositionWithRadialGradientBrushVertexShader; static const char* const qglslRadialGradientBrushSrcFragmentShader = "\ - uniform sampler2D brushTexture; \ + uniform lowp sampler2D brushTexture; \ uniform highp float fmp2_m_radius2; \ uniform highp float inverse_2_fmp2_m_radius2; \ varying highp float b; \ @@ -243,9 +243,9 @@ static const char* const qglslPositionWithTextureBrushVertexShader = "\ attribute highp vec4 vertexCoordsArray; \ uniform highp mat4 pmvMatrix; \ uniform mediump vec2 halfViewportSize; \ - uniform mediump vec2 invertedTextureSize; \ - uniform mediump mat3 brushTransform; \ - varying mediump vec2 brushTextureCoords; \ + uniform highp vec2 invertedTextureSize; \ + uniform highp mat3 brushTransform; \ + varying highp vec2 brushTextureCoords; \ void setPosition(void) { \ gl_Position = pmvMatrix * vertexCoordsArray;\ gl_Position.xy = gl_Position.xy / gl_Position.w; \ @@ -262,16 +262,16 @@ static const char* const qglslAffinePositionWithTextureBrushVertexShader = qglslPositionWithTextureBrushVertexShader; static const char* const qglslTextureBrushSrcFragmentShader = "\ - varying mediump vec2 brushTextureCoords; \ - uniform sampler2D brushTexture; \ + varying highp vec2 brushTextureCoords; \ + uniform lowp sampler2D brushTexture; \ lowp vec4 srcPixel() { \ return texture2D(brushTexture, brushTextureCoords); \ }"; static const char* const qglslTextureBrushSrcWithPatternFragmentShader = "\ - varying mediump vec2 brushTextureCoords; \ + varying highp vec2 brushTextureCoords; \ uniform lowp vec4 patternColor; \ - uniform sampler2D brushTexture; \ + uniform lowp sampler2D brushTexture; \ lowp vec4 srcPixel() { \ return patternColor * (1.0 - texture2D(brushTexture, brushTextureCoords).r); \ }"; @@ -284,15 +284,15 @@ static const char* const qglslSolidBrushSrcFragmentShader = "\ }"; static const char* const qglslImageSrcFragmentShader = "\ - varying mediump vec2 textureCoords; \ - uniform sampler2D imageTexture; \ + varying highp vec2 textureCoords; \ + uniform lowp sampler2D imageTexture; \ lowp vec4 srcPixel() { \ return texture2D(imageTexture, textureCoords); \ }"; static const char* const qglslCustomSrcFragmentShader = "\ varying highp vec2 textureCoords; \ - uniform sampler2D imageTexture; \ + uniform lowp sampler2D imageTexture; \ lowp vec4 customShader(lowp sampler2D texture, highp vec2 coords); \ lowp vec4 srcPixel() { \ return customShader(imageTexture, textureCoords); \ @@ -301,14 +301,14 @@ static const char* const qglslCustomSrcFragmentShader = "\ static const char* const qglslImageSrcWithPatternFragmentShader = "\ varying highp vec2 textureCoords; \ uniform lowp vec4 patternColor; \ - uniform sampler2D imageTexture; \ + uniform lowp sampler2D imageTexture; \ lowp vec4 srcPixel() { \ return patternColor * (1.0 - texture2D(imageTexture, textureCoords).r); \ }\n"; static const char* const qglslNonPremultipliedImageSrcFragmentShader = "\ varying highp vec2 textureCoords; \ - uniform sampler2D imageTexture; \ + uniform lowp sampler2D imageTexture; \ lowp vec4 srcPixel() { \ lowp vec4 sample = texture2D(imageTexture, textureCoords); \ sample.rgb = sample.rgb * sample.a; \ @@ -383,7 +383,7 @@ static const char* const qglslMainFragmentShader = "\ static const char* const qglslMaskFragmentShader = "\ varying highp vec2 textureCoords;\ - uniform sampler2D maskTexture;\ + uniform lowp sampler2D maskTexture;\ lowp vec4 applyMask(lowp vec4 src) \ {\ lowp vec4 mask = texture2D(maskTexture, textureCoords); \ -- cgit v0.12 From 4337df117dfa429776f2236141b570c4957e4a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 26 Aug 2009 17:07:21 +0200 Subject: Made brush textures in GL2 engine use correct filtering. Only use bilinear filtering when SmoothPixmapTransform render hint is used. Reviewed-by: Kim --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index ca33101..95199fa 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -376,6 +376,7 @@ void QGL2PaintEngineExPrivate::useSimpleShader() void QGL2PaintEngineExPrivate::updateBrushTexture() { + Q_Q(QGL2PaintEngineEx); // qDebug("QGL2PaintEngineExPrivate::updateBrushTexture()"); Qt::BrushStyle style = currentBrush->style(); @@ -385,7 +386,7 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, true); - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, true); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); } else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { // Gradiant brush: All the gradiants use the same texture @@ -400,11 +401,11 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() glBindTexture(GL_TEXTURE_2D, texId); if (g->spread() == QGradient::RepeatSpread || g->type() == QGradient::ConicalGradient) - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, true); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); else if (g->spread() == QGradient::ReflectSpread) - updateTextureFilter(GL_TEXTURE_2D, GL_MIRRORED_REPEAT_IBM, true); + updateTextureFilter(GL_TEXTURE_2D, GL_MIRRORED_REPEAT_IBM, q->state()->renderHints & QPainter::SmoothPixmapTransform); else - updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, true); + updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform); } else if (style == Qt::TexturePattern) { const QPixmap& texPixmap = currentBrush->texture(); @@ -412,7 +413,7 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); // TODO: Support y-inverted pixmaps as brushes ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, true); - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, true); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); } brushTextureDirty = false; } @@ -1080,6 +1081,7 @@ void QGL2PaintEngineEx::renderHintsChanged() Q_D(QGL2PaintEngineEx); d->lastTexture = GLuint(-1); + d->brushTextureDirty = true; // qDebug("QGL2PaintEngineEx::renderHintsChanged() not implemented!"); } @@ -1107,7 +1109,7 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c bool isBitmap = pixmap.isQBitmap(); bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel(); - d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, + d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); d->drawTexture(dest, srcRect, pixmap.size(), isOpaque, isBitmap); } @@ -1124,7 +1126,7 @@ void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, true); GLuint id = texture->id; - d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, + d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, id); d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel()); } @@ -1139,7 +1141,7 @@ void QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); glBindTexture(GL_TEXTURE_2D, textureId); - d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, + d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, textureId); d->drawTexture(dest, src, size, false); } -- cgit v0.12 From a6f19188282b427272f075063a306c7ef98e8a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 26 Aug 2009 17:29:28 +0200 Subject: Made GL 2 engine reset various GL state to their defaults in end(). This makes mixing GL and QPainter code safer. We need to be able to assume default GL state in begin(), and set back whatever we change to the default state in end() in the GL 2 paint engine. Reviewed-by: Trond --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 12 +++++++++--- src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 95199fa..2f565cf 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -710,16 +710,20 @@ void QGL2PaintEngineEx::beginNativePainting() #endif d->lastTexture = GLuint(-1); + d->resetGLState(); + d->needsSync = true; +} + +void QGL2PaintEngineExPrivate::resetGLState() +{ glDisable(GL_BLEND); glActiveTexture(GL_TEXTURE0); - glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); glDepthFunc(GL_LESS); glDepthMask(true); glClearDepth(1); - - d->needsSync = true; } void QGL2PaintEngineEx::endNativePainting() @@ -1364,6 +1368,8 @@ bool QGL2PaintEngineEx::end() d->drawable.doneCurrent(); d->ctx->d_ptr->active_engine = 0; + d->resetGLState(); + return false; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 2eec4d5..66e7a51 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -170,6 +170,7 @@ public: void setBrush(const QBrush* brush); void transferMode(EngineMode newMode); + void resetGLState(); // fill, drawOutline, drawTexture & drawCachedGlyphs are the rendering entry points: void fill(const QVectorPath &path); -- cgit v0.12 From 9385eebd22e005ff6027594ea643a8f46ed2e3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 26 Aug 2009 17:33:21 +0200 Subject: Made the opengl/overpainting example work with the GL 2 engine. Since the GL 2 engine can't set/unset every single GL state that a user might possibly change, we have to make a rule that if something is changed from its default state, it needs to be reset before the GL 2 engine can draw correctly. Reviewed-by: Samuel --- doc/src/examples/overpainting.qdoc | 7 ++++--- examples/opengl/overpainting/glwidget.cpp | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/src/examples/overpainting.qdoc b/doc/src/examples/overpainting.qdoc index 91100c0..b19b503 100644 --- a/doc/src/examples/overpainting.qdoc +++ b/doc/src/examples/overpainting.qdoc @@ -159,9 +159,10 @@ \snippet examples/opengl/overpainting/glwidget.cpp 7 - Once the list containing the object has been executed, the matrix stack - needs to be restored to its original state at the start of this function - before we can begin overpainting: + Once the list containing the object has been executed, the GL + states we changed and the matrix stack needs to be restored to its + original state at the start of this function before we can begin + overpainting: \snippet examples/opengl/overpainting/glwidget.cpp 8 diff --git a/examples/opengl/overpainting/glwidget.cpp b/examples/opengl/overpainting/glwidget.cpp index a6e6195..cad591f 100644 --- a/examples/opengl/overpainting/glwidget.cpp +++ b/examples/opengl/overpainting/glwidget.cpp @@ -166,6 +166,11 @@ void GLWidget::paintEvent(QPaintEvent *event) //! [7] //! [8] + glShadeModel(GL_FLAT); + glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); + glMatrixMode(GL_MODELVIEW); glPopMatrix(); //! [8] -- cgit v0.12 From 2b7aaf18660fb6639a97b0421563696648384948 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 26 Aug 2009 17:49:25 +0200 Subject: Doc: Corrected incorrect snippets and info in inherits() documentation. Task-number: 201882 Reviewed-by: Trust Me --- doc/src/snippets/code/src_corelib_kernel_qobject.cpp | 6 +++--- src/corelib/kernel/qobject.cpp | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp index 5c0f80c..a02d4e9 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp @@ -39,10 +39,10 @@ timer->inherits("QTimer"); // returns true timer->inherits("QObject"); // returns true timer->inherits("QAbstractButton"); // returns false -// QLayout inherits QObject and QLayoutItem -QLayout *layout = new QLayout; +// QVBoxLayout inherits QObject and QLayoutItem +QVBoxLayout *layout = new QVBoxLayout; layout->inherits("QObject"); // returns true -layout->inherits("QLayoutItem"); // returns false +layout->inherits("QLayoutItem"); // returns true (even though QLayoutItem is not a QObject) //! [4] diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index ddfc44f..1f35c73 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1089,10 +1089,9 @@ QObjectPrivate::Connection::~Connection() \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 4 - (\l QLayoutItem is not a QObject.) - - Consider using qobject_cast(object) instead. The method - is both faster and safer. + If you need to determine whether an object is an instance of a particular + class for the purpose of casting it, consider using qobject_cast(object) + instead. \sa metaObject(), qobject_cast() */ -- cgit v0.12 From b2835ef710b79e88a1163f653de686a79e810155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 26 Aug 2009 17:50:58 +0200 Subject: Fixed the bubbles.svg file after fixing some bugs in the SVG renderer. Reviewed-by: Kim --- examples/opengl/framebufferobject/bubbles.svg | 28 +++++++++++++-------------- examples/opengl/pbuffers2/bubbles.svg | 28 +++++++++++++-------------- examples/painting/svgviewer/files/bubbles.svg | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/examples/opengl/framebufferobject/bubbles.svg b/examples/opengl/framebufferobject/bubbles.svg index 65867da..5173012 100644 --- a/examples/opengl/framebufferobject/bubbles.svg +++ b/examples/opengl/framebufferobject/bubbles.svg @@ -72,7 +72,7 @@ - + @@ -91,56 +91,56 @@ - - - - - - - - @@ -148,28 +148,28 @@ - - - - @@ -186,7 +186,7 @@ - diff --git a/examples/opengl/pbuffers2/bubbles.svg b/examples/opengl/pbuffers2/bubbles.svg index 65867da..5173012 100644 --- a/examples/opengl/pbuffers2/bubbles.svg +++ b/examples/opengl/pbuffers2/bubbles.svg @@ -72,7 +72,7 @@ - + @@ -91,56 +91,56 @@ - - - - - - - - @@ -148,28 +148,28 @@ - - - - @@ -186,7 +186,7 @@ - diff --git a/examples/painting/svgviewer/files/bubbles.svg b/examples/painting/svgviewer/files/bubbles.svg index 9fae8cc..5173012 100644 --- a/examples/painting/svgviewer/files/bubbles.svg +++ b/examples/painting/svgviewer/files/bubbles.svg @@ -72,7 +72,7 @@ - + -- cgit v0.12 From b920f268e8f03e4857485df9dcdbf001409c8c40 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 26 Aug 2009 14:27:31 +0200 Subject: reverting the definition of WINVER and _WIN32_WINNT in qglobal.h This just caused too much problems and must be solved another way. In qfsfileengine_win.cpp we define FSCTL_GET_REPARSE_POINT and all of the other stuff that's needed for NTFS symlink support, if its not defined. This is the case if _WIN32_WINNT is less than 0x0500. All other changes in this commit are just reversions of commits that were done for the infamous qglobal.h change. Discussed with prasanth, tested by pulse. --- src/corelib/global/qglobal.h | 9 --------- src/corelib/io/qfsfileengine_win.cpp | 3 +++ src/corelib/thread/qthread_win.cpp | 4 ++++ src/gui/util/qsystemtrayicon_win.cpp | 9 +++++---- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index d22a863..93cc30f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -265,15 +265,6 @@ namespace QT_NAMESPACE {} # define Q_OS_WIN #endif -#if defined(Q_OS_WIN32) -# ifndef WINVER -# define WINVER 0x0500 -# endif -# ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0500 -# endif -#endif - #if defined(Q_OS_DARWIN) # define Q_OS_MAC /* Q_OS_MAC is mostly for compatibility, but also more clear */ # define Q_OS_MACX /* Q_OS_MACX is only for compatibility.*/ diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index e1fc804..4e142a9 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -123,6 +123,9 @@ typedef struct _REPARSE_DATA_BUFFER { # ifndef IO_REPARSE_TAG_SYMLINK # define IO_REPARSE_TAG_SYMLINK (0xA000000CL) # endif +# ifndef FSCTL_GET_REPARSE_POINT +# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) +# endif #endif QT_BEGIN_NAMESPACE diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 82b462e..12ee413 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -39,6 +39,10 @@ ** ****************************************************************************/ +//#define WINVER 0x0500 +#define _WIN32_WINNT 0x0400 + + #include "qthread.h" #include "qthread_p.h" #include "qthreadstorage.h" diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp index 465c1d8..ea7fbde 100644 --- a/src/gui/util/qsystemtrayicon_win.cpp +++ b/src/gui/util/qsystemtrayicon_win.cpp @@ -132,11 +132,12 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object) : hIcon(0), q(object), ignoreNextMouseRelease(false) { - notifyIconSize = sizeof(NOTIFYICONDATA); -#ifdef Q_OS_WINCE - maxTipLength = 64; -#else +#ifndef Q_OS_WINCE + notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, guidItem); // NOTIFYICONDATAW_V2_SIZE; maxTipLength = 128; +#else + notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, szTip[64]); // NOTIFYICONDATAW_V1_SIZE; + maxTipLength = 64; #endif // For restoring the tray icon after explorer crashes -- cgit v0.12 From b22e24db7e70a6b85055f4692301ddd523956db5 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 26 Aug 2009 17:56:41 +0200 Subject: Missing ducumentation in QAbstractItemModel --- src/corelib/kernel/qabstractitemmodel.cpp | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index fb0afcc..1c9104a 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1483,6 +1483,7 @@ QAbstractItemModel::~QAbstractItemModel() /*! \fn void QAbstractItemModel::rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) + \since 4.6 This signal is emitted after rows have been moved within the model. The items between \a sourceStart and \a sourceEnd @@ -1498,6 +1499,7 @@ QAbstractItemModel::~QAbstractItemModel() /*! \fn void QAbstractItemModel::rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) + \since 4.6 This signal is emitted just before rows are moved within the model. The items that will be moved are those between \a sourceStart and \a sourceEnd @@ -1512,6 +1514,38 @@ QAbstractItemModel::~QAbstractItemModel() */ /*! + \fn void QAbstractItemModel::columnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn) + \since 4.6 + + This signal is emitted after columns have been moved within the + model. The items between \a sourceStart and \a sourceEnd + inclusive, under the given \a sourceParent item have been moved to \a destinationParent + starting at the column \a destinationColumn. + + \bold{Note:} Components connected to this signal use it to adapt to changes + in the model's dimensions. It can only be emitted by the QAbstractItemModel + implementation, and cannot be explicitly emitted in subclass code. + + \sa beginMoveRows() +*/ + +/*! + \fn void QAbstractItemModel::columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn) + \since 4.6 + + This signal is emitted just before columns are moved within the + model. The items that will be moved are those between \a sourceStart and \a sourceEnd + inclusive, under the given \a sourceParent item. They will be moved to \a destinationParent + starting at the column \a destinationColumn. + + \bold{Note:} Components connected to this signal use it to adapt to changes + in the model's dimensions. It can only be emitted by the QAbstractItemModel + implementation, and cannot be explicitly emitted in subclass code. + + \sa beginMoveRows() +*/ + +/*! \fn void QAbstractItemModel::columnsInserted(const QModelIndex &parent, int start, int end) This signal is emitted after columns have been inserted into the model. The -- cgit v0.12 From 5e8b3fc4b913b1a1ac1a97cc633e33f3aa7fbd86 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 26 Aug 2009 08:12:06 -0700 Subject: Use QScopedPointer instead of homegrown smartptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since QScopedPointer can take a custom cleanup handler we can use this instead of the original QDirectFBPointer. Reviewed-by: Jørgen Lind --- .../gfxdrivers/directfb/qdirectfbpixmap.cpp | 59 +++++++++++----------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 70a6e02..146a920 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -209,66 +209,60 @@ bool QDirectFBPixmapData::fromData(const uchar *buffer, uint len, const char *fo return QPixmapData::fromData(buffer, len, format, flags); } -template class QDirectFBPointer +template struct QDirectFBInterfaceCleanupHandler { -public: - QDirectFBPointer(T *tt = 0) : t(tt) {} - ~QDirectFBPointer() { if (t) t->Release(t); } - - inline T* operator->() { return t; } - inline operator T*() { return t; } - - inline T** operator&() { return &t; } - inline bool operator!() const { return !t; } - inline T *data() { return t; } - inline const T *data() const { return t; } + static void cleanup(T *t) { if (t) t->Release(t); } +}; - T *t; +template +class QDirectFBPointer : public QScopedPointer > +{ +public: + QDirectFBPointer(T *t = 0) + : QScopedPointer >(t) + {} }; bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescription &dataBufferDescription) { IDirectFB *dfb = screen->dfb(); Q_ASSERT(dfb); - QDirectFBPointer dataBuffer; DFBResult result = DFB_OK; - if ((result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, &dataBuffer)) != DFB_OK) { + IDirectFBDataBuffer *dataBufferPtr; + if ((result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, &dataBufferPtr)) != DFB_OK) { DirectFBError("QDirectFBPixmapData::fromDataBufferDescription()", result); return false; } + QDirectFBPointer dataBuffer(dataBufferPtr); -#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE - IDirectFBImageProvider *provider = 0; -#else - QDirectFBPointer provider; -#endif - if ((result = dataBuffer->CreateImageProvider(dataBuffer, &provider)) != DFB_OK) { + IDirectFBImageProvider *providerPtr; + if ((result = dataBuffer->CreateImageProvider(dataBuffer.data(), &providerPtr)) != DFB_OK) { DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't create image provider", result); return false; } -#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE - screen->setDirectFBImageProvider(provider); -#endif + QDirectFBPointer provider(providerPtr); + DFBSurfaceDescription surfaceDescription; - if ((result = provider->GetSurfaceDescription(provider, &surfaceDescription)) != DFB_OK) { + if ((result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription)) != DFB_OK) { DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result); return false; } - QDirectFBPointer surfaceFromDescription = screen->createDFBSurface(surfaceDescription, QDirectFBScreen::DontTrackSurface, &result); + QDirectFBPointer surfaceFromDescription; + surfaceFromDescription.reset(screen->createDFBSurface(surfaceDescription, QDirectFBScreen::DontTrackSurface, &result)); if (!surfaceFromDescription) { DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't create surface", result); return false; } - result = provider->RenderTo(provider, surfaceFromDescription, 0); + result = provider->RenderTo(provider.data(), surfaceFromDescription.data(), 0); if (result != DFB_OK) { DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result); return false; } DFBImageDescription imageDescription; - result = provider->GetImageDescription(provider, &imageDescription); + result = provider->GetImageDescription(provider.data(), &imageDescription); if (result != DFB_OK) { DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't get image description", result); return false; @@ -285,7 +279,7 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; if (imageDescription.caps & DICAPS_COLORKEY) { blittingFlags |= DSBLIT_SRC_COLORKEY; - result = surfaceFromDescription->SetSrcColorKey(surfaceFromDescription, + result = surfaceFromDescription->SetSrcColorKey(surfaceFromDescription.data(), imageDescription.colorkey_r, imageDescription.colorkey_g, imageDescription.colorkey_b); @@ -305,7 +299,7 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti return false; } - result = dfbSurface->Blit(dfbSurface, surfaceFromDescription, 0, 0, 0); + result = dfbSurface->Blit(dfbSurface, surfaceFromDescription.data(), 0, 0, 0); if (result != DFB_OK) { DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't blit to surface", result); invalidate(); // release dfbSurface @@ -324,6 +318,11 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti #if (Q_DIRECTFB_VERSION >= 0x010000) dfbSurface->ReleaseSource(dfbSurface); #endif +#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + screen->setDirectFBImageProvider(providerPtr); + provider.take(); +#endif + return true; } -- cgit v0.12 From f7709332d5ed16107e1bd8cbf07ab778e8f77217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 26 Aug 2009 18:25:17 +0200 Subject: doc: Add Graphics Effect images. --- doc/src/images/graphicseffect-blur.png | Bin 0 -> 41433 bytes doc/src/images/graphicseffect-colorize.png | Bin 0 -> 35062 bytes doc/src/images/graphicseffect-drop-shadow.png | Bin 0 -> 38770 bytes doc/src/images/graphicseffect-effects.png | Bin 0 -> 112462 bytes doc/src/images/graphicseffect-grayscale.png | Bin 0 -> 35056 bytes doc/src/images/graphicseffect-opacity.png | Bin 0 -> 33879 bytes doc/src/images/graphicseffect-pixelize.png | Bin 0 -> 23577 bytes doc/src/images/graphicseffect-widget.png | Bin 0 -> 16693 bytes src/gui/effects/qgraphicseffect.cpp | 20 +++++++++++++++++--- 9 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 doc/src/images/graphicseffect-blur.png create mode 100644 doc/src/images/graphicseffect-colorize.png create mode 100644 doc/src/images/graphicseffect-drop-shadow.png create mode 100644 doc/src/images/graphicseffect-effects.png create mode 100644 doc/src/images/graphicseffect-grayscale.png create mode 100644 doc/src/images/graphicseffect-opacity.png create mode 100644 doc/src/images/graphicseffect-pixelize.png create mode 100644 doc/src/images/graphicseffect-widget.png diff --git a/doc/src/images/graphicseffect-blur.png b/doc/src/images/graphicseffect-blur.png new file mode 100644 index 0000000..3fa403b Binary files /dev/null and b/doc/src/images/graphicseffect-blur.png differ diff --git a/doc/src/images/graphicseffect-colorize.png b/doc/src/images/graphicseffect-colorize.png new file mode 100644 index 0000000..96fbfe4 Binary files /dev/null and b/doc/src/images/graphicseffect-colorize.png differ diff --git a/doc/src/images/graphicseffect-drop-shadow.png b/doc/src/images/graphicseffect-drop-shadow.png new file mode 100644 index 0000000..c02415a Binary files /dev/null and b/doc/src/images/graphicseffect-drop-shadow.png differ diff --git a/doc/src/images/graphicseffect-effects.png b/doc/src/images/graphicseffect-effects.png new file mode 100644 index 0000000..422ae19 Binary files /dev/null and b/doc/src/images/graphicseffect-effects.png differ diff --git a/doc/src/images/graphicseffect-grayscale.png b/doc/src/images/graphicseffect-grayscale.png new file mode 100644 index 0000000..2bd0c93 Binary files /dev/null and b/doc/src/images/graphicseffect-grayscale.png differ diff --git a/doc/src/images/graphicseffect-opacity.png b/doc/src/images/graphicseffect-opacity.png new file mode 100644 index 0000000..de15859 Binary files /dev/null and b/doc/src/images/graphicseffect-opacity.png differ diff --git a/doc/src/images/graphicseffect-pixelize.png b/doc/src/images/graphicseffect-pixelize.png new file mode 100644 index 0000000..047c452 Binary files /dev/null and b/doc/src/images/graphicseffect-pixelize.png differ diff --git a/doc/src/images/graphicseffect-widget.png b/doc/src/images/graphicseffect-widget.png new file mode 100644 index 0000000..27245d1 Binary files /dev/null and b/doc/src/images/graphicseffect-widget.png differ diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index f620878..5f64698 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -61,15 +61,17 @@ Qt provides the following standard effects: \list - \o QGraphicsGrayscaleEffect - renders the item in shades of gray - \o QGraphicsColorizeEffect - renders the item in shades of any given color - \o QGraphicsPixelizeEffect - pixelizes the item with any pixel size \o QGraphicsBlurEffect - blurs the item by a given radius \o QGraphicsDropShadowEffect - renders a dropshadow behind the item + \o QGraphicsColorizeEffect - renders the item in shades of any given color \o QGraphicsOpacityEffect - renders the item with an opacity + \o QGraphicsPixelizeEffect - pixelizes the item with any pixel size + \o QGraphicsGrayscaleEffect - renders the item in shades of gray \o QGraphicsShaderEffect - renders the item with a pixel shader fragment \endlist + \img graphicseffect-effects.png + \img graphicseffect-widget.png For more information on how to use each effect, refer to the specific effect's documentation. @@ -425,6 +427,8 @@ void QGraphicsEffect::sourceChanged(ChangeFlags flags) A grayscale effect renders the source in shades of gray. + \img graphicseffect-grayscale.png + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect */ @@ -478,6 +482,8 @@ void QGraphicsGrayscaleEffect::draw(QPainter *painter, QGraphicsEffectSource *so By default, the color is light blue (QColor(0, 0, 192)). + \img graphicseffect-colorize.png + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, QGraphicsOpacityEffect */ @@ -560,6 +566,8 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou By default, the pixel size is 3. + \img graphicseffect-pixelize.png + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsGrayscaleEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect */ @@ -678,6 +686,8 @@ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou By default, the blur radius is 5 pixels. + \img graphicseffect-blur.png + \sa QGraphicsDropShadowEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect */ @@ -782,6 +792,8 @@ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) (QColor(63, 63, 63, 180)) shadow, blurred with a radius of 1 at an offset of 8 pixels towards the lower right. + \img graphicseffect-drop-shadow.png + \sa QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect */ @@ -948,6 +960,8 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *s By default, the opacity is 0.7. + \img graphicseffect-opacity.png + \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect, QGraphicsColorizeEffect */ -- cgit v0.12 From a3ceb3627c0270274caa5818d34689b7bd81e2e3 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 26 Aug 2009 16:46:10 +0200 Subject: warn if QScriptValue::setScriptClass() is called on incompatible object --- src/script/api/qscriptvalue.cpp | 7 ++++++- tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 29 ++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 7fd1efe..d5aaed7 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -2421,8 +2421,13 @@ QScriptClass *QScriptValue::scriptClass() const void QScriptValue::setScriptClass(QScriptClass *scriptClass) { Q_D(QScriptValue); - if (!d || !d->isJSC() || !d->jscValue.isObject(&QScriptObject::info)) + if (!d || !d->isObject()) return; + if (!d->jscValue.isObject(&QScriptObject::info)) { + qWarning("QScriptValue::setScriptClass() failed: " + "cannot change class of non-QScriptObject"); + return; + } QScriptObject *scriptObject = static_cast(JSC::asObject(d->jscValue)); QScriptObjectDelegate *delegate = scriptObject->delegate(); if (!delegate || (delegate->type() != QScriptObjectDelegate::ClassObject)) { diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index b125965..f9ce79f 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2220,13 +2220,30 @@ void tst_QScriptValue::getSetScriptClass() QCOMPARE(inv.scriptClass(), (QScriptClass*)0); QScriptValue num(123); QCOMPARE(num.scriptClass(), (QScriptClass*)0); - QScriptValue obj = eng.newObject(); - QCOMPARE(obj.scriptClass(), (QScriptClass*)0); + TestScriptClass testClass(&eng); - obj.setScriptClass(&testClass); - QCOMPARE(obj.scriptClass(), (QScriptClass*)&testClass); - obj.setScriptClass(0); - QCOMPARE(obj.scriptClass(), (QScriptClass*)0); + // object created in C++ (newObject()) + { + QScriptValue obj = eng.newObject(); + QCOMPARE(obj.scriptClass(), (QScriptClass*)0); + obj.setScriptClass(&testClass); + QCOMPARE(obj.scriptClass(), (QScriptClass*)&testClass); + obj.setScriptClass(0); + QCOMPARE(obj.scriptClass(), (QScriptClass*)0); + } + // object created in JS + { + QScriptValue obj = eng.evaluate("new Object"); + QVERIFY(!eng.hasUncaughtException()); + QVERIFY(obj.isObject()); + QCOMPARE(obj.scriptClass(), (QScriptClass*)0); + QTest::ignoreMessage(QtWarningMsg, "QScriptValue::setScriptClass() failed: cannot change class of non-QScriptObject"); + 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); + obj.setScriptClass(0); + QCOMPARE(obj.scriptClass(), (QScriptClass*)0); + } } static QScriptValue getArg(QScriptContext *ctx, QScriptEngine *) -- cgit v0.12 From ea3955ca80ab6e067c58aa9def4055a53020cd90 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 26 Aug 2009 16:49:54 +0200 Subject: make JIT construct objects of type QScriptObject, not JSC::JSObject Commit 25e76959da84fe4c40f98cf32b7b8c69e5087681 changed it for the interpreter, this commit makes it work with the JIT enabled as well. --- src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 40d2182..2563848 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -58,6 +58,10 @@ #include "SamplingTool.h" #include +#ifdef QT_BUILD_SCRIPT_LIB +#include "bridge/qscriptobject_p.h" +#endif + using namespace std; namespace JSC { @@ -1470,7 +1474,11 @@ DEFINE_STUB_FUNCTION(JSObject*, op_construct_JSConstruct) structure = asObject(stackFrame.args[3].jsValue())->inheritorID(); else structure = constructor->scope().node()->globalObject()->emptyObjectStructure(); +#ifdef QT_BUILD_SCRIPT_LIB + return new (stackFrame.globalData) QScriptObject(structure); +#else return new (stackFrame.globalData) JSObject(structure); +#endif } DEFINE_STUB_FUNCTION(EncodedJSValue, op_construct_NotJSConstruct) -- cgit v0.12 From 52f5e632da1bd5ef413b3108564b9b47850ce441 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 26 Aug 2009 19:03:21 +0200 Subject: ignore warning in autotest --- tests/auto/qscriptclass/tst_qscriptclass.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp index 11c7f56..33c2c35 100644 --- a/tests/auto/qscriptclass/tst_qscriptclass.cpp +++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp @@ -606,6 +606,7 @@ void tst_QScriptClass::newInstance() QScriptValue arr = eng.newArray(); QVERIFY(arr.isArray()); QCOMPARE(arr.scriptClass(), (QScriptClass*)0); + QTest::ignoreMessage(QtWarningMsg, "QScriptValue::setScriptClass() failed: cannot change class of non-QScriptObject"); arr.setScriptClass(&cls); QEXPECT_FAIL("", "Changing class of arbitrary script object is not allowed (it's OK)", Continue); QCOMPARE(arr.scriptClass(), (QScriptClass*)&cls); -- cgit v0.12 From bf6a3925109ea55b57633d02fc752344d55a9fae Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 26 Aug 2009 00:12:25 -0700 Subject: Implement QDirectFBScreen::surfaceForWidget Allow applications to get a pointer to the surface of the window surface for a given widget or a subsurface of the widget. This function ignores whether or not the widget is fully or partially obscured. Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbscreen.cpp | 31 ++++++++++++++++++++++ src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 3 +++ .../gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 21 +++++++++++++++ .../gfxdrivers/directfb/qdirectfbwindowsurface.h | 1 + 4 files changed, 56 insertions(+) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index dbe8926..1bf74d4 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1557,5 +1557,36 @@ void QDirectFBScreen::setDirectFBImageProvider(IDirectFBImageProvider *provider) } #endif +IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRect *rect) const +{ + Q_ASSERT(widget); + if (!widget->isVisible() || widget->size().isNull()) + return 0; + + const QWSWindowSurface *surface = static_cast(widget->windowSurface()); + if (surface && surface->key() == QLatin1String("directfb")) { + return static_cast(surface)->surfaceForWidget(widget, rect); + } + return 0; +} +IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, const QRect &area) const +{ + Q_ASSERT(widget); + QRect rect; + IDirectFBSurface *surface = surfaceForWidget(widget, &rect); + IDirectFBSurface *subSurface = 0; + if (surface) { + if (!area.isNull()) + rect &= area.translated(widget->mapTo(widget->window(), QPoint(0, 0))); + if (!rect.isNull()) { + const DFBRectangle subRect = {rect.x(), rect.y(), rect.width(), rect.height() }; + const DFBResult result = surface->GetSubSurface(surface, &subRect, &subSurface); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen::subSurface(): Can't get sub surface", result); + } + } + } + return subSurface; +} diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 8ec91c7..8af4e0f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -152,6 +152,9 @@ public: return static_cast(inst); } + IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; + IDirectFBSurface *subSurfaceForWidget(const QWidget *widget, const QRect &area = QRect()) const; + IDirectFB *dfb(); #ifdef QT_NO_DIRECTFB_WM IDirectFBSurface *primarySurface(); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 2f240fb..aa98a13 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -466,6 +466,27 @@ QImage *QDirectFBWindowSurface::buffer(const QWidget *widget) return img; } +IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const +{ + Q_ASSERT(widget); + if (!dfbSurface) { + if (sibling && (!sibling->sibling || sibling->dfbSurface)) + return sibling->surfaceForWidget(widget, rect); + return 0; + } + QWidget *win = window(); + Q_ASSERT(win); + if (rect) { + if (win == widget) { + *rect = widget->rect(); + } else { + *rect = QRect(widget->mapTo(win, QPoint(0, 0)), widget->size()); + } + } + Q_ASSERT(win == widget || widget->isAncestorOf(win)); + return dfbSurface; +} + void QDirectFBWindowSurface::updateFormat() { imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index 0da3a98..707561b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -89,6 +89,7 @@ public: void endPaint(const QRegion &); QImage *buffer(const QWidget *widget); + IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; private: void updateFormat(); #ifdef QT_DIRECTFB_WM -- cgit v0.12 From 900c3368404f418c444a9781ed52f7b681ab7076 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 26 Aug 2009 12:19:04 -0700 Subject: Remove bufferImage stuff from dfbwindowsurface Neither grabWidget nor buffer is ever called from Qt and they're not public API Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 39 ---------------------- .../gfxdrivers/directfb/qdirectfbwindowsurface.h | 2 -- 2 files changed, 41 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index aa98a13..60211a6 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -48,8 +48,6 @@ #include #include -//#define QT_DIRECTFB_DEBUG_SURFACES 1 - QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr) : QDirectFBPaintDevice(scr) #ifndef QT_NO_DIRECTFB_WM @@ -418,7 +416,6 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, #endif } - void QDirectFBWindowSurface::beginPaint(const QRegion &) { if (!engine) @@ -427,45 +424,9 @@ void QDirectFBWindowSurface::beginPaint(const QRegion &) void QDirectFBWindowSurface::endPaint(const QRegion &) { -#ifdef QT_DIRECTFB_DEBUG_SURFACES - if (bufferImages.count()) { - qDebug("QDirectFBWindowSurface::endPaint() this=%p", this); - - foreach(QImage* bufferImg, bufferImages) - qDebug(" Deleting buffer image %p", bufferImg); - } -#endif - - qDeleteAll(bufferImages); - bufferImages.clear(); unlockDirectFB(); } - -QImage *QDirectFBWindowSurface::buffer(const QWidget *widget) -{ - if (!lockedImage) - return 0; - - const QRect rect = QRect(offset(widget), widget->size()) - & lockedImage->rect(); - if (rect.isEmpty()) - return 0; - - QImage *img = new QImage(lockedImage->scanLine(rect.y()) - + rect.x() * (lockedImage->depth() / 8), - rect.width(), rect.height(), - lockedImage->bytesPerLine(), - lockedImage->format()); - bufferImages.append(img); - -#ifdef QT_DIRECTFB_DEBUG_SURFACES - qDebug("QDirectFBWindowSurface::buffer() Created & returned %p", img); -#endif - - return img; -} - IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const { Q_ASSERT(widget); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index 707561b..dafc478 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -88,7 +88,6 @@ public: void beginPaint(const QRegion &); void endPaint(const QRegion &); - QImage *buffer(const QWidget *widget); IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; private: void updateFormat(); @@ -105,7 +104,6 @@ private: } mode; #endif - QList bufferImages; DFBSurfaceFlipFlags flipFlags; bool boundingRectFlip; #ifdef QT_DIRECTFB_TIMING -- cgit v0.12 From e201ff0ff3a8223b14a72954c898674e606f147e Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 26 Aug 2009 12:50:28 -0700 Subject: Optimize permanentState/setPermanentState No need to use a QDataStream here. Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 60211a6..9de1ca5 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -243,22 +243,19 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) QByteArray QDirectFBWindowSurface::permanentState() const { - QByteArray state; #ifdef QT_DIRECTFB_WM - QDataStream ds(&state, QIODevice::WriteOnly); - ds << reinterpret_cast(this); -#endif + QByteArray state(sizeof(this), 0); + *reinterpret_cast(state.data()) = this; return state; +#endif + return QByteArray(); } void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) { #ifdef QT_DIRECTFB_WM - if (state.size() == sizeof(quintptr)) { - QDataStream ds(state); - quintptr ptr; - ds >> ptr; - sibling = reinterpret_cast(ptr); + if (state.size() == sizeof(this)) { + sibling = *reinterpret_cast(state.constData()); } #else Q_UNUSED(state); -- cgit v0.12 From 40856f6e2e3b5115e8730ea86c97ed7211d4e5a3 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 27 Aug 2009 10:31:37 +1000 Subject: Fixes invalid use of statics Multiple database connections could have differing ideas on the return value for defaultCase. The cost of the call is so minimal that caching is unnecessary, and static caching is very very wrong. Reviewed-by: Justin McPherson --- src/sql/drivers/odbc/qsql_odbc.cpp | 54 ++++++++++++++------------------ tests/auto/qsqldriver/tst_qsqldriver.cpp | 14 ++++++--- 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 6a8609e..06ee3e1 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -743,37 +743,31 @@ void QODBCDriverPrivate::splitTableQualifier(const QString & qualifier, QString QODBCDriverPrivate::DefaultCase QODBCDriverPrivate::defaultCase() const { - static bool isInitialized = false; - static DefaultCase ret; - - if (!isInitialized) { - SQLUSMALLINT casing; - int r = SQLGetInfo(hDbc, - SQL_IDENTIFIER_CASE, - &casing, - sizeof(casing), - NULL); - if ( r != SQL_SUCCESS) - ret = Lower;//arbitrary case if driver cannot be queried - else { - switch (casing) { - case (SQL_IC_UPPER): - ret = Upper; - break; - case (SQL_IC_LOWER): - ret = Lower; - break; - case (SQL_IC_SENSITIVE): - ret = Sensitive; - break; - case (SQL_IC_MIXED): - ret = Mixed; - break; - default: - ret = Upper; - } + DefaultCase ret; + SQLUSMALLINT casing; + int r = SQLGetInfo(hDbc, + SQL_IDENTIFIER_CASE, + &casing, + sizeof(casing), + NULL); + if ( r != SQL_SUCCESS) + ret = Mixed;//arbitrary case if driver cannot be queried + else { + switch (casing) { + case (SQL_IC_UPPER): + ret = Upper; + break; + case (SQL_IC_LOWER): + ret = Lower; + break; + case (SQL_IC_SENSITIVE): + ret = Sensitive; + break; + case (SQL_IC_MIXED): + default: + ret = Mixed; + break; } - isInitialized = true; } return ret; } diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp index 5af56c7..4857295 100644 --- a/tests/auto/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp @@ -144,9 +144,11 @@ void tst_QSqlDriver::record() else if (db.driverName().startsWith("QPSQL")) tablename = tablename.toLower(); - //check we can get records using a properly quoted table name - rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName)); - QCOMPARE(rec.count(), 4); + if(!db.driverName().startsWith("QODBC") && !db.databaseName().contains("PostgreSql")) { + //check we can get records using a properly quoted table name + rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName)); + QCOMPARE(rec.count(), 4); + } for (int i = 0; i < fields.count(); ++i) QCOMPARE(rec.fieldName(i), fields[i]); @@ -188,8 +190,10 @@ void tst_QSqlDriver::primaryIndex() else if (db.driverName().startsWith("QPSQL")) tablename = tablename.toLower(); - index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName)); - QCOMPARE(index.count(), 1); + if(!db.driverName().startsWith("QODBC") && !db.databaseName().contains("PostgreSql")) { + index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName)); + QCOMPARE(index.count(), 1); + } if( db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) QCOMPARE(index.fieldName(0), QString::fromLatin1("ID")); else -- cgit v0.12 From 741bbc1be204adb4ceb6f9ae2aa35772c63d989c Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 27 Aug 2009 10:54:14 +1000 Subject: API improvements for creating shaders from files It used to be possible to derive the shader type from the file extension, but this isn't very extensible and doesn't capture the usual extensions. Change it so that the shader type must be supplied explicitly. Also add the addShaderFromFile() function to QGLShaderProgram to provide a convenient short-cut for file-based shader creation. Reviewed-by: Sarah Smith --- src/opengl/qglshaderprogram.cpp | 77 +++++++++++++++-------------------------- src/opengl/qglshaderprogram.h | 3 +- 2 files changed, 28 insertions(+), 52 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index f8bffd3..83578b3 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -348,31 +348,6 @@ QGLShader::QGLShader(QGLShader::ShaderType type, QObject *parent) } /*! - Constructs a new QGLShader object from the source code in \a fileName - and attaches it to \a parent. If the filename ends in \c{.fsh}, - it is assumed to be a fragment shader, otherwise it is assumed to - be a vertex shader (normally the extension is \c{.vsh} for vertex shaders). - If the shader could not be loaded, then isCompiled() will return false. - - The shader will be associated with the current QGLContext. - - \sa isCompiled() -*/ -QGLShader::QGLShader(const QString& fileName, QObject *parent) - : QObject(parent) -{ - if (fileName.endsWith(QLatin1String(".fsh"), Qt::CaseInsensitive)) - d = new QGLShaderPrivate(QGLShader::FragmentShader, QGLContext::currentContext()); - else - d = new QGLShaderPrivate(QGLShader::VertexShader, QGLContext::currentContext()); - if (d->create() && !compileFile(fileName)) { - if (d->shader) - glDeleteShader(d->shader); - d->shader = 0; - } -} - -/*! Constructs a new QGLShader object of the specified \a type from the source code in \a fileName and attaches it to \a parent. If the shader could not be loaded, then isCompiled() will return false. @@ -413,31 +388,6 @@ QGLShader::QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObj } /*! - Constructs a new QGLShader object from the source code in \a fileName - and attaches it to \a parent. If the filename ends in \c{.fsh}, - it is assumed to be a fragment shader, otherwise it is assumed to - be a vertex shader (normally the extension is \c{.vsh} for vertex shaders). - If the shader could not be loaded, then isCompiled() will return false. - - The shader will be associated with \a context. - - \sa isCompiled() -*/ -QGLShader::QGLShader(const QString& fileName, const QGLContext *context, QObject *parent) - : QObject(parent) -{ - if (fileName.endsWith(QLatin1String(".fsh"), Qt::CaseInsensitive)) - d = new QGLShaderPrivate(QGLShader::FragmentShader, context); - else - d = new QGLShaderPrivate(QGLShader::VertexShader, context); - if (d->create() && !compileFile(fileName)) { - if (d->shader) - glDeleteShader(d->shader); - d->shader = 0; - } -} - -/*! Constructs a new QGLShader object of the specified \a type from the source code in \a fileName and attaches it to \a parent. If the shader could not be loaded, then isCompiled() will return false. @@ -917,6 +867,33 @@ bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const QString& sour } /*! + Compiles the contents of \a fileName as a shader of the specified + \a type and adds it to this shader program. Returns true if + compilation was successful, false otherwise. The compilation errors + and warnings will be made available via log(). + + This function is intended to be a short-cut for quickly + adding vertex and fragment shaders to a shader program without + creating an instance of QGLShader first. + + \sa addShader() +*/ +bool QGLShaderProgram::addShaderFromFile + (QGLShader::ShaderType type, const QString& fileName) +{ + if (!init()) + return false; + QGLShader *shader = new QGLShader(type, this); + if (!shader->compileFile(fileName)) { + d->log = shader->log(); + delete shader; + return false; + } + d->anonShaders.append(shader); + return addShader(shader); +} + +/*! Removes \a shader from this shader program. The object is not deleted. \sa addShader(), link(), removeAllShaders() diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index c5295eb..5499f8a 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -72,10 +72,8 @@ public: }; explicit QGLShader(QGLShader::ShaderType type, QObject *parent = 0); - explicit QGLShader(const QString& fileName, QObject *parent = 0); QGLShader(const QString& fileName, QGLShader::ShaderType type, QObject *parent = 0); QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0); - QGLShader(const QString& fileName, const QGLContext *context, QObject *parent = 0); QGLShader(const QString& fileName, QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0); virtual ~QGLShader(); @@ -123,6 +121,7 @@ public: bool addShader(QGLShader::ShaderType type, const char *source); bool addShader(QGLShader::ShaderType type, const QByteArray& source); bool addShader(QGLShader::ShaderType type, const QString& source); + bool addShaderFromFile(QGLShader::ShaderType type, const QString& fileName); void removeAllShaders(); -- cgit v0.12 From c52061e7980fcde5d59a7657a254ce00d117b611 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 26 Aug 2009 08:54:04 +0200 Subject: Make QGLShader::ShaderType slightly more future proof by making it into a bitmask. I'll add GeometryShader in the future Reviewed-by: Rhys Weatherley --- src/opengl/qglshaderprogram.cpp | 9 ++++++--- src/opengl/qglshaderprogram.h | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 83578b3..8ce50cf 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -104,7 +104,7 @@ QT_BEGIN_NAMESPACE on desktop systems. The programmer should restrict themselves to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop. - + \section1 Simple shader example \code @@ -199,8 +199,11 @@ QT_BEGIN_NAMESPACE \value VertexShader Vertex shader written in the OpenGL Shading Language (GLSL). \value FragmentShader Fragment shader written in the OpenGL Shading Language (GLSL). + \value PartialVertexShader Partial vertex shader that will be concatenated with all other partial vertex shaders at link time. \value PartialFragmentShader Partial fragment shader that will be concatenated with all other partial fragment shaders at link time. + + \omitvalue PartialShader */ #ifndef GL_FRAGMENT_SHADER @@ -251,8 +254,7 @@ public: , shader(0) , shaderType(type) , compiled(false) - , isPartial(type == QGLShader::PartialVertexShader || - type == QGLShader::PartialFragmentShader) + , isPartial((type & QGLShader::PartialShader) != 0) , hasPartialSource(false) { } @@ -2960,6 +2962,7 @@ bool QGLShaderProgram::hasShaderPrograms(const QGLContext *context) #endif } + #endif QT_END_NAMESPACE diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index 5499f8a..4f95ef3 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -63,13 +63,17 @@ class Q_OPENGL_EXPORT QGLShader : public QObject { Q_OBJECT public: - enum ShaderType + enum ShaderTypeBits { - VertexShader, - FragmentShader, - PartialVertexShader, - PartialFragmentShader + VertexShader = 0x0001, + FragmentShader = 0x0002, + + PartialShader = 0x1000, + + PartialVertexShader = PartialShader | VertexShader, + PartialFragmentShader = PartialShader | FragmentShader }; + Q_DECLARE_FLAGS(ShaderType, ShaderTypeBits); explicit QGLShader(QGLShader::ShaderType type, QObject *parent = 0); QGLShader(const QString& fileName, QGLShader::ShaderType type, QObject *parent = 0); @@ -104,6 +108,9 @@ private: Q_DISABLE_COPY(QGLShader) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLShader::ShaderType); + + class QGLShaderProgramPrivate; class Q_OPENGL_EXPORT QGLShaderProgram : public QObject -- cgit v0.12 From 6576cf1ac0ce0443925f5f63f996f0a6be95c5d1 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 26 Aug 2009 08:47:40 +0200 Subject: New variant of QGLContext::bindTexture that does not require mipmap generation and y-axis inversion and overall less conversion, making significantly faster for plain usecases Reviewed-by: Trond --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 17 +- src/opengl/qgl.cpp | 282 ++++++++++++++++----- src/opengl/qgl.h | 33 +++ src/opengl/qgl_p.h | 33 ++- src/opengl/qgl_x11.cpp | 12 +- src/opengl/qglextensions_p.h | 8 + src/opengl/qglpixmapfilter.cpp | 2 +- src/opengl/qpaintengine_opengl.cpp | 8 +- src/opengl/qpixmapdata_gl.cpp | 2 +- 9 files changed, 308 insertions(+), 89 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 136a078..fb0cd99 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -384,7 +384,7 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() QImage texImage = qt_imageForBrush(style, false); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, true); + ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, true, QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, true); } else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { @@ -410,8 +410,7 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() const QPixmap& texPixmap = currentBrush->texture(); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - // TODO: Support y-inverted pixmaps as brushes - ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, true); + ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, true); } brushTextureDirty = false; @@ -667,7 +666,7 @@ void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& s GLfloat dx = 1.0 / textureSize.width(); GLfloat dy = 1.0 / textureSize.height(); - QGLRect srcTextureRect(src.left*dx, 1.0 - src.top*dy, src.right*dx, 1.0 - src.bottom*dy); + QGLRect srcTextureRect(src.left*dx, src.top*dy, src.right*dx, src.bottom*dy); setCoords(staticVertexCoordinateArray, dest); setCoords(staticTextureCoordinateArray, srcTextureRect); @@ -1092,10 +1091,11 @@ 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, true, true); + QGLTexture *texture = + ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); - GLfloat top = texture->yInverted ? (pixmap.height() - src.top()) : src.top(); - GLfloat bottom = texture->yInverted ? (pixmap.height() - src.bottom()) : src.bottom(); + GLfloat top = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.top()) : src.top(); + GLfloat bottom = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.bottom()) : src.bottom(); QGLRect srcRect(src.left(), top, src.right(), bottom); bool isBitmap = pixmap.isQBitmap(); @@ -1115,7 +1115,8 @@ void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QGLContext *ctx = d->ctx; glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); - QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, true); + QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, true, + QGLContext::InternalBindOption); GLuint id = texture->id; d->updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 57ef70c..e9c4190 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1443,7 +1443,7 @@ bool QGLTextureCache::remove(QGLContext* ctx, GLuint textureId) for (int i = 0; i < keys.size(); ++i) { QGLTexture *tex = m_cache.object(keys.at(i)); if (tex->id == textureId && tex->context == ctx) { - tex->clean = true; // forces a glDeleteTextures() call + tex->options |= QGLContext::MemoryManagedBindOption; // forces a glDeleteTextures() call m_cache.remove(keys.at(i)); return true; } @@ -1479,7 +1479,7 @@ void QGLTextureCache::imageCleanupHook(qint64 cacheKey) if (qApp->thread() != QThread::currentThread()) return; QGLTexture *texture = instance()->getTexture(cacheKey); - if (texture && texture->clean) + if (texture && texture->options & QGLContext::MemoryManagedBindOption) instance()->remove(cacheKey); } @@ -1490,7 +1490,7 @@ void QGLTextureCache::pixmapCleanupHook(QPixmap* pixmap) if (qApp->thread() == QThread::currentThread()) { const qint64 cacheKey = pixmap->cacheKey(); QGLTexture *texture = instance()->getTexture(cacheKey); - if (texture && texture->clean) + if (texture && texture->options & QGLContext::MemoryManagedBindOption) instance()->remove(cacheKey); } #if defined(Q_WS_X11) @@ -1578,6 +1578,39 @@ Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg() Please note that QGLContext is not thread safe. */ +/*! + \enum QGLContext::BindOption + A set of options to decide how to bind a texture using bindTexture(). + + \value NoBindOption Don't do anything, pass the texture straight + thru. + + \value InvertedYBindOption Specifies that the texture should be flipped + over the X axis so that the texture coordinate 0,0 corresponds to + the top left corner. Inverting the texture implies a deep copy + prior to upload. + + \value MipmapBindOption Specifies that bindTexture should try + to generate mipmaps. If the GL implementation supports the \c + GL_SGIS_generate_mipmap extension, mipmaps will be automatically + generated for the texture. Mipmap generation is only supported for + the \c GL_TEXTURE_2D target. + + \value PremultipliedAlphaBindOption Specifies that the image should be + uploaded with premultiplied alpha and does a conversion accordingly. + + \value LinearFilteringBindOption Specifies that the texture filtering + should be set to GL_LINEAR. Default is GL_NEAREST. If mipmap is + also enabled, filtering will be set to GL_LINEAR_MIPMAP_LINEAR. + + \value DefaultBindOption In Qt 4.5 and earlier, bindTexture() + would mirror the image and automatically generate mipmaps. This + option helps preserve this default behavior. + + \omitvalue MemoryManagedBindOption + + \omitvalue InternalBindOption +*/ /*! \obsolete @@ -1880,7 +1913,8 @@ QImage QGLContextPrivate::convertToGLFormat(const QImage &image, bool force_prem } /*! \internal */ -QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format, bool clean) +QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format, + QGLContext::BindOptions options) { const qint64 key = image.cacheKey(); QGLTexture *texture = textureCacheLookup(key, target); @@ -1890,7 +1924,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G } if (!texture) - texture = bindTexture(image, target, format, key, clean); + texture = bindTexture(image, target, format, key, options); // NOTE: bindTexture(const QImage&, GLenum, GLint, const qint64, bool) should never return null Q_ASSERT(texture); @@ -1900,68 +1934,128 @@ QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G return texture; } +// #define QGL_BIND_TEXTURE_DEBUG + QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format, - const qint64 key, bool clean) + const qint64 key, QGLContext::BindOptions options) { Q_Q(QGLContext); - QGLContext *ctx = q; - - // the GL_BGRA format is only present in GL version >= 1.2 - GLenum texture_format = (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2) - ? GL_BGRA : GL_RGBA; +#ifdef QGL_BIND_TEXTURE_DEBUG + printf("QGLContextPrivate::bindTexture(), imageSize=(%d,%d), format=%x, options=%x\n", + image.width(), image.height(), format, int(options)); +#endif // Scale the pixmap if needed. GL textures needs to have the // dimensions 2^n+2(border) x 2^m+2(border), unless we're using GL // 2.0 or use the GL_TEXTURE_RECTANGLE texture target int tx_w = qt_next_power_of_two(image.width()); int tx_h = qt_next_power_of_two(image.height()); - bool scale = false; QImage img = image; if (( !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) && !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0) ) && (target == GL_TEXTURE_2D && (tx_w != image.width() || tx_h != image.height()))) { - scale = true; + img = img.scaled(tx_w, tx_h); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - upscaled to %dx%d\n", tx_w, tx_h); +#endif } + GLuint filtering = options & QGLContext::LinearFilteringBindOption ? GL_LINEAR : GL_NEAREST; + GLuint tx_id; glGenTextures(1, &tx_id); glBindTexture(target, tx_id); - glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(target, GL_TEXTURE_MAG_FILTER, filtering); + if (glFormat.directRendering() && QGLExtensions::glExtensions & QGLExtensions::GenerateMipmap - && target == GL_TEXTURE_2D && !clean) + && target == GL_TEXTURE_2D + && options & QGLContext::MipmapBindOption) { +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - generating mipmaps\n"); +#endif glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); #ifndef QT_OPENGL_ES glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); #else glTexParameterf(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); #endif - glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(target, GL_TEXTURE_MIN_FILTER, options & QGLContext::LinearFilteringBindOption + ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST); } else { - glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(target, GL_TEXTURE_MIN_FILTER, filtering); } QImage::Format target_format = img.format(); - // Note: the clean param is only true when a texture is bound - // from the QOpenGLPaintEngine - in that case we have to force - // a premultiplied texture format - if (clean || img.format() != QImage::Format_ARGB32) - target_format = QImage::Format_ARGB32_Premultiplied; - if (img.format() != target_format) - img = img.convertToFormat(target_format); + bool premul = options & QGLContext::PremultipliedAlphaBindOption; + GLenum texture_format = QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2 + ? GL_BGRA : GL_RGBA; + GLuint pixel_type = GL_UNSIGNED_BYTE; + + switch (target_format) { + case QImage::Format_ARGB32: + if (premul) { + img = img.convertToFormat(target_format = QImage::Format_ARGB32_Premultiplied); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - converting ARGB32 -> ARGB32_Premultiplied \n"); +#endif + } + break; + case QImage::Format_ARGB32_Premultiplied: + if (!premul) { + img = img.convertToFormat(target_format = QImage::Format_ARGB32); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - converting ARGB32_Premultiplied -> ARGB32\n"); +#endif + } + break; + case QImage::Format_RGB16: + pixel_type = GL_UNSIGNED_SHORT_5_6_5; + texture_format = GL_RGB; + break; + case QImage::Format_RGB32: + if (format == GL_RGBA) + format = GL_RGB; + break; + + default: + if (img.hasAlphaChannel()) { + img = img.convertToFormat(premul + ? QImage::Format_ARGB32_Premultiplied + : QImage::Format_ARGB32); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - converting to 32-bit alpha format\n"); +#endif + } else { + img = img.convertToFormat(QImage::Format_RGB32); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - converting to 32-bit\n"); +#endif + } + } + + if (options & QGLContext::InvertedYBindOption) { + int ipl = img.bytesPerLine() / 4; + int h = img.height(); + for (int y=0; yinsert(q, key, texture, cost); return texture; } @@ -1980,7 +2074,7 @@ QGLTexture *QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum targe /*! \internal */ -QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, bool clean, bool canInvert) +QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, QGLContext::BindOptions options) { Q_Q(QGLContext); QPixmapData *pd = pixmap.pixmapData(); @@ -2005,9 +2099,9 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, #if defined(Q_WS_X11) // Try to use texture_from_pixmap if (pd->classId() == QPixmapData::X11Class) { - texture = bindTextureFromNativePixmap(pd, key, canInvert); + texture = bindTextureFromNativePixmap(pd, key, options); if (texture) { - texture->clean = clean; + texture->options |= QGLContext::BindMemoryManaged; texture->boundPixmap = pd; boundPixmaps.insert(pd, QPixmap(pixmap)); } @@ -2015,7 +2109,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, #endif if (!texture) - texture = bindTexture(pixmap.toImage(), target, format, key, clean); + texture = bindTexture(pixmap.toImage(), target, format, key, options); // NOTE: bindTexture(const QImage&, GLenum, GLint, const qint64, bool) should never return null Q_ASSERT(texture); @@ -2061,6 +2155,20 @@ int QGLContextPrivate::maxTextureSize() } /*! + Generates and binds a 2D GL texture to the current context, based + on \a image. The generated texture id is returned and can be used in + later \c glBindTexture() calls. + + \overload +*/ +GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) +{ + Q_D(QGLContext); + QGLTexture *texture = d->bindTexture(image, target, format, false, DefaultBindOption); + return texture->id; +} + +/*! Generates and binds a 2D GL texture to the current context, based on \a image. The generated texture id is returned and can be used in later \c glBindTexture() calls. @@ -2069,12 +2177,7 @@ int QGLContextPrivate::maxTextureSize() target is \c GL_TEXTURE_2D. The \a format parameter sets the internal format for the - texture. The default format is \c GL_RGBA8. - - If the GL implementation supports the \c GL_SGIS_generate_mipmap - extension, mipmaps will be automatically generated for the - texture. Mipmap generation is only supported for the \c - GL_TEXTURE_2D target. + texture. The default format is \c GL_RGBA. The texture that is generated is cached, so multiple calls to bindTexture() with the same QImage will return the same texture @@ -2085,10 +2188,10 @@ int QGLContextPrivate::maxTextureSize() \sa deleteTexture() */ -GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) +GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, BindOptions options) { Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(image, target, format, false); + QGLTexture *texture = d->bindTexture(image, target, format, false, options); return texture->id; } @@ -2097,7 +2200,16 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) { Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false); + QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, DefaultBindOption); + return texture->id; +} + +/*! \internal */ +GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, + BindOptions options) +{ + Q_D(QGLContext); + QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, options); return texture->id; } #endif @@ -2109,7 +2221,20 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) { Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(pixmap, target, format, false, false); + QGLTexture *texture = d->bindTexture(pixmap, target, format, DefaultBindOption); + return texture->id; +} + +/*! + \overload + + Generates and binds a 2D GL texture to the current context, based + on \a image. +*/ +GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, BindOptions options) +{ + Q_D(QGLContext); + QGLTexture *texture = d->bindTexture(pixmap, target, format, options); return texture->id; } @@ -2118,7 +2243,15 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format) { Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), false, false); + QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), DefaultBindOption); + return texture->id; +} +/*! \internal */ +GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format, + BindOptions options) +{ + Q_D(QGLContext); + QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), options); return texture->id; } #endif @@ -4118,15 +4251,31 @@ bool QGLWidget::autoBufferSwap() const GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format) { Q_D(QGLWidget); - return d->glcx->bindTexture(image, target, format); + return d->glcx->bindTexture(image, target, format, QGLContext::DefaultBindOption); } + + +GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options) +{ + Q_D(QGLWidget); + return d->glcx->bindTexture(image, target, format, options); +} + + #ifdef Q_MAC_COMPAT_GL_FUNCTIONS /*! \internal */ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) { Q_D(QGLWidget); - return d->glcx->bindTexture(image, GLenum(target), GLint(format)); + return d->glcx->bindTexture(image, GLenum(target), GLint(format), QGLContext::DefaultBindOption); +} + +GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, + QGLContext::BindOptions options) +{ + Q_D(QGLWidget); + return d->glcx->bindTexture(image, GLenum(target), GLint(format), options); } #endif @@ -4139,7 +4288,14 @@ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMac GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) { Q_D(QGLWidget); - return d->glcx->bindTexture(pixmap, target, format); + return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption); +} + +GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + QGLContext::BindOptions options) +{ + Q_D(QGLWidget); + return d->glcx->bindTexture(pixmap, target, format, options); } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS @@ -4147,7 +4303,14 @@ GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format GLuint QGLWidget::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format) { Q_D(QGLWidget); - return d->glcx->bindTexture(pixmap, target, format); + return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption); +} + +GLuint QGLWidget::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format, + QGLContext::BindOptions options) +{ + Q_D(QGLWidget); + return d->glcx->bindTexture(pixmap, target, format, options); } #endif @@ -4568,34 +4731,37 @@ QGLFormat QGLDrawable::format() const return QGLFormat(); } -GLuint QGLDrawable::bindTexture(const QImage &image, GLenum target, GLint format) +GLuint QGLDrawable::bindTexture(const QImage &image, GLenum target, GLint format, + QGLContext::BindOptions options) { QGLTexture *texture = 0; + options |= QGLContext::MemoryManagedBindOption; if (widget) - texture = widget->d_func()->glcx->d_func()->bindTexture(image, target, format, true); + texture = widget->d_func()->glcx->d_func()->bindTexture(image, target, format, options); else if (buffer) - texture = buffer->d_func()->qctx->d_func()->bindTexture(image, target, format, true); + texture = buffer->d_func()->qctx->d_func()->bindTexture(image, target, format, options); else if (fbo && QGLContext::currentContext()) - texture = const_cast(QGLContext::currentContext())->d_func()->bindTexture(image, target, format, true); + texture = const_cast(QGLContext::currentContext())->d_func()->bindTexture(image, target, format, options); #if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)) else if (wsurf) - texture = wsurf->context()->d_func()->bindTexture(image, target, format, true); + texture = wsurf->context()->d_func()->bindTexture(image, target, format, options); #endif return texture->id; } -GLuint QGLDrawable::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) +GLuint QGLDrawable::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + QGLContext::BindOptions options) { QGLTexture *texture = 0; if (widget) - texture = widget->d_func()->glcx->d_func()->bindTexture(pixmap, target, format, true, true); + texture = widget->d_func()->glcx->d_func()->bindTexture(pixmap, target, format, options); else if (buffer) - texture = buffer->d_func()->qctx->d_func()->bindTexture(pixmap, target, format, true, true); + texture = buffer->d_func()->qctx->d_func()->bindTexture(pixmap, target, format, options); else if (fbo && QGLContext::currentContext()) - texture = const_cast(QGLContext::currentContext())->d_func()->bindTexture(pixmap, target, format, true, true); + texture = const_cast(QGLContext::currentContext())->d_func()->bindTexture(pixmap, target, format, options); #if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)) else if (wsurf) - texture = wsurf->context()->d_func()->bindTexture(pixmap, target, format, true, true); + texture = wsurf->context()->d_func()->bindTexture(pixmap, target, format, options); #endif return texture->id; } diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 678bbb7..a928d64 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -288,6 +288,25 @@ 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 + }; + Q_DECLARE_FLAGS(BindOptions, BindOption); + + GLuint bindTexture(const QImage &image, GLenum target, GLint format, + BindOptions options); + GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + BindOptions options); + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, @@ -304,6 +323,10 @@ public: QMacCompatGLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, QMacCompatGLint format = GL_RGBA); + GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, + BindOptions); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, + BindOptions); void deleteTexture(QMacCompatGLuint tx_id); @@ -446,10 +469,16 @@ public: const QFont & fnt = QFont(), int listBase = 2000); QPaintEngine *paintEngine() const; + GLuint bindTexture(const QImage &image, GLenum target, GLint format, + QGLContext::BindOptions options); + GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + QGLContext::BindOptions options); + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); + GLuint bindTexture(const QString &fileName); void deleteTexture(GLuint tx_id); @@ -462,6 +491,10 @@ public: QMacCompatGLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, QMacCompatGLint format = GL_RGBA); + GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, + QGLContext::BindOptions); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, + QGLContext::BindOptions); void deleteTexture(QMacCompatGLuint tx_id); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index ab040ed..6905199 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -208,10 +208,12 @@ class QGLContextPrivate public: explicit QGLContextPrivate(QGLContext *context) : internal_context(false), q_ptr(context) {groupResources = new QGLContextGroupResources;} ~QGLContextPrivate() {if (!groupResources->refs.deref()) delete groupResources;} - QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, bool clean); + QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, + QGLContext::BindOptions options); QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, const qint64 key, - bool clean = false); - QGLTexture *bindTexture(const QPixmap &pixmap, GLenum target, GLint format, bool clean, bool canInvert = false); + QGLContext::BindOptions options); + QGLTexture *bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + QGLContext::BindOptions options); QGLTexture *textureCacheLookup(const qint64 key, GLenum target); void init(QPaintDevice *dev, const QGLFormat &format); QImage convertToGLFormat(const QImage &image, bool force_premul, GLenum texture_format); @@ -241,7 +243,8 @@ public: quint32 gpm; int screen; QHash boundPixmaps; - QGLTexture *bindTextureFromNativePixmap(QPixmapData*, const qint64 key, bool canInvert); + QGLTexture *bindTextureFromNativePixmap(QPixmapData*, const qint64 key, + QGLContext::BindOptions options); static void destroyGlSurfaceForPixmap(QPixmapData*); static void unbindPixmapFromTexture(QPixmapData*); #endif @@ -319,8 +322,10 @@ public: void doneCurrent(); QSize size() const; QGLFormat format() const; - GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); - GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA, + QGLContext::BindOptions = QGLContext::InternalBindOption); + GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA, + QGLContext::BindOptions = QGLContext::InternalBindOption); QColor backgroundColor() const; QGLContext *context() const; bool autoFillBackground() const; @@ -404,15 +409,18 @@ extern Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg(); class QGLTexture { public: QGLTexture(QGLContext *ctx = 0, GLuint tx_id = 0, GLenum tx_target = GL_TEXTURE_2D, - bool _clean = false, bool _yInverted = false) - : context(ctx), id(tx_id), target(tx_target), clean(_clean), yInverted(_yInverted) + QGLContext::BindOptions opt = QGLContext::DefaultBindOption) + : context(ctx), + id(tx_id), + target(tx_target), + options(opt) #if defined(Q_WS_X11) - , boundPixmap(0) + , boundPixmap(0) #endif {} ~QGLTexture() { - if (clean) { + if (options & QGLContext::MemoryManagedBindOption) { QGLContext *current = const_cast(QGLContext::currentContext()); QGLContext *ctx = const_cast(context); Q_ASSERT(ctx); @@ -436,8 +444,9 @@ public: QGLContext *context; GLuint id; GLenum target; - bool clean; - bool yInverted; // NOTE: Y-Inverted textures are for internal use only! + + QGLContext::BindOptions options; + #if defined(Q_WS_X11) QPixmapData* boundPixmap; #endif diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index dccdf63..2337964 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1599,7 +1599,8 @@ bool qt_resolveTextureFromPixmap() #endif //defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) -QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, const qint64 key, bool canInvert) +QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, const qint64 key, + QGLContext::BindOptions options) { #if !defined(GLX_VERSION_1_3) || defined(Q_OS_HPUX) return 0; @@ -1632,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, canInvert ? GLX_DONT_CARE : False, + GLX_Y_INVERTED_EXT, options & QGLContext::BindInvertedY ? GLX_DONT_CARE : False, XNone }; configList = glXChooseFBConfig(x11Info.display(), x11Info.screen(), configAttribs, &configCount); @@ -1693,9 +1694,10 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con glBindTexture(GL_TEXTURE_2D, textureId); - QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, canInvert, false); - texture->yInverted = (hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted); - if (texture->yInverted) + if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))); + options &= ~QGLContext::BindInvertedY; + QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); + if (texture->options & QGLContext::BindInvertedY) pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; // We assume the cost of bound pixmaps is zero diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h index b03fdfa..a5f83a5 100644 --- a/src/opengl/qglextensions_p.h +++ b/src/opengl/qglextensions_p.h @@ -410,6 +410,14 @@ struct QGLExtensionFuncs #define GL_BGRA 0x80E1 #endif +#ifndef GL_RGB16 +#define GL_RGB16 32852 +#endif + +#ifndef GL_UNSIGNED_SHORT_5_6_5 +#define GL_UNSIGNED_SHORT_5_6_5 33635 +#endif + #ifndef GL_MULTISAMPLE #define GL_MULTISAMPLE 0x809D #endif diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index e1ee61a..9ea602d 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE void QGLPixmapFilterBase::bindTexture(const QPixmap &src) const { - const_cast(QGLContext::currentContext())->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, true, false); + const_cast(QGLContext::currentContext())->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, QGLContext::BindOptions(QGLContext::DefaultBindOption | QGLContext::MemoryManagedBindOption)); } void QGLPixmapFilterBase::drawImpl(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF& source) const diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 9434adf..ade67d3 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4433,13 +4433,13 @@ void QOpenGLPaintEngine::drawTextureRect(int tx_width, int tx_height, const QRec if (target == GL_TEXTURE_2D) { x1 = sr.x() / tx_width; x2 = x1 + sr.width() / tx_width; - y1 = 1.0 - (sr.bottom() / tx_height); - y2 = 1.0 - (sr.y() / tx_height); + y1 = 1 - (sr.bottom() / tx_height); + y2 = 1 - (sr.y() / tx_height); } else { x1 = sr.x(); x2 = sr.right(); - y1 = tx_height - sr.bottom(); - y2 = tx_height - sr.y(); + y1 = sr.bottom(); + y2 = sr.y(); } q_vertexType vertexArray[4*2]; diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 80e99a0..c193f12 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -271,7 +271,7 @@ void QGLPixmapData::ensureCreated() const m_source = QImage(); } - m_texture.clean = false; + m_texture.options &= ~QGLContext::MemoryManagedBindOption; } QGLFramebufferObject *QGLPixmapData::fbo() const -- cgit v0.12 From 4b112230229544b13c254acd8a10b67939c79f22 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 26 Aug 2009 13:25:58 +0200 Subject: make x11 compile... --- src/opengl/qgl_x11.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 2337964..aca60bc 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::BindInvertedY ? GLX_DONT_CARE : False, + GLX_Y_INVERTED_EXT, options & QGLContext::InvertedYBindOption ? GLX_DONT_CARE : False, XNone }; configList = glXChooseFBConfig(x11Info.display(), x11Info.screen(), configAttribs, &configCount); @@ -1695,9 +1695,9 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con glBindTexture(GL_TEXTURE_2D, textureId); if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))); - options &= ~QGLContext::BindInvertedY; + options &= ~QGLContext::InvertedYBindOption; QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); - if (texture->options & QGLContext::BindInvertedY) + if (texture->options & QGLContext::InvertedYBindOption) pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; // We assume the cost of bound pixmaps is zero -- cgit v0.12 From fbef539a2a1ec5469b61ea69e72a0538e129e1a4 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 27 Aug 2009 09:29:48 +0200 Subject: compile on x11 --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e9c4190..02991d9 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2101,7 +2101,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, if (pd->classId() == QPixmapData::X11Class) { texture = bindTextureFromNativePixmap(pd, key, options); if (texture) { - texture->options |= QGLContext::BindMemoryManaged; + texture->options |= QGLContext::MemoryManagedBindOption; texture->boundPixmap = pd; boundPixmaps.insert(pd, QPixmap(pixmap)); } -- cgit v0.12