summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp25
-rw-r--r--src/gui/accessible/qaccessible.h25
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp2
-rw-r--r--src/gui/accessible/qplatformaccessibility_qpa.cpp9
-rw-r--r--src/gui/accessible/qplatformaccessibility_qpa.h11
-rw-r--r--src/gui/image/qimage.cpp15
-rw-r--r--src/gui/image/qimage.h21
-rw-r--r--src/gui/image/qimage_p.h10
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp18
-rw-r--r--src/gui/image/qimagereader.cpp6
-rw-r--r--src/gui/image/qpixmap.cpp4
-rw-r--r--src/gui/image/qpixmap.h6
-rw-r--r--src/gui/image/qplatformpixmap.cpp9
-rw-r--r--src/gui/image/qpnghandler.cpp228
-rw-r--r--src/gui/kernel/kernel.pri2
-rw-r--r--src/gui/kernel/qclipboard.cpp11
-rw-r--r--src/gui/kernel/qclipboard.h5
-rw-r--r--src/gui/kernel/qclipboard_qpa.cpp14
-rw-r--r--src/gui/kernel/qevent.cpp32
-rw-r--r--src/gui/kernel/qevent.h24
-rw-r--r--src/gui/kernel/qguiapplication.cpp63
-rw-r--r--src/gui/kernel/qguiapplication.h6
-rw-r--r--src/gui/kernel/qguiapplication_p.h2
-rw-r--r--src/gui/kernel/qinputmethod.cpp14
-rw-r--r--src/gui/kernel/qinputmethod.h2
-rw-r--r--src/gui/kernel/qinputmethod_p.h11
-rw-r--r--src/gui/kernel/qkeysequence.cpp24
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.cpp10
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.h11
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.cpp8
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.h11
-rw-r--r--src/gui/kernel/qplatformdialoghelper_qpa.cpp29
-rw-r--r--src/gui/kernel/qplatformdialoghelper_qpa.h20
-rw-r--r--src/gui/kernel/qplatformdrag_qpa.cpp9
-rw-r--r--src/gui/kernel/qplatformdrag_qpa.h11
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.cpp4
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.h11
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.h11
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.cpp35
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.h20
-rw-r--r--src/gui/kernel/qplatformopenglcontext_qpa.h11
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.h11
-rw-r--r--src/gui/kernel/qplatformscreenpageflipper_qpa.cpp21
-rw-r--r--src/gui/kernel/qplatformscreenpageflipper_qpa.h11
-rw-r--r--src/gui/kernel/qplatformservices_qpa.h11
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache_qpa.h11
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.cpp9
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.h11
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.h11
-rw-r--r--src/gui/kernel/qplatformthemeplugin_qpa.cpp9
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp24
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.h15
-rw-r--r--src/gui/opengl/opengl.pri2
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp7
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp4
-rw-r--r--src/gui/opengl/qtriangulator.cpp2
-rw-r--r--src/gui/painting/qbrush.cpp2
-rw-r--r--src/gui/painting/qdrawhelper.cpp135
-rw-r--r--src/gui/painting/qdrawhelper_p.h8
-rw-r--r--src/gui/painting/qmatrix.h14
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/painting/qplatformbackingstore_qpa.h11
-rw-r--r--src/gui/painting/qrgb.h18
-rw-r--r--src/gui/painting/qtransform.h26
-rw-r--r--src/gui/text/qcssparser.cpp2
-rw-r--r--src/gui/text/qfont.cpp74
-rw-r--r--src/gui/text/qfont.h5
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp8
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.h11
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp63
-rw-r--r--src/gui/text/qtextlayout.cpp8
-rw-r--r--src/gui/text/qzip.cpp11
-rw-r--r--src/gui/util/qdesktopservices.cpp8
-rw-r--r--src/gui/util/qdesktopservices.h5
-rw-r--r--src/gui/util/qvalidator.cpp11
76 files changed, 900 insertions, 483 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index ed3ee28f4f..02318468bb 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -641,18 +641,11 @@ void QAccessible::setRootObject(QObject *object)
}
/*!
+ \fn void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
\deprecated
Use the version with a single \l QAccessibleEvent paremeter instead.
*/
-void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
-{
- Q_ASSERT(object);
-
- QAccessibleEvent ev(object, reason);
- ev.setChild(child);
- updateAccessibility(&ev);
-}
/*!
Notifies about a change that might be relevant for accessibility clients.
@@ -1242,6 +1235,22 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
d << ")";
return d.space();
}
+
+/*! \internal */
+QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
+{
+ if (!&ev) {
+ d << "QAccessibleEvent(null)";
+ return d;
+ }
+ d.nospace() << "QAccessibleEvent(object=" << hex << ev.object();
+ d.nospace() << dec;
+ d.nospace() << "child=" << ev.child();
+ d << " event=" << qAccessibleEventString(ev.type());
+ d.nospace() << ")";
+ return d.space();
+}
+
#endif
QT_END_NAMESPACE
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 180ab61ef9..ce7c54e00b 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -293,10 +293,12 @@ public:
PageTabList = 0x0000003C,
Clock = 0x0000003D,
Splitter = 0x0000003E,
+ // Reserved space in case MSAA roles needs to be added
+
// Additional Qt roles where enum value does not map directly to MSAA:
- LayeredPane = 0x0000003F,
- Terminal = 0x00000040,
- Desktop = 0x00000041,
+ LayeredPane = 0x00000080,
+ Terminal = 0x00000081,
+ Desktop = 0x00000082,
UserRole = 0x0000ffff
};
@@ -340,8 +342,9 @@ public:
static RootObjectHandler installRootObjectHandler(RootObjectHandler);
static QAccessibleInterface *queryAccessibleInterface(QObject *);
-
- QT_DEPRECATED static void updateAccessibility(QObject *object, int child, Event reason);
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED static inline void updateAccessibility(QObject *object, int child, Event reason);
+#endif
static void updateAccessibility(QAccessibleEvent *event);
static bool isActive();
@@ -621,6 +624,18 @@ Q_GUI_EXPORT const char *qAccessibleEventString(QAccessible::Event event);
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface);
+Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleEvent &ev);
+#endif
+
+#if QT_DEPRECATED_SINCE(5, 0)
+inline void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
+{
+ Q_ASSERT(object);
+
+ QAccessibleEvent ev(object, reason);
+ ev.setChild(child);
+ updateAccessibility(&ev);
+}
#endif
#endif // QT_NO_ACCESSIBILITY
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index db4ee242ff..22c8ba5321 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -243,7 +243,7 @@ QAccessibleInterface *QAccessibleApplication::child(int index) const
/*! \reimp */
QAccessibleInterface *QAccessibleApplication::focusChild() const
{
- if (QWindow *window = QGuiApplication::activeWindow())
+ if (QWindow *window = QGuiApplication::focusWindow())
return window->accessibleRoot();
return 0;
}
diff --git a/src/gui/accessible/qplatformaccessibility_qpa.cpp b/src/gui/accessible/qplatformaccessibility_qpa.cpp
index 057d43add3..91b5de1198 100644
--- a/src/gui/accessible/qplatformaccessibility_qpa.cpp
+++ b/src/gui/accessible/qplatformaccessibility_qpa.cpp
@@ -59,12 +59,15 @@ Q_GLOBAL_STATIC(QVector<QAccessibleBridge *>, bridges)
/*!
\class QPlatformAccessibility
- \brief The QPlatformAccessibility class is the base class for
- integrating accessibility backends
-
+ \since 5.0
+ \internal
\preliminary
+ \ingroup qpa
\ingroup accessibility
+ \brief The QPlatformAccessibility class is the base class for
+ integrating accessibility backends
+
\sa QAccessible
*/
QPlatformAccessibility::QPlatformAccessibility()
diff --git a/src/gui/accessible/qplatformaccessibility_qpa.h b/src/gui/accessible/qplatformaccessibility_qpa.h
index 3bd6316d01..b1efd7cb34 100644
--- a/src/gui/accessible/qplatformaccessibility_qpa.h
+++ b/src/gui/accessible/qplatformaccessibility_qpa.h
@@ -41,6 +41,17 @@
#ifndef QPLATFORMACCESSIBILITY_H
#define QPLATFORMACCESSIBILITY_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qobject.h>
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 9770aca9e5..b8ec7de851 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1127,9 +1127,7 @@ QImage QImage::copy(const QRect& r) const
image.d->dpmy = d->dpmy;
image.d->offset = d->offset;
image.d->has_alpha_clut = d->has_alpha_clut;
-#ifndef QT_NO_IMAGE_TEXT
image.d->text = d->text;
-#endif
return image;
}
@@ -1219,9 +1217,7 @@ QImage QImage::copy(const QRect& r) const
image.d->dpmy = dotsPerMeterY();
image.d->offset = offset();
image.d->has_alpha_clut = d->has_alpha_clut;
-#ifndef QT_NO_IMAGE_TEXT
image.d->text = d->text;
-#endif
return image;
}
@@ -3350,9 +3346,7 @@ QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags) co
image.setDotsPerMeterY(dotsPerMeterY());
image.setDotsPerMeterX(dotsPerMeterX());
-#if !defined(QT_NO_IMAGE_TEXT)
image.d->text = d->text;
-#endif // !QT_NO_IMAGE_TEXT
converter(image.d, d, flags);
return image;
@@ -3399,14 +3393,12 @@ static QImage convertWithPalette(const QImage &src, QImage::Format format,
QImage dest(src.size(), format);
dest.setColorTable(clut);
-#if !defined(QT_NO_IMAGE_TEXT)
QString textsKeys = src.text();
QStringList textKeyList = textsKeys.split(QLatin1Char('\n'), QString::SkipEmptyParts);
foreach (const QString &textKey, textKeyList) {
QStringList textKeySplitted = textKey.split(QLatin1String(": "));
dest.setText(textKeySplitted[0], textKeySplitted[1]);
}
-#endif // !QT_NO_IMAGE_TEXT
int h = src.height();
int w = src.width();
@@ -3474,9 +3466,7 @@ QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Q
QImage image(d->width, d->height, format);
QIMAGE_SANITYCHECK_MEMORY(image);
-#if !defined(QT_NO_IMAGE_TEXT)
- image.d->text = d->text;
-#endif // !QT_NO_IMAGE_TEXT
+ image.d->text = d->text;
converter(image.d, d, flags);
return image;
@@ -4756,7 +4746,6 @@ void QImage::setOffset(const QPoint& p)
if (d)
d->offset = p;
}
-#ifndef QT_NO_IMAGE_TEXT
/*!
Returns the text keys for this image.
@@ -4879,8 +4868,6 @@ void QImage::setText(const QString &key, const QString &value)
\endomit
*/
-#endif // QT_NO_IMAGE_TEXT
-
/*
Sets the image bits to the \a pixmap contents and returns a
reference to the image.
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 6acc03f4bd..db549699a7 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -68,7 +68,6 @@ template <class T> class QVector;
struct QImageData;
class QImageDataMisc; // internal
-#ifndef QT_NO_IMAGE_TEXT
#if QT_DEPRECATED_SINCE(5, 0)
class QImageTextKeyLang {
public:
@@ -84,9 +83,11 @@ public:
{ return key==other.key && lang==other.lang; }
inline bool operator!= (const QImageTextKeyLang &other) const
{ return !operator==(other); }
+private:
+ friend class QImage;
+ QImageTextKeyLang(bool /*dummy*/) {}
};
#endif
-#endif //QT_NO_IMAGE_TEXT
typedef void (*QImageCleanupFunction)(void*);
@@ -267,7 +268,7 @@ public:
void setDotsPerMeterY(int);
QPoint offset() const;
void setOffset(const QPoint&);
-#ifndef QT_NO_IMAGE_TEXT
+
QStringList textKeys() const;
QString text(const QString &key = QString()) const;
void setText(const QString &key, const QString &value);
@@ -279,7 +280,6 @@ public:
QT_DEPRECATED inline QString text(const QImageTextKeyLang&) const;
QT_DEPRECATED inline void setText(const char* key, const char* lang, const QString&);
#endif
-#endif
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline int numColors() const;
@@ -308,13 +308,12 @@ Q_DECLARE_TYPEINFO(QImage, Q_MOVABLE_TYPE);
// Inline functions...
-Q_GUI_EXPORT_INLINE bool QImage::valid(const QPoint &pt) const { return valid(pt.x(), pt.y()); }
-Q_GUI_EXPORT_INLINE int QImage::pixelIndex(const QPoint &pt) const { return pixelIndex(pt.x(), pt.y());}
-Q_GUI_EXPORT_INLINE QRgb QImage::pixel(const QPoint &pt) const { return pixel(pt.x(), pt.y()); }
-Q_GUI_EXPORT_INLINE void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { setPixel(pt.x(), pt.y(), index_or_rgb); }
+inline bool QImage::valid(const QPoint &pt) const { return valid(pt.x(), pt.y()); }
+inline int QImage::pixelIndex(const QPoint &pt) const { return pixelIndex(pt.x(), pt.y());}
+inline QRgb QImage::pixel(const QPoint &pt) const { return pixel(pt.x(), pt.y()); }
+inline void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { setPixel(pt.x(), pt.y(), index_or_rgb); }
#if QT_DEPRECATED_SINCE(5, 0)
-#ifndef QT_NO_IMAGE_TEXT
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
# pragma GCC diagnostic push
@@ -342,7 +341,7 @@ inline QList<QImageTextKeyLang> QImage::textList() const
for (int i = 0; i < keys.size(); ++i) {
int index = keys.at(i).indexOf(QLatin1Char('/'));
if (index > 0) {
- QImageTextKeyLang tkl;
+ QImageTextKeyLang tkl(true);
tkl.key = keys.at(i).left(index).toAscii();
tkl.lang = keys.at(i).mid(index+1).toAscii();
imageTextKeys += tkl;
@@ -399,8 +398,6 @@ inline void QImage::setText(const char* key, const char* lang, const QString &s)
# pragma warning(default: 4996)
#endif
-#endif
-
inline int QImage::numColors() const
{
return colorCount();
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index fd1370d1d3..95108e9bf1 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -55,11 +55,8 @@
#include <QtCore/qglobal.h>
-#include <QVector>
-
-#ifndef QT_NO_IMAGE_TEXT
#include <QMap>
-#endif
+#include <QVector>
QT_BEGIN_NAMESPACE
@@ -103,9 +100,8 @@ struct Q_GUI_EXPORT QImageData { // internal image data
// Return false if the conversion cannot be done in-place.
bool convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags);
-#ifndef QT_NO_IMAGE_TEXT
QMap<QString, QString> text;
-#endif
+
bool doImageIO(const QImage *image, QImageWriter* io, int quality) const;
QPaintEngine *paintEngine;
@@ -152,4 +148,4 @@ inline int qt_depthForFormat(QImage::Format format)
QT_END_NAMESPACE
-#endif
+#endif // QIMAGE_P_H
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index 5b414b8d00..b118f5f856 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -46,15 +46,6 @@
QT_BEGIN_NAMESPACE
-// Legacy, single instance hooks: ### Qt 5: remove
-typedef void (*_qt_pixmap_cleanup_hook)(int);
-typedef void (*_qt_pixmap_cleanup_hook_64)(qint64);
-typedef void (*_qt_image_cleanup_hook)(int);
-Q_GUI_EXPORT _qt_pixmap_cleanup_hook qt_pixmap_cleanup_hook = 0;
-Q_GUI_EXPORT _qt_pixmap_cleanup_hook_64 qt_pixmap_cleanup_hook_64 = 0;
-Q_GUI_EXPORT _qt_image_cleanup_hook qt_image_cleanup_hook = 0;
-Q_GUI_EXPORT _qt_image_cleanup_hook_64 qt_image_cleanup_hook_64 = 0;
-
Q_GLOBAL_STATIC(QImagePixmapCleanupHooks, qt_image_and_pixmap_cleanup_hooks)
QImagePixmapCleanupHooks *QImagePixmapCleanupHooks::instance()
@@ -103,9 +94,6 @@ void QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(QPlatformP
return;
for (int i = 0; i < h->pixmapModificationHooks.count(); ++i)
h->pixmapModificationHooks[i](pmd);
-
- if (qt_pixmap_cleanup_hook_64)
- qt_pixmap_cleanup_hook_64(pmd->cacheKey());
}
void QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(QPlatformPixmap* pmd)
@@ -118,9 +106,6 @@ void QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(QPlatformPi
return;
for (int i = 0; i < h->pixmapDestructionHooks.count(); ++i)
h->pixmapDestructionHooks[i](pmd);
-
- if (qt_pixmap_cleanup_hook_64)
- qt_pixmap_cleanup_hook_64(pmd->cacheKey());
}
void QImagePixmapCleanupHooks::executeImageHooks(qint64 key)
@@ -133,9 +118,6 @@ void QImagePixmapCleanupHooks::executeImageHooks(qint64 key)
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/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 870784f638..fe14a45dcb 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1197,11 +1197,7 @@ bool QImageReader::read(QImage *image)
}
}
} else {
- if (d->handler->supportsOption(QImageIOHandler::ScaledSize) && d->scaledSize.isValid()) {
- // in this case, there's nothing we can do. if the
- // plugin supports scaled size but not ClipRect, then
- // we have to ignore ClipRect."
-
+ if (d->handler->supportsOption(QImageIOHandler::ScaledSize) && d->scaledSize.isValid() && d->clipRect.isNull()) {
if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) {
// nothing to do (ClipRect is ignored!)
} else {
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 65b9d62dfa..cefb8edf74 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -715,7 +715,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
return false;
QFileInfo info(fileName);
- QString key = QLatin1Literal("qt_pixmap")
+ QString key = QLatin1String("qt_pixmap")
% info.absoluteFilePath()
% HexString<uint>(info.lastModified().toTime_t())
% HexString<quint64>(info.size())
@@ -934,8 +934,6 @@ static void sendResizeEvents(QWidget *target)
QPixmap QPixmap::grabWidget(QObject *widget, const QRect &rectangle)
{
QPixmap pixmap;
- // ### Qt5: should we keep or remove this method?
- // SC solution would be to install a callback form QtWidgets, but ugly.
qWarning("QPixmap::grabWidget is deprecated, use QWidget::grab() instead");
if (!widget)
return pixmap;
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 0b21be5c8e..db92965274 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -84,11 +84,11 @@ public:
operator QVariant() const;
- bool isNull() const; // ### Qt 5: make inline
+ bool isNull() const;
int devType() const;
- int width() const; // ### Qt 5: make inline
- int height() const; // ### Qt 5: make inline
+ int width() const;
+ int height() const;
QSize size() const;
QRect rect() const;
int depth() const;
diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp
index 30ac6ce30e..073c267fbe 100644
--- a/src/gui/image/qplatformpixmap.cpp
+++ b/src/gui/image/qplatformpixmap.cpp
@@ -49,6 +49,15 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QPlatformPixmap
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+
+ \brief The QPlatformPixmap class provides an abstraction for native pixmaps.
+ */
QPlatformPixmap *QPlatformPixmap::create(int w, int h, PixelType type)
{
QPlatformPixmap *data = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(static_cast<QPlatformPixmap::PixelType>(type));
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index c3ae0a41da..04f3b4f332 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -116,19 +116,18 @@ public:
};
QPngHandlerPrivate(QPngHandler *qq)
- : gamma(0.0), quality(2), png_ptr(0), info_ptr(0),
- end_info(0), row_pointers(0), state(Ready), q(qq)
+ : gamma(0.0), quality(2), png_ptr(0), info_ptr(0), end_info(0), state(Ready), q(qq)
{ }
float gamma;
int quality;
QString description;
+ QSize scaledSize;
QStringList readTexts;
png_struct *png_ptr;
png_info *info_ptr;
png_info *end_info;
- png_byte **row_pointers;
bool readPngHeader();
bool readPngImage(QImage *image);
@@ -136,6 +135,30 @@ public:
QImage::Format readImageFormat();
+ struct AllocatedMemoryPointers {
+ AllocatedMemoryPointers()
+ : row_pointers(0), accRow(0), inRow(0), outRow(0)
+ { }
+ void deallocate()
+ {
+ delete [] row_pointers;
+ row_pointers = 0;
+ delete [] accRow;
+ accRow = 0;
+ delete [] inRow;
+ inRow = 0;
+ delete [] outRow;
+ outRow = 0;
+ }
+
+ png_byte **row_pointers;
+ quint32 *accRow;
+ png_byte *inRow;
+ uchar *outRow;
+ };
+
+ AllocatedMemoryPointers amp;
+
State state;
QPngHandler *q;
@@ -224,7 +247,7 @@ void CALLBACK_CALL_TYPE qpiw_flush_fn(png_structp /* png_ptr */)
#endif
static
-void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float screen_gamma=0.0)
+void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scaledSize, bool *doScaledRead, float screen_gamma=0.0)
{
if (screen_gamma != 0.0 && png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA)) {
double file_gamma;
@@ -241,7 +264,8 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre
int num_trans;
png_colorp palette = 0;
int num_palette;
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0);
+ int interlace_method;
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, 0, 0);
png_set_interlace_handling(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY) {
@@ -353,8 +377,16 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre
// We want 4 bytes, but it isn't an alpha channel
format = QImage::Format_RGB32;
}
- if (image.size() != QSize(width, height) || image.format() != format) {
- image = QImage(width, height, format);
+ QSize outSize(width,height);
+ if (!scaledSize.isEmpty() && quint32(scaledSize.width()) <= width &&
+ quint32(scaledSize.height()) <= height && interlace_method == PNG_INTERLACE_NONE) {
+ // Do inline downscaling
+ outSize = scaledSize;
+ if (doScaledRead)
+ *doScaledRead = true;
+ }
+ if (image.size() != outSize || image.format() != format) {
+ image = QImage(outSize, format);
if (image.isNull())
return;
}
@@ -371,6 +403,75 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre
}
}
+static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop info_ptr,
+ QPngHandlerPrivate::AllocatedMemoryPointers &amp, QSize scaledSize)
+{
+
+ png_uint_32 width;
+ png_uint_32 height;
+ int bit_depth;
+ int color_type;
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0);
+ uchar *data = outImage->bits();
+ int bpl = outImage->bytesPerLine();
+
+ if (scaledSize.isEmpty() || !width || !height)
+ return;
+
+ const quint32 iysz = height;
+ const quint32 ixsz = width;
+ const quint32 oysz = scaledSize.height();
+ const quint32 oxsz = scaledSize.width();
+ const quint32 ibw = 4*width;
+ amp.accRow = new quint32[ibw];
+ memset(amp.accRow, 0, ibw*sizeof(quint32));
+ amp.inRow = new png_byte[ibw];
+ memset(amp.inRow, 0, ibw*sizeof(png_byte));
+ amp.outRow = new uchar[ibw];
+ memset(amp.outRow, 0, ibw*sizeof(uchar));
+ qint32 rval = 0;
+ for (quint32 oy=0; oy<oysz; oy++) {
+ // Store the rest of the previous input row, if any
+ for (quint32 i=0; i < ibw; i++)
+ amp.accRow[i] = rval*amp.inRow[i];
+ // Accumulate the next input rows
+ for (rval = iysz-rval; rval > 0; rval-=oysz) {
+ png_read_row(png_ptr, amp.inRow, NULL);
+ quint32 fact = qMin(oysz, quint32(rval));
+ for (quint32 i=0; i < ibw; i++)
+ amp.accRow[i] += fact*amp.inRow[i];
+ }
+ rval *= -1;
+
+ // We have a full output row, store it
+ for (quint32 i=0; i < ibw; i++)
+ amp.outRow[i] = uchar(amp.accRow[i]/iysz);
+
+ quint32 a[4] = {0, 0, 0, 0};
+ qint32 cval = oxsz;
+ quint32 ix = 0;
+ for (quint32 ox=0; ox<oxsz; ox++) {
+ for (quint32 i=0; i < 4; i++)
+ a[i] = cval * amp.outRow[ix+i];
+ for (cval = ixsz - cval; cval > 0; cval-=oxsz) {
+ ix += 4;
+ if (ix >= ibw)
+ break; // Safety belt, should not happen
+ quint32 fact = qMin(oxsz, quint32(cval));
+ for (quint32 i=0; i < 4; i++)
+ a[i] += fact * amp.outRow[ix+i];
+ }
+ cval *= -1;
+ for (quint32 i=0; i < 4; i++)
+ data[(4*ox)+i] = uchar(a[i]/ixsz);
+ }
+ data += bpl;
+ }
+ amp.deallocate();
+
+ outImage->setDotsPerMeterX((png_get_x_pixels_per_meter(png_ptr,info_ptr)*oxsz)/ixsz);
+ outImage->setDotsPerMeterY((png_get_y_pixels_per_meter(png_ptr,info_ptr)*oysz)/iysz);
+}
#if defined(Q_C_CALLBACKS)
extern "C" {
@@ -390,7 +491,6 @@ static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const
*/
void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info)
{
-#ifndef QT_NO_IMAGE_TEXT
png_textp text_ptr;
int num_text=0;
png_get_text(png_ptr, info, &text_ptr, &num_text);
@@ -413,7 +513,6 @@ void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info)
readTexts.append(value);
text_ptr++;
}
-#endif
}
@@ -471,90 +570,75 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage)
return false;
}
- row_pointers = 0;
if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- delete [] row_pointers;
png_ptr = 0;
+ amp.deallocate();
state = Error;
return false;
}
- setup_qt(*outImage, png_ptr, info_ptr, gamma);
+ bool doScaledRead = false;
+ setup_qt(*outImage, png_ptr, info_ptr, scaledSize, &doScaledRead, gamma);
if (outImage->isNull()) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- delete [] row_pointers;
png_ptr = 0;
+ amp.deallocate();
state = Error;
return false;
}
- png_uint_32 width;
- png_uint_32 height;
- int bit_depth;
- int color_type;
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
- 0, 0, 0);
-
- uchar *data = outImage->bits();
- int bpl = outImage->bytesPerLine();
- row_pointers = new png_bytep[height];
-
- for (uint y = 0; y < height; y++)
- row_pointers[y] = data + y * bpl;
-
- png_read_image(png_ptr, row_pointers);
-
-#if 0 // libpng takes care of this.
- png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)
- if (outImage->depth()==32 && png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
- QRgb trans = 0xFF000000 | qRgb(
- (info_ptr->trans_values.red << 8 >> bit_depth)&0xff,
- (info_ptr->trans_values.green << 8 >> bit_depth)&0xff,
- (info_ptr->trans_values.blue << 8 >> bit_depth)&0xff);
- for (uint y=0; y<height; y++) {
- for (uint x=0; x<info_ptr->width; x++) {
- if (((uint**)jt)[y][x] == trans) {
- ((uint**)jt)[y][x] &= 0x00FFFFFF;
- } else {
- }
+ if (doScaledRead) {
+ read_image_scaled(outImage, png_ptr, info_ptr, amp, scaledSize);
+ } else {
+ png_uint_32 width;
+ png_uint_32 height;
+ int bit_depth;
+ int color_type;
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0);
+ uchar *data = outImage->bits();
+ int bpl = outImage->bytesPerLine();
+ amp.row_pointers = new png_bytep[height];
+
+ for (uint y = 0; y < height; y++)
+ amp.row_pointers[y] = data + y * bpl;
+
+ png_read_image(png_ptr, amp.row_pointers);
+ amp.deallocate();
+
+ outImage->setDotsPerMeterX(png_get_x_pixels_per_meter(png_ptr,info_ptr));
+ outImage->setDotsPerMeterY(png_get_y_pixels_per_meter(png_ptr,info_ptr));
+
+ // sanity check palette entries
+ if (color_type == PNG_COLOR_TYPE_PALETTE && outImage->format() == QImage::Format_Indexed8) {
+ int color_table_size = outImage->colorCount();
+ for (int y=0; y<(int)height; ++y) {
+ uchar *p = FAST_SCAN_LINE(data, bpl, y);
+ uchar *end = p + width;
+ while (p < end) {
+ if (*p >= color_table_size)
+ *p = 0;
+ ++p;
}
}
}
-#endif
-
- outImage->setDotsPerMeterX(png_get_x_pixels_per_meter(png_ptr,info_ptr));
- outImage->setDotsPerMeterY(png_get_y_pixels_per_meter(png_ptr,info_ptr));
+ }
state = ReadingEnd;
png_read_end(png_ptr, end_info);
-#ifndef QT_NO_IMAGE_TEXT
readPngTexts(end_info);
for (int i = 0; i < readTexts.size()-1; i+=2)
outImage->setText(readTexts.at(i), readTexts.at(i+1));
-#endif
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- delete [] row_pointers;
png_ptr = 0;
+ amp.deallocate();
state = Ready;
- // sanity check palette entries
- if (color_type == PNG_COLOR_TYPE_PALETTE
- && outImage->format() == QImage::Format_Indexed8) {
- int color_table_size = outImage->colorCount();
- for (int y=0; y<(int)height; ++y) {
- uchar *p = FAST_SCAN_LINE(data, bpl, y);
- uchar *end = p + width;
- while (p < end) {
- if (*p >= color_table_size)
- *p = 0;
- ++p;
- }
- }
- }
+ if (scaledSize.isValid() && outImage->size() != scaledSize)
+ *outImage = outImage->scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
return true;
}
@@ -638,7 +722,6 @@ void QPNGImageWriter::setGamma(float g)
}
-#ifndef QT_NO_IMAGE_TEXT
static void set_text(const QImage &image, png_structp png_ptr, png_infop info_ptr,
const QString &description)
{
@@ -712,7 +795,6 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt
}
delete [] text_ptr;
}
-#endif
bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y)
{
@@ -722,10 +804,6 @@ bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y)
bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, int quality_in, const QString &description,
int off_x_in, int off_y_in)
{
-#ifdef QT_NO_IMAGE_TEXT
- Q_UNUSED(description);
-#endif
-
QPoint offset = image.offset();
int off_x = off_x_in + offset.x();
int off_y = off_y_in + offset.y();
@@ -837,9 +915,8 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, in
PNG_RESOLUTION_METER);
}
-#ifndef QT_NO_IMAGE_TEXT
set_text(image, png_ptr, info_ptr, description);
-#endif
+
png_write_info(png_ptr, info_ptr);
if (image.depth() != 1)
@@ -970,7 +1047,8 @@ bool QPngHandler::supportsOption(ImageOption option) const
|| option == Description
|| option == ImageFormat
|| option == Quality
- || option == Size;
+ || option == Size
+ || option == ScaledSize;
}
QVariant QPngHandler::option(ImageOption option) const
@@ -989,9 +1067,11 @@ QVariant QPngHandler::option(ImageOption option) const
else if (option == Size)
return QSize(png_get_image_width(d->png_ptr, d->info_ptr),
png_get_image_height(d->png_ptr, d->info_ptr));
+ else if (option == ScaledSize)
+ return d->scaledSize;
else if (option == ImageFormat)
return d->readImageFormat();
- return 0;
+ return QVariant();
}
void QPngHandler::setOption(ImageOption option, const QVariant &value)
@@ -1002,6 +1082,8 @@ void QPngHandler::setOption(ImageOption option, const QVariant &value)
d->quality = value.toInt();
else if (option == Description)
d->description = value.toString();
+ else if (option == ScaledSize)
+ d->scaledSize = value.toSize();
}
QByteArray QPngHandler::name() const
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index b0fe871741..3c1b6b4e48 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -105,7 +105,7 @@ SOURCES += \
kernel/qplatformservices_qpa.cpp \
kernel/qplatformscreenpageflipper_qpa.cpp
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, egl) {
+contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
HEADERS += \
kernel/qplatformopenglcontext_qpa.h \
kernel/qopenglcontext.h \
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 27179cf141..ef5e4f9c18 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -237,17 +237,6 @@ QClipboard::~QClipboard()
*/
-/*****************************************************************************
- QApplication member functions related to QClipboard.
- *****************************************************************************/
-
-// text handling is done directly in qclipboard_qws, for now
-
-/*!
- \fn bool QClipboard::event(QEvent *e)
- \reimp
-*/
-
/*!
\overload
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index 5c88764d88..1c21e5eaca 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -91,13 +91,8 @@ Q_SIGNALS:
void selectionChanged();
void findBufferChanged();
void dataChanged();
-private Q_SLOTS:
- void ownerDestroyed();
protected:
- void connectNotify(const char *);
- bool event(QEvent *);
-
friend class QApplication;
friend class QApplicationPrivate;
friend class QGuiApplication;
diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp
index 0d97fdd0be..187e09253e 100644
--- a/src/gui/kernel/qclipboard_qpa.cpp
+++ b/src/gui/kernel/qclipboard_qpa.cpp
@@ -57,12 +57,6 @@ void QClipboard::clear(Mode mode)
setMimeData(0, mode);
}
-
-bool QClipboard::event(QEvent *e)
-{
- return QObject::event(e);
-}
-
const QMimeData* QClipboard::mimeData(Mode mode) const
{
QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
@@ -90,14 +84,6 @@ bool QClipboard::ownsMode(Mode mode) const
return clipboard->ownsMode(mode);
}
-void QClipboard::connectNotify( const char * )
-{
-}
-
-void QClipboard::ownerDestroyed()
-{
-}
-
#endif // QT_NO_CLIPBOARD
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 52880a231d..266eb143e5 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1672,16 +1672,13 @@ void QInputMethodEvent::setCommitString(const QString &commitString, int replace
}
/*!
- Sets the tentative commit string to \a tentativeCommitString.
+ \fn void QInputMethodEvent::setTentativeCommitString(const QString &string)
+ Sets the tentative commit string to \a string.
The tentative commit string is what the preedit string is expected to be committed as.
The string can be used within the editor to trigger code that reacts on text changes such as validators.
\deprecated
*/
-void QInputMethodEvent::setTentativeCommitString(const QString &tentativeCommitString)
-{
- tentativeCommit = tentativeCommitString;
-}
/*!
\fn const QList<Attribute> &QInputMethodEvent::attributes() const
@@ -3202,31 +3199,6 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
}
#endif
-#ifndef QT_NO_CLIPBOARD
-/*!
- \class QClipboardEvent
- \ingroup events
- \internal
-
- \brief The QClipboardEvent class provides the parameters used in a clipboard event.
-
- This class is for internal use only, and exists to aid the clipboard on various
- platforms to get all the information it needs. Use QEvent::Clipboard instead.
-
- \sa QClipboard
-*/
-
-QClipboardEvent::QClipboardEvent(QEventPrivate *data)
- : QEvent(QEvent::Clipboard)
-{
- d = data;
-}
-
-QClipboardEvent::~QClipboardEvent()
-{
-}
-#endif // QT_NO_CLIPBOARD
-
/*!
\class QShortcutEvent
\brief The QShortcutEvent class provides an event which is generated when
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 176747aa95..96e630ed0a 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -159,10 +159,8 @@ public:
inline QPoint pixelDelta() const { return pixelD; }
inline QPoint angleDelta() const { return angleD; }
-#if QT_DEPRECATED_SINCE(5, 0)
- inline QT_DEPRECATED int delta() const { return qt4D; }
- inline QT_DEPRECATED Qt::Orientation orientation() const { return qt4O; }
-#endif
+ inline int delta() const { return qt4D; }
+ inline Qt::Orientation orientation() const { return qt4O; }
#ifndef QT_NO_INTEGER_EVENT_COORDINATES
inline QPoint pos() const { return p.toPoint(); }
@@ -461,15 +459,18 @@ public:
QInputMethodEvent();
QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
- QT_DEPRECATED void setTentativeCommitString(const QString &tentativeCommitString);
-
inline const QList<Attribute> &attributes() const { return attrs; }
inline const QString &preeditString() const { return preedit; }
inline const QString &commitString() const { return commit; }
inline int replacementStart() const { return replace_from; }
inline int replacementLength() const { return replace_length; }
+
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED inline void setTentativeCommitString(const QString &string)
+ { tentativeCommit = string; }
QT_DEPRECATED inline const QString &tentativeCommitString() const { return tentativeCommit; }
+#endif
QInputMethodEvent(const QInputMethodEvent &other);
@@ -684,17 +685,6 @@ protected:
};
#endif
-#ifndef QT_NO_CLIPBOARD
-class Q_GUI_EXPORT QClipboardEvent : public QEvent
-{
-public:
- explicit QClipboardEvent(QEventPrivate *data);
- ~QClipboardEvent();
-
- QEventPrivate *data() { return d; }
-};
-#endif
-
class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
{
public:
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 8cbf55de05..8fd4d4a2b3 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -68,6 +68,7 @@
#include <QtGui/QGenericPluginFactory>
#include <QtGui/qstylehints.h>
#include <QtGui/qinputpanel.h>
+#include <QtGui/qpixmapcache.h>
#include <QtGui/qplatformtheme_qpa.h>
#include <QtGui/qplatforminputcontext_qpa.h>
#include <private/qplatforminputcontext_qpa_p.h>
@@ -347,17 +348,14 @@ QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p)
QGuiApplication::~QGuiApplication()
{
Q_D(QGuiApplication);
- // flush clipboard contents
- if (QGuiApplicationPrivate::qt_clipboard) {
- QEvent event(QEvent::Clipboard);
- QGuiApplication::sendEvent(QGuiApplicationPrivate::qt_clipboard, &event);
- }
d->eventDispatcher->closingDown();
d->eventDispatcher = 0;
+#ifndef QT_NO_CLIPBOARD
delete QGuiApplicationPrivate::qt_clipboard;
QGuiApplicationPrivate::qt_clipboard = 0;
+#endif
clearPalette();
@@ -626,33 +624,6 @@ static void init_platform(const QString &pluginArgument, const QString &platform
}
}
- if (name.isEmpty()) {
- const QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath);
-#if defined(Q_OS_MAC)
- const QString defaultPlatform = QLatin1String("cocoa");
-#elif defined (Q_OS_WIN)
- const QString defaultPlatform = QLatin1String("windows");
-#elif defined (Q_OS_QNX)
- const QString defaultPlatform = QLatin1String("qnx");
-#elif !defined (QT_NO_XCB)
- const QString defaultPlatform = QLatin1String("xcb");
-#elif !defined (QT_NO_WAYLAND)
- const QString defaultPlatform = QLatin1String("wayland");
-#elif !defined (QT_NO_EGLFS)
- const QString defaultPlatform = QLatin1String("eglfs");
-#else
- const QString defaultPlatform = QLatin1String("minimal");
-#endif
- if (keys.contains(defaultPlatform)) {
- qWarning("No platform plugin argument was specified, defaulting to \"%s\".",
- qPrintable(defaultPlatform));
- name = defaultPlatform;
- } else {
- qFatal("No platform plugin argument was specified and the default plugin \"%s\" is not available",
- qPrintable(defaultPlatform));
- }
- }
-
// Create the platform integration.
QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath);
if (QGuiApplicationPrivate::platform_integration) {
@@ -889,6 +860,8 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
qt_cleanupFontDatabase();
+ QPixmapCache::clear();
+
delete platform_theme;
delete platform_integration;
platform_integration = 0;
@@ -1026,6 +999,7 @@ bool QGuiApplication::notify(QObject *object, QEvent *event)
}
#endif
+ QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(qobject_cast<QWindow *>(object), event);
return QCoreApplication::notify(object, event);
}
@@ -1047,6 +1021,20 @@ bool QGuiApplication::compressEvent(QEvent *event, QObject *receiver, QPostEvent
return QCoreApplication::compressEvent(event, receiver, postedEvents);
}
+void QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(QWindow *window, QEvent *event)
+{
+ if (!window)
+ return;
+ QPlatformWindow *platformWindow = window->handle();
+ if (!platformWindow)
+ return;
+ // spontaneous events come from the platform integration already, we don't need to send the events back
+ if (event->spontaneous())
+ return;
+ // let the platform window do any handling it needs to as well
+ platformWindow->windowEvent(event);
+}
+
bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)
{
return window->nativeEvent(eventType, message, result);
@@ -1260,7 +1248,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
QWindow *window = e->window.data();
modifier_buttons = e->modifiers;
if (e->nullWindow)
- window = QGuiApplication::activeWindow();
+ window = QGuiApplication::focusWindow();
if (!window)
return;
if (window->d_func()->blockedByModalWindow) {
@@ -2183,18 +2171,17 @@ QInputMethod *QGuiApplication::inputMethod()
}
/*!
+ \fn QInputPanel *QGuiApplication::inputPanel() const
returns the input panel.
The input panel returns properties about the state and position of
the virtual keyboard. It also provides information about the position of the
current focused input element.
- \sa QInputPanel
+ \obsolete
+
+ \sa inputMethod()
*/
-QInputPanel *QGuiApplication::inputPanel() const
-{
- return inputMethod();
-}
/*!
\fn void QGuiApplication::fontDatabaseChanged()
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 2a1ea3d9de..9aad39ed47 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -90,7 +90,7 @@ public:
static QWindow *modalWindow();
-#ifdef QT_DEPRECATED
+#if QT_DEPRECATED_SINCE(5, 0)
static QT_DEPRECATED QWindow *activeWindow() { return focusWindow(); }
#endif
static QWindow *focusWindow();
@@ -130,7 +130,9 @@ public:
static void setDesktopSettingsAware(bool on);
static bool desktopSettingsAware();
- QT_DEPRECATED QInputPanel *inputPanel() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED QInputPanel *inputPanel() const { return inputMethod(); }
+#endif
static QInputMethod *inputMethod();
static QPlatformNativeInterface *platformNativeInterface();
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 435994cdd3..78641de55b 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -126,6 +126,8 @@ public:
static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);
+ static void sendQWindowEventToQPlatformWindow(QWindow *window, QEvent *event);
+
static inline Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
{
if (!(alignment & Qt::AlignHorizontal_Mask))
diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp
index c443a47cac..0e0bc7237a 100644
--- a/src/gui/kernel/qinputmethod.cpp
+++ b/src/gui/kernel/qinputmethod.cpp
@@ -97,12 +97,7 @@ QObject *QInputMethod::inputItem() const
void QInputMethod::setInputItem(QObject *inputItem)
{
Q_D(QInputMethod);
-
- if (d->inputItem.data() == inputItem)
- return;
-
- d->inputItem = inputItem;
- emit inputItemChanged();
+ d->setInputItem(inputItem);
}
/*!
@@ -112,7 +107,7 @@ void QInputMethod::setInputItem(QObject *inputItem)
*/
QWindow *QInputMethod::inputWindow() const
{
- return qApp->activeWindow();
+ return qApp->focusWindow();
}
/*!
@@ -299,7 +294,7 @@ void QInputMethod::update(Qt::InputMethodQueries queries)
if (queries & Qt::ImEnabled) {
QObject *focus = qApp->focusObject();
bool enabled = d->objectAcceptsInputMethod(focus);
- setInputItem(enabled ? focus : 0);
+ d->setInputItem(enabled ? focus : 0);
QPlatformInputContextPrivate::setInputMethodAccepted(enabled);
}
@@ -365,9 +360,8 @@ void QInputMethodPrivate::q_connectFocusObject()
void QInputMethodPrivate::q_checkFocusObject(QObject *object)
{
- Q_Q(QInputMethod);
bool enabled = objectAcceptsInputMethod(object);
- q->setInputItem(enabled ? object : 0);
+ setInputItem(enabled ? object : 0);
}
bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object)
diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h
index 92ae016b97..095c17ffd8 100644
--- a/src/gui/kernel/qinputmethod.h
+++ b/src/gui/kernel/qinputmethod.h
@@ -69,11 +69,13 @@ class Q_GUI_EXPORT QInputMethod : public QObject
Q_ENUMS(Action)
public:
+#ifdef QT_DEPRECATED
QT_DEPRECATED QObject *inputItem() const;
QT_DEPRECATED void setInputItem(QObject *inputItemChanged);
// the window containing the editor
QT_DEPRECATED QWindow *inputWindow() const;
+#endif
QTransform inputItemTransform() const;
void setInputItemTransform(const QTransform &transform);
diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h
index 34a0430f10..1e55b00318 100644
--- a/src/gui/kernel/qinputmethod_p.h
+++ b/src/gui/kernel/qinputmethod_p.h
@@ -69,6 +69,17 @@ public:
{
return inputMethod->d_func();
}
+ inline void setInputItem(QObject *item)
+ {
+ Q_Q(QInputMethod);
+
+ if (inputItem.data() == item)
+ return;
+
+ inputItem = item;
+ emit q->inputItemChanged();
+ }
+
void q_connectFocusObject();
void q_checkFocusObject(QObject *object);
bool objectAcceptsInputMethod(QObject *object);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index c616681b64..4946a1dc18 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -55,14 +55,14 @@
#endif
#include "qvariant.h"
-#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
#include <QtCore/private/qcore_mac_p.h>
#include <Carbon/Carbon.h>
#endif
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
static bool qt_sequence_no_mnemonics = true;
struct MacSpecialKey {
int key;
@@ -876,7 +876,7 @@ const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate
\value Underline Underline text.
\value Undo Undo.
\value UnknownKey Unbound key.
- \value WhatsThis Activate whats this.
+ \value WhatsThis Activate "what's this".
\value ZoomIn Zoom in.
\value ZoomOut Zoom out.
*/
@@ -966,7 +966,7 @@ QKeySequence::QKeySequence(const QKeySequence& keysequence)
d->ref.ref();
}
-#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
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 =
-#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
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()) {
-#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
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;
-#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
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) {
-#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
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) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
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) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
if (nativeText) {
QChar ch = qt_macSymbolForQtKey(key);
if (!ch.isNull())
@@ -1437,7 +1437,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
} else
#endif
{
-#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
NonSymbol:
#endif
while (keyname[i].name) {
@@ -1463,7 +1463,7 @@ NonSymbol:
}
}
-#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
if (nativeText)
s += p;
else
diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp
index bc08a73a7f..7273450077 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.cpp
+++ b/src/gui/kernel/qplatformclipboard_qpa.cpp
@@ -79,6 +79,16 @@ QClipboardData::~QClipboardData()
Q_GLOBAL_STATIC(QClipboardData,q_clipboardData);
+/*!
+ \class QPlatformClipboard
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+
+ \brief The QPlatformClipboard class provides an abstraction for the system clipboard.
+ */
+
QPlatformClipboard::~QPlatformClipboard()
{
diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h
index 4dd672b21e..95c8103b7e 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.h
+++ b/src/gui/kernel/qplatformclipboard_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMCLIPBOARD_QPA_H
#define QPLATFORMCLIPBOARD_QPA_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <qplatformdefs.h>
#ifndef QT_NO_CLIPBOARD
diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp
index a4e998ddbc..5ea080c40a 100644
--- a/src/gui/kernel/qplatformcursor_qpa.cpp
+++ b/src/gui/kernel/qplatformcursor_qpa.cpp
@@ -62,6 +62,10 @@ QList<QPlatformCursor *> QPlatformCursorPrivate::getInstances()
/*!
\class QPlatformCursor
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
\brief The QPlatformCursor class provides information about
pointer device events (movement, buttons), and requests to change
@@ -124,6 +128,10 @@ void QPlatformCursor::setPos(const QPoint &pos)
/*!
\class QPlatformCursorImage
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
\brief The QPlatformCursorImage class provides a set of graphics
intended to be used as cursors.
diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h
index c1a572b27d..fb3e4604d2 100644
--- a/src/gui/kernel/qplatformcursor_qpa.h
+++ b/src/gui/kernel/qplatformcursor_qpa.h
@@ -41,6 +41,17 @@
#ifndef QPLATFORMCURSOR_QPA_H
#define QPLATFORMCURSOR_QPA_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QList>
#include <QtGui/QImage>
#include <QtGui/QMouseEvent>
diff --git a/src/gui/kernel/qplatformdialoghelper_qpa.cpp b/src/gui/kernel/qplatformdialoghelper_qpa.cpp
index 385484828a..f2114d17e0 100644
--- a/src/gui/kernel/qplatformdialoghelper_qpa.cpp
+++ b/src/gui/kernel/qplatformdialoghelper_qpa.cpp
@@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE
\class QPlatformDialogHelper
\since 5.0
\internal
+ \ingroup qpa
+
\brief The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
*/
@@ -159,6 +161,15 @@ QFontDialogOptions::FontDialogOptions QFontDialogOptions::options() const
return d->options;
}
+/*!
+ \class QPlatformFontDialogHelper
+ \since 5.0
+ \internal
+ \ingroup qpa
+
+ \brief The QPlatformFontDialogHelper class allows for platform-specific customization of font dialogs.
+
+*/
const QSharedPointer<QFontDialogOptions> &QPlatformFontDialogHelper::options() const
{
return m_options;
@@ -327,6 +338,15 @@ void QColorDialogOptions::setStandardColor(int index, QRgb color)
qColorDialogStaticData()->standardRgb[index] = color;
}
+/*!
+ \class QPlatformColorDialogHelper
+ \since 5.0
+ \internal
+ \ingroup qpa
+
+ \brief The QPlatformColorDialogHelper class allows for platform-specific customization of color dialogs.
+
+*/
const QSharedPointer<QColorDialogOptions> &QPlatformColorDialogHelper::options() const
{
return m_options;
@@ -543,6 +563,15 @@ void QFileDialogOptions::setInitiallySelectedFiles(const QStringList &files)
d->initiallySelectedFiles = files;
}
+/*!
+ \class QPlatformFileDialogHelper
+ \since 5.0
+ \internal
+ \ingroup qpa
+
+ \brief The QPlatformFileDialogHelper class allows for platform-specific customization of file dialogs.
+
+*/
const QSharedPointer<QFileDialogOptions> &QPlatformFileDialogHelper::options() const
{
return m_options;
diff --git a/src/gui/kernel/qplatformdialoghelper_qpa.h b/src/gui/kernel/qplatformdialoghelper_qpa.h
index 5fdffae5cb..5cd3ab055b 100644
--- a/src/gui/kernel/qplatformdialoghelper_qpa.h
+++ b/src/gui/kernel/qplatformdialoghelper_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMDIALOGHELPER_H
#define QPLATFORMDIALOGHELPER_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QtGlobal>
#include <QtCore/QObject>
#include <QtCore/QList>
@@ -73,11 +84,6 @@ public:
SnapToDefaultButton
};
enum DialogCode { Rejected, Accepted };
- enum ShowFlag {
- ShowModal = 0x00000001
- };
-
- Q_DECLARE_FLAGS(ShowFlags, ShowFlag)
QPlatformDialogHelper();
virtual ~QPlatformDialogHelper();
@@ -88,8 +94,8 @@ public:
virtual void _q_platformRunNativeAppModalPanel() = 0;
virtual void deleteNativeDialog_sys() = 0;
- virtual bool show_sys(ShowFlags showFlags,
- Qt::WindowFlags windowFlags,
+ virtual bool show_sys(Qt::WindowFlags windowFlags,
+ Qt::WindowModality windowModality,
QWindow *parent) = 0;
virtual void hide_sys() = 0;
diff --git a/src/gui/kernel/qplatformdrag_qpa.cpp b/src/gui/kernel/qplatformdrag_qpa.cpp
index 0e7b0f41cc..d9fc3a2ab8 100644
--- a/src/gui/kernel/qplatformdrag_qpa.cpp
+++ b/src/gui/kernel/qplatformdrag_qpa.cpp
@@ -82,6 +82,15 @@ public:
Qt::DropAction cursor_drop_action;
};
+/*!
+ \class QPlatformDrag
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+
+ \brief The QPlatformDrag class provides an abstraction for drag.
+ */
QPlatformDrag::QPlatformDrag() : d_ptr(new QPlatformDragPrivate)
{
}
diff --git a/src/gui/kernel/qplatformdrag_qpa.h b/src/gui/kernel/qplatformdrag_qpa.h
index 22133706d1..14282c5a21 100644
--- a/src/gui/kernel/qplatformdrag_qpa.h
+++ b/src/gui/kernel/qplatformdrag_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMDRAG_H
#define QPLATFORMDRAG_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qglobal.h>
#include <QtGui/QPixmap>
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp
index 8612b4b42f..53839088c5 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.cpp
+++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp
@@ -49,6 +49,10 @@ QT_BEGIN_NAMESPACE
/*!
\class QPlatformInputContext
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
\brief The QPlatformInputContext class abstracts the input method dependent data and composing state.
An input method is responsible for inputting complex text that cannot
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext_qpa.h
index 5e8060c6e0..696146b859 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.h
+++ b/src/gui/kernel/qplatforminputcontext_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMINPUTCONTEXT_H
#define QPLATFORMINPUTCONTEXT_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtGui/qinputpanel.h>
QT_BEGIN_HEADER
diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h
index fe40fd3dad..a44f4343ef 100644
--- a/src/gui/kernel/qplatformintegration_qpa.h
+++ b/src/gui/kernel/qplatformintegration_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMINTEGRATION_H
#define QPLATFORMINTEGRATION_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtGui/qwindowdefs.h>
#include <QtGui/qplatformscreen_qpa.h>
#include <QtGui/qsurfaceformat.h>
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
index 48e43f5226..c17eee4415 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
@@ -43,6 +43,17 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QPlatformNativeInterface
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+
+ \brief The QPlatformNativeInterface class provides an abstraction for retrieving native
+ resource handles.
+ */
+
void *QPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
{
Q_UNUSED(resource);
@@ -69,6 +80,30 @@ void * QPlatformNativeInterface::nativeResourceForBackingStore(const QByteArray
return 0;
}
+QPlatformNativeInterface::NativeResourceForIntegrationFunction QPlatformNativeInterface::nativeResourceFunctionForIntegration(const QByteArray &resource)
+{
+ Q_UNUSED(resource);
+ return 0;
+}
+
+QPlatformNativeInterface::NativeResourceForContextFunction QPlatformNativeInterface::nativeResourceFunctionForContext(const QByteArray &resource)
+{
+ Q_UNUSED(resource);
+ return 0;
+}
+
+QPlatformNativeInterface::NativeResourceForWindowFunction QPlatformNativeInterface::nativeResourceFunctionForWindow(const QByteArray &resource)
+{
+ Q_UNUSED(resource);
+ return 0;
+}
+
+QPlatformNativeInterface::NativeResourceForBackingStoreFunction QPlatformNativeInterface::nativeResourceFunctionForBackingStore(const QByteArray &resource)
+{
+ Q_UNUSED(resource);
+ return 0;
+}
+
/*!
Contains generic window properties that the platform may utilize.
*/
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h
index dd1ef22354..918ba4a9b8 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.h
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMNATIVEINTERFACE_QPA_H
#define QPLATFORMNATIVEINTERFACE_QPA_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtGui/qwindowdefs.h>
#include <QtCore/QObject>
#include <QtCore/QVariant>
@@ -65,6 +76,15 @@ public:
virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
virtual void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore);
+ typedef void * (*NativeResourceForIntegrationFunction)();
+ typedef void * (*NativeResourceForContextFunction)(QOpenGLContext *context);
+ typedef void * (*NativeResourceForWindowFunction)(QWindow *window);
+ typedef void * (*NativeResourceForBackingStoreFunction)(QBackingStore *backingStore);
+ virtual NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource);
+ virtual NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource);
+ virtual NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource);
+ virtual NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource);
+
virtual QVariantMap windowProperties(QPlatformWindow *window) const;
virtual QVariant windowProperty(QPlatformWindow *window, const QString &name) const;
virtual QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const;
diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.h b/src/gui/kernel/qplatformopenglcontext_qpa.h
index af70368f5e..ddcb87ad5a 100644
--- a/src/gui/kernel/qplatformopenglcontext_qpa.h
+++ b/src/gui/kernel/qplatformopenglcontext_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMGLCONTEXT_H
#define QPLATFORMGLCONTEXT_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#ifndef QT_NO_OPENGL
#include <QtCore/qnamespace.h>
diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h
index b6eb91f9b2..71d734867e 100644
--- a/src/gui/kernel/qplatformscreen_qpa.h
+++ b/src/gui/kernel/qplatformscreen_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMSCREEN_H
#define QPLATFORMSCREEN_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qmetatype.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qcoreevent.h>
diff --git a/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp b/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp
index d652e34e5e..b912c6055e 100644
--- a/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp
+++ b/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp
@@ -43,6 +43,15 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QPlatformScreenBuffer
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+
+ \brief The QPlatformScreenBuffer class provides an abstraction for screen buffers.
+ */
QPlatformScreenBuffer::QPlatformScreenBuffer()
: m_destroyed(false)
, m_ready(true)
@@ -73,6 +82,18 @@ void QPlatformScreenBuffer::displayed()
{
}
+
+/*!
+ \class QPlatformScreenPageFlipper
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+
+ \brief The QPlatformScreenPageFlipper class provides an abstraction for flipping the screen
+ page.
+ */
+
QPlatformScreenPageFlipper::QPlatformScreenPageFlipper(QObject *parent)
:QObject(parent)
{
diff --git a/src/gui/kernel/qplatformscreenpageflipper_qpa.h b/src/gui/kernel/qplatformscreenpageflipper_qpa.h
index 850f9d8d2f..116d2dbf82 100644
--- a/src/gui/kernel/qplatformscreenpageflipper_qpa.h
+++ b/src/gui/kernel/qplatformscreenpageflipper_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMSCREENPAGEFLIPPER_QPA_H
#define QPLATFORMSCREENPAGEFLIPPER_QPA_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QObject>
QT_BEGIN_HEADER
diff --git a/src/gui/kernel/qplatformservices_qpa.h b/src/gui/kernel/qplatformservices_qpa.h
index aff2e5d6fe..c9bfe020ab 100644
--- a/src/gui/kernel/qplatformservices_qpa.h
+++ b/src/gui/kernel/qplatformservices_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMSERVICES_QPA_H
#define QPLATFORMSERVICES_QPA_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QtGlobal>
QT_BEGIN_HEADER
diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
index 8a92dbdd31..679b8ab7de 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
+++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMSHAREDGRAPHICSCACHE_QPA_H
#define QPLATFORMSHAREDGRAPHICSCACHE_QPA_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qobject.h>
#include <QtGui/qimage.h>
diff --git a/src/gui/kernel/qplatformsurface_qpa.cpp b/src/gui/kernel/qplatformsurface_qpa.cpp
index 6d3b6503d7..1f752fe3e2 100644
--- a/src/gui/kernel/qplatformsurface_qpa.cpp
+++ b/src/gui/kernel/qplatformsurface_qpa.cpp
@@ -43,6 +43,15 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QPlatformSurface
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+
+ \brief The QPlatformSurface class provides an abstraction for a surface.
+ */
QPlatformSurface::~QPlatformSurface()
{
diff --git a/src/gui/kernel/qplatformsurface_qpa.h b/src/gui/kernel/qplatformsurface_qpa.h
index 80ee99c899..f64a697fc5 100644
--- a/src/gui/kernel/qplatformsurface_qpa.h
+++ b/src/gui/kernel/qplatformsurface_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMSURFACE_H
#define QPLATFORMSURFACE_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qnamespace.h>
#include <QtGui/qsurface.h>
#include <QtGui/qsurfaceformat.h>
diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme_qpa.h
index 6ac6a0f573..8d936e8267 100644
--- a/src/gui/kernel/qplatformtheme_qpa.h
+++ b/src/gui/kernel/qplatformtheme_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMTHEME_H
#define QPLATFORMTHEME_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QtGlobal>
QT_BEGIN_HEADER
diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.cpp b/src/gui/kernel/qplatformthemeplugin_qpa.cpp
index 8383c9b948..da2743d6e3 100644
--- a/src/gui/kernel/qplatformthemeplugin_qpa.cpp
+++ b/src/gui/kernel/qplatformthemeplugin_qpa.cpp
@@ -43,6 +43,15 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QPlatformThemePlugin
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+
+ \brief The QPlatformScreen class provides an abstraction for theme plugins.
+ */
QPlatformThemePlugin::QPlatformThemePlugin(QObject *parent)
: QObject(parent)
{
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index a9dfbba788..b507eb4fdd 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -147,6 +147,7 @@ QMargins QPlatformWindow::frameMargins() const
*/
void QPlatformWindow::setVisible(bool visible)
{
+ Q_UNUSED(visible);
QRect rect(QPoint(), geometry().size());
QWindowSystemInterface::handleSynchronousExposeEvent(window(), rect);
}
@@ -313,6 +314,29 @@ bool QPlatformWindow::setMouseGrabEnabled(bool grab)
}
/*!
+ Reimplement to be able to let Qt indicate that the window has been
+ modified. Return true if the native window supports setting the modified
+ flag, false otherwise.
+*/
+bool QPlatformWindow::setWindowModified(bool modified)
+{
+ Q_UNUSED(modified);
+ return false;
+}
+
+/*!
+ Reimplement this method to be able to do any platform specific event
+ handling. All events for window() are passed to this function before being
+ sent to QWindow::event().
+
+ The default implementation is empty and does nothing with \a event.
+*/
+void QPlatformWindow::windowEvent(QEvent *event)
+{
+ Q_UNUSED(event);
+}
+
+/*!
\class QPlatformWindow
\since 4.8
\internal
diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h
index a72de7b547..729f35e025 100644
--- a/src/gui/kernel/qplatformwindow_qpa.h
+++ b/src/gui/kernel/qplatformwindow_qpa.h
@@ -41,6 +41,17 @@
#ifndef QPLATFORMWINDOW_H
#define QPLATFORMWINDOW_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qscopedpointer.h>
#include <QtCore/qrect.h>
#include <QtCore/qmargins.h>
@@ -102,6 +113,10 @@ public:
virtual bool setKeyboardGrabEnabled(bool grab);
virtual bool setMouseGrabEnabled(bool grab);
+ virtual bool setWindowModified(bool modified);
+
+ virtual void windowEvent(QEvent *event);
+
protected:
QScopedPointer<QPlatformWindowPrivate> d_ptr;
private:
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri
index f0d9000fb6..3becc2bcfe 100644
--- a/src/gui/opengl/opengl.pri
+++ b/src/gui/opengl/opengl.pri
@@ -4,7 +4,7 @@ contains(QT_CONFIG, opengl):CONFIG += opengl
contains(QT_CONFIG, opengles2):CONFIG += opengles2
contains(QT_CONFIG, egl):CONFIG += egl
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, egl) {
+contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
HEADERS += opengl/qopengl.h \
opengl/qopengl_p.h \
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 69b4fc9858..c0899e5a41 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -510,7 +510,7 @@ class QOpenGLShaderProgramPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QOpenGLShaderProgram)
public:
- QOpenGLShaderProgramPrivate(QOpenGLContext *ctx)
+ QOpenGLShaderProgramPrivate()
: programGuard(0)
, linked(false)
, inited(false)
@@ -518,7 +518,7 @@ public:
, geometryVertexCount(64)
, geometryInputType(0)
, geometryOutputType(0)
- , glfuncs(new QOpenGLFunctions(ctx))
+ , glfuncs(new QOpenGLFunctions)
{
}
~QOpenGLShaderProgramPrivate();
@@ -574,7 +574,7 @@ bool QOpenGLShaderProgramPrivate::hasShader(QOpenGLShader::ShaderType type) cons
\sa addShader()
*/
QOpenGLShaderProgram::QOpenGLShaderProgram(QObject *parent)
- : QObject(*new QOpenGLShaderProgramPrivate(QOpenGLContext::currentContext()), parent)
+ : QObject(*new QOpenGLShaderProgramPrivate, parent)
{
}
@@ -594,6 +594,7 @@ bool QOpenGLShaderProgram::init()
QOpenGLContext *context = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
if (!context)
return false;
+ d->glfuncs->initializeGLFunctions();
GLuint program = d->glfuncs->glCreateProgram();
if (!program) {
qWarning() << "QOpenGLShaderProgram: could not create shader program";
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index b37e8fb972..790b92a686 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -106,8 +106,10 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
if (height < 16)
height = 16;
- if (m_textureResource && !m_textureResource->m_texture)
+ if (m_textureResource && !m_textureResource->m_texture) {
delete m_textureResource;
+ m_textureResource = 0;
+ }
if (!m_textureResource)
m_textureResource = new QOpenGLGlyphTexture(ctx);
diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/opengl/qtriangulator.cpp
index c82b2a4ca8..74d33cd7e9 100644
--- a/src/gui/opengl/qtriangulator.cpp
+++ b/src/gui/opengl/qtriangulator.cpp
@@ -1133,7 +1133,7 @@ void QTriangulator<T>::ComplexToSimple::initEdges()
} else {
Q_ASSERT(i + 1 < m_parent->m_indices.size());
// {node, from, to, next, previous, winding, mayIntersect, pointingUp, originallyPointingUp}
- Edge edge = {0, m_parent->m_indices.at(i), m_parent->m_indices.at(i + 1), -1, -1, 0, true, false, false};
+ Edge edge = {0, int(m_parent->m_indices.at(i)), int(m_parent->m_indices.at(i + 1)), -1, -1, 0, true, false, false};
m_edges.add(edge);
}
}
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index fe9b370189..2f0fb9f96c 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -100,7 +100,7 @@ QPixmap qt_pixmapForBrush(int brushStyle, bool invert)
{
QPixmap pm;
- QString key = QLatin1Literal("$qt-brush$")
+ QString key = QLatin1String("$qt-brush$")
% HexString<uint>(brushStyle)
% QLatin1Char(invert ? '1' : '0');
if (!QPixmapCache::find(key, pm)) {
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 919a19eb9b..17877b79d5 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -68,7 +68,6 @@
QT_BEGIN_NAMESPACE
-
#define MASK(src, a) src = BYTE_MUL(src, a)
/*
@@ -316,7 +315,7 @@ FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = {
static uint * QT_FASTCALL destFetchMono(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
{
- uchar *data = (uchar *)rasterBuffer->scanLine(y);
+ uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y);
uint *start = buffer;
const uint *end = buffer + length;
while (buffer < end) {
@@ -329,7 +328,7 @@ static uint * QT_FASTCALL destFetchMono(uint *buffer, QRasterBuffer *rasterBuffe
static uint * QT_FASTCALL destFetchMonoLsb(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
{
- uchar *data = (uchar *)rasterBuffer->scanLine(y);
+ uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y);
uint *start = buffer;
const uint *end = buffer + length;
while (buffer < end) {
@@ -347,7 +346,7 @@ static uint * QT_FASTCALL destFetchARGB32P(uint *, QRasterBuffer *rasterBuffer,
static uint * QT_FASTCALL destFetchRGB16(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
{
- const ushort *data = (const ushort *)rasterBuffer->scanLine(y) + x;
+ const ushort *Q_DECL_RESTRICT data = (const ushort *)rasterBuffer->scanLine(y) + x;
for (int i = 0; i < length; ++i)
buffer[i] = qConvertRgb16To32(data[i]);
return buffer;
@@ -418,7 +417,7 @@ static inline QRgb findNearestColor(QRgb color, QRasterBuffer *rbuf)
static void QT_FASTCALL destStoreMono(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length)
{
- uchar *data = (uchar *)rasterBuffer->scanLine(y);
+ uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y);
if (rasterBuffer->monoDestinationWithClut) {
for (int i = 0; i < length; ++i) {
if (buffer[i] == rasterBuffer->destColor0) {
@@ -445,7 +444,7 @@ static void QT_FASTCALL destStoreMono(QRasterBuffer *rasterBuffer, int x, int y,
static void QT_FASTCALL destStoreMonoLsb(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length)
{
- uchar *data = (uchar *)rasterBuffer->scanLine(y);
+ uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y);
if (rasterBuffer->monoDestinationWithClut) {
for (int i = 0; i < length; ++i) {
if (buffer[i] == rasterBuffer->destColor0) {
@@ -566,9 +565,8 @@ static const uint *QT_FASTCALL fetchUntransformedRGB16(uint *buffer, const Opera
// blendType is either BlendTransformed or BlendTransformedTiled
template<TextureBlendType blendType>
-Q_STATIC_TEMPLATE_FUNCTION
-const uint *QT_FASTCALL fetchTransformedARGB32PM(uint *buffer, const Operator *, const QSpanData *data,
- int y, int x, int length)
+static const uint *QT_FASTCALL fetchTransformedARGB32PM(uint *buffer, const Operator *, const QSpanData *data,
+ int y, int x, int length)
{
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -648,8 +646,7 @@ const uint *QT_FASTCALL fetchTransformedARGB32PM(uint *buffer, const Operator *,
}
template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */
-Q_STATIC_TEMPLATE_FUNCTION
-const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data,
+static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
int image_width = data->texture.width;
@@ -853,10 +850,9 @@ inline void fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(int,
}
template<TextureBlendType blendType> /* blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled */
-Q_STATIC_TEMPLATE_FUNCTION
-const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, const Operator *,
- const QSpanData *data, int y, int x,
- int length)
+static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, const Operator *,
+ const QSpanData *data, int y, int x,
+ int length)
{
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -1303,9 +1299,8 @@ const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, const Op
// blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled
template<TextureBlendType blendType>
-Q_STATIC_TEMPLATE_FUNCTION
-const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *,
- const QSpanData *data, int y, int x, int length)
+static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *,
+ const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
@@ -2039,7 +2034,7 @@ void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint
}
}
-void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Source(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255) {
::memcpy(dest, src, length * sizeof(uint));
@@ -2082,7 +2077,7 @@ void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color,
}
}
-void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_SourceOver(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -2120,7 +2115,7 @@ void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint co
}
}
-void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_DestinationOver(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -2162,7 +2157,7 @@ void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, ui
}
}
-void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_SourceIn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -2199,7 +2194,7 @@ void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint colo
}
}
-void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_DestinationIn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -2241,7 +2236,7 @@ void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, u
}
}
-void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_SourceOut(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -2277,7 +2272,7 @@ void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint col
}
}
-void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_DestinationOut(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -2314,7 +2309,7 @@ void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color,
}
}
-void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_SourceAtop(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -2354,7 +2349,7 @@ void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint co
}
}
-void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_DestinationAtop(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -2396,7 +2391,7 @@ void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint co
}
}
-void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_XOR(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -2472,7 +2467,7 @@ void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color, uint c
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -2486,7 +2481,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *dest, const uin
}
}
-void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Plus(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Plus_impl(dest, src, length, QFullCoverage());
@@ -2536,7 +2531,7 @@ void QT_FASTCALL comp_func_solid_Multiply(uint *dest, int length, uint color, ui
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -2558,7 +2553,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *dest, const
}
}
-void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Multiply(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Multiply_impl(dest, src, length, QFullCoverage());
@@ -2604,7 +2599,7 @@ void QT_FASTCALL comp_func_solid_Screen(uint *dest, int length, uint color, uint
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -2683,7 +2678,7 @@ void QT_FASTCALL comp_func_solid_Overlay(uint *dest, int length, uint color, uin
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -2705,7 +2700,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *dest, const
}
}
-void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Overlay(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Overlay_impl(dest, src, length, QFullCoverage());
@@ -2756,7 +2751,7 @@ void QT_FASTCALL comp_func_solid_Darken(uint *dest, int length, uint color, uint
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -2778,7 +2773,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *dest, const u
}
}
-void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Darken(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Darken_impl(dest, src, length, QFullCoverage());
@@ -2829,7 +2824,7 @@ void QT_FASTCALL comp_func_solid_Lighten(uint *dest, int length, uint color, uin
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -2851,7 +2846,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *dest, const
}
}
-void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Lighten(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Lighten_impl(dest, src, length, QFullCoverage());
@@ -2912,7 +2907,7 @@ void QT_FASTCALL comp_func_solid_ColorDodge(uint *dest, int length, uint color,
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -2934,7 +2929,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *dest, con
}
}
-void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_ColorDodge(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_ColorDodge_impl(dest, src, length, QFullCoverage());
@@ -2995,7 +2990,7 @@ void QT_FASTCALL comp_func_solid_ColorBurn(uint *dest, int length, uint color, u
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -3017,7 +3012,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *dest, cons
}
}
-void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_ColorBurn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_ColorBurn_impl(dest, src, length, QFullCoverage());
@@ -3075,7 +3070,7 @@ void QT_FASTCALL comp_func_solid_HardLight(uint *dest, int length, uint color, u
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -3097,7 +3092,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *dest, cons
}
}
-void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_HardLight(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_HardLight_impl(dest, src, length, QFullCoverage());
@@ -3166,7 +3161,7 @@ void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint color, u
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -3188,7 +3183,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *dest, cons
}
}
-void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_SoftLight(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_SoftLight_impl(dest, src, length, QFullCoverage());
@@ -3239,7 +3234,7 @@ void QT_FASTCALL comp_func_solid_Difference(uint *dest, int length, uint color,
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -3261,7 +3256,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *dest, con
}
}
-void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Difference(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Difference_impl(dest, src, length, QFullCoverage());
@@ -3306,7 +3301,7 @@ void QT_FASTCALL comp_func_solid_Exclusion(uint *dest, int length, uint color, u
}
template <typename T>
-Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *dest, const uint *src, int length, const T &coverage)
+Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
@@ -3328,7 +3323,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *dest, cons
}
}
-void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Exclusion(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Exclusion_impl(dest, src, length, QFullCoverage());
@@ -3351,8 +3346,8 @@ void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest,
*dest++ |= color;
}
-void QT_FASTCALL rasterop_SourceOrDestination(uint *dest,
- const uint *src,
+void QT_FASTCALL rasterop_SourceOrDestination(uint *Q_DECL_RESTRICT dest,
+ const uint *Q_DECL_RESTRICT src,
int length,
uint const_alpha)
{
@@ -3372,8 +3367,8 @@ void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest,
*dest++ &= color;
}
-void QT_FASTCALL rasterop_SourceAndDestination(uint *dest,
- const uint *src,
+void QT_FASTCALL rasterop_SourceAndDestination(uint *Q_DECL_RESTRICT dest,
+ const uint *Q_DECL_RESTRICT src,
int length,
uint const_alpha)
{
@@ -3395,8 +3390,8 @@ void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest,
*dest++ ^= color;
}
-void QT_FASTCALL rasterop_SourceXorDestination(uint *dest,
- const uint *src,
+void QT_FASTCALL rasterop_SourceXorDestination(uint *Q_DECL_RESTRICT dest,
+ const uint *Q_DECL_RESTRICT src,
int length,
uint const_alpha)
{
@@ -3420,8 +3415,8 @@ void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest,
}
}
-void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest,
- const uint *src,
+void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *Q_DECL_RESTRICT dest,
+ const uint *Q_DECL_RESTRICT src,
int length,
uint const_alpha)
{
@@ -3445,8 +3440,8 @@ void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest,
}
}
-void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest,
- const uint *src,
+void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *Q_DECL_RESTRICT dest,
+ const uint *Q_DECL_RESTRICT src,
int length,
uint const_alpha)
{
@@ -3470,8 +3465,8 @@ void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest,
}
}
-void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest,
- const uint *src,
+void QT_FASTCALL rasterop_NotSourceXorDestination(uint *Q_DECL_RESTRICT dest,
+ const uint *Q_DECL_RESTRICT src,
int length,
uint const_alpha)
{
@@ -3489,7 +3484,7 @@ void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length,
qt_memfill(dest, ~color | 0xff000000, length);
}
-void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src,
+void QT_FASTCALL rasterop_NotSource(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src,
int length, uint const_alpha)
{
Q_UNUSED(const_alpha);
@@ -3510,8 +3505,8 @@ void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest,
}
}
-void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest,
- const uint *src,
+void QT_FASTCALL rasterop_NotSourceAndDestination(uint *Q_DECL_RESTRICT dest,
+ const uint *Q_DECL_RESTRICT src,
int length,
uint const_alpha)
{
@@ -3534,8 +3529,8 @@ void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest,
}
}
-void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest,
- const uint *src,
+void QT_FASTCALL rasterop_SourceAndNotDestination(uint *Q_DECL_RESTRICT dest,
+ const uint *Q_DECL_RESTRICT src,
int length,
uint const_alpha)
{
@@ -4049,8 +4044,8 @@ static inline quint32 interpolate_pixel_rgb16x2_255(quint32 x, quint8 a,
return t;
}
-static inline void blend_sourceOver_rgb16_rgb16(quint16 *dest,
- const quint16 *src,
+static inline void blend_sourceOver_rgb16_rgb16(quint16 *Q_DECL_RESTRICT dest,
+ const quint16 *Q_DECL_RESTRICT src,
int length,
const quint8 alpha,
const quint8 ialpha)
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 2e9f064951..f502533443 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -71,9 +71,15 @@ QT_BEGIN_NAMESPACE
// RVCT doesn't like static template functions
# define Q_STATIC_TEMPLATE_FUNCTION
# define Q_STATIC_INLINE_FUNCTION static __forceinline
+# define Q_DECL_RESTRICT
+#elif defined(Q_CC_GNU)
+# define Q_STATIC_TEMPLATE_FUNCTION static __attribute__((always_inline))
+# define Q_STATIC_INLINE_FUNCTION static inline __attribute__((always_inline))
+# define Q_DECL_RESTRICT __restrict__
#else
# define Q_STATIC_TEMPLATE_FUNCTION static
# define Q_STATIC_INLINE_FUNCTION static inline
+# define Q_DECL_RESTRICT
#endif
static const uint AMASK = 0xff000000;
@@ -162,7 +168,7 @@ extern DrawHelper qDrawHelper[QImage::NImageFormats];
void qBlendTexture(int count, const QSpan *spans, void *userData);
-typedef void (QT_FASTCALL *CompositionFunction)(uint *dest, const uint *src, int length, uint const_alpha);
+typedef void (QT_FASTCALL *CompositionFunction)(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha);
typedef void (QT_FASTCALL *CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha);
struct LinearGradientValues
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index 7acc962afa..00eec33410 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -137,19 +137,19 @@ private:
Q_DECLARE_TYPEINFO(QMatrix, Q_MOVABLE_TYPE);
// mathematical semantics
-Q_GUI_EXPORT_INLINE QPoint operator*(const QPoint &p, const QMatrix &m)
+inline QPoint operator*(const QPoint &p, const QMatrix &m)
{ return m.map(p); }
-Q_GUI_EXPORT_INLINE QPointF operator*(const QPointF &p, const QMatrix &m)
+inline QPointF operator*(const QPointF &p, const QMatrix &m)
{ return m.map(p); }
-Q_GUI_EXPORT_INLINE QLineF operator*(const QLineF &l, const QMatrix &m)
+inline QLineF operator*(const QLineF &l, const QMatrix &m)
{ return m.map(l); }
-Q_GUI_EXPORT_INLINE QLine operator*(const QLine &l, const QMatrix &m)
+inline QLine operator*(const QLine &l, const QMatrix &m)
{ return m.map(l); }
-Q_GUI_EXPORT_INLINE QPolygon operator *(const QPolygon &a, const QMatrix &m)
+inline QPolygon operator *(const QPolygon &a, const QMatrix &m)
{ return m.map(a); }
-Q_GUI_EXPORT_INLINE QPolygonF operator *(const QPolygonF &a, const QMatrix &m)
+inline QPolygonF operator *(const QPolygonF &a, const QMatrix &m)
{ return m.map(a); }
-Q_GUI_EXPORT_INLINE QRegion operator *(const QRegion &r, const QMatrix &m)
+inline QRegion operator *(const QRegion &r, const QMatrix &m)
{ return m.map(r); }
Q_GUI_EXPORT QPainterPath operator *(const QPainterPath &p, const QMatrix &m);
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 97b0f91c26..68e60ed548 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -6109,7 +6109,7 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen)
{
const qreal radiusBase = qMax(qreal(1), maxRadius);
- QString key = QLatin1Literal("WaveUnderline-")
+ QString key = QLatin1String("WaveUnderline-")
% pen.color().name()
% HexString<qreal>(radiusBase);
diff --git a/src/gui/painting/qplatformbackingstore_qpa.h b/src/gui/painting/qplatformbackingstore_qpa.h
index 042913292f..a4df63f4d4 100644
--- a/src/gui/painting/qplatformbackingstore_qpa.h
+++ b/src/gui/painting/qplatformbackingstore_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMBACKINGSTORE_QPA_H
#define QPLATFORMBACKINGSTORE_QPA_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qrect.h>
#include <QtGui/qwindow.h>
diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h
index 6d046be1d5..dd59069236 100644
--- a/src/gui/painting/qrgb.h
+++ b/src/gui/painting/qrgb.h
@@ -53,31 +53,31 @@ typedef unsigned int QRgb; // RGB triplet
const QRgb RGB_MASK = 0x00ffffff; // masks RGB values
-Q_GUI_EXPORT_INLINE int qRed(QRgb rgb) // get red part of RGB
+inline int qRed(QRgb rgb) // get red part of RGB
{ return ((rgb >> 16) & 0xff); }
-Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb) // get green part of RGB
+inline int qGreen(QRgb rgb) // get green part of RGB
{ return ((rgb >> 8) & 0xff); }
-Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb) // get blue part of RGB
+inline int qBlue(QRgb rgb) // get blue part of RGB
{ return (rgb & 0xff); }
-Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb) // get alpha part of RGBA
+inline int qAlpha(QRgb rgb) // get alpha part of RGBA
{ return rgb >> 24; }
-Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)// set RGB value
+inline QRgb qRgb(int r, int g, int b)// set RGB value
{ return (0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
-Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)// set RGBA value
+inline QRgb qRgba(int r, int g, int b, int a)// set RGBA value
{ return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
-Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)// convert R,G,B to gray 0..255
+inline int qGray(int r, int g, int b)// convert R,G,B to gray 0..255
{ return (r*11+g*16+b*5)/32; }
-Q_GUI_EXPORT_INLINE int qGray(QRgb rgb) // convert RGB to gray 0..255
+inline int qGray(QRgb rgb) // convert RGB to gray 0..255
{ return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); }
-Q_GUI_EXPORT_INLINE bool qIsGray(QRgb rgb)
+inline bool qIsGray(QRgb rgb)
{ return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); }
QT_END_NAMESPACE
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index 2e56da1873..9fd713d21f 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -361,34 +361,34 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QTransform &);
/****** end stream functions *******************/
// mathematical semantics
-Q_GUI_EXPORT_INLINE QPoint operator*(const QPoint &p, const QTransform &m)
+inline QPoint operator*(const QPoint &p, const QTransform &m)
{ return m.map(p); }
-Q_GUI_EXPORT_INLINE QPointF operator*(const QPointF &p, const QTransform &m)
+inline QPointF operator*(const QPointF &p, const QTransform &m)
{ return m.map(p); }
-Q_GUI_EXPORT_INLINE QLineF operator*(const QLineF &l, const QTransform &m)
+inline QLineF operator*(const QLineF &l, const QTransform &m)
{ return m.map(l); }
-Q_GUI_EXPORT_INLINE QLine operator*(const QLine &l, const QTransform &m)
+inline QLine operator*(const QLine &l, const QTransform &m)
{ return m.map(l); }
-Q_GUI_EXPORT_INLINE QPolygon operator *(const QPolygon &a, const QTransform &m)
+inline QPolygon operator *(const QPolygon &a, const QTransform &m)
{ return m.map(a); }
-Q_GUI_EXPORT_INLINE QPolygonF operator *(const QPolygonF &a, const QTransform &m)
+inline QPolygonF operator *(const QPolygonF &a, const QTransform &m)
{ return m.map(a); }
-Q_GUI_EXPORT_INLINE QRegion operator *(const QRegion &r, const QTransform &m)
+inline QRegion operator *(const QRegion &r, const QTransform &m)
{ return m.map(r); }
-Q_GUI_EXPORT_INLINE QPainterPath operator *(const QPainterPath &p, const QTransform &m)
+inline QPainterPath operator *(const QPainterPath &p, const QTransform &m)
{ return m.map(p); }
-Q_GUI_EXPORT_INLINE QTransform operator *(const QTransform &a, qreal n)
+inline QTransform operator *(const QTransform &a, qreal n)
{ QTransform t(a); t *= n; return t; }
-Q_GUI_EXPORT_INLINE QTransform operator /(const QTransform &a, qreal n)
+inline QTransform operator /(const QTransform &a, qreal n)
{ QTransform t(a); t /= n; return t; }
-Q_GUI_EXPORT_INLINE QTransform operator +(const QTransform &a, qreal n)
+inline QTransform operator +(const QTransform &a, qreal n)
{ QTransform t(a); t += n; return t; }
-Q_GUI_EXPORT_INLINE QTransform operator -(const QTransform &a, qreal n)
+inline QTransform operator -(const QTransform &a, qreal n)
{ QTransform t(a); t -= n; return t; }
QT_END_NAMESPACE
QT_END_HEADER
-#endif
+#endif // QTRANSFORM_H
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index fd01934eae..a06818bcd3 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -544,7 +544,7 @@ QSize ValueExtractor::sizeValue(const Declaration &decl)
else
x[1] = x[0];
QList<QVariant> v;
- v << QVariant::fromValue<LengthData>(x[0]) << qVariantFromValue<LengthData>(x[1]);
+ v << QVariant::fromValue<LengthData>(x[0]) << QVariant::fromValue<LengthData>(x[1]);
decl.d->parsed = v;
return QSize(lengthValueFromData(x[0], f), lengthValueFromData(x[1], f));
}
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 56ff298d9b..161bb4e23d 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -391,7 +391,7 @@ QFontEngineData::~QFontEngineData()
lastResortFont() in cases where a suitable match cannot be found.
You can provide substitutions for font family names using
insertSubstitution() and insertSubstitutions(). Substitutions can
- be removed with removeSubstitution(). Use substitute() to retrieve
+ be removed with removeSubstitutions(). Use substitute() to retrieve
a family's first substitute, or the family name itself if it has
no substitutes. Use substitutes() to retrieve a list of a family's
substitutes (which may be empty).
@@ -1788,27 +1788,6 @@ QFont QFont::resolve(const QFont &other) const
typedef QHash<QString, QStringList> QFontSubst;
Q_GLOBAL_STATIC(QFontSubst, globalFontSubst)
-// create substitution dict
-static void initFontSubst()
-{
- // default substitutions
- static const char * const initTbl[] = {
-
-
- 0, 0
- };
-
- QFontSubst *fontSubst = globalFontSubst();
- Q_ASSERT(fontSubst != 0);
- if (!fontSubst->isEmpty())
- return;
-
- for (int i=0; initTbl[i] != 0; i += 2) {
- QStringList &list = (*fontSubst)[QString::fromLatin1(initTbl[i])];
- list.append(QString::fromLatin1(initTbl[i+1]));
- }
-}
-
/*!
Returns the first family name to be used whenever \a familyName is
specified. The lookup is case insensitive.
@@ -1818,12 +1797,10 @@ static void initFontSubst()
To obtain a list of substitutions use substitutes().
- \sa setFamily() insertSubstitutions() insertSubstitution() removeSubstitution()
+ \sa setFamily() insertSubstitutions() insertSubstitution() removeSubstitutions()
*/
QString QFont::substitute(const QString &familyName)
{
- initFontSubst();
-
QFontSubst *fontSubst = globalFontSubst();
Q_ASSERT(fontSubst != 0);
QFontSubst::ConstIterator it = fontSubst->constFind(familyName.toLower());
@@ -1841,12 +1818,10 @@ QString QFont::substitute(const QString &familyName)
If there is no substitution for \a familyName, an empty list is
returned.
- \sa substitute() insertSubstitutions() insertSubstitution() removeSubstitution()
+ \sa substitute() insertSubstitutions() insertSubstitution() removeSubstitutions()
*/
QStringList QFont::substitutes(const QString &familyName)
{
- initFontSubst();
-
QFontSubst *fontSubst = globalFontSubst();
Q_ASSERT(fontSubst != 0);
return fontSubst->value(familyName.toLower(), QStringList());
@@ -1857,13 +1832,11 @@ QStringList QFont::substitutes(const QString &familyName)
Inserts \a substituteName into the substitution
table for the family \a familyName.
- \sa insertSubstitutions() removeSubstitution() substitutions() substitute() substitutes()
+ \sa insertSubstitutions() removeSubstitutions() substitutions() substitute() substitutes()
*/
void QFont::insertSubstitution(const QString &familyName,
const QString &substituteName)
{
- initFontSubst();
-
QFontSubst *fontSubst = globalFontSubst();
Q_ASSERT(fontSubst != 0);
QStringList &list = (*fontSubst)[familyName.toLower()];
@@ -1877,22 +1850,18 @@ void QFont::insertSubstitution(const QString &familyName,
Inserts the list of families \a substituteNames into the
substitution list for \a familyName.
- \sa insertSubstitution(), removeSubstitution(), substitutions(), substitute()
+ \sa insertSubstitution(), removeSubstitutions(), substitutions(), substitute()
*/
void QFont::insertSubstitutions(const QString &familyName,
const QStringList &substituteNames)
{
- initFontSubst();
-
QFontSubst *fontSubst = globalFontSubst();
Q_ASSERT(fontSubst != 0);
QStringList &list = (*fontSubst)[familyName.toLower()];
- QStringList::ConstIterator it = substituteNames.constBegin();
- while (it != substituteNames.constEnd()) {
- QString s = (*it).toLower();
- if (!list.contains(s))
- list.append(s);
- it++;
+ foreach (const QString &substituteName, substituteNames) {
+ const QString lowerSubstituteName = substituteName.toLower();
+ if (!list.contains(lowerSubstituteName))
+ list.append(lowerSubstituteName);
}
}
@@ -1910,22 +1879,26 @@ void QFont::insertSubstitutions(const QString &familyName,
Internal function that cleans up the font system.
*/
-// ### mark: should be called removeSubstitutions()
/*!
Removes all the substitutions for \a familyName.
\sa insertSubstitutions(), insertSubstitution(), substitutions(), substitute()
+ \since 5.0
*/
-void QFont::removeSubstitution(const QString &familyName)
-{ // ### function name should be removeSubstitutions() or
- // ### removeSubstitutionList()
- initFontSubst();
-
+void QFont::removeSubstitutions(const QString &familyName)
+{
QFontSubst *fontSubst = globalFontSubst();
Q_ASSERT(fontSubst != 0);
fontSubst->remove(familyName.toLower());
}
+/*!
+ \fn void QFont::removeSubstitution(const QString &familyName)
+
+ \obsolete
+
+ This function is deprecated. Use removeSubstitutions() instead.
+*/
/*!
Returns a sorted list of substituted family names.
@@ -1934,17 +1907,14 @@ void QFont::removeSubstitution(const QString &familyName)
*/
QStringList QFont::substitutions()
{
- initFontSubst();
+ typedef QFontSubst::const_iterator QFontSubstConstIterator;
QFontSubst *fontSubst = globalFontSubst();
Q_ASSERT(fontSubst != 0);
QStringList ret;
- QFontSubst::ConstIterator it = fontSubst->constBegin();
-
- while (it != fontSubst->constEnd()) {
+ const QFontSubstConstIterator cend = fontSubst->constEnd();
+ for (QFontSubstConstIterator it = fontSubst->constBegin(); it != cend; ++it)
ret.append(it.key());
- ++it;
- }
ret.sort();
return ret;
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index a3019e560c..45186cecc6 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -257,7 +257,10 @@ public:
static QStringList substitutions();
static void insertSubstitution(const QString&, const QString &);
static void insertSubstitutions(const QString&, const QStringList &);
- static void removeSubstitution(const QString &);
+ static void removeSubstitutions(const QString &);
+#if QT_DEPRECATED_SINCE(5, 0)
+ static QT_DEPRECATED void removeSubstitution(const QString &family) { removeSubstitutions(family); }
+#endif
static void initialize();
static void cleanup();
static void cacheStatistics();
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index f6d82802f7..632d2d89d9 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -415,11 +415,15 @@ bool QPlatformFontDatabase::fontsAlwaysScalable() const
/*!
\class QPlatformFontDatabase
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+ \ingroup painting
+
\brief The QPlatformFontDatabase class makes it possible to customize how fonts
are discovered and how they are rendered
- \ingroup painting
-
QPlatformFontDatabase is the superclass which is intended to let platform implementations use
native font handling.
diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h
index 9fe3b0380d..08faf8d84f 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.h
+++ b/src/gui/text/qplatformfontdatabase_qpa.h
@@ -42,6 +42,17 @@
#ifndef QPLATFORMFONTDATABASE_QPA_H
#define QPLATFORMFONTDATABASE_QPA_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qconfig.h>
#include <QtCore/QString>
#include <QtCore/QStringList>
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index a8991d5428..f9fe166c29 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1281,7 +1281,7 @@ QTextCursor QTextDocument::find(const QString &subString, const QTextCursor &fro
static bool findInBlock(const QTextBlock &block, const QRegExp &expression, int offset,
QTextDocument::FindFlags options, QTextCursor &cursor)
{
- const QRegExp expr(expression);
+ QRegExp expr(expression);
QString text = block.text();
text.replace(QChar::Nbsp, QLatin1Char(' '));
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 793ea4aa9e..9848898d66 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1755,12 +1755,19 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
font.setPixelSize((font.pixelSize() * 2) / 3);
scaledEngine = font.d->engineForScript(script);
}
- feCache.prevFontEngine = engine;
+
if (engine)
engine->ref.ref();
- feCache.prevScaledFontEngine = scaledEngine;
+ if (feCache.prevFontEngine)
+ releaseCachedFontEngine(feCache.prevFontEngine);
+ feCache.prevFontEngine = engine;
+
if (scaledEngine)
scaledEngine->ref.ref();
+ if (feCache.prevScaledFontEngine)
+ releaseCachedFontEngine(feCache.prevScaledFontEngine);
+ feCache.prevScaledFontEngine = scaledEngine;
+
feCache.prevScript = script;
feCache.prevPosition = si.position;
feCache.prevLength = length(&si);
@@ -1770,9 +1777,13 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
engine = feCache.prevFontEngine;
else {
engine = font.d->engineForScript(script);
- feCache.prevFontEngine = engine;
+
if (engine)
engine->ref.ref();
+ if (feCache.prevFontEngine)
+ releaseCachedFontEngine(feCache.prevFontEngine);
+ feCache.prevFontEngine = engine;
+
feCache.prevScript = script;
feCache.prevPosition = -1;
feCache.prevLength = -1;
@@ -2318,6 +2329,42 @@ static inline bool prevCharJoins(const QString &string, int pos)
return (joining == QChar::Dual || joining == QChar::Center);
}
+static bool isRetainableControlCode(const QChar &c)
+{
+ return (c.unicode() == 0x202a // LRE
+ || c.unicode() == 0x202b // LRE
+ || c.unicode() == 0x202c // PDF
+ || c.unicode() == 0x202d // LRO
+ || c.unicode() == 0x202e // RLO
+ || c.unicode() == 0x200e // LRM
+ || c.unicode() == 0x200f); // RLM
+}
+
+static QString stringMidRetainingBidiCC(const QString &string,
+ const QString &ellidePrefix,
+ const QString &ellideSuffix,
+ int subStringFrom,
+ int subStringTo,
+ int midStart,
+ int midLength)
+{
+ QString prefix;
+ for (int i=subStringFrom; i<midStart; ++i) {
+ QChar c = string.at(i);
+ if (isRetainableControlCode(c))
+ prefix += c;
+ }
+
+ QString suffix;
+ for (int i=midStart + midLength; i<subStringTo; ++i) {
+ QChar c = string.at(i);
+ if (isRetainableControlCode(c))
+ suffix += c;
+ }
+
+ return prefix + ellidePrefix + string.mid(midStart, midLength) + ellideSuffix + suffix;
+}
+
QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags, int from, int count) const
{
// qDebug() << "elidedText; available width" << width.toReal() << "text width:" << this->width(0, layoutData->string.length()).toReal();
@@ -2429,7 +2476,10 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
if (nextCharJoins(layoutData->string, pos))
ellipsisText.prepend(QChar(0x200d) /* ZWJ */);
- return layoutData->string.mid(from, pos - from) + ellipsisText;
+ return stringMidRetainingBidiCC(layoutData->string,
+ QString(), ellipsisText,
+ from, to,
+ from, pos - from);
} else if (mode == Qt::ElideLeft) {
QFixed currentWidth;
int pos;
@@ -2449,7 +2499,10 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
if (prevCharJoins(layoutData->string, pos))
ellipsisText.append(QChar(0x200d) /* ZWJ */);
- return ellipsisText + layoutData->string.mid(pos, to - pos);
+ return stringMidRetainingBidiCC(layoutData->string,
+ ellipsisText, QString(),
+ from, to,
+ pos, to - pos);
} else if (mode == Qt::ElideMiddle) {
QFixed leftWidth;
QFixed rightWidth;
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index bec574bb83..94af3edeeb 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2288,7 +2288,13 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
iterator.getSelectionBounds(&x, &width);
if (glyphLayout.numGlyphs > 0) {
- QFontEngine *mainFontEngine = eng->fontEngine(si);
+ QFontEngine *mainFontEngine;
+#ifndef QT_NO_RAWFONT
+ if (eng->useRawFont && eng->rawFont.isValid())
+ mainFontEngine= eng->fontEngine(si);
+ else
+#endif
+ mainFontEngine = font.d->engineForScript(si.analysis.script);
if (mainFontEngine->type() == QFontEngine::Multi) {
QFontEngineMulti *multiFontEngine = static_cast<QFontEngineMulti *>(mainFontEngine);
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 1491c1efbc..e9ff5e8b59 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -416,7 +416,9 @@ public:
void QZipPrivate::fillFileInfo(int index, QZipReader::FileInfo &fileInfo) const
{
FileHeader header = fileHeaders.at(index);
- fileInfo.filePath = QString::fromLocal8Bit(header.file_name);
+ // if bit 11 is set, the filename and comment fields must be encoded using UTF-8
+ const bool inUtf8 = (readUShort(header.h.general_purpose_bits) & 0x0800) != 0;
+ fileInfo.filePath = inUtf8 ? QString::fromUtf8(header.file_name) : QString::fromLocal8Bit(header.file_name);
const quint32 mode = (qFromLittleEndian<quint32>(&header.h.external_file_attributes[0]) >> 16) & 0xFFFF;
fileInfo.isDir = S_ISDIR(mode);
fileInfo.isFile = S_ISREG(mode);
@@ -629,7 +631,12 @@ void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const
crc_32 = ::crc32(crc_32, (const uchar *)contents.constData(), contents.length());
writeUInt(header.h.crc_32, crc_32);
- header.file_name = fileName.toLocal8Bit();
+ // if bit 11 is set, the filename and comment fields must be encoded using UTF-8
+ ushort general_purpose_bits = 0x0800; // always use utf-8
+ writeUShort(header.h.general_purpose_bits, general_purpose_bits);
+
+ const bool inUtf8 = (general_purpose_bits & 0x0800) != 0;
+ header.file_name = inUtf8 ? fileName.toUtf8() : fileName.toLocal8Bit();
if (header.file_name.size() > 0xffff) {
qWarning("QZip: Filename too long, chopping it to 65535 characters");
header.file_name = header.file_name.left(0xffff);
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index 26aecadcf4..a941c06031 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -284,14 +284,14 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme)
Use QStandardPaths::displayName()
*/
+extern Q_CORE_EXPORT QString qt_applicationName_noFallback();
-QString QDesktopServices::storageLocationImpl(StandardLocation type)
+QString QDesktopServices::storageLocationImpl(QStandardPaths::StandardLocation type)
{
- if (type == DataLocation) {
+ if (type == QStandardPaths::DataLocation) {
// 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)
@@ -307,7 +307,7 @@ QString QDesktopServices::storageLocationImpl(StandardLocation type)
+ compatAppName;
#endif
}
- return QStandardPaths::writableLocation(static_cast<QStandardPaths::StandardLocation>(type));
+ return QStandardPaths::writableLocation(type);
}
QT_END_NAMESPACE
diff --git a/src/gui/util/qdesktopservices.h b/src/gui/util/qdesktopservices.h
index 280acaf277..e116cf1123 100644
--- a/src/gui/util/qdesktopservices.h
+++ b/src/gui/util/qdesktopservices.h
@@ -64,6 +64,7 @@ public:
static void unsetUrlHandler(const QString &scheme);
#if QT_DEPRECATED_SINCE(5, 0)
+ //Must match QStandardPaths::StandardLocation
QT_DEPRECATED enum StandardLocation {
DesktopLocation,
DocumentsLocation,
@@ -79,14 +80,14 @@ public:
};
QT_DEPRECATED static QString storageLocation(StandardLocation type) {
- return storageLocationImpl(type);
+ return storageLocationImpl(static_cast<QStandardPaths::StandardLocation>(type));
}
QT_DEPRECATED static QString displayName(StandardLocation type) {
return QStandardPaths::displayName(static_cast<QStandardPaths::StandardLocation>(type));
}
#endif
private:
- static QString storageLocationImpl(StandardLocation type);
+ static QString storageLocationImpl(QStandardPaths::StandardLocation type);
};
#endif // QT_NO_DESKTOPSERVICES
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index ce16785d1d..3103cc7424 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -400,7 +400,7 @@ static qlonglong pow10(int exp)
QValidator::State QIntValidator::validate(QString & input, int&) const
{
QByteArray buff;
- if (!locale().d()->validateChars(input, QLocalePrivate::IntegerMode, &buff)) {
+ if (!locale().d->validateChars(input, QLocalePrivate::IntegerMode, &buff)) {
return Invalid;
}
@@ -439,7 +439,7 @@ QValidator::State QIntValidator::validate(QString & input, int&) const
void QIntValidator::fixup(QString &input) const
{
QByteArray buff;
- if (!locale().d()->validateChars(input, QLocalePrivate::IntegerMode, &buff)) {
+ if (!locale().d->validateChars(input, QLocalePrivate::IntegerMode, &buff)) {
return;
}
bool ok, overflow;
@@ -655,7 +655,7 @@ QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QL
{
Q_Q(const QDoubleValidator);
QByteArray buff;
- if (!locale.d()->validateChars(input, numMode, &buff, q->dec))
+ if (!locale.d->validateChars(input, numMode, &buff, q->dec))
return QValidator::Invalid;
if (buff.isEmpty())
@@ -871,10 +871,11 @@ QRegExpValidator::~QRegExpValidator()
QValidator::State QRegExpValidator::validate(QString &input, int& pos) const
{
- if (r.exactMatch(input)) {
+ QRegExp copy = r;
+ if (copy.exactMatch(input)) {
return Acceptable;
} else {
- if (const_cast<QRegExp &>(r).matchedLength() == input.size()) {
+ if (copy.matchedLength() == input.size()) {
return Intermediate;
} else {
pos = input.size();