summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@nokia.com>2012-04-17 10:38:24 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-17 10:38:24 +0200
commit16b53b2f0e3f8f64a59c465493a6209eb7f9ab47 (patch)
treebbb63401eb3c56c32ad9bd9be66bae8d3590de6b /src/gui
parent2c13dc7482690756280cfefe8515eb809b069721 (diff)
parent9bd032355163d92cda5e7e59ecd21214b131f187 (diff)
Merge "Merge remote-tracking branch 'origin/master' into api_changes" into refs/staging/api_changes
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qjpeghandler.cpp43
-rw-r--r--src/gui/image/qpixmap_raster.cpp2
-rw-r--r--src/gui/kernel/qguiapplication.cpp158
-rw-r--r--src/gui/kernel/qguiapplication.h8
-rw-r--r--src/gui/kernel/qguiapplication_p.h12
-rw-r--r--src/gui/kernel/qkeysequence.cpp22
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.h8
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp4
-rw-r--r--src/gui/kernel/qsurface.cpp4
-rw-r--r--src/gui/kernel/qwindow.cpp15
-rw-r--r--src/gui/kernel/qwindow.h7
-rw-r--r--src/gui/kernel/qwindow_p.h9
-rw-r--r--src/gui/opengl/qopenglfunctions.h2
-rw-r--r--src/gui/painting/painting.pri1
-rw-r--r--src/gui/painting/qcolor.cpp2
-rw-r--r--src/gui/painting/qmatrix.cpp1
-rw-r--r--src/gui/painting/qpaintdevice.cpp16
-rw-r--r--src/gui/painting/qpaintdevice_qpa.cpp65
-rw-r--r--src/gui/painting/qpaintengineex_p.h1
-rw-r--r--src/gui/painting/qpainterpath.cpp37
-rw-r--r--src/gui/painting/qpainterpath.h67
-rw-r--r--src/gui/painting/qpainterpath_p.h23
-rw-r--r--src/gui/painting/qplatformbackingstore_qpa.cpp3
-rw-r--r--src/gui/painting/qtransform.cpp1
-rw-r--r--src/gui/text/qfont_qpa.cpp35
-rw-r--r--src/gui/text/qfontdatabase.cpp22
-rw-r--r--src/gui/text/qfontdatabase.h5
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp6
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp29
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.h2
-rw-r--r--src/gui/text/qtextengine.cpp2
-rw-r--r--src/gui/text/qtextformat.cpp2
-rw-r--r--src/gui/text/qtexthtmlparser.cpp2
-rw-r--r--src/gui/text/qtextoption.cpp4
-rw-r--r--src/gui/text/qtextoption.h4
36 files changed, 379 insertions, 247 deletions
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index 013a1a83b0..7dcbcf508f 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -45,6 +45,7 @@
#include <qvariant.h>
#include <qvector.h>
#include <qbuffer.h>
+#include <qmath.h>
#include <private/qsimd_p.h>
#include <stdio.h> // jpeglib needs this to be pre-included
@@ -321,27 +322,31 @@ static bool read_jpeg_image(QImage *outImage,
}
// Determine the scale factor to pass to libjpeg for quick downscaling.
- if (!scaledSize.isEmpty()) {
+ if (!scaledSize.isEmpty() && info->image_width && info->image_height) {
if (clipRect.isEmpty()) {
- info->scale_denom =
- qMin(info->image_width / scaledSize.width(),
- info->image_height / scaledSize.height());
- } else {
- info->scale_denom =
- qMin(clipRect.width() / scaledSize.width(),
- clipRect.height() / scaledSize.height());
- }
- if (info->scale_denom < 2) {
- info->scale_denom = 1;
- } else if (info->scale_denom < 4) {
- info->scale_denom = 2;
- } else if (info->scale_denom < 8) {
- info->scale_denom = 4;
- } else {
+ double f = qMin(double(info->image_width) / scaledSize.width(),
+ double(info->image_height) / scaledSize.height());
+
+ // libjpeg supports M/8 scaling with M=[1,16]. All downscaling factors
+ // are a speed improvement, but upscaling during decode is slower.
+ info->scale_num = qBound(1, qCeil(8/f), 8);
info->scale_denom = 8;
- }
- info->scale_num = 1;
- if (!clipRect.isEmpty()) {
+ } else {
+ info->scale_denom = qMin(clipRect.width() / scaledSize.width(),
+ clipRect.height() / scaledSize.height());
+
+ // Only scale by powers of two when clipping so we can
+ // keep the exact pixel boundaries
+ if (info->scale_denom < 2)
+ info->scale_denom = 1;
+ else if (info->scale_denom < 4)
+ info->scale_denom = 2;
+ else if (info->scale_denom < 8)
+ info->scale_denom = 4;
+ else
+ info->scale_denom = 8;
+ info->scale_num = 1;
+
// Correct the scale factor so that we clip accurately.
// It is recommended that the clip rectangle be aligned
// on an 8-pixel boundary for best performance.
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 7c7c4652e3..27f472d842 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -151,7 +151,7 @@ void QRasterPlatformPixmap::fromImageReader(QImageReader *imageReader,
createPixmapForImage(image, flags, /* inplace = */true);
}
-// from qwindowsurface.cpp
+// from qbackingstore.cpp
extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
void QRasterPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect)
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index cb6f26b2c5..9ffc35a608 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -114,7 +114,6 @@ enum ApplicationResourceFlags
static unsigned applicationResourceFlags = 0;
QString *QGuiApplicationPrivate::platform_name = 0;
-bool QGuiApplicationPrivate::app_do_modal = false;
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
@@ -381,6 +380,132 @@ QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags
}
/*!
+ Returns the most recently shown modal window. If no modal windows are
+ visible, this function returns zero.
+
+ A modal window is a window which has its
+ \l{QWindow::windowModality}{windowModality} property set to Qt::WindowModal
+ or Qt::ApplicationModal. A modal window must be closed before the user can
+ continue with other parts of the program.
+
+ Modal window are organized in a stack. This function returns the modal
+ window at the top of the stack.
+
+ \sa Qt::WindowModality, QWindow::setWindowModality()
+*/
+QWindow *QGuiApplication::modalWindow()
+{
+ if (QGuiApplicationPrivate::self->modalWindowList.isEmpty())
+ return 0;
+ return QGuiApplicationPrivate::self->modalWindowList.first();
+}
+
+void QGuiApplicationPrivate::showModalWindow(QWindow *window)
+{
+ self->modalWindowList.prepend(window);
+
+ QEvent e(QEvent::WindowBlocked);
+ QWindowList windows = QGuiApplication::topLevelWindows();
+ for (int i = 0; i < windows.count(); ++i) {
+ QWindow *window = windows.at(i);
+ if (!window->d_func()->blockedByModalWindow && window->windowType() != Qt::Tool && self->isWindowBlocked(window)) {
+ window->d_func()->blockedByModalWindow = true;
+ QGuiApplication::sendEvent(window, &e);
+ }
+ }
+}
+
+void QGuiApplicationPrivate::hideModalWindow(QWindow *window)
+{
+ self->modalWindowList.removeAll(window);
+
+ QEvent e(QEvent::WindowUnblocked);
+ QWindowList windows = QGuiApplication::topLevelWindows();
+ for (int i = 0; i < windows.count(); ++i) {
+ QWindow *window = windows.at(i);
+ if (window->d_func()->blockedByModalWindow && window->windowType() != Qt::Tool && !self->isWindowBlocked(window)) {
+ window->d_func()->blockedByModalWindow = false;
+ QGuiApplication::sendEvent(window, &e);
+ }
+ }
+}
+
+/*
+ Returns true if \a window is blocked by a modal window. If \a
+ blockingWindow is non-zero, *blockingWindow will be set to the blocking
+ window (or to zero if \a window is not blocked).
+*/
+bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const
+{
+ QWindow *unused = 0;
+ if (!blockingWindow)
+ blockingWindow = &unused;
+
+ if (modalWindowList.isEmpty()) {
+ *blockingWindow = 0;
+ return false;
+ }
+
+ for (int i = 0; i < modalWindowList.count(); ++i) {
+ QWindow *modalWindow = modalWindowList.at(i);
+
+ {
+ // check if the modal window is our window or a (transient) parent of our window
+ QWindow *w = window;
+ while (w) {
+ if (w == modalWindow) {
+ *blockingWindow = 0;
+ return false;
+ }
+ QWindow *p = w->parent();
+ if (!p)
+ p = w->transientParent();
+ w = p;
+ }
+ }
+
+ Qt::WindowModality windowModality = modalWindow->windowModality();
+ switch (windowModality) {
+ case Qt::ApplicationModal:
+ {
+ if (modalWindow != window) {
+ *blockingWindow = modalWindow;
+ return true;
+ }
+ break;
+ }
+ case Qt::WindowModal:
+ {
+ QWindow *w = window;
+ do {
+ QWindow *m = modalWindow;
+ do {
+ if (m == w) {
+ *blockingWindow = m;
+ return true;
+ }
+ QWindow *p = m->parent();
+ if (!p)
+ p = m->transientParent();
+ m = p;
+ } while (m);
+ QWindow *p = w->parent();
+ if (!p)
+ p = w->transientParent();
+ w = p;
+ } while (w);
+ break;
+ }
+ default:
+ Q_ASSERT_X(false, "QGuiApplication", "internal error, a modal widget cannot be modeless");
+ break;
+ }
+ }
+ *blockingWindow = 0;
+ return false;
+}
+
+/*!
Returns the QWindow that receives events tied to focus,
such as key events.
*/
@@ -1049,6 +1174,11 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
}
if (window) {
+ if (window->d_func()->blockedByModalWindow) {
+ // a modal window is blocking this window, don't allow mouse events through
+ return;
+ }
+
QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers);
ev.setTimestamp(e->timestamp);
#ifndef QT_NO_CURSOR
@@ -1111,6 +1241,11 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
QWindow *window = e->window.data();
if (window) {
+ if (window->d_func()->blockedByModalWindow) {
+ // a modal window is blocking this window, don't allow wheel events through
+ return;
+ }
+
QWheelEvent ev(e->localPos, e->globalPos, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation, buttons, e->modifiers);
ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &ev);
@@ -1128,6 +1263,10 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
window = QGuiApplication::activeWindow();
if (!window)
return;
+ if (window->d_func()->blockedByModalWindow) {
+ // a modal window is blocking this window, don't allow key events through
+ return;
+ }
QKeyEvent ev(e->keyType, e->key, e->modifiers,
e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers,
@@ -1140,6 +1279,10 @@ void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::En
{
if (!e->enter)
return;
+ if (e->enter.data()->d_func()->blockedByModalWindow) {
+ // a modal window is blocking this window, don't allow enter events through
+ return;
+ }
QEvent event(QEvent::Enter);
QCoreApplication::sendSpontaneousEvent(e->enter.data(), &event);
@@ -1149,6 +1292,10 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le
{
if (!e->leave)
return;
+ if (e->leave.data()->d_func()->blockedByModalWindow) {
+ // a modal window is blocking this window, don't allow leave events through
+ return;
+ }
QEvent event(QEvent::Leave);
QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event);
@@ -1263,6 +1410,10 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
{
if (e->window.isNull())
return;
+ if (e->window.data()->d_func()->blockedByModalWindow) {
+ // a modal window is blocking this window, don't allow close events through
+ return;
+ }
QCloseEvent event;
QGuiApplication::sendSpontaneousEvent(e->window.data(), &event);
@@ -1451,6 +1602,11 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
break;
}
+ if (w->d_func()->blockedByModalWindow) {
+ // a modal window is blocking this window, don't allow touch events through
+ continue;
+ }
+
QTouchEvent touchEvent(eventType,
e->device,
e->modifiers,
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 858083b10b..75a0f6cd4b 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QGUIAPPLICATION_QPA_H
-#define QGUIAPPLICATION_QPA_H
+#ifndef QGUIAPPLICATION_H
+#define QGUIAPPLICATION_H
#include <QtCore/qcoreapplication.h>
#include <QtGui/qwindowdefs.h>
@@ -88,6 +88,8 @@ public:
static QString platformName();
+ static QWindow *modalWindow();
+
#ifdef QT_DEPRECATED
static QT_DEPRECATED QWindow *activeWindow() { return focusWindow(); }
#endif
@@ -168,4 +170,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QGUIAPPLICATION_QPA_H
+#endif // QGUIAPPLICATION_H
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 352917f2db..435994cdd3 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QGUIAPPLICATION_QPA_P_H
-#define QGUIAPPLICATION_QPA_P_H
+#ifndef QGUIAPPLICATION_P_H
+#define QGUIAPPLICATION_P_H
#include <QtGui/qguiapplication.h>
@@ -147,7 +147,11 @@ public:
static QGuiApplicationPrivate *instance() { return self; }
static QString *platform_name;
- static bool app_do_modal;
+
+ QWindowList modalWindowList;
+ static void showModalWindow(QWindow *window);
+ static void hideModalWindow(QWindow *window);
+ virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const;
static Qt::MouseButtons buttons;
static ulong mousePressTime;
@@ -226,4 +230,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QGUIAPPLICATION_QPA_P_H
+#endif // QGUIAPPLICATION_P_H
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index b0200335d7..c616681b64 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -55,14 +55,14 @@
#endif
#include "qvariant.h"
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
#include <QtCore/private/qcore_mac_p.h>
#include <Carbon/Carbon.h>
#endif
QT_BEGIN_NAMESPACE
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
static bool qt_sequence_no_mnemonics = true;
struct MacSpecialKey {
int key;
@@ -966,7 +966,7 @@ QKeySequence::QKeySequence(const QKeySequence& keysequence)
d->ref.ref();
}
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
static inline int maybeSwapShortcut(int shortcut)
{
if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
@@ -998,7 +998,7 @@ QList<QKeySequence> QKeySequence::keyBindings(StandardKey key)
QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i];
if (keyBinding.standardKey == key && (keyBinding.platform & platform)) {
uint shortcut =
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
maybeSwapShortcut(QKeySequencePrivate::keyBindings[i].shortcut);
#else
QKeySequencePrivate::keyBindings[i].shortcut;
@@ -1200,7 +1200,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
if (nativeText) {
gmodifs = globalModifs();
if (gmodifs->isEmpty()) {
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
if (dontSwap)
*gmodifs << QModifKeyName(Qt::META, QChar(kCommandUnicode));
@@ -1240,7 +1240,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
modifs += *gmodifs; // Test non-translated ones last
QString sl = accel;
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
for (int i = 0; i < modifs.size(); ++i) {
const QModifKeyName &mkf = modifs.at(i);
if (sl.contains(mkf.name)) {
@@ -1292,7 +1292,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
int fnum = 0;
if (accel.length() == 1) {
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
int qtKey = qtkeyForMacSymbol(accel[0]);
if (qtKey != -1) {
ret |= qtKey;
@@ -1371,7 +1371,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
if (key == -1 || key == Qt::Key_unknown)
return s;
-#if defined(Q_OS_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
if (nativeText) {
// On Mac OS X the order (by default) is Meta, Alt, Shift, Control.
// If the AA_MacDontSwapCtrlAndMeta is enabled, then the order
@@ -1427,7 +1427,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
: QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1);
} else if (key) {
int i=0;
-#if defined(Q_OS_MAC)
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
if (nativeText) {
QChar ch = qt_macSymbolForQtKey(key);
if (!ch.isNull())
@@ -1437,7 +1437,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
} else
#endif
{
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
NonSymbol:
#endif
while (keyname[i].name) {
@@ -1463,7 +1463,7 @@ NonSymbol:
}
}
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
if (nativeText)
s += p;
else
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index efb65ae3e7..b9a47a54b8 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -51,9 +51,11 @@
#include <QtGui/QSurfaceFormat>
#ifdef __GLEW_H__
+#if defined(Q_CC_GNU)
#warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined
#warning To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h
#endif
+#endif
#include <QtGui/qopengl.h>
diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h
index e29cf87d03..c1a572b27d 100644
--- a/src/gui/kernel/qplatformcursor_qpa.h
+++ b/src/gui/kernel/qplatformcursor_qpa.h
@@ -38,8 +38,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef QGRAPHICSSYSTEMCURSOR_H
-#define QGRAPHICSSYSTEMCURSOR_H
+#ifndef QPLATFORMCURSOR_QPA_H
+#define QPLATFORMCURSOR_QPA_H
#include <QtCore/QList>
#include <QtGui/QImage>
@@ -60,7 +60,7 @@ public:
QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
{ set(data, mask, width, height, hotX, hotY); }
QImage * image() { return &cursorImage; }
- QPoint hotspot() { return hot; }
+ QPoint hotspot() const { return hot; }
void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY);
void set(const QImage &image, int hx, int hy);
void set(Qt::CursorShape);
@@ -97,4 +97,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QGRAPHICSSYSTEMCURSOR_H
+#endif // QPLATFORMCURSOR_QPA_H
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index 227059e24e..a9dfbba788 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -329,7 +329,7 @@ bool QPlatformWindow::setMouseGrabEnabled(bool grab)
However, it is not concerned with how Qt renders into the window it represents.
Visible QWindows will always have a QPlatformWindow. However, it is not necessary for
- all windows to have a QWindowSurface. This is the case for QOpenGLWidget. And could be the case for
+ all windows to have a QBackingStore. This is the case for QOpenGLWidget. And could be the case for
windows where some 3.party renders into it.
The platform specific window handle can be retrieved by the winId function.
@@ -340,7 +340,7 @@ bool QPlatformWindow::setMouseGrabEnabled(bool grab)
The only way to retrieve a QPlatformOpenGLContext in QPA is by calling the glContext() function
on QPlatformWindow.
- \sa QWindowSurface, QWindow
+ \sa QBackingStore, QWindow
*/
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp
index 534135cc2f..8b71fc3536 100644
--- a/src/gui/kernel/qsurface.cpp
+++ b/src/gui/kernel/qsurface.cpp
@@ -88,7 +88,9 @@ QSurface::QSurface(SurfaceClass type)
{
}
-
+QSurface::~QSurface()
+{
+}
QSurface::SurfaceClass QSurface::surfaceClass() const
{
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index d65998ce49..b042283071 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -193,10 +193,6 @@ QWindow::~QWindow()
destroy();
}
-QSurface::~QSurface()
-{
-}
-
/*!
Set the \a surfaceType of the window.
@@ -253,6 +249,13 @@ void QWindow::setVisible(bool visible)
QGuiApplication::sendEvent(this, &showEvent);
}
+ if (isModal()) {
+ if (visible)
+ QGuiApplicationPrivate::showModalWindow(this);
+ else
+ QGuiApplicationPrivate::hideModalWindow(this);
+ }
+
d->platformWindow->setVisible(visible);
if (!visible) {
@@ -1396,7 +1399,7 @@ void QWindow::resizeEvent(QResizeEvent *ev)
/*!
Override this to handle show events.
- The show event is called when the window has requested becoming visible.
+ The function is called when the window has requested becoming visible.
If the window is successfully shown by the windowing system, this will
be followed by a resize and an expose event.
@@ -1409,7 +1412,7 @@ void QWindow::showEvent(QShowEvent *ev)
/*!
Override this to handle hide evens.
- The hide event is called when the window has requested being hidden in the
+ The function is called when the window has requested being hidden in the
windowing system.
*/
void QWindow::hideEvent(QHideEvent *ev)
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 2be50d63bc..118e3ec25f 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QWINDOW_QPA_H
-#define QWINDOW_QPA_H
+#ifndef QWINDOW_H
+#define QWINDOW_H
#include <QtCore/QObject>
#include <QtCore/QEvent>
@@ -249,7 +249,6 @@ public Q_SLOTS:
}
Q_SIGNALS:
- void backBufferReady();
void screenChanged(QScreen *screen);
void windowModalityChanged(Qt::WindowModality windowModality);
@@ -306,4 +305,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QWINDOW_QPA_H
+#endif // QWINDOW_H
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 03b3b92a25..375bd1e729 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QWINDOW_QPA_P_H
-#define QWINDOW_QPA_P_H
+#ifndef QWINDOW_P_H
+#define QWINDOW_P_H
#include <QtGui/qwindow.h>
#include <QtGui/qplatformwindow_qpa.h>
@@ -81,6 +81,7 @@ public:
, windowOrientation(Qt::PrimaryOrientation)
, maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX)
, modality(Qt::NonModal)
+ , blockedByModalWindow(false)
, transientParent(0)
, screen(0)
{
@@ -123,6 +124,8 @@ public:
QSize sizeIncrement;
Qt::WindowModality modality;
+ bool blockedByModalWindow;
+
QPointer<QWindow> transientParent;
QScreen *screen;
};
@@ -132,4 +135,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QWINDOW_QPA_P_H
+#endif // QWINDOW_P_H
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index ce36a821b6..87029849e3 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -45,9 +45,11 @@
#ifndef QT_NO_OPENGL
#ifdef __GLEW_H__
+#if defined(Q_CC_GNU)
#warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined
#warning To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h
#endif
+#endif
#include <QtGui/qopengl.h>
#include <QtGui/qopenglcontext.h>
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index d1dd246e9c..a8f6a5bf8f 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -53,7 +53,6 @@ SOURCES += \
painting/qoutlinemapper.cpp \
painting/qpagedpaintdevice.cpp \
painting/qpaintdevice.cpp \
- painting/qpaintdevice_qpa.cpp \
painting/qpaintengine.cpp \
painting/qpaintengineex.cpp \
painting/qpainter.cpp \
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index f531565fb9..75122571d6 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -2260,7 +2260,7 @@ QColor QColor::light(int factor) const
QColor hsv = toHsv();
int s = hsv.ct.ahsv.saturation;
- int v = hsv.ct.ahsv.value;
+ uint v = hsv.ct.ahsv.value;
v = (factor*v)/100;
if (v > USHRT_MAX) {
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
index ced2e4548c..c26d7e5d98 100644
--- a/src/gui/painting/qmatrix.cpp
+++ b/src/gui/painting/qmatrix.cpp
@@ -44,6 +44,7 @@
#include "qmatrix.h"
#include "qregion.h"
#include "qpainterpath.h"
+#include "qpainterpath_p.h"
#include "qvariant.h"
#include <qmath.h>
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index d1dfa7001f..afbd86601d 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -76,4 +76,20 @@ Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice
return device->metric(metric);
}
+int QPaintDevice::metric(PaintDeviceMetric m) const
+{
+ qWarning("QPaintDevice::metrics: Device has no metric information");
+ if (m == PdmDpiX) {
+ return 72;
+ } else if (m == PdmDpiY) {
+ return 72;
+ } else if (m == PdmNumColors) {
+ // FIXME: does this need to be a real value?
+ return 256;
+ } else {
+ qDebug("Unrecognised metric %d!",m);
+ return 0;
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintdevice_qpa.cpp b/src/gui/painting/qpaintdevice_qpa.cpp
deleted file mode 100644
index e469a5f10f..0000000000
--- a/src/gui/painting/qpaintdevice_qpa.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** 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 "qpaintdevice.h"
-#include "qpainter.h"
-#include "qbitmap.h"
-#include "qguiapplication.h"
-
-QT_BEGIN_NAMESPACE
-
-int QPaintDevice::metric(PaintDeviceMetric m) const
-{
- qWarning("QPaintDevice::metrics: Device has no metric information");
- if (m == PdmDpiX) {
- return 72;
- } else if (m == PdmDpiY) {
- return 72;
- } else if (m == PdmNumColors) {
- // FIXME: does this need to be a real value?
- return 256;
- } else {
- qDebug("Unrecognised metric %d!",m);
- return 0;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 31c6b30ec4..dd2f507653 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -150,7 +150,6 @@ public:
virtual void beginNativePainting() {}
virtual void endNativePainting() {}
- // ### Qt5: remove, once QtGui is merged into QtGui and QtWidgets
// Return a pixmap filter of "type" that can render the parameters
// in "prototype". The returned filter is owned by the engine and
// will be destroyed when the engine is destroyed. The "prototype"
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index e098e7c761..0e8811b934 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -478,14 +478,26 @@ static void qt_debug_path(const QPainterPath &path)
\sa ElementType, elementAt(), isEmpty()
*/
+int QPainterPath::elementCount() const
+{
+ return d_ptr ? d_ptr->elements.size() : 0;
+}
+
/*!
- \fn const QPainterPath::Element &QPainterPath::elementAt(int index) const
+ \fn QPainterPath::Element QPainterPath::elementAt(int index) const
Returns the element at the given \a index in the painter path.
\sa ElementType, elementCount(), isEmpty()
*/
+QPainterPath::Element QPainterPath::elementAt(int i) const
+{
+ Q_ASSERT(d_ptr);
+ Q_ASSERT(i >= 0 && i < elementCount());
+ return d_ptr->elements.at(i);
+}
+
/*!
\fn void QPainterPath::setElementPositionAt(int index, qreal x, qreal y)
\since 4.2
@@ -494,6 +506,17 @@ static void qt_debug_path(const QPainterPath &path)
x and \a y.
*/
+void QPainterPath::setElementPositionAt(int i, qreal x, qreal y)
+{
+ Q_ASSERT(d_ptr);
+ Q_ASSERT(i >= 0 && i < elementCount());
+ detach();
+ QPainterPath::Element &e = d_ptr->elements[i];
+ e.x = x;
+ e.y = y;
+}
+
+
/*###
\fn QPainterPath &QPainterPath::operator +=(const QPainterPath &other)
@@ -535,6 +558,13 @@ QPainterPath::QPainterPath(const QPointF &startPoint)
d_func()->elements << e;
}
+void QPainterPath::detach()
+{
+ if (d_ptr->ref.load() != 1)
+ detach_helper();
+ setDirty(true);
+}
+
/*!
\internal
*/
@@ -1451,6 +1481,11 @@ QRectF QPainterPath::controlPointRect() const
\sa elementCount()
*/
+bool QPainterPath::isEmpty() const
+{
+ return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement);
+}
+
/*!
Creates and returns a reversed copy of the path.
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 40456bc163..7bb52f4125 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -165,7 +165,7 @@ public:
Qt::FillRule fillRule() const;
void setFillRule(Qt::FillRule fillRule);
- inline bool isEmpty() const;
+ bool isEmpty() const;
QPainterPath toReversed() const;
QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const;
@@ -175,9 +175,9 @@ public:
QList<QPolygonF> toFillPolygons(const QTransform &matrix) const;
QPolygonF toFillPolygon(const QTransform &matrix) const;
- inline int elementCount() const;
- inline const QPainterPath::Element &elementAt(int i) const;
- inline void setElementPositionAt(int i, qreal x, qreal y);
+ int elementCount() const;
+ QPainterPath::Element elementAt(int i) const;
+ void setElementPositionAt(int i, qreal x, qreal y);
qreal length() const;
qreal percentAtLength(qreal t) const;
@@ -211,7 +211,7 @@ private:
inline void ensureData() { if (!d_ptr) ensureData_helper(); }
void ensureData_helper();
- inline void detach();
+ void detach();
void detach_helper();
void setDirty(bool);
void computeBoundingRect() const;
@@ -233,29 +233,6 @@ private:
#endif
};
-class QPainterPathPrivate
-{
-public:
- friend class QPainterPath;
- friend class QPainterPathData;
- friend class QPainterPathStroker;
- friend class QPainterPathStrokerPrivate;
- friend class QMatrix;
- friend class QTransform;
- friend class QVectorPath;
- friend struct QPainterPathPrivateDeleter;
-#ifndef QT_NO_DATASTREAM
- friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &);
- friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);
-#endif
-
- QPainterPathPrivate() : ref(1) {}
-
-private:
- QAtomicInt ref;
- QVector<QPainterPath::Element> elements;
-};
-
Q_DECLARE_TYPEINFO(QPainterPath::Element, Q_PRIMITIVE_TYPE);
#ifndef QT_NO_DATASTREAM
@@ -391,40 +368,6 @@ inline void QPainterPath::translate(const QPointF &offset)
inline QPainterPath QPainterPath::translated(const QPointF &offset) const
{ return translated(offset.x(), offset.y()); }
-inline bool QPainterPath::isEmpty() const
-{
- return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement);
-}
-
-inline int QPainterPath::elementCount() const
-{
- return d_ptr ? d_ptr->elements.size() : 0;
-}
-
-inline const QPainterPath::Element &QPainterPath::elementAt(int i) const
-{
- Q_ASSERT(d_ptr);
- Q_ASSERT(i >= 0 && i < elementCount());
- return d_ptr->elements.at(i);
-}
-
-inline void QPainterPath::setElementPositionAt(int i, qreal x, qreal y)
-{
- Q_ASSERT(d_ptr);
- Q_ASSERT(i >= 0 && i < elementCount());
- detach();
- QPainterPath::Element &e = d_ptr->elements[i];
- e.x = x;
- e.y = y;
-}
-
-
-inline void QPainterPath::detach()
-{
- if (d_ptr->ref.load() != 1)
- detach_helper();
- setDirty(true);
-}
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QPainterPath &);
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index a9068f3855..116ea63425 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -65,6 +65,29 @@
QT_BEGIN_NAMESPACE
+class QPainterPathPrivate
+{
+public:
+ friend class QPainterPath;
+ friend class QPainterPathData;
+ friend class QPainterPathStroker;
+ friend class QPainterPathStrokerPrivate;
+ friend class QMatrix;
+ friend class QTransform;
+ friend class QVectorPath;
+ friend struct QPainterPathPrivateDeleter;
+#ifndef QT_NO_DATASTREAM
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &);
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);
+#endif
+
+ QPainterPathPrivate() : ref(1) {}
+
+private:
+ QAtomicInt ref;
+ QVector<QPainterPath::Element> elements;
+};
+
class QPainterPathStrokerPrivate
{
public:
diff --git a/src/gui/painting/qplatformbackingstore_qpa.cpp b/src/gui/painting/qplatformbackingstore_qpa.cpp
index ff7d91ccea..485190d301 100644
--- a/src/gui/painting/qplatformbackingstore_qpa.cpp
+++ b/src/gui/painting/qplatformbackingstore_qpa.cpp
@@ -114,9 +114,6 @@ QWindow* QPlatformBackingStore::window() const
This function is called before painting onto the surface begins,
with the \a region in which the painting will occur.
- \note A platform providing a backing store with an alpha channel
- needs to properly initialize the region to be painted.
-
\sa endPaint(), paintDevice()
*/
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index e5c41efc15..ba971d454d 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -45,6 +45,7 @@
#include "qmatrix.h"
#include "qregion.h"
#include "qpainterpath.h"
+#include "qpainterpath_p.h"
#include "qvariant.h"
#include <qmath.h>
#include <qnumeric.h>
diff --git a/src/gui/text/qfont_qpa.cpp b/src/gui/text/qfont_qpa.cpp
index 6576f237c4..b73b03025b 100644
--- a/src/gui/text/qfont_qpa.cpp
+++ b/src/gui/text/qfont_qpa.cpp
@@ -75,35 +75,12 @@ void QFont::setRawName(const QString &)
QString QFont::defaultFamily() const
{
- QString familyName;
- switch(d->request.styleHint) {
- case QFont::SansSerif:
- familyName = QString::fromLatin1("sans-serif");
- break;
- case QFont::Serif:
- familyName = QString::fromLatin1("serif");
- break;
- case QFont::TypeWriter:
- case QFont::Monospace:
- familyName = QString::fromLatin1("monospace");
- break;
- case QFont::Cursive:
- familyName = QString::fromLatin1("cursive");
- break;
- case QFont::Fantasy:
- familyName = QString::fromLatin1("fantasy");
- break;
- case QFont::Decorative:
- familyName = QString::fromLatin1("decorative");
- break;
- case QFont::System:
- default:
- familyName = QString();
- break;
- }
-
- return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(familyName);
-
+ QPlatformFontDatabase *fontDB = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ const QStringList fallbacks = fontDB->fallbacksForFamily(QString(), QFont::StyleNormal
+ , QFont::StyleHint(d->request.styleHint), QUnicodeTables::Common);
+ if (!fallbacks.isEmpty())
+ return fallbacks.first();
+ return QString();
}
QString QFont::lastResortFamily() const
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 468d029cf2..a1af856992 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -735,12 +735,13 @@ static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDe
fontDef->family += QLatin1Char(']');
}
- if (desc.style->smoothScalable)
+ if (desc.style->smoothScalable
+ || QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
+ || (desc.style->bitmapScalable && (request.styleStrategy & QFont::PreferMatch))) {
fontDef->pixelSize = request.pixelSize;
- else if ((desc.style->bitmapScalable && (request.styleStrategy & QFont::PreferMatch)))
- fontDef->pixelSize = request.pixelSize;
- else
+ } else {
fontDef->pixelSize = desc.size->pixelSize;
+ }
fontDef->styleHint = request.styleHint;
fontDef->styleStrategy = request.styleStrategy;
@@ -1534,6 +1535,9 @@ bool QFontDatabase::isScalable(const QString &family,
QList<int> QFontDatabase::pointSizes(const QString &family,
const QString &styleName)
{
+ if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable())
+ return standardSizes();
+
bool smoothScalable = false;
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
@@ -1634,6 +1638,9 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
QList<int> QFontDatabase::smoothSizes(const QString &family,
const QString &styleName)
{
+ if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable())
+ return standardSizes();
+
bool smoothScalable = false;
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
@@ -1689,12 +1696,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
*/
QList<int> QFontDatabase::standardSizes()
{
- QList<int> ret;
- static const unsigned short standard[] =
- { 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72, 0 };
- const unsigned short *sizes = standard;
- while (*sizes) ret << *sizes++;
- return ret;
+ return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->standardSizes();
}
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index b30f7da48d..f0830f2a41 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -46,8 +46,6 @@
#include <QtCore/qstring.h>
#include <QtGui/qfont.h>
-class tst_QFont;
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -162,9 +160,6 @@ private:
friend class QFontEngineMultiXLFD;
friend class QFontEngineMultiQWS;
friend class QFontEngineMultiQPA;
-#ifdef QT_BUILD_INTERNAL
- friend class ::tst_QFont;
-#endif
QFontDatabasePrivate *d;
};
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
index 0014efc450..c2a3aa9722 100644
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ b/src/gui/text/qfontdatabase_qpa.cpp
@@ -161,9 +161,12 @@ QFontEngine *loadSingleEngine(int script,
Q_UNUSED(foundry);
Q_ASSERT(size);
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
int pixelSize = size->pixelSize;
- if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE))
+ if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE)
+ || pfdb->fontsAlwaysScalable()) {
pixelSize = request.pixelSize;
+ }
QFontDef def = request;
def.pixelSize = pixelSize;
@@ -171,7 +174,6 @@ QFontEngine *loadSingleEngine(int script,
QFontCache::Key key(def,script);
QFontEngine *engine = QFontCache::instance()->findEngine(key);
if (!engine) {
- QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
engine = pfdb->fontEngine(def,QUnicodeTables::Script(script),size->handle);
if (engine) {
QFontCache::Key key(def,script);
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index 6af0398f00..f6d82802f7 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -385,6 +385,35 @@ QString QPlatformFontDatabase::resolveFontFamilyAlias(const QString &family) con
}
/*!
+ Return true if all fonts are considered scalable when using this font database.
+ Defaults to false.
+
+ \since 5.0
+ */
+
+bool QPlatformFontDatabase::fontsAlwaysScalable() const
+{
+ return false;
+}
+
+/*!
+ Return list of standard font sizes when using this font database.
+
+ \since 5.0
+ */
+
+ QList<int> QPlatformFontDatabase::standardSizes() const
+{
+ QList<int> ret;
+ static const unsigned short standard[] =
+ { 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72, 0 };
+ ret.reserve(int(sizeof(standard) / sizeof(standard[0])));
+ const unsigned short *sizes = standard;
+ while (*sizes) ret << *sizes++;
+ return ret;
+}
+
+/*!
\class QPlatformFontDatabase
\brief The QPlatformFontDatabase class makes it possible to customize how fonts
are discovered and how they are rendered
diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h
index 3810b75dbf..9fe3b0380d 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.h
+++ b/src/gui/text/qplatformfontdatabase_qpa.h
@@ -102,6 +102,8 @@ public:
virtual QFont defaultFont() const;
virtual QString resolveFontFamilyAlias(const QString &family) const;
+ virtual bool fontsAlwaysScalable() const;
+ virtual QList<int> standardSizes() const;
//callback
static void registerQPF2Font(const QByteArray &dataArray, void *handle);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index c5c6b2e621..793ea4aa9e 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2185,7 +2185,7 @@ int QTextEngine::formatIndex(const QScriptItem *si) const
int pos = si->position;
if (specialData && si->position >= specialData->preeditPosition) {
if (si->position < specialData->preeditPosition + specialData->preeditText.length())
- pos = qMax(specialData->preeditPosition - 1, 0);
+ pos = qMax(qMin(block.length(), specialData->preeditPosition) - 1, 0);
else
pos -= specialData->preeditText.length();
}
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index a7e68a41c2..9a38b1f0b2 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -3010,7 +3010,6 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
*/
-// ### Qt5 qreal replace with a QTextLength
/*!
\fn qreal QTextImageFormat::width() const
@@ -3029,7 +3028,6 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
*/
-// ### Qt5 qreal replace with a QTextLength
/*!
\fn qreal QTextImageFormat::height() const
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index da08c4e468..7005fca902 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1051,7 +1051,7 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
&& !attributes.at(i + 1).isEmpty()) {
hasHref = true;
charFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- charFormat.setForeground(Qt::blue); // ### Qt5: QApplication::palette().link());
+ charFormat.setForeground(Qt::blue);
}
}
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index b3b4c90d79..25760de0dc 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -145,7 +145,7 @@ QTextOption &QTextOption::operator=(const QTextOption &o)
\sa tabArray(), setTabStop(), setTabs()
*/
-void QTextOption::setTabArray(QList<qreal> tabStops) // Qt5: const ref
+void QTextOption::setTabArray(const QList<qreal> &tabStops)
{
if (!d)
d = new QTextOptionPrivate;
@@ -165,7 +165,7 @@ void QTextOption::setTabArray(QList<qreal> tabStops) // Qt5: const ref
\sa tabStops()
*/
-void QTextOption::setTabs(QList<QTextOption::Tab> tabStops) // Qt5: const ref
+void QTextOption::setTabs(const QList<QTextOption::Tab> &tabStops)
{
if (!d)
d = new QTextOptionPrivate;
diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h
index 96a0cdda9b..44dc79e255 100644
--- a/src/gui/text/qtextoption.h
+++ b/src/gui/text/qtextoption.h
@@ -122,10 +122,10 @@ public:
inline void setTabStop(qreal tabStop);
inline qreal tabStop() const { return tab; }
- void setTabArray(QList<qreal> tabStops);
+ void setTabArray(const QList<qreal> &tabStops);
QList<qreal> tabArray() const;
- void setTabs(QList<Tab> tabStops);
+ void setTabs(const QList<Tab> &tabStops);
QList<Tab> tabs() const;
void setUseDesignMetrics(bool b) { design = b; }