summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWater-Team <water@pad.test.qt.nokia.com>2011-10-18 01:00:33 +0200
committerWater-Team <water@pad.test.qt.nokia.com>2011-10-18 01:00:33 +0200
commit923693d4919f22eabd5cec8fb6e855514bb64fb7 (patch)
treece5c6ec3f89b9bef3684c748bc4bc39af0d53a9a /src
parentec9a31abf003880a60d1120738a3bee7075b8ca8 (diff)
parent09e7218a1c30ca33a5d82280f89f07ba54b96555 (diff)
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qdir.cpp10
-rw-r--r--src/corelib/io/qfile.cpp7
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian.cpp10
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian_p.h18
-rw-r--r--src/corelib/kernel/qcore_symbian_p.cpp19
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp81
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h3
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp239
-rw-r--r--src/corelib/plugin/qfactoryloader_p.h1
-rw-r--r--src/corelib/plugin/qpluginloader.cpp2
-rw-r--r--src/corelib/tools/qline.cpp21
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp28
-rw-r--r--src/declarative/qml/qdeclarativesqldatabase.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp2
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp42
-rw-r--r--src/declarative/util/qdeclarativespringanimation.cpp8
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp2
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp16
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp4
-rw-r--r--src/gui/graphicsview/qgridlayoutengine.cpp8
-rw-r--r--src/gui/graphicsview/qsimplex_p.cpp2
-rw-r--r--src/gui/image/qimage.cpp12
-rw-r--r--src/gui/image/qvolatileimage.cpp14
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h2
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp139
-rw-r--r--src/gui/kernel/qapplication_s60.cpp9
-rw-r--r--src/gui/kernel/qtooltip.cpp2
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--src/gui/painting/qcolor.cpp4
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp8
-rw-r--r--src/gui/painting/qpaintengineex.cpp12
-rw-r--r--src/gui/painting/qpainter.cpp16
-rw-r--r--src/gui/painting/qrasterizer.cpp10
-rw-r--r--src/gui/painting/qtessellator.cpp2
-rw-r--r--src/gui/styles/qs60style.cpp8
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp10
-rw-r--r--src/gui/text/qfontdatabase.cpp4
-rw-r--r--src/gui/text/qfontengine.cpp4
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/widgets/qprogressbar.cpp2
-rw-r--r--src/gui/widgets/qtextbrowser.cpp3
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp15
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp2
-rw-r--r--src/s60installs/bwins/QtCoreu.def5
-rw-r--r--src/s60installs/eabi/QtCoreu.def2
-rw-r--r--src/s60installs/qt_resources.iby11
-rwxr-xr-xsrc/s60installs/s60installs.pro1
-rw-r--r--src/xmlpatterns/api/qxmlquery.cpp5
-rw-r--r--src/xmlpatterns/functions/qsequencegeneratingfns.cpp20
-rw-r--r--src/xmlpatterns/schema/qxsdtypechecker.cpp11
57 files changed, 591 insertions, 295 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 4ba8e0675d..48b9358fe9 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1872,7 +1872,10 @@ QString QDir::currentPath()
Under non-Windows operating systems the \c HOME environment
variable is used if it exists, otherwise the path returned by the
- rootPath(). On Symbian always the same as the path returned by the rootPath().
+ rootPath().
+
+ On Symbian this typically returns "c:/data",
+ i.e. the same as native PathInfo::PhoneMemoryRootPath().
\sa home(), currentPath(), rootPath(), tempPath()
*/
@@ -1936,9 +1939,8 @@ QString QDir::tempPath()
/*!
Returns the absolute path of the root directory.
- For Unix operating systems this returns "/". For Windows file
- systems this normally returns "c:/". On Symbian this typically returns
- "c:/data", i.e. the same as native PathInfo::PhoneMemoryRootPath().
+ For Unix operating systems this returns "/". For Windows and Symbian file
+ systems this normally returns "c:/". I.E. the root of the system drive.
\sa root(), drives(), currentPath(), homePath(), tempPath()
*/
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 06c403a117..d08574d456 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -1332,6 +1332,13 @@ bool QFile::open(const RFile &f, OpenMode mode, FileHandleFlags handleFlags)
This function is not supported on Windows CE.
+ On Symbian, this function returns -1 if the file was opened normally,
+ as Symbian OS native file handles do not fit in an int, and are
+ incompatible with C library functions that the handle would be used for.
+ If the file was opened using the overloads that take an open C library
+ file handle / file descriptor, then this function returns that same
+ handle.
+
\sa QSocketNotifier
*/
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 338552cb7f..86b9496355 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -694,7 +694,7 @@ bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSyst
if (what & QFileSystemMetaData::UserWritePermission) {
if (::_waccess((wchar_t*)entry.nativeFilePath().utf16(), W_OK) == 0)
data.entryFlags |= QFileSystemMetaData::UserWritePermission;
- data.knownFlagsMask |= QFileSystemMetaData::UserReadPermission;
+ data.knownFlagsMask |= QFileSystemMetaData::UserWritePermission;
}
}
diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp
index 63cc4f1ce6..fa857c61a9 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian.cpp
+++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp
@@ -52,7 +52,7 @@
QT_BEGIN_NAMESPACE
QNotifyChangeEvent::QNotifyChangeEvent(RFs &fs, const TDesC &file,
- QSymbianFileSystemWatcherEngine *e, bool aIsDir,
+ QSymbianFileSystemWatcherInterface *e, bool aIsDir,
TInt aPriority) :
CActive(aPriority),
isDir(aIsDir),
@@ -96,9 +96,9 @@ void QNotifyChangeEvent::RunL()
if (!failureCount) {
int err;
- QT_TRYCATCH_ERROR(err, engine->emitPathChanged(this));
+ QT_TRYCATCH_ERROR(err, engine->handlePathChanged(this));
if (err != KErrNone)
- qWarning("QNotifyChangeEvent::RunL() - emitPathChanged threw exception (Converted error code: %d)", err);
+ qWarning("QNotifyChangeEvent::RunL() - handlePathChanged threw exception (Converted error code: %d)", err);
}
}
}
@@ -203,7 +203,7 @@ QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &path
return p;
}
-void QSymbianFileSystemWatcherEngine::emitPathChanged(QNotifyChangeEvent *e)
+void QSymbianFileSystemWatcherEngine::handlePathChanged(QNotifyChangeEvent *e)
{
QMutexLocker locker(&mutex);
@@ -255,7 +255,7 @@ void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directory
QMutexLocker locker(&mutex);
QString nativeDir(QDir::toNativeSeparators(directoryPath));
TPtrC ptr(qt_QString2TPtrC(nativeDir));
- currentAddEvent = new QNotifyChangeEvent(qt_s60GetRFs(), ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive));
+ currentAddEvent = q_check_ptr(new QNotifyChangeEvent(qt_s60GetRFs(), ptr, this, directoryPath.endsWith(QChar(L'/'))));
syncCondition.wakeOne();
}
diff --git a/src/corelib/io/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qfilesystemwatcher_symbian_p.h
index 0b317a062f..842df802c3 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian_p.h
+++ b/src/corelib/io/qfilesystemwatcher_symbian_p.h
@@ -66,29 +66,35 @@
QT_BEGIN_NAMESPACE
-class QSymbianFileSystemWatcherEngine;
+class QSymbianFileSystemWatcherInterface;
class QNotifyChangeEvent : public CActive
{
public:
- QNotifyChangeEvent(RFs &fsSession, const TDesC &file, QSymbianFileSystemWatcherEngine *engine,
+ QNotifyChangeEvent(RFs &fsSession, const TDesC &file, QSymbianFileSystemWatcherInterface *engine,
bool aIsDir, TInt aPriority = EPriorityStandard);
~QNotifyChangeEvent();
bool isDir;
+ TPath watchedPath;
private:
void RunL();
void DoCancel();
RFs &fsSession;
- TPath watchedPath;
- QSymbianFileSystemWatcherEngine *engine;
+ QSymbianFileSystemWatcherInterface *engine;
int failureCount;
};
-class QSymbianFileSystemWatcherEngine : public QFileSystemWatcherEngine
+class QSymbianFileSystemWatcherInterface
+{
+public:
+ virtual void handlePathChanged(QNotifyChangeEvent *e) = 0;
+};
+
+class QSymbianFileSystemWatcherEngine : public QFileSystemWatcherEngine, public QSymbianFileSystemWatcherInterface
{
Q_OBJECT
@@ -111,7 +117,7 @@ public Q_SLOTS:
private:
friend class QNotifyChangeEvent;
- void emitPathChanged(QNotifyChangeEvent *e);
+ void handlePathChanged(QNotifyChangeEvent *e);
void startWatcher();
diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp
index 04acfb0362..57ae2af579 100644
--- a/src/corelib/kernel/qcore_symbian_p.cpp
+++ b/src/corelib/kernel/qcore_symbian_p.cpp
@@ -45,6 +45,7 @@
#include "qcore_symbian_p.h"
#include <string>
#include <in_sock.h>
+#include "qdebug.h"
QT_BEGIN_NAMESPACE
@@ -115,6 +116,24 @@ public:
QS60RFsSession() {
qt_symbian_throwIfError(iFs.Connect());
qt_symbian_throwIfError(iFs.ShareProtected());
+ //BC with 4.7: create private path on system drive
+ TInt sysdrive = iFs.GetSystemDrive();
+ TInt err = iFs.CreatePrivatePath(sysdrive);
+ if (err != KErrNone && err != KErrAlreadyExists)
+ qWarning("Failed to create private path on system drive.");
+ //BC with 4.7: set working directory to same drive as application
+ TFileName pfn = RProcess().FileName();
+ TInt drive;
+ if (pfn.Length() > 0 && iFs.CharToDrive(pfn[0], drive) == KErrNone) {
+ // for system drive or rom based apps, leave the path on system drive
+ if (drive != sysdrive && drive != EDriveZ) {
+ err = iFs.CreatePrivatePath(drive);
+ if (err == KErrNone || err == KErrAlreadyExists)
+ iFs.SetSessionToPrivate(drive);
+ else
+ qWarning("Failed to create private path on application drive.");
+ }
+ }
}
~QS60RFsSession() {
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 752bbaa0dc..2eb68f7c8e 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1991,12 +1991,6 @@ QString QCoreApplication::applicationDirPath()
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.");
-
d->cachedApplicationDirPath = QFileInfo(appPath).path();
}
#else
@@ -2335,6 +2329,33 @@ QString QCoreApplication::applicationVersion()
#ifndef QT_NO_LIBRARY
+#if defined(Q_OS_SYMBIAN)
+void qt_symbian_installLibraryPaths(QString installPathPlugins, QStringList& libPaths)
+{
+ // Add existing path on all drives for relative PluginsPath in Symbian
+ QString tempPath = installPathPlugins;
+ if (tempPath.at(tempPath.length() - 1) != QDir::separator()) {
+ tempPath += QDir::separator();
+ }
+ RFs& fs = qt_s60GetRFs();
+ TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData()));
+ // Symbian searches should start from Y:. Fix start drive otherwise TFindFile starts from the session drive
+ _LIT(KStartDir, "Y:");
+ TFileName dirPath(KStartDir);
+ dirPath.Append(tempPathPtr);
+ TFindFile finder(fs);
+ TInt err = finder.FindByDir(tempPathPtr, dirPath);
+ while (err == KErrNone) {
+ QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()),
+ finder.File().Length());
+ foundDir = QDir(foundDir).canonicalPath();
+ if (!libPaths.contains(foundDir))
+ libPaths.append(foundDir);
+ err = finder.Find();
+ }
+}
+#endif
+
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, libraryPathMutex, (QMutex::Recursive))
/*!
@@ -2367,24 +2388,8 @@ QStringList QCoreApplication::libraryPaths()
QStringList *app_libpaths = coreappdata()->app_libpaths = new QStringList;
QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath);
#if defined(Q_OS_SYMBIAN)
- // Add existing path on all drives for relative PluginsPath in Symbian
if (installPathPlugins.at(1) != QChar(QLatin1Char(':'))) {
- QString tempPath = installPathPlugins;
- if (tempPath.at(tempPath.length() - 1) != QDir::separator()) {
- tempPath += QDir::separator();
- }
- RFs& fs = qt_s60GetRFs();
- TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData()));
- TFindFile finder(fs);
- TInt err = finder.FindByDir(tempPathPtr, tempPathPtr);
- while (err == KErrNone) {
- QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()),
- finder.File().Length());
- foundDir = QDir(foundDir).canonicalPath();
- if (!app_libpaths->contains(foundDir))
- app_libpaths->append(foundDir);
- err = finder.Find();
- }
+ qt_symbian_installLibraryPaths(installPathPlugins, *app_libpaths);
}
#else
if (QFile::exists(installPathPlugins)) {
@@ -2499,6 +2504,36 @@ void QCoreApplication::removeLibraryPath(const QString &path)
QFactoryLoader::refreshAll();
}
+#if defined(Q_OS_SYMBIAN)
+void QCoreApplicationPrivate::rebuildInstallLibraryPaths()
+{
+ // check there is not a single fixed install path
+ QString nativeInstallPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath);
+ if (nativeInstallPathPlugins.at(1) == QChar(QLatin1Char(':')))
+ return;
+ QString installPathPlugins = QDir::cleanPath(nativeInstallPathPlugins);
+ // look for the install path at the drive roots
+ installPathPlugins.prepend(QChar(QLatin1Char(':')));
+
+ QMutexLocker locker(libraryPathMutex());
+ QStringList &app_libpaths = *coreappdata()->app_libpaths;
+ // Build a new library path, copying non-installPath components, and replacing existing install path with new
+ QStringList newPaths;
+ bool installPathFound = false;
+ foreach (QString path, app_libpaths) {
+ if (path.mid(1).compare(installPathPlugins, Qt::CaseInsensitive) == 0) {
+ // skip existing install paths, insert new install path when we find the first
+ if (!installPathFound)
+ qt_symbian_installLibraryPaths(nativeInstallPathPlugins, newPaths);
+ installPathFound = true;
+ } else {
+ newPaths.append(path);
+ }
+ }
+ app_libpaths = newPaths;
+}
+#endif
+
#endif //QT_NO_LIBRARY
/*!
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index c6c6489a51..6f75da309d 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -126,6 +126,9 @@ public:
void symbianInit();
# endif
static CApaCommandLine* symbianCommandLine();
+#ifndef QT_NO_LIBRARY
+ static void rebuildInstallLibraryPaths();
+#endif
#endif
static bool isTranslatorInstalled(QTranslator *translator);
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index c8831e5ae5..24b4be0e8a 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -50,8 +50,13 @@
#include "qmutex.h"
#include "qplugin.h"
#include "qpluginloader.h"
+#include "qlibraryinfo.h"
#include "private/qobject_p.h"
#include "private/qcoreapplication_p.h"
+#ifdef Q_OS_SYMBIAN
+#include "private/qcore_symbian_p.h"
+#include "private/qfilesystemwatcher_symbian_p.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -59,6 +64,23 @@ Q_GLOBAL_STATIC(QList<QFactoryLoader *>, qt_factory_loaders)
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, qt_factoryloader_mutex, (QMutex::Recursive))
+#ifdef Q_OS_SYMBIAN
+class QSymbianSystemPluginWatcher : public QSymbianFileSystemWatcherInterface
+{
+public:
+ QSymbianSystemPluginWatcher();
+ ~QSymbianSystemPluginWatcher();
+
+ void watchForUpdates();
+ void handlePathChanged(QNotifyChangeEvent *e);
+
+ QList<QNotifyChangeEvent*> watchers;
+ TDriveList drives;
+};
+
+Q_GLOBAL_STATIC(QSymbianSystemPluginWatcher, qt_symbian_system_plugin_watcher)
+#endif
+
class QFactoryLoaderPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QFactoryLoader)
@@ -98,102 +120,117 @@ QFactoryLoader::QFactoryLoader(const char *iid,
QMutexLocker locker(qt_factoryloader_mutex());
update();
qt_factory_loaders()->append(this);
+#ifdef Q_OS_SYMBIAN
+ // kick off Symbian plugin watcher for updates
+ qt_symbian_system_plugin_watcher();
+#endif
}
-
-void QFactoryLoader::update()
+void QFactoryLoader::updateDir(const QString &pluginDir, QSettings& settings)
{
-#ifdef QT_SHARED
Q_D(QFactoryLoader);
- QStringList paths = QCoreApplication::libraryPaths();
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- for (int i = 0; i < paths.count(); ++i) {
- const QString &pluginDir = paths.at(i);
- // Already loaded, skip it...
- if (d->loadedPaths.contains(pluginDir))
- continue;
- d->loadedPaths << pluginDir;
+ QString path = pluginDir + d->suffix;
+ if (!QDir(path).exists(QLatin1String(".")))
+ return;
- QString path = pluginDir + d->suffix;
- if (!QDir(path).exists(QLatin1String(".")))
- continue;
+ QStringList plugins = QDir(path).entryList(QDir::Files);
+ QLibraryPrivate *library = 0;
+ for (int j = 0; j < plugins.count(); ++j) {
+ QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j));
- QStringList plugins = QDir(path).entryList(QDir::Files);
- QLibraryPrivate *library = 0;
- for (int j = 0; j < plugins.count(); ++j) {
- QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j));
+ if (qt_debug_component()) {
+ qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName;
+ }
+ library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath());
+ if (!library->isPlugin(&settings)) {
if (qt_debug_component()) {
- qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName;
+ qDebug() << library->errorString;
+ qDebug() << " not a plugin";
}
- library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath());
- if (!library->isPlugin(&settings)) {
+ library->release();
+ continue;
+ }
+ QString regkey = QString::fromLatin1("Qt Factory Cache %1.%2/%3:/%4")
+ .arg((QT_VERSION & 0xff0000) >> 16)
+ .arg((QT_VERSION & 0xff00) >> 8)
+ .arg(QLatin1String(d->iid))
+ .arg(fileName);
+ QStringList reg, keys;
+ reg = settings.value(regkey).toStringList();
+ if (reg.count() && library->lastModified == reg[0]) {
+ keys = reg;
+ keys.removeFirst();
+ } else {
+ if (!library->loadPlugin()) {
if (qt_debug_component()) {
qDebug() << library->errorString;
- qDebug() << " not a plugin";
+ qDebug() << " could not load";
}
library->release();
continue;
}
- QString regkey = QString::fromLatin1("Qt Factory Cache %1.%2/%3:/%4")
- .arg((QT_VERSION & 0xff0000) >> 16)
- .arg((QT_VERSION & 0xff00) >> 8)
- .arg(QLatin1String(d->iid))
- .arg(fileName);
- QStringList reg, keys;
- reg = settings.value(regkey).toStringList();
- if (reg.count() && library->lastModified == reg[0]) {
- keys = reg;
- keys.removeFirst();
- } else {
- if (!library->loadPlugin()) {
- if (qt_debug_component()) {
- qDebug() << library->errorString;
- qDebug() << " could not load";
- }
- library->release();
- continue;
- }
- QObject *instance = library->instance();
- if (!instance) {
- library->release();
- // ignore plugins that have a valid signature but cannot be loaded.
- continue;
- }
- QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance);
- if (instance && factory && instance->qt_metacast(d->iid))
- keys = factory->keys();
- if (keys.isEmpty())
- library->unload();
- reg.clear();
- reg << library->lastModified;
- reg += keys;
- settings.setValue(regkey, reg);
- }
- if (qt_debug_component()) {
- qDebug() << "keys" << keys;
- }
-
- if (keys.isEmpty()) {
+ QObject *instance = library->instance();
+ if (!instance) {
library->release();
+ // ignore plugins that have a valid signature but cannot be loaded.
continue;
}
- d->libraryList += library;
- for (int k = 0; k < keys.count(); ++k) {
- // first come first serve, unless the first
- // library was built with a future Qt version,
- // whereas the new one has a Qt version that fits
- // better
- QString key = keys.at(k);
- if (!d->cs)
- key = key.toLower();
- QLibraryPrivate *previous = d->keyMap.value(key);
- if (!previous || (previous->qt_version > QT_VERSION && library->qt_version <= QT_VERSION)) {
- d->keyMap[key] = library;
- d->keyList += keys.at(k);
- }
+ QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance);
+ if (instance && factory && instance->qt_metacast(d->iid))
+ keys = factory->keys();
+ if (keys.isEmpty())
+ library->unload();
+ reg.clear();
+ reg << library->lastModified;
+ reg += keys;
+ settings.setValue(regkey, reg);
+ }
+ if (qt_debug_component()) {
+ qDebug() << "keys" << keys;
+ }
+
+ if (keys.isEmpty()) {
+ library->release();
+ continue;
+ }
+
+ int keysUsed = 0;
+ for (int k = 0; k < keys.count(); ++k) {
+ // first come first serve, unless the first
+ // library was built with a future Qt version,
+ // whereas the new one has a Qt version that fits
+ // better
+ QString key = keys.at(k);
+ if (!d->cs)
+ key = key.toLower();
+ QLibraryPrivate *previous = d->keyMap.value(key);
+ if (!previous || (previous->qt_version > QT_VERSION && library->qt_version <= QT_VERSION)) {
+ d->keyMap[key] = library;
+ d->keyList += keys.at(k);
+ keysUsed++;
}
}
+ if (keysUsed)
+ d->libraryList += library;
+ else
+ library->release();
+ }
+}
+
+void QFactoryLoader::update()
+{
+#ifdef QT_SHARED
+ Q_D(QFactoryLoader);
+ QStringList paths = QCoreApplication::libraryPaths();
+ QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
+ for (int i = 0; i < paths.count(); ++i) {
+ const QString &pluginDir = paths.at(i);
+ // Already loaded, skip it...
+ if (d->loadedPaths.contains(pluginDir))
+ continue;
+ d->loadedPaths << pluginDir;
+ updateDir(pluginDir, settings);
}
#else
Q_D(QFactoryLoader);
@@ -264,6 +301,56 @@ void QFactoryLoader::refreshAll()
}
}
+#ifdef Q_OS_SYMBIAN
+QSymbianSystemPluginWatcher::QSymbianSystemPluginWatcher()
+{
+ qt_s60GetRFs().DriveList(drives);
+ watchForUpdates();
+}
+
+QSymbianSystemPluginWatcher::~QSymbianSystemPluginWatcher()
+{
+ qDeleteAll(watchers);
+}
+
+void QSymbianSystemPluginWatcher::watchForUpdates()
+{
+ QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath);
+ if (installPathPlugins.at(1) == QChar(QLatin1Char(':')))
+ return;
+
+ installPathPlugins.prepend(QLatin1String("?:"));
+ installPathPlugins = QDir::toNativeSeparators(installPathPlugins);
+ RFs& fs = qt_s60GetRFs();
+ for (int i=0; i<KMaxDrives; i++) {
+ int attr = drives[i];
+ if ((attr & KDriveAttLocal) && !(attr & KDriveAttRom)) {
+ // start new watcher
+ TChar driveLetter;
+ fs.DriveToChar(i, driveLetter);
+ installPathPlugins[0] = driveLetter;
+ TPtrC ptr(qt_QString2TPtrC(installPathPlugins));
+ QNotifyChangeEvent *event = q_check_ptr(new QNotifyChangeEvent(fs, ptr, this, true));
+ watchers.push_back(event);
+ }
+ }
+}
+
+void QSymbianSystemPluginWatcher::handlePathChanged(QNotifyChangeEvent *e)
+{
+ QCoreApplicationPrivate::rebuildInstallLibraryPaths();
+ QMutexLocker locker(qt_factoryloader_mutex());
+ QString dirName(QDir::cleanPath(qt_TDesC2QString(e->watchedPath)));
+ QList<QFactoryLoader *> *loaders = qt_factory_loaders();
+ for (QList<QFactoryLoader *>::const_iterator it = loaders->constBegin();
+ it != loaders->constEnd(); ++it) {
+ QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
+ (*it)->updateDir(dirName, settings);
+ }
+}
+
+#endif
+
QT_END_NAMESPACE
#endif // QT_NO_LIBRARY
diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h
index e90ebf66c3..8548ab2359 100644
--- a/src/corelib/plugin/qfactoryloader_p.h
+++ b/src/corelib/plugin/qfactoryloader_p.h
@@ -82,6 +82,7 @@ public:
#endif
void update();
+ void updateDir(const QString &pluginDir, QSettings& settings);
static void refreshAll();
};
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index bbb64e42e7..9f9ea1a4ed 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -198,7 +198,7 @@ QPluginLoader::~QPluginLoader()
*/
QObject *QPluginLoader::instance()
{
- if (!isLoaded() && !load())
+ if (!load())
return 0;
if (!d->inst && d->instance)
d->inst = d->instance();
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index 0f67652fb5..9c7c243f49 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -302,10 +302,15 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
#endif // QT_NO_DATASTREAM
+inline static qreal q_deg2rad(qreal x)
+{
+ return x * qreal(0.01745329251994329576923690768489); /* pi/180 */
+}
-#ifndef M_2PI
-#define M_2PI 6.28318530717958647692528676655900576
-#endif
+inline static qreal q_rad2deg(qreal x)
+{
+ return x * qreal(57.295779513082320876798154814105); /* 180/pi */
+}
/*!
\class QLineF
@@ -575,7 +580,7 @@ qreal QLineF::angle() const
const qreal dx = pt2.x() - pt1.x();
const qreal dy = pt2.y() - pt1.y();
- const qreal theta = qAtan2(-dy, dx) * 360.0 / M_2PI;
+ const qreal theta = q_rad2deg(qAtan2(-dy, dx));
const qreal theta_normalized = theta < 0 ? theta + 360 : theta;
@@ -599,7 +604,7 @@ qreal QLineF::angle() const
*/
void QLineF::setAngle(qreal angle)
{
- const qreal angleR = angle * M_2PI / 360.0;
+ const qreal angleR = q_deg2rad(angle);
const qreal l = length();
const qreal dx = qCos(angleR) * l;
@@ -621,7 +626,7 @@ void QLineF::setAngle(qreal angle)
*/
QLineF QLineF::fromPolar(qreal length, qreal angle)
{
- const qreal angleR = angle * M_2PI / 360.0;
+ const qreal angleR = q_deg2rad(angle);
return QLineF(0, 0, qCos(angleR) * length, -qSin(angleR) * length);
}
@@ -815,8 +820,8 @@ qreal QLineF::angle(const QLineF &l) const
qreal cos_line = (dx()*l.dx() + dy()*l.dy()) / (length()*l.length());
qreal rad = 0;
// only accept cos_line in the range [-1,1], if it is outside, use 0 (we return 0 rather than PI for those cases)
- if (cos_line >= -1.0 && cos_line <= 1.0) rad = qAcos( cos_line );
- return rad * 360 / M_2PI;
+ if (cos_line >= qreal(-1.0) && cos_line <= qreal(1.0)) rad = qAcos( cos_line );
+ return q_rad2deg(rad);
}
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
index 70fc702bee..4dcf17cfbc 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
@@ -228,9 +228,9 @@ void QDeclarativeFlipablePrivate::updateSceneTransformFromParent()
if (current == QDeclarativeFlipable::Back && back)
setBackTransform();
if (front)
- front->setOpacity((current==QDeclarativeFlipable::Front)?1.:0.);
+ front->setOpacity((current==QDeclarativeFlipable::Front)?qreal(1.):qreal(0.));
if (back)
- back->setOpacity((current==QDeclarativeFlipable::Back)?1.:0.);
+ back->setOpacity((current==QDeclarativeFlipable::Back)?qreal(1.):qreal(0.));
emit q->sideChanged();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 023737d0d0..a7d593a6b2 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1212,10 +1212,10 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
}
qreal accel = deceleration;
qreal v2 = v * v;
- qreal overshootDist = 0.0;
- if ((maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeGridView::SnapOneRow) {
+ qreal overshootDist = qreal(0.0);
+ if ((maxDistance > qreal(0.0) && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeGridView::SnapOneRow) {
// + rowSize()/4 to encourage moving at least one item in the flick direction
- qreal dist = v2 / (accel * 2.0) + rowSize()/4;
+ qreal dist = v2 / (accel * qreal(2.0)) + rowSize()/4;
dist = qMin(dist, maxDistance);
if (v > 0)
dist = -dist;
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 6a91e5fe9d..44d6a1a7f4 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1457,14 +1457,14 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
// the initial flick - estimate boundary
qreal accel = deceleration;
qreal v2 = v * v;
- overshootDist = 0.0;
+ overshootDist = qreal(0.0);
// + averageSize/4 to encourage moving at least one item in the flick direction
- qreal dist = v2 / (accel * 2.0) + averageSize/4;
+ qreal dist = v2 / (accel * qreal(2.0)) + averageSize/4;
if (maxDistance > 0)
dist = qMin(dist, maxDistance);
if (v > 0)
dist = -dist;
- if ((maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeListView::SnapOneItem) {
+ if ((maxDistance > qreal(0.0) && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeListView::SnapOneItem) {
if (snapMode != QDeclarativeListView::SnapOneItem) {
qreal distTemp = isRightToLeft() ? -dist : dist;
data.flickTarget = -snapPosAt(-(dataValue - highlightStart) + distTemp) + highlightStart;
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 94f128dca8..ecd8982a96 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -246,7 +246,7 @@ void QDeclarativePathViewPrivate::updateHighlight()
} else {
qreal target = currentIndex;
- offsetAdj = 0.0;
+ offsetAdj = qreal(0.0);
tl.reset(moveHighlight);
moveHighlight.setValue(highlightPosition);
@@ -255,14 +255,14 @@ void QDeclarativePathViewPrivate::updateHighlight()
if (target - highlightPosition > modelCount/2) {
highlightUp = false;
qreal distance = modelCount - target + highlightPosition;
- tl.move(moveHighlight, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * highlightPosition / distance));
- tl.set(moveHighlight, modelCount-0.01);
+ tl.move(moveHighlight, qreal(0.0), QEasingCurve(QEasingCurve::InQuad), int(duration * highlightPosition / distance));
+ tl.set(moveHighlight, modelCount-qreal(0.01));
tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * (modelCount-target) / distance));
} else if (target - highlightPosition <= -modelCount/2) {
highlightUp = true;
qreal distance = modelCount - highlightPosition + target;
- tl.move(moveHighlight, modelCount-0.01, QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-highlightPosition) / distance));
- tl.set(moveHighlight, 0.0);
+ tl.move(moveHighlight, modelCount-qreal(0.01), QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-highlightPosition) / distance));
+ tl.set(moveHighlight, qreal(0.0));
tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * target / distance));
} else {
highlightUp = highlightPosition - target < 0;
@@ -287,18 +287,18 @@ void QDeclarativePathViewPrivate::setHighlightPosition(qreal pos)
qreal relativeHighlight = qmlMod(pos + offset, range) / range;
if (!highlightUp && relativeHighlight > end * mappedRange) {
- qreal diff = 1.0 - relativeHighlight;
+ qreal diff = qreal(1.0) - relativeHighlight;
setOffset(offset + diff * range);
} else if (highlightUp && relativeHighlight >= (end - start) * mappedRange) {
qreal diff = relativeHighlight - (end - start) * mappedRange;
- setOffset(offset - diff * range - 0.00001);
+ setOffset(offset - diff * range - qreal(0.00001));
}
highlightPosition = pos;
qreal pathPos = positionOfIndex(pos);
updateItem(highlightItem, pathPos);
if (QDeclarativePathViewAttached *att = attached(highlightItem))
- att->setOnPath(pathPos != -1.0);
+ att->setOnPath(pathPos != qreal(-1.0));
}
}
@@ -1200,7 +1200,7 @@ void QDeclarativePathViewPrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve
qreal elapsed = qreal(lastElapsed + QDeclarativeItemPrivate::elapsed(lastPosTime)) / 1000.;
qreal velocity = elapsed > 0. ? lastDist / elapsed : 0;
- if (model && modelCount && qAbs(velocity) > 1.) {
+ if (model && modelCount && qAbs(velocity) > qreal(1.)) {
qreal count = pathItems == -1 ? modelCount : pathItems;
if (qAbs(velocity) > count * 2) // limit velocity
velocity = (velocity > 0 ? count : -count) * 2;
@@ -1208,7 +1208,7 @@ void QDeclarativePathViewPrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve
qreal v2 = velocity*velocity;
qreal accel = deceleration/10;
// + 0.25 to encourage moving at least one item in the flick direction
- qreal dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0) + 0.25));
+ qreal dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * qreal(2.0)) + qreal(0.25)));
if (haveHighlightRange && highlightRangeMode == QDeclarativePathView::StrictlyEnforceRange) {
// round to nearest item.
if (velocity > 0.)
@@ -1217,13 +1217,13 @@ void QDeclarativePathViewPrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve
dist = qRound(dist - offset) + offset;
// Calculate accel required to stop on item boundary
if (dist <= 0.) {
- dist = 0.;
- accel = 0.;
+ dist = qreal(0.);
+ accel = qreal(0.);
} else {
accel = v2 / (2.0f * qAbs(dist));
}
}
- offsetAdj = 0.0;
+ offsetAdj = qreal(0.0);
moveOffset.setValue(offset);
tl.accel(moveOffset, velocity, accel, dist);
tl.callback(QDeclarativeTimeLineCallback(&moveOffset, fixOffsetCallback, this));
@@ -1588,7 +1588,7 @@ void QDeclarativePathView::createdItem(int index, QDeclarativeItem *item)
att->setOnPath(false);
}
item->setParentItem(this);
- d->updateItem(item, index < d->firstIndex ? 0.0 : 1.0);
+ d->updateItem(item, index < d->firstIndex ? qreal(0.0) : qreal(1.0));
}
}
diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp
index 588b6bf306..513cae2da1 100644
--- a/src/declarative/qml/qdeclarativesqldatabase.cpp
+++ b/src/declarative/qml/qdeclarativesqldatabase.cpp
@@ -175,7 +175,7 @@ static const char* sqlerror[] = {
static QString qmlsqldatabase_databasesPath(QScriptEngine *engine)
{
QDeclarativeScriptEngine *qmlengine = static_cast<QDeclarativeScriptEngine*>(engine);
- return qmlengine->offlineStoragePath
+ return QDir::toNativeSeparators(qmlengine->offlineStoragePath)
+ QDir::separator() + QLatin1String("Databases");
}
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index ce21bcd30e..455c4f6906 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -2719,7 +2719,7 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions,
}
if (scale != 0)
- rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI;
+ rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/qreal(M_PI);
else {
qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under scale of 0");
ok = false;
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
index b77db89043..e905d0ad84 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation.cpp
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -51,7 +51,7 @@
#include <QtCore/qdebug.h>
-#include <math.h>
+#include <QtCore/qmath.h>
#define DELAY_STOP_TIMER_INTERVAL 32
@@ -98,20 +98,20 @@ bool QSmoothedAnimation::recalc()
s = to - initialValue;
vi = initialVelocity;
- s = (invert? -1.0: 1.0) * s;
+ s = (invert? qreal(-1.0): qreal(1.0)) * s;
if (userDuration > 0 && velocity > 0) {
tf = s / velocity;
- if (tf > (userDuration / 1000.)) tf = (userDuration / 1000.);
+ if (tf > (userDuration / qreal(1000.))) tf = (userDuration / qreal(1000.));
} else if (userDuration > 0) {
- tf = userDuration / 1000.;
+ tf = userDuration / qreal(1000.);
} else if (velocity > 0) {
tf = s / velocity;
} else {
return false;
}
- finalDuration = ceil(tf * 1000.0);
+ finalDuration = ceil(tf * qreal(1000.0));
if (maximumEasingTime == 0) {
a = 0;
@@ -121,33 +121,33 @@ bool QSmoothedAnimation::recalc()
vp = velocity;
sp = 0;
sd = s;
- } else if (maximumEasingTime != -1 && tf > (maximumEasingTime / 1000.)) {
- qreal met = maximumEasingTime / 1000.;
+ } else if (maximumEasingTime != -1 && tf > (maximumEasingTime / qreal(1000.))) {
+ qreal met = maximumEasingTime / qreal(1000.);
td = tf - met;
qreal c1 = td;
qreal c2 = (tf - td) * vi - tf * velocity;
- qreal c3 = -0.5 * (tf - td) * vi * vi;
+ qreal c3 = qreal(-0.5) * (tf - td) * vi * vi;
- qreal vp1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);
+ qreal vp1 = (-c2 + qSqrt(c2 * c2 - 4 * c1 * c3)) / (qreal(2.) * c1);
vp = vp1;
a = vp / met;
d = a;
tp = (vp - vi) / a;
- sp = vi * tp + 0.5 * a * tp * tp;
+ sp = vi * tp + qreal(0.5) * a * tp * tp;
sd = sp + (td - tp) * vp;
} else {
- qreal c1 = 0.25 * tf * tf;
- qreal c2 = 0.5 * vi * tf - s;
- qreal c3 = -0.25 * vi * vi;
+ qreal c1 = qreal(0.25) * tf * tf;
+ qreal c2 = qreal(0.5) * vi * tf - s;
+ qreal c3 = qreal(-0.25) * vi * vi;
- qreal a1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);
+ qreal a1 = (-c2 + qSqrt(c2 * c2 - 4 * c1 * c3)) / (qreal(2.) * c1);
- qreal tp1 = 0.5 * tf - 0.5 * vi / a1;
+ qreal tp1 = qreal(0.5) * tf - qreal(0.5) * vi / a1;
qreal vp1 = a1 * tp1 + vi;
- qreal sp1 = 0.5 * a1 * tp1 * tp1 + vi * tp1;
+ qreal sp1 = qreal(0.5) * a1 * tp1 * tp1 + vi * tp1;
a = a1;
d = a1;
@@ -165,7 +165,7 @@ qreal QSmoothedAnimation::easeFollow(qreal time_seconds)
qreal value;
if (time_seconds < tp) {
trackVelocity = vi + time_seconds * a;
- value = 0.5 * a * time_seconds * time_seconds + vi * time_seconds;
+ value = qreal(0.5) * a * time_seconds * time_seconds + vi * time_seconds;
} else if (time_seconds < td) {
time_seconds -= tp;
trackVelocity = vp;
@@ -173,7 +173,7 @@ qreal QSmoothedAnimation::easeFollow(qreal time_seconds)
} else if (time_seconds < tf) {
time_seconds -= td;
trackVelocity = vp - time_seconds * a;
- value = sd - 0.5 * d * time_seconds * time_seconds + vp * time_seconds;
+ value = sd - qreal(0.5) * d * time_seconds * time_seconds + vp * time_seconds;
} else {
trackVelocity = 0;
value = s;
@@ -186,10 +186,10 @@ qreal QSmoothedAnimation::easeFollow(qreal time_seconds)
void QSmoothedAnimation::updateCurrentTime(int t)
{
- qreal time_seconds = qreal(t - lastTime) / 1000.;
+ qreal time_seconds = qreal(t - lastTime) / qreal(1000.);
qreal value = easeFollow(time_seconds);
- value *= (invert? -1.0: 1.0);
+ value *= (invert? qreal(-1.0): qreal(1.0));
QDeclarativePropertyPrivate::write(target, initialValue + value,
QDeclarativePropertyPrivate::BypassInterceptor
| QDeclarativePropertyPrivate::DontRemoveBinding);
@@ -213,7 +213,7 @@ void QSmoothedAnimation::init()
return;
}
- bool hasReversed = trackVelocity != 0. &&
+ bool hasReversed = trackVelocity != qreal(0.) &&
((!invert) == ((initialValue - to) > 0));
if (hasReversed) {
diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp
index 2c6058caf6..0b453eed3f 100644
--- a/src/declarative/util/qdeclarativespringanimation.cpp
+++ b/src/declarative/util/qdeclarativespringanimation.cpp
@@ -161,17 +161,17 @@ bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &pro
animation.velocity = animation.velocity + (spring * diff - damping * animation.velocity) / mass;
else
animation.velocity = animation.velocity + spring * diff - damping * animation.velocity;
- if (maxVelocity > 0.) {
+ if (maxVelocity > qreal(0.)) {
// limit velocity
if (animation.velocity > maxVelocity)
animation.velocity = maxVelocity;
else if (animation.velocity < -maxVelocity)
animation.velocity = -maxVelocity;
}
- animation.currentValue += animation.velocity * 16.0 / 1000.0;
+ animation.currentValue += animation.velocity * qreal(16.0) / qreal(1000.0);
if (haveModulus) {
animation.currentValue = fmod(animation.currentValue, modulus);
- if (animation.currentValue < 0.0)
+ if (animation.currentValue < qreal(0.0))
animation.currentValue += modulus;
}
}
@@ -195,7 +195,7 @@ bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &pro
animation.currentValue = fmod(animation.currentValue, modulus);
} else {
animation.currentValue -= moveBy;
- if (haveModulus && animation.currentValue < 0.0)
+ if (haveModulus && animation.currentValue < qreal(0.0))
animation.currentValue = fmod(animation.currentValue, modulus) + modulus;
}
if (lastTime - animation.start >= animation.duration) {
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index c260684eef..8f613b0212 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -123,7 +123,7 @@ void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, Q
}
if (scale != 0)
- rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI;
+ rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/qreal(M_PI);
else {
qmlInfo(q) << QDeclarativeParentChange::tr("Unable to preserve appearance under scale of 0");
ok = false;
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 658dcad0f0..980568e683 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -530,7 +530,7 @@ public:
void notifyQueryStarted(bool remoteSource) {
Q_Q(QDeclarativeXmlListModel);
- progress = remoteSource ? 0.0 : 1.0;
+ progress = remoteSource ? qreal(0.0) : qreal(1.0);
status = QDeclarativeXmlListModel::Loading;
errorString.clear();
emit q->progressChanged(progress);
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index f7ae045974..73e8eed6e2 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -8870,7 +8870,7 @@ QPainterPath QGraphicsEllipseItem::shape() const
return path;
if (d->spanAngle != 360 * 16) {
path.moveTo(d->rect.center());
- path.arcTo(d->rect, d->startAngle / 16.0, d->spanAngle / 16.0);
+ path.arcTo(d->rect, d->startAngle / qreal(16.0), d->spanAngle / qreal(16.0));
} else {
path.addEllipse(d->rect);
}
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 867880c621..d652f25e49 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4304,7 +4304,7 @@ static void _q_paintItem(QGraphicsItem *item, QPainter *painter,
QGraphicsWidget *widgetItem = static_cast<QGraphicsWidget *>(item);
QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(widgetItem);
const qreal windowOpacity = (proxy && proxy->widget() && useWindowOpacity)
- ? proxy->widget()->windowOpacity() : 1.0;
+ ? proxy->widget()->windowOpacity() : qreal(1.0);
const qreal oldPainterOpacity = painter->opacity();
if (qFuzzyIsNull(windowOpacity))
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 548f79fa17..d2e21fba89 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -298,7 +298,7 @@ inline int q_round_bound(qreal d) //### (int)(qreal) INT_MAX != INT_MAX for sing
return INT_MIN;
else if (d >= (qreal) INT_MAX)
return INT_MAX;
- return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1);
+ return d >= 0.0 ? int(d + qreal(0.5)) : int(d - int(d-1) + qreal(0.5)) + int(d-1);
}
void QGraphicsViewPrivate::translateTouchEvent(QGraphicsViewPrivate *d, QTouchEvent *touchEvent)
@@ -1830,14 +1830,14 @@ void QGraphicsView::centerOn(const QPointF &pos)
qint64 horizontal = 0;
horizontal += horizontalScrollBar()->minimum();
horizontal += horizontalScrollBar()->maximum();
- horizontal -= int(viewPoint.x() - width / 2.0);
+ horizontal -= int(viewPoint.x() - width / qreal(2.0));
horizontalScrollBar()->setValue(horizontal);
} else {
- horizontalScrollBar()->setValue(int(viewPoint.x() - width / 2.0));
+ horizontalScrollBar()->setValue(int(viewPoint.x() - width / qreal(2.0)));
}
}
if (!d->topIndent)
- verticalScrollBar()->setValue(int(viewPoint.y() - height / 2.0));
+ verticalScrollBar()->setValue(int(viewPoint.y() - height / qreal(2.0)));
d->lastCenterPoint = oldCenterPoint;
}
@@ -1886,22 +1886,22 @@ void QGraphicsView::ensureVisible(const QRectF &rect, int xmargin, int ymargin)
if (viewRect.left() <= left + xmargin) {
// need to scroll from the left
if (!d->leftIndent)
- horizontalScrollBar()->setValue(int(viewRect.left() - xmargin - 0.5));
+ horizontalScrollBar()->setValue(int(viewRect.left() - xmargin - qreal(0.5)));
}
if (viewRect.right() >= right - xmargin) {
// need to scroll from the right
if (!d->leftIndent)
- horizontalScrollBar()->setValue(int(viewRect.right() - width + xmargin + 0.5));
+ horizontalScrollBar()->setValue(int(viewRect.right() - width + xmargin + qreal(0.5)));
}
if (viewRect.top() <= top + ymargin) {
// need to scroll from the top
if (!d->topIndent)
- verticalScrollBar()->setValue(int(viewRect.top() - ymargin - 0.5));
+ verticalScrollBar()->setValue(int(viewRect.top() - ymargin - qreal(0.5)));
}
if (viewRect.bottom() >= bottom - ymargin) {
// need to scroll from the bottom
if (!d->topIndent)
- verticalScrollBar()->setValue(int(viewRect.bottom() - height + ymargin + 0.5));
+ verticalScrollBar()->setValue(int(viewRect.bottom() - height + ymargin + qreal(0.5)));
}
}
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index ca6713bf24..ec79a2fd30 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -482,8 +482,8 @@ static QSizeF closestAcceptableSize(const QSizeF &proposed,
minw = maxw;
minh = maxh;
}
- middlew = minw + (maxw - minw)/2.0;
- middleh = minh + (maxh - minh)/2.0;
+ middlew = minw + (maxw - minw)/qreal(2.0);
+ middleh = minh + (maxh - minh)/qreal(2.0);
min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget);
diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp
index 66b4a5b6b4..5c614357d8 100644
--- a/src/gui/graphicsview/qgridlayoutengine.cpp
+++ b/src/gui/graphicsview/qgridlayoutengine.cpp
@@ -84,7 +84,7 @@ static qreal fixedDescent(qreal descent, qreal ascent, qreal targetSize)
Q_ASSERT(targetSize >= ascent + descent);
qreal extra = targetSize - (ascent + descent);
- return descent + (extra / 2.0);
+ return descent + (extra / qreal(2.0));
}
static qreal compare(const QGridLayoutBox &box1, const QGridLayoutBox &box2, int which)
@@ -292,9 +292,9 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
int stretch = stretches[start + i];
if (sumStretches == 0) {
if (hasIgnoreFlag) {
- factors[i] = (stretch < 0) ? 1.0 : 0.0;
+ factors[i] = (stretch < 0) ? qreal(1.0) : qreal(0.0);
} else {
- factors[i] = (stretch < 0) ? sizes[i] : 0.0;
+ factors[i] = (stretch < 0) ? sizes[i] : qreal(0.0);
}
} else if (stretch == sumStretches) {
factors[i] = 1.0;
@@ -373,7 +373,7 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
for (int i = 0; i < n; ++i) {
if (newSizes[i] < 0.0) {
- qreal delta = (sumFactors == 0.0) ? 0.0
+ qreal delta = (sumFactors == 0.0) ? qreal(0.0)
: sumCurrentAvailable * factors[i] / sumFactors;
newSizes[i] = sizes[i] + delta;
}
diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp
index eb8bcb8c1f..1b45d9d9f5 100644
--- a/src/gui/graphicsview/qsimplex_p.cpp
+++ b/src/gui/graphicsview/qsimplex_p.cpp
@@ -486,7 +486,7 @@ bool QSimplex::iterate()
// Normalize Pivot Row
qreal pivot = valueAt(pivotRow, pivotColumn);
if (pivot != 1.0)
- combineRows(pivotRow, pivotRow, (1.0 - pivot) / pivot);
+ combineRows(pivotRow, pivotRow, (qreal(1.0) - pivot) / pivot);
// Update other rows
for (int row=0; row < rows; ++row) {
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index a3378de443..f527bcf5cb 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -5908,12 +5908,12 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth
uchar *dptr, int dbpl, int p_inc, int dHeight,
const uchar *sptr, int sbpl, int sWidth, int sHeight)
{
- int m11 = int(trueMat.m11()*4096.0);
- int m12 = int(trueMat.m12()*4096.0);
- int m21 = int(trueMat.m21()*4096.0);
- int m22 = int(trueMat.m22()*4096.0);
- int dx = qRound(trueMat.dx()*4096.0);
- int dy = qRound(trueMat.dy()*4096.0);
+ int m11 = int(trueMat.m11()*qreal(4096.0));
+ int m12 = int(trueMat.m12()*qreal(4096.0));
+ int m21 = int(trueMat.m21()*qreal(4096.0));
+ int m22 = int(trueMat.m22()*qreal(4096.0));
+ int dx = qRound(trueMat.dx()*qreal(4096.0));
+ int dy = qRound(trueMat.dy()*qreal(4096.0));
int m21ydx = dx + (xoffset<<16) + (m11 + m21) / 2;
int m22ydy = dy + (m12 + m22) / 2;
diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp
index 9734c82494..350d70ff42 100644
--- a/src/gui/image/qvolatileimage.cpp
+++ b/src/gui/image/qvolatileimage.cpp
@@ -248,12 +248,14 @@ void QVolatileImage::copyFrom(QVolatileImage *source, const QRect &rect)
const uchar *sptr = srcImgRef.constBits() + r.y() * srcbpl;
beginDataAccess();
QImage &dstImgRef(imageRef());
- int dstbpl = dstImgRef.bytesPerLine();
- uchar *dptr = dstImgRef.bits();
- for (int y = 0; y < r.height(); ++y) {
- qMemCopy(dptr, sptr + r.x() * srcbpp, r.width() * srcbpp);
- sptr += srcbpl;
- dptr += dstbpl;
+ if (!dstImgRef.isNull()) {
+ int dstbpl = dstImgRef.bytesPerLine();
+ uchar *dptr = dstImgRef.bits();
+ for (int y = 0; y < r.height(); ++y) {
+ qMemCopy(dptr, sptr + r.x() * srcbpp, r.width() * srcbpp);
+ sptr += srcbpl;
+ dptr += dstbpl;
+ }
}
endDataAccess();
source->endDataAccess(true);
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index 8ef9726632..ad51b4b265 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_p.h
+++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
@@ -136,6 +136,7 @@ private:
private Q_SLOTS:
void ensureInputCapabilitiesChanged();
void translateInputWidget();
+ void ensureWidgetVisibility();
// From MCoeFepAwareTextEditor
public:
@@ -208,6 +209,7 @@ private:
int m_splitViewResizeBy;
Qt::WindowStates m_splitViewPreviousWindowStates;
QRectF m_transformation;
+ QGraphicsItem *m_splitViewPreviousFocusItem; //can't use QPointer<> since QGraphicsItem is not a QObject.
CAknCcpuSupport *m_ccpu;
QAction *m_copyAction;
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 90252216d8..8f13c53898 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -94,6 +94,11 @@
#define QT_EPSUidAknFep 0x100056de
#define QT_EAknFepTouchInputActive 0x00000004
+// For compatibility with older Symbian^3 environments, which do not have this define yet.
+#ifndef R_AVKON_DISCREET_POPUP_TEXT_COPIED
+#define R_AVKON_DISCREET_POPUP_TEXT_COPIED 0x8cc0227
+#endif
+
_LIT(KAvkonResourceFile, "z:\\resource\\avkon.rsc" );
QT_BEGIN_NAMESPACE
@@ -377,6 +382,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_hasTempPreeditString(false),
m_splitViewResizeBy(0),
m_splitViewPreviousWindowStates(Qt::WindowNoState),
+ m_splitViewPreviousFocusItem(0),
m_ccpu(0)
{
m_fepState->SetObjectProvider(this);
@@ -446,6 +452,11 @@ void QCoeFepInputContext::reset()
if (m_cachedPreeditString.isEmpty() && !(currentHints & Qt::ImhNoPredictiveText))
m_cachedPreeditString = m_preeditString;
commitCurrentString(true);
+
+ // QGraphicsScene calls reset() when changing focus item. Unfortunately, the new focus item is
+ // set right after resetting the input context. Therefore, asynchronously call ensureWidgetVisibility().
+ if (S60->splitViewLastWidget)
+ QMetaObject::invokeMethod(this,"ensureWidgetVisibility", Qt::QueuedConnection);
}
void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType)
@@ -788,9 +799,8 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget)
{
QGraphicsView *gv = qobject_cast<QGraphicsView*>(S60->splitViewLastWidget);
- if (!gv) {
+ if (!gv)
return;
- }
QSymbianControl *symControl = static_cast<QSymbianControl*>(gv->effectiveWinId());
symControl->CancelLongTapTimer();
@@ -805,11 +815,13 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget)
if (!alwaysResize) {
if (gv->scene() && S60->partial_keyboardAutoTranslation) {
if (gv->scene()->focusItem()) {
+ QGraphicsItem *focusItem =
+ m_splitViewPreviousFocusItem ? m_splitViewPreviousFocusItem : gv->scene()->focusItem();
// Check if the widget contains cursorPositionChanged signal and disconnect from it.
QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged()));
- int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1));
+ int index = focusItem->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1));
if (index != -1)
- disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget()));
+ disconnect(focusItem->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget()));
}
QGraphicsItem *rootItem = 0;
@@ -877,10 +889,18 @@ bool QCoeFepInputContext::isPartialKeyboardSupported()
return (S60->partial_keyboard || !QApplication::testAttribute(Qt::AA_S60DisablePartialScreenInputMode));
}
+void QCoeFepInputContext::ensureWidgetVisibility()
+{
+ ensureFocusWidgetVisible(S60->splitViewLastWidget);
+}
+
// Ensure that the input widget is visible in the splitview rect.
void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget)
{
+ if (!widget)
+ return;
+
// Native side opening and closing its virtual keyboard when it changes the keyboard layout,
// has an adverse impact on long tap timer. Cancel the timer when splitview opens to avoid this.
QSymbianControl *symControl = static_cast<QSymbianControl*>(widget->effectiveWinId());
@@ -908,17 +928,22 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget)
// states getting changed.
if (!moveWithinVisibleArea) {
- // Check if the widget contains cursorPositionChanged signal and connect to it.
- QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged()));
- if (gv->scene() && gv->scene()->focusItem() && S60->partial_keyboardAutoTranslation) {
- int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1));
- if (index != -1)
- connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget()));
- }
S60->splitViewLastWidget = widget;
m_splitViewPreviousWindowStates = windowToMove->windowState();
}
+ // Check if the widget contains cursorPositionChanged signal and connect to it.
+ if (gv->scene() && gv->scene()->focusItem() && S60->partial_keyboardAutoTranslation) {
+ QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged()));
+ if (m_splitViewPreviousFocusItem && m_splitViewPreviousFocusItem != gv->scene()->focusItem())
+ disconnect(m_splitViewPreviousFocusItem->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget()));
+ int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1));
+ if (index != -1) {
+ connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget()));
+ m_splitViewPreviousFocusItem = gv->scene()->focusItem();
+ }
+ }
+
int windowTop = widget->window()->pos().y();
const bool userResize = widget->testAttribute(Qt::WA_Resized);
@@ -1083,6 +1108,9 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
} else if (hints & ImhNoAutoUppercase) {
m_fepState->SetDefaultCase(EAknEditorLowerCase);
m_fepState->SetCurrentCase(EAknEditorLowerCase);
+ } else if (hints & ImhHiddenText) {
+ m_fepState->SetDefaultCase(EAknEditorLowerCase);
+ m_fepState->SetCurrentCase(EAknEditorLowerCase);
} else {
m_fepState->SetDefaultCase(EAknEditorTextCase);
m_fepState->SetCurrentCase(EAknEditorTextCase);
@@ -1094,6 +1122,10 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
if (hints & ImhLowercaseOnly) {
flags |= EAknEditorLowerCase;
}
+ if (hints & ImhHiddenText) {
+ flags = EAknEditorAllCaseModes;
+ flags &= ~EAknEditorTextCase;
+ }
if (flags == 0) {
flags = EAknEditorAllCaseModes;
if (hints & ImhNoAutoUppercase) {
@@ -1254,10 +1286,15 @@ void QCoeFepInputContext::translateInputWidget()
m_transformation = (rootItem->transform().isTranslating()) ? QRectF(0,0, gv->width(), rootItem->transform().dy()) : QRectF();
- // Adjust cursor bounding rect to be lower, so that view translates if the cursor gets near
- // the splitview border.
- QRect cursorRect = cursorP.boundingRect().adjusted(0, cursor.height(), 0, cursor.height());
- if (splitViewRect.contains(cursorRect))
+ // Adjust cursor bounding rect towards navigation direction,
+ // so that view translates if the cursor gets near the splitview border.
+ QRect cursorRect = (cursorP.boundingRect().top() < 0) ?
+ cursorP.boundingRect().adjusted(0, -cursor.height(), 0, -cursor.height()) :
+ cursorP.boundingRect().adjusted(0, cursor.height(), 0, cursor.height());
+
+ // If the current cursor position and upcoming cursor positions are visible in the splitview
+ // area, do not move the view.
+ if (splitViewRect.contains(cursorRect) && splitViewRect.contains(cursorP.boundingRect()))
return;
// New Y position should be ideally just above the keyboard.
@@ -1269,18 +1306,29 @@ void QCoeFepInputContext::translateInputWidget()
const qreal itemHeight = path.boundingRect().height();
// Limit the maximum translation so that underlaying window content is not exposed.
- qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom();
- maxY = m_transformation.height() ? (qMin(itemHeight, maxY) + m_transformation.height()) : maxY;
- if (maxY < 0)
- maxY = 0;
+ qreal availableSpace = gv->sceneRect().bottom() - splitViewRect.bottom();
+ availableSpace = m_transformation.height() ?
+ (qMin(itemHeight, availableSpace) + m_transformation.height()) :
+ availableSpace;
// Translation should happen row-by-row, but initially it needs to ensure that cursor is visible.
const qreal translation = m_transformation.height() ?
cursor.height() : (cursorRect.bottom() - vkbRect.top());
- const qreal dy = -(qMin(maxY, translation));
+ qreal dy = 0.0;
+ if (availableSpace > 0)
+ dy = -(qMin(availableSpace, translation));
+ else
+ dy = -(translation);
+
+ // Correct the translation direction, if the cursor rect would be moved above application area.
+ if ((cursorP.boundingRect().bottom() + dy) < 0)
+ dy *= -1;
- // Do not allow transform above screen top, nor beyond scenerect
- if (m_transformation.height() + dy > 0 || gv->sceneRect().bottom() + m_transformation.height() < 0) {
+ // Do not allow transform above screen top, nor beyond scenerect. Also, if there is no available
+ // space anymore, skip translation.
+ if ((m_transformation.height() + dy) > 0
+ || (gv->sceneRect().bottom() + m_transformation.height()) < 0
+ || !availableSpace) {
// If we already have some transformation, remove it.
if (m_transformation.height() < 0 || gv->sceneRect().bottom() + m_transformation.height() < 0) {
rootItem->resetTransform();
@@ -1596,8 +1644,6 @@ void QCoeFepInputContext::changeCBA(bool showCopyAndOrPaste)
void QCoeFepInputContext::copyOrCutTextToClipboard(const char *operation)
{
- bool hasText = false;
-
QWidget *w = focusWidget();
QObject *focusObject = 0;
if (!w) {
@@ -1613,11 +1659,13 @@ void QCoeFepInputContext::copyOrCutTextToClipboard(const char *operation)
if (cursor != anchor) {
if (ccpuInvokeSlot(w, focusObject, operation)) {
- TRAP_IGNORE(
- CAknDiscreetPopup::ShowGlobalPopupL(
- R_AVKON_DISCREET_POPUP_TEXT_COPIED,
- KAvkonResourceFile);
- )
+ if (QSysInfo::symbianVersion() > QSysInfo::SV_SF_3) {
+ TRAP_IGNORE(
+ CAknDiscreetPopup::ShowGlobalPopupL(
+ R_AVKON_DISCREET_POPUP_TEXT_COPIED,
+ KAvkonResourceFile);
+ )
+ }
}
}
}
@@ -1696,15 +1744,33 @@ TBool QCoeFepInputContext::CcpuIsFocused() const
TBool QCoeFepInputContext::CcpuCanCut() const
{
bool retval = false;
+ if (m_inDestruction)
+ return retval;
QWidget *w = focusWidget();
- if (!w)
+ QObject *focusObject = 0;
+ if (!w) {
w = m_lastFocusedEditor;
- else
- w = getQWidgetFromQGraphicsView(w);
+ focusObject = m_lastFocusedObject;
+ } else {
+ w = getQWidgetFromQGraphicsView(w, &focusObject);
+ }
if (w) {
- int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
- int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt();
- retval = cursor != anchor;
+ QRect microFocus = w->inputMethodQuery(Qt::ImMicroFocus).toRect();
+ if (microFocus.isNull()) {
+ // For some reason, the editor does not have microfocus. Most probably,
+ // it is due to using native fullscreen editing mode with QML apps.
+ // Try accessing "selectedText" directly.
+ QObject *invokeTarget = w;
+ if (focusObject)
+ invokeTarget = focusObject;
+
+ QString selectedText = invokeTarget->property("selectedText").toString();
+ retval = !selectedText.isNull();
+ } else {
+ int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
+ int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt();
+ retval = cursor != anchor;
+ }
}
return retval;
}
@@ -1727,6 +1793,9 @@ void QCoeFepInputContext::CcpuCopyL()
TBool QCoeFepInputContext::CcpuCanPaste() const
{
bool canPaste = false;
+ if (m_inDestruction)
+ return canPaste;
+
QString textToPaste = QApplication::clipboard()->text();
if (!textToPaste.isEmpty()) {
QWidget *w = focusWidget();
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 80bcdf0ea5..03da630d05 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1493,12 +1493,15 @@ void QSymbianControl::handleClientAreaChange()
}
}
-bool QSymbianControl::isSplitViewWidget(QWidget *widget) {
+bool QSymbianControl::isSplitViewWidget(QWidget *widget)
+{
bool returnValue = true;
- //Ignore events sent to non-active windows, not visible widgets and not parents of input widget.
+ // Ignore events sent to non-active windows, not visible widgets and not parents of input widget
+ // and non-Qt dialogs.
if (!qwidget->isActiveWindow()
|| !qwidget->isVisible()
- || !qwidget->isAncestorOf(widget)) {
+ || !qwidget->isAncestorOf(widget)
+ || CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) {
returnValue = false;
}
diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp
index f880243a7e..178e7b1a46 100644
--- a/src/gui/kernel/qtooltip.cpp
+++ b/src/gui/kernel/qtooltip.cpp
@@ -184,7 +184,7 @@ QTipLabel::QTipLabel(const QString &text, QWidget *w)
setAlignment(Qt::AlignLeft);
setIndent(1);
qApp->installEventFilter(this);
- setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
+ setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / qreal(255.0));
setMouseTracking(true);
fadingOut = false;
reuseTip(text);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 9b5a28326f..7055c6b4b7 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -11063,7 +11063,7 @@ bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const
qreal QWidget::windowOpacity() const
{
Q_D(const QWidget);
- return (isWindow() && d->maybeTopData()) ? d->maybeTopData()->opacity / 255. : 1.0;
+ return (isWindow() && d->maybeTopData()) ? d->maybeTopData()->opacity / qreal(255.) : qreal(1.0);
}
void QWidget::setWindowOpacity(qreal opacity)
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 3d895b7753..2fe68a8e58 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -1578,7 +1578,7 @@ QColor QColor::toRgb() const
}
// chromatic case
- const qreal h = ct.ahsv.hue == 36000 ? 0 : ct.ahsv.hue / 6000.;
+ const qreal h = ct.ahsv.hue == 36000 ? 0 : ct.ahsv.hue / qreal(6000.);
const qreal s = ct.ahsv.saturation / qreal(USHRT_MAX);
const qreal v = ct.ahsv.value / qreal(USHRT_MAX);
const int i = int(h);
@@ -1638,7 +1638,7 @@ QColor QColor::toRgb() const
color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0;
} else {
// chromatic case
- const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / 36000.;
+ const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / qreal(36000.);
const qreal s = ct.ahsl.saturation / qreal(USHRT_MAX);
const qreal l = ct.ahsl.lightness / qreal(USHRT_MAX);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index bcc5f9d9b7..0fea2daf08 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1649,8 +1649,8 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
if (lines[i].p1() == lines[i].p2()) {
if (s->lastPen.capStyle() != Qt::FlatCap) {
QPointF p = lines[i].p1();
- QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*0.5, p.y()),
- QPointF(p.x() + width*0.5, p.y())));
+ QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*qreal(0.5), p.y()),
+ QPointF(p.x() + width*qreal(0.5), p.y())));
d->rasterizer->rasterizeLine(line.p1(), line.p2(), 1);
}
continue;
@@ -5117,7 +5117,7 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip,
{
const qreal a = qreal(rect.width()) / 2;
const qreal b = qreal(rect.height()) / 2;
- qreal d = b*b - (a*a*b) + 0.25*a*a;
+ qreal d = b*b - (a*a*b) + qreal(0.25)*a*a;
int x = 0;
int y = (rect.height() + 1) / 2;
@@ -5140,7 +5140,7 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip,
pen_func, brush_func, pen_data, brush_data);
// region 2
- d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b);
+ d = b*b*(x + qreal(0.5))*(x + qreal(0.5)) + a*a*((y - 1)*(y - 1) - b*b);
const int miny = rect.height() & 0x1;
while (y > miny) {
if (d < 0) { // select SE
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 6df410b27d..eaedc4c8b4 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -748,8 +748,8 @@ void QPaintEngineEx::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yR
qreal y2 = rect.bottom();
if (mode == Qt::RelativeSize) {
- xRadius = xRadius * rect.width() / 200.;
- yRadius = yRadius * rect.height() / 200.;
+ xRadius = xRadius * rect.width() / qreal(200.);
+ yRadius = yRadius * rect.height() / qreal(200.);
}
xRadius = qMin(xRadius, rect.width() / 2);
@@ -863,7 +863,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount)
for (int i=0; i<count; ++i) {
pts[++oset] = points[i].x();
pts[++oset] = points[i].y();
- pts[++oset] = points[i].x() + 1/63.;
+ pts[++oset] = points[i].x() + 1/qreal(63.);
pts[++oset] = points[i].y();
}
QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint);
@@ -873,7 +873,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount)
}
} else {
for (int i=0; i<pointCount; ++i) {
- qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 1/63., points[i].y() };
+ qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 1/qreal(63.), points[i].y() };
QVectorPath path(pts, 2, 0);
stroke(path, pen);
}
@@ -894,7 +894,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount)
for (int i=0; i<count; ++i) {
pts[++oset] = points[i].x();
pts[++oset] = points[i].y();
- pts[++oset] = points[i].x() + 1/63.;
+ pts[++oset] = points[i].x() + 1/qreal(63.);
pts[++oset] = points[i].y();
}
QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint);
@@ -905,7 +905,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount)
} else {
for (int i=0; i<pointCount; ++i) {
qreal pts[] = { qreal(points[i].x()), qreal(points[i].y()),
- qreal(points[i].x() +1/63.), qreal(points[i].y()) };
+ qreal(points[i].x() +1/qreal(63.)), qreal(points[i].y()) };
QVectorPath path(pts, 2, 0);
stroke(path, pen);
}
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index efb016e9e2..fb5ce96ec7 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -403,8 +403,8 @@ void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperatio
QPainterPath stroke = stroker.createStroke(originalPath);
strokeBounds = (stroke * state->matrix).boundingRect();
} else {
- strokeOffsetX = qAbs(penWidth * state->matrix.m11() / 2.0);
- strokeOffsetY = qAbs(penWidth * state->matrix.m22() / 2.0);
+ strokeOffsetX = qAbs(penWidth * state->matrix.m11() / qreal(2.0));
+ strokeOffsetY = qAbs(penWidth * state->matrix.m22() / qreal(2.0));
}
}
}
@@ -4460,8 +4460,8 @@ void QPainter::drawArc(const QRectF &r, int a, int alen)
QRectF rect = r.normalized();
QPainterPath path;
- path.arcMoveTo(rect, a/16.0);
- path.arcTo(rect, a/16.0, alen/16.0);
+ path.arcMoveTo(rect, a/qreal(16.0));
+ path.arcTo(rect, a/qreal(16.0), alen/qreal(16.0));
strokePath(path, d->state->pen);
}
@@ -4531,7 +4531,7 @@ void QPainter::drawPie(const QRectF &r, int a, int alen)
QPainterPath path;
path.moveTo(rect.center());
- path.arcTo(rect.x(), rect.y(), rect.width(), rect.height(), a/16.0, alen/16.0);
+ path.arcTo(rect.x(), rect.y(), rect.width(), rect.height(), a/qreal(16.0), alen/qreal(16.0));
path.closeSubpath();
drawPath(path);
@@ -4592,8 +4592,8 @@ void QPainter::drawChord(const QRectF &r, int a, int alen)
QRectF rect = r.normalized();
QPainterPath path;
- path.arcMoveTo(rect, a/16.0);
- path.arcTo(rect, a/16.0, alen/16.0);
+ path.arcMoveTo(rect, a/qreal(16.0));
+ path.arcTo(rect, a/qreal(16.0), alen/qreal(16.0));
path.closeSubpath();
drawPath(path);
}
@@ -9242,7 +9242,7 @@ void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragment
qreal h = fragments[i].scaleY * fragments[i].height;
QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,
fragments[i].width, fragments[i].height);
- drawPixmap(QRectF(-0.5 * w + xOffset, -0.5 * h + yOffset, w, h), pixmap, sourceRect);
+ drawPixmap(QRectF(qreal(-0.5) * w + xOffset, qreal(-0.5) * h + yOffset, w, h), pixmap, sourceRect);
}
setOpacity(oldOpacity);
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index 1d3f581b88..ca10e6aa68 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -51,8 +51,8 @@
QT_BEGIN_NAMESPACE
typedef int Q16Dot16;
-#define Q16Dot16ToFloat(i) ((i)/65536.)
-#define FloatToQ16Dot16(i) (int)((i) * 65536.)
+#define Q16Dot16ToFloat(i) ((i)/qreal(65536.))
+#define FloatToQ16Dot16(i) (int)((i) * qreal(65536.))
#define IntToQ16Dot16(i) ((i) << 16)
#define Q16Dot16ToInt(i) ((i) >> 16)
#define Q16Dot16Factor 65536
@@ -701,7 +701,7 @@ static Q16Dot16 intersectPixelFP(int x, Q16Dot16 top, Q16Dot16 bottom, Q16Dot16
static inline bool q26Dot6Compare(qreal p1, qreal p2)
{
- return int((p2 - p1) * 64.) == 0;
+ return int((p2 - p1) * qreal(64.)) == 0;
}
static inline qreal qFloorF(qreal v)
@@ -1210,8 +1210,8 @@ void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule)
QRectF bounds = path.controlPointRect();
- int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + (COORD_OFFSET - COORD_ROUNDING)/64.));
- int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + (COORD_OFFSET - COORD_ROUNDING)/64.));
+ int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + qreal(0.5) + (COORD_OFFSET - COORD_ROUNDING)/qreal(64.)));
+ int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - qreal(0.5) + (COORD_OFFSET - COORD_ROUNDING)/qreal(64.)));
if (iTopBound > iBottomBound)
return;
diff --git a/src/gui/painting/qtessellator.cpp b/src/gui/painting/qtessellator.cpp
index 94a5128d90..15e4f65469 100644
--- a/src/gui/painting/qtessellator.cpp
+++ b/src/gui/painting/qtessellator.cpp
@@ -1400,7 +1400,7 @@ void QTessellator::tessellateRect(const QPointF &a_, const QPointF &b_, qreal wi
if (delta.x == 0 && delta.y == 0)
return;
- qreal hw = 0.5 * width;
+ qreal hw = qreal(0.5) * width;
if (delta.x == 0) {
Q27Dot5 halfWidth = FloatToQ27Dot5(hw);
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index eec2d15ca7..59bd0dd657 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -1679,7 +1679,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafBarWaitAnim,
painter, progressRect, flags | orientationFlag | QS60StylePrivate::SF_Animation );
} else {
- const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? 1.0
+ const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? qreal(1.0)
: (qreal)optionProgressBar->progress / optionProgressBar->maximum;
const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget);
if (optionProgressBar->orientation == Qt::Horizontal) {
@@ -2010,7 +2010,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
if (focusFrame->widget() && focusFrame->widget()->hasEditFocus())
editFocus = true;
}
- const qreal opacity = editFocus ? 1 : 0.75; // Trial and error factors. Feel free to improve.
+ const qreal opacity = editFocus ? 1 : qreal(0.75); // Trial and error factors. Feel free to improve.
#else
const qreal opacity = 0.85;
#endif
@@ -2148,8 +2148,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_IndicatorRadioButton: {
QRect buttonRect = option->rect;
//there is empty (a. 33%) space in svg graphics for radiobutton
- const qreal reduceWidth = (qreal)buttonRect.width() / 3.0;
- const qreal rectWidth = (qreal)option->rect.width() != 0 ? option->rect.width() : 1.0;
+ const qreal reduceWidth = (qreal)buttonRect.width() / qreal(3.0);
+ const qreal rectWidth = (qreal)option->rect.width() != 0 ? option->rect.width() : qreal(1.0);
// Try to occupy the full area
const qreal scaler = 1 + (reduceWidth/rectWidth);
buttonRect.setWidth((int)((buttonRect.width()-reduceWidth) * scaler));
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 7d2ed2af8c..c066631c3d 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1247,20 +1247,20 @@ QPainterPath QRenderRule::borderClip(QRect r)
const QRectF rect(r);
const int *borders = border()->borders;
QPainterPath path;
- qreal curY = rect.y() + borders[TopEdge]/2.0;
+ qreal curY = rect.y() + borders[TopEdge]/qreal(2.0);
path.moveTo(rect.x() + tlr.width(), curY);
path.lineTo(rect.right() - trr.width(), curY);
- qreal curX = rect.right() - borders[RightEdge]/2.0;
+ qreal curX = rect.right() - borders[RightEdge]/qreal(2.0);
path.arcTo(curX - 2*trr.width() + borders[RightEdge], curY,
trr.width()*2 - borders[RightEdge], trr.height()*2 - borders[TopEdge], 90, -90);
path.lineTo(curX, rect.bottom() - brr.height());
- curY = rect.bottom() - borders[BottomEdge]/2.0;
+ curY = rect.bottom() - borders[BottomEdge]/qreal(2.0);
path.arcTo(curX - 2*brr.width() + borders[RightEdge], curY - 2*brr.height() + borders[BottomEdge],
brr.width()*2 - borders[RightEdge], brr.height()*2 - borders[BottomEdge], 0, -90);
path.lineTo(rect.x() + blr.width(), curY);
- curX = rect.left() + borders[LeftEdge]/2.0;
+ curX = rect.left() + borders[LeftEdge]/qreal(2.0);
path.arcTo(curX, rect.bottom() - 2*blr.height() + borders[BottomEdge]/2,
blr.width()*2 - borders[LeftEdge], blr.height()*2 - borders[BottomEdge], 270, -90);
@@ -3810,7 +3810,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (inverted)
reverse = !reverse;
const bool indeterminate = pb->minimum == pb->maximum;
- qreal fillRatio = indeterminate ? 0.50 : qreal(progress - minimum)/(maximum - minimum);
+ qreal fillRatio = indeterminate ? qreal(0.50) : qreal(progress - minimum)/(maximum - minimum);
int fillWidth = int(rect.width() * fillRatio);
int chunkWidth = fillWidth;
if (subRule.hasContentsSize()) {
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 1d463c47b2..796c455d37 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1994,7 +1994,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
const QtFontSize *size = style->pixelSizes + l;
if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) {
- const uint pointSize = qRound(size->pixelSize * 72.0 / dpi);
+ const uint pointSize = qRound(size->pixelSize * qreal(72.0) / dpi);
if (! sizes.contains(pointSize))
sizes.append(pointSize);
}
@@ -2105,7 +2105,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
const QtFontSize *size = style->pixelSizes + l;
if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) {
- const uint pointSize = qRound(size->pixelSize * 72.0 / dpi);
+ const uint pointSize = qRound(size->pixelSize * qreal(72.0) / dpi);
if (! sizes.contains(pointSize))
sizes.append(pointSize);
}
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index c9b672bb89..8f46a805cc 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -381,9 +381,9 @@ void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rig
glyph_metrics_t gi = boundingBox(glyph);
bool isValid = gi.isValid();
if (leftBearing != 0)
- *leftBearing = isValid ? gi.x.toReal() : 0.0;
+ *leftBearing = isValid ? gi.x.toReal() : qreal(0.0);
if (rightBearing != 0)
- *rightBearing = isValid ? (gi.xoff - gi.x - gi.width).toReal() : 0.0;
+ *rightBearing = isValid ? (gi.xoff - gi.x - gi.width).toReal() : qreal(0.0);
}
glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs)
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 143dc1ab8c..de2e27ad2e 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -159,7 +159,7 @@ bool Qt::mightBeRichText(const QString& text)
QString Qt::escape(const QString& plain)
{
QString rich;
- rich.reserve(int(plain.length() * 1.1));
+ rich.reserve(int(plain.length() * qreal(1.1)));
for (int i = 0; i < plain.length(); ++i) {
if (plain.at(i) == QLatin1Char('<'))
rich += QLatin1String("&lt;");
diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp
index dd92bda993..1b0a1a118c 100644
--- a/src/gui/widgets/qprogressbar.cpp
+++ b/src/gui/widgets/qprogressbar.cpp
@@ -462,7 +462,7 @@ QString QProgressBar::text() const
return result;
}
- int progress = (qreal(d->value) - d->minimum) * 100.0 / totalSteps;
+ int progress = (qreal(d->value) - d->minimum) * qreal(100.0) / totalSteps;
result.replace(QLatin1String("%p"), QString::number(progress));
return result;
}
diff --git a/src/gui/widgets/qtextbrowser.cpp b/src/gui/widgets/qtextbrowser.cpp
index cd8fa117b7..e786c5cef9 100644
--- a/src/gui/widgets/qtextbrowser.cpp
+++ b/src/gui/widgets/qtextbrowser.cpp
@@ -619,7 +619,8 @@ void QTextBrowserPrivate::restoreHistoryEntry(const HistoryEntry entry)
If you want to load documents stored in the Qt resource system use
\c{qrc} as the scheme in the URL to load. For example, for the document
resource path \c{:/docs/index.html} use \c{qrc:/docs/index.html} as
- the URL with setSource().
+ the URL with setSource(). To access local files, use \c{file} as the
+ scheme in the URL.
\sa QTextEdit, QTextDocument
*/
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index 2fae7d6624..88c45d197b 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -57,20 +57,25 @@
QT_BEGIN_NAMESPACE
-static bool factoryDataShutdown = false;
class QNetworkAccessBackendFactoryData: public QList<QNetworkAccessBackendFactory *>
{
public:
- QNetworkAccessBackendFactoryData() : mutex(QMutex::Recursive) { }
+ QNetworkAccessBackendFactoryData() : mutex(QMutex::Recursive)
+ {
+ valid.ref();
+ }
~QNetworkAccessBackendFactoryData()
{
QMutexLocker locker(&mutex); // why do we need to lock?
- factoryDataShutdown = true;
+ valid.deref();
}
QMutex mutex;
+ //this is used to avoid (re)constructing factory data from destructors of other global classes
+ static QAtomicInt valid;
};
Q_GLOBAL_STATIC(QNetworkAccessBackendFactoryData, factoryData)
+QAtomicInt QNetworkAccessBackendFactoryData::valid;
QNetworkAccessBackendFactory::QNetworkAccessBackendFactory()
{
@@ -80,7 +85,7 @@ QNetworkAccessBackendFactory::QNetworkAccessBackendFactory()
QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory()
{
- if (!factoryDataShutdown) {
+ if (QNetworkAccessBackendFactoryData::valid) {
QMutexLocker locker(&factoryData()->mutex);
factoryData()->removeAll(this);
}
@@ -89,7 +94,7 @@ QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory()
QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessManager::Operation op,
const QNetworkRequest &request)
{
- if (!factoryDataShutdown) {
+ if (QNetworkAccessBackendFactoryData::valid) {
QMutexLocker locker(&factoryData()->mutex);
QNetworkAccessBackendFactoryData::ConstIterator it = factoryData()->constBegin(),
end = factoryData()->constEnd();
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index 18e29afd7a..96a534d60d 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -60,7 +60,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
#endif
QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate()
- : QObject(), pollTimer(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true)
+ : QObject(), pollTimer(0), bearerThread(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true)
{
qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration");
qRegisterMetaType<QNetworkConfigurationPrivatePointer>("QNetworkConfigurationPrivatePointer");
diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def
index be0929543b..34375020ff 100644
--- a/src/s60installs/bwins/QtCoreu.def
+++ b/src/s60installs/bwins/QtCoreu.def
@@ -4879,4 +4879,9 @@ EXPORTS
?languageId@QLocalePrivate@@QBEGXZ @ 4878 NONAME ; unsigned short QLocalePrivate::languageId(void) const
?started@QFutureWatcherBase@@IAEXXZ @ 4879 NONAME ; void QFutureWatcherBase::started(void)
?staticMetaObjectExtraData@QAbstractState@@0UQMetaObjectExtraData@@B @ 4880 NONAME ; struct QMetaObjectExtraData const QAbstractState::staticMetaObjectExtraData
+ ?rebuildInstallLibraryPaths@QCoreApplicationPrivate@@SAXXZ @ 4881 NONAME ; void QCoreApplicationPrivate::rebuildInstallLibraryPaths(void)
+ ?connectNotify@QFutureWatcherBase@@MAEXPBD@Z @ 4882 NONAME ; void QFutureWatcherBase::connectNotify(char const *)
+ ?event@QFutureWatcherBase@@UAE_NPAVQEvent@@@Z @ 4883 NONAME ; bool QFutureWatcherBase::event(class QEvent *)
+ ?updateDir@QFactoryLoader@@QAEXABVQString@@AAVQSettings@@@Z @ 4884 NONAME ; void QFactoryLoader::updateDir(class QString const &, class QSettings &)
+ ?disconnectNotify@QFutureWatcherBase@@MAEXPBD@Z @ 4885 NONAME ; void QFutureWatcherBase::disconnectNotify(char const *)
diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def
index cf42b679d3..1fabdb295e 100644
--- a/src/s60installs/eabi/QtCoreu.def
+++ b/src/s60installs/eabi/QtCoreu.def
@@ -4162,4 +4162,6 @@ EXPORTS
inflateReset2 @ 4161 NONAME
inflateUndermine @ 4162 NONAME
zlibCompileFlags @ 4163 NONAME
+ _ZN14QFactoryLoader9updateDirERK7QStringR9QSettings @ 4164 NONAME
+ _ZN23QCoreApplicationPrivate26rebuildInstallLibraryPathsEv @ 4165 NONAME
diff --git a/src/s60installs/qt_resources.iby b/src/s60installs/qt_resources.iby
new file mode 100644
index 0000000000..f5fe1c4c20
--- /dev/null
+++ b/src/s60installs/qt_resources.iby
@@ -0,0 +1,11 @@
+#ifndef QT_RESOURCES_IBY
+#define QT_RESOURCES_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+// Localisation files
+
+data=DATAZ_\QT_TRANSLATIONS_DIR\qt.qm QT_TRANSLATIONS_DIR\qt.qm
+
+#endif // __QT_RESOURCES_IBY__
+
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index c2b462c313..08c4829462 100755
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -175,4 +175,5 @@ symbian: {
}
BLD_INF_RULES.prj_exports += "$$S60_INSTALLS_SOURCE_DIR/qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)"
+ BLD_INF_RULES.prj_exports += "$$S60_INSTALLS_SOURCE_DIR/qt_resources.iby $$LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(qt_resources.iby)"
}
diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp
index e69fe508d8..e5e901d315 100644
--- a/src/xmlpatterns/api/qxmlquery.cpp
+++ b/src/xmlpatterns/api/qxmlquery.cpp
@@ -988,7 +988,12 @@ bool setFocusHelper(QXmlQuery *const queryInstance,
const QXmlItem focusItem(focusResult.next());
if(focusItem.isNull() || focusResult.hasError())
+ {
+ /* The previous focus must be cleared in error situations.
+ * Otherwise the query may be left in an inconsistent state. */
+ queryInstance->setFocus(QXmlItem());
return false;
+ }
else
{
queryInstance->setFocus(focusItem);
diff --git a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
index 6215f3d449..3f3dbbb96a 100644
--- a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
+++ b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
@@ -41,6 +41,7 @@
#include <QStack>
#include <QStringList>
+#include <QFileInfo>
#include "qanyuri_p.h"
#include "qboolean_p.h"
@@ -207,6 +208,21 @@ Item::Iterator::Ptr IdrefFN::evaluateSequence(const DynamicContext::Ptr &context
return CommonValues::emptyIterator; /* TODO Haven't implemented further. */
}
+/*!
+ * Attemps to resolve scheme if URL does not have scheme defined.
+ */
+static QUrl resolveScheme(const QUrl &url)
+{
+ // On Windows and Symbian the drive letter is detected as the scheme.
+ if (url.scheme().isEmpty() || (url.scheme().length() == 1)) {
+ QString filename = url.toString();
+ QFileInfo file(filename);
+ if (file.exists())
+ return QUrl::fromLocalFile(filename);
+ }
+ return url;
+}
+
Item DocFN::evaluateSingleton(const DynamicContext::Ptr &context) const
{
const Item itemURI(m_operands.first()->evaluateSingleton(context));
@@ -219,7 +235,7 @@ Item DocFN::evaluateSingleton(const DynamicContext::Ptr &context) const
* as part of a workaround for solaris-cc-64. DocFN::typeCheck() is in qsequencefns.cpp
* as part of that workaround. */
const QUrl mayRela(AnyURI::toQUrl<ReportContext::FODC0005>(itemURI.stringValue(), context, this));
- const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));
+ const QUrl uri(resolveScheme(context->resolveURI(mayRela, staticBaseURI())));
Q_ASSERT(uri.isValid());
Q_ASSERT(!uri.isRelative());
@@ -251,7 +267,7 @@ bool DocAvailableFN::evaluateEBV(const DynamicContext::Ptr &context) const
/* These two lines are duplicated in DocFN::evaluateSingleton(), as part
* of a workaround for solaris-cc-64. */
const QUrl mayRela(AnyURI::toQUrl<ReportContext::FODC0005>(itemURI.stringValue(), context, this));
- const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));
+ const QUrl uri(resolveScheme(context->resolveURI(mayRela, staticBaseURI())));
Q_ASSERT(!uri.isRelative());
return context->resourceLoader()->isDocumentAvailable(uri);
diff --git a/src/xmlpatterns/schema/qxsdtypechecker.cpp b/src/xmlpatterns/schema/qxsdtypechecker.cpp
index fb47448691..e5709ae4b2 100644
--- a/src/xmlpatterns/schema/qxsdtypechecker.cpp
+++ b/src/xmlpatterns/schema/qxsdtypechecker.cpp
@@ -57,6 +57,7 @@
#include "qxsdschemahelper_p.h"
#include "qxsdschemamerger_p.h"
#include "qxsdstatemachine_p.h"
+#include "qabstractfloat_p.h"
#include "qxsdschemadebugger_p.h"
@@ -697,7 +698,8 @@ bool XsdTypeChecker::checkConstrainingFacetsDouble(double value, const QString &
}
if (facets.contains(XsdFacet::Enumeration)) {
const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration);
- const DerivedString<TypeString>::Ptr valueStr = DerivedString<TypeString>::fromLexical(m_namePool, QString::number(value));
+ const Numeric::Ptr valuePtr = Double::fromValue(value);
+ const DerivedString<TypeString>::Ptr valueStr = DerivedString<TypeString>::fromLexical(m_namePool, valuePtr->stringValue());
const AtomicValue::List multiValue = facet->multiValue();
bool found = false;
@@ -706,6 +708,13 @@ bool XsdTypeChecker::checkConstrainingFacetsDouble(double value, const QString &
found = true;
break;
}
+
+ // Handle case when both facet and value are NaN separately as equals for NaN returns always false.
+ const Numeric::Ptr facetValue = ValueFactory::fromLexical(multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue(), BuiltinTypes::xsDouble, m_context, m_reflection);
+ if (facetValue->isNaN() && valuePtr->isNaN()) {
+ found = true;
+ break;
+ }
}
if (!found) {