summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-10 12:48:01 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-10 15:31:45 +0200
commit143c4d3e13a430b951f4f4f8c28db14303f80605 (patch)
tree2b89637b93fc7d81c674106008566010f986d67c /src/gui
parenta7ed81b557d593a8ddb43b71bf4bbf3b44ead070 (diff)
parente5337ad1b1fb02873ce7b5ca8db45f6fd8063352 (diff)
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts: configure src/widgets/styles/qwindowsxpstyle.cpp tests/auto/gui/kernel/qwindow/qwindow.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp1
-rw-r--r--src/gui/image/qimage.cpp7
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp10
-rw-r--r--src/gui/kernel/kernel.pri1
-rw-r--r--src/gui/kernel/qcursor.cpp17
-rw-r--r--src/gui/kernel/qguiapplication.cpp62
-rw-r--r--src/gui/kernel/qguiapplication.h2
-rw-r--r--src/gui/kernel/qguiapplication_p.h6
-rw-r--r--src/gui/kernel/qinputmethod.cpp19
-rw-r--r--src/gui/kernel/qinputmethod_p.h1
-rw-r--r--src/gui/kernel/qpalette.h6
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.cpp26
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.h14
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa_p.h67
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.cpp3
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.h3
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache_qpa.h7
-rw-r--r--src/gui/kernel/qstylehints.cpp5
-rw-r--r--src/gui/kernel/qstylehints.h1
-rw-r--r--src/gui/kernel/qwindow.cpp29
-rw-r--r--src/gui/kernel/qwindow.h2
-rw-r--r--src/gui/painting/painting.pri1
-rw-r--r--src/gui/painting/qdrawhelper.cpp65
-rw-r--r--src/gui/painting/qdrawhelper_p.h12
-rw-r--r--src/gui/painting/qgammatables.cpp66
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h4
-rw-r--r--src/gui/painting/qpainter.cpp1
-rw-r--r--src/gui/painting/qpdf.cpp1
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp15
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp6
-rw-r--r--src/gui/text/qrawfont.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp2
-rw-r--r--src/gui/text/qtextimagehandler.cpp4
-rw-r--r--src/gui/text/qtextlayout.cpp9
-rw-r--r--src/gui/text/qzip.cpp2
-rw-r--r--src/gui/util/qdesktopservices.cpp27
37 files changed, 399 insertions, 109 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 7b1da21095..ed3ee28f4f 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -650,6 +650,7 @@ void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
Q_ASSERT(object);
QAccessibleEvent ev(object, reason);
+ ev.setChild(child);
updateAccessibility(&ev);
}
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 61a3895a6b..9770aca9e5 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -51,6 +51,7 @@
#include "qvariant.h"
#include "qimagepixmapcleanuphooks_p.h"
#include "qplatformintegration_qpa.h"
+#include <private/qguiapplication_p.h>
#include <ctype.h>
#include <stdlib.h>
#include <limits.h>
@@ -3303,10 +3304,10 @@ extern const uchar *qt_pow_rgb_gamma();
void qGamma_correct_back_to_linear_cs(QImage *image)
{
- const uchar *gamma = qt_pow_rgb_gamma();
- if (!gamma)
+ const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables();
+ if (!tables)
return;
-
+ const uchar *gamma = tables->qt_pow_rgb_gamma;
// gamma correct the pixels back to linear color space...
int h = image->height();
int w = image->width();
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index 6d8693ffb1..5b414b8d00 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -125,8 +125,14 @@ void QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(QPlatformPi
void QImagePixmapCleanupHooks::executeImageHooks(qint64 key)
{
- for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->imageHooks.count(); ++i)
- qt_image_and_pixmap_cleanup_hooks()->imageHooks[i](key);
+ QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
+ // the global destructor for the pixmap and image hooks might have
+ // been called already if the app is "leaking" global
+ // pixmaps/images
+ if (!h)
+ return;
+ for (int i = 0; i < h->imageHooks.count(); ++i)
+ h->imageHooks[i](key);
if (qt_image_cleanup_hook_64)
qt_image_cleanup_hook_64(key);
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 06773f58b5..b0fe871741 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -15,6 +15,7 @@ HEADERS += \
kernel/qplatformscreen_qpa.h \
kernel/qplatformscreen_qpa_p.h \
kernel/qplatforminputcontext_qpa.h \
+ kernel/qplatforminputcontext_qpa_p.h \
kernel/qplatformintegrationfactory_qpa_p.h \
kernel/qplatformintegrationplugin_qpa.h \
kernel/qplatformtheme_qpa.h\
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 95b2b4a28e..476d3a449b 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -205,6 +205,13 @@ QT_BEGIN_NAMESPACE
You can call QWidget::mapFromGlobal() to translate it to widget
coordinates.
+ \note The position is queried from the windowing system. If mouse events are generated
+ via other means (e.g., via QWindowSystemInterface in a unit test), those fake mouse
+ moves will not be reflected in the returned value.
+
+ \note On platforms where there is no windowing system or cursors are not available, the returned
+ position is based on the mouse move events generated via QWindowSystemInterface.
+
\sa setPos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QGuiApplication::primaryScreen()
*/
@@ -218,6 +225,16 @@ QT_BEGIN_NAMESPACE
You can call QWidget::mapToGlobal() to translate widget
coordinates to global screen coordinates.
+ \note Calling this function results in changing the cursor position through the windowing
+ system. The windowing system will typically respond by sending mouse events to the application's
+ window. This means that the usage of this function should be avoided in unit tests and
+ everywhere where fake mouse events are being injected via QWindowSystemInterface because the
+ windowing system's mouse state (with regards to buttons for example) may not match the state in
+ the application-generated events.
+
+ \note On platforms where there is no windowing system or cursors are not available, this
+ function may do nothing.
+
\sa pos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal()
*/
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 5c419a79dd..6a93ef4d09 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -52,6 +52,7 @@
#include "qplatformintegration_qpa.h"
#include <QtCore/QAbstractEventDispatcher>
+#include <QtCore/QVariant>
#include <QtCore/private/qcoreapplication_p.h>
#include <QtCore/private/qabstracteventdispatcher_p.h>
#include <QtCore/qmutex.h>
@@ -61,13 +62,15 @@
#include <qpalette.h>
#include <qscreen.h>
#include <private/qscreen_p.h>
+#include <private/qdrawhelper_p.h>
#include <QtGui/QPlatformIntegration>
#include <QtGui/QGenericPluginFactory>
#include <QtGui/qstylehints.h>
#include <QtGui/qinputpanel.h>
#include <QtGui/qplatformtheme_qpa.h>
-
+#include <QtGui/qplatforminputcontext_qpa.h>
+#include <private/qplatforminputcontext_qpa_p.h>
#include <QWindowSystemInterface>
#include "private/qwindowsysteminterface_qpa_p.h"
@@ -142,6 +145,8 @@ static QBasicMutex applicationFontMutex;
QFont *QGuiApplicationPrivate::app_font = 0;
bool QGuiApplicationPrivate::obey_desktop_settings = true;
+static qreal fontSmoothingGamma = 1.7;
+
extern void qRegisterGuiVariant();
extern void qInitDrawhelperAsm();
extern void qInitImageConversions();
@@ -575,13 +580,13 @@ static void init_platform(const QString &pluginArgument, const QString &platform
nativeInterface->setProperty(name.constData(), value);
}
}
+ fontSmoothingGamma = QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FontSmoothingGamma).toReal();
}
static void init_plugins(const QList<QByteArray> &pluginList)
{
for (int i = 0; i < pluginList.count(); ++i) {
QByteArray pluginSpec = pluginList.at(i);
- qDebug() << "init_plugins" << i << pluginSpec;
int colonPos = pluginSpec.indexOf(':');
QObject *plugin;
if (colonPos < 0)
@@ -589,7 +594,6 @@ static void init_plugins(const QList<QByteArray> &pluginList)
else
plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)),
QLatin1String(pluginSpec.mid(colonPos+1)));
- qDebug() << " created" << plugin;
if (plugin)
QGuiApplicationPrivate::generic_plugin_list.append(plugin);
}
@@ -597,12 +601,10 @@ static void init_plugins(const QList<QByteArray> &pluginList)
void QGuiApplicationPrivate::createPlatformIntegration()
{
- Q_Q(QGuiApplication);
-
// Use the Qt menus by default. Platform plugins that
// want to enable a native menu implementation can clear
// this flag.
- q->setAttribute(Qt::AA_DontUseNativeMenuBar, true);
+ QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);
// Load the platform integration
QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
@@ -706,6 +708,10 @@ void QGuiApplicationPrivate::init()
argc = j;
}
+ // Load environment exported generic plugins
+ foreach (const QByteArray &plugin, qgetenv("QT_QPA_GENERIC_PLUGINS").split(','))
+ pluginList << plugin;
+
if (platform_integration == 0)
createPlatformIntegration();
@@ -761,6 +767,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
delete platform_theme;
delete platform_integration;
platform_integration = 0;
+ delete m_gammaTables.load();
}
#if 0
@@ -1168,7 +1175,7 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
QFocusEvent focusOut(QEvent::FocusOut);
QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
QObject::disconnect(previous, SIGNAL(focusObjectChanged(QObject*)),
- qApp, SIGNAL(focusObjectChanged(QObject*)));
+ qApp, SLOT(q_updateFocusObject(QObject*)));
} else {
QEvent appActivate(QEvent::ApplicationActivate);
qApp->sendSpontaneousEvent(qApp, &appActivate);
@@ -1178,17 +1185,18 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
QFocusEvent focusIn(QEvent::FocusIn);
QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
QObject::connect(QGuiApplicationPrivate::focus_window, SIGNAL(focusObjectChanged(QObject*)),
- qApp, SIGNAL(focusObjectChanged(QObject*)));
+ qApp, SLOT(q_updateFocusObject(QObject*)));
} else {
QEvent appActivate(QEvent::ApplicationDeactivate);
qApp->sendSpontaneousEvent(qApp, &appActivate);
}
- if (self)
+ if (self) {
self->notifyActiveWindowChange(previous);
- if (previousFocusObject != qApp->focusObject())
- emit qApp->focusObjectChanged(qApp->focusObject());
+ if (previousFocusObject != qApp->focusObject())
+ self->q_updateFocusObject(qApp->focusObject());
+ }
}
void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse)
@@ -2160,4 +2168,36 @@ void QGuiApplicationPrivate::notifyThemeChanged()
}
}
+const QDrawHelperGammaTables *QGuiApplicationPrivate::gammaTables()
+{
+ QDrawHelperGammaTables *result = m_gammaTables.load();
+ if (!result){
+ QDrawHelperGammaTables *tables = new QDrawHelperGammaTables(fontSmoothingGamma);
+ if (!m_gammaTables.testAndSetRelease(0, tables))
+ delete tables;
+ result = m_gammaTables.load();
+ }
+ return result;
+}
+
+void QGuiApplicationPrivate::q_updateFocusObject(QObject *object)
+{
+ Q_Q(QGuiApplication);
+
+ bool enabled = false;
+ if (object) {
+ QInputMethodQueryEvent query(Qt::ImEnabled);
+ QGuiApplication::sendEvent(object, &query);
+ enabled = query.value(Qt::ImEnabled).toBool();
+ }
+
+ QPlatformInputContextPrivate::setInputMethodAccepted(enabled);
+ QPlatformInputContext *inputContext = platformIntegration()->inputContext();
+ if (inputContext)
+ inputContext->setFocusObject(object);
+ emit q->focusObjectChanged(object);
+}
+
+#include "moc_qguiapplication.cpp"
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index cc7dea422f..b58720db13 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -155,6 +155,8 @@ private:
Q_DISABLE_COPY(QGuiApplication)
Q_DECLARE_PRIVATE(QGuiApplication)
+ Q_PRIVATE_SLOT(d_func(), void q_updateFocusObject(QObject *object))
+
#ifndef QT_NO_GESTURES
friend class QGestureManager;
#endif
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 6792e9382c..352917f2db 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
class QPlatformIntegration;
class QPlatformTheme;
+struct QDrawHelperGammaTables;
class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate
{
@@ -141,6 +142,8 @@ public:
QPixmap getPixmapCursor(Qt::CursorShape cshape);
+ void q_updateFocusObject(QObject *object);
+
static QGuiApplicationPrivate *instance() { return self; }
static QString *platform_name;
@@ -200,6 +203,8 @@ public:
};
QHash<QWindow *, SynthesizedMouseData> synthesizedMousePoints;
+ const QDrawHelperGammaTables *gammaTables();
+
protected:
virtual void notifyThemeChanged();
@@ -209,6 +214,7 @@ private:
static QGuiApplicationPrivate *self;
static QTouchDevice *m_fakeTouchDevice;
static int m_fakeMouseSourcePointId;
+ QAtomicPointer<QDrawHelperGammaTables> m_gammaTables;
};
Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp
index 23ab8535a0..c443a47cac 100644
--- a/src/gui/kernel/qinputmethod.cpp
+++ b/src/gui/kernel/qinputmethod.cpp
@@ -43,6 +43,7 @@
#include <private/qinputmethod_p.h>
#include <qguiapplication.h>
#include <qtimer.h>
+#include <private/qplatforminputcontext_qpa_p.h>
QT_BEGIN_NAMESPACE
@@ -72,7 +73,7 @@ QInputMethod::~QInputMethod()
information like virtual keyboard visibility and keyboard dimensions.
Qt Quick also provides access to QInputMethod in QML through \l{QmlGlobalQtObject}{Qt global object}
- as \c Qt.application.inputPanel property.
+ as \c Qt.inputMethod property.
*/
/*!
@@ -295,8 +296,12 @@ void QInputMethod::update(Qt::InputMethodQueries queries)
{
Q_D(QInputMethod);
- if (queries & Qt::ImEnabled)
- d->q_checkFocusObject(qApp->focusObject());
+ if (queries & Qt::ImEnabled) {
+ QObject *focus = qApp->focusObject();
+ bool enabled = d->objectAcceptsInputMethod(focus);
+ setInputItem(enabled ? focus : 0);
+ QPlatformInputContextPrivate::setInputMethodAccepted(enabled);
+ }
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
@@ -361,14 +366,20 @@ void QInputMethodPrivate::q_connectFocusObject()
void QInputMethodPrivate::q_checkFocusObject(QObject *object)
{
Q_Q(QInputMethod);
+ bool enabled = objectAcceptsInputMethod(object);
+ q->setInputItem(enabled ? object : 0);
+}
+bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object)
+{
bool enabled = false;
if (object) {
QInputMethodQueryEvent query(Qt::ImEnabled);
QGuiApplication::sendEvent(object, &query);
enabled = query.value(Qt::ImEnabled).toBool();
}
- q->setInputItem(enabled ? object : 0);
+
+ return enabled;
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h
index 8a17c85990..34a0430f10 100644
--- a/src/gui/kernel/qinputmethod_p.h
+++ b/src/gui/kernel/qinputmethod_p.h
@@ -71,6 +71,7 @@ public:
}
void q_connectFocusObject();
void q_checkFocusObject(QObject *object);
+ bool objectAcceptsInputMethod(QObject *object);
QTransform inputItemTransform;
QWeakPointer<QObject> inputItem;
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index ca619a89b4..96295ab5db 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -86,12 +86,12 @@ public:
enum ColorRole { WindowText, Button, Light, Midlight, Dark, Mid,
Text, BrightText, ButtonText, Base, Window, Shadow,
Highlight, HighlightedText,
- Link, LinkVisited, // ### Qt 5: remove
+ Link, LinkVisited,
AlternateBase,
- NoRole, // ### Qt 5: value should be 0 or -1
+ NoRole,
ToolTipBase, ToolTipText,
NColorRoles = ToolTipText + 1,
- Foreground = WindowText, Background = Window // ### Qt 5: remove
+ Foreground = WindowText, Background = Window
};
inline ColorGroup currentColorGroup() const { return static_cast<ColorGroup>(current_group); }
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp
index ee18f3ebd1..8612b4b42f 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.cpp
+++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp
@@ -43,6 +43,7 @@
#include <qguiapplication.h>
#include <QRect>
#include "private/qkeymapper_p.h"
+#include "private/qplatforminputcontext_qpa_p.h"
QT_BEGIN_NAMESPACE
@@ -75,6 +76,7 @@ QT_BEGIN_NAMESPACE
\internal
*/
QPlatformInputContext::QPlatformInputContext()
+ : QObject(*(new QPlatformInputContextPrivate))
{
}
@@ -228,5 +230,29 @@ void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDir
emit qApp->inputMethod()->inputDirectionChanged(newDirection);
}
+/*!
+ This virtual method gets called to notify updated focus to \a object.
+ \warning Input methods must not call this function directly.
+ */
+void QPlatformInputContext::setFocusObject(QObject *object)
+{
+ Q_UNUSED(object)
+}
+
+/*!
+ Returns true if current focus object supports input method events.
+ */
+bool QPlatformInputContext::inputMethodAccepted() const
+{
+ return QPlatformInputContextPrivate::s_inputMethodAccepted;
+}
+
+bool QPlatformInputContextPrivate::s_inputMethodAccepted = false;
+
+void QPlatformInputContextPrivate::setInputMethodAccepted(bool accepted)
+{
+ QPlatformInputContextPrivate::s_inputMethodAccepted = accepted;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext_qpa.h
index c7d823d662..5e8060c6e0 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.h
+++ b/src/gui/kernel/qplatforminputcontext_qpa.h
@@ -48,13 +48,13 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-
-class QWindow;
-class QMouseEvent;
+class QPlatformInputContextPrivate;
class Q_GUI_EXPORT QPlatformInputContext : public QObject
{
Q_OBJECT
+ Q_DECLARE_PRIVATE(QPlatformInputContext)
+
public:
QPlatformInputContext();
virtual ~QPlatformInputContext();
@@ -81,6 +81,14 @@ public:
void emitLocaleChanged();
virtual Qt::LayoutDirection inputDirection() const;
void emitInputDirectionChanged(Qt::LayoutDirection newDirection);
+
+ virtual void setFocusObject(QObject *object);
+ bool inputMethodAccepted() const;
+
+private:
+ friend class QGuiApplication;
+ friend class QGuiApplicationPrivate;
+ friend class QInputMethod;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext_qpa_p.h b/src/gui/kernel/qplatforminputcontext_qpa_p.h
new file mode 100644
index 0000000000..dc12d26ffc
--- /dev/null
+++ b/src/gui/kernel/qplatforminputcontext_qpa_p.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMINPUTCONTEXT_P_H
+#define QPLATFORMINPUTCONTEXT_P_H
+
+#include <private/qobject_p.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QPlatformInputContextPrivate: public QObjectPrivate
+{
+public:
+ QPlatformInputContextPrivate() {}
+ ~QPlatformInputContextPrivate() {}
+
+ static void setInputMethodAccepted(bool accepted);
+ static bool inputMethodAccepted();
+
+ static bool s_inputMethodAccepted;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp
index 6879f0517e..5269d8fb24 100644
--- a/src/gui/kernel/qplatformintegration_qpa.cpp
+++ b/src/gui/kernel/qplatformintegration_qpa.cpp
@@ -247,6 +247,7 @@ QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphics
*/
QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDevice) const
{
+ Q_UNUSED(paintDevice)
return 0;
}
@@ -293,6 +294,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return false;
case PasswordMaskDelay:
return 0;
+ case FontSmoothingGamma:
+ return qreal(1.7);
}
return 0;
diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h
index 68dfc21833..fe40fd3dad 100644
--- a/src/gui/kernel/qplatformintegration_qpa.h
+++ b/src/gui/kernel/qplatformintegration_qpa.h
@@ -122,7 +122,8 @@ public:
StartDragTime,
KeyboardAutoRepeatRate,
ShowIsFullScreen,
- PasswordMaskDelay
+ PasswordMaskDelay,
+ FontSmoothingGamma
};
virtual QVariant styleHint(StyleHint hint) const;
diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
index f8ee201d85..8a92dbdd31 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
+++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
@@ -76,17 +76,18 @@ public:
const QVector<QImage> &items) = 0;
Q_INVOKABLE virtual void releaseItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0;
- virtual void serializeBuffer(void *bufferId, QByteArray *serializedData, int *fileDescriptor) const = 0;
virtual uint textureIdForBuffer(void *bufferId) = 0;
virtual void referenceBuffer(void *bufferId) = 0;
virtual bool dereferenceBuffer(void *bufferId) = 0;
+ virtual QSize sizeOfBuffer(void *bufferId) = 0;
+ virtual void *eglImageForBuffer(void *bufferId) = 0;
Q_SIGNALS:
void itemsMissing(const QByteArray &cacheId, const QVector<quint32> &itemIds);
- void itemsAvailable(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize,
+ void itemsAvailable(const QByteArray &cacheId, void *bufferId,
const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer);
void itemsInvalidated(const QByteArray &cacheId, const QVector<quint32> &itemIds);
- void itemsUpdated(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize,
+ void itemsUpdated(const QByteArray &cacheId, void *bufferId,
const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer);
};
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 4970f6a26b..9384d34097 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -101,4 +101,9 @@ int QStyleHints::passwordMaskDelay() const
return hint(QPlatformIntegration::PasswordMaskDelay).toInt();
}
+qreal QStyleHints::fontSmoothingGamma() const
+{
+ return hint(QPlatformIntegration::FontSmoothingGamma).toReal();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index ae51ebc052..301b51868f 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -63,6 +63,7 @@ public:
int cursorFlashTime() const;
bool showIsFullScreen() const;
int passwordMaskDelay() const;
+ qreal fontSmoothingGamma() const;
private:
friend class QGuiApplication;
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 85f619db31..d65998ce49 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -375,6 +375,8 @@ bool QWindow::isTopLevel() const
Returns whether the window is modal.
A modal window prevents other windows from getting any input.
+
+ \sa QWindow::windowModality
*/
bool QWindow::isModal() const
{
@@ -382,26 +384,37 @@ bool QWindow::isModal() const
return d->modality != Qt::NonModal;
}
-/*!
- Returns the window's modality.
+/*! \property QWindow::windowModality
+ \brief the modality of the window
+
+ A modal window prevents other windows from receiving input events. Qt
+ supports two types of modality: Qt::WindowModal and Qt::ApplicationModal.
- \sa setWindowModality()
+ By default, this property is Qt::NonModal
+
+ \sa Qt::WindowModality
*/
+
Qt::WindowModality QWindow::windowModality() const
{
Q_D(const QWindow);
return d->modality;
}
-/*!
- Sets the window's modality to \a windowModality.
-*/
-void QWindow::setWindowModality(Qt::WindowModality windowModality)
+void QWindow::setWindowModality(Qt::WindowModality modality)
{
Q_D(QWindow);
- d->modality = windowModality;
+ if (d->modality == modality)
+ return;
+ d->modality = modality;
+ emit windowModalityChanged(modality);
}
+/*! \fn void QWindow::windowModalityChanged(Qt::WindowModality windowModality)
+
+ This signal is emitted when the Qwindow::windowModality property changes to \a windowModality.
+*/
+
/*!
Sets the window's surface \a format.
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 62ddb66a75..5cf6b413ba 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -85,6 +85,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_DECLARE_PRIVATE(QWindow)
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
+ Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality NOTIFY windowModalityChanged)
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
@@ -255,6 +256,7 @@ public Q_SLOTS:
Q_SIGNALS:
void backBufferReady();
void screenChanged(QScreen *screen);
+ void windowModalityChanged(Qt::WindowModality windowModality);
void xChanged(int arg);
void yChanged(int arg);
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 0792343ce1..d1dd246e9c 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -75,6 +75,7 @@ SOURCES += \
SOURCES += \
painting/qpaintengine_raster.cpp \
painting/qdrawhelper.cpp \
+ painting/qgammatables.cpp \
painting/qimagescale.cpp \
painting/qgrayraster.c \
painting/qpaintengine_blitter.cpp \
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 3aea7945af..919a19eb9b 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -39,6 +39,18 @@
**
****************************************************************************/
+#if defined(__OPTIMIZE__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) \
+ && (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)
+// GCC 4.4 supports #pragma GCC optimize and #pragma GCC target
+# pragma GCC optimize "O3"
+# if defined(__i386__) && defined(__SSE2__) && !defined(__SSE2_MATH__)
+# pragma GCC target "fpmath=sse"
+# endif
+#endif
+
+#include <qstylehints.h>
+#include <qguiapplication.h>
+#include <qatomic.h>
#include <private/qdrawhelper_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qpainter_p.h>
@@ -51,6 +63,7 @@
#include <private/qdrawhelper_mips_dsp_p.h>
#endif
#include <private/qmath_p.h>
+#include <private/qguiapplication_p.h>
#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -5313,54 +5326,6 @@ inline static void qt_bitmapblit_quint16(QRasterBuffer *rasterBuffer,
map, mapWidth, mapHeight, mapStride);
}
-
-struct QDrawHelperGammaTables
-{
- QDrawHelperGammaTables();
-
- uchar qt_pow_rgb_gamma[256];
- uchar qt_pow_rgb_invgamma[256];
-
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- uint qt_pow_gamma[256];
- uchar qt_pow_invgamma[2048];
-#endif
-};
-
-QDrawHelperGammaTables::QDrawHelperGammaTables()
-{
- qreal smoothing = qreal(1.7);
-
- for (int i=0; i<256; ++i) {
- qt_pow_rgb_gamma[i] = uchar(qRound(qPow(i / qreal(255.0), smoothing) * 255));
- qt_pow_rgb_invgamma[i] = uchar(qRound(qPow(i / qreal(255.), 1 / smoothing) * 255));
- }
-
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- const qreal gray_gamma = 2.31;
- for (int i=0; i<256; ++i)
- qt_pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047));
- for (int i=0; i<2048; ++i)
- qt_pow_invgamma[i] = uchar(qRound(qPow(i / qreal(2047.0), 1 / gray_gamma) * 255));
-#endif
-}
-
-Q_GLOBAL_STATIC(QDrawHelperGammaTables, qt_gamma_tables);
-
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
-const uint *qt_pow_gamma()
-{
- QDrawHelperGammaTables *tables = qt_gamma_tables();
- return tables ? tables->qt_pow_gamma : 0;
-}
-#endif
-
-const uchar *qt_pow_rgb_gamma()
-{
- QDrawHelperGammaTables *tables = qt_gamma_tables();
- return tables ? tables->qt_pow_rgb_gamma : 0;
-}
-
static void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer,
int x, int y, quint32 color,
const uchar *map,
@@ -5473,7 +5438,7 @@ static void qt_alphamapblit_quint32(QRasterBuffer *rasterBuffer,
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32);
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- QDrawHelperGammaTables *tables = qt_gamma_tables();
+ const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables();
if (!tables)
return;
@@ -5570,7 +5535,7 @@ static void qt_alphargbblit_quint32(QRasterBuffer *rasterBuffer,
int sb = qBlue(color);
int sa = qAlpha(color);
- QDrawHelperGammaTables *tables = qt_gamma_tables();
+ const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables();
if (!tables)
return;
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 442fd8bcd7..2e9f064951 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -328,6 +328,18 @@ struct QSpanData
void adjustSpanMethods();
};
+struct QDrawHelperGammaTables
+{
+ explicit QDrawHelperGammaTables(qreal smoothing);
+
+ void refresh(qreal smoothing);
+
+ uchar qt_pow_rgb_gamma[256];
+ uchar qt_pow_rgb_invgamma[256];
+ uint qt_pow_gamma[256];
+ uchar qt_pow_invgamma[2048];
+};
+
static inline uint qt_gradient_clamp(const QGradientData *data, int ipos)
{
if (ipos < 0 || ipos >= GRADIENT_STOPTABLE_SIZE) {
diff --git a/src/gui/painting/qgammatables.cpp b/src/gui/painting/qgammatables.cpp
new file mode 100644
index 0000000000..06dc95a103
--- /dev/null
+++ b/src/gui/painting/qgammatables.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <private/qdrawhelper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+
+QDrawHelperGammaTables::QDrawHelperGammaTables(qreal smoothing)
+{
+ const qreal gray_gamma = 2.31;
+ for (int i=0; i<256; ++i)
+ qt_pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047));
+ for (int i=0; i<2048; ++i)
+ qt_pow_invgamma[i] = uchar(qRound(qPow(i / qreal(2047.0), 1 / gray_gamma) * 255));
+
+ refresh(smoothing);
+}
+
+void QDrawHelperGammaTables::refresh(qreal smoothing)
+{
+ for (int i=0; i<256; ++i) {
+ qt_pow_rgb_gamma[i] = uchar(qRound(qPow(i / qreal(255.0), smoothing) * 255));
+ qt_pow_rgb_invgamma[i] = uchar(qRound(qPow(i / qreal(255.), 1 / smoothing) * 255));
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index b5e8bca7e0..15f344bf81 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -737,7 +737,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
s->flags.fast_pen = pen_style > Qt::NoPen
&& s->penData.blend
&& ((pen.isCosmetic() && penWidth <= 1)
- || (s->flags.tx_noshear && penWidth * s->txscale <= 1));
+ || (!pen.isCosmetic() && s->flags.tx_noshear && penWidth * s->txscale <= 1));
s->flags.non_complex_pen = qpen_capStyle(s->lastPen) <= Qt::SquareCap && s->flags.tx_noshear;
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 79ed03e393..f1310a5dca 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -194,7 +194,7 @@ public:
void clip(const QVectorPath &path, Qt::ClipOperation op);
void clip(const QRect &rect, Qt::ClipOperation op);
void clip(const QRegion &region, Qt::ClipOperation op);
- inline const QClipData *clip() const;
+ inline const QClipData *clipData() const;
void drawStaticTextItem(QStaticTextItem *textItem);
virtual bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions,
@@ -492,7 +492,7 @@ inline const QClipData *QRasterPaintEnginePrivate::clip() const {
return baseClip.data();
}
-inline const QClipData *QRasterPaintEngine::clip() const {
+inline const QClipData *QRasterPaintEngine::clipData() const {
Q_D(const QRasterPaintEngine);
if (state() && state()->clip && state()->clip->enabled)
return state()->clip;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 2752fbd573..849955100b 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -7248,6 +7248,7 @@ void QPainter::setRedirected(const QPaintDevice *device,
const QPoint &offset)
{
Q_ASSERT(device != 0);
+ Q_UNUSED(device)
Q_UNUSED(replacement)
Q_UNUSED(offset)
qWarning("QPainter::setRedirected(): ignoring call to deprecated function, use QWidget::render() instead");
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 843551d51f..cfa0a28fda 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1524,6 +1524,7 @@ bool QPdfEngine::begin(QPaintDevice *pdev)
d->pages.clear();
d->imageCache.clear();
+ d->alphaCache.clear();
setActive(true);
d->writeHeader();
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index 589c0f701f..e14cfe0f82 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -577,6 +577,21 @@ QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const
if (cursorPos == -1)
return QString();
+ // compensate for preedit in the hit text block
+ QTextBlock block = document()->firstBlock();
+ while (block.isValid()) {
+ QRectF blockBr = blockBoundingRect(block);
+ if (blockBr.contains(pos)) {
+ QTextLayout *layout = block.layout();
+ int relativeCursorPos = cursorPos - block.position();
+ const int preeditLength = layout ? layout->preeditAreaText().length() : 0;
+ if (preeditLength > 0 && relativeCursorPos > layout->preeditAreaPosition())
+ cursorPos -= qMin(cursorPos - layout->preeditAreaPosition(), preeditLength);
+ break;
+ }
+ block = block.next();
+ }
+
QTextDocumentPrivate *pieceTable = qobject_cast<const QTextDocument *>(parent())->docHandle();
QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos);
QTextCharFormat fmt = pieceTable->formatCollection()->charFormat(it->format);
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index 6bd8284fa0..6af0398f00 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -250,10 +250,10 @@ QPlatformFontDatabase::~QPlatformFontDatabase()
void QPlatformFontDatabase::populateFontDatabase()
{
QString fontpath = fontDir();
-
if(!QFile::exists(fontpath)) {
- qFatal("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?",
- qPrintable(fontpath));
+ qWarning("QFontDatabase: Cannot find font directory '%s' - is Qt installed correctly?",
+ qPrintable(QDir::toNativeSeparators(fontpath)));
+ return;
}
QDir dir(fontpath);
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 9fbeef4685..5cdd563a33 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -672,7 +672,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
*/
void QRawFont::setPixelSize(qreal pixelSize)
{
- if (d->fontEngine == 0)
+ if (d->fontEngine == 0 || qFuzzyCompare(d->fontEngine->fontDef.pixelSize, pixelSize))
return;
d.detach();
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 3d58d91169..7d366275a3 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -63,7 +63,7 @@
QT_BEGIN_NAMESPACE
-static const float smallCapsFraction = 0.7;
+static const float smallCapsFraction = 0.7f;
namespace {
// Helper class used in QTextEngine::itemize
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index 6804dba95c..4f699ee45f 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -79,7 +79,7 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format)
if (img.isNull()) { // try direct loading
name = format.name(); // remove qrc:/ prefix again
if (name.isEmpty() || !img.load(name))
- return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/file-16.png"));
+ return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
}
pm = QPixmap::fromImage(img);
doc->addResource(QTextDocument::ImageResource, url, pm);
@@ -154,7 +154,7 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format)
if (image.isNull()) { // try direct loading
name = format.name(); // remove qrc:/ prefix again
if (name.isEmpty() || !image.load(name))
- return QImage(QLatin1String(":/trolltech/styles/commonstyle/images/file-16.png"));
+ return QImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
}
doc->addResource(QTextDocument::ImageResource, url, image);
}
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 95b8f48ec5..bec574bb83 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -506,6 +506,7 @@ QString QTextLayout::preeditAreaText() const
/*!
Sets the additional formats supported by the text layout to \a formatList.
+ The formats are applied with preedit area text in place.
\sa additionalFormats(), clearAdditionalFormats()
*/
@@ -2169,7 +2170,8 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
glyphRun.setFlags(flags);
glyphRun.setRawFont(font);
- glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY, selectionWidth.toReal(), height));
+ glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY - font.ascent(),
+ selectionWidth.toReal(), height));
return glyphRun;
}
@@ -2586,6 +2588,10 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
int pos = *cursorPos;
int itm;
const HB_CharAttributes *attributes = eng->attributes();
+ if (!attributes) {
+ *cursorPos = 0;
+ return x.toReal();
+ }
while (pos < line.from + line.length && !attributes[pos].charStop)
pos++;
if (pos == line.from + (int)line.length) {
@@ -2703,6 +2709,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
Converts the x-coordinate \a x, to the nearest matching cursor
position, depending on the cursor position type, \a cpos.
+ Note that result cursor position includes possible preedit area text.
\sa cursorToX()
*/
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 337326d3d7..1491c1efbc 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -505,7 +505,7 @@ void QZipReaderPrivate::scanFiles()
int num_dir_entries = 0;
EndOfDirectory eod;
while (start_of_directory == -1) {
- int pos = device->size() - sizeof(EndOfDirectory) - i;
+ const int pos = device->size() - int(sizeof(EndOfDirectory)) - i;
if (pos < 0 || i > 65535) {
qWarning() << "QZip: EndOfDirectory not found";
return;
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index 1a6661440c..26aecadcf4 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -287,17 +287,26 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme)
QString QDesktopServices::storageLocationImpl(StandardLocation type)
{
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
if (type == DataLocation) {
- QString xdgDataHome = QLatin1String(qgetenv("XDG_DATA_HOME"));
- if (xdgDataHome.isEmpty())
- xdgDataHome = QDir::homePath() + QLatin1String("/.local/share");
- xdgDataHome += QLatin1String("/data/")
- + QCoreApplication::organizationName() + QLatin1Char('/')
- + QCoreApplication::applicationName();
- return xdgDataHome;
- }
+ // Preserve Qt 4 compatibility:
+ // * QCoreApplication::applicationName() must default to empty
+ // * Unix data location is under the "data/" subdirectory
+ extern Q_CORE_EXPORT QString qt_applicationName_noFallback();
+ const QString compatAppName = qt_applicationName_noFallback();
+ const QString baseDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
+#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
+ QString result = baseDir;
+ if (!QCoreApplication::organizationName().isEmpty())
+ result += QLatin1Char('/') + QCoreApplication::organizationName();
+ if (!compatAppName.isEmpty())
+ result += QLatin1Char('/') + compatAppName;
+ return result;
+#elif defined(Q_OS_UNIX)
+ return baseDir + QLatin1String("/data/")
+ + QCoreApplication::organizationName() + QLatin1Char('/')
+ + compatAppName;
#endif
+ }
return QStandardPaths::writableLocation(static_cast<QStandardPaths::StandardLocation>(type));
}