diff options
author | Lorn Potter <lorn.potter@nokia.com> | 2010-03-24 23:06:43 (GMT) |
---|---|---|
committer | Lorn Potter <lorn.potter@nokia.com> | 2010-03-24 23:06:43 (GMT) |
commit | d20510dd91e01b15e2346c0cb12e352080b6a093 (patch) | |
tree | 83554f5c96f69df6fe6d9d5c2a9f529a3b1316d8 /src | |
parent | f727f993c3c4e3f548b06d57b3ee0da4f3914bae (diff) | |
parent | 8218a16815d883823d3411be9896332b997f3e91 (diff) | |
download | Qt-d20510dd91e01b15e2346c0cb12e352080b6a093.zip Qt-d20510dd91e01b15e2346c0cb12e352080b6a093.tar.gz Qt-d20510dd91e01b15e2346c0cb12e352080b6a093.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Conflicts:
src/plugins/bearer/corewlan/qcorewlanengine.mm
Diffstat (limited to 'src')
83 files changed, 852 insertions, 712 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h index 5fb7fe3..5b655e8 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h @@ -75,7 +75,7 @@ #include <libkern/OSAtomic.h> #elif OS(ANDROID) #include <cutils/atomic.h> -#elif COMPILER(GCC) && !PLATFORM(SYMBIAN) +#elif COMPILER(GCC) && !defined(__SYMBIAN32__) #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) #include <ext/atomicity.h> #else @@ -239,7 +239,7 @@ inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Bar inline int atomicIncrement(int volatile* addend) { return android_atomic_inc(addend); } inline int atomicDecrement(int volatile* addend) { return android_atomic_dec(addend); } -#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !PLATFORM(SYMBIAN) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc +#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !defined(__SYMBIAN32__) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h index 52a24f6..3e25c95 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h @@ -73,7 +73,7 @@ #include <windows.h> #elif PLATFORM(DARWIN) #include <libkern/OSAtomic.h> -#elif COMPILER(GCC) && !PLATFORM(SYMBIAN) +#elif COMPILER(GCC) && !defined(__SYMBIAN32__) #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) #include <ext/atomicity.h> #else @@ -232,7 +232,7 @@ inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(r inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); } inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); } -#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !PLATFORM(SYMBIAN) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc +#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !defined(__SYMBIAN32__) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; } diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 7617c1f..5ca30e6 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -464,12 +464,7 @@ void QSequentialAnimationGroupPrivate::setCurrentAnimation(int index, bool inter void QSequentialAnimationGroupPrivate::activateCurrentAnimation(bool intermediate) { - Q_Q(QSequentialAnimationGroup); - - if (!currentAnimation) - return; - - if (state == QSequentialAnimationGroup::Stopped) + if (!currentAnimation || state == QSequentialAnimationGroup::Stopped) return; currentAnimation->stop(); diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 775c0f3..b1108cb 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1255,7 +1255,7 @@ window boundary (widget without parent or dialog) is found. This attribute currently has effect only on Symbian platforms - \value WA_X11DoNoAcceptFocus Asks the window manager to not give focus + \value WA_X11DoNotAcceptFocus Asks the window manager to not give focus to this top level window. This attribute has no effect on non-X11 platforms. diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 505889e..1b60936 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1079,6 +1079,8 @@ QDir::Filters QDir::filter() const \value NoSymLinks Do not list symbolic links (ignored by operating systems that don't support symbolic links). \value NoDotAndDotDot Do not list the special entries "." and "..". + \value NoDot Do not list the special entry ".". + \value NoDotDot Do not list the special entry "..". \value AllEntries List directories, files, drives and symlinks (this does not list broken symlinks unless you specify System). \value Readable List files for which the application has read @@ -2367,7 +2369,9 @@ QDebug operator<<(QDebug debug, QDir::Filters filters) if (filters & QDir::Files) flags << QLatin1String("Files"); if (filters & QDir::Drives) flags << QLatin1String("Drives"); if (filters & QDir::NoSymLinks) flags << QLatin1String("NoSymLinks"); - if (filters & QDir::NoDotAndDotDot) flags << QLatin1String("NoDotAndDotDot"); + if (filters & QDir::NoDotAndDotDot) flags << QLatin1String("NoDotAndDotDot"); // ### Qt5: remove (because NoDotAndDotDot=NoDot|NoDotDot) + if (filters & QDir::NoDot) flags << QLatin1String("NoDot"); + if (filters & QDir::NoDotDot) flags << QLatin1String("NoDotDot"); if ((filters & QDir::AllEntries) == QDir::AllEntries) flags << QLatin1String("AllEntries"); if (filters & QDir::Readable) flags << QLatin1String("Readable"); if (filters & QDir::Writable) flags << QLatin1String("Writable"); diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h index 186dd2f..28da271 100644 --- a/src/corelib/io/qdir.h +++ b/src/corelib/io/qdir.h @@ -88,7 +88,9 @@ public: AllDirs = 0x400, CaseSensitive = 0x800, - NoDotAndDotDot = 0x1000, + NoDotAndDotDot = 0x1000, // ### Qt5 NoDotAndDotDot = NoDot|NoDotDot + NoDot = 0x2000, + NoDotDot = 0x4000, NoFilter = -1 #ifdef QT3_SUPPORT diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 860fb63..fd4b9c1 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -287,7 +287,11 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf const bool dotOrDotDot = fileName[0] == QLatin1Char('.') && ((fileNameSize == 1) ||(fileNameSize == 2 && fileName[1] == QLatin1Char('.'))); - if ((filters & QDir::NoDotAndDotDot) && dotOrDotDot) + if ((filters & QDir::NoDot) && dotOrDotDot && fileNameSize == 1) + return false; + if ((filters & QDir::NoDotDot) && dotOrDotDot && fileNameSize == 2) + return false; + if ((filters & QDir::NoDotAndDotDot) && dotOrDotDot) // ### Qt5 remove (NoDotAndDotDot == NoDot|NoDotDot) return false; // name filter diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 5e14804..a1ffb81 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -126,8 +126,10 @@ void QFSFileEnginePrivate::init() fileAttrib = INVALID_FILE_ATTRIBUTES; fileHandle = INVALID_HANDLE_VALUE; mapHandle = INVALID_HANDLE_VALUE; +#ifndef Q_OS_WINCE cachedFd = -1; #endif +#endif } /*! diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index d07c3a0..55c779e 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -112,7 +112,11 @@ public: HANDLE fileHandle; HANDLE mapHandle; QHash<uchar *, DWORD /* offset % AllocationGranularity */> maps; + +#ifndef Q_OS_WINCE mutable int cachedFd; +#endif + mutable DWORD fileAttrib; #else QHash<uchar *, QPair<int /*offset % PageSize*/, size_t /*length + offset % PageSize*/> > maps; diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 8d34486..eeca07e 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -450,13 +450,27 @@ bool QFSFileEnginePrivate::nativeClose() // Windows native mode. bool ok = true; + +#ifndef Q_OS_WINCE + if (cachedFd != -1) { + if (::_close(cachedFd) && !::CloseHandle(fileHandle)) { + q->setError(QFile::UnspecifiedError, qt_error_string()); + ok = false; + } + + // System handle is closed with associated file descriptor. + fileHandle = INVALID_HANDLE_VALUE; + cachedFd = -1; + + return ok; + } +#endif + if ((fileHandle == INVALID_HANDLE_VALUE || !::CloseHandle(fileHandle))) { q->setError(QFile::UnspecifiedError, qt_error_string()); ok = false; } fileHandle = INVALID_HANDLE_VALUE; - cachedFd = -1; // gets closed by CloseHandle above - return ok; } @@ -1261,12 +1275,7 @@ static QString readSymLink(const QString &link) REPARSE_DATA_BUFFER *rdb = (REPARSE_DATA_BUFFER*)qMalloc(bufsize); DWORD retsize = 0; if (::DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, 0, 0, rdb, bufsize, &retsize, 0)) { - if (rdb->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { - int length = rdb->MountPointReparseBuffer.SubstituteNameLength / sizeof(wchar_t); - int offset = rdb->MountPointReparseBuffer.SubstituteNameOffset / sizeof(wchar_t); - const wchar_t* PathBuffer = &rdb->MountPointReparseBuffer.PathBuffer[offset]; - result = QString::fromWCharArray(PathBuffer, length); - } else { + if (rdb->ReparseTag == IO_REPARSE_TAG_SYMLINK) { int length = rdb->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(wchar_t); int offset = rdb->SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(wchar_t); const wchar_t* PathBuffer = &rdb->SymbolicLinkReparseBuffer.PathBuffer[offset]; @@ -1529,8 +1538,7 @@ bool QFSFileEnginePrivate::isSymlink() const if (hFind != INVALID_HANDLE_VALUE) { ::FindClose(hFind); if ((findData.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) - && (findData.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT - || findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) { + && findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK) { is_link = true; } } diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp index 394323f..eb42c20 100644 --- a/src/corelib/io/qwindowspipewriter.cpp +++ b/src/corelib/io/qwindowspipewriter.cpp @@ -100,7 +100,7 @@ qint64 QWindowsPipeWriter::write(const char *ptr, qint64 maxlen) void QWindowsPipeWriter::run() { - OVERLAPPED overl = {0, 0, 0, 0, NULL}; + OVERLAPPED overl = {0, 0, {{ 0 }}, 0}; overl.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); forever { lock.lock(); diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 566626d..c1925e7 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -1022,12 +1022,12 @@ QString decodeMSG(const MSG& msg) if (!winPos) break; QString hwndAfter = valueCheck(quint64(winPos->hwndInsertAfter), - FLAG_STRING((quintptr)HWND_BOTTOM, "HWND_BOTTOM"), - FLAG_STRING((quintptr)HWND_NOTOPMOST, "HWND_NOTOPMOST"), - FLAG_STRING((quintptr)HWND_TOP, "HWND_TOP"), - FLAG_STRING((quintptr)HWND_TOPMOST, "HWND_TOPMOST"), + FLAG_STRING((qptrdiff)HWND_BOTTOM, "HWND_BOTTOM"), + FLAG_STRING((qptrdiff)HWND_NOTOPMOST, "HWND_NOTOPMOST"), + FLAG_STRING((qptrdiff)HWND_TOP, "HWND_TOP"), + FLAG_STRING((qptrdiff)HWND_TOPMOST, "HWND_TOPMOST"), FLAG_STRING()); - if (hwndAfter.size() == 0) + if (hwndAfter.isEmpty()) hwndAfter = QString::number((quintptr)winPos->hwndInsertAfter, 16); QString flags = flagCheck(winPos->flags, FLGSTR(SWP_DRAWFRAME), diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 312c4b2..4ad78fd 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -483,38 +483,37 @@ int QMetaObject::classInfoCount() const } /** \internal -* helper class for indexOf{Method,Slot,Signal}, returns the relative index of the method within +* helper function for indexOf{Method,Slot,Signal}, returns the relative index of the method within * the baseObject * \a MethodType might be MethodSignal or MethodSlot, or 0 to match everything. +* \a normalizeStringData set to true if we should do a second pass for old moc generated files normalizing all the symbols. */ template<int MethodType> static inline int indexOfMethodRelative(const QMetaObject **baseObject, const char *method, bool normalizeStringData) { - const QMetaObject *m; - for (m = *baseObject; m; m = *baseObject = m->d.superdata) { - const QMetaObject *const m = *baseObject; + for (const QMetaObject *m = *baseObject; m; m = m->d.superdata) { int i = (MethodType == MethodSignal && priv(m->d.data)->revision >= 4) ? (priv(m->d.data)->signalCount - 1) : (priv(m->d.data)->methodCount - 1); - if (i < 0) - continue; - const int end = (MethodType == MethodSlot && priv(m->d.data)->revision >= 4) ? (priv(m->d.data)->signalCount) : 0; if (!normalizeStringData) { for (; i >= end; --i) { - if ((MethodType == 0 || (m->d.data[priv(m->d.data)->methodData + 5*i + 4] & MethodTypeMask) == MethodType) - && strcmp(method, m->d.stringdata + m->d.data[priv(m->d.data)->methodData + 5*i]) == 0) + const char *stringdata = m->d.stringdata + m->d.data[priv(m->d.data)->methodData + 5*i]; + if (method[0] == stringdata[0] && strcmp(method + 1, stringdata + 1) == 0) { + *baseObject = m; return i; + } } } else if (priv(m->d.data)->revision < 5) { - const char *stringdata = (m->d.stringdata + m->d.data[priv(m->d.data)->methodData + 5 * i]); - const QByteArray normalizedSignature = QMetaObject::normalizedSignature(stringdata); for (; i >= end; --i) { - if ((MethodType == 0|| (m->d.data[priv(m->d.data)->methodData + 5*i + 4] & MethodTypeMask) == MethodType) - && normalizedSignature == method) + const char *stringdata = (m->d.stringdata + m->d.data[priv(m->d.data)->methodData + 5 * i]); + const QByteArray normalizedSignature = QMetaObject::normalizedSignature(stringdata); + if (normalizedSignature == method) { + *baseObject = m; return i; + } } } } @@ -537,8 +536,8 @@ int QMetaObject::indexOfConstructor(const char *constructor) const if (priv(d.data)->revision < 2) return -1; for (int i = priv(d.data)->constructorCount-1; i >= 0; --i) { - if (strcmp(constructor, d.stringdata - + d.data[priv(d.data)->constructorData + 5*i]) == 0) { + const char *data = d.stringdata + d.data[priv(d.data)->constructorData + 5*i]; + if (data[0] == constructor[0] && strcmp(constructor + 1, data + 1) == 0) { return i; } } @@ -682,18 +681,19 @@ static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, co */ int QMetaObject::indexOfEnumerator(const char *name) const { - int i = -1; const QMetaObject *m = this; - while (m && i < 0) { - for (i = priv(m->d.data)->enumeratorCount-1; i >= 0; --i) - if (strcmp(name, m->d.stringdata - + m->d.data[priv(m->d.data)->enumeratorData + 4*i]) == 0) { + while (m) { + const QMetaObjectPrivate *d = priv(m->d.data); + for (int i = d->enumeratorCount - 1; i >= 0; --i) { + const char *prop = m->d.stringdata + m->d.data[d->enumeratorData + 4*i]; + if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) { i += m->enumeratorOffset(); - break; + return i; } + } m = m->d.superdata; } - return i; + return -1; } /*! @@ -704,26 +704,27 @@ int QMetaObject::indexOfEnumerator(const char *name) const */ int QMetaObject::indexOfProperty(const char *name) const { - int i = -1; const QMetaObject *m = this; - while (m && i < 0) { - for (i = priv(m->d.data)->propertyCount-1; i >= 0; --i) - if (strcmp(name, m->d.stringdata - + m->d.data[priv(m->d.data)->propertyData + 3*i]) == 0) { + while (m) { + const QMetaObjectPrivate *d = priv(m->d.data); + for (int i = d->propertyCount-1; i >= 0; --i) { + const char *prop = m->d.stringdata + m->d.data[d->propertyData + 3*i]; + if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) { i += m->propertyOffset(); - break; + return i; } + } m = m->d.superdata; } - if (i == -1 && priv(this->d.data)->revision >= 3 && (priv(this->d.data)->flags & DynamicMetaObject)){ + if (priv(this->d.data)->revision >= 3 && (priv(this->d.data)->flags & DynamicMetaObject)) { QAbstractDynamicMetaObject *me = const_cast<QAbstractDynamicMetaObject *>(static_cast<const QAbstractDynamicMetaObject *>(this)); - i = me->createProperty(name, 0); + return me->createProperty(name, 0); } - return i; + return -1; } /*! diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 7d1e1d3..ca54c6c 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -412,12 +412,12 @@ bool QTranslator::load(const QString & filename, const QString & directory, realname = prefix + fname + (suffix.isNull() ? QString::fromLatin1(".qm") : suffix); fi.setFile(realname); - if (fi.isReadable()) + if (fi.isReadable() && fi.isFile()) break; realname = prefix + fname; fi.setFile(realname); - if (fi.isReadable()) + if (fi.isReadable() && fi.isFile()) break; int rightmost = 0; diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index caa47d0..c3f6783 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1274,25 +1274,11 @@ QLocale QSystemLocale::fallbackLocale() const */ QVariant QSystemLocale::query(QueryType type, QVariant /* in */) const { - switch (type) { - case MeasurementSystem: + if (type == MeasurementSystem) { return QVariant(unixGetSystemMeasurementSystem()); - case LanguageId: - case CountryId: { - QString locale = QLatin1String(envVarLocale()); - QLocale::Language lang; - QLocale::Country cntry; - getLangAndCountry(locale, lang, cntry); - if (type == LanguageId) - return lang; - if (cntry == QLocale::AnyCountry) - return fallbackLocale().country(); - return cntry; - } - default: - break; + } else { + return QVariant(); } - return QVariant(); } #elif !defined(Q_OS_SYMBIAN) @@ -1324,10 +1310,12 @@ QVariant QSystemLocale::query(QueryType /* type */, QVariant /* in */) const #endif +#ifndef QT_NO_SYSTEMLOCALE static QSystemLocale *_systemLocale = 0; Q_GLOBAL_STATIC_WITH_ARGS(QSystemLocale, QSystemLocale_globalSystemLocale, (true)) static QLocalePrivate *system_lp = 0; Q_GLOBAL_STATIC(QLocalePrivate, globalLocalePrivate) +#endif /****************************************************************************** ** Default system locale behavior @@ -1400,8 +1388,7 @@ QSystemLocale::QSystemLocale() /*! \internal */ QSystemLocale::QSystemLocale(bool) -{ -} +{ } /*! Deletes the object. @@ -1423,42 +1410,16 @@ static const QSystemLocale *systemLocale() return QSystemLocale_globalSystemLocale(); } -static const QLocalePrivate *maybeSystemPrivate(); -bool QLocalePrivate::isUninitializedSystemLocale() const -{ - return this == maybeSystemPrivate() && m_language_id == 0; -} - -QVariant QLocalePrivate::querySystemLocale(int type, const QVariant &in) const -{ - QVariant res = systemLocale()->query(QSystemLocale::QueryType(type), in); - if (res.isNull() && isUninitializedSystemLocale()) { - // if we were not able to get data from the system, initialize the - // system locale private data (which is essentially equals to this) - // with a fallback locale. - QLocalePrivate *system_private = globalLocalePrivate(); - *system_private = *systemLocale()->fallbackLocale().d(); - // internal cache is not initialized with values from the system, mark - // it as not fully initialized system locale. - system_private->m_language_id = 0; - } - return res; -} - -// retrieves data from the system locale and caches them locally. void QLocalePrivate::updateSystemPrivate() { const QSystemLocale *sys_locale = systemLocale(); if (!system_lp) - return; - - // copy over the information from the fallback locale and modify + system_lp = globalLocalePrivate(); *system_lp = *sys_locale->fallbackLocale().d(); QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant()); if (!res.isNull()) system_lp->m_language_id = res.toInt(); - res = sys_locale->query(QSystemLocale::CountryId, QVariant()); if (!res.isNull()) system_lp->m_country_id = res.toInt(); @@ -1485,29 +1446,19 @@ void QLocalePrivate::updateSystemPrivate() } #endif -// returns the private data for the system locale. Cached data will not be -// initialized until the updateSystemPrivate is called. static const QLocalePrivate *systemPrivate() { #ifndef QT_NO_SYSTEMLOCALE - if (!system_lp) { - system_lp = globalLocalePrivate(); - // mark the locale as uninitialized system locale - system_lp->m_language_id = 0; - } + // copy over the information from the fallback locale and modify + if (!system_lp || system_lp->m_language_id == 0) + QLocalePrivate::updateSystemPrivate(); + return system_lp; #else return locale_data; #endif } -#ifndef QT_NO_SYSTEMLOCALE -static const QLocalePrivate *maybeSystemPrivate() -{ - return system_lp; -} -#endif - static const QLocalePrivate *defaultPrivate() { if (!default_lp) @@ -2386,12 +2337,7 @@ void QLocale::setDefault(const QLocale &locale) */ QLocale::Language QLocale::language() const { - const QLocalePrivate *dd = d(); -#ifndef QT_NO_SYSTEMLOCALE - if (dd->isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif - return Language(dd->languageId()); + return Language(d()->languageId()); } /*! @@ -2401,12 +2347,7 @@ QLocale::Language QLocale::language() const */ QLocale::Country QLocale::country() const { - const QLocalePrivate *dd = d(); -#ifndef QT_NO_SYSTEMLOCALE - if (dd->isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif - return Country(dd->countryId()); + return Country(d()->countryId()); } /*! @@ -2744,8 +2685,8 @@ QString QLocale::toString(const QDate &date, FormatType format) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(format == LongFormat + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(format == LongFormat ? QSystemLocale::DateToStringLong : QSystemLocale::DateToStringShort, date); if (!res.isNull()) @@ -2839,8 +2780,8 @@ QString QLocale::toString(const QDateTime &dateTime, FormatType format) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(format == LongFormat + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(format == LongFormat ? QSystemLocale::DateTimeToStringLong : QSystemLocale::DateTimeToStringShort, dateTime); @@ -2865,8 +2806,8 @@ QString QLocale::toString(const QTime &time, FormatType format) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(format == LongFormat + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(format == LongFormat ? QSystemLocale::TimeToStringLong : QSystemLocale::TimeToStringShort, time); if (!res.isNull()) @@ -2892,8 +2833,8 @@ QString QLocale::toString(const QTime &time, FormatType format) const QString QLocale::dateFormat(FormatType format) const { #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(format == LongFormat + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(format == LongFormat ? QSystemLocale::DateFormatLong : QSystemLocale::DateFormatShort, QVariant()); if (!res.isNull()) @@ -2929,8 +2870,8 @@ QString QLocale::dateFormat(FormatType format) const QString QLocale::timeFormat(FormatType format) const { #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(format == LongFormat + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(format == LongFormat ? QSystemLocale::TimeFormatLong : QSystemLocale::TimeFormatShort, QVariant()); if (!res.isNull()) @@ -2966,8 +2907,8 @@ QString QLocale::timeFormat(FormatType format) const QString QLocale::dateTimeFormat(FormatType format) const { #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(format == LongFormat + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(format == LongFormat ? QSystemLocale::DateTimeFormatLong : QSystemLocale::DateTimeFormatShort, QVariant()); @@ -3134,12 +3075,7 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format) cons */ QChar QLocale::decimalPoint() const { - const QLocalePrivate *dd = d(); -#ifndef QT_NO_SYSTEMLOCALE - if (dd->isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif - return dd->decimal(); + return d()->decimal(); } /*! @@ -3149,12 +3085,7 @@ QChar QLocale::decimalPoint() const */ QChar QLocale::groupSeparator() const { - const QLocalePrivate *dd = d(); -#ifndef QT_NO_SYSTEMLOCALE - if (dd->isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif - return dd->group(); + return d()->group(); } /*! @@ -3164,12 +3095,7 @@ QChar QLocale::groupSeparator() const */ QChar QLocale::percent() const { - const QLocalePrivate *dd = d(); -#ifndef QT_NO_SYSTEMLOCALE - if (dd->isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif - return dd->percent(); + return d()->percent(); } /*! @@ -3179,12 +3105,7 @@ QChar QLocale::percent() const */ QChar QLocale::zeroDigit() const { - const QLocalePrivate *dd = d(); -#ifndef QT_NO_SYSTEMLOCALE - if (dd->isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif - return dd->zero(); + return d()->zero(); } /*! @@ -3194,12 +3115,7 @@ QChar QLocale::zeroDigit() const */ QChar QLocale::negativeSign() const { - const QLocalePrivate *dd = d(); -#ifndef QT_NO_SYSTEMLOCALE - if (dd->isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif - return dd->minus(); + return d()->minus(); } /*! @@ -3209,12 +3125,7 @@ QChar QLocale::negativeSign() const */ QChar QLocale::positiveSign() const { - const QLocalePrivate *dd = d(); -#ifndef QT_NO_SYSTEMLOCALE - if (dd->isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif - return dd->plus(); + return d()->plus(); } /*! @@ -3224,12 +3135,7 @@ QChar QLocale::positiveSign() const */ QChar QLocale::exponential() const { - const QLocalePrivate *dd = d(); -#ifndef QT_NO_SYSTEMLOCALE - if (dd->isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif - return dd->exponential(); + return d()->exponential(); } static bool qIsUpper(char c) @@ -3348,8 +3254,8 @@ QString QLocale::monthName(int month, FormatType type) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(type == LongFormat + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(type == LongFormat ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort, month); if (!res.isNull()) @@ -3394,8 +3300,8 @@ QString QLocale::standaloneMonthName(int month, FormatType type) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(type == LongFormat + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(type == LongFormat ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort, month); if (!res.isNull()) @@ -3441,8 +3347,8 @@ QString QLocale::dayName(int day, FormatType type) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(type == LongFormat + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(type == LongFormat ? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort, day); if (!res.isNull()) @@ -3490,8 +3396,8 @@ QString QLocale::standaloneDayName(int day, FormatType type) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(type == LongFormat + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(type == LongFormat ? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort, day); if (!res.isNull()) @@ -3535,8 +3441,8 @@ QLocale::MeasurementSystem QLocale::measurementSystem() const bool found = false; #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(QSystemLocale::MeasurementSystem, QVariant()); + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(QSystemLocale::MeasurementSystem, QVariant()); if (!res.isNull()) { meas = MeasurementSystem(res.toInt()); found = true; @@ -3563,8 +3469,8 @@ QLocale::MeasurementSystem QLocale::measurementSystem() const QString QLocale::amText() const { #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(QSystemLocale::AMText, QVariant()); + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(QSystemLocale::AMText, QVariant()); if (!res.isNull()) return res.toString(); } @@ -3583,8 +3489,8 @@ QString QLocale::amText() const QString QLocale::pmText() const { #ifndef QT_NO_SYSTEMLOCALE - if (d() == maybeSystemPrivate()) { - QVariant res = d()->querySystemLocale(QSystemLocale::PMText, QVariant()); + if (d() == systemPrivate()) { + QVariant res = systemLocale()->query(QSystemLocale::PMText, QVariant()); if (!res.isNull()) return res.toString(); } @@ -3999,10 +3905,6 @@ QString QLocalePrivate::doubleToString(double d, int width, unsigned flags) const { -#ifndef QT_NO_SYSTEMLOCALE - if (isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif if (precision == -1) precision = 6; if (width == -1) @@ -4153,10 +4055,6 @@ QString QLocalePrivate::longLongToString(qlonglong l, int precision, int base, int width, unsigned flags) const { -#ifndef QT_NO_SYSTEMLOCALE - if (isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif bool precision_not_specified = false; if (precision == -1) { precision_not_specified = true; @@ -4242,10 +4140,6 @@ QString QLocalePrivate::unsLongLongToString(qulonglong l, int precision, int base, int width, unsigned flags) const { -#ifndef QT_NO_SYSTEMLOCALE - if (isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif bool precision_not_specified = false; if (precision == -1) { precision_not_specified = true; @@ -4448,10 +4342,6 @@ bool QLocalePrivate::numberToCLocale(const QString &num, bool QLocalePrivate::validateChars(const QString &str, NumberMode numMode, QByteArray *buff, int decDigits) const { -#ifndef QT_NO_SYSTEMLOCALE - if (isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif buff->clear(); buff->reserve(str.length()); @@ -4545,10 +4435,6 @@ bool QLocalePrivate::validateChars(const QString &str, NumberMode numMode, QByte double QLocalePrivate::stringToDouble(const QString &number, bool *ok, GroupSeparatorMode group_sep_mode) const { -#ifndef QT_NO_SYSTEMLOCALE - if (isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif CharBuff buff; if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)) { @@ -4562,10 +4448,6 @@ double QLocalePrivate::stringToDouble(const QString &number, bool *ok, qlonglong QLocalePrivate::stringToLongLong(const QString &number, int base, bool *ok, GroupSeparatorMode group_sep_mode) const { -#ifndef QT_NO_SYSTEMLOCALE - if (isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif CharBuff buff; if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)) { @@ -4580,10 +4462,6 @@ qlonglong QLocalePrivate::stringToLongLong(const QString &number, int base, qulonglong QLocalePrivate::stringToUnsLongLong(const QString &number, int base, bool *ok, GroupSeparatorMode group_sep_mode) const { -#ifndef QT_NO_SYSTEMLOCALE - if (isUninitializedSystemLocale()) - QLocalePrivate::updateSystemPrivate(); -#endif CharBuff buff; if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)) { diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 3b4e9dc..ac05c86 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -691,7 +691,6 @@ public: ; private: friend struct QLocalePrivate; - // ### We now use this field to pack an index into locale_data and NumberOptions. // ### Qt 5: change to a QLocaleData *d; uint numberOptions. union { diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 003ae8c..ecf79e9 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -63,14 +63,14 @@ QT_BEGIN_NAMESPACE struct Q_CORE_EXPORT QLocalePrivate { public: - QChar decimal() const { Q_ASSERT(m_decimal); return QChar(m_decimal); } - QChar group() const { Q_ASSERT(m_group); return QChar(m_group); } - QChar list() const { Q_ASSERT(m_list); return QChar(m_list); } - QChar percent() const { Q_ASSERT(m_percent); return QChar(m_percent); } - QChar zero() const { Q_ASSERT(m_zero); return QChar(m_zero); } - QChar plus() const { Q_ASSERT(m_plus); return QChar(m_plus); } - QChar minus() const { Q_ASSERT(m_minus); return QChar(m_minus); } - QChar exponential() const { Q_ASSERT(m_exponential); return QChar(m_exponential); } + QChar decimal() const { return QChar(m_decimal); } + QChar group() const { return QChar(m_group); } + QChar list() const { return QChar(m_list); } + QChar percent() const { return QChar(m_percent); } + QChar zero() const { return QChar(m_zero); } + QChar plus() const { return QChar(m_plus); } + QChar minus() const { return QChar(m_minus); } + QChar exponential() const { return QChar(m_exponential); } quint32 languageId() const { return m_language_id; } quint32 countryId() const { return m_country_id; } @@ -132,8 +132,6 @@ public: CharBuff *result) const; inline char digitToCLocale(const QChar &c) const; - inline bool isUninitializedSystemLocale() const; - QVariant querySystemLocale(int type, const QVariant &in) const; static void updateSystemPrivate(); enum NumberMode { IntegerMode, DoubleStandardMode, DoubleScientificMode }; diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index 58e3ba8..01f56cc 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -133,7 +133,7 @@ static const symbianToISO symbian_to_iso_list[] = { { ELangMalay, "ms_MY" }, { ELangBrazilianPortuguese, "pt_BR" }, { ELangRomanian, "ro_RO" }, - { ELangSerbian, "sr_YU" }, + { ELangSerbian, "sr_RS" }, { ELangLatinAmericanSpanish, "es" }, { ELangUkrainian, "uk_UA" }, { ELangUrdu, "ur_PK" }, // India/Pakistan diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 464e77b..2f12b80 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -5104,8 +5104,19 @@ QString &QString::vsprintf(const char* cformat, va_list ap) const char *c = cformat; for (;;) { // Copy non-escape chars to result +#ifndef QT_NO_TEXTCODEC + int i = 0; + while (*(c + i) != '\0' && *(c + i) != '%') + ++i; + if (codecForCStrings) + result.append(codecForCStrings->toUnicode(c, i)); + else + result.append(fromLatin1(c, i)); + c += i; +#else while (*c != '\0' && *c != '%') result.append(QLatin1Char(*c++)); +#endif if (*c == '\0') break; diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index 1ebbaee..d19e5a5 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -74,7 +74,7 @@ public: Here is a Flipable that flips whenever it is clicked: - \snippet examples/declarative/flipable/flipable.qml 0 + \snippet examples/declarative/flipable/flipable-example.qml 0 \image flipable.gif diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 4ba80ad..0bc4b8b 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1264,22 +1264,22 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec */ /*! - \fn void QDeclarativeItem::childrenRectChanged() + \fn void QDeclarativeItem::childrenRectChanged(const QRectF &) \internal */ /*! - \fn void QDeclarativeItem::baselineOffsetChanged() + \fn void QDeclarativeItem::baselineOffsetChanged(qreal) \internal */ /*! - \fn void QDeclarativeItem::widthChanged() + \fn void QDeclarativeItem::widthChanged(qreal) \internal */ /*! - \fn void QDeclarativeItem::heightChanged() + \fn void QDeclarativeItem::heightChanged(qreal) \internal */ @@ -1289,17 +1289,17 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec */ /*! - \fn void QDeclarativeItem::parentChanged() + \fn void QDeclarativeItem::parentChanged(QDeclarativeItem *) \internal */ /*! - \fn void QDeclarativeItem::smoothChanged() + \fn void QDeclarativeItem::smoothChanged(bool) \internal */ /*! - \fn void QDeclarativeItem::clipChanged() + \fn void QDeclarativeItem::clipChanged(bool) \internal */ @@ -1313,12 +1313,12 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec */ /*! - \fn void QDeclarativeItem::focusChanged() + \fn void QDeclarativeItem::focusChanged(bool) \internal */ /*! - \fn void QDeclarativeItem::wantsFocusChanged() + \fn void QDeclarativeItem::wantsFocusChanged(bool) \internal */ diff --git a/src/declarative/qml/qdeclarativecompiledbindings_p.h b/src/declarative/qml/qdeclarativecompiledbindings_p.h index 84a5df9..8776c08 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings_p.h +++ b/src/declarative/qml/qdeclarativecompiledbindings_p.h @@ -60,7 +60,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QDeclarativeBindingCompilerPrivate; +struct QDeclarativeBindingCompilerPrivate; class QDeclarativeBindingCompiler { public: diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 64d46d5..a47e868 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2094,7 +2094,7 @@ bool QDeclarativeCompiler::buildPropertyOnAssignment(QDeclarativeParser::Propert buildDynamicMeta(baseObj, ForceCreation); v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor; } else { - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","\"%1\" cannot operate on \"%2\"").arg(QLatin1String(v->object->typeName.constData())).arg(QLatin1String(prop->name.constData()))); + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","\"%1\" cannot operate on \"%2\"").arg(QString::fromUtf8(v->object->typeName)).arg(QString::fromUtf8(prop->name.constData()))); } return true; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 800434a..1a40857 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -116,16 +116,16 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(qmlImportTrace, QML_IMPORT_TRACE) /*! - \qmlclass QtObject QObject + \qmlclass QtObject QObject \since 4.7 - \brief The QtObject element is the most basic element in QML + \brief The QtObject element is the most basic element in QML - The QtObject element is a non-visual element which contains only - the objectName property. It is useful for when you need an extremely - lightweight element to place your own custom properties in. + The QtObject element is a non-visual element which contains only the + objectName property. It is useful for when you need an extremely + lightweight element to place your own custom properties in. - It can also be useful for C++ integration, as it is just a plain QObject. See - the QObject documentation for further details. + It can also be useful for C++ integration, as it is just a plain + QObject. See the QObject documentation for further details. */ /*! \qmlproperty string QtObject::objectName @@ -374,37 +374,38 @@ QDeclarativeWorkerScriptEngine *QDeclarativeEnginePrivate::getWorkerScriptEngine } /*! - \class QDeclarativeEngine + \class QDeclarativeEngine \since 4.7 - \brief The QDeclarativeEngine class provides an environment for instantiating QML components. - \mainclass - - Each QML component is instantiated in a QDeclarativeContext. QDeclarativeContext's are - essential for passing data to QML components. In QML, contexts are arranged - hierarchically and this hierarchy is managed by the QDeclarativeEngine. - - Prior to creating any QML components, an application must have created a - QDeclarativeEngine to gain access to a QML context. The following example shows how - to create a simple Text item. - - \code - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nText { text: \"Hello world!\" }", QUrl()); - QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(component.create()); - - //add item to view, etc - ... - \endcode - - In this case, the Text item will be created in the engine's - \l {QDeclarativeEngine::rootContext()}{root context}. - - \sa QDeclarativeComponent QDeclarativeContext + \brief The QDeclarativeEngine class provides an environment for instantiating QML components. + \mainclass + + Each QML component is instantiated in a QDeclarativeContext. + QDeclarativeContext's are essential for passing data to QML + components. In QML, contexts are arranged hierarchically and this + hierarchy is managed by the QDeclarativeEngine. + + Prior to creating any QML components, an application must have + created a QDeclarativeEngine to gain access to a QML context. The + following example shows how to create a simple Text item. + + \code + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6\nText { text: \"Hello world!\" }", QUrl()); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(component.create()); + + //add item to view, etc + ... + \endcode + + In this case, the Text item will be created in the engine's + \l {QDeclarativeEngine::rootContext()}{root context}. + + \sa QDeclarativeComponent QDeclarativeContext */ /*! - Create a new QDeclarativeEngine with the given \a parent. + Create a new QDeclarativeEngine with the given \a parent. */ QDeclarativeEngine::QDeclarativeEngine(QObject *parent) : QObject(*new QDeclarativeEnginePrivate(this), parent) @@ -414,10 +415,11 @@ QDeclarativeEngine::QDeclarativeEngine(QObject *parent) } /*! - Destroys the QDeclarativeEngine. + Destroys the QDeclarativeEngine. - Any QDeclarativeContext's created on this engine will be invalidated, but not - destroyed (unless they are parented to the QDeclarativeEngine object). + Any QDeclarativeContext's created on this engine will be + invalidated, but not destroyed (unless they are parented to the + QDeclarativeEngine object). */ QDeclarativeEngine::~QDeclarativeEngine() { @@ -433,8 +435,9 @@ QDeclarativeEngine::~QDeclarativeEngine() /*! Clears the engine's internal component cache. - Normally the QDeclarativeEngine caches components loaded from qml files. This method - clears this cache and forces the component to be reloaded. + Normally the QDeclarativeEngine caches components loaded from qml + files. This method clears this cache and forces the component to be + reloaded. */ void QDeclarativeEngine::clearComponentCache() { @@ -443,14 +446,15 @@ void QDeclarativeEngine::clearComponentCache() } /*! - Returns the engine's root context. + Returns the engine's root context. - The root context is automatically created by the QDeclarativeEngine. Data that - should be available to all QML component instances instantiated by the - engine should be put in the root context. + The root context is automatically created by the QDeclarativeEngine. + Data that should be available to all QML component instances + instantiated by the engine should be put in the root context. - Additional data that should only be available to a subset of component - instances should be added to sub-contexts parented to the root context. + Additional data that should only be available to a subset of + component instances should be added to sub-contexts parented to the + root context. */ QDeclarativeContext *QDeclarativeEngine::rootContext() { @@ -459,14 +463,14 @@ QDeclarativeContext *QDeclarativeEngine::rootContext() } /*! - Sets the \a factory to use for creating QNetworkAccessManager(s). + Sets the \a factory to use for creating QNetworkAccessManager(s). - QNetworkAccessManager is used for all network access by QML. - By implementing a factory it is possible to create custom - QNetworkAccessManager with specialized caching, proxy and - cookie support. + QNetworkAccessManager is used for all network access by QML. By + implementing a factory it is possible to create custom + QNetworkAccessManager with specialized caching, proxy and cookie + support. - The factory must be set before exceuting the engine. + The factory must be set before exceuting the engine. */ void QDeclarativeEngine::setNetworkAccessManagerFactory(QDeclarativeNetworkAccessManagerFactory *factory) { @@ -476,9 +480,9 @@ void QDeclarativeEngine::setNetworkAccessManagerFactory(QDeclarativeNetworkAcces } /*! - Returns the current QDeclarativeNetworkAccessManagerFactory. + Returns the current QDeclarativeNetworkAccessManagerFactory. - \sa setNetworkAccessManagerFactory() + \sa setNetworkAccessManagerFactory() */ QDeclarativeNetworkAccessManagerFactory *QDeclarativeEngine::networkAccessManagerFactory() const { @@ -508,15 +512,16 @@ QNetworkAccessManager *QDeclarativeEnginePrivate::getNetworkAccessManager() cons } /*! - Returns a common QNetworkAccessManager which can be used by any QML element - instantiated by this engine. + Returns a common QNetworkAccessManager which can be used by any QML + element instantiated by this engine. - If a QDeclarativeNetworkAccessManagerFactory has been set and a QNetworkAccessManager - has not yet been created, the QDeclarativeNetworkAccessManagerFactory will be used - to create the QNetworkAccessManager; otherwise the returned QNetworkAccessManager - will have no proxy or cache set. + If a QDeclarativeNetworkAccessManagerFactory has been set and a + QNetworkAccessManager has not yet been created, the + QDeclarativeNetworkAccessManagerFactory will be used to create the + QNetworkAccessManager; otherwise the returned QNetworkAccessManager + will have no proxy or cache set. - \sa setNetworkAccessManagerFactory() + \sa setNetworkAccessManagerFactory() */ QNetworkAccessManager *QDeclarativeEngine::networkAccessManager() const { @@ -525,26 +530,27 @@ QNetworkAccessManager *QDeclarativeEngine::networkAccessManager() const } /*! - Sets the \a provider to use for images requested via the \e image: url - scheme, with host \a providerId. - QDeclarativeImageProvider allows images to be provided to QML asynchronously. - The image request will be run in a low priority thread. This allows - potentially costly image loading to be done in the background, without - affecting the performance of the UI. + Sets the \a provider to use for images requested via the \e + image: url scheme, with host \a providerId. + + QDeclarativeImageProvider allows images to be provided to QML + asynchronously. The image request will be run in a low priority + thread. This allows potentially costly image loading to be done in + the background, without affecting the performance of the UI. - Note that images loaded from a QDeclarativeImageProvider are cached by - QPixmapCache, similar to any image loaded by QML. + Note that images loaded from a QDeclarativeImageProvider are cached + by QPixmapCache, similar to any image loaded by QML. - The QDeclarativeEngine assumes ownership of the provider. + The QDeclarativeEngine assumes ownership of the provider. - This example creates a provider with id \e colors: + This example creates a provider with id \e colors: - \snippet examples/declarative/imageprovider/imageprovider.cpp 0 + \snippet examples/declarative/imageprovider/imageprovider.cpp 0 - \snippet examples/declarative/imageprovider/imageprovider.qml 0 + \snippet examples/declarative/imageprovider/imageprovider-example.qml 0 - \sa removeImageProvider() + \sa removeImageProvider() */ void QDeclarativeEngine::addImageProvider(const QString &providerId, QDeclarativeImageProvider *provider) { @@ -554,7 +560,7 @@ void QDeclarativeEngine::addImageProvider(const QString &providerId, QDeclarativ } /*! - Returns the QDeclarativeImageProvider set for \a providerId. + Returns the QDeclarativeImageProvider set for \a providerId. */ QDeclarativeImageProvider *QDeclarativeEngine::imageProvider(const QString &providerId) const { @@ -564,11 +570,11 @@ QDeclarativeImageProvider *QDeclarativeEngine::imageProvider(const QString &prov } /*! - Removes the QDeclarativeImageProvider for \a providerId. + Removes the QDeclarativeImageProvider for \a providerId. - Returns the provider if it was found; otherwise returns 0. + Returns the provider if it was found; otherwise returns 0. - \sa addImageProvider() + \sa addImageProvider() */ void QDeclarativeEngine::removeImageProvider(const QString &providerId) { @@ -588,13 +594,14 @@ QImage QDeclarativeEnginePrivate::getImageFromProvider(const QUrl &url) } /*! - Return the base URL for this engine. The base URL is only used to resolve - components when a relative URL is passed to the QDeclarativeComponent constructor. + Return the base URL for this engine. The base URL is only used to + resolve components when a relative URL is passed to the + QDeclarativeComponent constructor. - If a base URL has not been explicitly set, this method returns the - application's current working directory. + If a base URL has not been explicitly set, this method returns the + application's current working directory. - \sa setBaseUrl() + \sa setBaseUrl() */ QUrl QDeclarativeEngine::baseUrl() const { @@ -607,9 +614,9 @@ QUrl QDeclarativeEngine::baseUrl() const } /*! - Set the base URL for this engine to \a url. + Set the base URL for this engine to \a url. - \sa baseUrl() + \sa baseUrl() */ void QDeclarativeEngine::setBaseUrl(const QUrl &url) { @@ -618,9 +625,11 @@ void QDeclarativeEngine::setBaseUrl(const QUrl &url) } /*! - Returns the QDeclarativeContext for the \a object, or 0 if no context has been set. + Returns the QDeclarativeContext for the \a object, or 0 if no + context has been set. - When the QDeclarativeEngine instantiates a QObject, the context is set automatically. + When the QDeclarativeEngine instantiates a QObject, the context is + set automatically. */ QDeclarativeContext *QDeclarativeEngine::contextForObject(const QObject *object) { @@ -645,7 +654,8 @@ QDeclarativeContext *QDeclarativeEngine::contextForObject(const QObject *object) If the \a object already has a context, a warning is output, but the context is not changed. - When the QDeclarativeEngine instantiates a QObject, the context is set automatically. + When the QDeclarativeEngine instantiates a QObject, the context is + set automatically. */ void QDeclarativeEngine::setContextForObject(QObject *object, QDeclarativeContext *context) { @@ -663,37 +673,43 @@ void QDeclarativeEngine::setContextForObject(QObject *object, QDeclarativeContex } /*! -\enum QDeclarativeEngine::ObjectOwnership - -Ownership controls whether or not QML automatically destroys the QObject when the object -is garbage collected by the JavaScript engine. The two ownership options are: - -\list -\o CppOwnership - The object is owned by C++ code, and will never be deleted by QML. The -JavaScript destroy() method cannot be used on objects with CppOwnership. This option -is similar to QScriptEngine::QtOwnership. - -\o JavaScriptOwnership - The object is owned by JavaScript. When the object is returned to QML -as the return value of a method call or property access, QML will delete the object if there -are no remaining JavaScript references to it and it has no QObject::parent(). This option -is similar to QScriptEngine::ScriptOwnership. -\endlist - -Generally an application doesn't need to set an object's ownership explicitly. QML uses -a heuristic to set the default object ownership. By default, an object that is created by -QML has JavaScriptOwnership. The exception to this are the root objects created by calling -QDeclarativeCompnent::create() or QDeclarativeComponent::beginCreate() which have -CppOwnership by default. The ownership of these root-level objects is considered to have -been transfered to the C++ caller. - -Objects not-created by QML have CppOwnership by default. The exception to this is objects -returned from a C++ method call. The ownership of these objects is passed to JavaScript. - -Calling setObjectOwnership() overrides the default ownership heuristic used by QML. + \enum QDeclarativeEngine::ObjectOwnership + + Ownership controls whether or not QML automatically destroys the + QObject when the object is garbage collected by the JavaScript + engine. The two ownership options are: + + \value CppOwnership The object is owned by C++ code, and will + never be deleted by QML. The JavaScript destroy() method cannot be + used on objects with CppOwnership. This option is similar to + QScriptEngine::QtOwnership. + + \value JavaScriptOwnership The object is owned by JavaScript. + When the object is returned to QML as the return value of a method + call or property access, QML will delete the object if there are no + remaining JavaScript references to it and it has no + QObject::parent(). This option is similar to + QScriptEngine::ScriptOwnership. + + Generally an application doesn't need to set an object's ownership + explicitly. QML uses a heuristic to set the default object + ownership. By default, an object that is created by QML has + JavaScriptOwnership. The exception to this are the root objects + created by calling QDeclarativeCompnent::create() or + QDeclarativeComponent::beginCreate() which have CppOwnership by + default. The ownership of these root-level objects is considered to + have been transfered to the C++ caller. + + Objects not-created by QML have CppOwnership by default. The + exception to this is objects returned from a C++ method call. The + ownership of these objects is passed to JavaScript. + + Calling setObjectOwnership() overrides the default ownership + heuristic used by QML. */ /*! -Sets the \a ownership of \a object. + Sets the \a ownership of \a object. */ void QDeclarativeEngine::setObjectOwnership(QObject *object, ObjectOwnership ownership) { @@ -706,7 +722,7 @@ void QDeclarativeEngine::setObjectOwnership(QObject *object, ObjectOwnership own } /*! -Returns the ownership of \a object. + Returns the ownership of \a object. */ QDeclarativeEngine::ObjectOwnership QDeclarativeEngine::objectOwnership(QObject *object) { diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h index 1a36f10..d41323d 100644 --- a/src/declarative/qml/qdeclarativemetatype_p.h +++ b/src/declarative/qml/qdeclarativemetatype_p.h @@ -136,7 +136,7 @@ public: int index() const; private: friend class QDeclarativeTypePrivate; - friend class QDeclarativeMetaTypeData; + friend struct QDeclarativeMetaTypeData; friend int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterInterface &); friend int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterType &); QDeclarativeType(int, const QDeclarativePrivate::RegisterInterface &); diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index ddf00ea..f455870 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -62,8 +62,7 @@ HEADERS += \ $$PWD/qdeclarativebehavior_p.h \ $$PWD/qdeclarativefontloader_p.h \ $$PWD/qdeclarativestyledtext_p.h \ - $$PWD/qdeclarativelistmodelworkeragent_p.h \ - $$PWD/qdeclarativelistmodelworkeragent_p_p.h + $$PWD/qdeclarativelistmodelworkeragent_p.h contains(QT_CONFIG, xmlpatterns) { QT+=xmlpatterns diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h index fe01587..5f3b6c2 100644 --- a/src/gui/dialogs/qwizard_win_p.h +++ b/src/gui/dialogs/qwizard_win_p.h @@ -82,7 +82,6 @@ class QWizard; class QVistaHelper : public QObject { - Q_OBJECT public: QVistaHelper(QWizard *wizard); ~QVistaHelper(); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 3c255ef..948ff28 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3482,7 +3482,7 @@ void QGraphicsItem::setX(qreal x) if (qIsNaN(x)) return; - d_ptr->setPosHelper(QPointF(x, d_ptr->pos.y())); + setPos(QPointF(x, d_ptr->pos.y())); } /*! @@ -3509,7 +3509,7 @@ void QGraphicsItem::setY(qreal y) if (qIsNaN(y)) return; - d_ptr->setPosHelper(QPointF(d_ptr->pos.x(), y)); + setPos(QPointF(d_ptr->pos.x(), y)); } /*! @@ -3577,7 +3577,7 @@ void QGraphicsItem::setPos(const QPointF &pos) return; // Update and repositition. - if (!(d_ptr->flags & ItemSendsGeometryChanges)) { + if (!(d_ptr->flags & ItemSendsGeometryChanges) && !(d_ptr->flags & ItemSendsScenePositionChanges)) { d_ptr->setPosHelper(pos); return; } @@ -10936,7 +10936,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP // Item coordinates with info. QTransform newEffectTransform = info->transformPtr->inverted(); newEffectTransform *= effectTransform; - scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, info->exposedRegion, + scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0, info->widget, info->opacity, &newEffectTransform, info->wasDirtySceneTransform, info->drawItem); } diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index bcdc7d3..29a4be8 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4721,7 +4721,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) { ENSURE_TRANSFORM_PTR; QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp, - painter, opacity, wasDirtyParentSceneTransform, drawItem); + painter, opacity, wasDirtyParentSceneTransform, itemHasContents && !itemIsFullyTransparent); QGraphicsEffectSource *source = item->d_ptr->graphicsEffect->d_func()->source; QGraphicsItemEffectSourcePrivate *sourced = static_cast<QGraphicsItemEffectSourcePrivate *> (source->d_func()); diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 669dd61..a257e0d 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -396,6 +396,12 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) } /*! + \fn QGraphicsWidget::geometryChanged() + + This signal gets emitted whenever the geometry is changed in setGeometry(). +*/ + +/*! \fn QRectF QGraphicsWidget::rect() const Returns the item's local rect as a QRectF. This function is equivalent diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index d7ddf4e..97fd6e1 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -104,9 +104,10 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate() horizontalScrollMode(QAbstractItemView::ScrollPerItem), currentIndexSet(false), wrapItemText(false), - delayedPendingLayout(true) + delayedPendingLayout(true), moveCursorUpdatedView(false) { + keyboardInputTime.invalidate(); } QAbstractItemViewPrivate::~QAbstractItemViewPrivate() @@ -2842,17 +2843,16 @@ void QAbstractItemView::keyboardSearch(const QString &search) QModelIndex start = currentIndex().isValid() ? currentIndex() : d->model->index(0, 0, d->root); - QElapsedTimer now; - now.start(); bool skipRow = false; - if (search.isEmpty() - || (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) { + bool keyboardTimeWasValid = d->keyboardInputTime.isValid(); + qint64 keyboardInputTimeElapsed = d->keyboardInputTime.restart(); + if (search.isEmpty() || !keyboardTimeWasValid + || keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) { d->keyboardInput = search; skipRow = currentIndex().isValid(); //if it is not valid we should really start at QModelIndex(0,0) } else { d->keyboardInput += search; } - d->keyboardInputTime = now; // special case for searches with same key like 'aaaaa' bool sameKey = false; diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index b2457f3..d934683 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -674,15 +674,19 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto // refresh the height cache here; we don't really lose anything by getting the size hint, // since QAbstractItemView::dataChanged() will get the visualRect for the items anyway - int topViewIndex = d->viewIndex(topLeft); - if (topViewIndex == 0) - d->defaultItemHeight = indexRowSizeHint(topLeft); bool sizeChanged = false; + int topViewIndex = d->viewIndex(topLeft); + if (topViewIndex == 0) { + int newDefaultItemHeight = indexRowSizeHint(topLeft); + sizeChanged = d->defaultItemHeight != newDefaultItemHeight; + d->defaultItemHeight = newDefaultItemHeight; + } + if (topViewIndex != -1) { if (topLeft.row() == bottomRight.row()) { int oldHeight = d->itemHeight(topViewIndex); d->invalidateHeightCache(topViewIndex); - sizeChanged = (oldHeight != d->itemHeight(topViewIndex)); + sizeChanged |= (oldHeight != d->itemHeight(topViewIndex)); if (topLeft.column() == 0) d->viewItems[topViewIndex].hasChildren = d->hasVisibleChildren(topLeft); } else { @@ -958,17 +962,16 @@ void QTreeView::keyboardSearch(const QString &search) else start = d->model->index(0, 0, d->root); - QElapsedTimer now; - now.start(); bool skipRow = false; - if (search.isEmpty() - || (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) { + bool keyboardTimeWasValid = d->keyboardInputTime.isValid(); + qint64 keyboardInputTimeElapsed = d->keyboardInputTime.restart(); + if (search.isEmpty() || !keyboardTimeWasValid + || keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) { d->keyboardInput = search; - skipRow = true; + skipRow = currentIndex().isValid(); //if it is not valid we should really start at QModelIndex(0,0) } else { d->keyboardInput += search; } - d->keyboardInputTime = now; // special case for searches with same key like 'aaaaa' bool sameKey = false; diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index ae9b34c..1d8eb4c 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1578,6 +1578,10 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: case WM_XBUTTONDOWN: + case WM_LBUTTONDBLCLK: + case WM_RBUTTONDBLCLK: + case WM_MBUTTONDBLCLK: + case WM_XBUTTONDBLCLK: if (qt_win_ignoreNextMouseReleaseEvent) qt_win_ignoreNextMouseReleaseEvent = false; break; @@ -2278,7 +2282,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa case WM_GETOBJECT: { // Ignoring all requests while starting up - if (QApplication::startingUp() || QApplication::closingDown() || (DWORD)lParam != OBJID_CLIENT) { + if (QApplication::startingUp() || QApplication::closingDown() || (LONG)lParam != OBJID_CLIENT) { result = false; break; } diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 67e0865..78fc704 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -669,11 +669,6 @@ static int qt_x_errhandler(Display *dpy, XErrorEvent *err) return 0; break; - case BadMatch: - if (err->request_code == 42 /* X_SetInputFocus */) - return 0; - break; - default: #if !defined(QT_NO_XINPUT) if (err->request_code == X11->xinput_major diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp index 0742a93..a164c2a 100644 --- a/src/gui/kernel/qdnd_win.cpp +++ b/src/gui/kernel/qdnd_win.cpp @@ -524,18 +524,14 @@ QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) if (fEscapePressed) { return ResultFromScode(DRAGDROP_S_CANCEL); - } else if (!(grfKeyState & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON))) { + } else if ((GetAsyncKeyState(VK_LBUTTON) == 0) + && (GetAsyncKeyState(VK_MBUTTON) == 0) + && (GetAsyncKeyState(VK_RBUTTON) == 0)) { + // grfKeyState is broken on CE & some Windows XP versions, + // therefore we need to check the state manually return ResultFromScode(DRAGDROP_S_DROP); } else { -#if defined(Q_OS_WINCE) - // grfKeyState is broken on CE, therefore need to check - // the state manually - if ((GetAsyncKeyState(VK_LBUTTON) == 0) && - (GetAsyncKeyState(VK_MBUTTON) == 0) && - (GetAsyncKeyState(VK_RBUTTON) == 0)) { - return ResultFromScode(DRAGDROP_S_DROP); - } -#else +#if !defined(Q_OS_WINCE) if (currentButtons == Qt::NoButton) { currentButtons = keystate_to_mousebutton(grfKeyState); } else { diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index b3a6aec..ef7373c 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4067,7 +4067,8 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) QRect xrect = data.crect; QRect parentWRect; - if (q->isWindow() && topData()->embedded) { + bool isEmbeddedWindow = (q->isWindow() && topData()->embedded); + if (isEmbeddedWindow) { #ifndef QT_MAC_USE_COCOA HIViewRef parentView = HIViewGetSuperview(qt_mac_nativeview_for(q)); #else @@ -4092,7 +4093,7 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) if (parentWRect.isValid()) { // parent is clipped, and we have to clip to the same limit as parent - if (!parentWRect.contains(xrect)) { + if (!parentWRect.contains(xrect) && !isEmbeddedWindow) { xrect &= parentWRect; wrect = xrect; //translate from parent's to my Qt coord sys diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index c32e1a1..ef7ac1f 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -680,7 +680,7 @@ public: QMap<Qt::GestureType, Qt::GestureFlags> gestureContext; // Bit fields. - uint high_attributes[3]; // the low ones are in QWidget::widget_attributes + uint high_attributes[4]; // the low ones are in QWidget::widget_attributes QPalette::ColorRole fg_role : 8; QPalette::ColorRole bg_role : 8; uint dirtyOpaqueChildren : 1; diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index c1363d2..37ac6bf 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1642,7 +1642,8 @@ void QWidget::activateWindow() X11->userTime = X11->time; qt_net_update_user_time(tlw, X11->userTime); - if (X11->isSupportedByWM(ATOM(_NET_ACTIVE_WINDOW))) { + if (X11->isSupportedByWM(ATOM(_NET_ACTIVE_WINDOW)) + && !(tlw->windowFlags() & Qt::X11BypassWindowManagerHint)) { XEvent e; e.xclient.type = ClientMessage; e.xclient.message_type = ATOM(_NET_ACTIVE_WINDOW); @@ -1660,7 +1661,8 @@ void QWidget::activateWindow() XSendEvent(X11->display, RootWindow(X11->display, tlw->x11Info().screen()), false, SubstructureNotifyMask | SubstructureRedirectMask, &e); } else { - XSetInputFocus(X11->display, tlw->internalWinId(), XRevertToParent, X11->time); + if (!qt_widget_private(tlw)->topData()->waitingForMapNotify) + XSetInputFocus(X11->display, tlw->internalWinId(), XRevertToParent, X11->time); } } } diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 71e2e3b..1f75ec7 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -3884,8 +3884,8 @@ inline void interpolate_pixel_unaligned_2(DST *dest, const SRC *src, template <class DST, class SRC> inline void interpolate_pixel_2(DST *dest, const SRC *src, quint16 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint16 a = eff_alpha_2(alpha, dest); const quint16 ia = eff_ialpha_2(alpha, dest); @@ -3958,8 +3958,8 @@ template <class DST, class SRC> inline void interpolate_pixel_2(DST *dest, quint8 a, const SRC *src, quint8 b) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); Q_ASSERT(!SRC::hasAlpha()); @@ -4007,8 +4007,8 @@ inline void interpolate_pixel_2(qrgb444 *dest, quint8 a, template <class DST, class SRC> inline void interpolate_pixel_4(DST *dest, const SRC *src, quint32 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = eff_alpha_4(alpha, dest); const quint32 ia = eff_ialpha_4(alpha, dest); @@ -4411,7 +4411,7 @@ void QT_FASTCALL blendUntransformed_dest16(DST *dest, const SRC *src, { Q_ASSERT(sizeof(DST) == 2); Q_ASSERT(sizeof(SRC) == 2); - Q_ASSERT((long(dest) & 0x3) == (long(src) & 0x3)); + Q_ASSERT((quintptr(dest) & 0x3) == (quintptr(src) & 0x3)); Q_ASSERT(coverage > 0); const int align = quintptr(dest) & 0x3; @@ -4479,8 +4479,8 @@ void QT_FASTCALL blendUntransformed_dest16(DST *dest, const SRC *src, } while (length >= 2) { - Q_ASSERT((long(dest) & 3) == 0); - Q_ASSERT((long(src) & 3) == 0); + Q_ASSERT((quintptr(dest) & 3) == 0); + Q_ASSERT((quintptr(src) & 3) == 0); const quint16 a = alpha_2(src); if (a == 0xffff) { @@ -4511,7 +4511,7 @@ template <class DST, class SRC> void QT_FASTCALL blendUntransformed_dest24(DST *dest, const SRC *src, quint8 coverage, int length) { - Q_ASSERT((long(dest) & 0x3) == (long(src) & 0x3)); + Q_ASSERT((quintptr(dest) & 0x3) == (quintptr(src) & 0x3)); Q_ASSERT(sizeof(DST) == 3); Q_ASSERT(coverage > 0); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index db4ace4..1c528fe 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7999,7 +7999,7 @@ start_lengthVariant: for (int i = 0; i < textLayout.lineCount(); i++) { QTextLine line = textLayout.lineAt(i); - qreal advance = textLayout.engine()->lines[i].textAdvance.toReal(); + qreal advance = line.horizontalAdvance(); if (tf & Qt::AlignRight) xoff = r.width() - advance; else if (tf & Qt::AlignHCenter) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index e2de43a..bd87ca4 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -769,6 +769,8 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, GtkArrowType type = GTK_ARROW_UP; QRect r = header->rect; QImage arrow; + // This sorting indicator inversion is intentional, and follows the GNOME HIG. + // See http://library.gnome.org/devel/hig-book/stable/controls-lists.html.en#controls-lists-sortable if (header->sortIndicator & QStyleOptionHeader::SortUp) type = GTK_ARROW_UP; else if (header->sortIndicator & QStyleOptionHeader::SortDown) diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 6138e85..4a279a7 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -63,7 +63,7 @@ #include <AknUtils.h> #include <aknnavi.h> #include <gulicon.h> -#include <AknBitmapAnimation.h> +#include <aknbitmapanimation.h> #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 6c48590..60c06ca 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -497,7 +497,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW { #ifndef Q_OS_WINCE NONCLIENTMETRICS ncm; - ncm.cbSize = sizeof(NONCLIENTMETRICS); + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT); if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)) ret = qMax(ncm.iScrollHeight, ncm.iScrollWidth); else diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index f2d0654..7dc2c26 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1124,14 +1124,13 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const bool kerningEnabled = this->font(si).d->kerning; HB_ShaperItem entire_shaper_item; - entire_shaper_item.kerning_applied = false; + qMemSet(&entire_shaper_item, 0, sizeof(entire_shaper_item)); entire_shaper_item.string = reinterpret_cast<const HB_UChar16 *>(layoutData->string.constData()); entire_shaper_item.stringLength = layoutData->string.length(); entire_shaper_item.item.script = (HB_Script)si.analysis.script; entire_shaper_item.item.pos = si.position; entire_shaper_item.item.length = length(item); entire_shaper_item.item.bidiLevel = si.analysis.bidiLevel; - entire_shaper_item.glyphIndicesPresent = false; HB_UChar16 upperCased[256]; // XXX what about making this 4096, so we don't have to extend it ever. if (si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase @@ -2467,7 +2466,7 @@ void QTextEngine::splitItem(int item, int pos) const if (pos <= 0) return; - layoutData->items.insert(item + 1, QScriptItem(layoutData->items[item])); + layoutData->items.insert(item + 1, layoutData->items[item]); QScriptItem &oldItem = layoutData->items[item]; QScriptItem &newItem = layoutData->items[item+1]; newItem.position += pos; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 766053c..2fc5d1a 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1570,6 +1570,20 @@ qreal QTextLine::naturalTextWidth() const return eng->lines[i].textWidth.toReal(); } +/*! \since 4.7 + Returns the horizontal advance of the text. The advance of the text + is the distance from its position to the next position at which + text would naturally be drawn. + + By adding the advance to the position of the text line and using this + as the position of a second text line, you will be able to position + the two lines side-by-side without gaps in-between. +*/ +qreal QTextLine::horizontalAdvance() const +{ + return eng->lines[i].textAdvance.toReal(); +} + /*! Lays out the line with the given \a width. The line is filled from its starting position with as many characters as will fit into diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h index edae7de..8c93ed6 100644 --- a/src/gui/text/qtextlayout.h +++ b/src/gui/text/qtextlayout.h @@ -202,6 +202,7 @@ public: bool leadingIncluded() const; qreal naturalTextWidth() const; + qreal horizontalAdvance() const; QRectF naturalTextRect() const; enum Edge { diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index 387bf87..c095b3b 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -1110,7 +1110,7 @@ void QCompleter::setPopup(QAbstractItemView *popup) delete d->popup; if (popup->model() != d->proxy) popup->setModel(d->proxy); -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) popup->show(); #else popup->hide(); diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index d2eda80..44483ea 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -1374,7 +1374,9 @@ bool QMainWindow::event(QEvent *event) #endif // QT_NO_STATUSTIP case QEvent::StyleChange: +#ifndef QT_NO_DOCKWIDGET d->layout->layoutState.dockAreaLayout.styleChangedEvent(); +#endif if (!d->explicitIconSize) setIconSize(QSize()); break; diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index 597b28b..88b7517 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -227,6 +227,33 @@ QSize QSplitterHandle::sizeHint() const /*! \reimp */ +void QSplitterHandle::resizeEvent(QResizeEvent *event) +{ + Q_D(const QSplitterHandle); + + // When splitters are only 1 pixel large we increase the + // actual grab area to five pixels + + // Note that QSplitter uses contentsRect for layouting + // and ensures that handles are drawn on top of widgets + // We simply use the contents margins for draggin and only + // paint the mask area + bool useTinyMode = (d->s->handleWidth() == 1); + setAttribute(Qt::WA_MouseNoMask, useTinyMode); + if (useTinyMode) { + if (orientation() == Qt::Horizontal) + setContentsMargins(2, 0, 2, 0); + else + setContentsMargins(0, 2, 0, 2); + setMask(QRegion(contentsRect())); + } + + QWidget::resizeEvent(event); +} + +/*! + \reimp +*/ bool QSplitterHandle::event(QEvent *event) { Q_D(QSplitterHandle); @@ -301,7 +328,7 @@ void QSplitterHandle::paintEvent(QPaintEvent *) Q_D(QSplitterHandle); QPainter p(this); QStyleOption opt(0); - opt.rect = rect(); + opt.rect = contentsRect(); opt.palette = palette(); if (orientation() == Qt::Horizontal) opt.state = QStyle::State_Horizontal; @@ -1662,6 +1689,9 @@ void QSplitter::setSizes(const QList<int> &list) By default, this property contains a value that depends on the user's platform and style preferences. + + If you set handleWidth to 1, the actual grab area will grow to overlap a + few pixels of it's respective widgets. */ int QSplitter::handleWidth() const diff --git a/src/gui/widgets/qsplitter.h b/src/gui/widgets/qsplitter.h index a793f24..c3b304d 100644 --- a/src/gui/widgets/qsplitter.h +++ b/src/gui/widgets/qsplitter.h @@ -172,6 +172,7 @@ protected: void mouseMoveEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *); void mouseReleaseEvent(QMouseEvent *); + void resizeEvent(QResizeEvent *); bool event(QEvent *); void moveSplitter(int p); diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp index 4eb252a..f87510f 100644 --- a/src/gui/widgets/qtoolbarlayout.cpp +++ b/src/gui/widgets/qtoolbarlayout.cpp @@ -654,7 +654,11 @@ void QToolBarLayout::setExpanded(bool exp) if (!tb) return; if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) { +#ifdef QT_NO_DOCKWIDGET + animating = false; +#else animating = !tb->isWindow() && win->isAnimated(); +#endif QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout()); if (expanded) { tb->raise(); diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp index dfe125f..077ed9a 100644 --- a/src/imports/multimedia/qdeclarativeaudio.cpp +++ b/src/imports/multimedia/qdeclarativeaudio.cpp @@ -142,7 +142,7 @@ void QDeclarativeAudio::stop() */ /*! - \qmlproperty url Audio:autoLoad + \qmlproperty url Audio::autoLoad This property indicates if loading of media should begin immediately. diff --git a/src/imports/multimedia/qdeclarativevideo.cpp b/src/imports/multimedia/qdeclarativevideo.cpp index 6aff9bd..c878fe1 100644 --- a/src/imports/multimedia/qdeclarativevideo.cpp +++ b/src/imports/multimedia/qdeclarativevideo.cpp @@ -116,7 +116,7 @@ QDeclarativeVideo::~QDeclarativeVideo() */ /*! - \qmlproperty url Audio:autoLoad + \qmlproperty url Video::autoLoad This property indicates if loading of media should begin immediately. diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp index 465a1e7..e9d30d0 100644 --- a/src/multimedia/video/qabstractvideobuffer.cpp +++ b/src/multimedia/video/qabstractvideobuffer.cpp @@ -71,6 +71,8 @@ QT_BEGIN_NAMESPACE \value NoHandle The buffer has no handle, its data can only be accessed by mapping the buffer. \value GLTextureHandle The handle of the buffer is an OpenGL texture ID. + \value XvShmImageHandle The handle contains pointer to shared memory XVideo image. + \value CoreImageHandle The handle contains pointer to Mac OS X CIImage. \value UserHandle Start value for user defined handle types. \sa handleType() diff --git a/src/multimedia/video/qabstractvideobuffer.h b/src/multimedia/video/qabstractvideobuffer.h index 4ffa46f..a8389db 100644 --- a/src/multimedia/video/qabstractvideobuffer.h +++ b/src/multimedia/video/qabstractvideobuffer.h @@ -61,6 +61,8 @@ public: { NoHandle, GLTextureHandle, + XvShmImageHandle, + CoreImageHandle, UserHandle = 1000 }; diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 1d794a2..c57c9c6 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -148,7 +148,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionNewConfigurationActivated()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) - Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State)); + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State)) }; QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 7fc0097..edd6889 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -318,11 +318,15 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const // for HTTP, we want to send out the request as fast as possible to the network, without // invoking methods in a QueuedConnection +#ifndef QT_NO_HTTP if (qobject_cast<QNetworkAccessHttpBackend *>(backend)) { _q_startOperation(); } else { QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); } +#else + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); +#endif // QT_NO_HTTP } q->QIODevice::open(QIODevice::ReadOnly); @@ -872,11 +876,15 @@ bool QNetworkReplyImplPrivate::migrateBackend() backend->setResumeOffset(bytesDownloaded); } +#ifndef QT_NO_HTTP if (qobject_cast<QNetworkAccessHttpBackend *>(backend)) { _q_startOperation(); } else { QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); } +#else + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); +#endif // QT_NO_HTTP return true; } diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 0cd5efb..1ba5dab 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -64,7 +64,7 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() \since 4.7 \inmodule QtNetwork - \ingroup bearer + \ingroup network QNetworkConfigurationManager provides access to the network configurations known to the system and enables applications to detect the system capabilities (with regards to network sessions) at runtime. diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 82669e0..4108fee 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE \since 4.7 \inmodule QtNetwork - \ingroup bearer + \ingroup network QNetworkConfiguration encapsulates a single access point or service network. In most cases a single access point configuration can be mapped to one network diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index cf9f4b2..ca21dcd 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE \since 4.7 \inmodule QtNetwork - \ingroup bearer + \ingroup network A QNetworkSession enables control over the system's network interfaces. The session's configuration parameter are determined via the QNetworkConfiguration object to which it is bound. Depending on the diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index e65c177..1f25088 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -81,7 +81,7 @@ public: InvalidConfigurationError }; - QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); + explicit QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); virtual ~QNetworkSession(); bool isOpen() const; diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp index 755f34c..223243c 100644 --- a/src/opengl/qglbuffer.cpp +++ b/src/opengl/qglbuffer.cpp @@ -388,31 +388,23 @@ void QGLBuffer::release() const #undef ctx /*! - Binds a raw \a bufferId to the specified buffer \a type - in the current QGLContext. Returns false if there is - no context current or the GL buffer extension could - not be resolved. + Releases the buffer associated with \a type in the current + QGLContext. - This function is a direct call to \c{glBindBuffer()} for - use when the caller does not have a QGLBuffer but does - have a raw \a bufferId. It can also be used to release - the current buffer when the caller does not know which - QGLBuffer object is currently bound: + This function is a direct call to \c{glBindBuffer(type, 0)} + for use when the caller does not know which QGLBuffer has + been bound to the context but wants to make sure that it + is released. \code - QGLBuffer::bind(QGLBuffer::VertexBuffer, 0); + QGLBuffer::release(QGLBuffer::VertexBuffer); \endcode */ -bool QGLBuffer::bind(QGLBuffer::Type type, uint bufferId) +void QGLBuffer::release(QGLBuffer::Type type) { const QGLContext *ctx = QGLContext::currentContext(); - if (ctx) { - if (qt_resolve_buffer_extensions(const_cast<QGLContext *>(ctx))) { - glBindBuffer(GLenum(type), GLuint(bufferId)); - return true; - } - } - return false; + if (ctx && qt_resolve_buffer_extensions(const_cast<QGLContext *>(ctx))) + glBindBuffer(GLenum(type), 0); } #define ctx d->guard.context() @@ -423,7 +415,7 @@ bool QGLBuffer::bind(QGLBuffer::Type type, uint bufferId) \sa isCreated() */ -uint QGLBuffer::bufferId() const +GLuint QGLBuffer::bufferId() const { Q_D(const QGLBuffer); return d->guard.id(); diff --git a/src/opengl/qglbuffer.h b/src/opengl/qglbuffer.h index a060733..2fe1f1f 100644 --- a/src/opengl/qglbuffer.h +++ b/src/opengl/qglbuffer.h @@ -43,6 +43,7 @@ #define QGLBUFFER_H #include <QtCore/qscopedpointer.h> +#include <QtOpenGL/qgl.h> QT_BEGIN_HEADER @@ -97,9 +98,9 @@ public: bool bind() const; void release() const; - static bool bind(QGLBuffer::Type type, uint bufferId); + static void release(QGLBuffer::Type type); - uint bufferId() const; + GLuint bufferId() const; int size() const; diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 2fe8974..02766c5 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -95,11 +95,10 @@ private: SCDynamicStoreRef storeSession; CFRunLoopSourceRef runloopSource; - bool hasWifi; protected: - QMap<QString, QMap<QString,QString> > userProfiles; + QMap<QString, QMap<QString,QString> > userProfiles; void startNetworkChangeLoop(); void getUserConfigurations(); diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index af57159..9c2cb0c 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -50,11 +50,13 @@ #include <QtCore/qstringlist.h> #include <QtCore/qdebug.h> + #include <QDir> #include <CoreWLAN/CoreWLAN.h> #include <CoreWLAN/CWInterface.h> #include <CoreWLAN/CWNetwork.h> #include <CoreWLAN/CWNetwork.h> +#include <CoreWLAN/CW8021XProfile.h> #include <Foundation/NSEnumerator.h> #include <Foundation/NSKeyValueObserving.h> @@ -194,14 +196,14 @@ void QCoreWlanEngine::connectToId(const QString &id) NSString *wantedSsid = 0; bool okToProceed = true; + if(getNetworkNameFromSsid(id) != id) { NSArray *array = [CW8021XProfile allUser8021XProfiles]; for (NSUInteger i=0; i<[array count]; ++i) { const QString idCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] userDefinedName]))); const QString idCheck2 = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] ssid]))); - if(id == idCheck - || id == idCheck2) { + if (id == idCheck || id == idCheck2) { QString thisName = getSsidFromNetworkName(id); if(thisName.isEmpty()) { wantedSsid = qt_mac_QStringToNSString(id); @@ -263,6 +265,8 @@ void QCoreWlanEngine::connectToId(const QString &id) emit connectionError(id, InterfaceLookupError); locker.relock(); } + + locker.unlock(); emit connectionError(id, OperationNotSupported); } @@ -416,7 +420,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) if (!err) { for(uint row=0; row < [apArray count]; row++ ) { - apNetwork = [apArray objectAtIndex:row]; const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]); @@ -456,7 +459,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) QString networkSsid = getSsidFromNetworkName(networkName); const QString ssidId = QString::number(qHash(QLatin1String("corewlan:") + networkSsid)); QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; - QString interfaceName; QMapIterator<QString, QString> ij(i.value()); while (ij.hasNext()) { @@ -693,7 +695,6 @@ QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name) QMapIterator<QString, QMap<QString,QString> > i(userProfiles); while (i.hasNext()) { i.next(); - QMap<QString,QString> map = i.value(); QMapIterator<QString, QString> ij(i.value()); while (ij.hasNext()) { @@ -702,7 +703,7 @@ QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name) if(name == i.key() || name == idCheck) { return ij.key(); } - } + } } return QString(); } @@ -737,7 +738,6 @@ void QCoreWlanEngine::getUserConfigurations() CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]]; NSString *nsInterfaceName = [wifiInterface name]; - // add user configured system networks SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil); NSDictionary * airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName]); diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index dfc74f2..c1de4e0 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -203,7 +203,7 @@ void QGenericEngine::doRequestUpdate() if (interface.flags() & QNetworkInterface::IsLoopBack) continue; - // ignore WLAN interface handled in seperate engine + // ignore WLAN interface handled in separate engine if (qGetInterfaceType(interface.name()) == QLatin1String("WLAN")) continue; diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index f70a209..7a4cb9d 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -335,7 +335,7 @@ void QIcdEngine::doRequestUpdate() locker.relock(); } - if (!ap.scan.network_type.startsWith("WLAN")) + if (!ap.scan.network_type.startsWith(QLatin1String("WLAN"))) continue; // not a wlan AP } } else { diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index a2ae65c..06e0529 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -391,7 +391,7 @@ quint64 QNetworkSessionPrivateImpl::getStatistics(bool sent) const return 0; } - foreach (Maemo::IcdStatisticsResult res, stats_results) { + foreach (const Maemo::IcdStatisticsResult &res, stats_results) { if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) { /* network_id is the IAP UUID */ if (QString(res.params.network_id.data()) == activeConfig.identifier()) { diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h index 048f628..ecca537 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h @@ -215,7 +215,7 @@ public: Q_DECLARE_FLAGS(ApSecurityFlags, ApSecurityFlag); - QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0); + explicit QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0); ~QNetworkManagerInterfaceAccessPoint(); QDBusInterface *connectionInterface() const; @@ -248,7 +248,7 @@ class QNetworkManagerInterfaceDevice : public QObject public: - QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = 0); + explicit QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = 0); ~QNetworkManagerInterfaceDevice(); QString udi() const; @@ -277,7 +277,8 @@ class QNetworkManagerInterfaceDeviceWired : public QObject public: - QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent = 0); + explicit QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, + QObject *parent = 0); ~QNetworkManagerInterfaceDeviceWired(); QDBusInterface *connectionInterface() const; @@ -311,7 +312,8 @@ public: Rsn = 0x20 }; - QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent = 0); + explicit QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, + QObject *parent = 0); ~QNetworkManagerInterfaceDeviceWireless(); QDBusObjectPath path() const; @@ -342,7 +344,7 @@ class QNetworkManagerSettings : public QObject public: - QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0); + explicit QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0); ~QNetworkManagerSettings(); QDBusInterface *connectionInterface() const; @@ -402,7 +404,7 @@ public: Activated = 2 }; - QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0); + explicit QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0); ~ QNetworkManagerConnectionActive(); QDBusInterface *connectionInterface() const; @@ -430,7 +432,7 @@ class QNetworkManagerIp4Config : public QObject Q_OBJECT public: - QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0); + explicit QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0); ~QNetworkManagerIp4Config(); QStringList domains() const; diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 0737942..8910efe 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -241,15 +241,24 @@ void QNetworkSessionPrivateImpl::open() // => RConnection::ProgressNotification will be used for IAP/SNAP monitoring iConnectionMonitor.CancelNotifications(); - // Configuration must be at least in Discovered - state for connecting purposes. - if ((publicConfig.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { + // Configuration may have been invalidated after session creation by platform + // (e.g. configuration has been deleted). + if (!publicConfig.isValid()) { newState(QNetworkSession::Invalid); iError = QNetworkSession::InvalidConfigurationError; emit QNetworkSessionPrivate::error(iError); syncStateWithInterface(); return; } + // If opening a (un)defined configuration, session emits error and enters + // NotAvailable -state. + if (publicConfig.state() == QNetworkConfiguration::Undefined || + publicConfig.state() == QNetworkConfiguration::Defined) { + newState(QNetworkSession::NotAvailable); + iError = QNetworkSession::InvalidConfigurationError; + emit QNetworkSessionPrivate::error(iError); + return; + } TInt error = iSocketServ.Connect(); if (error != KErrNone) { @@ -450,15 +459,49 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals) void QNetworkSessionPrivateImpl::stop() { - if (!isOpen) { - return; + if (!isOpen && + publicConfig.isValid() && + publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + // If the publicConfig is type of IAP, enumerate through connections at + // connection monitor. If publicConfig is active in that list, stop it. + // Otherwise there is nothing to stop. Note: because this QNetworkSession is not open, + // activeConfig is not usable. + TUint count; + TRequestStatus status; + iConnectionMonitor.GetConnectionCount(count, status); + User::WaitForRequest(status); + if (status.Int() != KErrNone) { + return; + } + TUint numSubConnections; // Not used but needed by GetConnectionInfo i/f + TUint connectionId; + for (TInt i = 1; i <= count; ++i) { + // Get (connection monitor's assigned) connection ID + TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); + if (ret == KErrNone) { + SymbianNetworkConfigurationPrivate *symbianConfig = + toSymbianConfig(privateConfiguration(publicConfig)); + + QMutexLocker configLocker(&symbianConfig->mutex); + + // See if connection Id matches with our Id. If so, stop() it. + if (symbianConfig->connectionId == connectionId) { + ret = iConnectionMonitor.SetBoolAttribute(connectionId, + 0, // subConnectionId don't care + KConnectionStop, + ETrue); + } + } + } + } else if (isOpen) { + // Since we are open, use RConnection to stop the interface + isOpen = false; + newState(QNetworkSession::Closing); + iConnection.Stop(RConnection::EStopAuthoritative); + isOpen = true; + close(false); + emit closed(); } - isOpen = false; - newState(QNetworkSession::Closing); - iConnection.Stop(RConnection::EStopAuthoritative); - isOpen = true; - close(false); - emit closed(); } void QNetworkSessionPrivateImpl::migrate() @@ -794,7 +837,7 @@ void QNetworkSessionPrivateImpl::RunL() TInt statusCode = iStatus.Int(); switch (statusCode) { - case KErrNone: // Connection created succesfully + case KErrNone: // Connection created successfully { TInt error = KErrNone; QNetworkConfiguration newActiveConfig = activeConfiguration(); diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h index 98d4222..35e2c58 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.h +++ b/src/plugins/bearer/symbian/qnetworksession_impl.h @@ -72,12 +72,11 @@ QT_BEGIN_NAMESPACE class ConnectionProgressNotifier; class SymbianEngine; +class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive, #ifdef SNAP_FUNCTIONALITY_AVAILABLE -class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive, public MMobilityProtocolResp, - public MConnectionMonitorObserver -#else -class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive, public MConnectionMonitorObserver + public MMobilityProtocolResp, #endif + public MConnectionMonitorObserver { Q_OBJECT public: diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 4d65b80..440f463 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -45,6 +45,16 @@ #include <commdb.h> #include <cdbcols.h> #include <d32dbms.h> +#include <QEventLoop> +#include <QTimer> +#include <QTime> // For randgen seeding +#include <QtCore> // For randgen seeding + +// #define QT_BEARERMGMT_CONFIGMGR_DEBUG + +#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG +#include <QDebug> +#endif #ifdef SNAP_FUNCTIONALITY_AVAILABLE #include <cmdestination.h> @@ -100,10 +110,15 @@ QString SymbianNetworkConfigurationPrivate::bearerName() const } SymbianEngine::SymbianEngine(QObject *parent) -: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iFirstUpdate(true), iInitOk(true) +: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iFirstUpdate(true), iInitOk(true), + iIgnoringUpdates(false), iTimeToWait(0), iIgnoreEventLoop(0) { CActiveScheduler::Add(this); + // Seed the randomgenerator + qsrand(QTime(0,0,0).secsTo(QTime::currentTime()) + QCoreApplication::applicationPid()); + iIgnoreEventLoop = new QEventLoop(this); + TRAPD(error, ipCommsDB = CCommsDatabase::NewL(EDatabaseTypeIAP)); if (error != KErrNone) { iInitOk = false; @@ -138,9 +153,7 @@ SymbianEngine::SymbianEngine(QObject *parent) updateConfigurations(); updateStatesToSnaps(); - updateAvailableAccessPoints(); // On first time updates synchronously (without WLAN scans) - // Start monitoring IAP and/or SNAP changes in Symbian CommsDB startCommsDatabaseNotifications(); iFirstUpdate = false; @@ -231,7 +244,7 @@ void SymbianEngine::updateConfigurationsL() QList<QString> knownConfigs = accessPointConfigurations.keys(); QList<QString> knownSnapConfigs = snapConfigurations.keys(); - + #ifdef SNAP_FUNCTIONALITY_AVAILABLE // S60 version is >= Series60 3rd Edition Feature Pack 2 TInt error = KErrNone; @@ -738,8 +751,7 @@ void SymbianEngine::updateStatesToSnaps() QMutexLocker locker(&mutex); // Go through SNAPs and set correct state to SNAPs - QList<QString> snapConfigIdents = snapConfigurations.keys(); - foreach (QString iface, snapConfigIdents) { + foreach (const QString &iface, snapConfigurations.keys()) { bool discovered = false; bool active = false; QNetworkConfigurationPrivatePointer ptr = snapConfigurations.value(iface); @@ -874,6 +886,13 @@ void SymbianEngine::RunL() { QMutexLocker locker(&mutex); + if (iIgnoringUpdates) { +#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG + qDebug("CommsDB event handling postponed (postpone-timer running because IAPs/SNAPs were updated very recently)."); +#endif + return; + } + if (iStatus != KErrCancel) { RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); switch (event) { @@ -881,16 +900,32 @@ void SymbianEngine::RunL() case RDbNotifier::ECommit: /** A transaction has been committed. */ case RDbNotifier::ERollback: /** A transaction has been rolled back */ case RDbNotifier::ERecover: /** The database has been recovered */ - // Note that if further database events occur while a client is handling - // a request completion, the notifier records the most significant database - // event and this is signalled as soon as the client issues the next - // RequestNotification() request. - // => Stop recording notifications - stopCommsDatabaseNotifications(); - TRAPD(error, updateConfigurationsL()); - if (error == KErrNone) { - updateStatesToSnaps(); +#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG + qDebug("CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int()); +#endif + iIgnoringUpdates = true; + // Other events than ECommit get lower priority. In practice with those events, + // we delay_before_updating methods, whereas + // with ECommit we _update_before_delaying the reaction to next event. + // Few important notes: 1) listening to only ECommit does not seem to be adequate, + // but updates will be missed. Hence other events are reacted upon too. + // 2) RDbNotifier records the most significant event, and that will be returned once + // we issue new RequestNotification, and hence updates will not be missed even + // when we are 'not reacting to them' for few seconds. + if (event == RDbNotifier::ECommit) { + TRAPD(error, updateConfigurationsL()); + if (error == KErrNone) { + updateStatesToSnaps(); + } + waitRandomTime(); + } else { + waitRandomTime(); + TRAPD(error, updateConfigurationsL()); + if (error == KErrNone) { + updateStatesToSnaps(); + } } + iIgnoringUpdates = false; // Wait time done, allow updating again iWaitingCommsDatabaseNotifications = true; break; default: @@ -1015,6 +1050,20 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) } } +// Waits for 1..4 seconds. +void SymbianEngine::waitRandomTime() +{ + iTimeToWait = (qAbs(qrand()) % 5) * 1000; + if (iTimeToWait < 1000) { + iTimeToWait = 1000; + } +#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG + qDebug("QNetworkConfigurationManager waiting random time: %d ms", iTimeToWait); +#endif + QTimer::singleShot(iTimeToWait, iIgnoreEventLoop, SLOT(quit())); + iIgnoreEventLoop->exec(); +} + QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aConnectionId) { QMutexLocker locker(&mutex); diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index e6af908..2e7ae60 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -53,6 +53,7 @@ #endif class CCommsDatabase; +class QEventLoop; QT_BEGIN_NAMESPACE class QTimer; @@ -148,6 +149,7 @@ private: void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo); void startCommsDatabaseNotifications(); void stopCommsDatabaseNotifications(); + void waitRandomTime(); QNetworkConfigurationPrivatePointer defaultConfigurationL(); TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const; @@ -170,8 +172,10 @@ private: // Data TBool iOnline; TBool iInitOk; TBool iUpdateGoingOn; + TBool iIgnoringUpdates; + TUint iTimeToWait; + QEventLoop* iIgnoreEventLoop; - AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner; friend class QNetworkSessionPrivate; diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index abe3ffe..93b7cc6 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -183,82 +183,34 @@ inline my_jpeg_source_mgr::my_jpeg_source_mgr(QIODevice *device) } -static bool read_jpeg_size(QIODevice *device, int &w, int &h) +inline static bool read_jpeg_size(int &w, int &h, j_decompress_ptr cinfo) { - bool rt = false; - struct jpeg_decompress_struct cinfo; + (void) jpeg_calc_output_dimensions(cinfo); - struct my_jpeg_source_mgr *iod_src = new my_jpeg_source_mgr(device); - struct my_error_mgr jerr; - - jpeg_create_decompress(&cinfo); - - cinfo.src = iod_src; - - cinfo.err = jpeg_std_error(&jerr); - jerr.error_exit = my_error_exit; - - if (!setjmp(jerr.setjmp_buffer)) { -#if defined(Q_OS_UNIXWARE) - (void) jpeg_read_header(&cinfo, B_TRUE); -#else - (void) jpeg_read_header(&cinfo, true); -#endif - (void) jpeg_calc_output_dimensions(&cinfo); - - w = cinfo.output_width; - h = cinfo.output_height; - rt = true; - } - jpeg_destroy_decompress(&cinfo); - delete iod_src; - return rt; + w = cinfo->output_width; + h = cinfo->output_height; + return true; } #define HIGH_QUALITY_THRESHOLD 50 -static bool read_jpeg_format(QIODevice *device, QImage::Format &format) +inline static bool read_jpeg_format(QImage::Format &format, j_decompress_ptr cinfo) { - bool result = false; - struct jpeg_decompress_struct cinfo; - - struct my_jpeg_source_mgr *iod_src = new my_jpeg_source_mgr(device); - struct my_error_mgr jerr; - - jpeg_create_decompress(&cinfo); - - cinfo.src = iod_src; - - cinfo.err = jpeg_std_error(&jerr); - jerr.error_exit = my_error_exit; - if (!setjmp(jerr.setjmp_buffer)) { -#if defined(Q_OS_UNIXWARE) - (void) jpeg_read_header(&cinfo, B_TRUE); -#else - (void) jpeg_read_header(&cinfo, true); -#endif - // This does not allocate memory for the whole image - // or such, so we are safe. - (void) jpeg_start_decompress(&cinfo); - result = true; - switch (cinfo.output_components) { - case 1: - format = QImage::Format_Indexed8; - break; - case 3: - case 4: - format = QImage::Format_RGB32; - break; - default: - result = false; - break; - } - cinfo.output_scanline = cinfo.output_height; - (void) jpeg_finish_decompress(&cinfo); + bool result = true; + switch (cinfo->output_components) { + case 1: + format = QImage::Format_Indexed8; + break; + case 3: + case 4: + format = QImage::Format_RGB32; + break; + default: + result = false; + break; } - jpeg_destroy_decompress(&cinfo); - delete iod_src; + cinfo->output_scanline = cinfo->output_height; return result; } @@ -291,29 +243,11 @@ static bool ensureValidImage(QImage *dest, struct jpeg_decompress_struct *info, return !dest->isNull(); } -static bool read_jpeg_image(QIODevice *device, QImage *outImage, +static bool read_jpeg_image(QImage *outImage, QSize scaledSize, QRect scaledClipRect, - QRect clipRect, int inQuality ) + QRect clipRect, int inQuality, j_decompress_ptr info, struct my_error_mgr* err ) { - struct jpeg_decompress_struct cinfo; - - struct my_jpeg_source_mgr *iod_src = new my_jpeg_source_mgr(device); - struct my_error_mgr jerr; - - jpeg_create_decompress(&cinfo); - - cinfo.src = iod_src; - - cinfo.err = jpeg_std_error(&jerr); - jerr.error_exit = my_error_exit; - - if (!setjmp(jerr.setjmp_buffer)) { -#if defined(Q_OS_UNIXWARE) - (void) jpeg_read_header(&cinfo, B_TRUE); -#else - (void) jpeg_read_header(&cinfo, true); -#endif - + if (!setjmp(err->setjmp_buffer)) { // -1 means default quality. int quality = inQuality; if (quality < 0) @@ -335,16 +269,16 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, } else if (clipRect.isEmpty()) { // No clipping, but scaling: if we can map back to an // integer pixel boundary, then clip before scaling. - if ((cinfo.image_width % scaledSize.width()) == 0 && - (cinfo.image_height % scaledSize.height()) == 0) { - int x = scaledClipRect.x() * cinfo.image_width / + if ((info->image_width % scaledSize.width()) == 0 && + (info->image_height % scaledSize.height()) == 0) { + int x = scaledClipRect.x() * info->image_width / scaledSize.width(); - int y = scaledClipRect.y() * cinfo.image_height / + int y = scaledClipRect.y() * info->image_height / scaledSize.height(); int width = (scaledClipRect.right() + 1) * - cinfo.image_width / scaledSize.width() - x; + info->image_width / scaledSize.width() - x; int height = (scaledClipRect.bottom() + 1) * - cinfo.image_height / scaledSize.height() - y; + info->image_height / scaledSize.height() - y; clipRect = QRect(x, y, width, height); scaledSize = scaledClipRect.size(); scaledClipRect = QRect(); @@ -358,69 +292,69 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, // Determine the scale factor to pass to libjpeg for quick downscaling. if (!scaledSize.isEmpty()) { if (clipRect.isEmpty()) { - cinfo.scale_denom = - qMin(cinfo.image_width / scaledSize.width(), - cinfo.image_height / scaledSize.height()); + info->scale_denom = + qMin(info->image_width / scaledSize.width(), + info->image_height / scaledSize.height()); } else { - cinfo.scale_denom = + info->scale_denom = qMin(clipRect.width() / scaledSize.width(), clipRect.height() / scaledSize.height()); } - if (cinfo.scale_denom < 2) { - cinfo.scale_denom = 1; - } else if (cinfo.scale_denom < 4) { - cinfo.scale_denom = 2; - } else if (cinfo.scale_denom < 8) { - cinfo.scale_denom = 4; + if (info->scale_denom < 2) { + info->scale_denom = 1; + } else if (info->scale_denom < 4) { + info->scale_denom = 2; + } else if (info->scale_denom < 8) { + info->scale_denom = 4; } else { - cinfo.scale_denom = 8; + info->scale_denom = 8; } - cinfo.scale_num = 1; + info->scale_num = 1; if (!clipRect.isEmpty()) { // Correct the scale factor so that we clip accurately. // It is recommended that the clip rectangle be aligned // on an 8-pixel boundary for best performance. - while (cinfo.scale_denom > 1 && - ((clipRect.x() % cinfo.scale_denom) != 0 || - (clipRect.y() % cinfo.scale_denom) != 0 || - (clipRect.width() % cinfo.scale_denom) != 0 || - (clipRect.height() % cinfo.scale_denom) != 0)) { - cinfo.scale_denom /= 2; + while (info->scale_denom > 1 && + ((clipRect.x() % info->scale_denom) != 0 || + (clipRect.y() % info->scale_denom) != 0 || + (clipRect.width() % info->scale_denom) != 0 || + (clipRect.height() % info->scale_denom) != 0)) { + info->scale_denom /= 2; } } } // If high quality not required, use fast decompression if( quality < HIGH_QUALITY_THRESHOLD ) { - cinfo.dct_method = JDCT_IFAST; - cinfo.do_fancy_upsampling = FALSE; + info->dct_method = JDCT_IFAST; + info->do_fancy_upsampling = FALSE; } - (void) jpeg_calc_output_dimensions(&cinfo); + (void) jpeg_calc_output_dimensions(info); // Determine the clip region to extract. - QRect imageRect(0, 0, cinfo.output_width, cinfo.output_height); + QRect imageRect(0, 0, info->output_width, info->output_height); QRect clip; if (clipRect.isEmpty()) { clip = imageRect; - } else if (cinfo.scale_denom == cinfo.scale_num) { + } else if (info->scale_denom == info->scale_num) { clip = clipRect.intersected(imageRect); } else { // The scale factor was corrected above to ensure that // we don't miss pixels when we scale the clip rectangle. - clip = QRect(clipRect.x() / int(cinfo.scale_denom), - clipRect.y() / int(cinfo.scale_denom), - clipRect.width() / int(cinfo.scale_denom), - clipRect.height() / int(cinfo.scale_denom)); + clip = QRect(clipRect.x() / int(info->scale_denom), + clipRect.y() / int(info->scale_denom), + clipRect.width() / int(info->scale_denom), + clipRect.height() / int(info->scale_denom)); clip = clip.intersected(imageRect); } // Allocate memory for the clipped QImage. - if (!ensureValidImage(outImage, &cinfo, clip.size())) - longjmp(jerr.setjmp_buffer, 1); + if (!ensureValidImage(outImage, info, clip.size())) + longjmp(err->setjmp_buffer, 1); // Avoid memcpy() overhead if grayscale with no clipping. - bool quickGray = (cinfo.output_components == 1 && + bool quickGray = (info->output_components == 1 && clip == imageRect); if (!quickGray) { // Ask the jpeg library to allocate a temporary row. @@ -429,23 +363,23 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, // jpeg_start_decompress(). We can't use "new" here // because we are inside the setjmp() block and an error // in the jpeg input stream would cause a memory leak. - JSAMPARRAY rows = (cinfo.mem->alloc_sarray) - ((j_common_ptr)&cinfo, JPOOL_IMAGE, - cinfo.output_width * cinfo.output_components, 1); + JSAMPARRAY rows = (info->mem->alloc_sarray) + ((j_common_ptr)info, JPOOL_IMAGE, + info->output_width * info->output_components, 1); - (void) jpeg_start_decompress(&cinfo); + (void) jpeg_start_decompress(info); - while (cinfo.output_scanline < cinfo.output_height) { - int y = int(cinfo.output_scanline) - clip.y(); + while (info->output_scanline < info->output_height) { + int y = int(info->output_scanline) - clip.y(); if (y >= clip.height()) break; // We've read the entire clip region, so abort. - (void) jpeg_read_scanlines(&cinfo, rows, 1); + (void) jpeg_read_scanlines(info, rows, 1); if (y < 0) continue; // Haven't reached the starting line yet. - if (cinfo.output_components == 3) { + if (info->output_components == 3) { // Expand 24->32 bpp. uchar *in = rows[0] + clip.x() * 3; QRgb *out = (QRgb*)outImage->scanLine(y); @@ -453,7 +387,7 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, *out++ = qRgb(in[0], in[1], in[2]); in += 3; } - } else if (cinfo.out_color_space == JCS_CMYK) { + } else if (info->out_color_space == JCS_CMYK) { // Convert CMYK->RGB. uchar *in = rows[0] + clip.x() * 4; QRgb *out = (QRgb*)outImage->scanLine(y); @@ -463,7 +397,7 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, k * in[2] / 255); in += 4; } - } else if (cinfo.output_components == 1) { + } else if (info->output_components == 1) { // Grayscale. memcpy(outImage->scanLine(y), rows[0] + clip.x(), clip.width()); @@ -471,37 +405,36 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, } } else { // Load unclipped grayscale data directly into the QImage. - (void) jpeg_start_decompress(&cinfo); - while (cinfo.output_scanline < cinfo.output_height) { - uchar *row = outImage->scanLine(cinfo.output_scanline); - (void) jpeg_read_scanlines(&cinfo, &row, 1); + (void) jpeg_start_decompress(info); + while (info->output_scanline < info->output_height) { + uchar *row = outImage->scanLine(info->output_scanline); + (void) jpeg_read_scanlines(info, &row, 1); } } - if (cinfo.output_scanline == cinfo.output_height) - (void) jpeg_finish_decompress(&cinfo); + if (info->output_scanline == info->output_height) + (void) jpeg_finish_decompress(info); - if (cinfo.density_unit == 1) { - outImage->setDotsPerMeterX(int(100. * cinfo.X_density / 2.54)); - outImage->setDotsPerMeterY(int(100. * cinfo.Y_density / 2.54)); - } else if (cinfo.density_unit == 2) { - outImage->setDotsPerMeterX(int(100. * cinfo.X_density)); - outImage->setDotsPerMeterY(int(100. * cinfo.Y_density)); + if (info->density_unit == 1) { + outImage->setDotsPerMeterX(int(100. * info->X_density / 2.54)); + outImage->setDotsPerMeterY(int(100. * info->Y_density / 2.54)); + } else if (info->density_unit == 2) { + outImage->setDotsPerMeterX(int(100. * info->X_density)); + outImage->setDotsPerMeterY(int(100. * info->Y_density)); } if (scaledSize.isValid() && scaledSize != clip.size()) { *outImage = outImage->scaled(scaledSize, Qt::IgnoreAspectRatio, quality >= HIGH_QUALITY_THRESHOLD ? Qt::SmoothTransformation : Qt::FastTransformation); } - } - jpeg_destroy_decompress(&cinfo); - delete iod_src; - if (!scaledClipRect.isEmpty()) - *outImage = outImage->copy(scaledClipRect); - return !outImage->isNull(); + if (!scaledClipRect.isEmpty()) + *outImage = outImage->copy(scaledClipRect); + return !outImage->isNull(); + } + else + return false; } - struct my_jpeg_destination_mgr : public jpeg_destination_mgr { // Nothing dynamic - cannot rely on destruction over longjump QIODevice *device; @@ -745,18 +678,124 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s return success; } +class QJpegHandlerPrivate +{ +public: + enum State { + Ready, + ReadHeader, + Error + }; + + QJpegHandlerPrivate(QJpegHandler *qq) + : quality(75), iod_src(0), state(Ready), q(qq) + {} + + ~QJpegHandlerPrivate() + { + if(iod_src) + { + jpeg_destroy_decompress(&info); + delete iod_src; + iod_src = 0; + } + } + + bool readJpegHeader(QIODevice*); + bool read(QImage *image); + + int quality; + QVariant size; + QImage::Format format; + QSize scaledSize; + QRect scaledClipRect; + QRect clipRect; + struct jpeg_decompress_struct info; + struct my_jpeg_source_mgr * iod_src; + struct my_error_mgr err; + + State state; + + QJpegHandler *q; +}; + +/*! + \internal +*/ +bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device) +{ + if(state == Ready) + { + state = Error; + iod_src = new my_jpeg_source_mgr(device); + + jpeg_create_decompress(&info); + info.src = iod_src; + info.err = jpeg_std_error(&err); + err.error_exit = my_error_exit; + + if (!setjmp(err.setjmp_buffer)) { + #if defined(Q_OS_UNIXWARE) + (void) jpeg_read_header(&info, B_TRUE); + #else + (void) jpeg_read_header(&info, true); + #endif + + int width = 0; + int height = 0; + read_jpeg_size(width, height, &info); + size = QSize(width, height); + + format = QImage::Format_Invalid; + read_jpeg_format(format, &info); + state = ReadHeader; + return true; + } + else + { + return false; + } + } + else if(state == Error) + return false; + return true; +} + +bool QJpegHandlerPrivate::read(QImage *image) +{ + if(state == Ready) + readJpegHeader(q->device()); + + if(state == ReadHeader) + { + bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, &info, &err); + state = success ? Ready : Error; + return success; + } + + return false; + +} + QJpegHandler::QJpegHandler() + : d(new QJpegHandlerPrivate(this)) +{ +} + +QJpegHandler::~QJpegHandler() { - quality = 75; + delete d; } bool QJpegHandler::canRead() const { - if (canRead(device())) { + if(d->state == QJpegHandlerPrivate::Ready) { + if (!canRead(device())) + return false; setFormat("jpeg"); return true; } - return false; + return d->state != QJpegHandlerPrivate::Error; } bool QJpegHandler::canRead(QIODevice *device) @@ -769,7 +808,6 @@ bool QJpegHandler::canRead(QIODevice *device) char buffer[2]; if (device->peek(buffer, 2) != 2) return false; - return uchar(buffer[0]) == 0xff && uchar(buffer[1]) == 0xd8; } @@ -777,12 +815,12 @@ bool QJpegHandler::read(QImage *image) { if (!canRead()) return false; - return read_jpeg_image(device(), image, scaledSize, scaledClipRect, clipRect, quality); + return d->read(image); } bool QJpegHandler::write(const QImage &image) { - return write_jpeg_image(image, device(), quality); + return write_jpeg_image(image, device(), d->quality); } bool QJpegHandler::supportsOption(ImageOption option) const @@ -799,32 +837,19 @@ QVariant QJpegHandler::option(ImageOption option) const { switch(option) { case Quality: - return quality; + return d->quality; case ScaledSize: - return scaledSize; + return d->scaledSize; case ScaledClipRect: - return scaledClipRect; + return d->scaledClipRect; case ClipRect: - return clipRect; + return d->clipRect; case Size: - if (canRead() && !device()->isSequential()) { - qint64 pos = device()->pos(); - int width = 0; - int height = 0; - read_jpeg_size(device(), width, height); - device()->seek(pos); - return QSize(width, height); - } - return QVariant(); + d->readJpegHeader(device()); + return d->size; case ImageFormat: - if (canRead() && !device()->isSequential()) { - qint64 pos = device()->pos(); - QImage::Format format = QImage::Format_Invalid; - read_jpeg_format(device(), format); - device()->seek(pos); - return format; - } - return QImage::Format_Invalid; + d->readJpegHeader(device()); + return d->format; default: return QVariant(); } @@ -834,16 +859,16 @@ void QJpegHandler::setOption(ImageOption option, const QVariant &value) { switch(option) { case Quality: - quality = value.toInt(); + d->quality = value.toInt(); break; case ScaledSize: - scaledSize = value.toSize(); + d->scaledSize = value.toSize(); break; case ScaledClipRect: - scaledClipRect = value.toRect(); + d->scaledClipRect = value.toRect(); break; case ClipRect: - clipRect = value.toRect(); + d->clipRect = value.toRect(); break; default: break; @@ -855,4 +880,7 @@ QByteArray QJpegHandler::name() const return "jpeg"; } + + + QT_END_NAMESPACE diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.h b/src/plugins/imageformats/jpeg/qjpeghandler.h index dfb6b47..c879f21 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.h +++ b/src/plugins/imageformats/jpeg/qjpeghandler.h @@ -48,10 +48,12 @@ QT_BEGIN_NAMESPACE +class QJpegHandlerPrivate; class QJpegHandler : public QImageIOHandler { public: QJpegHandler(); + ~QJpegHandler(); bool canRead() const; bool read(QImage *image); @@ -66,10 +68,7 @@ public: bool supportsOption(ImageOption option) const; private: - int quality; - QSize scaledSize; - QRect scaledClipRect; - QRect clipRect; + QJpegHandlerPrivate *d; }; QT_END_NAMESPACE diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h index 31a0314..49049ad 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h +++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h @@ -100,6 +100,7 @@ private: void *m_movie; void *m_movieView; + bool m_layouted; WId m_winId; QRect m_displayRect; diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm index d8dbf9b..8e4dd9b 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm +++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm @@ -154,6 +154,7 @@ QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent) :QT7VideoWindowControl(parent), m_movie(0), m_movieView(0), + m_layouted(false), m_winId(0), m_fullscreen(false), m_aspectRatioMode(Qt::KeepAspectRatio), @@ -166,6 +167,8 @@ QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent) QT7MovieViewOutput::~QT7MovieViewOutput() { + [(QTMovieView*)m_movieView release]; + [(QTMovie*)m_movie release]; } void QT7MovieViewOutput::setupVideoOutput() @@ -186,6 +189,7 @@ void QT7MovieViewOutput::setupVideoOutput() [(QTMovieView*)m_movieView setMovie:(QTMovie*)m_movie]; [(NSView *)m_winId addSubview:(QTMovieView*)m_movieView]; + m_layouted = true; setDisplayRect(m_displayRect); } @@ -196,8 +200,21 @@ void QT7MovieViewOutput::setEnabled(bool) void QT7MovieViewOutput::setMovie(void *movie) { - m_movie = movie; - setupVideoOutput(); + if (m_movie != movie) { + if (m_movie) { + if (m_movieView) + [(QTMovieView*)m_movieView setMovie:nil]; + + [(QTMovie*)m_movie release]; + } + + m_movie = movie; + + if (m_movie) + [(QTMovie*)m_movie retain]; + + setupVideoOutput(); + } } void QT7MovieViewOutput::updateNaturalSize(const QSize &newSize) @@ -215,8 +232,15 @@ WId QT7MovieViewOutput::winId() const void QT7MovieViewOutput::setWinId(WId id) { - m_winId = id; - setupVideoOutput(); + if (m_winId != id) { + if (m_movieView && m_layouted) { + [(QTMovieView*)m_movieView removeFromSuperview]; + m_layouted = false; + } + + m_winId = id; + setupVideoOutput(); + } } QRect QT7MovieViewOutput::displayRect() const diff --git a/src/qt3support/network/q3socketdevice_win.cpp b/src/qt3support/network/q3socketdevice_win.cpp index 528b50a..1354cfa 100644 --- a/src/qt3support/network/q3socketdevice_win.cpp +++ b/src/qt3support/network/q3socketdevice_win.cpp @@ -47,7 +47,6 @@ #include <string.h> -# include <qt_windows.h> #if defined (QT_NO_IPV6) # include <winsock.h> #else diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 356b4d0..2650d7f 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -292,6 +292,7 @@ QT_BEGIN_NAMESPACE \value ExcludeSuperClassProperties The script object will not expose properties inherited from the superclass. \value ExcludeSuperClassContents Shorthand form for ExcludeSuperClassMethods | ExcludeSuperClassProperties \value ExcludeDeleteLater The script object will not expose the QObject::deleteLater() slot. + \value ExcludeSlots The script object will not expose the QObject's slots. \value AutoCreateDynamicProperties Properties that don't already exist in the QObject will be created as dynamic properties of that object, rather than as properties of the script object. \value PreferExistingWrapperObject If a wrapper object with the requested configuration already exists, return that object. \value SkipMethodsInEnumeration Don't include methods (signals and slots) when enumerating the object's properties. diff --git a/src/script/api/qscriptengine.h b/src/script/api/qscriptengine.h index 2ce3183..76461bc 100644 --- a/src/script/api/qscriptengine.h +++ b/src/script/api/qscriptengine.h @@ -125,6 +125,7 @@ public: ExcludeSuperClassContents = 0x0006, SkipMethodsInEnumeration = 0x0008, ExcludeDeleteLater = 0x0010, + ExcludeSlots = 0x0020, AutoCreateDynamicProperties = 0x0100, PreferExistingWrapperObject = 0x0200 diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 5db1165..3fe0e7d 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1505,8 +1505,9 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, const QScriptValueList &args) { Q_D(const QScriptValue); - if (!d || !d->isJSC()) + if (!d || !d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); JSC::JSValue callee = d->jscValue; JSC::CallData callData; JSC::CallType callType = callee.getCallData(callData); @@ -1582,8 +1583,9 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, const QScriptValue &arguments) { Q_D(QScriptValue); - if (!d || !d->isJSC()) + if (!d || !d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); JSC::JSValue callee = d->jscValue; JSC::CallData callData; JSC::CallType callType = callee.getCallData(callData); @@ -1656,8 +1658,9 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, QScriptValue QScriptValue::construct(const QScriptValueList &args) { Q_D(const QScriptValue); - if (!d || !d->isJSC()) + if (!d || !d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); JSC::JSValue callee = d->jscValue; JSC::ConstructData constructData; JSC::ConstructType constructType = callee.getConstructData(constructData); @@ -1705,8 +1708,9 @@ QScriptValue QScriptValue::construct(const QScriptValueList &args) QScriptValue QScriptValue::construct(const QScriptValue &arguments) { Q_D(QScriptValue); - if (!d || !d->isJSC()) + if (!d || !d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); JSC::JSValue callee = d->jscValue; JSC::ConstructData constructData; JSC::ConstructType constructType = callee.getConstructData(constructData); diff --git a/src/script/api/qscriptvalueiterator.cpp b/src/script/api/qscriptvalueiterator.cpp index 5c1e6f2..7fd7093 100644 --- a/src/script/api/qscriptvalueiterator.cpp +++ b/src/script/api/qscriptvalueiterator.cpp @@ -100,6 +100,7 @@ public: if (initialized) return; QScriptEnginePrivate *eng_p = engine(); + QScript::APIShim shim(eng_p); JSC::ExecState *exec = eng_p->globalExec(); JSC::PropertyNameArray propertyNamesArray(exec); JSC::asObject(object()->jscValue)->getOwnPropertyNames(exec, propertyNamesArray, JSC::IncludeDontEnumProperties); diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 765e074..83a811b 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -151,7 +151,8 @@ private: static bool hasMethodAccess(const QMetaMethod &method, int index, const QScriptEngine::QObjectWrapOptions &opt) { return (method.access() != QMetaMethod::Private) - && ((index != 2) || !(opt & QScriptEngine::ExcludeDeleteLater)); + && ((index != 2) || !(opt & QScriptEngine::ExcludeDeleteLater)) + && (!(opt & QScriptEngine::ExcludeSlots) || (method.methodType() != QMetaMethod::Slot)); } static bool isEnumerableMetaProperty(const QMetaProperty &prop, |