summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-10-24 12:48:39 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-10-24 12:48:42 +0200
commit840f6a40e6218992b5b9d451ee3c0886a4846c89 (patch)
tree2b808decc7adf5218b810d2de6b45c5a8b4cfc42 /src/gui
parent109bf980b37fed405c6c1eb14cb9c83ff897e389 (diff)
parent2e3870fe37d36ccf4bd84eb90e1d5e08ad00c1bc (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.h2
-rw-r--r--src/gui/kernel/qevent.cpp115
-rw-r--r--src/gui/kernel/qevent.h28
-rw-r--r--src/gui/kernel/qguiapplication.cpp22
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
-rw-r--r--src/gui/kernel/qguivariant.cpp3
-rw-r--r--src/gui/kernel/qplatformtheme.cpp4
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp4
-rw-r--r--src/gui/kernel/qwindow.cpp2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp29
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h9
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h16
-rw-r--r--src/gui/opengl/qopengltexture.cpp2
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp50
-rw-r--r--src/gui/text/qfontdatabase.h2
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp6
-rw-r--r--src/gui/text/qfontengine.cpp10
-rw-r--r--src/gui/text/qfontengine_p.h1
-rw-r--r--src/gui/text/qtextdocument.cpp23
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp13
-rw-r--r--src/gui/text/qtextengine.cpp3
-rw-r--r--src/gui/text/qtexthtmlparser.cpp4
-rw-r--r--src/gui/text/qtextlayout.cpp23
23 files changed, 320 insertions, 52 deletions
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index ff3e910883..d5b0af550e 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -589,7 +589,7 @@ public:
virtual QString imageDescription() const = 0;
virtual QSize imageSize() const = 0;
- virtual QRect imagePosition() const = 0;
+ virtual QPoint imagePosition() const = 0;
};
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 15ed79c981..816419d155 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -2281,6 +2281,121 @@ QTabletEvent::~QTabletEvent()
#endif // QT_NO_TABLETEVENT
+/*!
+ \class QNativeGestureEvent
+ \since 5.2
+ \brief The QNativeGestureEvent class contains parameters that describe a gesture event.
+ \inmodule QtGui
+ \ingroup events
+
+ Native gesture events are generated by the operating system, typically by
+ interpreting touch events. Gesture events are high-level events such
+ as zoom or rotate.
+
+ \table
+ \header
+ \li Event Type
+ \li Description
+ \li Touch equence
+ \row
+ \li Qt::ZoomNativeGesture
+ \li Magnification delta in percent.
+ \li OS X: Two-finger pinch.
+ \row
+ \li Qt::SmartZoomNativeGesture
+ \li Boolean magnification state.
+ \li OS X: Two-finger douple tap (trackpad) / One-finger douple tap (magic mouse).
+ \row
+ \li Qt::RotateNativeGesture
+ \li Rotation delta in degrees.
+ \li OS X: Two-finger rotate.
+ \endtable
+
+
+ In addition, BeginNativeGesture and EndNativeGesture are sent before and after
+ gesture event streams:
+
+ BeginNativeGesture
+ ZoomNativeGesture
+ ZoomNativeGesture
+ ZoomNativeGesture
+ EndNativeGesture
+
+ \sa Qt::NativeGestureType, QGestureEvent
+*/
+
+/*!
+ Constructs a native gesture event of type \a type.
+
+ The points \a localPos, \a windowPos and \a screenPos specify the
+ gesture position relative to the receiving widget or item,
+ window, and screen, respectively.
+
+ \a realValue is the OS X event parameter, \a sequenceId and \a intValue are the Windows event parameters.
+*/
+QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos,
+ const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
+ : QInputEvent(QEvent::NativeGesture), mGestureType(type),
+ mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
+ mSequenceId(sequenceId), mIntValue(intValue)
+{ }
+
+/*!
+ \fn QNativeGestureEvent::gestureType() const
+ \since 5.2
+
+ Returns the gesture type.
+*/
+
+/*!
+ \fn QNativeGestureEvent::value() const
+ \since 5.2
+
+ Returns the gesture value. The value should be interpreted based on the
+ gesture type. For example, a Zoom gesture provides a scale factor while a Rotate
+ gesture provides a rotation delta.
+
+ \sa QNativeGestureEvent, gestureType()
+*/
+
+/*!
+ \fn QPoint QNativeGestureEvent::globalPos() const
+ \since 5.2
+
+ Returns the position of the gesture as a QPointF in screen coordinates
+*/
+
+/*!
+ \fn QPoint QNativeGestureEvent::pos() const
+ \since 5.2
+
+ Returns the position of the mouse cursor, relative to the widget
+ or item that received the event.
+*/
+
+/*!
+ \fn QPointF QNativeGestureEvent::localPos() const
+ \since 5.2
+
+ Returns the position of the gesture as a QPointF, relative to the
+ widget or item that received the event.
+*/
+
+/*!
+ \fn QPointF QNativeGestureEvent::screenPos() const
+ \since 5.2
+
+ Returns the position of the gesture as a QPointF in screen coordinates.
+*/
+
+/*!
+ \fn QPointF QNativeGestureEvent::windowPos() const
+ \since 5.2
+
+ Returns the position of the gesture as a QPointF, relative to the
+ window that received the event.
+*/
+
#ifndef QT_NO_DRAGANDDROP
/*!
Creates a QDragMoveEvent of the required \a type indicating
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 7d05e1c5a9..b6b1e0c76b 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -270,6 +270,34 @@ protected:
};
#endif // QT_NO_TABLETEVENT
+#ifndef QT_NO_GESTURES
+class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent
+{
+public:
+ QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos,
+ const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument);
+ Qt::NativeGestureType gestureType() const { return mGestureType; }
+ qreal value() const { return mRealValue; }
+
+#ifndef QT_NO_INTEGER_EVENT_COORDINATES
+ inline const QPoint pos() const { return mLocalPos.toPoint(); }
+ inline const QPoint globalPos() const { return mScreenPos.toPoint(); }
+#endif
+ const QPointF &localPos() const { return mLocalPos; }
+ const QPointF &windowPos() const { return mWindowPos; }
+ const QPointF &screenPos() const { return mScreenPos; }
+
+protected:
+ Qt::NativeGestureType mGestureType;
+ QPointF mLocalPos;
+ QPointF mWindowPos;
+ QPointF mScreenPos;
+ qreal mRealValue;
+ ulong mSequenceId;
+ quint64 mIntValue;
+};
+#endif // QT_NO_GESTURES
+
class Q_GUI_EXPORT QKeyEvent : public QInputEvent
{
public:
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 591e83c0bd..db655bd2ad 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1477,6 +1477,10 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
QGuiApplicationPrivate::processTabletLeaveProximityEvent(
static_cast<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *>(e));
break;
+ case QWindowSystemInterfacePrivate::Gesture:
+ QGuiApplicationPrivate::processGestureEvent(
+ static_cast<QWindowSystemInterfacePrivate::GestureEvent *>(e));
+ break;
case QWindowSystemInterfacePrivate::PlatformPanel:
QGuiApplicationPrivate::processPlatformPanelEvent(
static_cast<QWindowSystemInterfacePrivate::PlatformPanelEvent *>(e));
@@ -1493,6 +1497,7 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
#endif
case QWindowSystemInterfacePrivate::EnterWhatsThisMode:
QGuiApplication::postEvent(QGuiApplication::instance(), new QEvent(QEvent::EnterWhatsThisMode));
+ break;
default:
qWarning() << "Unknown user input event type:" << e->type;
break;
@@ -1570,9 +1575,11 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
ev.setTimestamp(e->timestamp);
setMouseEventSource(&ev, e->source);
#ifndef QT_NO_CURSOR
- if (const QScreen *screen = window->screen())
- if (QPlatformCursor *cursor = screen->handle()->cursor())
- cursor->pointerEvent(ev);
+ if (!e->synthetic) {
+ if (const QScreen *screen = window->screen())
+ if (QPlatformCursor *cursor = screen->handle()->cursor())
+ cursor->pointerEvent(ev);
+ }
#endif
if (window->d_func()->blockedByModalWindow) {
@@ -1961,6 +1968,15 @@ void QGuiApplicationPrivate::processTabletLeaveProximityEvent(QWindowSystemInter
#endif
}
+#ifndef QT_NO_GESTURES
+void QGuiApplicationPrivate::processGestureEvent(QWindowSystemInterfacePrivate::GestureEvent *e)
+{
+ QNativeGestureEvent ev(e->type, e->pos, e->pos, e->globalPos, e->realValue, e->sequenceId, e->intValue);
+ ev.setTimestamp(e->timestamp);
+ QGuiApplication::sendSpontaneousEvent(e->window, &ev);
+}
+#endif // QT_NO_GESTURES
+
void QGuiApplicationPrivate::processPlatformPanelEvent(QWindowSystemInterfacePrivate::PlatformPanelEvent *e)
{
if (!e->window)
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 1068e1eb2e..b158138bb7 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -148,6 +148,7 @@ public:
static void processTabletEvent(QWindowSystemInterfacePrivate::TabletEvent *e);
static void processTabletEnterProximityEvent(QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e);
static void processTabletLeaveProximityEvent(QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e);
+ static void processGestureEvent(QWindowSystemInterfacePrivate::GestureEvent *e);
static void processPlatformPanelEvent(QWindowSystemInterfacePrivate::PlatformPanelEvent *e);
#ifndef QT_NO_CONTEXTMENU
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 65f57aed84..1739e8c6fd 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -115,7 +115,7 @@ static void clear(QVariant::Private *d)
QMetaTypeSwitcher::switcher<void>(destructor, d->type, 0);
}
-// This class is a hack that customizes access to QPolygon
+// This class is a hack that customizes access to QPolygon and QPolygonF
template<class Filter>
class QGuiVariantIsNull : public QVariantIsNull<Filter> {
typedef QVariantIsNull<Filter> Base;
@@ -126,6 +126,7 @@ public:
template<typename T>
bool delegate(const T *p) { return Base::delegate(p); }
bool delegate(const QPolygon*) { return v_cast<QPolygon>(Base::m_d)->isEmpty(); }
+ bool delegate(const QPolygonF*) { return v_cast<QPolygonF>(Base::m_d)->isEmpty(); }
bool delegate(const void *p) { return Base::delegate(p); }
};
static bool isNull(const QVariant::Private *d)
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 3fb4939b69..562df1c913 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -48,8 +48,8 @@
#include <QtCore/qfileinfo.h>
#include <qpalette.h>
#include <qtextformat.h>
-#include <qiconloader_p.h>
-#include "private/qguiapplication_p.h"
+#include <private/qiconloader_p.h>
+#include <private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index b2abed7812..2f1b30ae4a 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -337,7 +337,7 @@ bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOptions opt) const
/*!
Set the minimum depth buffer size to \a size.
- \sa depthBufferSize(), setDepth(), depth()
+ \sa depthBufferSize()
*/
void QSurfaceFormat::setDepthBufferSize(int size)
{
@@ -350,7 +350,7 @@ void QSurfaceFormat::setDepthBufferSize(int size)
/*!
Returns the depth buffer size.
- \sa setDepthBufferSize(), setDepth(), depth()
+ \sa setDepthBufferSize()
*/
int QSurfaceFormat::depthBufferSize() const
{
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index f2e60e0ff3..13218fa178 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -227,6 +227,8 @@ QWindow::~QWindow()
QGuiApplicationPrivate::focus_window = 0;
if (QGuiApplicationPrivate::currentMouseWindow == this)
QGuiApplicationPrivate::currentMouseWindow = 0;
+ if (QGuiApplicationPrivate::tabletPressTarget == this)
+ QGuiApplicationPrivate::tabletPressTarget = 0;
QGuiApplicationPrivate::window_list.removeAll(this);
destroy();
}
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 5ee9bce540..07717bb63d 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -673,6 +673,35 @@ void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int poi
handleTabletLeaveProximityEvent(time, device, pointerType, uid);
}
+#ifndef QT_NO_GESTURES
+void QWindowSystemInterface::handleGestureEvent(QWindow *window, ulong timestamp, Qt::NativeGestureType type,
+ QPointF &local, QPointF &global)
+{
+ QWindowSystemInterfacePrivate::GestureEvent *e =
+ new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, local, global);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+}
+
+void QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, ulong timestamp, Qt::NativeGestureType type,
+ qreal value, QPointF &local, QPointF &global)
+{
+ QWindowSystemInterfacePrivate::GestureEvent *e =
+ new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, local, global);
+ e->realValue = value;
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+}
+
+void QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, ulong timestamp, Qt::NativeGestureType type,
+ ulong sequenceId, quint64 value, QPointF &local, QPointF &global)
+{
+ QWindowSystemInterfacePrivate::GestureEvent *e =
+ new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, local, global);
+ e->sequenceId = sequenceId;
+ e->intValue = value;
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+}
+#endif // QT_NO_GESTURES
+
void QWindowSystemInterface::handlePlatformPanelEvent(QWindow *w)
{
QWindowSystemInterfacePrivate::PlatformPanelEvent *e =
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 813f538651..0c3494a46d 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -185,6 +185,15 @@ public:
static void handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid);
+#ifndef QT_NO_GESTURES
+ static void handleGestureEvent(QWindow *window, ulong timestamp, Qt::NativeGestureType type,
+ QPointF &local, QPointF &global);
+ static void handleGestureEventWithRealValue(QWindow *window, ulong timestamp, Qt::NativeGestureType type,
+ qreal value, QPointF &local, QPointF &global);
+ static void handleGestureEventWithSequenceIdAndValue(QWindow *window, ulong timestamp,Qt::NativeGestureType type,
+ ulong sequenceId, quint64 value, QPointF &local, QPointF &global);
+#endif // QT_NO_GESTURES
+
static void handlePlatformPanelEvent(QWindow *w);
#ifndef QT_NO_CONTEXTMENU
static void handleContextMenuEvent(QWindow *w, bool mouseTriggered,
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index a4221b0e76..f0398ffc51 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -91,6 +91,7 @@ public:
PlatformPanel = UserInputEvent | 0x17,
ContextMenu = UserInputEvent | 0x18,
EnterWhatsThisMode = UserInputEvent | 0x19,
+ Gesture = UserInputEvent | 0x1a,
ApplicationStateChanged = 0x19,
FlushEvents = 0x20,
WindowScreenChanged = 0x21
@@ -401,6 +402,21 @@ public:
};
#endif
+ class GestureEvent : public InputEvent {
+ public:
+ GestureEvent(QWindow *window, ulong time, Qt::NativeGestureType type, QPointF pos, QPointF globalPos)
+ : InputEvent(window, time, Gesture, Qt::NoModifier), type(type), pos(pos), globalPos(globalPos),
+ realValue(0), sequenceId(0), intValue(0) { }
+ Qt::NativeGestureType type;
+ QPointF pos;
+ QPointF globalPos;
+ // Mac
+ qreal realValue;
+ // Windows
+ ulong sequenceId;
+ quint64 intValue;
+ };
+
class WindowSystemEventList {
QList<WindowSystemEvent *> impl;
mutable QMutex mutex;
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index fcd556e892..d5a7399c18 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -2488,7 +2488,7 @@ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
qWarning("QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3");
return;
}
- GLint swizzleMask[] = {r, g, b, a};
+ GLint swizzleMask[] = {GLint(r), GLint(g), GLint(b), GLint(a)};
d->swizzleMask[0] = r;
d->swizzleMask[1] = g;
d->swizzleMask[2] = b;
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
index 16ed79ac10..ee8abde77b 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ b/src/gui/opengl/qopenglvertexarrayobject.cpp
@@ -58,13 +58,19 @@ public:
{
Q_ASSERT(context);
#if !defined(QT_OPENGL_ES_2)
- GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress("glGenVertexArrays"));
- DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress("glDeleteVertexArrays"));
- BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress("glBindVertexArray"));
+ if (context->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object"))) {
+ GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysAPPLE")));
+ DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysAPPLE")));
+ BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayAPPLE")));
+ } else {
+ GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArrays")));
+ DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArrays")));
+ BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArray")));
+ }
#else
- GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress("glGenVertexArraysOES"));
- DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress("glDeleteVertexArraysOES"));
- BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress("glBindVertexArrayOES"));
+ GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES")));
+ DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES")));
+ BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES")));
#endif
}
@@ -84,7 +90,7 @@ public:
}
private:
- // Function signatures are equivalent between desktop core, ARB and ES 2 extensions
+ // Function signatures are equivalent between desktop core, ARB, APPLE and ES 2 extensions
void (QOPENGLF_APIENTRYP GenVertexArrays)(GLsizei n, GLuint *arrays);
void (QOPENGLF_APIENTRYP DeleteVertexArrays)(GLsizei n, const GLuint *arrays);
void (QOPENGLF_APIENTRYP BindVertexArray)(GLuint array);
@@ -109,8 +115,8 @@ public:
#if defined(QT_OPENGL_ES_2)
delete vaoFuncs;
#else
- if (vaoFuncsType == ARB)
- delete vaoFuncs.arb;
+ if ((vaoFuncsType == ARB) || (vaoFuncsType == APPLE))
+ delete vaoFuncs.helper;
#endif
}
@@ -130,13 +136,14 @@ public:
union {
QOpenGLFunctions_3_0 *core_3_0;
QOpenGLFunctions_3_2_Core *core_3_2;
- QVertexArrayObjectHelper *arb;
+ QVertexArrayObjectHelper *helper;
} vaoFuncs;
enum {
NotSupported,
Core_3_0,
Core_3_2,
- ARB
+ ARB,
+ APPLE
} vaoFuncsType;
#endif
QOpenGLContext *context;
@@ -162,7 +169,7 @@ bool QOpenGLVertexArrayObjectPrivate::create()
QObject::connect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
#if defined(QT_OPENGL_ES_2)
- if (ctx->hasExtension("GL_OES_vertex_array_object")) {
+ if (ctx->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) {
vaoFuncs = new QVertexArrayObjectHelper(ctx);
vaoFuncs->glGenVertexArrays(1, &vao);
}
@@ -180,10 +187,14 @@ bool QOpenGLVertexArrayObjectPrivate::create()
vaoFuncsType = Core_3_0;
vaoFuncs.core_3_0->initializeOpenGLFunctions();
vaoFuncs.core_3_0->glGenVertexArrays(1, &vao);
- } else if (ctx->hasExtension("GL_ARB_vertex_array_object")) {
- vaoFuncs.arb = new QVertexArrayObjectHelper(ctx);
+ } else if (ctx->hasExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) {
+ vaoFuncs.helper = new QVertexArrayObjectHelper(ctx);
vaoFuncsType = ARB;
- vaoFuncs.arb->glGenVertexArrays(1, &vao);
+ vaoFuncs.helper->glGenVertexArrays(1, &vao);
+ } else if (ctx->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object"))) {
+ vaoFuncs.helper = new QVertexArrayObjectHelper(ctx);
+ vaoFuncsType = APPLE;
+ vaoFuncs.helper->glGenVertexArrays(1, &vao);
}
#endif
return (vao != 0);
@@ -205,7 +216,8 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
vaoFuncs.core_3_0->glDeleteVertexArrays(1, &vao);
break;
case ARB:
- vaoFuncs.arb->glDeleteVertexArrays(1, &vao);
+ case APPLE:
+ vaoFuncs.helper->glDeleteVertexArrays(1, &vao);
break;
case NotSupported:
break;
@@ -236,7 +248,8 @@ void QOpenGLVertexArrayObjectPrivate::bind()
vaoFuncs.core_3_0->glBindVertexArray(vao);
break;
case ARB:
- vaoFuncs.arb->glBindVertexArray(vao);
+ case APPLE:
+ vaoFuncs.helper->glBindVertexArray(vao);
break;
case NotSupported:
break;
@@ -258,7 +271,8 @@ void QOpenGLVertexArrayObjectPrivate::release()
vaoFuncs.core_3_0->glBindVertexArray(0);
break;
case ARB:
- vaoFuncs.arb->glBindVertexArray(0);
+ case APPLE:
+ vaoFuncs.helper->glBindVertexArray(0);
break;
case NotSupported:
break;
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index 4e8f718962..708b8cbd58 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -151,7 +151,7 @@ public:
static bool removeAllApplicationFonts();
#if QT_DEPRECATED_SINCE(5, 2)
- QT_DEPRECATED static inline bool supportsThreadedFontRendering() { return true; }
+ QT_DEPRECATED static bool supportsThreadedFontRendering();
#endif
static QFont systemFont(SystemFont type);
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
index 7f5281131e..6c0be950dc 100644
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ b/src/gui/text/qfontdatabase_qpa.cpp
@@ -267,6 +267,12 @@ bool QFontDatabase::removeAllApplicationFonts()
return true;
}
+// QT_DEPRECATED_SINCE(5, 2)
+bool QFontDatabase::supportsThreadedFontRendering()
+{
+ return true;
+}
+
/*!
\internal
*/
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index b3889a02a4..303c85ce75 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -891,6 +891,16 @@ QByteArray QFontEngine::getSfntTable(uint tag) const
return table;
}
+void QFontEngine::clearGlyphCache(const void *key)
+{
+ for (QLinkedList<GlyphCacheEntry>::iterator it = m_glyphCaches.begin(), end = m_glyphCaches.end(); it != end; ) {
+ if (it->context == key)
+ it = m_glyphCaches.erase(it);
+ else
+ ++it;
+ }
+}
+
void QFontEngine::setGlyphCache(const void *key, QFontEngineGlyphCache *data)
{
Q_ASSERT(data);
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index d3faef93bb..c181d61d73 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -256,6 +256,7 @@ public:
virtual int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints);
+ void clearGlyphCache(const void *key);
void setGlyphCache(const void *key, QFontEngineGlyphCache *data);
QFontEngineGlyphCache *glyphCache(const void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const;
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 03602712cc..30e0f32547 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -2531,6 +2531,29 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
html += QLatin1Char(';');
}
+ if (format.lineHeightType() != QTextBlockFormat::SingleHeight) {
+ switch (format.lineHeightType()) {
+ case QTextBlockFormat::ProportionalHeight:
+ case QTextBlockFormat::FixedHeight:
+ html += QLatin1String(" line-height:");
+ break;
+ case QTextBlockFormat::MinimumHeight:
+ html += QLatin1String(" min-height:");
+ break;
+ case QTextBlockFormat::LineDistanceHeight:
+ html += QLatin1String(" line-spacing:");
+ break;
+ case QTextBlockFormat::SingleHeight:
+ default:
+ break; // Should never reach here
+ }
+ html += QString::number(format.lineHeight());
+ if (format.lineHeightType() == QTextBlockFormat::ProportionalHeight)
+ html += QLatin1String("%;");
+ else
+ html += QLatin1String("px;");
+ }
+
emitPageBreakPolicy(format.pageBreakPolicy());
QTextCharFormat diff;
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index 6156f56ae1..313700429c 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -1427,19 +1427,6 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
xoff = -xoff - size.width();
r.translate( xoff, (fontMetrics.height() / 2) - (size.height() / 2));
- // Prevent clipping the left side of the list decorator (on left to
- // right layouts) and clipping the right side of the list
- // decorator (on right to left layouts).
- if ((r.left() < 0) && (dir == Qt::LeftToRight)) {
- int horizontalOffset = -r.left();
- r.translate(horizontalOffset, 0);
- layout->setPosition(layout->position() + QPointF(horizontalOffset, 0));
- } else if ((r.right() > document->pageSize().width()) && (dir == Qt::RightToLeft)) {
- int horizontalOffset = r.right() - document->pageSize().width();
- r.translate(-horizontalOffset, 0);
- layout->setPosition(layout->position() - QPointF(horizontalOffset, 0));
- }
-
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index c0e2c5b803..2b0f9ffeb6 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1883,11 +1883,12 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
scaledEngine = feCache.prevScaledFontEngine;
} else {
QFontEngine *scEngine = rawFont.d->fontEngine->cloneWithSize(smallCapsFraction * rawFont.pixelSize());
+ scEngine->ref.ref();
scaledEngine = QFontEngineMultiQPA::createMultiFontEngine(scEngine, script);
scaledEngine->ref.ref();
feCache.prevScaledFontEngine = scaledEngine;
// If scEngine is not ref'ed by scaledEngine, make sure it is deallocated and not leaked.
- if (!scEngine->ref.load())
+ if (!scEngine->ref.deref())
delete scEngine;
}
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 5292ba20a2..a131503b85 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -46,7 +46,7 @@
#include <qstack.h>
#include <qdebug.h>
#include <qthread.h>
-#include <qcoreapplication.h>
+#include <qguiapplication.h>
#include "qtextdocument.h"
#include "qtextformat_p.h"
@@ -1066,7 +1066,7 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
&& !attributes.at(i + 1).isEmpty()) {
hasHref = true;
charFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- charFormat.setForeground(Qt::blue);
+ charFormat.setForeground(QGuiApplication::palette().link());
}
}
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index dc8ae06868..66341e186a 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -44,6 +44,7 @@
#include <qthread.h>
#include <qfont.h>
+#include <qmath.h>
#include <qpainter.h>
#include <qvarlengtharray.h>
#include <qtextformat.h>
@@ -207,7 +208,7 @@ void QTextInlineObject::setAscent(qreal a)
}
/*!
- Sets the inline object's decent to \a d.
+ Sets the inline object's descent to \a d.
\sa descent(), setAscent(), width(), rect()
*/
@@ -946,15 +947,23 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo
continue;
}
- if (lastSelectionWidth > 0)
- region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));
+ if (lastSelectionWidth > 0) {
+ QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
+ rect.moveLeft(qFloor(rect.left()));
+ rect.moveTop(qFloor(rect.top()));
+ region->addRect(rect);
+ }
lastSelectionX = selectionX;
lastSelectionWidth = selectionWidth;
}
}
- if (lastSelectionWidth > 0)
- region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));
+ if (lastSelectionWidth > 0) {
+ QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
+ rect.moveLeft(qFloor(rect.left()));
+ rect.moveTop(qFloor(rect.top()));
+ region->addRect(rect);
+ }
}
static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip)
@@ -1288,7 +1297,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
After being created, the line can be filled using the setLineWidth()
or setNumColumns() functions. A line has a number of attributes including the
rectangle it occupies, rect(), its coordinates, x() and y(), its
- textLength(), width() and naturalTextWidth(), and its ascent() and decent()
+ textLength(), width() and naturalTextWidth(), and its ascent() and descent()
relative to the text. The position of the cursor in terms of the
line is available from cursorToX() and its inverse from
xToCursor(). A line can be moved with setPosition().
@@ -2077,7 +2086,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q
QBrush bg = chf.background();
if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool())
- p->fillRect(r, bg);
+ p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg);
if (c.style() != Qt::NoBrush) {
p->setPen(QPen(c, 0));
}