summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/doc/qtcore.qdocconf7
-rw-r--r--src/corelib/doc/src/custom-types.qdoc22
-rw-r--r--src/corelib/io/qfsfileengine_p.h2
-rw-r--r--src/corelib/io/qloggingregistry.cpp8
-rw-r--r--src/corelib/io/qprocess_win.cpp2
-rw-r--r--src/corelib/io/qsettings.cpp8
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp4
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp8
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h2
-rw-r--r--src/corelib/kernel/qjni.cpp65
-rw-r--r--src/corelib/tools/qdatetime.cpp2
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/gui/opengl/opengl.pri1
-rw-r--r--src/gui/opengl/qopenglpaintdevice.cpp31
-rw-r--r--src/gui/opengl/qopenglpaintdevice.h2
-rw-r--r--src/gui/opengl/qopenglpaintdevice_p.h81
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp5
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp241
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h5
-rw-r--r--src/platformsupport/linuxaccessibility/application.cpp4
-rw-r--r--src/plugins/platforms/android/androidjniaccessibility.cpp28
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm6
-rw-r--r--src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp1
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp51
-rw-r--r--src/testlib/qbenchmarkvalgrind.cpp24
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp8
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp99
-rw-r--r--src/widgets/kernel/qwidget_p.h2
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm155
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h8
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp3
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp3
33 files changed, 581 insertions, 315 deletions
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf
index 7c879cbbfd..5a14ba9088 100644
--- a/src/corelib/doc/qtcore.qdocconf
+++ b/src/corelib/doc/qtcore.qdocconf
@@ -4,7 +4,7 @@ project = QtCore
description = Qt Core Reference Documentation
version = $QT_VERSION
-examplesinstallpath = core
+examplesinstallpath = corelib
qhp.projects = QtCore
@@ -35,10 +35,7 @@ sourcedirs += ..
exampledirs += \
../ \
snippets \
- ../../../examples/threads/ \
- ../../../examples/tools/ \
- ../../../examples/ipc/ \
- ../../../examples/json/ \
+ ../../../examples/corelib \
../../../examples/network/dnslookup
imagedirs += images
diff --git a/src/corelib/doc/src/custom-types.qdoc b/src/corelib/doc/src/custom-types.qdoc
index bac4a90829..81ce698735 100644
--- a/src/corelib/doc/src/custom-types.qdoc
+++ b/src/corelib/doc/src/custom-types.qdoc
@@ -61,7 +61,7 @@
The following \c Message class definition includes these members:
- \snippet customtype/message.h custom type definition
+ \snippet tools/customtype/message.h custom type definition
The class also provides a constructor for normal use and two public member functions
that are used to obtain the private data.
@@ -77,7 +77,7 @@
to this class, we invoke the Q_DECLARE_METATYPE() macro on the class in the header
file where it is defined:
- \snippet customtype/message.h custom type meta-type declaration
+ \snippet tools/customtype/message.h custom type meta-type declaration
This now makes it possible for \c Message values to be stored in QVariant objects
and retrieved later. See the \l{Custom Type Example} for code that demonstrates
@@ -104,19 +104,19 @@
The \l{Queued Custom Type Example} declares a \c Block class which is registered
in the \c{main.cpp} file:
- \snippet queuedcustomtype/main.cpp main start
+ \snippet threads/queuedcustomtype/main.cpp main start
\dots
- \snippet queuedcustomtype/main.cpp register meta-type for queued communications
+ \snippet threads/queuedcustomtype/main.cpp register meta-type for queued communications
\dots
- \snippet queuedcustomtype/main.cpp main finish
+ \snippet threads/queuedcustomtype/main.cpp main finish
This type is later used in a signal-slot connection in the \c{window.cpp} file:
- \snippet queuedcustomtype/window.cpp Window constructor start
+ \snippet threads/queuedcustomtype/window.cpp Window constructor start
\dots
- \snippet queuedcustomtype/window.cpp connecting signal with custom type
+ \snippet threads/queuedcustomtype/window.cpp connecting signal with custom type
\dots
- \snippet queuedcustomtype/window.cpp Window constructor finish
+ \snippet threads/queuedcustomtype/window.cpp Window constructor finish
If a type is used in a queued connection without being registered, a warning will be
printed at the console; for example:
@@ -131,18 +131,18 @@
It is often quite useful to make a custom type printable for debugging purposes,
as in the following code:
- \snippet customtype/main.cpp printing a custom type
+ \snippet tools/customtype/main.cpp printing a custom type
This is achieved by creating a streaming operator for the type, which is often
defined in the header file for that type:
- \snippet customtype/message.h custom type streaming operator
+ \snippet tools/customtype/message.h custom type streaming operator
The implementation for the \c Message type in the \l{Custom Type Example}
goes to some effort to make the printable representation as readable as
possible:
- \snippet customtype/message.cpp custom type streaming operator
+ \snippet tools/customtype/message.cpp custom type streaming operator
The output sent to the debug stream can, of course, be made as simple or as
complicated as you like. Note that the value returned by this function is
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index 5d5a29243e..3963a9cb11 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
class QFSFileEnginePrivate;
-class Q_AUTOTEST_EXPORT QFSFileEngine : public QAbstractFileEngine
+class Q_CORE_EXPORT QFSFileEngine : public QAbstractFileEngine
{
Q_DECLARE_PRIVATE(QFSFileEngine)
public:
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index e9ee8d9458..8af1487834 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -398,9 +398,11 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
// hard-wired implementation of
// qt.*.debug=false
// qt.debug=false
- char c;
- if (!memcmp(cat->categoryName(), "qt", 2) && (!(c = cat->categoryName()[2]) || c == '.'))
- debug = false;
+ if (const char *categoryName = cat->categoryName()) {
+ // == "qt" or startsWith("qt.")
+ if (strcmp(categoryName, "qt") == 0 || strncmp(categoryName, "qt.", 3) == 0)
+ debug = false;
+ }
QString categoryName = QLatin1String(cat->categoryName());
foreach (const QLoggingRule &item, reg->rules) {
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 980fb58865..ee6b7e13f4 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -634,7 +634,7 @@ bool QProcessPrivate::drainOutputPipes()
someReadyReadEmitted |= readyReadEmitted;
if (!readOperationActive || !readyReadEmitted)
break;
- Sleep(100);
+ QThread::yieldCurrentThread();
}
return someReadyReadEmitted;
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index fd35ae33dc..d896da176a 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -3121,6 +3121,10 @@ bool QSettings::isWritable() const
void QSettings::setValue(const QString &key, const QVariant &value)
{
Q_D(QSettings);
+ if (key.isEmpty()) {
+ qWarning("QSettings::setValue: Empty key passed");
+ return;
+ }
QString k = d->actualKey(key);
d->set(k, value);
d->requestUpdate();
@@ -3253,6 +3257,10 @@ bool QSettings::event(QEvent *event)
QVariant QSettings::value(const QString &key, const QVariant &defaultValue) const
{
Q_D(const QSettings);
+ if (key.isEmpty()) {
+ qWarning("QSettings::value: Empty key passed");
+ return QVariant();
+ }
QVariant result = defaultValue;
QString k = d->actualKey(key);
d->get(k, &result);
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 68ab03976f..74a7ea1988 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -3375,7 +3375,7 @@ Qt::ItemFlags QAbstractTableModel::flags(const QModelIndex &index) const
QAbstractItemModel, it is not suitable for use with tree views; you will
need to subclass QAbstractItemModel if you want to provide a model for
that purpose. If you need to use a number of list models to manage data,
- it may be more appropriate to subclass QAbstractTableModel class instead.
+ it may be more appropriate to subclass QAbstractTableModel instead.
Simple models can be created by subclassing this class and implementing
the minimum number of required functions. For example, we could implement
@@ -3399,7 +3399,7 @@ Qt::ItemFlags QAbstractTableModel::flags(const QModelIndex &index) const
default ones provided by the roleNames() function, you must override it.
For editable list models, you must also provide an implementation of
- setData(), implement the flags() function so that it returns a value
+ setData(), and implement the flags() function so that it returns a value
containing \l{Qt::ItemFlags}{Qt::ItemIsEditable}.
Note that QAbstractListModel provides a default implementation of
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 7816edd3f9..a3d00faf31 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -639,7 +639,6 @@ void QEventDispatcherWin32::createInternalHwnd()
{
Q_D(QEventDispatcherWin32);
- Q_ASSERT(!d->internalHwnd);
if (d->internalHwnd)
return;
d->internalHwnd = qt_create_internal_window(this);
@@ -664,9 +663,6 @@ void QEventDispatcherWin32::createInternalHwnd()
// start all normal timers
for (int i = 0; i < d->timerVec.count(); ++i)
d->registerTimer(d->timerVec.at(i));
-
- // trigger a call to sendPostedEvents()
- wakeUp();
}
QEventDispatcherWin32::QEventDispatcherWin32(QObject *parent)
@@ -686,8 +682,10 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
{
Q_D(QEventDispatcherWin32);
- if (!d->internalHwnd)
+ if (!d->internalHwnd) {
createInternalHwnd();
+ wakeUp(); // trigger a call to sendPostedEvents()
+ }
d->interrupt = false;
emit awake();
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index f9bb06a5c5..369c276615 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -65,8 +65,8 @@ class Q_CORE_EXPORT QEventDispatcherWin32 : public QAbstractEventDispatcher
Q_OBJECT
Q_DECLARE_PRIVATE(QEventDispatcherWin32)
+protected:
void createInternalHwnd();
- friend class QGuiEventDispatcherWin32;
public:
explicit QEventDispatcherWin32(QObject *parent = 0);
diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp
index 173127b063..452e3464d6 100644
--- a/src/corelib/kernel/qjni.cpp
+++ b/src/corelib/kernel/qjni.cpp
@@ -80,38 +80,22 @@ static QString toDotEncodedClassName(const char *className)
return QString::fromLatin1(className).replace(QLatin1Char('/'), QLatin1Char('.'));
}
-static jclass getCachedClass(const QString &classDotEnc)
+static jclass getCachedClass(const QString &classDotEnc, bool *isCached = 0)
{
QHash<QString, jclass>::iterator it = cachedClasses->find(classDotEnc);
+ const bool found = (it != cachedClasses->end());
- if (it == cachedClasses->end())
- return 0;
-
- return it.value();
-}
-
-static jclass findClass(const char *className, JNIEnv *env)
-{
- const QString &classDotEnc = toDotEncodedClassName(className);
- jclass clazz = getCachedClass(classDotEnc);
- if (clazz != 0)
- return clazz;
-
- jclass fclazz = env->FindClass(className);
- if (!exceptionCheckAndClear(env)) {
- clazz = static_cast<jclass>(env->NewGlobalRef(fclazz));
- env->DeleteLocalRef(fclazz);
- }
+ if (isCached != 0)
+ *isCached = found;
- cachedClasses->insert(classDotEnc, clazz);
- return clazz;
+ return found ? it.value() : 0;
}
-static jclass loadClass(const char *className, JNIEnv *env)
+static jclass loadClassDotEnc(const QString &classDotEnc, JNIEnv *env)
{
- const QString &classDotEnc = toDotEncodedClassName(className);
- jclass clazz = getCachedClass(classDotEnc);
- if (clazz != 0)
+ bool isCached = false;
+ jclass clazz = getCachedClass(classDotEnc, &isCached);
+ if (clazz != 0 || isCached)
return clazz;
QJNIObjectPrivate classLoader = QtAndroidPrivate::classLoader();
@@ -130,6 +114,11 @@ static jclass loadClass(const char *className, JNIEnv *env)
return clazz;
}
+inline static jclass loadClass(const char *className, JNIEnv *env)
+{
+ return loadClassDotEnc(toDotEncodedClassName(className), env);
+}
+
typedef QHash<QString, jmethodID> JMethodIDHash;
Q_GLOBAL_STATIC(JMethodIDHash, cachedMethodID)
@@ -224,12 +213,28 @@ JNIEnv *QJNIEnvironmentPrivate::operator->()
jclass QJNIEnvironmentPrivate::findClass(const char *className, JNIEnv *env)
{
- jclass clazz = 0;
- if (env != 0)
- clazz = ::findClass(className, env);
+ const QString &classDotEnc = toDotEncodedClassName(className);
+ bool isCached = false;
+ jclass clazz = getCachedClass(classDotEnc, &isCached);
+
+ const bool found = (clazz != 0) || (clazz == 0 && isCached);
+
+ if (found)
+ return clazz;
+
+ if (env != 0) { // We got an env. pointer (We expect this to be the right env. and call FindClass())
+ jclass fclazz = env->FindClass(className);
+ if (!exceptionCheckAndClear(env)) {
+ clazz = static_cast<jclass>(env->NewGlobalRef(fclazz));
+ env->DeleteLocalRef(fclazz);
+ }
+
+ if (clazz != 0)
+ cachedClasses->insert(classDotEnc, clazz);
+ }
- if (clazz == 0)
- clazz = loadClass(className, QJNIEnvironmentPrivate());
+ if (clazz == 0) // We didn't get an env. pointer or we got one with the WRONG class loader...
+ clazz = loadClassDotEnc(classDotEnc, QJNIEnvironmentPrivate());
return clazz;
}
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 75f2a93e45..f0f6a56755 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -4419,7 +4419,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
if (size == 10)
return QDateTime(date);
- isoString = isoString.right(11);
+ isoString = isoString.right(isoString.length() - 11);
int offset = 0;
// Check end of string for Time Zone definition, either Z for UTC or [+-]HH:MM for Offset
if (isoString.endsWith(QLatin1Char('Z'))) {
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index b805ec792e..48f251e3f4 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -9020,7 +9020,7 @@ QStringRef QStringRef::right(int n) const
{
if (uint(n) >= uint(m_size))
return *this;
- return QStringRef(m_string, n + m_position, m_size - n);
+ return QStringRef(m_string, m_size - n + m_position, n);
}
/*!
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri
index f82401c973..adf5428c49 100644
--- a/src/gui/opengl/opengl.pri
+++ b/src/gui/opengl/opengl.pri
@@ -11,6 +11,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopenglframebufferobject.h \
opengl/qopenglframebufferobject_p.h \
opengl/qopenglpaintdevice.h \
+ opengl/qopenglpaintdevice_p.h \
opengl/qopenglbuffer.h \
opengl/qopenglshaderprogram.h \
opengl/qopenglextensions_p.h \
diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp
index 59bca6efdf..e908fd8e91 100644
--- a/src/gui/opengl/qopenglpaintdevice.cpp
+++ b/src/gui/opengl/qopenglpaintdevice.cpp
@@ -35,6 +35,7 @@
#include <qpaintengine.h>
#include <qthreadstorage.h>
+#include <private/qopenglpaintdevice_p.h>
#include <private/qobject_p.h>
#include <private/qopenglcontext_p.h>
#include <private/qopenglframebufferobject_p.h>
@@ -98,23 +99,6 @@ QT_BEGIN_NAMESPACE
*/
-class QOpenGLPaintDevicePrivate
-{
-public:
- QOpenGLPaintDevicePrivate(const QSize &size);
-
- QSize size;
- QOpenGLContext *ctx;
-
- qreal dpmx;
- qreal dpmy;
- qreal devicePixelRatio;
-
- bool flipped;
-
- QPaintEngine *engine;
-};
-
/*!
Constructs a QOpenGLPaintDevice.
@@ -152,6 +136,14 @@ QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height)
}
/*!
+ \internal
+ */
+QOpenGLPaintDevice::QOpenGLPaintDevice(QOpenGLPaintDevicePrivate *dd)
+ : d_ptr(dd)
+{
+}
+
+/*!
Destroys the QOpenGLPaintDevice.
*/
@@ -355,7 +347,10 @@ bool QOpenGLPaintDevice::paintFlipped() const
frame buffer object or context when different QOpenGLPaintDevice instances
are issuing draw calls alternately.
- QPainter::beginNativePainting will also trigger this method.
+ \l{QPainter::beginNativePainting()}{beginNativePainting()} will also trigger
+ this method.
+
+ The default implementation does nothing.
*/
void QOpenGLPaintDevice::ensureActiveTarget()
{
diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h
index e1be9b525d..dda3bfe43f 100644
--- a/src/gui/opengl/qopenglpaintdevice.h
+++ b/src/gui/opengl/qopenglpaintdevice.h
@@ -44,7 +44,6 @@
QT_BEGIN_NAMESPACE
-
class QOpenGLPaintDevicePrivate;
class Q_GUI_EXPORT QOpenGLPaintDevice : public QPaintDevice
@@ -54,6 +53,7 @@ public:
QOpenGLPaintDevice();
explicit QOpenGLPaintDevice(const QSize &size);
QOpenGLPaintDevice(int width, int height);
+ QOpenGLPaintDevice(QOpenGLPaintDevicePrivate *dd);
virtual ~QOpenGLPaintDevice();
int devType() const { return QInternal::OpenGL; }
diff --git a/src/gui/opengl/qopenglpaintdevice_p.h b/src/gui/opengl/qopenglpaintdevice_p.h
new file mode 100644
index 0000000000..0b01129a84
--- /dev/null
+++ b/src/gui/opengl/qopenglpaintdevice_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QOPENGL_PAINTDEVICE_P_H
+#define QOPENGL_PAINTDEVICE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the Qt OpenGL classes. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qopenglpaintdevice.h>
+
+QT_BEGIN_NAMESPACE
+
+class QOpenGLContext;
+class QPaintEngine;
+
+class Q_GUI_EXPORT QOpenGLPaintDevicePrivate
+{
+public:
+ QOpenGLPaintDevicePrivate(const QSize &size);
+ virtual ~QOpenGLPaintDevicePrivate() { }
+
+ static QOpenGLPaintDevicePrivate *get(QOpenGLPaintDevice *dev) { return dev->d_func(); }
+
+ virtual void beginPaint() { }
+ virtual void endPaint() { }
+
+public:
+ QSize size;
+ QOpenGLContext *ctx;
+
+ qreal dpmx;
+ qreal dpmy;
+ qreal devicePixelRatio;
+
+ bool flipped;
+
+ QPaintEngine *engine;
+};
+
+QT_END_NAMESPACE
+
+#endif // QOPENGL_PAINTDEVICE_P_H
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index 21bc4a95e8..c490726359 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -59,6 +59,7 @@
#include "qopenglgradientcache_p.h"
#include "qopengltexturecache_p.h"
#include "qopenglpaintengine_p.h"
+#include "qopenglpaintdevice_p.h"
#include <string.h> //for memcpy
#include <qmath.h>
@@ -1994,6 +1995,8 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->ctx = QOpenGLContext::currentContext();
d->ctx->d_func()->active_engine = this;
+ QOpenGLPaintDevicePrivate::get(d->device)->beginPaint();
+
d->funcs.initializeOpenGLFunctions();
for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
@@ -2044,6 +2047,8 @@ bool QOpenGL2PaintEngineEx::end()
{
Q_D(QOpenGL2PaintEngineEx);
+ QOpenGLPaintDevicePrivate::get(d->device)->endPaint();
+
QOpenGLContext *ctx = d->ctx;
d->funcs.glUseProgram(0);
d->transferMode(BrushDrawingMode);
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 62dc9a9c6b..2b9883eb36 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -587,92 +587,18 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
{
if (!usrPtr)
return 0;
- QFontDef fontDef = f;
- QFontEngineFT *engine;
FontFile *fontfile = static_cast<FontFile *> (usrPtr);
QFontEngine::FaceId fid;
fid.filename = QFile::encodeName(fontfile->fileName);
fid.index = fontfile->indexValue;
- bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias);
- bool forcedAntialiasSetting = !antialias;
- engine = new QFontEngineFT(fontDef);
-
- const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services();
- bool useXftConf = (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY"));
- if (useXftConf) {
- void *antialiasResource =
- QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled",
- QGuiApplication::primaryScreen());
- int antialiasingEnabled = int(reinterpret_cast<qintptr>(antialiasResource));
- if (antialiasingEnabled > 0) {
- antialias = antialiasingEnabled - 1;
- forcedAntialiasSetting = true;
- }
- }
+ QFontEngineFT *engine = new QFontEngineFT(f);
+ engine->face_id = fid;
- QFontEngine::GlyphFormat format;
- // try and get the pattern
- FcPattern *pattern = FcPatternCreate();
+ setupFontEngine(engine, f);
- FcValue value;
- value.type = FcTypeString;
- QByteArray cs = fontDef.family.toUtf8();
- value.u.s = (const FcChar8 *)cs.data();
- FcPatternAdd(pattern,FC_FAMILY,value,true);
-
- value.u.s = (const FcChar8 *)fid.filename.data();
- FcPatternAdd(pattern,FC_FILE,value,true);
-
- value.type = FcTypeInteger;
- value.u.i = fid.index;
- FcPatternAdd(pattern,FC_INDEX,value,true);
-
- FcResult result;
-
- FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
-
- FcPattern *match = FcFontMatch(0, pattern, &result);
- if (match) {
- engine->setDefaultHintStyle(defaultHintStyleFromMatch((QFont::HintingPreference)f.hintingPreference, match, useXftConf));
-
- FcBool fc_autohint;
- if (FcPatternGetBool(match, FC_AUTOHINT,0, &fc_autohint) == FcResultMatch)
- engine->forceAutoHint = fc_autohint;
-
-#if defined(FT_LCD_FILTER_H)
- int lcdFilter;
- if (FcPatternGetInteger(match, FC_LCD_FILTER, 0, &lcdFilter) == FcResultMatch)
- engine->lcdFilterType = lcdFilter;
-#endif
-
- if (!forcedAntialiasSetting) {
- FcBool fc_antialias;
- if (FcPatternGetBool(match, FC_ANTIALIAS,0, &fc_antialias) == FcResultMatch)
- antialias = fc_antialias;
- }
-
- if (antialias) {
- QFontEngine::SubpixelAntialiasingType subpixelType = QFontEngine::Subpixel_None;
- if (!(f.styleStrategy & QFont::NoSubpixelAntialias))
- subpixelType = subpixelTypeFromMatch(match, useXftConf);
- engine->subpixelType = subpixelType;
-
- format = (subpixelType == QFontEngine::Subpixel_None)
- ? QFontEngine::Format_A8
- : QFontEngine::Format_A32;
- } else
- format = QFontEngine::Format_Mono;
-
- FcPatternDestroy(match);
- } else
- format = antialias ? QFontEngine::Format_A8 : QFontEngine::Format_Mono;
-
- FcPatternDestroy(pattern);
-
- if (!engine->init(fid, antialias, format) || engine->invalid()) {
+ if (!engine->init(fid, engine->antialias, engine->defaultFormat) || engine->invalid()) {
delete engine;
engine = 0;
}
@@ -686,74 +612,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal p
if (engine == 0)
return 0;
- QFontDef fontDef = engine->fontDef;
-
- bool forcedAntialiasSetting = false;
- const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services();
- bool useXftConf = (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY"));
- if (useXftConf) {
- void *antialiasResource =
- QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled",
- QGuiApplication::primaryScreen());
- int antialiasingEnabled = int(reinterpret_cast<qintptr>(antialiasResource));
- if (antialiasingEnabled > 0) {
- engine->antialias = antialiasingEnabled - 1;
- forcedAntialiasSetting = true;
- }
- }
-
- QFontEngine::GlyphFormat format;
- // try and get the pattern
- FcPattern *pattern = FcPatternCreate();
-
- FcValue value;
- value.type = FcTypeString;
- QByteArray cs = fontDef.family.toUtf8();
- value.u.s = (const FcChar8 *)cs.data();
- FcPatternAdd(pattern,FC_FAMILY,value,true);
-
- FcResult result;
-
- FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
-
- FcPattern *match = FcFontMatch(0, pattern, &result);
- if (match) {
- engine->setDefaultHintStyle(defaultHintStyleFromMatch(hintingPreference, match, useXftConf));
-
- FcBool fc_autohint;
- if (FcPatternGetBool(match, FC_AUTOHINT,0, &fc_autohint) == FcResultMatch)
- engine->forceAutoHint = fc_autohint;
-
-#if defined(FT_LCD_FILTER_H)
- int lcdFilter;
- if (FcPatternGetInteger(match, FC_LCD_FILTER, 0, &lcdFilter) == FcResultMatch)
- engine->lcdFilterType = lcdFilter;
-#endif
-
- if (!forcedAntialiasSetting) {
- FcBool fc_antialias;
- if (FcPatternGetBool(match, FC_ANTIALIAS,0, &fc_antialias) == FcResultMatch)
- engine->antialias = fc_antialias;
- }
-
- if (engine->antialias) {
- QFontEngine::SubpixelAntialiasingType subpixelType = subpixelTypeFromMatch(match, useXftConf);
- engine->subpixelType = subpixelType;
-
- format = subpixelType == QFontEngine::Subpixel_None
- ? QFontEngine::Format_A8
- : QFontEngine::Format_A32;
- } else
- format = QFontEngine::Format_Mono;
- FcPatternDestroy(match);
- } else
- format = QFontEngine::Format_A8;
-
- FcPatternDestroy(pattern);
-
- engine->defaultFormat = format;
- engine->glyphFormat = format;
+ setupFontEngine(engine, engine->fontDef);
return engine;
}
@@ -947,4 +806,94 @@ QFont QFontconfigDatabase::defaultFont() const
return QFont(resolved);
}
+void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef &fontDef) const
+{
+ bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias);
+ bool forcedAntialiasSetting = !antialias;
+
+ const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services();
+ bool useXftConf = (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY"));
+ if (useXftConf) {
+ void *antialiasResource =
+ QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled",
+ QGuiApplication::primaryScreen());
+ int antialiasingEnabled = int(reinterpret_cast<qintptr>(antialiasResource));
+ if (antialiasingEnabled > 0) {
+ antialias = antialiasingEnabled - 1;
+ forcedAntialiasSetting = true;
+ }
+ }
+
+ QFontEngine::GlyphFormat format;
+ // try and get the pattern
+ FcPattern *pattern = FcPatternCreate();
+
+ FcValue value;
+ value.type = FcTypeString;
+ QByteArray cs = fontDef.family.toUtf8();
+ value.u.s = (const FcChar8 *)cs.data();
+ FcPatternAdd(pattern,FC_FAMILY,value,true);
+
+ QFontEngine::FaceId fid = engine->faceId();
+
+ if (!fid.filename.isEmpty()) {
+ value.u.s = (const FcChar8 *)fid.filename.data();
+ FcPatternAdd(pattern,FC_FILE,value,true);
+
+ value.type = FcTypeInteger;
+ value.u.i = fid.index;
+ FcPatternAdd(pattern,FC_INDEX,value,true);
+ }
+
+ if (fontDef.pixelSize > 0.1)
+ FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontDef.pixelSize);
+
+ FcResult result;
+
+ FcConfigSubstitute(0, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
+
+ FcPattern *match = FcFontMatch(0, pattern, &result);
+ if (match) {
+ engine->setDefaultHintStyle(defaultHintStyleFromMatch((QFont::HintingPreference)fontDef.hintingPreference, match, useXftConf));
+
+ FcBool fc_autohint;
+ if (FcPatternGetBool(match, FC_AUTOHINT,0, &fc_autohint) == FcResultMatch)
+ engine->forceAutoHint = fc_autohint;
+
+#if defined(FT_LCD_FILTER_H)
+ int lcdFilter;
+ if (FcPatternGetInteger(match, FC_LCD_FILTER, 0, &lcdFilter) == FcResultMatch)
+ engine->lcdFilterType = lcdFilter;
+#endif
+
+ if (!forcedAntialiasSetting) {
+ FcBool fc_antialias;
+ if (FcPatternGetBool(match, FC_ANTIALIAS,0, &fc_antialias) == FcResultMatch)
+ antialias = fc_antialias;
+ }
+
+ if (antialias) {
+ QFontEngine::SubpixelAntialiasingType subpixelType = QFontEngine::Subpixel_None;
+ if (!(fontDef.styleStrategy & QFont::NoSubpixelAntialias))
+ subpixelType = subpixelTypeFromMatch(match, useXftConf);
+ engine->subpixelType = subpixelType;
+
+ format = (subpixelType == QFontEngine::Subpixel_None)
+ ? QFontEngine::Format_A8
+ : QFontEngine::Format_A32;
+ } else
+ format = QFontEngine::Format_Mono;
+
+ FcPatternDestroy(match);
+ } else
+ format = antialias ? QFontEngine::Format_A8 : QFontEngine::Format_Mono;
+
+ FcPatternDestroy(pattern);
+
+ engine->antialias = antialias;
+ engine->defaultFormat = format;
+ engine->glyphFormat = format;
+}
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
index 91ecb52e7b..745d12b825 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
@@ -50,6 +50,8 @@
QT_BEGIN_NAMESPACE
+class QFontEngineFT;
+
class QFontconfigDatabase : public QBasicFontDatabase
{
public:
@@ -61,6 +63,9 @@ public:
QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName);
QString resolveFontFamilyAlias(const QString &family) const;
QFont defaultFont() const;
+
+private:
+ void setupFontEngine(QFontEngineFT *engine, const QFontDef &fontDef) const;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/linuxaccessibility/application.cpp b/src/platformsupport/linuxaccessibility/application.cpp
index dcf17143fa..2ee6b0a203 100644
--- a/src/platformsupport/linuxaccessibility/application.cpp
+++ b/src/platformsupport/linuxaccessibility/application.cpp
@@ -196,7 +196,9 @@ bool QSpiApplicationAdaptor::eventFilter(QObject *target, QEvent *event)
QKeyEvent* QSpiApplicationAdaptor::copyKeyEvent(QKeyEvent* old)
{
- return new QKeyEvent(old->type(), old->key(), old->modifiers(), old->text(), old->isAutoRepeat(), old->count());
+ return new QKeyEvent(old->type(), old->key(), old->modifiers(),
+ old->nativeScanCode(), old->nativeVirtualKey(), old->nativeModifiers(),
+ old->text(), old->isAutoRepeat(), old->count());
}
void QSpiApplicationAdaptor::notifyKeyboardListenerCallback(const QDBusMessage& message)
diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp
index 7229fd7af5..5c927da9c5 100644
--- a/src/plugins/platforms/android/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/androidjniaccessibility.cpp
@@ -187,18 +187,30 @@ if (!clazz) { \
//__android_log_print(ANDROID_LOG_FATAL, m_qtTag, m_methodErrorMsg, METHOD_NAME, METHOD_SIGNATURE);
- static jstring descriptionForAccessibleObject(JNIEnv *env, jobject /*thiz*/, jint objectId)
+
+ static jstring descriptionForAccessibleObject_helper(JNIEnv *env, QAccessibleInterface *iface)
{
QString desc;
- QAccessibleInterface *iface = interfaceFromId(objectId);
if (iface && iface->isValid()) {
desc = iface->text(QAccessible::Name);
if (desc.isEmpty())
desc = iface->text(QAccessible::Description);
+ if (desc.isEmpty()) {
+ desc = iface->text(QAccessible::Value);
+ if (desc.isEmpty()) {
+ if (QAccessibleValueInterface *valueIface = iface->valueInterface()) {
+ desc= valueIface->currentValue().toString();
+ }
+ }
+ }
}
+ return env->NewString((jchar*) desc.constData(), (jsize) desc.size());
+ }
- jstring jdesc = env->NewString((jchar*) desc.constData(), (jsize) desc.size());
- return jdesc;
+ static jstring descriptionForAccessibleObject(JNIEnv *env, jobject /*thiz*/, jint objectId)
+ {
+ QAccessibleInterface *iface = interfaceFromId(objectId);
+ return descriptionForAccessibleObject_helper(env, iface);
}
static bool populateNode(JNIEnv *env, jobject /*thiz*/, jint objectId, jobject node)
@@ -216,11 +228,8 @@ if (!clazz) { \
const bool hasDecreaseAction = actions.contains(QAccessibleActionInterface::decreaseAction());
// try to fill in the text property, this is what the screen reader reads
- QString desc = iface->text(QAccessible::Value);
- if (desc.isEmpty())
- desc = iface->text(QAccessible::Name);
- if (desc.isEmpty())
- desc = iface->text(QAccessible::Description);
+ jstring jdesc = descriptionForAccessibleObject_helper(env, iface);
+
if (QAccessibleTextInterface *textIface = iface->textInterface()) {
if (m_setTextSelectionMethodID && textIface->selectionCount() > 0) {
int startSelection;
@@ -252,7 +261,6 @@ if (!clazz) { \
env->CallVoidMethod(node, m_addActionMethodID, (int)8192); // ACTION_SCROLL_BACKWARD defined in AccessibilityNodeInfo
- jstring jdesc = env->NewString((jchar*) desc.constData(), (jsize) desc.size());
//CALL_METHOD(node, "setText", "(Ljava/lang/CharSequence;)V", jdesc)
env->CallVoidMethod(node, m_setContentDescriptionMethodID, jdesc);
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 10a92667c1..06680228bc 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -420,12 +420,10 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
#pragma clang diagnostic ignored "-Wobjc-method-access"
enum { NSWindowOcclusionStateVisible = 1UL << 1 };
#endif
- // Older versions managed in -[QNSView viewDidMoveToWindow].
- // Support QWidgetAction in NSMenu. Mavericks only sends this notification.
- // Ideally we should support this in Qt as well, in order to disable animations
- // when the window is occluded.
if ((NSUInteger)[self.window occlusionState] & NSWindowOcclusionStateVisible)
m_platformWindow->exposeWindow();
+ else
+ m_platformWindow->obscureWindow();
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
#pragma clang diagnostic pop
#endif
diff --git a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp
index 73988b6db5..593b5eac7a 100644
--- a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp
+++ b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp
@@ -62,6 +62,7 @@ QWindowsGuiEventDispatcher::QWindowsGuiEventDispatcher(QObject *parent) :
QEventDispatcherWin32(parent), m_flags(0)
{
setObjectName(QStringLiteral("QWindowsGuiEventDispatcher"));
+ createInternalHwnd(); // QTBUG-40881: Do not delay registering timers, etc. for QtMfc.
}
bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index d7267c740b..fc3443aba5 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -841,8 +841,8 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const
xkb_layout_index_t baseLayout = xkb_state_serialize_layout(xkb_state, XKB_STATE_LAYOUT_DEPRESSED);
xkb_layout_index_t latchedLayout = xkb_state_serialize_layout(xkb_state, XKB_STATE_LAYOUT_LATCHED);
xkb_layout_index_t lockedLayout = xkb_state_serialize_layout(xkb_state, XKB_STATE_LAYOUT_LOCKED);
- xkb_mod_index_t latchedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);
- xkb_mod_index_t lockedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);
+ xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);
+ xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);
xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods,
baseLayout, latchedLayout, lockedLayout);
@@ -907,7 +907,7 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const
Qt::KeyboardModifiers mods = modifiers & ~neededMods;
qtKey = keysymToQtKey(sym, mods, lookupString(kb_state, event->nativeScanCode()));
- if (qtKey == baseQtKey)
+ if (qtKey == baseQtKey || qtKey == 0)
continue;
result += (qtKey + mods);
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index c4cf3b4416..0c2e9d047c 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -251,6 +251,27 @@ QXcbWindow::QXcbWindow(QWindow *window)
m_window = window->winId();
}
+#ifdef Q_COMPILER_CLASS_ENUM
+enum : quint32 {
+#else
+enum {
+#endif
+ baseEventMask
+ = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY
+ | XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_FOCUS_CHANGE,
+
+ defaultEventMask = baseEventMask
+ | XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE
+ | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE
+ | XCB_EVENT_MASK_BUTTON_MOTION | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW
+ | XCB_EVENT_MASK_POINTER_MOTION,
+
+ transparentForInputEventMask = baseEventMask
+ | XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_RESIZE_REDIRECT
+ | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT
+ | XCB_EVENT_MASK_COLOR_MAP_CHANGE | XCB_EVENT_MASK_OWNER_GRAB_BUTTON
+};
+
void QXcbWindow::create()
{
destroy();
@@ -285,18 +306,7 @@ void QXcbWindow::create()
// XCB_CW_SAVE_UNDER
type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer,
// XCB_CW_EVENT_MASK
- XCB_EVENT_MASK_EXPOSURE
- | XCB_EVENT_MASK_STRUCTURE_NOTIFY
- | XCB_EVENT_MASK_KEY_PRESS
- | XCB_EVENT_MASK_KEY_RELEASE
- | XCB_EVENT_MASK_BUTTON_PRESS
- | XCB_EVENT_MASK_BUTTON_RELEASE
- | XCB_EVENT_MASK_BUTTON_MOTION
- | XCB_EVENT_MASK_ENTER_WINDOW
- | XCB_EVENT_MASK_LEAVE_WINDOW
- | XCB_EVENT_MASK_POINTER_MOTION
- | XCB_EVENT_MASK_PROPERTY_CHANGE
- | XCB_EVENT_MASK_FOCUS_CHANGE
+ defaultEventMask
};
// Parameters to XCreateWindow() are frame corner + inner size.
@@ -985,14 +995,15 @@ void QXcbWindow::setWindowFlags(Qt::WindowFlags flags)
if (type == Qt::Popup)
flags |= Qt::X11BypassWindowManagerHint;
- if (flags & Qt::WindowTransparentForInput) {
- uint32_t mask = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_VISIBILITY_CHANGE
- | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_RESIZE_REDIRECT
- | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT
- | XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE
- | XCB_EVENT_MASK_COLOR_MAP_CHANGE | XCB_EVENT_MASK_OWNER_GRAB_BUTTON;
- xcb_change_window_attributes(xcb_connection(), xcb_window(), XCB_CW_EVENT_MASK, &mask);
- }
+ const quint32 mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
+ const quint32 values[] = {
+ // XCB_CW_OVERRIDE_REDIRECT
+ (flags & Qt::BypassWindowManagerHint) ? 1u : 0,
+ // XCB_CW_EVENT_MASK
+ (flags & Qt::WindowTransparentForInput) ? transparentForInputEventMask : defaultEventMask
+ };
+
+ xcb_change_window_attributes(xcb_connection(), xcb_window(), mask, values);
setNetWmWindowFlags(flags);
setMotifWindowFlags(flags);
diff --git a/src/testlib/qbenchmarkvalgrind.cpp b/src/testlib/qbenchmarkvalgrind.cpp
index c480753675..f107645ab5 100644
--- a/src/testlib/qbenchmarkvalgrind.cpp
+++ b/src/testlib/qbenchmarkvalgrind.cpp
@@ -45,33 +45,15 @@
QT_BEGIN_NAMESPACE
-// Returns \c true iff a sufficiently recent valgrind is available.
+// Returns \c true if valgrind is available.
bool QBenchmarkValgrindUtils::haveValgrind()
{
#ifdef NVALGRIND
return false;
#else
QProcess process;
- QStringList args;
- args << QLatin1String("--version");
- process.start(QLatin1String("valgrind"), args);
- if (!process.waitForFinished(-1))
- return false;
- const QByteArray out = process.readAllStandardOutput();
- QRegExp rx(QLatin1String("^valgrind-([0-9]+).([0-9]+).[0-9]+"));
- if (rx.indexIn(QLatin1String(out.data())) == -1)
- return false;
- bool ok;
- const int major = rx.cap(1).toInt(&ok);
- if (!ok)
- return false;
- const int minor = rx.cap(2).toInt(&ok);
- if (!ok)
- return false;
-// return (major > 3 || (major == 3 && minor >= 3)); // v >= 3.3 for --callgrind-out-file option
- Q_UNUSED(major);
- Q_UNUSED(minor);
- return true; // skip version restriction for now
+ process.start(QLatin1String("valgrind"), QStringList(QLatin1String("--version")));
+ return process.waitForStarted() && process.waitForFinished(-1);
#endif
}
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index fff78b1cbc..36dd05bb92 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -1253,11 +1253,11 @@ void QDocDatabase::findAllSince(InnerNode* node)
nsmap.value().insert(name,(*child));
}
}
- // Recursively find child nodes with since commands.
- if ((*child)->isInnerNode()) {
- findAllSince(static_cast<InnerNode *>(*child));
- }
}
+ // Recursively find child nodes with since commands.
+ if ((*child)->isInnerNode())
+ findAllSince(static_cast<InnerNode *>(*child));
+
++child;
}
}
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 7782c4c1d4..8a4e0c8ffd 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -45,6 +45,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qopenglextensions_p.h>
#include <QtGui/private/qfont_p.h>
+#include <QtGui/private/qopenglpaintdevice_p.h>
#include <QtWidgets/private/qwidget_p.h>
QT_BEGIN_NAMESPACE
@@ -239,6 +240,28 @@ QT_BEGIN_NAMESPACE
\note Avoid calling winId() on a QOpenGLWidget. This function triggers the creation of
a native window, resulting in reduced performance and possibly rendering glitches.
+ \section1 Differences to QGLWidget
+
+ Besides the main conceptual difference of being backed by a framebuffer object, there
+ are a number of smaller, internal differences between QOpenGLWidget and the older
+ QGLWidget:
+
+ \list
+
+ \li OpenGL state when invoking paintGL(). QOpenGLWidget sets up the viewport via
+ glViewport(). It does not perform any clearing.
+
+ \li Clearing when starting to paint via QPainter. Unlike regular widgets, QGLWidget
+ defaulted to a value of \c true for
+ \l{QWidget::autoFillBackground()}{autoFillBackground}. It then performed clearing to the
+ palette's background color every time QPainter::begin() was used. QOpenGLWidget does not
+ follow this: \l{QWidget::autoFillBackground()}{autoFillBackground} defaults to false,
+ like for any other widget. The only exception is when being used as a viewport for other
+ widgets like QGraphicsView. In such a case autoFillBackground will be automatically set
+ to true to ensure compatibility with QGLWidget-based viewports.
+
+ \endlist
+
\section1 Multisampling
To enable multisampling, set the number of requested samples on the
@@ -432,16 +455,26 @@ QT_BEGIN_NAMESPACE
due to resizing the widget.
*/
-class QOpenGLWidgetPaintDevice : public QOpenGLPaintDevice
+class QOpenGLWidgetPaintDevicePrivate : public QOpenGLPaintDevicePrivate
{
public:
- QOpenGLWidgetPaintDevice(QOpenGLWidget *widget) : w(widget) { }
- void ensureActiveTarget() Q_DECL_OVERRIDE;
+ QOpenGLWidgetPaintDevicePrivate(QOpenGLWidget *widget)
+ : QOpenGLPaintDevicePrivate(QSize()),
+ w(widget) { }
+
+ void beginPaint() Q_DECL_OVERRIDE;
-private:
QOpenGLWidget *w;
};
+class QOpenGLWidgetPaintDevice : public QOpenGLPaintDevice
+{
+public:
+ QOpenGLWidgetPaintDevice(QOpenGLWidget *widget)
+ : QOpenGLPaintDevice(new QOpenGLWidgetPaintDevicePrivate(widget)) { }
+ void ensureActiveTarget() Q_DECL_OVERRIDE;
+};
+
class QOpenGLWidgetPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QOpenGLWidget)
@@ -454,7 +487,8 @@ public:
initialized(false),
fakeHidden(false),
paintDevice(0),
- inBackingStorePaint(false)
+ inBackingStorePaint(false),
+ flushPending(false)
{
requestedFormat = QSurfaceFormat::defaultFormat();
}
@@ -478,6 +512,7 @@ public:
void endBackingStorePainting() Q_DECL_OVERRIDE { inBackingStorePaint = false; }
void beginCompose() Q_DECL_OVERRIDE;
void endCompose() Q_DECL_OVERRIDE;
+ void initializeViewportFramebuffer() Q_DECL_OVERRIDE;
void resizeViewportFramebuffer() Q_DECL_OVERRIDE;
void resolveSamples() Q_DECL_OVERRIDE;
@@ -490,18 +525,44 @@ public:
QOpenGLPaintDevice *paintDevice;
bool inBackingStorePaint;
QSurfaceFormat requestedFormat;
+ bool flushPending;
};
+void QOpenGLWidgetPaintDevicePrivate::beginPaint()
+{
+ // NB! autoFillBackground is and must be false by default. Otherwise we would clear on
+ // every QPainter begin() which is not desirable. This is only for legacy use cases,
+ // like using QOpenGLWidget as the viewport of a graphics view, that expect clearing
+ // with the palette's background color.
+ if (w->autoFillBackground()) {
+ QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
+ if (w->testAttribute(Qt::WA_TranslucentBackground)) {
+ f->glClearColor(0, 0, 0, 0);
+ } else {
+ QColor c = w->palette().brush(w->backgroundRole()).color();
+ float alpha = c.alphaF();
+ f->glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha);
+ }
+ f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ }
+}
+
void QOpenGLWidgetPaintDevice::ensureActiveTarget()
{
- QOpenGLWidgetPrivate *d = static_cast<QOpenGLWidgetPrivate *>(QWidgetPrivate::get(w));
- if (!d->initialized)
+ QOpenGLWidgetPaintDevicePrivate *d = static_cast<QOpenGLWidgetPaintDevicePrivate *>(d_ptr.data());
+ QOpenGLWidgetPrivate *wd = static_cast<QOpenGLWidgetPrivate *>(QWidgetPrivate::get(d->w));
+ if (!wd->initialized)
return;
- if (QOpenGLContext::currentContext() != d->context)
- w->makeCurrent();
+ if (QOpenGLContext::currentContext() != wd->context)
+ d->w->makeCurrent();
else
- d->fbo->bind();
+ wd->fbo->bind();
+
+ // When used as a viewport, drawing is done via opening a QPainter on the widget
+ // without going through paintEvent(). We will have to make sure a glFlush() is done
+ // before the texture is accessed also in this case.
+ wd->flushPending = true;
}
GLuint QOpenGLWidgetPrivate::textureId() const
@@ -572,6 +633,11 @@ void QOpenGLWidgetPrivate::recreateFbo()
void QOpenGLWidgetPrivate::beginCompose()
{
Q_Q(QOpenGLWidget);
+ if (flushPending) {
+ flushPending = false;
+ q->makeCurrent();
+ context->functions()->glFlush();
+ }
emit q->aboutToCompose();
}
@@ -653,9 +719,10 @@ void QOpenGLWidgetPrivate::invokeUserPaint()
{
Q_Q(QOpenGLWidget);
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
- f->glViewport(0, 0, q->width() * q->devicePixelRatio(), q->height() * q->devicePixelRatio());
+ f->glViewport(0, 0, q->width() * q->devicePixelRatio(), q->height() * q->devicePixelRatio());
q->paintGL();
+ f->glFlush();
}
void QOpenGLWidgetPrivate::render()
@@ -667,7 +734,6 @@ void QOpenGLWidgetPrivate::render()
q->makeCurrent();
invokeUserPaint();
- context->functions()->glFlush();
}
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
@@ -686,6 +752,14 @@ QImage QOpenGLWidgetPrivate::grabFramebuffer()
return res;
}
+void QOpenGLWidgetPrivate::initializeViewportFramebuffer()
+{
+ Q_Q(QOpenGLWidget);
+ // Legacy behavior for compatibility with QGLWidget when used as a graphics view
+ // viewport: enable clearing on each painter begin.
+ q->setAutoFillBackground(true);
+}
+
void QOpenGLWidgetPrivate::resizeViewportFramebuffer()
{
Q_Q(QOpenGLWidget);
@@ -929,7 +1003,6 @@ void QOpenGLWidget::resizeEvent(QResizeEvent *e)
d->recreateFbo();
resizeGL(width(), height());
d->invokeUserPaint();
- d->context->functions()->glFlush();
d->resolveSamples();
}
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index e80447c477..bbdbabc14b 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -641,6 +641,8 @@ public:
}
}
static void sendComposeStatus(QWidget *w, bool end);
+ // Called on setViewport().
+ virtual void initializeViewportFramebuffer() { }
// When using a QOpenGLWidget as viewport with QAbstractScrollArea, resize events are
// filtered away from the widget. This is fine for QGLWidget but bad for QOpenGLWidget
// since the fbo must be resized. We need an alternative way to notify.
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 33e1134848..620ba660e0 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1661,10 +1661,34 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti
tdi->kind = kThemeSmallSlider;
break;
}
+
+ bool usePlainKnob = slider->tickPosition == QSlider::NoTicks
+ || slider->tickPosition == QSlider::TicksBothSides;
+
tdi->bounds = qt_hirectForQRect(slider->rect);
- tdi->min = slider->minimum;
- tdi->max = slider->maximum;
- tdi->value = slider->sliderPosition;
+ if (isScrollbar || QSysInfo::MacintoshVersion <= QSysInfo::MV_10_9) {
+ tdi->min = slider->minimum;
+ tdi->max = slider->maximum;
+ tdi->value = slider->sliderPosition;
+ } else {
+ // Fix min and max positions. HITheme seems confused when it comes to rendering
+ // a slider at those positions. We give it a hand by extending and offsetting
+ // the slider range accordingly. See also comment for CC_Slider in drawComplexControl()
+ tdi->min = 0;
+ if (slider->orientation == Qt::Horizontal)
+ tdi->max = 10 * slider->rect.width();
+ else
+ tdi->max = 10 * slider->rect.height();
+
+ if (usePlainKnob || slider->orientation == Qt::Horizontal) {
+ int endsCorrection = usePlainKnob ? 25 : 10;
+ tdi->value = (tdi->max + 2 * endsCorrection) * (slider->sliderPosition - slider->minimum)
+ / (slider->maximum - slider->minimum) - endsCorrection;
+ } else {
+ tdi->value = (tdi->max + 30) * (slider->sliderPosition - slider->minimum)
+ / (slider->maximum - slider->minimum) - 20;
+ }
+ }
tdi->attributes = kThemeTrackShowThumb;
if (slider->upsideDown)
tdi->attributes |= kThemeTrackRightToLeft;
@@ -1681,7 +1705,7 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti
// Tiger broke reverse scroll bars so put them back and "fake it"
if (isScrollbar && (tdi->attributes & kThemeTrackRightToLeft)) {
tdi->attributes &= ~kThemeTrackRightToLeft;
- tdi->value = tdi->max - slider->sliderPosition;
+ tdi->value = tdi->max - tdi->value;
}
tdi->enableState = (slider->state & QStyle::State_Enabled) ? kThemeTrackActive
@@ -1689,7 +1713,7 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti
if (!isScrollbar) {
if (slider->state & QStyle::QStyle::State_HasFocus)
tdi->attributes |= kThemeTrackHasFocus;
- if (slider->tickPosition == QSlider::NoTicks || slider->tickPosition == QSlider::TicksBothSides)
+ if (usePlainKnob)
tdi->trackInfo.slider.thumbDir = kThemeThumbPlain;
else if (slider->tickPosition == QSlider::TicksAbove)
tdi->trackInfo.slider.thumbDir = kThemeThumbUpward;
@@ -1816,6 +1840,12 @@ NSView *QMacStylePrivate::cocoaControl(QCocoaWidget widget, QPoint *offset) cons
bv = [[NSPopUpButton alloc] init];
else if (widget.first == QCocoaComboBox)
bv = [[NSComboBox alloc] init];
+ else if (widget.first == QCocoaHorizontalSlider)
+ bv = [[NSSlider alloc] init];
+ else if (widget.first == QCocoaVerticalSlider)
+ // Cocoa sets the orientation from the view's frame
+ // at construction time, and it cannot be changed later.
+ bv = [[NSSlider alloc] initWithFrame:NSMakeRect(0, 0, 10, 100)];
else
bv = [[NSButton alloc] init];
@@ -1900,7 +1930,7 @@ NSView *QMacStylePrivate::cocoaControl(QCocoaWidget widget, QPoint *offset) cons
return bv;
}
-void QMacStylePrivate::drawNSViewInRect(NSView *view, const QRect &qtRect, QPainter *p) const
+void QMacStylePrivate::drawNSViewInRect(NSView *view, const QRect &qtRect, QPainter *p, QCocoaDrawRectBlock drawRectBlock) const
{
QMacCGContext ctx(p);
CGContextSaveGState(ctx);
@@ -1913,7 +1943,10 @@ void QMacStylePrivate::drawNSViewInRect(NSView *view, const QRect &qtRect, QPain
[backingStoreNSView addSubview:view];
view.frame = rect;
- [view drawRect:rect];
+ if (drawRectBlock)
+ drawRectBlock(rect, (CGContextRef)ctx);
+ else
+ [view drawRect:rect];
[view removeFromSuperviewWithoutNeedingDisplay];
[NSGraphicsContext restoreGraphicsState];
@@ -5337,6 +5370,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
// because on Tiger I only "fake" the reverse stuff.
bool reverseHorizontal = (slider->direction == Qt::RightToLeft
&& slider->orientation == Qt::Horizontal);
+
if ((reverseHorizontal
&& slider->activeSubControls == SC_ScrollBarAddLine)
|| (!reverseHorizontal
@@ -5387,6 +5421,9 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
tdi.attributes |= kThemeTrackHideTrack;
}
+ const bool usingYosemiteOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_9;
+ const bool isHorizontal = slider->orientation == Qt::Horizontal;
+
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if (cc == CC_ScrollBar && proxy()->styleHint(SH_ScrollBar_Transient, opt, widget)) {
bool wasActive = false;
@@ -5471,8 +5508,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
}
}
- const bool isHorizontal = slider->orientation == Qt::Horizontal;
-
CGContextSaveGState(cg);
[NSGraphicsContext saveGraphicsState];
@@ -5557,9 +5592,86 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
{
d->stopAnimation(opt->styleObject);
- HIThemeDrawTrack(&tdi, tracking ? 0 : &macRect, cg,
- kHIThemeOrientationNormal);
+ if (usingYosemiteOrLater && cc == CC_Slider) {
+ // Fix min and max positions. (See also getSliderInfo()
+ // for the slider values adjustments.)
+ // HITheme seems to have forgotten how to render
+ // a slide at those positions, leaving a gap between
+ // the knob and the ends of the track.
+ // We fix this by rendering the track first, and then
+ // the knob on top. However, in order to not clip the
+ // knob, we reduce the the drawing rect for the track.
+ HIRect bounds = tdi.bounds;
+ if (isHorizontal) {
+ tdi.bounds.size.width -= 2;
+ tdi.bounds.origin.x += 1;
+ if (tdi.trackInfo.slider.thumbDir == kThemeThumbDownward)
+ tdi.bounds.origin.y -= 2;
+ else if (tdi.trackInfo.slider.thumbDir == kThemeThumbUpward)
+ tdi.bounds.origin.y += 3;
+ } else {
+ tdi.bounds.size.height -= 2;
+ tdi.bounds.origin.y += 1;
+ if (tdi.trackInfo.slider.thumbDir == kThemeThumbDownward) // pointing right
+ tdi.bounds.origin.x -= 4;
+ else if (tdi.trackInfo.slider.thumbDir == kThemeThumbUpward) // pointing left
+ tdi.bounds.origin.x += 2;
+ }
+
+ // Yosemite demands its blue progress track when no tickmarks are present
+ if (!(slider->subControls & SC_SliderTickmarks)) {
+ QCocoaWidgetKind sliderKind = slider->orientation == Qt::Horizontal ? QCocoaHorizontalSlider : QCocoaVerticalSlider;
+ NSSlider *sl = (NSSlider *)d->cocoaControl(QCocoaWidget(sliderKind, QAquaSizeLarge), 0);
+ sl.minValue = slider->minimum;
+ sl.maxValue = slider->maximum;
+ sl.intValue = slider->sliderValue;
+ sl.enabled = slider->state & QStyle::State_Enabled;
+ d->drawNSViewInRect(sl, opt->rect, p, ^(NSRect rect, CGContextRef ctx) {
+ if (slider->upsideDown) {
+ if (isHorizontal) {
+ CGContextTranslateCTM(ctx, rect.size.width, 0);
+ CGContextScaleCTM(ctx, -1, 1);
+ }
+ } else if (!isHorizontal) {
+ CGContextTranslateCTM(ctx, 0, rect.size.height);
+ CGContextScaleCTM(ctx, 1, -1);
+ }
+ [sl.cell drawBarInside:tdi.bounds flipped:NO];
+ // No need to restore the CTM later, the context has been saved
+ // and will be restored at the end of drawNSViewInRect()
+ });
+ tdi.attributes |= kThemeTrackHideTrack;
+ } else {
+ tdi.attributes &= ~(kThemeTrackShowThumb | kThemeTrackHasFocus);
+ HIThemeDrawTrack(&tdi, tracking ? 0 : &macRect, cg,
+ kHIThemeOrientationNormal);
+ tdi.attributes |= kThemeTrackHideTrack | kThemeTrackShowThumb;
+ }
+
+ tdi.bounds = bounds;
+ }
+
if (cc == CC_Slider && slider->subControls & SC_SliderTickmarks) {
+
+ HIRect bounds;
+ if (usingYosemiteOrLater) {
+ // As part of fixing the min and max positions,
+ // we need to adjust the tickmarks as well
+ bounds = tdi.bounds;
+ if (slider->orientation == Qt::Horizontal) {
+ tdi.bounds.size.width += 2;
+ tdi.bounds.origin.x -= 1;
+ if (tdi.trackInfo.slider.thumbDir == kThemeThumbUpward)
+ tdi.bounds.origin.y -= 2;
+ } else {
+ tdi.bounds.size.height += 3;
+ tdi.bounds.origin.y -= 3;
+ tdi.bounds.origin.y += 1;
+ if (tdi.trackInfo.slider.thumbDir == kThemeThumbUpward) // pointing left
+ tdi.bounds.origin.x -= 2;
+ }
+ }
+
if (qt_mac_is_metal(widget)) {
if (tdi.enableState == kThemeTrackInactive)
tdi.enableState = kThemeTrackActive; // Looks more Cocoa-like
@@ -5581,16 +5693,37 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
cg,
kHIThemeOrientationNormal);
tdi.trackInfo.slider.thumbDir = kThemeThumbUpward;
+ if (usingYosemiteOrLater) {
+ if (slider->orientation == Qt::Vertical)
+ tdi.bounds.origin.x -= 2;
+ }
HIThemeDrawTrackTickMarks(&tdi, numMarks,
cg,
kHIThemeOrientationNormal);
+ // Reset to plain thumb to be drawn further down
+ tdi.trackInfo.slider.thumbDir = kThemeThumbPlain;
} else {
HIThemeDrawTrackTickMarks(&tdi, numMarks,
cg,
kHIThemeOrientationNormal);
+ }
+
+ if (usingYosemiteOrLater)
+ tdi.bounds = bounds;
+ }
+ if (usingYosemiteOrLater && cc == CC_Slider) {
+ // Still as part of fixing the min and max positions,
+ // we also adjust the knob position. We can do this
+ // because it's rendered separately from the track.
+ if (slider->orientation == Qt::Vertical) {
+ if (tdi.trackInfo.slider.thumbDir == kThemeThumbDownward) // pointing right
+ tdi.bounds.origin.x -= 2;
}
}
+
+ HIThemeDrawTrack(&tdi, tracking ? 0 : &macRect, cg,
+ kHIThemeOrientationNormal);
}
}
break;
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index 7685da1f52..080f944ef8 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -128,11 +128,15 @@ enum QCocoaWidgetKind {
QCocoaPopupButton, // Non-editable QComboBox
QCocoaPullDownButton, // QPushButton with menu
QCocoaPushButton,
- QCocoaRadioButton
+ QCocoaRadioButton,
+ QCocoaHorizontalSlider,
+ QCocoaVerticalSlider
};
typedef QPair<QCocoaWidgetKind, QAquaWidgetSize> QCocoaWidget;
+typedef void (^QCocoaDrawRectBlock)(NSRect, CGContextRef);
+
#define SIZE(large, small, mini) \
(controlSize == QAquaSizeLarge ? (large) : controlSize == QAquaSizeSmall ? (small) : (mini))
@@ -202,7 +206,7 @@ public:
NSView *cocoaControl(QCocoaWidget widget, QPoint *offset) const;
- void drawNSViewInRect(NSView *view, const QRect &rect, QPainter *p) const;
+ void drawNSViewInRect(NSView *view, const QRect &rect, QPainter *p, QCocoaDrawRectBlock drawRectBlock = nil) const;
void resolveCurrentNSView(QWindow *window);
public:
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index 3b75591998..4cafeafcec 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -609,6 +609,9 @@ void QAbstractScrollArea::setViewport(QWidget *widget)
#endif
#endif
d->layoutChildren();
+#ifndef QT_NO_OPENGL
+ QWidgetPrivate::get(d->viewport)->initializeViewportFramebuffer();
+#endif
if (isVisible())
d->viewport->show();
setupViewport(widget);
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 3d3f42605e..bb3f2d74a8 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -636,6 +636,9 @@ void QToolButton::setMenu(QMenu* menu)
{
Q_D(QToolButton);
+ if (d->menuAction == (menu ? menu->menuAction() : 0))
+ return;
+
if (d->menuAction)
removeAction(d->menuAction);