summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp10
-rw-r--r--src/corelib/animation/qabstractanimation.cpp18
-rw-r--r--src/corelib/animation/qabstractanimation.h2
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp2
-rw-r--r--src/corelib/animation/qparallelanimationgroup.h2
-rw-r--r--src/corelib/animation/qpauseanimation.cpp3
-rw-r--r--src/corelib/animation/qpauseanimation.h2
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp16
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.h2
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h2
-rw-r--r--src/corelib/animation/qvariantanimation.cpp3
-rw-r--r--src/corelib/animation/qvariantanimation.h2
-rw-r--r--src/corelib/codecs/qtextcodec.cpp14
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.cpp6
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp65
-rw-r--r--src/corelib/tools/qringbuffer_p.h23
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp34
-rw-r--r--src/gui/graphicsview/qgraphicslayout.cpp18
-rw-r--r--src/gui/graphicsview/qgraphicslayout.h1
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp41
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp14
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex_p.h6
-rw-r--r--src/gui/graphicsview/qgraphicsscenelinearindex.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscenelinearindex_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp16
-rw-r--r--src/gui/image/qpixmap.h6
-rw-r--r--src/gui/image/qpixmap_s60.cpp410
-rw-r--r--src/gui/image/qpixmap_s60_p.h21
-rw-r--r--src/gui/image/qpixmap_win.cpp46
-rw-r--r--src/gui/image/qpixmapdata.cpp5
-rw-r--r--src/gui/image/qpixmapdata_p.h15
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp8
-rw-r--r--src/gui/itemviews/qdirmodel.cpp8
-rw-r--r--src/gui/itemviews/qlistview.cpp2
-rw-r--r--src/gui/kernel/qapplication_p.h5
-rw-r--r--src/gui/kernel/qapplication_s60.cpp76
-rw-r--r--src/gui/kernel/qsound_qws.cpp2
-rw-r--r--src/gui/kernel/qt_s60_p.h1
-rw-r--r--src/gui/kernel/qwidget.cpp12
-rw-r--r--src/gui/kernel/qwidget_p.h1
-rw-r--r--src/gui/kernel/qwidget_s60.cpp12
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp1
-rw-r--r--src/gui/styles/gtksymbols.cpp3
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp22
-rw-r--r--src/gui/styles/qwindowsstyle.cpp2
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp11
-rw-r--r--src/gui/text/qtextcursor.cpp8
-rw-r--r--src/gui/widgets/qtoolbar.cpp2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp38
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp3
-rw-r--r--src/network/access/qhttpnetworkreply.cpp3
-rw-r--r--src/network/access/qhttpnetworkreply_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp2
-rw-r--r--src/openvg/qpixmapdata_vg.cpp266
-rw-r--r--src/openvg/qpixmapdata_vg_p.h4
-rw-r--r--src/openvg/qwindowsurface_vg.cpp1
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp6
-rw-r--r--src/script/api/qscriptengine.cpp2
-rw-r--r--src/script/api/qscriptengine_p.h23
-rw-r--r--src/script/api/qscriptvalue.cpp14
-rw-r--r--src/script/bridge/qscriptclassobject.cpp9
-rw-r--r--src/script/script.pro2
-rw-r--r--src/testlib/qtestsystem.h2
66 files changed, 819 insertions, 550 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp b/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp
index 0733617..977b284 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp
@@ -444,7 +444,7 @@ String localizedMediaControlElementHelpText(const String& name)
String localizedMediaTimeDescription(float time)
{
if (!isfinite(time))
- return QCoreApplication::translate("QWebPage," "Indefinite time", "Media time description");
+ return QCoreApplication::translate("QWebPage", "Indefinite time", "Media time description");
int seconds = (int)fabsf(time);
int days = seconds / (60 * 60 * 24);
@@ -453,18 +453,18 @@ String localizedMediaTimeDescription(float time)
seconds %= 60;
if (days) {
- return QCoreApplication::translate("QWebPage," "%1 days %2 hours %3 minutes %4 seconds", "Media time description").arg(days).arg(hours).arg(minutes).arg(seconds);
+ return QCoreApplication::translate("QWebPage", "%1 days %2 hours %3 minutes %4 seconds", "Media time description").arg(days).arg(hours).arg(minutes).arg(seconds);
}
if (hours) {
- return QCoreApplication::translate("QWebPage," "%1 hours %2 minutes %3 seconds", "Media time description").arg(hours).arg(minutes).arg(seconds);
+ return QCoreApplication::translate("QWebPage", "%1 hours %2 minutes %3 seconds", "Media time description").arg(hours).arg(minutes).arg(seconds);
}
if (minutes) {
- return QCoreApplication::translate("QWebPage," "%1 minutes %2 seconds", "Media time description").arg(minutes).arg(seconds);
+ return QCoreApplication::translate("QWebPage", "%1 minutes %2 seconds", "Media time description").arg(minutes).arg(seconds);
}
- return QCoreApplication::translate("QWebPage," "%1 seconds", "Media time description").arg(seconds);
+ return QCoreApplication::translate("QWebPage", "%1 seconds", "Media time description").arg(seconds);
}
#endif // ENABLE(VIDEO)
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 6306882..9027be0 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -81,12 +81,12 @@
QAbstractAnimation provides pure virtual functions used by
subclasses to track the progress of the animation: duration() and
updateCurrentTime(). The duration() function lets you report a
- duration for the animation (as discussed above). The current time
- is delivered by the animation framework through calls to
- updateCurrentTime(). By reimplementing this function, you can
- track the animation progress. Note that neither the interval
- between calls nor the number of calls to this function are
- defined; though, it will normally be 60 updates per second.
+ duration for the animation (as discussed above). The animation
+ framework calls updateCurrentTime() when current time has changed.
+ By reimplementing this function, you can track the animation
+ progress. Note that neither the interval between calls nor the
+ number of calls to this function are defined; though, it will
+ normally be 60 updates per second.
By reimplementing updateState(), you can track the animation's
state changes, which is particularly useful for animations that
@@ -604,7 +604,7 @@ void QAbstractAnimation::setCurrentTime(int msecs)
}
}
- updateCurrentTime(msecs);
+ updateCurrentTime();
if (d->currentLoop != oldLoop)
emit currentLoopChanged(d->currentLoop);
@@ -705,10 +705,10 @@ bool QAbstractAnimation::event(QEvent *event)
}
/*!
- \fn virtual void QAbstractAnimation::updateCurrentTime(int msecs) = 0;
+ \fn virtual void QAbstractAnimation::updateCurrentTime() = 0;
This pure virtual function is called every time the animation's current
- time changes. The \a msecs argument is the current time.
+ time changes.
\sa updateState()
*/
diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h
index dc0af19..516f5e9 100644
--- a/src/corelib/animation/qabstractanimation.h
+++ b/src/corelib/animation/qabstractanimation.h
@@ -119,7 +119,7 @@ protected:
QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = 0);
bool event(QEvent *event);
- virtual void updateCurrentTime(int msecs) = 0;
+ virtual void updateCurrentTime() = 0;
virtual void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
virtual void updateDirection(QAbstractAnimation::Direction direction);
diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp
index 349090b..82d5224 100644
--- a/src/corelib/animation/qparallelanimationgroup.cpp
+++ b/src/corelib/animation/qparallelanimationgroup.cpp
@@ -125,7 +125,7 @@ int QParallelAnimationGroup::duration() const
/*!
\reimp
*/
-void QParallelAnimationGroup::updateCurrentTime(int)
+void QParallelAnimationGroup::updateCurrentTime()
{
Q_D(QParallelAnimationGroup);
if (d->animations.isEmpty())
diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h
index f013bc7..6afe4a7 100644
--- a/src/corelib/animation/qparallelanimationgroup.h
+++ b/src/corelib/animation/qparallelanimationgroup.h
@@ -67,7 +67,7 @@ protected:
QParallelAnimationGroup(QParallelAnimationGroupPrivate &dd, QObject *parent);
bool event(QEvent *event);
- void updateCurrentTime(int msecs);
+ void updateCurrentTime();
void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
void updateDirection(QAbstractAnimation::Direction direction);
diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp
index 8bfed08..c382b19 100644
--- a/src/corelib/animation/qpauseanimation.cpp
+++ b/src/corelib/animation/qpauseanimation.cpp
@@ -141,9 +141,8 @@ bool QPauseAnimation::event(QEvent *e)
/*!
\reimp
*/
-void QPauseAnimation::updateCurrentTime(int msecs)
+void QPauseAnimation::updateCurrentTime()
{
- Q_UNUSED(msecs);
}
diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h
index 05eb3b3..caac9e9 100644
--- a/src/corelib/animation/qpauseanimation.h
+++ b/src/corelib/animation/qpauseanimation.h
@@ -68,7 +68,7 @@ public:
protected:
bool event(QEvent *e);
- void updateCurrentTime(int msecs);
+ void updateCurrentTime();
private:
Q_DISABLE_COPY(QPauseAnimation)
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 53fc4f3..9ad433f 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -112,17 +112,13 @@ int QSequentialAnimationGroupPrivate::animationActualTotalDuration(int index) co
return ret;
}
-QSequentialAnimationGroupPrivate::AnimationIndex QSequentialAnimationGroupPrivate::indexForTime(int msecs) const
+QSequentialAnimationGroupPrivate::AnimationIndex QSequentialAnimationGroupPrivate::indexForCurrentTime() const
{
- Q_Q(const QSequentialAnimationGroup);
Q_ASSERT(!animations.isEmpty());
AnimationIndex ret;
int duration = 0;
- // in case duration is -1, currentLoop will always be 0
- ret.timeOffset = currentLoop * q->duration();
-
for (int i = 0; i < animations.size(); ++i) {
duration = animationActualTotalDuration(i);
@@ -131,8 +127,8 @@ QSequentialAnimationGroupPrivate::AnimationIndex QSequentialAnimationGroupPrivat
// 2. it ends after msecs
// 3. it is the last animation (this can happen in case there is at least 1 uncontrolled animation)
// 4. it ends exactly in msecs and the direction is backwards
- if (duration == -1 || msecs < (ret.timeOffset + duration)
- || (msecs == (ret.timeOffset + duration) && direction == QAbstractAnimation::Backward)) {
+ if (duration == -1 || currentTime < (ret.timeOffset + duration)
+ || (currentTime == (ret.timeOffset + duration) && direction == QAbstractAnimation::Backward)) {
ret.index = i;
return ret;
}
@@ -338,13 +334,13 @@ int QSequentialAnimationGroup::duration() const
/*!
\reimp
*/
-void QSequentialAnimationGroup::updateCurrentTime(int msecs)
+void QSequentialAnimationGroup::updateCurrentTime()
{
Q_D(QSequentialAnimationGroup);
if (!d->currentAnimation)
return;
- const QSequentialAnimationGroupPrivate::AnimationIndex newAnimationIndex = d->indexForTime(msecs);
+ const QSequentialAnimationGroupPrivate::AnimationIndex newAnimationIndex = d->indexForCurrentTime();
// remove unneeded animations from actualDuration list
while (newAnimationIndex.index < d->actualDuration.size())
@@ -363,7 +359,7 @@ void QSequentialAnimationGroup::updateCurrentTime(int msecs)
d->setCurrentAnimation(newAnimationIndex.index);
- const int newCurrentTime = msecs - newAnimationIndex.timeOffset;
+ const int newCurrentTime = d->currentTime - newAnimationIndex.timeOffset;
if (d->currentAnimation) {
d->currentAnimation->setCurrentTime(newCurrentTime);
diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h
index e17e103..1c9e4cc 100644
--- a/src/corelib/animation/qsequentialanimationgroup.h
+++ b/src/corelib/animation/qsequentialanimationgroup.h
@@ -77,7 +77,7 @@ protected:
QSequentialAnimationGroup(QSequentialAnimationGroupPrivate &dd, QObject *parent);
bool event(QEvent *event);
- void updateCurrentTime(int msecs);
+ void updateCurrentTime();
void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
void updateDirection(QAbstractAnimation::Direction direction);
diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h
index 2e65cc0..ab41d35 100644
--- a/src/corelib/animation/qsequentialanimationgroup_p.h
+++ b/src/corelib/animation/qsequentialanimationgroup_p.h
@@ -79,7 +79,7 @@ public:
};
int animationActualTotalDuration(int index) const;
- AnimationIndex indexForTime(int msecs) const;
+ AnimationIndex indexForCurrentTime() const;
void setCurrentAnimation(int index, bool intermediate = false);
void activateCurrentAnimation(bool intermediate = false);
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index c831a34..ae8bf2f 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -656,9 +656,8 @@ QVariant QVariantAnimation::interpolated(const QVariant &from, const QVariant &t
/*!
\reimp
*/
-void QVariantAnimation::updateCurrentTime(int msecs)
+void QVariantAnimation::updateCurrentTime()
{
- Q_UNUSED(msecs);
d_func()->recalculateCurrentInterval();
}
diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h
index c803150..98c1aec 100644
--- a/src/corelib/animation/qvariantanimation.h
+++ b/src/corelib/animation/qvariantanimation.h
@@ -102,7 +102,7 @@ protected:
QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = 0);
bool event(QEvent *event);
- void updateCurrentTime(int msecs);
+ void updateCurrentTime();
void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
virtual void updateCurrentValue(const QVariant &value) = 0;
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 3ef9f7e..4f0e13c 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -1536,12 +1536,14 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba, QTextCodec *defaultCo
if (!c) {
QByteArray header = ba.left(512).toLower();
if ((pos = header.indexOf("http-equiv=")) != -1) {
- pos = header.indexOf("charset=", pos) + int(strlen("charset="));
- if (pos != -1) {
- int pos2 = header.indexOf('\"', pos+1);
- QByteArray cs = header.mid(pos, pos2-pos);
- // qDebug("found charset: %s", cs.data());
- c = QTextCodec::codecForName(cs);
+ if ((pos = header.lastIndexOf("meta ", pos)) != -1) {
+ pos = header.indexOf("charset=", pos) + int(strlen("charset="));
+ if (pos != -1) {
+ int pos2 = header.indexOf('\"', pos+1);
+ QByteArray cs = header.mid(pos, pos2-pos);
+ // qDebug("found charset: %s", cs.data());
+ c = QTextCodec::codecForName(cs);
+ }
}
}
}
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.cpp b/src/corelib/io/qfilesystemwatcher_fsevents.cpp
index f648016..be2125a 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents.cpp
+++ b/src/corelib/io/qfilesystemwatcher_fsevents.cpp
@@ -223,6 +223,11 @@ QStringList QFSEventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
}
}
}
+
+ if (!pathsToWatch && failedToAdd.size() == paths.size()) {
+ return failedToAdd;
+ }
+
if (CFArrayGetCount(tmpArray) > 0) {
if (pathsToWatch) {
CFArrayAppendArray(tmpArray, pathsToWatch, CFRangeMake(0, CFArrayGetCount(pathsToWatch)));
@@ -230,6 +235,7 @@ QStringList QFSEventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
}
pathsToWatch = CFArrayCreateCopy(kCFAllocatorDefault, tmpArray);
}
+
FSEventStreamContext context = { 0, this, 0, 0, 0 };
fsStream = FSEventStreamCreate(kCFAllocatorDefault,
QFSEventsFileSystemWatcherEngine::fseventsCallback,
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index e54bad6..4ec5772 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -899,7 +899,7 @@ QString QFSFileEngine::fileName(FileName file) const
// Clean up the path
bool isDir = ret.endsWith(slashChar);
ret = QDir::cleanPath(ret);
- if (isDir)
+ if (isDir && !ret.endsWith(slashChar))
ret += slashChar;
if (file == AbsolutePathName) {
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 9283730..9a93685 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -345,7 +345,7 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver)
}
#elif defined(Q_OS_SYMBIAN) && defined (QT_NO_DEBUG)
// no implementation in release builds, but keep the symbol present
-void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver)
+void QCoreApplicationPrivate::checkReceiverThread(QObject * /* receiver */)
{
}
#endif
@@ -1788,6 +1788,8 @@ bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator)
In Symbian this function will return the application private directory,
not the path to executable itself, as those are always in \c {/sys/bin}.
+ If the application is in a read only drive, i.e. ROM, then the private path
+ on the system drive will be returned.
\sa applicationFilePath()
*/
@@ -1803,42 +1805,39 @@ QString QCoreApplication::applicationDirPath()
#if defined(Q_OS_SYMBIAN)
{
QString appPath;
- RProcess proc;
- TInt err = proc.Open(proc.Id());
+ RFs& fs = qt_s60GetRFs();
+ TChar driveChar;
+ QChar qDriveChar;
+ driveChar = (RProcess().FileName())[0];
+
+ //Check if the process is installed in a read only drive (typically ROM),
+ //and use the system drive (typically C:) if so.
+ TInt drive;
+ TDriveInfo driveInfo;
+ TInt err = fs.CharToDrive(driveChar, drive);
if (err == KErrNone) {
- QChar driveChar;
-#if defined(Q_CC_NOKIAX86)
- // In emulator, always resolve the private dir on C-drive
- driveChar = QLatin1Char('C');
-#else
- driveChar = QLatin1Char((proc.FileName())[0]);
-#endif
- proc.Close();
+ err = fs.Drive(driveInfo, drive);
+ }
+ if (err != KErrNone || (driveInfo.iDriveAtt & KDriveAttRom) || (driveInfo.iMediaAtt
+ & KMediaAttWriteProtected)) {
+ driveChar = fs.GetSystemDriveChar();
+ drive = fs.GetSystemDrive();
+ }
- driveChar = driveChar.toUpper();
+ qDriveChar = QChar(QLatin1Char(driveChar)).toUpper();
- TFileName privatePath;
- RFs& fs = qt_s60GetRFs();
- fs.PrivatePath(privatePath);
- appPath = qt_TDesC2QString(privatePath);
- appPath.prepend(QLatin1Char(':')).prepend(driveChar);
-
- // Create the appPath if it doesn't exist. Non-existing appPath will cause
- // Platform Security violations later on if the app doesn't have AllFiles capability.
- // Can't create appPath for ROM unfortunately, so applications meant for
- // ROM should always deploy something to their private dir to ensure appPath exists,
- // if the PlatSec violations are an issue.
- char driveDiff = QLatin1Char('Z').toLatin1() - driveChar.toLatin1();
- TInt driveId = EDriveZ - static_cast<TInt>(driveDiff);
- if (driveId != EDriveZ) {
- TInt err = fs.CreatePrivatePath(driveId);
- if (err != KErrNone)
- qWarning("QCoreApplication::applicationDirPath: Failed to create private path.");
- }
- }
+ TFileName privatePath;
+ fs.PrivatePath(privatePath);
+ appPath = qt_TDesC2QString(privatePath);
+ appPath.prepend(QLatin1Char(':')).prepend(qDriveChar);
+
+ // Create the appPath if it doesn't exist. Non-existing appPath will cause
+ // Platform Security violations later on if the app doesn't have AllFiles capability.
+ err = fs.CreatePrivatePath(drive);
+ if (err != KErrNone)
+ qWarning("QCoreApplication::applicationDirPath: Failed to create private path.");
- QFileInfo fi(appPath);
- d->cachedApplicationDirPath = fi.exists() ? fi.canonicalFilePath() : QString();
+ d->cachedApplicationDirPath = QFileInfo(appPath).path();
}
#else
d->cachedApplicationDirPath = QFileInfo(applicationFilePath()).path();
diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h
index b2df054..c44346c 100644
--- a/src/corelib/tools/qringbuffer_p.h
+++ b/src/corelib/tools/qringbuffer_p.h
@@ -147,9 +147,20 @@ public:
--tailBuffer;
head = 0;
}
+
+ if (isEmpty())
+ clear(); // try to minify/squeeze us
}
inline char *reserve(int bytes) {
+ // if this is a fresh empty QRingBuffer
+ if (bufferSize == 0) {
+ buffers[0].resize(qMax(basicBlockSize, bytes));
+ bufferSize += bytes;
+ tail = bytes;
+ return buffers[tailBuffer].data();
+ }
+
bufferSize += bytes;
// if there is already enough space, simply return.
@@ -208,6 +219,9 @@ public:
--tailBuffer;
tail = buffers.at(tailBuffer).size();
}
+
+ if (isEmpty())
+ clear(); // try to minify/squeeze us
}
inline bool isEmpty() const {
@@ -244,11 +258,10 @@ public:
}
inline void clear() {
- if(!buffers.isEmpty()) {
- buffers.erase(buffers.begin() + 1, buffers.end());
- if (buffers.at(0).size() != basicBlockSize)
- buffers[0].resize(basicBlockSize);
- }
+ buffers.erase(buffers.begin() + 1, buffers.end());
+ buffers[0].resize(0);
+ buffers[0].squeeze();
+
head = tail = 0;
tailBuffer = 0;
bufferSize = 0;
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 0145499..3249bb1 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -982,12 +982,10 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
QGraphicsItem *p = newParent;
while (p) {
if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
- // ### We really want the parent's focus scope item to point
- // to this item's focusItem...
- if (q_ptr->flags() & QGraphicsItem::ItemIsFocusScope)
- p->d_ptr->focusScopeItem = q_ptr;
- else
- p->d_ptr->focusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem;
+ p->d_ptr->focusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem;
+ // ### The below line might not make sense...
+ if (subFocusItem)
+ subFocusItem->d_ptr->clearSubFocus();
break;
}
p = p->d_ptr->parent;
@@ -2812,15 +2810,12 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
if (scene && scene->focusItem() == f)
return;
- // Update the child focus chain.
- setSubFocus();
-
// Update focus scope item ptr.
QGraphicsItem *p = parent;
while (p) {
if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
p->d_ptr->focusScopeItem = q_ptr;
- if (!q_ptr->isActive())
+ if (!q_ptr->isActive() || !p->focusItem())
return;
break;
}
@@ -2830,10 +2825,11 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
if (climb) {
while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible())
f = f->d_ptr->focusScopeItem;
- if (f != q_ptr)
- f->d_ptr->setSubFocus();
}
+ // Update the child focus chain.
+ f->d_ptr->setSubFocus();
+
// Update the scene's focus item.
if (scene) {
QGraphicsItem *p = q_ptr->panel();
@@ -2858,13 +2854,15 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
void QGraphicsItem::clearFocus()
{
// Pass focus to the closest parent focus scope.
- QGraphicsItem *p = d_ptr->parent;
- while (p) {
- if (p->flags() & ItemIsFocusScope) {
- p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false);
- return;
+ if (!d_ptr->inDestructor) {
+ QGraphicsItem *p = d_ptr->parent;
+ while (p) {
+ if (p->flags() & ItemIsFocusScope) {
+ p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false);
+ return;
+ }
+ p = p->d_ptr->parent;
}
- p = p->d_ptr->parent;
}
// Invisible items with focus must explicitly clear subfocus.
diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp
index 0e4df71..f9800bc 100644
--- a/src/gui/graphicsview/qgraphicslayout.cpp
+++ b/src/gui/graphicsview/qgraphicslayout.cpp
@@ -419,6 +419,24 @@ void QGraphicsLayout::widgetEvent(QEvent *e)
\sa itemAt(), count()
*/
+/*!
+ This function is a convenience function provided for custom layouts, and will go through
+ all items in the layout and reparent their graphics items to the closest QGraphicsWidget
+ ancestor of the layout.
+
+ If \a layoutItem is already in a different layout, it will be removed from that layout.
+
+ If custom layouts want special behaviour they can ignore to use this function, and implement
+ their own behaviour.
+
+ \sa graphicsItem()
+ */
+void QGraphicsLayout::addChildLayoutItem(QGraphicsLayoutItem *layoutItem)
+{
+ Q_D(QGraphicsLayout);
+ d->addChildLayoutItem(layoutItem);
+}
+
QT_END_NAMESPACE
#endif //QT_NO_GRAPHICSVIEW
diff --git a/src/gui/graphicsview/qgraphicslayout.h b/src/gui/graphicsview/qgraphicslayout.h
index e872980..e214a62 100644
--- a/src/gui/graphicsview/qgraphicslayout.h
+++ b/src/gui/graphicsview/qgraphicslayout.h
@@ -78,6 +78,7 @@ public:
protected:
QGraphicsLayout(QGraphicsLayoutPrivate &, QGraphicsLayoutItem *);
+ void addChildLayoutItem(QGraphicsLayoutItem *layoutItem);
private:
Q_DISABLE_COPY(QGraphicsLayout)
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index f6e0aaf..0655ecc 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -925,19 +925,19 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &scre
Q_Q(const QGraphicsScene);
QGraphicsView *view = widget ? qobject_cast<QGraphicsView *>(widget->parentWidget()) : 0;
if (!view)
- return q->items(scenePos, Qt::IntersectsItemShape, Qt::AscendingOrder, QTransform());
+ return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform());
const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1));
if (!view->isTransformed())
- return q->items(pointRect, Qt::IntersectsItemShape, Qt::AscendingOrder);
+ return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder);
const QTransform viewTransform = view->viewportTransform();
if (viewTransform.type() <= QTransform::TxScale) {
return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape,
- Qt::AscendingOrder, viewTransform);
+ Qt::DescendingOrder, viewTransform);
}
return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape,
- Qt::AscendingOrder, viewTransform);
+ Qt::DescendingOrder, viewTransform);
}
/*!
@@ -1584,7 +1584,7 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method)
d->indexMethod = method;
- QList<QGraphicsItem *> oldItems = d->index->items(Qt::AscendingOrder);
+ QList<QGraphicsItem *> oldItems = d->index->items(Qt::DescendingOrder);
delete d->index;
if (method == BspTreeIndex)
d->index = new QGraphicsSceneBspTreeIndex(this);
@@ -1693,7 +1693,7 @@ QRectF QGraphicsScene::itemsBoundingRect() const
QList<QGraphicsItem *> QGraphicsScene::items() const
{
Q_D(const QGraphicsScene);
- return d->index->items(Qt::AscendingOrder);
+ return d->index->items(Qt::DescendingOrder);
}
/*!
@@ -1724,7 +1724,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const
QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const
{
Q_D(const QGraphicsScene);
- return d->index->items(pos, Qt::IntersectsItemShape, Qt::AscendingOrder);
+ return d->index->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder);
}
/*!
@@ -1746,7 +1746,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const
QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSelectionMode mode) const
{
Q_D(const QGraphicsScene);
- return d->index->items(rectangle, mode, Qt::AscendingOrder);
+ return d->index->items(rectangle, mode, Qt::DescendingOrder);
}
/*!
@@ -1794,7 +1794,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSe
QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode) const
{
Q_D(const QGraphicsScene);
- return d->index->items(polygon, mode, Qt::AscendingOrder);
+ return d->index->items(polygon, mode, Qt::DescendingOrder);
}
/*!
@@ -1816,7 +1816,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS
QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const
{
Q_D(const QGraphicsScene);
- return d->index->items(path, mode, Qt::AscendingOrder);
+ return d->index->items(path, mode, Qt::DescendingOrder);
}
/*!
@@ -1928,7 +1928,7 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item,
// Does not support ItemIgnoresTransformations.
QList<QGraphicsItem *> tmp;
- foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::AscendingOrder)) {
+ foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::DescendingOrder)) {
if (item != itemInVicinity && item->collidesWithItem(itemInVicinity, mode))
tmp << itemInVicinity;
}
@@ -1972,7 +1972,7 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const
QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const
{
QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape,
- Qt::AscendingOrder, deviceTransform);
+ Qt::DescendingOrder, deviceTransform);
return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
}
@@ -2127,7 +2127,7 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectio
bool changed = false;
// Set all items in path to selected.
- foreach (QGraphicsItem *item, items(path, mode, Qt::AscendingOrder, deviceTransform)) {
+ foreach (QGraphicsItem *item, items(path, mode, Qt::DescendingOrder, deviceTransform)) {
if (item->flags() & QGraphicsItem::ItemIsSelectable) {
if (!item->isSelected())
changed = true;
@@ -2434,17 +2434,8 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Ensure that newly added items that have subfocus set, gain
// focus automatically if there isn't a focus item already.
- if (!d->focusItem) {
- if (item->focusItem() == item && item != d->lastFocusItem) {
- QGraphicsItem *fi = item->focusItem() ? item->focusItem() : item->focusScopeItem();
- if (fi) {
- QGraphicsItem *fsi;
- while ((fsi = fi->focusScopeItem()) && fsi->isVisible())
- fi = fsi;
- fi->setFocus();
- }
- }
- }
+ if (!d->focusItem && item != d->lastFocusItem && item->focusItem() == item)
+ item->focusItem()->setFocus();
d->updateInputMethodSensitivityInViews();
}
@@ -4380,7 +4371,7 @@ void QGraphicsScenePrivate::drawItems(QPainter *painter, const QTransform *const
if (viewTransform)
exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect);
}
- const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::DescendingOrder);
+ const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::AscendingOrder);
for (int i = 0; i < tli.size(); ++i)
drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget);
}
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
index 7c46144..e21183a 100644
--- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
@@ -480,23 +480,23 @@ void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList<QGraphicsItem *> *itemLi
return;
if (onlyTopLevelItems) {
- if (order == Qt::AscendingOrder)
+ if (order == Qt::DescendingOrder)
qSort(itemList->begin(), itemList->end(), qt_closestLeaf);
- else if (order == Qt::DescendingOrder)
+ else if (order == Qt::AscendingOrder)
qSort(itemList->begin(), itemList->end(), qt_notclosestLeaf);
return;
}
if (sortCacheEnabled) {
- if (order == Qt::AscendingOrder) {
+ if (order == Qt::DescendingOrder) {
qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache);
- } else if (order == Qt::DescendingOrder) {
+ } else if (order == Qt::AscendingOrder) {
qSort(itemList->begin(), itemList->end(), closestItemLast_withCache);
}
} else {
- if (order == Qt::AscendingOrder) {
+ if (order == Qt::DescendingOrder) {
qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache);
- } else if (order == Qt::DescendingOrder) {
+ } else if (order == Qt::AscendingOrder) {
qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache);
}
}
@@ -605,7 +605,7 @@ QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::estimateTopLevelItems(const Q
}
/*!
- \fn QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const;
+ \fn QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order = Qt::DescendingOrder) const;
Return all items in the BSP index and sort them using \a order.
*/
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
index cf85ba8..0a86bb7 100644
--- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
@@ -81,7 +81,7 @@ public:
QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const;
QList<QGraphicsItem *> estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const;
- QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const;
+ QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const;
int bspTreeDepth();
void setBspTreeDepth(int depth);
diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp
index e01ad10..3ea957f 100644
--- a/src/gui/graphicsview/qgraphicssceneindex.cpp
+++ b/src/gui/graphicsview/qgraphicssceneindex.cpp
@@ -542,7 +542,7 @@ QList<QGraphicsItem *> QGraphicsSceneIndex::estimateTopLevelItems(const QRectF &
Q_UNUSED(rect);
QGraphicsScenePrivate *scened = d->scene->d_func();
scened->ensureSortedTopLevelItems();
- if (order == Qt::AscendingOrder) {
+ if (order == Qt::DescendingOrder) {
QList<QGraphicsItem *> sorted;
for (int i = scened->topLevelItems.size() - 1; i >= 0; --i)
sorted << scened->topLevelItems.at(i);
@@ -552,7 +552,7 @@ QList<QGraphicsItem *> QGraphicsSceneIndex::estimateTopLevelItems(const QRectF &
}
/*!
- \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const
+ \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::DescendingOrder) const
This pure virtual function all items in the index and sort them using
\a order.
diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h
index ab7b38c..768c724 100644
--- a/src/gui/graphicsview/qgraphicssceneindex_p.h
+++ b/src/gui/graphicsview/qgraphicssceneindex_p.h
@@ -88,7 +88,7 @@ public:
QGraphicsScene *scene() const;
- virtual QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const = 0;
+ virtual QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const = 0;
virtual QList<QGraphicsItem *> items(const QPointF &pos, Qt::ItemSelectionMode mode,
Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
virtual QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode,
@@ -154,10 +154,10 @@ inline void QGraphicsSceneIndexPrivate::items_helper(const QRectF &rect, QGraphi
Qt::ItemSelectionMode mode, Qt::SortOrder order) const
{
Q_Q(const QGraphicsSceneIndex);
- const QList<QGraphicsItem *> tli = q->estimateTopLevelItems(rect, Qt::DescendingOrder);
+ const QList<QGraphicsItem *> tli = q->estimateTopLevelItems(rect, Qt::AscendingOrder);
for (int i = 0; i < tli.size(); ++i)
recursive_items_helper(tli.at(i), rect, intersector, items, viewTransform, mode, order);
- if (order == Qt::AscendingOrder) {
+ if (order == Qt::DescendingOrder) {
const int n = items->size();
for (int i = 0; i < n / 2; ++i)
items->swap(i, n - i - 1);
diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp
index 70fed64..d6faf05 100644
--- a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp
+++ b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp
@@ -62,7 +62,7 @@
*/
/*!
- \fn QList<QGraphicsItem *> QGraphicsSceneLinearIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const;
+ \fn QList<QGraphicsItem *> QGraphicsSceneLinearIndex::items(Qt::SortOrder order = Qt::DescendingOrder) const;
Return all items in the index and sort them using \a order.
*/
diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h
index 4c4aa9f..0aaee14 100644
--- a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h
+++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h
@@ -76,7 +76,7 @@ public:
QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0) : QGraphicsSceneIndex(scene)
{ }
- QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const
+ QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const
{ Q_UNUSED(order); return m_items; }
virtual QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index b0829c5..98b2c9c 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -971,7 +971,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg
*allItems = true;
// All items are guaranteed within the exposed region.
- return scene->items(Qt::DescendingOrder);
+ return scene->items(Qt::AscendingOrder);
}
// Step 2) If the expose region is a simple rect and the view is only
@@ -981,7 +981,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg
if (simpleRectLookup) {
return scene->items(exposedRegionSceneBounds,
Qt::IntersectsItemBoundingRect,
- Qt::DescendingOrder, viewTransform);
+ Qt::AscendingOrder, viewTransform);
}
// If the region is complex or the view has a complex transform, adjust
@@ -993,7 +993,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg
const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion)));
return scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect,
- Qt::DescendingOrder, viewTransform);
+ Qt::AscendingOrder, viewTransform);
}
/*!
@@ -2055,13 +2055,13 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPoint &pos) const
QTransform xinv = viewportTransform().inverted();
return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)),
Qt::IntersectsItemShape,
- Qt::AscendingOrder,
+ Qt::DescendingOrder,
viewportTransform());
}
// Use the polygon version
return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1),
Qt::IntersectsItemShape,
- Qt::AscendingOrder,
+ Qt::DescendingOrder,
viewportTransform());
}
@@ -2089,7 +2089,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QRect &rect, Qt::ItemSelection
Q_D(const QGraphicsView);
if (!d->scene)
return QList<QGraphicsItem *>();
- return d->scene->items(mapToScene(rect), mode, Qt::AscendingOrder, viewportTransform());
+ return d->scene->items(mapToScene(rect), mode, Qt::DescendingOrder, viewportTransform());
}
/*!
@@ -2117,7 +2117,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPolygon &polygon, Qt::ItemSel
Q_D(const QGraphicsView);
if (!d->scene)
return QList<QGraphicsItem *>();
- return d->scene->items(mapToScene(polygon), mode, Qt::AscendingOrder, viewportTransform());
+ return d->scene->items(mapToScene(polygon), mode, Qt::DescendingOrder, viewportTransform());
}
/*!
@@ -2137,7 +2137,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPainterPath &path, Qt::ItemSe
Q_D(const QGraphicsView);
if (!d->scene)
return QList<QGraphicsItem *>();
- return d->scene->items(mapToScene(path), mode, Qt::AscendingOrder, viewportTransform());
+ return d->scene->items(mapToScene(path), mode, Qt::DescendingOrder, viewportTransform());
}
/*!
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 2ed65ea..a891637 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -161,10 +161,8 @@ public:
#endif
#if defined(Q_OS_SYMBIAN)
- enum ConversionMode { CopyData, DuplicateHandle };
-
- CFbsBitmap *toSymbianCFbsBitmap(ConversionMode mode = DuplicateHandle) const;
- static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap, ConversionMode mode = DuplicateHandle);
+ CFbsBitmap *toSymbianCFbsBitmap() const;
+ static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap);
RSgImage* toSymbianRSgImage() const;
static QPixmap fromSymbianRSgImage(RSgImage *sgImage);
#endif
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 303e923..cab6116 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -297,231 +297,55 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h)
}
/*!
- \enum QPixmap::ConversionMode
-
- \bold{Symbian only:} This enum defines how the conversion between \c
- CFbsBitmap and QPixmap is performed.
-
- \warning This enum is only available on Symbian.
-
- \value CopyData Copied CFbsBitmap data.
-
- \value DuplicateHandle Duplicates CFbsBitmap handle. This also means
- that pixmap data will be explicitly shared.
-
- \sa fromSymbianCFbsBitmap(), toSymbianCFbsBitmap()
-*/
-
-
-/*!
- \fn CFbsBitmap *QPixmap::toSymbianCFbsBitmap(ConversionMode mode)
+ \fn CFbsBitmap *QPixmap::toSymbianCFbsBitmap()
\since 4.6
- Creates \c CFbsBitmap that is equivalent to the QPixmap, based on
- the given \a mode. If the creation then this function returns 0.
+ Creates a \c CFbsBitmap that is equivalent to the QPixmap. Internally this
+ function will try to duplicate the handle instead of copying the data,
+ however in scenarios where this is not possible the data will be copied.
+ If the creation fails or the pixmap is null, then this function returns 0.
It is the caller's responsibility to release the \c CFbsBitmap data
after use either by deleting the bitmap or calling \c Reset().
- \warning On S60 3.1 and S60 3.2 conversion mode will always be CopyData
- if QPixmap pixels have alpha values.
+ \warning On S60 3.1 and S60 3.2, semi-transparent pixmaps are always copied
+ and not duplicated.
\warning This function is only available on Symbian OS.
\sa fromSymbianCFbsBitmap()
*/
-CFbsBitmap *QPixmap::toSymbianCFbsBitmap(ConversionMode mode) const
+CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const
{
- QS60PixmapData *s60data = static_cast<QS60PixmapData *>(data.data());
-
- if (isNull() || !s60data->cfbsBitmap)
+ QPixmapData *data = pixmapData();
+ if (data->isNull())
return 0;
- bool convertToArgb32 = false;
-
- QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
- if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) {
- // Convert argb32_premultiplied to argb32 since Symbian 9.2 and Symbian 9.3 do
- // not support premultipied format.
-
- if (s60data->image.format() == QImage::Format_ARGB32_Premultiplied) {
- mode = CopyData;
- convertToArgb32 = true;
- }
- }
-
- CFbsBitmap *bitmap = 0;
-
- TDisplayMode displayMode = s60data->cfbsBitmap->DisplayMode();
-
- if(displayMode == EGray2) {
- //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
- //So invert mono bitmaps so that masks work correctly.
- s60data->image.invertPixels();
- mode = CopyData;
- }
-
- if (mode == CopyData) {
- QImage source;
-
- if (convertToArgb32) {
- source = s60data->image.convertToFormat(QImage::Format_ARGB32);
- displayMode = EColor16MA;
- } else {
- source = s60data->image;
- }
-
- CFbsBitmap *newBitmap = createSymbianCFbsBitmap(TSize(source.width(), source.height()), displayMode);
- const uchar *sptr = source.bits();
- s60data->symbianBitmapDataAccess->beginDataAccess(newBitmap);
-
- uchar *dptr = (uchar*)newBitmap->DataAddress();
- Mem::Copy(dptr, sptr, source.numBytes());
-
- s60data->symbianBitmapDataAccess->endDataAccess(newBitmap);
-
- bitmap = newBitmap;
- } else {
-
- QT_TRAP_THROWING(bitmap = new (ELeave) CFbsBitmap);
-
- TInt err = bitmap->Duplicate(s60data->cfbsBitmap->Handle());
- if (err != KErrNone) {
- qWarning("Could not duplicate CFbsBitmap");
- delete bitmap;
- bitmap = 0;
- }
- }
-
- if(displayMode == EGray2) {
- // restore pixels
- s60data->image.invertPixels();
- }
-
- return bitmap;
+ return reinterpret_cast<CFbsBitmap*>(data->toNativeType(QPixmapData::FbsBitmap));
}
/*!
- \fn QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap, ConversionMode mode)
+ \fn QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
\since 4.6
- Creates a QPixmap from native \c CFbsBitmap \a bitmap. The conversion
- is based on the specified \a mode. Conversion mode is always QPixmap::CopyData
- if given \a bitmap does not have display mode of TDisplayMode::EGray2,
- \c TDisplayMode::EColor16MU or \c TDisplayMode::EColor16MAP.
-
+ Creates a QPixmap from a \c CFbsBitmap \a bitmap. Internally this function
+ will try to duplicate the bitmap handle instead of copying the data, however
+ in scenarios where this is not possible the data will be copied.
+ To be sure that QPixmap does not modify your original instance, you should
+ make a copy of your \c CFbsBitmap before calling this function.
If the CFbsBitmap is not valid this function will return a null QPixmap.
\warning This function is only available on Symbian OS.
\sa toSymbianCFbsBitmap(), {QPixmap#Pixmap Conversion}{Pixmap Conversion}
*/
-QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap, ConversionMode mode)
+QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
{
- if (bitmap) {
-
- bool deleteSourceBitmap = false;
-
-#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
-
- // Rasterize extended bitmaps
-
- TUid extendedBitmapType = bitmap->ExtendedBitmapType();
- if (extendedBitmapType != KNullUid) {
- CFbsBitmap *rasterBitmap = createSymbianCFbsBitmap(bitmap->SizeInPixels(), EColor16MA);
-
- CFbsBitmapDevice *rasterBitmapDev = 0;
- QT_TRAP_THROWING(rasterBitmapDev = CFbsBitmapDevice::NewL(rasterBitmap));
-
- CFbsBitGc *rasterBitmapGc = 0;
- TInt err = rasterBitmapDev->CreateContext(rasterBitmapGc);
- if (err != KErrNone) {
- delete rasterBitmap;
- delete rasterBitmapDev;
- rasterBitmapDev = 0;
- return QPixmap();
- }
-
- rasterBitmapGc->BitBlt(TPoint( 0, 0), bitmap);
-
- bitmap = rasterBitmap;
-
- delete rasterBitmapDev;
- delete rasterBitmapGc;
-
- rasterBitmapDev = 0;
- rasterBitmapGc = 0;
-
- deleteSourceBitmap = true;
- }
-#endif
-
-
- deleteSourceBitmap = bitmap->IsCompressedInRAM();
- CFbsBitmap *sourceBitmap = uncompress(bitmap);
-
- TDisplayMode displayMode = sourceBitmap->DisplayMode();
- QImage::Format format = qt_TDisplayMode2Format(displayMode);
-
- QImage::Format opaqueFormat = QNativeImage::systemFormat();
- QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
-
- if (format != opaqueFormat && format != alphaFormat && format != QImage::Format_MonoLSB)
- mode = CopyData;
-
-
- QPixmapData::PixelType type = (format!=QImage::Format_MonoLSB)
- ? QPixmapData::PixmapType
- : QPixmapData::BitmapType;
-
- QS60PixmapData *pixmapData = 0;
-
- if (mode == CopyData) {
-
- TSize size = sourceBitmap->SizeInPixels();
-
- QSymbianBitmapDataAccess da;
- da.beginDataAccess(sourceBitmap);
- uchar *bytes = (uchar*)sourceBitmap->DataAddress();
- QImage img = QImage(bytes, size.iWidth, size.iHeight, format);
- da.endDataAccess(sourceBitmap);
-
- pixmapData = new QS60PixmapData(type);
- pixmapData->fromImage(img, Qt::AutoColor);
-
- if(deleteSourceBitmap)
- delete sourceBitmap;
-
- if(displayMode == EGray2) {
- //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
- //So invert mono bitmaps so that masks work correctly.
- pixmapData->image.invertPixels();
- }
- } else {
- CFbsBitmap* duplicate = 0;
- QT_TRAP_THROWING(duplicate = new (ELeave) CFbsBitmap);
-
- TInt err = duplicate->Duplicate(sourceBitmap->Handle());
- if (err != KErrNone) {
- qWarning("Could not duplicate CFbsBitmap");
-
- if(deleteSourceBitmap)
- delete sourceBitmap;
-
- delete duplicate;
- return QPixmap();
- }
-
- pixmapData = new QS60PixmapData(type);
- pixmapData->fromSymbianBitmap(duplicate);
-
- if(deleteSourceBitmap)
- delete sourceBitmap;
- }
-
- return QPixmap(pixmapData);
- }
+ if (!bitmap)
+ return QPixmap();
- return QPixmap();
+ QPixmap pixmap;
+ pixmap.pixmapData()->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::FbsBitmap);
+ return pixmap;
}
QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
@@ -921,7 +745,7 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage)
return QPixmap();
QPixmap pixmap;
- pixmap.pixmapData()->fromRSgImage(sgImage);
+ pixmap.pixmapData()->fromNativeType(reinterpret_cast<void*>(sgImage), QPixmapData::SgImage);
return pixmap;
}
@@ -949,9 +773,193 @@ RSgImage *QPixmap::toSymbianRSgImage() const
if (isNull())
return 0;
- RSgImage *sgImage = pixmapData()->toRSgImage();
+ RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmapData()->toNativeType(QPixmapData::SgImage));
return sgImage;
}
+void* QS60PixmapData::toNativeType(NativeType type)
+{
+ if (type == QPixmapData::SgImage) {
+ return 0;
+ } else if (type == QPixmapData::FbsBitmap) {
+
+ if (isNull() || !cfbsBitmap)
+ return 0;
+
+ bool convertToArgb32 = false;
+ bool needsCopy = false;
+
+ QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
+ if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) {
+ // Convert argb32_premultiplied to argb32 since Symbian 9.2 and Symbian 9.3 do
+ // not support premultipied format.
+
+ if (image.format() == QImage::Format_ARGB32_Premultiplied) {
+ needsCopy = true;
+ convertToArgb32 = true;
+ }
+ }
+
+ CFbsBitmap *bitmap = 0;
+
+ TDisplayMode displayMode = cfbsBitmap->DisplayMode();
+
+ if(displayMode == EGray2) {
+ //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
+ //So invert mono bitmaps so that masks work correctly.
+ image.invertPixels();
+ needsCopy = true;
+ }
+
+ if (needsCopy) {
+ QImage source;
+
+ if (convertToArgb32) {
+ source = image.convertToFormat(QImage::Format_ARGB32);
+ displayMode = EColor16MA;
+ } else {
+ source = image;
+ }
+
+ CFbsBitmap *newBitmap = createSymbianCFbsBitmap(TSize(source.width(), source.height()), displayMode);
+ const uchar *sptr = source.bits();
+ symbianBitmapDataAccess->beginDataAccess(newBitmap);
+
+ uchar *dptr = (uchar*)newBitmap->DataAddress();
+ Mem::Copy(dptr, sptr, source.numBytes());
+
+ symbianBitmapDataAccess->endDataAccess(newBitmap);
+
+ bitmap = newBitmap;
+ } else {
+
+ QT_TRAP_THROWING(bitmap = new (ELeave) CFbsBitmap);
+
+ TInt err = bitmap->Duplicate(cfbsBitmap->Handle());
+ if (err != KErrNone) {
+ qWarning("Could not duplicate CFbsBitmap");
+ delete bitmap;
+ bitmap = 0;
+ }
+ }
+
+ if(displayMode == EGray2) {
+ // restore pixels
+ image.invertPixels();
+ }
+
+ return reinterpret_cast<void*>(bitmap);
+
+ }
+
+ return 0;
+}
+
+void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
+{
+ if (nativeType == QPixmapData::SgImage) {
+ return;
+ } else if (nativeType == QPixmapData::FbsBitmap && pixmap) {
+
+ CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap);
+
+ bool deleteSourceBitmap = false;
+ bool needsCopy = false;
+
+#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
+
+ // Rasterize extended bitmaps
+
+ TUid extendedBitmapType = bitmap->ExtendedBitmapType();
+ if (extendedBitmapType != KNullUid) {
+ CFbsBitmap *rasterBitmap = createSymbianCFbsBitmap(bitmap->SizeInPixels(), EColor16MA);
+
+ CFbsBitmapDevice *rasterBitmapDev = 0;
+ QT_TRAP_THROWING(rasterBitmapDev = CFbsBitmapDevice::NewL(rasterBitmap));
+
+ CFbsBitGc *rasterBitmapGc = 0;
+ TInt err = rasterBitmapDev->CreateContext(rasterBitmapGc);
+ if (err != KErrNone) {
+ delete rasterBitmap;
+ delete rasterBitmapDev;
+ rasterBitmapDev = 0;
+ return;
+ }
+
+ rasterBitmapGc->BitBlt(TPoint( 0, 0), bitmap);
+
+ bitmap = rasterBitmap;
+
+ delete rasterBitmapDev;
+ delete rasterBitmapGc;
+
+ rasterBitmapDev = 0;
+ rasterBitmapGc = 0;
+
+ deleteSourceBitmap = true;
+ }
+#endif
+
+
+ deleteSourceBitmap = bitmap->IsCompressedInRAM();
+ CFbsBitmap *sourceBitmap = uncompress(bitmap);
+
+ TDisplayMode displayMode = sourceBitmap->DisplayMode();
+ QImage::Format format = qt_TDisplayMode2Format(displayMode);
+
+ QImage::Format opaqueFormat = QNativeImage::systemFormat();
+ QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
+
+ if (format != opaqueFormat && format != alphaFormat && format != QImage::Format_MonoLSB)
+ needsCopy = true;
+
+
+ type = (format != QImage::Format_MonoLSB)
+ ? QPixmapData::PixmapType
+ : QPixmapData::BitmapType;
+
+ if (needsCopy) {
+
+ TSize size = sourceBitmap->SizeInPixels();
+
+ QSymbianBitmapDataAccess da;
+ da.beginDataAccess(sourceBitmap);
+ uchar *bytes = (uchar*)sourceBitmap->DataAddress();
+ QImage img = QImage(bytes, size.iWidth, size.iHeight, format);
+ da.endDataAccess(sourceBitmap);
+
+ fromImage(img, Qt::AutoColor);
+
+ if(deleteSourceBitmap)
+ delete sourceBitmap;
+
+ if(displayMode == EGray2) {
+ //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
+ //So invert mono bitmaps so that masks work correctly.
+ image.invertPixels();
+ }
+ } else {
+ CFbsBitmap* duplicate = 0;
+ QT_TRAP_THROWING(duplicate = new (ELeave) CFbsBitmap);
+
+ TInt err = duplicate->Duplicate(sourceBitmap->Handle());
+ if (err != KErrNone) {
+ qWarning("Could not duplicate CFbsBitmap");
+
+ if(deleteSourceBitmap)
+ delete sourceBitmap;
+
+ delete duplicate;
+ return;
+ }
+
+ fromSymbianBitmap(duplicate);
+
+ if(deleteSourceBitmap)
+ delete sourceBitmap;
+ }
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index 21f1bb3..4498c05 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -66,17 +66,17 @@ class QSymbianBitmapDataAccess;
class QSymbianFbsHeapLock
{
public:
-
+
enum LockAction {
Unlock
};
-
+
explicit QSymbianFbsHeapLock(LockAction a);
~QSymbianFbsHeapLock();
- void relock();
-
+ void relock();
+
private:
-
+
LockAction action;
bool wasLocked;
};
@@ -102,13 +102,16 @@ public:
void beginDataAccess();
void endDataAccess(bool readOnly=false) const;
+ void* toNativeType(NativeType type);
+ void fromNativeType(void* pixmap, NativeType type);
+
private:
- void release();
- void fromSymbianBitmap(CFbsBitmap* bitmap);
- bool initSymbianBitmapContext();
+ void release();
+ void fromSymbianBitmap(CFbsBitmap* bitmap);
+ bool initSymbianBitmapContext();
QSymbianBitmapDataAccess *symbianBitmapDataAccess;
-
+
CFbsBitmap *cfbsBitmap;
CFbsBitmapDevice *bitmapDevice;
CBitmapContext *bitmapContext;
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index a9bcca2..1b61484 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -387,12 +387,30 @@ QPixmap QPixmap::fromWinHICON(HICON icon)
ReleaseDC(0, screenDevice);
ICONINFO iconinfo;
- bool result = GetIconInfo(icon, &iconinfo); //x and y Hotspot describes the icon center
+ bool result = GetIconInfo(icon, &iconinfo);
if (!result)
qWarning("QPixmap::fromWinHICON(), failed to GetIconInfo()");
- int w = iconinfo.xHotspot * 2;
- int h = iconinfo.yHotspot * 2;
+ int w = 0;
+ int h = 0;
+ if (!iconinfo.xHotspot || !iconinfo.yHotspot) {
+ // We could not retrieve the icon size via GetIconInfo,
+ // so we try again using the icon bitmap.
+ BITMAP bm;
+ int result = GetObject(iconinfo.hbmColor, sizeof(BITMAP), &bm);
+ if (!result) result = GetObject(iconinfo.hbmMask, sizeof(BITMAP), &bm);
+ if (!result) {
+ qWarning("QPixmap::fromWinHICON(), failed to retrieve icon size");
+ return QPixmap();
+ }
+ w = bm.bmWidth;
+ h = bm.bmHeight;
+ } else {
+ // x and y Hotspot describes the icon center
+ w = iconinfo.xHotspot * 2;
+ h = iconinfo.yHotspot * 2;
+ }
+ const DWORD dwImageSize = w * h * 4;
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(bmi));
@@ -402,44 +420,44 @@ QPixmap QPixmap::fromWinHICON(HICON icon)
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
- bmi.bmiHeader.biSizeImage = size*size*4;
+ bmi.bmiHeader.biSizeImage = dwImageSize;
uchar* bits;
HBITMAP winBitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &bits, 0, 0);
if (winBitmap )
- memset(bits, 0xff, size*size*4);
+ memset(bits, 0xff, dwImageSize);
if (!winBitmap) {
qWarning("QPixmap::fromWinHICON(), failed to CreateDIBSection()");
return QPixmap();
}
HGDIOBJ oldhdc = (HBITMAP)SelectObject(hdc, winBitmap);
- if (!DrawIconEx( hdc, 0, 0, icon, size, size, 0, 0, DI_NORMAL))
+ if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_NORMAL))
qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()");
uint mask = 0xff000000;
// Create image and copy data into image.
- QImage image(size, size, QImage::Format_ARGB32);
+ QImage image(w, h, QImage::Format_ARGB32);
if (!image.isNull()) { // failed to alloc?
- int bytes_per_line = size * sizeof(QRgb);
- for (int y=0; y<size; ++y) {
+ int bytes_per_line = w * sizeof(QRgb);
+ for (int y=0; y < h; ++y) {
QRgb *dest = (QRgb *) image.scanLine(y);
const QRgb *src = (const QRgb *) (bits + y * bytes_per_line);
- for (int x=0; x<size; ++x) {
+ for (int x=0; x < w; ++x) {
dest[x] = src[x];
}
}
}
- if (!DrawIconEx( hdc, 0, 0, icon, size, size, 0, 0, DI_MASK))
+ if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_MASK))
qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()");
if (!image.isNull()) { // failed to alloc?
- int bytes_per_line = size * sizeof(QRgb);
- for (int y=0; y<size; ++y) {
+ int bytes_per_line = w * sizeof(QRgb);
+ for (int y=0; y < h; ++y) {
QRgb *dest = (QRgb *) image.scanLine(y);
const QRgb *src = (const QRgb *) (bits + y * bytes_per_line);
- for (int x=0; x<size; ++x) {
+ for (int x=0; x < w; ++x) {
if (!src[x])
dest[x] = dest[x] | mask;
}
diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp
index 65899a4..93fc2eb 100644
--- a/src/gui/image/qpixmapdata.cpp
+++ b/src/gui/image/qpixmapdata.cpp
@@ -224,14 +224,15 @@ QImage* QPixmapData::buffer()
}
#if defined(Q_OS_SYMBIAN)
-RSgImage* QPixmapData::toRSgImage()
+void* QPixmapData::toNativeType(NativeType /* type */)
{
return 0;
}
-void QPixmapData::fromRSgImage(RSgImage* rsgImage)
+void QPixmapData::fromNativeType(void* /* pixmap */, NativeType /* typre */)
{
return;
}
#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h
index 5920a06..3e85236 100644
--- a/src/gui/image/qpixmapdata_p.h
+++ b/src/gui/image/qpixmapdata_p.h
@@ -56,10 +56,6 @@
#include <QtGui/qpixmap.h>
#include <QtCore/qatomic.h>
-#if defined(Q_OS_SYMBIAN)
-class RSgImage;
-#endif
-
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QPixmapData
@@ -70,6 +66,12 @@ public:
// Must match QPixmap::Type
PixmapType, BitmapType
};
+#if defined(Q_OS_SYMBIAN)
+ enum NativeType {
+ FbsBitmap,
+ SgImage
+ };
+#endif
enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass,
OpenGLClass, OpenVGClass, CustomClass = 1024 };
@@ -114,8 +116,8 @@ public:
inline bool isNull() const { return is_null; }
#if defined(Q_OS_SYMBIAN)
- virtual RSgImage* toRSgImage();
- virtual void fromRSgImage(RSgImage* rsgImage);
+ virtual void* toNativeType(NativeType type);
+ virtual void fromNativeType(void* pixmap, NativeType type);
#endif
protected:
@@ -129,6 +131,7 @@ private:
friend class QPixmap;
friend class QGLContextPrivate;
friend class QX11PixmapData;
+ friend class QS60PixmapData;
friend class QGLTextureCache; //Needs to check the reference count
friend class QExplicitlySharedDataPointer<QPixmapData>;
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index b198ae1..fc55a0f 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -98,7 +98,9 @@ QCoeFepInputContext::~QCoeFepInputContext()
void QCoeFepInputContext::reset()
{
- CCoeEnv::Static()->Fep()->CancelTransaction();
+ CCoeFep* fep = CCoeEnv::Static()->Fep();
+ if (fep)
+ fep->CancelTransaction();
}
void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType)
@@ -626,7 +628,9 @@ void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian)
m_isEditing = false;
if (!triggeredBySymbian) {
- CCoeEnv::Static()->Fep()->CancelTransaction();
+ CCoeFep* fep = CCoeEnv::Static()->Fep();
+ if (fep)
+ fep->CancelTransaction();
}
}
diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp
index 26e1557..2973741 100644
--- a/src/gui/itemviews/qdirmodel.cpp
+++ b/src/gui/itemviews/qdirmodel.cpp
@@ -190,6 +190,9 @@ void QDirModelPrivate::invalidate()
\ingroup model-view
+ \note The usage of QDirModel is not recommended anymore. The
+ QFileSystemModel class is a more performant alternative.
+
This class provides access to the local filesystem, providing functions
for renaming and removing files and directories, and for creating new
directories. In the simplest case, it can be used with a suitable display
@@ -228,10 +231,7 @@ void QDirModelPrivate::invalidate()
\note QDirModel requires an instance of a GUI application.
- \note The usage of QDirModel is not recommended anymore. The
- QFileSystemModel class is a more performant alternative.
-
- \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel
+ \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel,
{Dir View Example}, {Model Classes}
*/
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index a4cebe3..9b0b00f 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -2429,7 +2429,7 @@ void QIconModeViewBase::appendHiddenRow(int row)
void QIconModeViewBase::removeHiddenRow(int row)
{
- QCommonListViewBase::appendHiddenRow(row);
+ QCommonListViewBase::removeHiddenRow(row);
if (row >= 0 && row < items.count()) //insert item
tree.insertLeaf(items.at(row).rect(), row);
}
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 707caaa..aec21fd 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -576,6 +576,11 @@ public:
void _q_readRX71MultiTouchEvents();
#endif
+#if defined(Q_WS_S60)
+ int maxTouchPressure;
+ QList<QTouchEvent::TouchPoint> appAllTouchPoints;
+#endif
+
private:
#ifdef Q_WS_QWS
QMap<const QScreen*, QRect> maxWindowRects;
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 4ca9459..1c198f9 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -368,8 +368,77 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons
m_previousEventLongTap = true;
}
+void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent *event)
+{
+ QApplicationPrivate *d = QApplicationPrivate::instance();
+
+ QRect screenGeometry = qApp->desktop()->screenGeometry(qwidget);
+
+ while (d->appAllTouchPoints.count() <= event->PointerNumber())
+ d->appAllTouchPoints.append(QTouchEvent::TouchPoint(d->appAllTouchPoints.count()));
+
+ Qt::TouchPointStates allStates = 0;
+ for (int i = 0; i < d->appAllTouchPoints.count(); ++i) {
+ QTouchEvent::TouchPoint &touchPoint = d->appAllTouchPoints[i];
+
+ if (touchPoint.id() == event->PointerNumber()) {
+ Qt::TouchPointStates state;
+ switch (event->iType) {
+ case TPointerEvent::EButton1Down:
+ case TPointerEvent::EEnterHighPressure:
+ state = Qt::TouchPointPressed;
+ break;
+ case TPointerEvent::EButton1Up:
+ case TPointerEvent::EExitCloseProximity:
+ state = Qt::TouchPointReleased;
+ break;
+ case TPointerEvent::EDrag:
+ state = Qt::TouchPointMoved;
+ break;
+ default:
+ // how likely is this to happen?
+ state = Qt::TouchPointStationary;
+ break;
+ }
+ if (event->PointerNumber() == 0)
+ state |= Qt::TouchPointPrimary;
+ touchPoint.setState(state);
+
+ QPointF screenPos = QPointF(event->iPosition.iX, event->iPosition.iY);
+ touchPoint.setScreenPos(screenPos);
+ touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(),
+ screenPos.y() / screenGeometry.height()));
+
+ touchPoint.setPressure(event->Pressure() / qreal(d->maxTouchPressure));
+ } else if (touchPoint.state() != Qt::TouchPointReleased) {
+ // all other active touch points should be marked as stationary
+ touchPoint.setState(Qt::TouchPointStationary);
+ }
+
+ allStates |= touchPoint.state();
+ }
+
+ if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased) {
+ // all touch points released
+ d->appAllTouchPoints.clear();
+ }
+
+ QApplicationPrivate::translateRawTouchEvent(qwidget,
+ QTouchEvent::TouchScreen,
+ d->appAllTouchPoints);
+}
+
void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
{
+ if (pEvent.IsAdvancedPointerEvent()) {
+ const TAdvancedPointerEvent *advancedPointerEvent = pEvent.AdvancedPointerEvent();
+ translateAdvancedPointerEvent(advancedPointerEvent);
+ if (advancedPointerEvent->PointerNumber() != 0) {
+ // only send mouse events for the first touch point
+ return;
+ }
+ }
+
m_longTapDetector->PointerEventL(pEvent);
QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent));
}
@@ -1480,9 +1549,12 @@ TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym)
}
}
-
void QApplicationPrivate::initializeMultitouch_sys()
-{ }
+{
+ if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone)
+ maxTouchPressure = KMaxTInt;
+}
+
void QApplicationPrivate::cleanupMultitouch_sys()
{ }
diff --git a/src/gui/kernel/qsound_qws.cpp b/src/gui/kernel/qsound_qws.cpp
index 33a0922..8595faa 100644
--- a/src/gui/kernel/qsound_qws.cpp
+++ b/src/gui/kernel/qsound_qws.cpp
@@ -279,7 +279,7 @@ QAuBucketQWS::QAuBucketQWS( QAuServerQWS *server, QSound *sound, QObject* parent
sound->setObjectName( m_id.toString() );
- m_channel = new QCopChannel(QLatin1String("QPE/QSound/") + m_id ), this );
+ m_channel = new QCopChannel(QLatin1String("QPE/QSound/") + m_id, this );
connect( m_channel, SIGNAL(received(QString,QByteArray)),
this, SLOT(processMessage(QString,QByteArray)) );
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 905adc2..3a2dd2b 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -169,6 +169,7 @@ private:
TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent);
bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent);
void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
+ void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event);
private:
QWidget *qwidget;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index e68a72d..53ef682 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -2106,6 +2106,13 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus
painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
}
#endif // Q_WS_MAC
+
+ } else if (brush.gradient()
+ && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) {
+ painter->save();
+ painter->setClipRegion(rgn);
+ painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush);
+ painter->restore();
} else {
const QVector<QRect> &rects = rgn.rects();
for (int i = 0; i < rects.size(); ++i)
@@ -2146,7 +2153,6 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
if (q->autoFillBackground())
fillRegion(painter, rgn, autoFillBrush);
-
if (q->testAttribute(Qt::WA_StyledBackground)) {
painter->setClipRegion(rgn);
QStyleOption opt;
@@ -4991,7 +4997,7 @@ QGraphicsEffect *QWidget::graphicsEffect() const
/*!
\brief The setGraphicsEffect function is for setting the widget's graphics effect.
-
+
Sets \a effect as the widget's effect. If there already is an effect installed
on this widget, QWidget will delete the existing effect before installing
the new \a effect.
@@ -10391,7 +10397,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
case Qt::WA_AcceptTouchEvents:
-#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
+#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_S60)
if (on)
d->registerTouchWindow();
#endif
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 5a9c48c..296c5b1 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -693,6 +693,7 @@ public:
static QWidget *keyboardGrabber;
void s60UpdateIsOpaque();
void reparentChildren();
+ void registerTouchWindow();
#endif
};
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 4fef020..2e6139b 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -299,6 +299,9 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
destroyw->ControlEnv()->AppUi()->RemoveFromStack(destroyw);
CBase::Delete(destroyw);
}
+
+ if (q->testAttribute(Qt::WA_AcceptTouchEvents))
+ registerTouchWindow();
}
@@ -800,6 +803,15 @@ void QWidgetPrivate::setMask_sys(const QRegion& /* region */)
}
+void QWidgetPrivate::registerTouchWindow()
+{
+ Q_Q(QWidget);
+ if (q->testAttribute(Qt::WA_WState_Created) && q->windowType() != Qt::Desktop) {
+ RWindow *rwindow = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
+ rwindow->EnableAdvancedPointers();
+ }
+}
+
int QWidget::metric(PaintDeviceMetric m) const
{
Q_D(const QWidget);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index effc99e..6037bd5 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3663,6 +3663,7 @@ void QRasterPaintEngine::drawEllipse(const QRectF &rect)
ensurePen();
if (((qpen_style(s->lastPen) == Qt::SolidLine && s->flags.fast_pen)
|| (qpen_style(s->lastPen) == Qt::NoPen && !s->flags.antialiased))
+ && qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT
#ifdef FLOATING_POINT_BUGGY_OR_NO_FPU
&& qMax(rect.width(), rect.height()) < 128 // integer math breakdown
#endif
diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp
index 23d25bd..1cb0ca4 100644
--- a/src/gui/styles/gtksymbols.cpp
+++ b/src/gui/styles/gtksymbols.cpp
@@ -211,7 +211,8 @@ static QString classPath(GtkWidget *widget)
static void resolveGtk()
{
- QLibrary libgtk(QLS("gtk-x11-2.0"));
+ // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
+ QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0);
QGtk::gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init");
QGtk::gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new");
QGtk::gtk_style_attach = (Ptr_gtk_style_attach)libgtk.resolve("gtk_style_attach");
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index e33b255..0f3a88b 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1759,7 +1759,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QWidget *w, const QStyleOption *o
QStyle::SubControl subControl = knownPseudoElements[pseudoElement].subControl;
if (!(complex->activeSubControls & subControl))
- state = QStyle::State(state & (QStyle::State_Enabled | QStyle::State_Horizontal));
+ state &= (QStyle::State_Enabled | QStyle::State_Horizontal | QStyle::State_HasFocus);
}
switch (pseudoElement) {
@@ -3136,19 +3136,25 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
rule.drawRule(p, opt->rect);
- QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove);
- if (!subRule.hasDrawable()) {
- baseStyle()->drawComplexControl(cc, slider, p, w);
- return;
+ QRenderRule grooveSubRule = renderRule(w, opt, PseudoElement_SliderGroove);
+ QRenderRule handleSubRule = renderRule(w, opt, PseudoElement_SliderHandle);
+ if (!grooveSubRule.hasDrawable()) {
+ QStyleOptionSlider slOpt(*slider);
+ bool handleHasRule = handleSubRule.hasDrawable();
+ // If the style specifies a different handler rule, draw the groove without the handler.
+ if (handleHasRule)
+ slOpt.subControls &= ~SC_SliderHandle;
+ baseStyle()->drawComplexControl(cc, &slOpt, p, w);
+ if (!handleHasRule)
+ return;
}
QRect gr = subControlRect(cc, opt, SC_SliderGroove, w);
if (slider->subControls & SC_SliderGroove) {
- subRule.drawRule(p, gr);
+ grooveSubRule.drawRule(p, gr);
}
if (slider->subControls & SC_SliderHandle) {
- QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderHandle);
QRect hr = subControlRect(cc, opt, SC_SliderHandle, w);
QRenderRule subRule1 = renderRule(w, opt, PseudoElement_SliderSubPage);
@@ -3169,7 +3175,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
subRule2.drawRule(p, r);
}
- subRule.drawRule(p, subRule.boxRect(hr, Margin));
+ handleSubRule.drawRule(p, grooveSubRule.boxRect(hr, Margin));
}
if (slider->subControls & SC_SliderTickmarks) {
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 2ed9303..0f72440 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -3030,6 +3030,8 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
ar.adjust(2, 2, -2, -2);
if (opt->state & State_Enabled)
flags |= State_Enabled;
+ if (opt->state & State_HasFocus)
+ flags |= State_HasFocus;
if (sunkenArrow)
flags |= State_Sunken;
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index 0dc1832..9c374d8 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -621,12 +621,21 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
QMatrix m = painter->matrix();
bool complexXForm = m.m11() != 1.0 || m.m22() != 1.0 || m.m12() != 0.0 || m.m21() != 0.0;
+ bool translucentToplevel = false;
+ QPaintDevice *pdev = painter->device();
+ if (pdev->devType() == QInternal::Widget) {
+ QWidget *win = ((QWidget *) pdev)->window();
+ translucentToplevel = win->testAttribute(Qt::WA_TranslucentBackground);
+ }
+
bool useFallback = painter->paintEngine()->getDC() == 0
|| painter->opacity() != 1.0
|| themeData.rotate
|| complexXForm
|| themeData.mirrorVertically
- || (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0);
+ || (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0)
+ || translucentToplevel;
+
if (!useFallback)
drawBackgroundDirectly(themeData);
else
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 8b85d2d..ce62834 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -92,8 +92,12 @@ QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int position
{
QTextCursorPrivate::AdjustResult result = QTextCursorPrivate::CursorMoved;
// not(!) <= , so that inserting text adjusts the cursor correctly
- if (position < positionOfChange ||
- (position == positionOfChange && op == QTextUndoCommand::KeepCursor)) {
+ if (position < positionOfChange
+ || (position == positionOfChange
+ && (op == QTextUndoCommand::KeepCursor
+ || anchor < position)
+ )
+ ) {
result = CursorUnchanged;
} else {
if (charsAddedOrRemoved < 0 && position < positionOfChange - charsAddedOrRemoved)
diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp
index a727b2b..40c0b02 100644
--- a/src/gui/widgets/qtoolbar.cpp
+++ b/src/gui/widgets/qtoolbar.cpp
@@ -307,6 +307,8 @@ bool QToolBarPrivate::mouseReleaseEvent(QMouseEvent*)
return true;
} else {
#ifdef Q_WS_MAC
+ if (!macWindowDragging)
+ return false;
macWindowDragging = false;
macWindowDragPressPosition = QPoint();
return true;
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 2aa84d0..27c0ed4 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -588,19 +588,53 @@ QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError e
return errorString;
}
+// this is called from the destructor of QHttpNetworkReply. It is called when
+// the reply was finished correctly or when it was aborted.
void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply)
{
Q_Q(QHttpNetworkConnection);
- // remove the from active list.
+ // check if the reply is currently being processed or it is pipelined in
for (int i = 0; i < channelCount; ++i) {
+ // is the reply associated the currently processing of this channel?
if (channels[i].reply == reply) {
channels[i].reply = 0;
- if (reply->d_func()->isConnectionCloseEnabled())
+
+ if (!reply->isFinished() && !channels[i].alreadyPipelinedRequests.isEmpty()) {
+ // the reply had to be prematurely removed, e.g. it was not finished
+ // therefore we have to requeue the already pipelined requests.
+ channels[i].requeueCurrentlyPipelinedRequests();
+ }
+
+ // if HTTP mandates we should close
+ // or the reply is not finished yet, e.g. it was aborted
+ // we have to close that connection
+ if (reply->d_func()->isConnectionCloseEnabled() || !reply->isFinished())
channels[i].close();
+
QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
return;
}
+
+ // is the reply inside the pipeline of this channel already?
+ for (int j = 0; j < channels[i].alreadyPipelinedRequests.length(); j++) {
+ if (channels[i].alreadyPipelinedRequests.at(j).second == reply) {
+ // Remove that HttpMessagePair
+ channels[i].alreadyPipelinedRequests.removeAt(j);
+
+ channels[i].requeueCurrentlyPipelinedRequests();
+
+ // Since some requests had already been pipelined, but we removed
+ // one and re-queued the others
+ // we must force a connection close after the request that is
+ // currently in processing has been finished.
+ if (channels[i].reply)
+ channels[i].reply->d_func()->forceConnectionCloseEnabled = true;
+
+ QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
+ return;
+ }
+ }
}
// remove from the high priority queue
if (!highPriorityQueue.isEmpty()) {
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 641b35b..beab9af 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -542,6 +542,7 @@ void QHttpNetworkConnectionChannel::allDone()
if (resendCurrent || reply->d_func()->isConnectionCloseEnabled() || socket->state() != QAbstractSocket::ConnectedState) {
// move the pipelined ones back to the main queue
requeueCurrentlyPipelinedRequests();
+ close();
} else {
// there were requests pipelined in and we can continue
HttpMessagePair messagePair = alreadyPipelinedRequests.takeFirst();
@@ -601,7 +602,6 @@ void QHttpNetworkConnectionChannel::requeueCurrentlyPipelinedRequests()
connection->d_func()->requeueRequest(alreadyPipelinedRequests.at(i));
alreadyPipelinedRequests.clear();
- close();
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
}
@@ -758,6 +758,7 @@ void QHttpNetworkConnectionChannel::_q_disconnected()
state = QHttpNetworkConnectionChannel::IdleState;
requeueCurrentlyPipelinedRequests();
+ close();
}
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index c953ebf..e990704 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -198,6 +198,7 @@ QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl)
majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0),
chunkedTransferEncoding(false),
connectionCloseEnabled(true),
+ forceConnectionCloseEnabled(false),
currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false),
autoDecompress(false), responseData(), requestIsPrepared(false)
,pipeliningUsed(false)
@@ -564,7 +565,7 @@ bool QHttpNetworkReplyPrivate::isChunked()
bool QHttpNetworkReplyPrivate::isConnectionCloseEnabled()
{
- return connectionCloseEnabled;
+ return connectionCloseEnabled || forceConnectionCloseEnabled;
}
// note this function can only be used for non-chunked, non-compressed with
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index ded1d44..1073560 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -213,6 +213,7 @@ public:
QByteArray fragment; // used for header, status, chunk header etc, not for reply data
bool chunkedTransferEncoding;
bool connectionCloseEnabled;
+ bool forceConnectionCloseEnabled;
qint64 currentChunkSize;
qint64 currentChunkRead;
QPointer<QHttpNetworkConnection> connection;
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 25f4184..9db1de8 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -297,7 +297,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph)
for (int y = 0; y < maskHeight; ++y) {
uchar *src = (uchar *) mask.scanLine(y);
for (int x = 0; x < maskWidth; ++x)
- src[x] = -src[x];
+ src[x] = -src[x]; // convert 0 and 1 into 0 and 255
}
}
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index 53975d7..38a89e6 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -381,167 +381,179 @@ void QVGPixmapData::cleanup()
source = QImage();
}
-void QVGPixmapData::fromRSgImage(RSgImage* sgImage)
+void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
{
- Q_UNUSED(sgImage);
#if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL)
- // when "0" used as argument then
- // default display, context are used
- if (!context)
- context = qt_vg_create_context(0);
+ if (type == QPixmapData::SgImage && pixmap) {
+ RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmap);
+ // when "0" used as argument then
+ // default display, context are used
+ if (!context)
+ context = qt_vg_create_context(0);
- if (vgImage != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImage);
- vgImage = VG_INVALID_HANDLE;
- }
- if (vgImageOpacity != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImageOpacity);
- vgImageOpacity = VG_INVALID_HANDLE;
- }
+ if (vgImage != VG_INVALID_HANDLE) {
+ vgDestroyImage(vgImage);
+ vgImage = VG_INVALID_HANDLE;
+ }
+ if (vgImageOpacity != VG_INVALID_HANDLE) {
+ vgDestroyImage(vgImageOpacity);
+ vgImageOpacity = VG_INVALID_HANDLE;
+ }
- TInt err = 0;
+ TInt err = 0;
- err = SgDriver::Open();
- if(err != KErrNone) {
- cleanup();
- return;
- }
+ err = SgDriver::Open();
+ if(err != KErrNone) {
+ cleanup();
+ return;
+ }
- if(sgImage->IsNull()) {
- cleanup();
- SgDriver::Close();
- return;
- }
+ if(sgImage->IsNull()) {
+ cleanup();
+ SgDriver::Close();
+ return;
+ }
- TSgImageInfo sgImageInfo;
- err = sgImage->GetInfo(sgImageInfo);
- if(err != KErrNone) {
- cleanup();
- SgDriver::Close();
- return;
- }
+ TSgImageInfo sgImageInfo;
+ err = sgImage->GetInfo(sgImageInfo);
+ if(err != KErrNone) {
+ cleanup();
+ SgDriver::Close();
+ return;
+ }
- pfnEglCreateImageKHR eglCreateImageKHR = (pfnEglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR");
- pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
- pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR");
+ pfnEglCreateImageKHR eglCreateImageKHR = (pfnEglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR");
+ pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
+ pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR");
- if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) {
- cleanup();
- SgDriver::Close();
- return;
- }
+ if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) {
+ cleanup();
+ SgDriver::Close();
+ return;
+ }
- const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE};
- EGLImageKHR eglImage = eglCreateImageKHR(context->display(),
- EGL_NO_CONTEXT,
- EGL_NATIVE_PIXMAP_KHR,
- (EGLClientBuffer)sgImage,
- (EGLint*)KEglImageAttribs);
+ const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE};
+ EGLImageKHR eglImage = eglCreateImageKHR(context->display(),
+ EGL_NO_CONTEXT,
+ EGL_NATIVE_PIXMAP_KHR,
+ (EGLClientBuffer)sgImage,
+ (EGLint*)KEglImageAttribs);
+
+ if(eglGetError() != EGL_SUCCESS) {
+ cleanup();
+ SgDriver::Close();
+ return;
+ }
- if(eglGetError() != EGL_SUCCESS) {
- cleanup();
- SgDriver::Close();
- return;
- }
+ vgImage = vgCreateEGLImageTargetKHR(eglImage);
+ if(vgGetError() != VG_NO_ERROR) {
+ cleanup();
+ eglDestroyImageKHR(context->display(), eglImage);
+ SgDriver::Close();
+ return;
+ }
- vgImage = vgCreateEGLImageTargetKHR(eglImage);
- if(vgGetError() != VG_NO_ERROR) {
- cleanup();
+ w = sgImageInfo.iSizeInPixels.iWidth;
+ h = sgImageInfo.iSizeInPixels.iHeight;
+ d = 32; // We always use ARGB_Premultiplied for VG pixmaps.
+ is_null = (w <= 0 || h <= 0);
+ source = QImage();
+ recreate = false;
+ setSerialNumber(++qt_vg_pixmap_serial);
+ // release stuff
eglDestroyImageKHR(context->display(), eglImage);
SgDriver::Close();
- return;
- }
+ } else if (type == QPixmapData::FbsBitmap) {
- w = sgImageInfo.iSizeInPixels.iWidth;
- h = sgImageInfo.iSizeInPixels.iHeight;
- d = 32; // We always use ARGB_Premultiplied for VG pixmaps.
- is_null = (w <= 0 || h <= 0);
- source = QImage();
- recreate = false;
- setSerialNumber(++qt_vg_pixmap_serial);
- // release stuff
- eglDestroyImageKHR(context->display(), eglImage);
- SgDriver::Close();
+ }
#else
+ Q_UNUSED(pixmap);
+ Q_UNUSED(type);
#endif
}
-RSgImage* QVGPixmapData::toRSgImage()
+void* QVGPixmapData::toNativeType(NativeType type)
{
#if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL)
- toVGImage();
-
- if(!isValid() || vgImage == VG_INVALID_HANDLE)
- return 0;
-
- TInt err = 0;
+ if (type == QPixmapData::SgImage) {
+ toVGImage();
+
+ if(!isValid() || vgImage == VG_INVALID_HANDLE)
+ return 0;
+
+ TInt err = 0;
+
+ err = SgDriver::Open();
+ if(err != KErrNone)
+ return 0;
+
+ TSgImageInfo sgInfo;
+ sgInfo.iPixelFormat = EUidPixelFormatARGB_8888_PRE;
+ sgInfo.iSizeInPixels.SetSize(w, h);
+ sgInfo.iUsage = ESgUsageOpenVgImage | ESgUsageOpenVgTarget;
+ sgInfo.iShareable = ETrue;
+ sgInfo.iCpuAccess = ESgCpuAccessNone;
+ sgInfo.iScreenId = KSgScreenIdMain; //KSgScreenIdAny;
+ sgInfo.iUserAttributes = NULL;
+ sgInfo.iUserAttributeCount = 0;
+
+ RSgImage *sgImage = q_check_ptr(new RSgImage());
+ err = sgImage->Create(sgInfo, NULL, NULL);
+ if(err != KErrNone) {
+ SgDriver::Close();
+ return 0;
+ }
- err = SgDriver::Open();
- if(err != KErrNone)
- return 0;
+ pfnEglCreateImageKHR eglCreateImageKHR = (pfnEglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR");
+ pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
+ pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR");
- TSgImageInfo sgInfo;
- sgInfo.iPixelFormat = EUidPixelFormatARGB_8888_PRE;
- sgInfo.iSizeInPixels.SetSize(w, h);
- sgInfo.iUsage = ESgUsageOpenVgImage | ESgUsageOpenVgTarget;
- sgInfo.iShareable = ETrue;
- sgInfo.iCpuAccess = ESgCpuAccessNone;
- sgInfo.iScreenId = KSgScreenIdMain; //KSgScreenIdAny;
- sgInfo.iUserAttributes = NULL;
- sgInfo.iUserAttributeCount = 0;
-
- RSgImage *sgImage = q_check_ptr(new RSgImage());
- err = sgImage->Create(sgInfo, NULL, NULL);
- if(err != KErrNone) {
- SgDriver::Close();
- return 0;
- }
+ if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) {
+ SgDriver::Close();
+ return 0;
+ }
- pfnEglCreateImageKHR eglCreateImageKHR = (pfnEglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR");
- pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
- pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR");
+ const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE};
+ EGLImageKHR eglImage = eglCreateImageKHR(context->display(),
+ EGL_NO_CONTEXT,
+ EGL_NATIVE_PIXMAP_KHR,
+ (EGLClientBuffer)sgImage,
+ (EGLint*)KEglImageAttribs);
+ if(eglGetError() != EGL_SUCCESS) {
+ sgImage->Close();
+ SgDriver::Close();
+ return 0;
+ }
- if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) {
- SgDriver::Close();
- return 0;
- }
+ VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage);
+ if(vgGetError() != VG_NO_ERROR) {
+ eglDestroyImageKHR(context->display(), eglImage);
+ sgImage->Close();
+ SgDriver::Close();
+ return 0;
+ }
- const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE};
- EGLImageKHR eglImage = eglCreateImageKHR(context->display(),
- EGL_NO_CONTEXT,
- EGL_NATIVE_PIXMAP_KHR,
- (EGLClientBuffer)sgImage,
- (EGLint*)KEglImageAttribs);
- if(eglGetError() != EGL_SUCCESS) {
- sgImage->Close();
- SgDriver::Close();
- return 0;
- }
+ vgCopyImage(dstVgImage, 0, 0,
+ vgImage, 0, 0,
+ w, h, VG_FALSE);
- VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage);
- if(vgGetError() != VG_NO_ERROR) {
+ if(vgGetError() != VG_NO_ERROR) {
+ sgImage->Close();
+ sgImage = 0;
+ }
+ // release stuff
+ vgDestroyImage(dstVgImage);
eglDestroyImageKHR(context->display(), eglImage);
- sgImage->Close();
SgDriver::Close();
+ return reinterpret_cast<void*>(sgImage);
+ } else if (type == QPixmapData::FbsBitmap) {
return 0;
}
-
- vgCopyImage(dstVgImage, 0, 0,
- vgImage, 0, 0,
- w, h, VG_FALSE);
-
- if(vgGetError() != VG_NO_ERROR) {
- sgImage->Close();
- sgImage = 0;
- }
- // release stuff
- vgDestroyImage(dstVgImage);
- eglDestroyImageKHR(context->display(), eglImage);
- SgDriver::Close();
- return sgImage;
#else
+ Q_UNUSED(type);
return 0;
#endif
}
#endif //Q_OS_SYMBIAN
+
QT_END_NAMESPACE
diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h
index 122f596..99115df 100644
--- a/src/openvg/qpixmapdata_vg_p.h
+++ b/src/openvg/qpixmapdata_vg_p.h
@@ -95,8 +95,8 @@ public:
QSize size() const { return QSize(w, h); }
#if defined(Q_OS_SYMBIAN)
- RSgImage* toRSgImage();
- void fromRSgImage(RSgImage* sgImage);
+ void* toNativeType(NativeType type);
+ void fromNativeType(void* pixmap, NativeType type);
#endif
protected:
diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp
index 1997ee8..6cc2e27 100644
--- a/src/openvg/qwindowsurface_vg.cpp
+++ b/src/openvg/qwindowsurface_vg.cpp
@@ -85,7 +85,6 @@ void QVGWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoin
void QVGWindowSurface::setGeometry(const QRect &rect)
{
QWindowSurface::setGeometry(rect);
- d_ptr->ensureContext(window());
}
bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy)
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 5fcbb5f..3b23e56 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -895,7 +895,8 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage,
(void) jpeg_finish_decompress(&cinfo);
}
#ifndef QT_NO_IMAGE_SMOOTHSCALE
- } else if (scaledSize.isValid()) {
+ } else if (scaledSize.isValid() && scaledSize != QSize(cinfo.output_width, cinfo.output_height)
+ && quality >= HIGH_QUALITY_THRESHOLD) {
jpegSmoothScaler scaler(&cinfo, QString().sprintf("Scale( %d, %d, ScaleFree )",
scaledSize.width(),
@@ -946,6 +947,9 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage,
outImage->setDotsPerMeterX(int(100. * cinfo.X_density));
outImage->setDotsPerMeterY(int(100. * cinfo.Y_density));
}
+
+ if (scaledSize.isValid() && scaledSize != QSize(cinfo.output_width, cinfo.output_height))
+ *outImage = outImage->scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::FastTransformation);
}
}
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 7a910d2..71194d3 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -508,6 +508,7 @@ JSC::JSValue JSC_HOST_CALL functionDisconnect(JSC::ExecState *exec, JSC::JSObjec
slot = arg1;
else {
// ### don't go via QScriptValue
+ QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue tmp = engine->scriptValueFromJSCValue(arg0);
QString propertyName(arg1.toString(exec));
slot = engine->scriptValueToJSCValue(tmp.property(propertyName, QScriptValue::ResolvePrototype));
@@ -591,6 +592,7 @@ JSC::JSValue JSC_HOST_CALL functionConnect(JSC::ExecState *exec, JSC::JSObject *
slot = arg1;
else {
// ### don't go via QScriptValue
+ QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue tmp = engine->scriptValueFromJSCValue(arg0);
QString propertyName = arg1.toString(exec);
slot = engine->scriptValueToJSCValue(tmp.property(propertyName, QScriptValue::ResolvePrototype));
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index c7db276..ec41cc9 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -265,6 +265,29 @@ public:
#endif
};
+namespace QScript
+{
+
+class SaveFrameHelper
+{
+public:
+ SaveFrameHelper(QScriptEnginePrivate *eng,
+ JSC::ExecState *newFrame)
+ : engine(eng), oldFrame(eng->currentFrame)
+ {
+ eng->currentFrame = newFrame;
+ }
+ ~SaveFrameHelper()
+ {
+ engine->currentFrame = oldFrame;
+ }
+private:
+ QScriptEnginePrivate *engine;
+ JSC::ExecState *oldFrame;
+};
+
+} // namespace QScript
+
inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(size_t size)
{
if (freeScriptValues) {
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 6a6381e..2a33aea 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -2409,12 +2409,16 @@ void QScriptValue::setScriptClass(QScriptClass *scriptClass)
return;
}
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue));
- QScriptObjectDelegate *delegate = scriptObject->delegate();
- if (!delegate || (delegate->type() != QScriptObjectDelegate::ClassObject)) {
- delegate = new QScript::ClassObjectDelegate(scriptClass);
- scriptObject->setDelegate(delegate);
+ if (!scriptClass) {
+ scriptObject->setDelegate(0);
+ } else {
+ QScriptObjectDelegate *delegate = scriptObject->delegate();
+ if (!delegate || (delegate->type() != QScriptObjectDelegate::ClassObject)) {
+ delegate = new QScript::ClassObjectDelegate(scriptClass);
+ scriptObject->setDelegate(delegate);
+ }
+ static_cast<QScript::ClassObjectDelegate*>(delegate)->setScriptClass(scriptClass);
}
- static_cast<QScript::ClassObjectDelegate*>(delegate)->setScriptClass(scriptClass);
}
/*!
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index a5dc670..c1e386b 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -77,6 +77,7 @@ QScriptClass *ClassObjectDelegate::scriptClass() const
void ClassObjectDelegate::setScriptClass(QScriptClass *scriptClass)
{
+ Q_ASSERT(scriptClass != 0);
m_scriptClass = scriptClass;
}
@@ -90,12 +91,13 @@ bool ClassObjectDelegate::getOwnPropertySlot(QScriptObject* object,
const JSC::Identifier &propertyName,
JSC::PropertySlot &slot)
{
+ QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(engine, exec);
// for compatibility with the old back-end, normal JS properties
// are queried first.
if (QScriptObjectDelegate::getOwnPropertySlot(object, exec, propertyName, slot))
return true;
- QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
QScriptString scriptName;
QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
@@ -116,6 +118,7 @@ void ClassObjectDelegate::put(QScriptObject* object, JSC::ExecState *exec,
JSC::JSValue value, JSC::PutPropertySlot &slot)
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
QScriptString scriptName;
QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
@@ -136,6 +139,7 @@ bool ClassObjectDelegate::deleteProperty(QScriptObject* object, JSC::ExecState *
{
// ### avoid duplication of put()
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
QScriptString scriptName;
QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
@@ -157,6 +161,7 @@ bool ClassObjectDelegate::getPropertyAttributes(const QScriptObject* object, JSC
unsigned &attribs) const
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
QScriptString scriptName;
QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
@@ -188,6 +193,7 @@ void ClassObjectDelegate::getPropertyNames(QScriptObject* object, JSC::ExecState
unsigned listedAttributes)
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
QScriptClassPropertyIterator *it = m_scriptClass->newIterator(scriptObject);
if (it != 0) {
@@ -267,6 +273,7 @@ bool ClassObjectDelegate::hasInstance(QScriptObject* object, JSC::ExecState *exe
return QScriptObjectDelegate::hasInstance(object, exec, value, proto);
QScriptValueList args;
QScriptEnginePrivate *eng_p = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(eng_p, exec);
args << eng_p->scriptValueFromJSCValue(object) << eng_p->scriptValueFromJSCValue(value);
QVariant result = scriptClass()->extension(QScriptClass::HasInstance, qVariantFromValue(args));
return result.toBool();
diff --git a/src/script/script.pro b/src/script/script.pro
index 860080d..c844d89 100644
--- a/src/script/script.pro
+++ b/src/script/script.pro
@@ -1,7 +1,7 @@
TARGET = QtScript
QPRO_PWD = $$PWD
QT = core
-DEFINES += JSC=QTJSC
+DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror
DEFINES += QT_BUILD_SCRIPT_LIB
DEFINES += QT_NO_USING_NAMESPACE
DEFINES += QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index 540b18d..a9a2193 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -76,8 +76,10 @@ namespace QTest
#if defined(Q_WS_X11)
qt_x11_wait_for_window_manager(window);
#elif defined(Q_WS_QWS)
+ Q_UNUSED(window);
qWait(100);
#else
+ Q_UNUSED(window);
qWait(50);
#endif
return true;