summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/forkfd/forkfd.c10
-rw-r--r--src/3rdparty/md5/md5.cpp2
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java30
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtLayout.java8
-rw-r--r--src/corelib/arch/qatomic_cxx11.h6
-rw-r--r--src/corelib/codecs/qutfcodec.cpp12
-rw-r--r--src/corelib/global/qcompilerdetection.h5
-rw-r--r--src/corelib/global/qglobal.cpp6
-rw-r--r--src/corelib/io/qbuffer.cpp2
-rw-r--r--src/corelib/io/qdebug.cpp146
-rw-r--r--src/corelib/io/qdebug.h14
-rw-r--r--src/corelib/io/qfsfileengine.cpp4
-rw-r--r--src/corelib/io/qloggingregistry.cpp8
-rw-r--r--src/corelib/io/qprocess.cpp12
-rw-r--r--src/corelib/io/qresource.cpp6
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp8
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp23
-rw-r--r--src/corelib/kernel/qmetatype.cpp13
-rw-r--r--src/corelib/kernel/qobject.cpp9
-rw-r--r--src/corelib/kernel/qtranslator.cpp2
-rw-r--r--src/corelib/plugin/qlibrary_p.h2
-rw-r--r--src/corelib/plugin/qplugin.h4
-rw-r--r--src/corelib/plugin/quuid.cpp2
-rw-r--r--src/corelib/thread/qreadwritelock.cpp57
-rw-r--r--src/corelib/thread/qreadwritelock_p.h1
-rw-r--r--src/corelib/tools/qbytearray.cpp8
-rw-r--r--src/corelib/tools/qcollator.cpp2
-rw-r--r--src/corelib/tools/qpair.qdoc5
-rw-r--r--src/corelib/tools/qsimd.cpp18
-rw-r--r--src/corelib/tools/qsimd_p.h3
-rw-r--r--src/corelib/tools/qstring.cpp30
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp19
-rw-r--r--src/corelib/xml/qxmlstream.cpp6
-rw-r--r--src/dbus/qdbusunixfiledescriptor.cpp2
-rw-r--r--src/gui/accessible/qaccessible.cpp132
-rw-r--r--src/gui/image/qgifhandler.pri1
-rw-r--r--src/gui/image/qicon.cpp7
-rw-r--r--src/gui/image/qimage.cpp9
-rw-r--r--src/gui/image/qjpeghandler.pri1
-rw-r--r--src/gui/image/qpixmapcache.cpp14
-rw-r--r--src/gui/image/qpnghandler.pri1
-rw-r--r--src/gui/kernel/qevent.cpp56
-rw-r--r--src/gui/kernel/qguiapplication.cpp10
-rw-r--r--src/gui/kernel/qsessionmanager.cpp2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp16
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h2
-rw-r--r--src/gui/math3d/qgenericmatrix.cpp6
-rw-r--r--src/gui/opengl/qopengldebug.cpp6
-rw-r--r--src/gui/opengl/qopengltexture.cpp5
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp10
-rw-r--r--src/gui/painting/qbackingstore.cpp14
-rw-r--r--src/gui/painting/qbrush.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/painting/qpdf.cpp8
-rw-r--r--src/gui/text/qfontdatabase.cpp85
-rw-r--r--src/gui/text/qfontengine.cpp14
-rw-r--r--src/gui/text/qfontmetrics.cpp5
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp14
-rw-r--r--src/gui/text/qtextdocument.cpp3
-rw-r--r--src/network/ssl/qasn1element_p.h2
-rw-r--r--src/network/ssl/qsslcertificate_qt.cpp4
-rw-r--r--src/network/ssl/qsslkey_qt.cpp67
-rw-r--r--src/network/ssl/qsslsocket.cpp1
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp9
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp3
-rw-r--r--src/opengl/qgl.cpp7
-rw-r--r--src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc1
-rw-r--r--src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp40
-rw-r--r--src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h3
-rw-r--r--src/plugins/imageformats/gif/gif.pro1
-rw-r--r--src/plugins/imageformats/jpeg/jpeg.pro1
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp5
-rw-r--r--src/plugins/platforms/android/qandroidplatformfontdatabase.cpp35
-rw-r--r--src/plugins/platforms/android/qandroidplatformfontdatabase.h3
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm8
-rw-r--r--src/plugins/platforms/ios/qioscontext.h12
-rw-r--r--src/plugins/platforms/ios/qiosfileengineassetslibrary.mm2
-rw-r--r--src/plugins/platforms/ios/qiosintegration.h26
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm2
-rw-r--r--src/plugins/platforms/ios/qiosmenu.h2
-rw-r--r--src/plugins/platforms/ios/qiosscreen.h20
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm2
-rw-r--r--src/plugins/platforms/ios/qiostheme.h4
-rw-r--r--src/plugins/platforms/ios/qioswindow.h24
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp37
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp26
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.h1
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsinternalmimedata.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp24
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.h3
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeinterface.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp1
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp64
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp33
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp2
-rw-r--r--src/printsupport/kernel/qprinter.cpp10
-rw-r--r--src/testlib/testlib.pro11
-rw-r--r--src/tools/qdoc/generator.cpp4
-rw-r--r--src/tools/qdoc/helpprojectwriter.cpp8
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp2
-rw-r--r--src/tools/qlalr/lalr.cpp8
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp15
-rw-r--r--src/widgets/kernel/qaction.cpp11
-rw-r--r--src/widgets/kernel/qwidget.cpp49
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp4
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp1
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.mm5
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp7
118 files changed, 1160 insertions, 407 deletions
diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c
index 39eeb6a202..e942db2717 100644
--- a/src/3rdparty/forkfd/forkfd.c
+++ b/src/3rdparty/forkfd/forkfd.c
@@ -44,11 +44,13 @@
#ifdef __linux__
# define HAVE_WAIT4 1
-# if (defined(__GLIBC__) && (__GLIBC__ << 16) + __GLIBC_MINOR__ >= 0x207) || defined(__BIONIC__)
+# if defined(__BIONIC__) || (defined(__GLIBC__) && (__GLIBC__ << 8) + __GLIBC_MINOR__ >= 0x207 && \
+ (!defined(__UCLIBC__) || ((__UCLIBC_MAJOR__ << 16) + (__UCLIBC_MINOR__ << 8) + __UCLIBC_SUBLEVEL__ > 0x921)))
# include <sys/eventfd.h>
# define HAVE_EVENTFD 1
# endif
-# if (defined(__GLIBC__) && (__GLIBC__ << 16) + __GLIBC_MINOR__ >= 0x209) || defined(__BIONIC__)
+# if defined(__BIONIC__) || (defined(__GLIBC__) && (__GLIBC__ << 8) + __GLIBC_MINOR__ >= 0x209 && \
+ (!defined(__UCLIBC__) || ((__UCLIBC_MAJOR__ << 16) + (__UCLIBC_MINOR__ << 8) + __UCLIBC_SUBLEVEL__ > 0x921)))
# define HAVE_PIPE2 1
# endif
#endif
@@ -56,6 +58,10 @@
#if _POSIX_VERSION-0 >= 200809L || _XOPEN_VERSION-0 >= 500
# define HAVE_WAITID 1
#endif
+
+#if defined(__FreeBSD__)
+# define HAVE_PIPE2 1
+#endif
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) || \
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
# define HAVE_WAIT4 1
diff --git a/src/3rdparty/md5/md5.cpp b/src/3rdparty/md5/md5.cpp
index cc69b56213..f9e04a93e3 100644
--- a/src/3rdparty/md5/md5.cpp
+++ b/src/3rdparty/md5/md5.cpp
@@ -36,7 +36,7 @@ static void
byteSwap(UWORD32 *buf, unsigned words)
{
const quint32 byteOrderTest = 0x1;
- if (((char *)&byteOrderTest)[0] == 0) {
+ if (((const char *)&byteOrderTest)[0] == 0) {
md5byte *p = (md5byte *)buf;
do {
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index f4d2645e9a..ba3ecfecd6 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -760,12 +760,6 @@ public class QtActivityDelegate
if (null == m_surfaces)
onCreate(null);
- String nativeLibraryDir = QtNativeLibrariesDir.nativeLibrariesDir(m_activity);
- QtNative.startApplication(m_applicationParameters,
- m_environmentVariables,
- m_mainLib,
- nativeLibraryDir);
- m_started = true;
return true;
} catch (Exception e) {
e.printStackTrace();
@@ -781,14 +775,26 @@ public class QtActivityDelegate
public void onCreate(Bundle savedInstanceState)
{
m_quitApp = true;
+ Runnable startApplication = null;
if (null == savedInstanceState) {
- DisplayMetrics metrics = new DisplayMetrics();
- m_activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
- QtNative.setApplicationDisplayMetrics(metrics.widthPixels, metrics.heightPixels,
- 0, 0,
- metrics.xdpi, metrics.ydpi, metrics.scaledDensity);
+ startApplication = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ String nativeLibraryDir = QtNativeLibrariesDir.nativeLibrariesDir(m_activity);
+ QtNative.startApplication(m_applicationParameters,
+ m_environmentVariables,
+ m_mainLib,
+ nativeLibraryDir);
+ m_started = true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ m_activity.finish();
+ }
+ }
+ };
}
- m_layout = new QtLayout(m_activity);
+ m_layout = new QtLayout(m_activity, startApplication);
m_editText = new QtEditText(m_activity, this);
m_imm = (InputMethodManager)m_activity.getSystemService(Context.INPUT_METHOD_SERVICE);
m_surfaces = new HashMap<Integer, QtSurface>();
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java b/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java
index 09fef4a705..4d7ca47dde 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java
@@ -43,9 +43,11 @@ import android.view.ViewGroup;
public class QtLayout extends ViewGroup
{
- public QtLayout(Context context)
+ private Runnable m_startApplicationRunnable;
+ public QtLayout(Context context, Runnable startRunnable)
{
super(context);
+ m_startApplicationRunnable = startRunnable;
}
public QtLayout(Context context, AttributeSet attrs)
@@ -65,6 +67,10 @@ public class QtLayout extends ViewGroup
((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(metrics);
QtNative.setApplicationDisplayMetrics(metrics.widthPixels,
metrics.heightPixels, w, h, metrics.xdpi, metrics.ydpi, metrics.scaledDensity);
+ if (m_startApplicationRunnable != null) {
+ m_startApplicationRunnable.run();
+ m_startApplicationRunnable = null;
+ }
}
@Override
diff --git a/src/corelib/arch/qatomic_cxx11.h b/src/corelib/arch/qatomic_cxx11.h
index 09e900f4ea..0e06ca951a 100644
--- a/src/corelib/arch/qatomic_cxx11.h
+++ b/src/corelib/arch/qatomic_cxx11.h
@@ -328,10 +328,10 @@ template <typename X> struct QAtomicOps
}
};
-#ifdef ATOMIC_VAR_INIT
-# define Q_BASIC_ATOMIC_INITIALIZER(a) { ATOMIC_VAR_INIT(a) }
+#if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS)
+# define Q_BASIC_ATOMIC_INITIALIZER(a) { a }
#else
-# define Q_BASIC_ATOMIC_INITIALIZER(a) { {a} }
+# define Q_BASIC_ATOMIC_INITIALIZER(a) { ATOMIC_VAR_INIT(a) }
#endif
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index 64863cdb05..98d4b2e4e3 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -51,8 +51,8 @@ static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const
{
// do sixteen characters at a time
for ( ; end - src >= 16; src += 16, dst += 16) {
- __m128i data1 = _mm_loadu_si128((__m128i*)src);
- __m128i data2 = _mm_loadu_si128(1+(__m128i*)src);
+ __m128i data1 = _mm_loadu_si128((const __m128i*)src);
+ __m128i data2 = _mm_loadu_si128(1+(const __m128i*)src);
// check if everything is ASCII
@@ -90,7 +90,7 @@ static inline bool simdDecodeAscii(ushort *&dst, const uchar *&nextAscii, const
{
// do sixteen characters at a time
for ( ; end - src >= 16; src += 16, dst += 16) {
- __m128i data = _mm_loadu_si128((__m128i*)src);
+ __m128i data = _mm_loadu_si128((const __m128i*)src);
#ifdef __AVX2__
const int BitSpacing = 2;
@@ -390,7 +390,7 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte
*dst++ = QChar::ReplacementCharacter;
}
- result.truncate(dst - (ushort *)result.unicode());
+ result.truncate(dst - (const ushort *)result.unicode());
if (state) {
state->invalidChars += invalid;
if (headerdone)
@@ -469,7 +469,7 @@ QString QUtf16::convertToUnicode(const char *chars, int len, QTextCodec::Convert
endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BigEndianness : LittleEndianness;
QString result(len, Qt::Uninitialized); // worst case
- QChar *qch = (QChar *)result.unicode();
+ QChar *qch = (QChar *)result.data();
while (len--) {
if (half) {
QChar ch;
@@ -600,7 +600,7 @@ QString QUtf32::convertToUnicode(const char *chars, int len, QTextCodec::Convert
QString result;
result.resize((num + len) >> 2 << 1); // worst case
- QChar *qch = (QChar *)result.unicode();
+ QChar *qch = (QChar *)result.data();
const char *end = chars + len;
while (chars < end) {
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index c582b1f238..4828d8596a 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -572,6 +572,9 @@
# if _MSC_VER < 1900
// ICC disables unicode string support when compatibility mode with MSVC 2013 or lower is active
# undef Q_COMPILER_UNICODE_STRINGS
+// Disable constexpr unless the MS headers have constexpr in all the right places too
+// (like std::numeric_limits<T>::max())
+# undef Q_COMPILER_CONSTEXPR
# endif
# endif
# endif
@@ -1140,7 +1143,7 @@
# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) // GCC directives work in Clang too
# define QT_WARNING_DISABLE_INTEL(number)
# define QT_WARNING_DISABLE_MSVC(number)
-#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 405)
+#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
# define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push)
# define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop)
# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text)
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index f335794fed..37a765b40a 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1178,7 +1178,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\relates <QtGlobal>
Defined on Darwin-based operating systems distributed by Apple, which
- currently includes OS X and iOS, but not the open source version.
+ currently includes OS X and iOS, but not the open source versions of Darwin.
*/
/*!
@@ -1200,7 +1200,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\relates <QtGlobal>
Defined on all supported versions of Windows. That is, if
- \l Q_OS_WIN32, \l Q_OS_WIN64 or \l Q_OS_WINCE is defined.
+ \l Q_OS_WIN32, \l Q_OS_WIN64, \l Q_OS_WINCE or \l Q_OS_WINRT is defined.
*/
/*!
@@ -2046,8 +2046,6 @@ QSysInfo::WinVersion QSysInfo::windowsVersion()
} else if (osver.dwMajorVersion == 10 && osver.dwMinorVersion == 0) {
winver = QSysInfo::WV_WINDOWS10;
} else {
- qWarning("Qt: Untested Windows version %d.%d detected!",
- int(osver.dwMajorVersion), int(osver.dwMinorVersion));
winver = QSysInfo::WV_NT_based;
}
}
diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp
index 680f832909..fd74681663 100644
--- a/src/corelib/io/qbuffer.cpp
+++ b/src/corelib/io/qbuffer.cpp
@@ -425,7 +425,7 @@ qint64 QBuffer::writeData(const char *data, qint64 len)
}
}
- memcpy(d->buf->data() + pos(), (uchar *)data, int(len));
+ memcpy(d->buf->data() + pos(), data, int(len));
#ifndef QT_NO_QOBJECT
d->writtenSinceLastEmit += len;
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index 8676fe0259..54a705b72b 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -174,6 +174,16 @@ void QDebug::putUcs4(uint ucs4)
maybeQuote('\'');
}
+// These two functions return true if the character should be printed by QDebug.
+// For QByteArray, this is technically identical to US-ASCII isprint();
+// for QString, we use QChar::isPrint, which requires a full UCS-4 decode.
+static inline bool isPrintable(uint ucs4)
+{ return QChar::isPrint(ucs4); }
+static inline bool isPrintable(ushort uc)
+{ return QChar::isPrint(uc); }
+static inline bool isPrintable(uchar c)
+{ return c >= ' ' && c < 0x7f; }
+
template <typename Char>
static inline void putEscapedString(QTextStreamPrivate *d, const Char *begin, int length, bool isUnicode = true)
{
@@ -194,22 +204,23 @@ static inline void putEscapedString(QTextStreamPrivate *d, const Char *begin, in
}
if (sizeof(Char) == sizeof(QChar)) {
+ // Surrogate characters are category Cs (Other_Surrogate), so isPrintable = false for them
int runLength = 0;
while (p + runLength != end &&
- p[runLength] < 0x7f && p[runLength] >= 0x20 && p[runLength] != '\\' && p[runLength] != '"')
+ isPrintable(p[runLength]) && p[runLength] != '\\' && p[runLength] != '"')
++runLength;
if (runLength) {
d->write(reinterpret_cast<const QChar *>(p), runLength);
p += runLength - 1;
continue;
}
- } else if (*p < 0x7f && *p >= 0x20 && *p != '\\' && *p != '"') {
+ } else if (isPrintable(*p) && *p != '\\' && *p != '"') {
QChar c = QLatin1Char(*p);
d->write(&c, 1);
continue;
}
- // print as an escape sequence
+ // print as an escape sequence (maybe, see below for surrogate pairs)
int buflen = 2;
ushort buf[sizeof "\\U12345678" - 1];
buf[0] = '\\';
@@ -248,17 +259,23 @@ static inline void putEscapedString(QTextStreamPrivate *d, const Char *begin, in
if ((p + 1) != end && QChar::isLowSurrogate(p[1])) {
// properly-paired surrogates
uint ucs4 = QChar::surrogateToUcs4(*p, p[1]);
+ if (isPrintable(ucs4)) {
+ buf[0] = *p;
+ buf[1] = p[1];
+ buflen = 2;
+ } else {
+ buf[1] = 'U';
+ buf[2] = '0'; // toHexUpper(ucs4 >> 32);
+ buf[3] = '0'; // toHexUpper(ucs4 >> 28);
+ buf[4] = toHexUpper(ucs4 >> 20);
+ buf[5] = toHexUpper(ucs4 >> 16);
+ buf[6] = toHexUpper(ucs4 >> 12);
+ buf[7] = toHexUpper(ucs4 >> 8);
+ buf[8] = toHexUpper(ucs4 >> 4);
+ buf[9] = toHexUpper(ucs4);
+ buflen = 10;
+ }
++p;
- buf[1] = 'U';
- buf[2] = '0'; // toHexUpper(ucs4 >> 32);
- buf[3] = '0'; // toHexUpper(ucs4 >> 28);
- buf[4] = toHexUpper(ucs4 >> 20);
- buf[5] = toHexUpper(ucs4 >> 16);
- buf[6] = toHexUpper(ucs4 >> 12);
- buf[7] = toHexUpper(ucs4 >> 8);
- buf[8] = toHexUpper(ucs4 >> 4);
- buf[9] = toHexUpper(ucs4);
- buflen = 10;
break;
}
// improperly-paired surrogates, fall through
@@ -409,6 +426,9 @@ QDebug &QDebug::resetFormat()
Disables automatic insertion of quotation characters around QChar, QString and QByteArray
contents and returns a reference to the stream.
+ When quoting is disabled, these types are printed without quotation
+ characters and without escaping of non-printable characters.
+
\sa quote(), maybeQuote()
*/
@@ -454,7 +474,11 @@ QDebug &QDebug::resetFormat()
\fn QDebug &QDebug::operator<<(QChar t)
Writes the character, \a t, to the stream and returns a reference to the
- stream.
+ stream. Normally, QDebug prints control characters and non-US-ASCII
+ characters as their C escape sequences or their Unicode value (\\u1234). To
+ print non-printable characters without transformation, enable the noquote()
+ functionality, but note that some QDebug backends may not be 8-bit clean
+ and may not be able to represent \c t.
*/
/*!
@@ -545,34 +569,114 @@ QDebug &QDebug::resetFormat()
\fn QDebug &QDebug::operator<<(const char *s)
Writes the '\\0'-terminated string, \a s, to the stream and returns a
- reference to the stream.
+ reference to the stream. The string is never quoted nor transformed to the
+ output, but note that some QDebug backends might not be 8-bit clean.
*/
/*!
\fn QDebug &QDebug::operator<<(const QString &s)
- Writes the string, \a s, to the stream and returns a reference to the stream.
+ Writes the string, \a s, to the stream and returns a reference to the
+ stream. Normally, QDebug prints the string inside quotes and transforms
+ non-printable characters to their Unicode values (\\u1234).
+
+ To print non-printable characters without transformation, enable the
+ noquote() functionality. Note that some QDebug backends might not be 8-bit
+ clean.
+
+ Output examples:
+ \code
+ QString s;
+
+ s = "a";
+ qDebug().noquote() << s; // prints: a
+ qDebug() << s; // prints: "a"
+
+ s = "\"a\r\n\"";
+ qDebug() << s; // prints: "\"a\r\n\""
+
+ s = "\033"; // escape character
+ qDebug() << s; // prints: "\u001B"
+
+ s = "\u00AD"; // SOFT HYPHEN
+ qDebug() << s; // prints: "\u00AD"
+
+ s = "\u00E1"; // LATIN SMALL LETTER A WITH ACUTE
+ qDebug() << s; // prints: "á"
+
+ s = "a\u0301"; // "a" followed by COMBINING ACUTE ACCENT
+ qDebug() << s; // prints: "á";
+
+ s = "\u0430\u0301"; // CYRILLIC SMALL LETTER A followed by COMBINING ACUTE ACCENT
+ qDebug() << s; // prints: "а́"
+ \endcode
*/
/*!
\fn QDebug &QDebug::operator<<(const QStringRef &s)
- Writes the string reference, \a s, to the stream and returns a reference to
- the stream.
+ Writes the string, \a s, to the stream and returns a reference to the
+ stream. Normally, QDebug prints the string inside quotes and transforms
+ non-printable characters to their Unicode values (\\u1234).
+
+ To print non-printable characters without transformation, enable the
+ noquote() functionality. Note that some QDebug backends might not be 8-bit
+ clean.
+
+ See the QString overload for examples.
*/
/*!
\fn QDebug &QDebug::operator<<(QLatin1String s)
- Writes the Latin1-encoded string, \a s, to the stream and returns a reference
- to the stream.
+ Writes the string, \a s, to the stream and returns a reference to the
+ stream. Normally, QDebug prints the string inside quotes and transforms
+ non-printable characters to their Unicode values (\\u1234).
+
+ To print non-printable characters without transformation, enable the
+ noquote() functionality. Note that some QDebug backends might not be 8-bit
+ clean.
+
+ See the QString overload for examples.
*/
/*!
\fn QDebug &QDebug::operator<<(const QByteArray &b)
Writes the byte array, \a b, to the stream and returns a reference to the
- stream.
+ stream. Normally, QDebug prints the array inside quotes and transforms
+ control or non-US-ASCII characters to their C escape sequences (\\xAB). This
+ way, the output is always 7-bit clean and the string can be copied from the
+ output and pasted back into C++ sources, if necessary.
+
+ To print non-printable characters without transformation, enable the
+ noquote() functionality. Note that some QDebug backends might not be 8-bit
+ clean.
+
+ Output examples:
+ \code
+ QByteArray ba;
+
+ ba = "a";
+ qDebug().noquote() << ba; // prints: a
+ qDebug() << ba; // prints: "a"
+
+ ba = "\"a\r\n\"";
+ qDebug() << ba; // prints: "\"a\r\n\""
+
+ ba = "\033"; // escape character
+ qDebug() << ba; // prints: "\x1B"
+
+ ba = "\xC3\xA1";
+ qDebug() << ba; // prints: "\xC3\xA1"
+
+ ba = QByteArray("a\0b", 3);
+ qDebug() << ba // prints: "\a\x00""b"
+ \endcode
+
+ Note how QDebug needed to close and reopen the string in the way C and C++
+ languages concatenate string literals so that the letter 'b' is not
+ interpreted as part of the previous hexadecimal escape sequence.
*/
/*!
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 9391799624..2f626dfc1f 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -293,7 +293,7 @@ template <class T>
inline typename QtPrivate::QEnableIf<
QtPrivate::IsQEnumHelper<T>::Value || QtPrivate::IsQEnumHelper<QFlags<T> >::Value,
QDebug>::Type
-operator<<(QDebug debug, const QFlags<T> &flags)
+qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
{
const QMetaObject *obj = qt_getEnumMetaObject(T());
const char *name = qt_getEnumName(T());
@@ -304,10 +304,10 @@ template <class T>
inline typename QtPrivate::QEnableIf<
!QtPrivate::IsQEnumHelper<T>::Value && !QtPrivate::IsQEnumHelper<QFlags<T> >::Value,
QDebug>::Type
-operator<<(QDebug debug, const QFlags<T> &flags)
+qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
#else // !QT_NO_QOBJECT
template <class T>
-inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
+inline QDebug qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
#endif
{
QDebugStateSaver saver(debug);
@@ -327,6 +327,14 @@ inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
return debug;
}
+template<typename T>
+inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
+{
+ // We have to use an indirection otherwise specialisation of some other overload of the
+ // operator<< the compiler would try to instantiate QFlags<T> for the QEnableIf
+ return qt_QMetaEnum_flagDebugOperator_helper(debug, flags);
+}
+
#ifdef Q_OS_MAC
// We provide QDebug stream operators for commonly used Core Foundation
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index ddbd24338b..429c40da1a 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -819,13 +819,13 @@ bool QFSFileEngine::extension(Extension extension, const ExtensionOption *option
return feof(d->fh);
if (extension == MapExtension) {
- const MapExtensionOption *options = (MapExtensionOption*)(option);
+ const MapExtensionOption *options = (const MapExtensionOption*)(option);
MapExtensionReturn *returnValue = static_cast<MapExtensionReturn*>(output);
returnValue->address = d->map(options->offset, options->size, options->flags);
return (returnValue->address != 0);
}
if (extension == UnMapExtension) {
- UnMapExtensionOption *options = (UnMapExtensionOption*)option;
+ const UnMapExtensionOption *options = (const UnMapExtensionOption*)option;
return d->unmap(options->address);
}
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index 05c41910c5..f0b72cd9be 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -398,10 +398,12 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
Q_ASSERT(reg->categories.contains(cat));
QtMsgType enableForLevel = reg->categories.value(cat);
+ // NB: note that the numeric values of the Qt*Msg constants are
+ // not in severity order.
bool debug = (enableForLevel == QtDebugMsg);
- bool info = (enableForLevel <= QtInfoMsg);
- bool warning = (enableForLevel <= QtWarningMsg);
- bool critical = (enableForLevel <= QtCriticalMsg);
+ bool info = debug || (enableForLevel == QtInfoMsg);
+ bool warning = info || (enableForLevel == QtWarningMsg);
+ bool critical = warning || (enableForLevel == QtCriticalMsg);
// hard-wired implementation of
// qt.*.debug=false
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index f979f8e0ec..dfde5f236d 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -2122,6 +2122,13 @@ void QProcess::start(const QString &program, const QStringList &arguments, OpenM
qWarning("QProcess::start: Process is already running");
return;
}
+ if (program.isEmpty()) {
+ Q_D(QProcess);
+ d->processError = QProcess::FailedToStart;
+ setErrorString(tr("No program defined"));
+ emit error(d->processError);
+ return;
+ }
d->program = program;
d->arguments = arguments;
@@ -2146,7 +2153,10 @@ void QProcess::start(OpenMode mode)
return;
}
if (d->program.isEmpty()) {
- qWarning("QProcess::start: program not set");
+ Q_D(QProcess);
+ d->processError = QProcess::FailedToStart;
+ setErrorString(tr("No program defined"));
+ emit error(d->processError);
return;
}
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 345f0bd65d..4e6079306b 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -956,7 +956,7 @@ public:
} else
#endif
{
- delete [] (uchar *)mappingBuffer();
+ delete [] mappingBuffer();
}
}
QString mappingFile() const { return fileName; }
@@ -1450,13 +1450,13 @@ bool QResourceFileEngine::extension(Extension extension, const ExtensionOption *
{
Q_D(QResourceFileEngine);
if (extension == MapExtension) {
- const MapExtensionOption *options = (MapExtensionOption*)(option);
+ const MapExtensionOption *options = (const MapExtensionOption*)(option);
MapExtensionReturn *returnValue = static_cast<MapExtensionReturn*>(output);
returnValue->address = d->map(options->offset, options->size, options->flags);
return (returnValue->address != 0);
}
if (extension == UnMapExtension) {
- UnMapExtensionOption *options = (UnMapExtensionOption*)option;
+ const UnMapExtensionOption *options = (const UnMapExtensionOption*)option;
return d->unmap(options->address);
}
return false;
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index fa7d4647a4..ba97543c44 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -1744,13 +1744,19 @@ const QItemSelection QItemSelectionModel::selection() const
\property QItemSelectionModel::selectedIndexes
*/
+
/*!
\since 5.5
- \property QItemSelectionModel::model
+ \property QItemSelectionModel::selection
\internal
*/
+/*!
+ \since 5.5
+ \property QItemSelectionModel::model
+ \internal
+*/
/*!
\since 5.5
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index 4ee37defae..0771fd0e30 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -2725,7 +2725,7 @@ bool QSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &
The default implementation returns \c true if the value held by the relevant item
matches the filter string, wildcard string or regular expression.
- \note By default, the Qt::DisplayRole is used to determine if the row
+ \note By default, the Qt::DisplayRole is used to determine if the column
should be accepted or not. This can be changed by setting the \l
filterRole property.
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 5e15f2d773..e08f709cd2 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -441,7 +441,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
static const char *const empty = "";
if (argc == 0 || argv == 0) {
argc = 0;
- argv = (char **)&empty;
+ argv = const_cast<char **>(&empty);
}
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
if (!isArgvModified(argc, argv)) {
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 90ee7d8f95..7ae9fef622 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1533,6 +1533,29 @@ bool QMetaObject::invokeMethod(QObject *obj,
*/
/*!
+ \fn QMetaObject::Connection::Connection(const Connection &other)
+
+ Constructs a copy of \a other.
+*/
+
+/*!
+ \fn QMetaObject::Connection::Connection &operator=(const Connection &other)
+
+ Assigns \a other to this connection and returns a reference to this connection.
+*/
+
+/*!
+ \fn QMetaObject::Connection &QMetaObject::Connection::operator=(Connection &&other)
+
+ Move-assigns \a other to this object.
+*/
+/*!
+ \fn QMetaObject::Connection::Connection(Connection &&o)
+
+ Move-constructs a Connection instance, making it point to the same object that \a o was pointing to.
+*/
+
+/*!
\class QMetaMethod
\inmodule QtCore
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 641053371d..3906cdc036 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -421,6 +421,16 @@ struct DefinedTypesFilter {
*/
/*!
+ \fn void *QMetaType::construct(int type, const void *copy)
+ \deprecated
+
+ Constructs a value of the given type which is a copy of \a copy.
+ The default value for \a copy is 0.
+
+ Deprecated, use the static function QMetaType::create(int type,
+ const void *copy) instead.
+*/
+/*!
\fn void *QMetaType::construct(void *where, const void *copy = 0) const
\since 5.0
@@ -1834,7 +1844,8 @@ public:
void delegate(const T *where) { DestructorImpl<T>::Destruct(m_type, const_cast<T*>(where)); }
void delegate(const void *) {}
void delegate(const QMetaTypeSwitcher::UnknownType*) {}
- void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestructor(m_type, (void*)where); }
+ void delegate(const QMetaTypeSwitcher::NotBuiltinType *where)
+ { customTypeDestructor(m_type, const_cast<void *>(static_cast<const void *>(where))); }
private:
static void customTypeDestructor(const int type, void *where)
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index e6ea27ef58..4d4cccd7b1 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4103,7 +4103,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
QDebugStateSaver saver(dbg);
if (!o)
return dbg << "QObject(0x0)";
- dbg.nospace() << o->metaObject()->className() << '(' << (void *)o;
+ dbg.nospace() << o->metaObject()->className() << '(' << (const void *)o;
if (!o->objectName().isEmpty())
dbg << ", name = " << o->objectName();
dbg << ')';
@@ -4908,8 +4908,15 @@ QMetaObject::Connection& QMetaObject::Connection::operator=(const QMetaObject::C
return *this;
}
+/*!
+ Creates a Connection instance.
+*/
+
QMetaObject::Connection::Connection() : d_ptr(0) {}
+/*!
+ Destructor for QMetaObject::Connection.
+*/
QMetaObject::Connection::~Connection()
{
if (d_ptr)
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index ef74b4bdd1..794a4aaa0c 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -722,7 +722,7 @@ static QString find_translation(const QLocale & locale,
For example, an application running in the \a locale with the following
\l{QLocale::uiLanguages()}{ui languages} - "es", "fr-CA", "de" might call
- load(QLocale::system(), "foo", ".", "/opt/foolib", ".qm"). load() would
+ load(QLocale(), "foo", ".", "/opt/foolib", ".qm"). load() would
replace '-' (dash) with '_' (underscore) in the ui language and then try to
open the first existing readable file from this list:
diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h
index 3965176ef7..ada90d7bfd 100644
--- a/src/corelib/plugin/qlibrary_p.h
+++ b/src/corelib/plugin/qlibrary_p.h
@@ -108,7 +108,7 @@ public:
raw += strlen("QTMETADATA ");
// the size of the embedded JSON object can be found 8 bytes into the data (see qjson_p.h),
// but doesn't include the size of the header (8 bytes)
- QByteArray json(raw, qFromLittleEndian<uint>(*(uint *)(raw + 8)) + 8);
+ QByteArray json(raw, qFromLittleEndian<uint>(*(const uint *)(raw + 8)) + 8);
return QJsonDocument::fromBinaryData(json);
}
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 4b5cafaa06..efab6523ac 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -112,7 +112,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \
static QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGINCLASSNAME() \
Q_PLUGIN_INSTANCE(PLUGINCLASS) \
- static const char *qt_plugin_query_metadata_##PLUGINCLASSNAME() { return (const char *)qt_pluginMetaData; } \
+ static const char *qt_plugin_query_metadata_##PLUGINCLASSNAME() { return reinterpret_cast<const char *>(qt_pluginMetaData); } \
const QT_PREPEND_NAMESPACE(QStaticPlugin) qt_static_plugin_##PLUGINCLASSNAME() { \
QT_PREPEND_NAMESPACE(QStaticPlugin) plugin = { qt_plugin_instance_##PLUGINCLASSNAME, qt_plugin_query_metadata_##PLUGINCLASSNAME}; \
return plugin; \
@@ -123,7 +123,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \
Q_EXTERN_C Q_DECL_EXPORT \
const char *qt_plugin_query_metadata() \
- { return (const char *)qt_pluginMetaData; } \
+ { return reinterpret_cast<const char *>(qt_pluginMetaData); } \
Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance() \
Q_PLUGIN_INSTANCE(PLUGINCLASS)
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 72f662dc1e..812e2c9fb6 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -543,7 +543,7 @@ QUuid QUuid::fromRfc4122(const QByteArray &bytes)
QString QUuid::toString() const
{
QString result(38, Qt::Uninitialized);
- ushort *data = (ushort *)result.unicode();
+ ushort *data = (ushort *)result.data();
_q_uuidToHex(data, data1, data2, data3, data4);
diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp
index e6477bf5e0..0ea8c4c00f 100644
--- a/src/corelib/thread/qreadwritelock.cpp
+++ b/src/corelib/thread/qreadwritelock.cpp
@@ -136,11 +136,27 @@ void QReadWriteLock::lockForRead()
{
QMutexLocker lock(&d->mutex);
+ Qt::HANDLE self = 0;
+ if (d->recursive) {
+ self = QThread::currentThreadId();
+
+ QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);
+ if (it != d->currentReaders.end()) {
+ ++it.value();
+ ++d->accessCount;
+ Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::lockForRead()",
+ "Overflow in lock counter");
+ return;
+ }
+ }
+
while (d->accessCount < 0 || d->waitingWriters) {
++d->waitingReaders;
d->readerWait.wait(&d->mutex);
--d->waitingReaders;
}
+ if (d->recursive)
+ d->currentReaders.insert(self, 1);
++d->accessCount;
Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::lockForRead()", "Overflow in lock counter");
@@ -166,8 +182,24 @@ bool QReadWriteLock::tryLockForRead()
{
QMutexLocker lock(&d->mutex);
+ Qt::HANDLE self = 0;
+ if (d->recursive) {
+ self = QThread::currentThreadId();
+
+ QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);
+ if (it != d->currentReaders.end()) {
+ ++it.value();
+ ++d->accessCount;
+ Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()",
+ "Overflow in lock counter");
+ return true;
+ }
+ }
+
if (d->accessCount < 0)
return false;
+ if (d->recursive)
+ d->currentReaders.insert(self, 1);
++d->accessCount;
Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()", "Overflow in lock counter");
@@ -198,6 +230,20 @@ bool QReadWriteLock::tryLockForRead(int timeout)
{
QMutexLocker lock(&d->mutex);
+ Qt::HANDLE self = 0;
+ if (d->recursive) {
+ self = QThread::currentThreadId();
+
+ QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);
+ if (it != d->currentReaders.end()) {
+ ++it.value();
+ ++d->accessCount;
+ Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()",
+ "Overflow in lock counter");
+ return true;
+ }
+ }
+
while (d->accessCount < 0 || d->waitingWriters) {
++d->waitingReaders;
bool success = d->readerWait.wait(&d->mutex, timeout < 0 ? ULONG_MAX : ulong(timeout));
@@ -205,6 +251,8 @@ bool QReadWriteLock::tryLockForRead(int timeout)
if (!success)
return false;
}
+ if (d->recursive)
+ d->currentReaders.insert(self, 1);
++d->accessCount;
Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()", "Overflow in lock counter");
@@ -364,6 +412,15 @@ void QReadWriteLock::unlock()
bool unlocked = false;
if (d->accessCount > 0) {
// releasing a read lock
+ if (d->recursive) {
+ Qt::HANDLE self = QThread::currentThreadId();
+ QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);
+ if (it != d->currentReaders.end()) {
+ if (--it.value() <= 0)
+ d->currentReaders.erase(it);
+ }
+ }
+
unlocked = --d->accessCount == 0;
} else if (d->accessCount < 0 && ++d->accessCount == 0) {
// released a write lock
diff --git a/src/corelib/thread/qreadwritelock_p.h b/src/corelib/thread/qreadwritelock_p.h
index 15a6d1f57e..e57c0e403f 100644
--- a/src/corelib/thread/qreadwritelock_p.h
+++ b/src/corelib/thread/qreadwritelock_p.h
@@ -69,6 +69,7 @@ struct QReadWriteLockPrivate
bool recursive;
Qt::HANDLE currentWriter;
+ QHash<Qt::HANDLE, int> currentReaders;
};
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 0434cebc15..447e84b3d4 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -511,7 +511,7 @@ QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel)
int res;
do {
bazip.resize(len + 4);
- res = ::compress2((uchar*)bazip.data()+4, &len, (uchar*)data, nbytes, compressionLevel);
+ res = ::compress2((uchar*)bazip.data()+4, &len, data, nbytes, compressionLevel);
switch (res) {
case Z_OK:
@@ -602,7 +602,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
d->size = 0; // Shut up valgrind "uninitialized variable" warning
int res = ::uncompress((uchar*)d->data(), &len,
- (uchar*)data+4, nbytes-4);
+ data+4, nbytes-4);
switch (res) {
case Z_OK:
@@ -2186,9 +2186,9 @@ QByteArray &QByteArray::replace(const char *before, int bsize, const char *after
}
if (a != after)
- ::free((char *)a);
+ ::free(const_cast<char *>(a));
if (b != before)
- ::free((char *)b);
+ ::free(const_cast<char *>(b));
return *this;
diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp
index 615b7a4e3e..59f8f66869 100644
--- a/src/corelib/tools/qcollator.cpp
+++ b/src/corelib/tools/qcollator.cpp
@@ -87,7 +87,7 @@ QCollator::QCollator(const QCollator &other)
}
/*!
- Destructor for QCollator.
+ Destroys the collator.
*/
QCollator::~QCollator()
{
diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc
index 2a421a1bbf..7cba7480f0 100644
--- a/src/corelib/tools/qpair.qdoc
+++ b/src/corelib/tools/qpair.qdoc
@@ -109,7 +109,7 @@
\endcode
Swap overloads are found in namespace \c std as well as via
- argument-dependent lookup (ADL) in \c{T}'s namespace.
+ argument-dependent lookup (ADL) in the namespace of \c{T} .
*/
/*!
@@ -136,8 +136,7 @@
\fn QPair::QPair(QPair<TT1, TT2> &&p)
\since 5.2
- Move-constructs a QPair instance, making it point to the same object that
- \a p was pointing to.
+ Move-constructs a QPair instance, making it point to the same object that \a p was pointing to.
*/
/*!
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index d572dd209c..e7917ffdac 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -36,6 +36,10 @@
#include <QByteArray>
#include <stdio.h>
+#ifdef Q_OS_LINUX
+# include "../testlib/3rdparty/valgrind_p.h"
+#endif
+
#if defined(Q_OS_WIN)
# if defined(Q_OS_WINCE)
# include <qt_windows.h>
@@ -256,8 +260,12 @@ static inline uint detectProcessorFeatures()
uint features = 0;
int cpuidLevel = maxBasicCpuidSupported();
+#if Q_PROCESSOR_X86 < 5
if (cpuidLevel < 1)
return 0;
+#else
+ Q_ASSERT(cpuidLevel >= 1);
+#endif
uint cpuid01ECX = 0, cpuid01EDX = 0;
cpuidFeatures01(cpuid01ECX, cpuid01EDX);
@@ -497,8 +505,7 @@ static const int features_indices[] = {
static const int features_count = (sizeof features_indices - 1) / (sizeof features_indices[0]);
// record what CPU features were enabled by default in this Qt build
-// don't define for HLE, since the HLE prefix can be run on older CPUs
-static const uint minFeature = qCompilerCpuFeatures & ~HLE;
+static const uint minFeature = qCompilerCpuFeatures;
#ifdef Q_OS_WIN
#if defined(Q_CC_GNU)
@@ -554,7 +561,12 @@ void qDetectCpuFeatures()
}
}
- if (minFeature != 0 && (f & minFeature) != minFeature) {
+#ifdef RUNNING_ON_VALGRIND
+ bool runningOnValgrind = RUNNING_ON_VALGRIND;
+#else
+ bool runningOnValgrind = false;
+#endif
+ if (!runningOnValgrind && (minFeature != 0 && (f & minFeature) != minFeature)) {
uint missing = minFeature & ~f;
fprintf(stderr, "Incompatible processor. This Qt build requires the following features:\n ");
for (int i = 0; i < features_count; ++i) {
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 1f5e743b7f..dd93b4fd26 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -265,9 +265,6 @@ static const uint qCompilerCpuFeatures = 0
#if defined __RTM__
| RTM
#endif
-#if defined __HLE__
- | HLE
-#endif
#if defined __AVX2__
| AVX2
#endif
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 345114d907..8bb8953dde 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -215,7 +215,7 @@ void qt_from_latin1(ushort *dst, const char *str, size_t size)
// we're going to read str[offset..offset+15] (16 bytes)
for ( ; str + offset + 15 < e; offset += 16) {
- const __m128i chunk = _mm_loadu_si128((__m128i*)(str + offset)); // load
+ const __m128i chunk = _mm_loadu_si128((const __m128i*)(str + offset)); // load
#ifdef __AVX2__
// zero extend to an YMM register
const __m256i extended = _mm256_cvtepu8_epi16(chunk);
@@ -316,10 +316,10 @@ static void qt_to_latin1(uchar *dst, const ushort *src, int length)
// we're going to write to dst[offset..offset+15] (16 bytes)
for ( ; dst + offset + 15 < e; offset += 16) {
- __m128i chunk1 = _mm_loadu_si128((__m128i*)(src + offset)); // load
+ __m128i chunk1 = _mm_loadu_si128((const __m128i*)(src + offset)); // load
chunk1 = mergeQuestionMarks(chunk1);
- __m128i chunk2 = _mm_loadu_si128((__m128i*)(src + offset + 8)); // load
+ __m128i chunk2 = _mm_loadu_si128((const __m128i*)(src + offset + 8)); // load
chunk2 = mergeQuestionMarks(chunk2);
// pack the two vector to 16 x 8bits elements
@@ -458,8 +458,8 @@ static int ucstrncmp(const QChar *a, const QChar *b, int l)
// we're going to read ptr[0..15] (16 bytes)
for ( ; ptr + 15 < reinterpret_cast<const char *>(a); ptr += 16) {
- __m128i a_data = _mm_loadu_si128((__m128i*)ptr);
- __m128i b_data = _mm_loadu_si128((__m128i*)(ptr + distance));
+ __m128i a_data = _mm_loadu_si128((const __m128i*)ptr);
+ __m128i b_data = _mm_loadu_si128((const __m128i*)(ptr + distance));
__m128i result = _mm_cmpeq_epi16(a_data, b_data);
uint mask = ~_mm_movemask_epi8(result);
if (ushort(mask)) {
@@ -541,14 +541,14 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l)
for ( ; uc + offset + 15 < e; offset += 16) {
// similar to fromLatin1_helper:
// load 16 bytes of Latin 1 data
- __m128i chunk = _mm_loadu_si128((__m128i*)(c + offset));
+ __m128i chunk = _mm_loadu_si128((const __m128i*)(c + offset));
# ifdef __AVX2__
// expand Latin 1 data via zero extension
__m256i ldata = _mm256_cvtepu8_epi16(chunk);
// load UTF-16 data and compare
- __m256i ucdata = _mm256_loadu_si256((__m256i*)(uc + offset));
+ __m256i ucdata = _mm256_loadu_si256((const __m256i*)(uc + offset));
__m256i result = _mm256_cmpeq_epi16(ldata, ucdata);
uint mask = ~_mm256_movemask_epi8(result);
@@ -558,8 +558,8 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l)
__m128i secondHalf = _mm_unpackhi_epi8(chunk, nullmask);
// load UTF-16 data and compare
- __m128i ucdata1 = _mm_loadu_si128((__m128i*)(uc + offset));
- __m128i ucdata2 = _mm_loadu_si128((__m128i*)(uc + offset + 8));
+ __m128i ucdata1 = _mm_loadu_si128((const __m128i*)(uc + offset));
+ __m128i ucdata2 = _mm_loadu_si128((const __m128i*)(uc + offset + 8));
__m128i result1 = _mm_cmpeq_epi16(firstHalf, ucdata1);
__m128i result2 = _mm_cmpeq_epi16(secondHalf, ucdata2);
@@ -577,10 +577,10 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l)
// we'll read uc[offset..offset+7] (16 bytes) and c[offset..offset+7] (8 bytes)
if (uc + offset + 7 < e) {
// same, but we're using an 8-byte load
- __m128i chunk = _mm_cvtsi64_si128(*(long long *)(c + offset));
+ __m128i chunk = _mm_cvtsi64_si128(*(const long long *)(c + offset));
__m128i secondHalf = _mm_unpacklo_epi8(chunk, nullmask);
- __m128i ucdata = _mm_loadu_si128((__m128i*)(uc + offset));
+ __m128i ucdata = _mm_loadu_si128((const __m128i*)(uc + offset));
__m128i result = _mm_cmpeq_epi16(secondHalf, ucdata);
uint mask = ~_mm_movemask_epi8(result);
if (ushort(mask)) {
@@ -672,7 +672,7 @@ static int findChar(const QChar *str, int len, QChar ch, int from,
// we're going to read n[0..7] (16 bytes)
for (const ushort *next = n + 8; next <= e; n = next, next += 8) {
- __m128i data = _mm_loadu_si128((__m128i*)n);
+ __m128i data = _mm_loadu_si128((const __m128i*)n);
__m128i result = _mm_cmpeq_epi16(data, mch);
uint mask = _mm_movemask_epi8(result);
if (ushort(mask)) {
@@ -2744,7 +2744,7 @@ bool operator<(const QString &s1, const QString &s2)
*/
bool QString::operator<(QLatin1String other) const
{
- const uchar *c = (uchar *) other.latin1();
+ const uchar *c = (const uchar *) other.latin1();
if (!c || *c == 0)
return false;
@@ -2849,7 +2849,7 @@ bool QString::operator<(QLatin1String other) const
*/
bool QString::operator>(QLatin1String other) const
{
- const uchar *c = (uchar *) other.latin1();
+ const uchar *c = (const uchar *) other.latin1();
if (!c || *c == '\0')
return !isEmpty();
@@ -5392,7 +5392,7 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2,
{
const ushort *uc = reinterpret_cast<const ushort *>(data1);
const ushort *uce = uc + length1;
- const uchar *c = (uchar *)s2.latin1();
+ const uchar *c = (const uchar *)s2.latin1();
if (!c)
return length1;
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index 7c5e5bd2cf..90ce8e3b68 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -389,12 +389,19 @@ static int parsePosixOffset(const QByteArray &timeRule)
// Format "[+|-]hh[:mm[:ss]]"
QList<QByteArray> parts = timeRule.split(':');
int count = parts.count();
- if (count == 3)
- return (parts.at(0).toInt() * -60 * 60) + (parts.at(1).toInt() * 60) + parts.at(2).toInt();
- else if (count == 2)
- return (parts.at(0).toInt() * -60 * 60) + (parts.at(1).toInt() * 60);
- else if (count == 1)
- return (parts.at(0).toInt() * -60 * 60);
+ if (count == 3) {
+ int hour = parts.at(0).toInt();
+ int sign = hour >= 0 ? -1 : 1;
+ return sign * ((qAbs(hour) * 60 * 60) + (parts.at(1).toInt() * 60) + parts.at(2).toInt());
+ } else if (count == 2) {
+ int hour = parts.at(0).toInt();
+ int sign = hour >= 0 ? -1 : 1;
+ return sign * ((qAbs(hour) * 60 * 60) + (parts.at(1).toInt() * 60));
+ } else if (count == 1) {
+ int hour = parts.at(0).toInt();
+ int sign = hour >= 0 ? -1 : 1;
+ return sign * (qAbs(hour) * 60 * 60);
+ }
return 0;
}
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index bbd751efd0..13c84db9ae 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -2396,6 +2396,12 @@ QXmlStreamAttribute& QXmlStreamAttribute::operator=(const QXmlStreamAttribute &o
*/
/*!
+ \fn QXmlStreamAttributes::QXmlStreamAttributes()
+
+ A constructor for QXmlStreamAttributes.
+*/
+
+/*!
\typedef QXmlStreamNotationDeclarations
\relates QXmlStreamNotationDeclaration
diff --git a/src/dbus/qdbusunixfiledescriptor.cpp b/src/dbus/qdbusunixfiledescriptor.cpp
index 77f48c03a4..6b167458b9 100644
--- a/src/dbus/qdbusunixfiledescriptor.cpp
+++ b/src/dbus/qdbusunixfiledescriptor.cpp
@@ -174,7 +174,7 @@ QDBusUnixFileDescriptor &QDBusUnixFileDescriptor::operator=(const QDBusUnixFileD
}
/*!
- \fn QDBusUnixFileDescriptor &operator=(QDBusUnixFileDescriptor &&other)
+ \fn QDBusUnixFileDescriptor &QDBusUnixFileDescriptor::operator=(QDBusUnixFileDescriptor &&other)
Move-assigns \a other to this QDBusUnixFileDescriptor.
*/
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index dc6933f9ff..50a4a09102 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1387,10 +1387,18 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
*/
/*! \fn QAccessibleValueChangeEvent::QAccessibleValueChangeEvent(QObject *object, const QVariant &value)
+
Constructs a new QAccessibleValueChangeEvent for \a object.
The event contains the new \a value.
*/
+/*! \fn QAccessibleValueChangeEvent::QAccessibleValueChangeEvent(QAccessibleInterface *iface, const QVariant &val)
+
+ Constructs a new QAccessibleValueChangeEvent for \a iface.
+ The event contains the new value \a val.
+*/
+
/*! \fn void QAccessibleValueChangeEvent::setValue(const QVariant & value)
+
Sets the new \a value for this event.
*/
/*!
@@ -1419,11 +1427,13 @@ QAccessibleValueChangeEvent::~QAccessibleValueChangeEvent()
\sa QAccessibleInterface::state()
*/
/*! \fn QAccessibleStateChangeEvent::QAccessibleStateChangeEvent(QObject *object, QAccessible::State state)
+
Constructs a new QAccessibleStateChangeEvent for \a object.
The difference to the object's previous state is in \a state.
*/
/*!
\fn QAccessibleStateChangeEvent::QAccessibleStateChangeEvent(QAccessibleInterface *iface, QAccessible::State state)
+
Constructs a new QAccessibleStateChangeEvent.
\a iface is the interface associated with the event
\a state is the state of the accessible object.
@@ -1432,8 +1442,8 @@ QAccessibleValueChangeEvent::~QAccessibleValueChangeEvent()
\fn QAccessible::State QAccessibleStateChangeEvent::changedStates() const
\brief Returns the states that have been changed.
- Be aware that the returned states are the ones that have changed,
- to find out about the state of an object, use QAccessibleInterface::state().
+ Keep in mind that the returned states are the ones that have changed.
+ To find out about the state of an object, use QAccessibleInterface::state().
For example, if an object used to have the focus but loses it,
the object's state will have focused set to \c false. This event on the
@@ -1462,7 +1472,7 @@ QAccessibleStateChangeEvent::~QAccessibleStateChangeEvent()
*/
/*! \enum QAccessibleTableModelChangeEvent::ModelChangeType
- This enum describes different types of changes in the table model.
+ This enum describes the different types of changes in the table model.
\value ModelReset The model has been reset, all previous knowledge about the model is now invalid.
\value DataChanged No cells have been added or removed, but the data of the specified cell range is invalid.
\value RowsInserted New rows have been inserted.
@@ -1471,47 +1481,62 @@ QAccessibleStateChangeEvent::~QAccessibleStateChangeEvent()
\value ColumnsRemoved Columns have been removed.
*/
/*! \fn QAccessibleTableModelChangeEvent::QAccessibleTableModelChangeEvent(QObject *object, ModelChangeType changeType)
+
Constructs a new QAccessibleTableModelChangeEvent for \a object of with \a changeType.
*/
/*! \fn int QAccessibleTableModelChangeEvent::firstColumn() const
+
Returns the first changed column.
*/
/*! \fn int QAccessibleTableModelChangeEvent::firstRow() const
+
Returns the first changed row.
*/
/*! \fn int QAccessibleTableModelChangeEvent::lastColumn() const
+
Returns the last changed column.
*/
/*! \fn int QAccessibleTableModelChangeEvent::lastRow() const
+
Returns the last changed row.
*/
/*! \fn QAccessibleTableModelChangeEvent::ModelChangeType QAccessibleTableModelChangeEvent::modelChangeType() const
+
Returns the type of change.
*/
/*! \fn void QAccessibleTableModelChangeEvent::setFirstColumn(int column)
+
Sets the first changed \a column.
*/
/*! \fn void QAccessibleTableModelChangeEvent::setFirstRow(int row)
+
Sets the first changed \a row.
*/
/*! \fn void QAccessibleTableModelChangeEvent::setLastColumn(int column)
+
Sets the last changed \a column.
*/
/*! \fn void QAccessibleTableModelChangeEvent::setLastRow(int row)
+
Sets the last changed \a row.
*/
/*! \fn void QAccessibleTableModelChangeEvent::setModelChangeType(ModelChangeType changeType)
+
Sets the type of change to \a changeType.
*/
/*!
+ \fn QAccessibleTableModelChangeEvent::QAccessibleTableModelChangeEvent(QAccessibleInterface *iface, ModelChangeType changeType)
+
+ Constructs a new QAccessibleTableModelChangeEvent for interface \a iface with a model
+ change type \a changeType.
+*/
+/*!
\internal
*/
QAccessibleTableModelChangeEvent::~QAccessibleTableModelChangeEvent()
{
// must be empty until ### Qt 6
}
-
-
/*!
\class QAccessibleTextCursorEvent
\ingroup accessibility
@@ -1521,14 +1546,17 @@ QAccessibleTableModelChangeEvent::~QAccessibleTableModelChangeEvent()
This class is used with \l QAccessible::updateAccessibility().
*/
-/*! \fn QAccessibleTextCursorEvent::QAccessibleTextCursorEvent(QObject *object, int cursorPosition)
+/*! \fn QAccessibleTextCursorEvent::QAccessibleTextCursorEvent(QObject *object, int cursorPos)
+
Create a new QAccessibleTextCursorEvent for \a object.
- The \a cursorPosition is the new cursor position.
+ The \a cursorPos is the new cursor position.
*/
/*! \fn int QAccessibleTextCursorEvent::cursorPosition() const
+
Returns the cursor position.
*/
/*! \fn void QAccessibleTextCursorEvent::setCursorPosition(int position)
+
Sets the cursor \a position for this event.
*/
/*!
@@ -1541,6 +1569,13 @@ QAccessibleTextCursorEvent::~QAccessibleTextCursorEvent()
/*!
+ \fn QAccessibleTextCursorEvent(QAccessibleInterface *iface, int cursorPos)
+
+ Create a new QAccessibleTextCursorEvent for \a iface,
+ The \a cursorPos is the new cursor position.
+*/
+
+/*!
\class QAccessibleTextInsertEvent
\ingroup accessibility
\inmodule QtGui
@@ -1550,6 +1585,7 @@ QAccessibleTextCursorEvent::~QAccessibleTextCursorEvent()
This class is used with \l QAccessible::updateAccessibility().
*/
/*! \fn QAccessibleTextInsertEvent::QAccessibleTextInsertEvent(QObject *object, int position, const QString &text)
+
Constructs a new QAccessibleTextInsertEvent event for \a object.
The \a text has been inserted at \a position.
By default, it is assumed that the cursor has moved to the end
@@ -1557,9 +1593,11 @@ QAccessibleTextCursorEvent::~QAccessibleTextCursorEvent()
set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event.
*/
/*! \fn int QAccessibleTextInsertEvent::changePosition() const
+
Returns the position where the text was inserted.
*/
/*! \fn QString QAccessibleTextInsertEvent::textInserted() const
+
Returns the text that has been inserted.
*/
/*!
@@ -1581,17 +1619,28 @@ QAccessibleTextInsertEvent::~QAccessibleTextInsertEvent()
This class is used with \l QAccessible::updateAccessibility().
*/
/*! \fn QAccessibleTextRemoveEvent::QAccessibleTextRemoveEvent(QObject *object, int position, const QString &text)
+
Constructs a new QAccessibleTextRemoveEvent event for \a object.
The \a text has been removed at \a position.
By default it is assumed that the cursor has moved to \a position.
If that is not the case, one needs to manually
set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event.
*/
+/*! \fn QAccessibleTextRemoveEvent::QAccessibleTextRemoveEvent(QAccessibleInterface *iface, int position, const QString &text)
+
+ Constructs a new QAccessibleTextRemoveEvent event for \a iface.
+ The \a text has been removed at \a position.
+ By default it is assumed that the cursor has moved to \a position.
+ If that is not the case, one needs to manually
+ set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event.
+*/
/*! \fn int QAccessibleTextRemoveEvent::changePosition() const
+
Returns the position where the text was removed.
*/
/*! \fn QString QAccessibleTextRemoveEvent::textRemoved() const
+
Returns the text that has been removed.
*/
/*!
@@ -1603,6 +1652,31 @@ QAccessibleTextRemoveEvent::~QAccessibleTextRemoveEvent()
}
/*!
+ \fn QAccessibleTextSelectionEvent::QAccessibleTextSelectionEvent(QAccessibleInterface *iface, int start, int end)
+
+ Constructs a new QAccessibleTextSelectionEvent for \a iface. The new selection this
+ event notifies about is from position \a start to \a end.
+*/
+
+/*!
+ \fn QAccessibleTextInsertEvent::QAccessibleTextInsertEvent(QAccessibleInterface *iface, int position, const QString &text)
+
+ Constructs a new QAccessibleTextInsertEvent event for \a iface. The text has been inserted at
+ \a position.
+*/
+
+/*!
+ \fn inline QAccessibleTextUpdateEvent::QAccessibleTextUpdateEvent(QAccessibleInterface *iface, int position, const QString &oldText,
+ const QString &text)
+
+ Constructs a new QAccessibleTextUpdateEvent for \a iface. The text change takes place at
+ \a position where the \a oldText was removed and \a text inserted instead.
+
+*/
+
+
+
+/*!
\class QAccessibleTextUpdateEvent
\ingroup accessibility
\inmodule QtGui
@@ -1615,16 +1689,20 @@ QAccessibleTextRemoveEvent::~QAccessibleTextRemoveEvent()
This class is used with \l QAccessible::updateAccessibility().
*/
/*! \fn QAccessibleTextUpdateEvent::QAccessibleTextUpdateEvent(QObject *object, int position, const QString &oldText, const QString &text)
+
Constructs a new QAccessibleTextUpdateEvent for \a object.
The text change takes place at \a position where the \a oldText was removed and \a text inserted instead.
*/
/*! \fn int QAccessibleTextUpdateEvent::changePosition() const
+
Returns where the change took place.
*/
/*! \fn QString QAccessibleTextUpdateEvent::textInserted() const
+
Returns the inserted text.
*/
/*! \fn QString QAccessibleTextUpdateEvent::textRemoved() const
+
Returns the removed text.
*/
/*!
@@ -1646,16 +1724,20 @@ QAccessibleTextUpdateEvent::~QAccessibleTextUpdateEvent()
This class is used with \l QAccessible::updateAccessibility().
*/
/*! \fn QAccessibleTextSelectionEvent::QAccessibleTextSelectionEvent(QObject *object, int start, int end)
+
Constructs a new QAccessibleTextSelectionEvent for \a object.
The new selection this event notifies about is from position \a start to \a end.
*/
/*! \fn int QAccessibleTextSelectionEvent::selectionEnd() const
+
Returns the position of the last selected character.
*/
/*! \fn int QAccessibleTextSelectionEvent::selectionStart() const
+
Returns the position of the first selected character.
*/
/*! \fn void QAccessibleTextSelectionEvent::setSelection(int start, int end)
+
Sets the selection for this event from position \a start to \a end.
*/
/*!
@@ -1903,6 +1985,7 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
*/
/*!
+
Destroys the QAccessibleTextInterface.
*/
QAccessibleTextInterface::~QAccessibleTextInterface()
@@ -1912,6 +1995,7 @@ QAccessibleTextInterface::~QAccessibleTextInterface()
/*!
\fn void QAccessibleTextInterface::addSelection(int startOffset, int endOffset)
+
Select the text from \a startOffset to \a endOffset.
The \a startOffset is the first character that will be selected.
The \a endOffset is the first character that will not be selected.
@@ -1924,6 +2008,7 @@ QAccessibleTextInterface::~QAccessibleTextInterface()
/*!
\fn QString QAccessibleTextInterface::attributes(int offset, int *startOffset, int *endOffset) const
+
Returns the text attributes at the position \a offset.
In addition the range of the attributes is returned in \a startOffset and \a endOffset.
*/
@@ -1936,6 +2021,7 @@ QAccessibleTextInterface::~QAccessibleTextInterface()
/*!
\fn QRect QAccessibleTextInterface::characterRect(int offset) const
+
Returns the position and size of the character at position \a offset in screen coordinates.
*/
@@ -2288,6 +2374,7 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
*/
/*!
+
Destroys the QAccessibleEditableTextInterface.
*/
QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface()
@@ -2333,6 +2420,7 @@ QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface()
/*!
Destroys the QAccessibleValueInterface.
+
*/
QAccessibleValueInterface::~QAccessibleValueInterface()
{
@@ -2415,6 +2503,7 @@ QAccessibleImageInterface::~QAccessibleImageInterface()
*/
/*!
+
Destroys the QAccessibleTableCellInterface.
*/
QAccessibleTableCellInterface::~QAccessibleTableCellInterface()
@@ -2424,41 +2513,49 @@ QAccessibleTableCellInterface::~QAccessibleTableCellInterface()
/*!
\fn virtual int QAccessibleTableCellInterface::columnExtent() const
+
Returns the number of columns occupied by this cell accessible.
*/
/*!
\fn virtual QList<QAccessibleInterface*> QAccessibleTableCellInterface::columnHeaderCells() const
+
Returns the column headers as an array of cell accessibles.
*/
/*!
\fn virtual int QAccessibleTableCellInterface::columnIndex() const
+
Translates this cell accessible into the corresponding column index.
*/
/*!
\fn virtual int QAccessibleTableCellInterface::rowExtent() const
+
Returns the number of rows occupied by this cell accessible.
*/
/*!
\fn virtual QList<QAccessibleInterface*> QAccessibleTableCellInterface::rowHeaderCells() const
+
Returns the row headers as an array of cell accessibles.
*/
/*!
\fn virtual int QAccessibleTableCellInterface::rowIndex() const
+
Translates this cell accessible into the corresponding row index.
*/
/*!
\fn virtual bool QAccessibleTableCellInterface::isSelected() const
+
Returns a boolean value indicating whether this cell is selected.
*/
/*!
\fn virtual QAccessibleInterface *QAccessibleTableCellInterface::table() const
+
Returns the QAccessibleInterface of the table containing this cell.
*/
@@ -2474,6 +2571,7 @@ QAccessibleTableCellInterface::~QAccessibleTableCellInterface()
*/
/*!
+
Destroys the QAccessibleTableInterface.
*/
QAccessibleTableInterface::~QAccessibleTableInterface()
@@ -2483,100 +2581,119 @@ QAccessibleTableInterface::~QAccessibleTableInterface()
/*!
\fn virtual QAccessibleInterface *QAccessibleTableInterface::cellAt(int row, int column) const
+
Returns the cell at the specified \a row and \a column in the table.
*/
/*!
\fn virtual QAccessibleInterface *QAccessibleTableInterface::caption() const
+
Returns the caption for the table.
*/
/*!
\fn virtual QString QAccessibleTableInterface::columnDescription(int column) const
+
Returns the description text of the specified \a column in the table.
*/
/*!
\fn virtual int QAccessibleTableInterface::columnCount() const
+
Returns the total number of columns in table.
*/
/*!
\fn virtual int QAccessibleTableInterface::rowCount() const
+
Returns the total number of rows in table.
*/
/*!
\fn virtual int QAccessibleTableInterface::selectedCellCount() const
+
Returns the total number of selected cells.
*/
/*!
\fn virtual int QAccessibleTableInterface::selectedColumnCount() const
+
Returns the total number of selected columns.
*/
/*!
\fn virtual int QAccessibleTableInterface::selectedRowCount() const
+
Returns the total number of selected rows.
*/
/*!
\fn virtual QString QAccessibleTableInterface::rowDescription(int row) const
+
Returns the description text of the specified \a row in the table.
*/
/*!
\fn virtual QList<int> QAccessibleTableInterface::selectedCells() const
+
Returns the list of selected cell (by their index as \l QAccessibleInterface::child() accepts).
*/
/*!
\fn virtual QList<int> QAccessibleTableInterface::selectedColumns() const
+
Returns the list of currently selected columns.
*/
/*!
\fn virtual QList<int> QAccessibleTableInterface::selectedRows() const
+
Returns the list of currently selected columns.
*/
/*!
\fn virtual QAccessibleInterface *QAccessibleTableInterface::summary() const
+
Returns a QAccessibleInterface that represents a summary of the table.
This function may return 0 if no such interface exists.
*/
/*!
\fn virtual bool QAccessibleTableInterface::isColumnSelected(int column) const
+
Returns a boolean value indicating whether the specified \a column is completely selected.
*/
/*!
\fn virtual bool QAccessibleTableInterface::isRowSelected(int row) const
+
Returns a boolean value indicating whether the specified \a row is completely selected.
*/
/*!
\fn virtual bool QAccessibleTableInterface::selectRow(int row)
+
Selects \a row. This function might unselect all previously selected rows.
Returns \c true if the selection was successful.
*/
/*!
\fn virtual bool QAccessibleTableInterface::selectColumn(int column)
+
Selects \a column. This function might unselect all previously selected columns.
Returns \c true if the selection was successful.
*/
/*!
\fn virtual bool QAccessibleTableInterface::unselectRow(int row)
+
Unselects \a row, leaving other selected rows selected (if any).
Returns \c true if the selection was successful.
*/
/*!
\fn virtual bool QAccessibleTableInterface::unselectColumn(int column)
+
Unselects \a column, leaving other selected columns selected (if any).
Returns \c true if the selection was successful.
*/
@@ -2630,6 +2747,7 @@ QAccessibleTableInterface::~QAccessibleTableInterface()
*/
/*!
+
Destroys the QAccessibleActionInterface.
*/
QAccessibleActionInterface::~QAccessibleActionInterface()
diff --git a/src/gui/image/qgifhandler.pri b/src/gui/image/qgifhandler.pri
index 6eb0751372..ec33101451 100644
--- a/src/gui/image/qgifhandler.pri
+++ b/src/gui/image/qgifhandler.pri
@@ -1,4 +1,3 @@
# common to plugin and built-in forms
-INCLUDEPATH *= $$PWD
HEADERS += $$PWD/qgifhandler_p.h
SOURCES += $$PWD/qgifhandler.cpp
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 6b506580ea..7a59adffb8 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -629,6 +629,13 @@ QIcon::QIcon(const QIcon &other)
}
/*!
+ \fn QIcon::QIcon(QIcon &&other)
+
+ Move-constructs a QIcon instance, making it point to the same object
+ that \a other was pointing to.
+*/
+
+/*!
Constructs an icon from the file with the given \a fileName. The
file will be loaded on demand.
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index b8606a92b4..aea6fc133f 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -572,12 +572,13 @@ bool QImageData::checkForAlphaPixels() const
\endtable
+ \target qimage-legalese
\section1 Legal Information
For smooth scaling, the transformed() functions use code based on
smooth scaling algorithm by Daniel M. Duley.
- \legalese
+ \badcode
Copyright (C) 2004, 2005 Daniel M. Duley
Redistribution and use in source and binary forms, with or without
@@ -600,7 +601,7 @@ bool QImageData::checkForAlphaPixels() const
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- \endlegalese
+ \endcode
\sa QImageReader, QImageWriter, QPixmap, QSvgRenderer, {Image Composition Example},
{Image Viewer Example}, {Scribble Example}, {Pixelator Example}
@@ -4359,6 +4360,10 @@ int QImage::bitPlaneCount() const
return bpc;
}
+/*!
+ Returns a smoothly scaled copy of the image. The returned image has a size
+ of width \a w by height \a h pixels.
+*/
QImage QImage::smoothScaled(int w, int h) const {
QImage src = *this;
switch (src.format()) {
diff --git a/src/gui/image/qjpeghandler.pri b/src/gui/image/qjpeghandler.pri
index c8de33d8b4..de40c6742e 100644
--- a/src/gui/image/qjpeghandler.pri
+++ b/src/gui/image/qjpeghandler.pri
@@ -1,5 +1,4 @@
# common to plugin and built-in forms
-INCLUDEPATH *= $$PWD
HEADERS += $$PWD/qjpeghandler_p.h
SOURCES += $$PWD/qjpeghandler.cpp
contains(QT_CONFIG, system-jpeg) {
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 0fefa1f7ea..71a79745e8 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -659,4 +659,18 @@ int QPixmapCache::totalUsed()
return (pm_cache()->totalCost()+1023) / 1024;
}
+/*!
+ \fn QPixmapCache::KeyData::KeyData()
+
+ \internal
+*/
+/*!
+ \fn QPixmapCache::KeyData::KeyData(const KeyData &other)
+ \internal
+*/
+/*!
+ \fn QPixmapCache::KeyData::~KeyData()
+
+ \internal
+*/
QT_END_NAMESPACE
diff --git a/src/gui/image/qpnghandler.pri b/src/gui/image/qpnghandler.pri
index aca7e2c568..9ab175d628 100644
--- a/src/gui/image/qpnghandler.pri
+++ b/src/gui/image/qpnghandler.pri
@@ -1,4 +1,3 @@
-INCLUDEPATH *= $$PWD
HEADERS += $$PWD/qpnghandler_p.h
SOURCES += $$PWD/qpnghandler.cpp
contains(QT_CONFIG, system-png) {
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index adbaa5ff86..3873976144 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -83,6 +83,52 @@ QEnterEvent::~QEnterEvent()
}
/*!
+ \fn QPoint QEnterEvent::globalPos() const
+
+ Returns the global position of the widget \e{at the time of the event}.
+*/
+/*!
+ \fn int QEnterEvent::globalX() const
+
+ Returns the global position on the X-axis of the mouse cursor relative to the the widget.
+*/
+/*!
+ \fn int QEnterEvent::globalY() const
+
+ Returns the global position on the Y-axis of the mouse cursor relative to the the widget.
+*/
+/*!
+ \fn QPoint QEnterEvent::localPos() const
+
+ Returns the mouse cursor's position relative to the receiving widget.
+*/
+/*!
+ \fn QPoint QEnterEvent::pos() const
+
+ Returns the position of the mouse cursor in global screen coordinates.
+*/
+/*!
+ \fn QPoint QEnterEvent::screenPos() const
+
+ Returns the position of the mouse cursor relative to the receiving screen.
+*/
+/*!
+ \fn QPoint QEnterEvent::windowPos() const
+
+ Returns the position of the mouse cursor relative to the receiving window.
+*/
+/*!
+ \fn int QEnterEvent::x() const
+
+ Returns the x position of the mouse cursor relative to the receiving widget.
+*/
+/*!
+ \fn int QEnterEvent::y() const
+
+ Returns the y position of the mouse cursor relative to the receiving widget.
+*/
+
+/*!
\class QInputEvent
\ingroup events
\inmodule QtGui
@@ -4196,6 +4242,12 @@ QTouchEvent::~QTouchEvent()
\sa QTouchDevice::type(), QTouchEvent::device()
*/
+/*! \fn QTouchEvent::TouchPoint::TouchPoint(TouchPoint &&other)
+
+ Move-constructs a TouchPoint instance, making it point to the same
+ object that \a other was pointing to.
+*/
+
/*! \fn Qt::TouchPointStates QTouchEvent::touchPointStates() const
Returns a bitwise OR of all the touch point states for this event.
@@ -4723,6 +4775,10 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
*/
/*!
+ \fn TouchPoint &TouchPoint::operator=(TouchPoint &&other)
+ \internal
+ */
+/*!
\fn void QTouchEvent::TouchPoint::swap(TouchPoint &other);
\internal
*/
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 54bd654ce5..f240153f9f 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1898,8 +1898,14 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
#if !defined(Q_OS_OSX)
// On OS X the shortcut override is checked earlier, see: QWindowSystemInterface::handleKeyEvent()
const bool checkShortcut = e->keyType == QEvent::KeyPress && window != 0;
- if (checkShortcut && QWindowSystemInterface::tryHandleShortcutEvent(window, e->timestamp, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount))
- return;
+ if (checkShortcut) {
+ QKeyEvent override(QEvent::ShortcutOverride, e->key, e->modifiers,
+ e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers,
+ e->unicode, e->repeat, e->repeatCount);
+ override.setTimestamp(e->timestamp);
+ if (QWindowSystemInterface::tryHandleShortcutOverrideEvent(window, &override))
+ return;
+ }
#endif // Q_OS_OSX
QKeyEvent ev(e->keyType, e->key, e->modifiers,
diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp
index b54b7b468c..f4b56fd01b 100644
--- a/src/gui/kernel/qsessionmanager.cpp
+++ b/src/gui/kernel/qsessionmanager.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\class QSessionManager
\brief The QSessionManager class provides access to the session manager.
- \inmodule QtWidgets
+ \inmodule QtGui
A session manager in a desktop environment (in which Qt GUI applications
live) keeps track of a session, which is a group of running applications,
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 5877467830..3ab2f59661 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -227,6 +227,22 @@ bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, ulong timestamp,
#endif
}
+bool QWindowSystemInterface::tryHandleShortcutOverrideEvent(QWindow *w, QKeyEvent *ev)
+{
+#ifndef QT_NO_SHORTCUT
+ Q_ASSERT(ev->type() == QKeyEvent::ShortcutOverride);
+
+ QObject *focus = w->focusObject();
+ if (!focus)
+ focus = w;
+ return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, ev);
+#else
+ Q_UNUSED(w)
+ Q_UNUSED(ev)
+ return false;
+#endif
+}
+
// used by QTestLib to directly send shortcuts to objects
bool QWindowSystemInterface::tryHandleShortcutEventToObject(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods,
const QString &text, bool autorep, ushort count)
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 7ad491cdac..453dbe81cf 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -78,6 +78,8 @@ public:
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+ static bool tryHandleShortcutOverrideEvent(QWindow *w, QKeyEvent *ev);
+
static bool tryHandleShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods,
const QString & text = QString(), bool autorep = false, ushort count = 1);
static bool tryHandleShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods,
diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp
index 7b46bb452c..2c9dfd8bb5 100644
--- a/src/gui/math3d/qgenericmatrix.cpp
+++ b/src/gui/math3d/qgenericmatrix.cpp
@@ -69,12 +69,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QGenericMatrix::QGenericMatrix(const QGenericMatrix<N, M, T>& other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
\fn QGenericMatrix::QGenericMatrix(const T *values)
Constructs a matrix from the given N * M floating-point \a values.
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp
index e747372df9..8b2ffb1a20 100644
--- a/src/gui/opengl/qopengldebug.cpp
+++ b/src/gui/opengl/qopengldebug.cpp
@@ -916,6 +916,12 @@ QOpenGLDebugMessage &QOpenGLDebugMessage::operator=(const QOpenGLDebugMessage &d
}
/*!
+ \fn QOpenGLDebugMessage &QOpenGLDebugMessage::operator=(QOpenGLDebugMessage &&debugMessage)
+
+ Move-assigns \a debugMessage to this object.
+*/
+
+/*!
\fn void QOpenGLDebugMessage::swap(QOpenGLDebugMessage &debugMessage)
Swaps the message \a debugMessage with this message. This operation is very
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 9b82233b9a..301b2ad13d 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -179,8 +179,9 @@ void QOpenGLTexturePrivate::destroy()
// not created or already destroyed
return;
}
- if (QOpenGLContext::currentContext() != context) {
- qWarning("Requires a valid current OpenGL context.\n"
+ QOpenGLContext *currentContext = QOpenGLContext::currentContext();
+ if (!currentContext || !QOpenGLContext::areSharing(currentContext, context)) {
+ qWarning("Texture is not valid in the current context.\n"
"Texture has not been destroyed");
return;
}
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
index 346a526054..17cd55720a 100644
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ b/src/gui/opengl/qopenglversionfunctions.cpp
@@ -186,11 +186,17 @@ void QAbstractOpenGLFunctionsPrivate::removeExternalFunctions(QOpenGLContext *co
\sa QOpenGLContext::versionFunctions()
*/
+/*!
+ Constructs a QAbstractOpenGLFunctions object.
+*/
QAbstractOpenGLFunctions::QAbstractOpenGLFunctions()
: d_ptr(new QAbstractOpenGLFunctionsPrivate)
{
}
+/*!
+ Destroys a QAbstractOpenGLFunctions object.
+*/
QAbstractOpenGLFunctions::~QAbstractOpenGLFunctions()
{
Q_D(QAbstractOpenGLFunctions);
@@ -228,12 +234,16 @@ bool QAbstractOpenGLFunctions::isInitialized() const
return d->initialized;
}
+/*! \internal
+ */
void QAbstractOpenGLFunctions::setOwningContext(const QOpenGLContext *context)
{
Q_D(QAbstractOpenGLFunctions);
d->owningContext = const_cast<QOpenGLContext*>(context);
}
+/*! \internal
+ */
QOpenGLContext *QAbstractOpenGLFunctions::owningContext() const
{
Q_D(const QAbstractOpenGLFunctions);
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 4136c29d4e..68ed3eae6e 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -235,16 +235,27 @@ bool QBackingStore::scroll(const QRegion &area, int dx, int dy)
return d_ptr->platformBackingStore->scroll(QHighDpi::toNativeLocalRegion(area, d_ptr->window), QHighDpi::toNativePixels(dx, d_ptr->window), QHighDpi::toNativePixels(dy, d_ptr->window));
}
+/*!
+ Set \a region as the static contents of this window.
+*/
void QBackingStore::setStaticContents(const QRegion &region)
{
d_ptr->staticContents = region;
}
+/*!
+ Returns a pointer to the QRegion that has the static contents
+ of this window.
+*/
QRegion QBackingStore::staticContents() const
{
return d_ptr->staticContents;
}
+/*!
+ Returns a boolean indicating if this window
+ has static contents or not.
+*/
bool QBackingStore::hasStaticContents() const
{
return !d_ptr->staticContents.isEmpty();
@@ -297,6 +308,9 @@ void Q_GUI_EXPORT qt_scrollRectInImage(QImage &img, const QRect &rect, const QPo
}
}
+/*!
+ Returns a pointer to the QPlatformBackingStore implementation
+*/
QPlatformBackingStore *QBackingStore::handle() const
{
return d_ptr->platformBackingStore;
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index d6eb8d8a48..9e039b7ae4 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -35,7 +35,7 @@
#include "qpixmap.h"
#include "qbitmap.h"
#include "qpixmapcache.h"
-#include "qplatformpixmap.h"
+#include <qpa/qplatformpixmap.h>
#include "qdatastream.h"
#include "qvariant.h"
#include "qline.h"
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 28a6276746..6b8136c52d 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3277,6 +3277,10 @@ bool QRasterPaintEngine::requiresPretransformedGlyphPositions(QFontEngine *fontE
return QPaintEngineEx::requiresPretransformedGlyphPositions(fontEngine, m);
}
+/*!
+ Indicates whether glyph caching is supported by the font engine
+ \a fontEngine with the given transform \a m applied.
+*/
bool QRasterPaintEngine::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const
{
// The raster engine does not support projected cached glyph drawing
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index eb9cfcac2a..0814e0494d 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -2012,8 +2012,8 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from
if (reflect && step % 2) {
for (int i = stops.size() - 1; i > 0; --i) {
QGradientBound b;
- b.start = step + 1 - qBound(0., stops.at(i).first, 1.);
- b.stop = step + 1 - qBound(0., stops.at(i - 1).first, 1.);
+ b.start = step + 1 - qBound(qreal(0.), stops.at(i).first, qreal(1.));
+ b.stop = step + 1 - qBound(qreal(0.), stops.at(i - 1).first, qreal(1.));
b.function = functions.at(i - 1);
b.reverse = true;
gradientBounds << b;
@@ -2021,8 +2021,8 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from
} else {
for (int i = 0; i < stops.size() - 1; ++i) {
QGradientBound b;
- b.start = step + qBound(0., stops.at(i).first, 1.);
- b.stop = step + qBound(0., stops.at(i + 1).first, 1.);
+ b.start = step + qBound(qreal(0.), stops.at(i).first, qreal(1.));
+ b.stop = step + qBound(qreal(0.), stops.at(i + 1).first, qreal(1.));
b.function = functions.at(i);
b.reverse = false;
gradientBounds << b;
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 0b0940855d..80908122a8 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -72,12 +72,14 @@ QT_BEGIN_NAMESPACE
#define SMOOTH_SCALABLE 0xffff
+#if defined(QT_BUILD_INTERNAL)
bool qt_enable_test_font = false;
Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value)
{
qt_enable_test_font = value;
}
+#endif
static int getFontWeight(const QString &weightString)
{
@@ -756,7 +758,47 @@ QString qt_resolveFontFamilyAlias(const QString &alias)
return alias;
}
-static QStringList fallbackFamilies(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
+QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
+{
+ Q_UNUSED(family);
+ Q_UNUSED(styleHint);
+
+ QStringList retList;
+
+ size_t writingSystem = std::find(scriptForWritingSystem,
+ scriptForWritingSystem + QFontDatabase::WritingSystemsCount,
+ script) - scriptForWritingSystem;
+ if (writingSystem >= QFontDatabase::WritingSystemsCount)
+ writingSystem = QFontDatabase::Any;
+
+ QFontDatabasePrivate *db = privateDb();
+ for (int i = 0; i < db->count; ++i) {
+ QtFontFamily *f = db->families[i];
+
+ f->ensurePopulated();
+
+ if (writingSystem > QFontDatabase::Any && f->writingSystems[writingSystem] != QtFontFamily::Supported)
+ continue;
+
+ for (int j = 0; j < f->count; ++j) {
+ QtFontFoundry *foundry = f->foundries[j];
+
+ for (int k = 0; k < foundry->count; ++k) {
+ if (style == foundry->styles[k]->key.style) {
+ if (foundry->name.isEmpty())
+ retList.append(f->name);
+ else
+ retList.append(f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']'));
+ break;
+ }
+ }
+ }
+ }
+
+ return retList;
+}
+
+QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
{
// make sure that the db has all fallback families
QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
@@ -884,17 +926,19 @@ QFontEngine *loadEngine(int script, const QFontDef &request,
QFontEngine *engine = loadSingleEngine(script, request, family, foundry, style, size);
Q_ASSERT(!engine || engine->type() != QFontEngine::Multi);
if (engine && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol) {
- QStringList fallbacks = request.fallBackFamilies;
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));
+ if (!request.fallBackFamilies.isEmpty()) {
+ QStringList fallbacks = request.fallBackFamilies;
- QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
- if (styleHint == QFont::AnyStyle && request.fixedPitch)
- styleHint = QFont::TypeWriter;
+ QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
+ if (styleHint == QFont::AnyStyle && request.fixedPitch)
+ styleHint = QFont::TypeWriter;
- fallbacks += fallbackFamilies(family->name, QFont::Style(style->key.style), styleHint, QChar::Script(script));
+ fallbacks += qt_fallbacksForFamily(family->name, QFont::Style(style->key.style), styleHint, QChar::Script(script));
- QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
- QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));
- pfMultiEngine->setFallbackFamiliesList(fallbacks);
+ pfMultiEngine->setFallbackFamiliesList(fallbacks);
+ }
engine = pfMultiEngine;
// Cache Multi font engine as well in case we got the single
@@ -2527,6 +2571,15 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
QFontEngine *engine;
+#if defined(QT_BUILD_INTERNAL)
+ // For testing purpose only, emulates an exact-matching monospace font
+ if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
+ engine = new QTestFontEngine(request.pixelSize);
+ engine->fontDef = request;
+ return engine;
+ }
+#endif
+
// Until we specifically asked not to, try looking for Multi font engine
// first, the last '1' indicates that we want Multi font engine instead
// of single ones
@@ -2542,12 +2595,6 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
parseFontName(request.family, foundry_name, family_name);
- if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
- engine =new QTestFontEngine(request.pixelSize);
- engine->fontDef = request;
- return engine;
- }
-
QtFontDesc desc;
QList<int> blackListed;
int index = match(script, request, family_name, foundry_name, &desc, blackListed);
@@ -2568,10 +2615,10 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
styleHint = QFont::TypeWriter;
QStringList fallbacks = request.fallBackFamilies
- + fallbackFamilies(request.family,
- QFont::Style(request.style),
- styleHint,
- QChar::Script(script));
+ + qt_fallbacksForFamily(request.family,
+ QFont::Style(request.style),
+ styleHint,
+ QChar::Script(script));
if (script > QChar::Script_Common)
fallbacks += QString(); // Find the first font matching the specified script.
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 6f5d178655..f9d924d10a 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1590,15 +1590,15 @@ QFontEngineMulti::~QFontEngineMulti()
}
}
+QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script);
+
void QFontEngineMulti::ensureFallbackFamiliesQueried()
{
- if (QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration()) {
- const QStringList fallbackFamilies = integration->fontDatabase()->fallbacksForFamily(fontDef.family,
- QFont::Style(fontDef.style),
- QFont::AnyStyle,
- QChar::Script(m_script));
- setFallbackFamiliesList(fallbackFamilies);
- }
+ QFont::StyleHint styleHint = QFont::StyleHint(fontDef.styleHint);
+ if (styleHint == QFont::AnyStyle && fontDef.fixedPitch)
+ styleHint = QFont::TypeWriter;
+
+ setFallbackFamiliesList(qt_fallbacksForFamily(fontDef.family, QFont::Style(fontDef.style), styleHint, QChar::Script(m_script)));
}
void QFontEngineMulti::setFallbackFamiliesList(const QStringList &fallbackFamilies)
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index e351d4d2c5..5bc9fe3c7f 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -208,6 +208,11 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm)
\since 5.2
*/
+/*!
+ \fn QFontMetricsF &QFontMetricsF::operator=(QFontMetricsF &&other)
+
+ Move-assigns \a other to this QFontMetricsF instance.
+*/
/*!
\fn void QFontMetrics::swap(QFontMetrics &other)
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 482495302b..0695c2eff4 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -346,17 +346,15 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal
}
/*!
+ \fn QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
+
Returns a list of alternative fonts for the specified \a family and
\a style and \a script using the \a styleHint given.
+
+ Default implementation returns a list of fonts for which \a style and \a script support
+ has been reported during the font database population.
*/
-QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
-{
- Q_UNUSED(family);
- Q_UNUSED(style);
- Q_UNUSED(styleHint);
- Q_UNUSED(script);
- return QStringList();
-}
+// implemented in qfontdatabase.cpp
/*!
Adds an application font described by the font contained supplied \a fontData
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 40cca77c26..0affd3239d 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -135,9 +135,8 @@ bool Qt::mightBeRichText(const QString& text)
return false;
}
-/*!
- \fn QString Qt::convertFromPlainText(const QString &plain, WhiteSpaceMode mode)
+/*!
Converts the plain text string \a plain to an HTML-formatted
paragraph while preserving most of its look.
diff --git a/src/network/ssl/qasn1element_p.h b/src/network/ssl/qasn1element_p.h
index 68acbe33ee..e58b974661 100644
--- a/src/network/ssl/qasn1element_p.h
+++ b/src/network/ssl/qasn1element_p.h
@@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE
#define RSA_ENCRYPTION_OID QByteArrayLiteral("1.2.840.113549.1.1.1")
#define DSA_ENCRYPTION_OID QByteArrayLiteral("1.2.840.10040.4.1")
+#define EC_ENCRYPTION_OID QByteArrayLiteral("1.2.840.10045.2.1")
class Q_AUTOTEST_EXPORT QAsn1Element
{
@@ -80,6 +81,7 @@ public:
// context specific
Context0Type = 0xA0,
+ Context1Type = 0xA1,
Context3Type = 0xA3
};
diff --git a/src/network/ssl/qsslcertificate_qt.cpp b/src/network/ssl/qsslcertificate_qt.cpp
index 2d1dd68198..a283078998 100644
--- a/src/network/ssl/qsslcertificate_qt.cpp
+++ b/src/network/ssl/qsslcertificate_qt.cpp
@@ -366,8 +366,10 @@ bool QSslCertificatePrivate::parse(const QByteArray &data)
const QByteArray oid = elem.toObjectId();
if (oid == RSA_ENCRYPTION_OID)
publicKeyAlgorithm = QSsl::Rsa;
- else if (oid == RSA_ENCRYPTION_OID)
+ else if (oid == DSA_ENCRYPTION_OID)
publicKeyAlgorithm = QSsl::Dsa;
+ else if (oid == EC_ENCRYPTION_OID)
+ publicKeyAlgorithm = QSsl::Ec;
else
publicKeyAlgorithm = QSsl::Opaque;
diff --git a/src/network/ssl/qsslkey_qt.cpp b/src/network/ssl/qsslkey_qt.cpp
index 4f68912527..c4f8df86e2 100644
--- a/src/network/ssl/qsslkey_qt.cpp
+++ b/src/network/ssl/qsslkey_qt.cpp
@@ -59,6 +59,47 @@ static const quint8 bits_table[256] = {
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
};
+// OIDs of named curves allowed in TLS as per RFCs 4492 and 7027,
+// see also https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8
+
+typedef QMap<QByteArray, int> OidLengthMap;
+static OidLengthMap createOidMap()
+{
+ OidLengthMap oids;
+ oids.insert(oids.cend(), QByteArrayLiteral("1.2.840.10045.3.1.1"), 192); // secp192r1 a.k.a prime192v1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.2.840.10045.3.1.7"), 256); // secp256r1 a.k.a prime256v1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.1"), 193); // sect193r2
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.10"), 256); // secp256k1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.16"), 283); // sect283k1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.17"), 283); // sect283r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.26"), 233); // sect233k1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.27"), 233); // sect233r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.3"), 239); // sect239k1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.30"), 160); // secp160r2
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.31"), 192); // secp192k1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.32"), 224); // secp224k1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.33"), 224); // secp224r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.34"), 384); // secp384r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.35"), 521); // secp521r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.36"), 409); // sect409k1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.37"), 409); // sect409r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.38"), 571); // sect571k1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.39"), 571); // sect571r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.8"), 160); // secp160r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.9"), 160); // secp160k1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.11"), 384); // brainpoolP384r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.13"), 521); // brainpoolP512r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.7"), 256); // brainpoolP256r1
+ return oids;
+}
+Q_GLOBAL_STATIC_WITH_ARGS(OidLengthMap, oidLengthMap, (createOidMap()))
+
+static int curveBits(const QByteArray &oid)
+{
+ const int length = oidLengthMap->value(oid);
+ return length ? length : -1;
+}
+
static int numberOfBits(const QByteArray &modulus)
{
int bits = modulus.size() * 8;
@@ -146,6 +187,12 @@ void QSslKeyPrivate::decodeDer(const QByteArray &der, bool deepClear)
if (params.isEmpty() || params[0].type() != QAsn1Element::IntegerType)
return;
keyLength = numberOfBits(params[0].value());
+ } else if (algorithm == QSsl::Ec) {
+ if (infoItems[0].toObjectId() != EC_ENCRYPTION_OID)
+ return;
+ if (infoItems[1].type() != QAsn1Element::ObjectIdentifierType)
+ return;
+ keyLength = curveBits(infoItems[1].toObjectId());
}
} else {
@@ -154,17 +201,35 @@ void QSslKeyPrivate::decodeDer(const QByteArray &der, bool deepClear)
return;
// version
- if (items[0].type() != QAsn1Element::IntegerType || items[0].value().toHex() != "00")
+ if (items[0].type() != QAsn1Element::IntegerType)
return;
+ const QByteArray versionHex = items[0].value().toHex();
if (algorithm == QSsl::Rsa) {
+ if (versionHex != "00")
+ return;
if (items.size() != 9 || items[1].type() != QAsn1Element::IntegerType)
return;
keyLength = numberOfBits(items[1].value());
} else if (algorithm == QSsl::Dsa) {
+ if (versionHex != "00")
+ return;
if (items.size() != 6 || items[1].type() != QAsn1Element::IntegerType)
return;
keyLength = numberOfBits(items[1].value());
+ } else if (algorithm == QSsl::Ec) {
+ if (versionHex != "01")
+ return;
+ if (items.size() != 4
+ || items[1].type() != QAsn1Element::OctetStringType
+ || items[2].type() != QAsn1Element::Context0Type
+ || items[3].type() != QAsn1Element::Context1Type)
+ return;
+ QAsn1Element oidElem;
+ if (!oidElem.read(items[2].value())
+ || oidElem.type() != QAsn1Element::ObjectIdentifierType)
+ return;
+ keyLength = curveBits(oidElem.toObjectId());
}
}
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index b9b49ac26e..c15045b180 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -500,6 +500,7 @@ bool QSslSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState state
bool retVal = d->plainSocket->setSocketDescriptor(socketDescriptor, state, openMode);
d->cachedSocketDescriptor = d->plainSocket->socketDescriptor();
setSocketError(d->plainSocket->error());
+ setErrorString(d->plainSocket->errorString());
setSocketState(state);
setOpenMode(openMode);
setLocalPort(d->plainSocket->localPort());
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 3bcb8925c1..1634d65eb6 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -380,12 +380,9 @@ bool QSslSocketBackendPrivate::initSslContext()
return false;
}
- if ((configuration.protocol == QSsl::TlsV1SslV3 ||
- configuration.protocol == QSsl::TlsV1_0 ||
- configuration.protocol == QSsl::TlsV1_1 ||
- configuration.protocol == QSsl::TlsV1_2 ||
- configuration.protocol == QSsl::SecureProtocols ||
- configuration.protocol == QSsl::AnyProtocol) &&
+ if (configuration.protocol != QSsl::SslV2 &&
+ configuration.protocol != QSsl::SslV3 &&
+ configuration.protocol != QSsl::UnknownProtocol &&
mode == QSslSocket::SslClientMode && q_SSLeay() >= 0x00090806fL) {
// Set server hostname on TLS extension. RFC4366 section 3.1 requires it in ACE format.
QString tlsHostName = verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName;
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index 8e5d93dce2..903f34f939 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -424,11 +424,10 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS
if (!inCache)
shaderCache.store(newProg->program, QGLContext::currentContext());
} else {
- QLatin1String none("none");
- QLatin1String br("\n");
QString error;
error = QLatin1String("Shader program failed to link,");
#if defined(QT_DEBUG)
+ QLatin1String br("\n");
error += QLatin1String("\n Shaders Used:\n");
for (int i = 0; i < newProg->program->shaders().count(); ++i) {
QGLShader *shader = newProg->program->shaders().at(i);
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 63ebf14bd5..d84b59efff 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2168,6 +2168,9 @@ QGLContext::QGLContext(QOpenGLContext *context)
d->setupSharing();
}
+/*!
+ Returns the OpenGL context handle.
+*/
QOpenGLContext *QGLContext::contextHandle() const
{
Q_D(const QGLContext);
@@ -2175,7 +2178,7 @@ QOpenGLContext *QGLContext::contextHandle() const
}
/*!
- Returns a OpenGL context for the window context specified by the \a context
+ Returns an OpenGL context for the window context specified by the \a context
parameter.
*/
QGLContext *QGLContext::fromOpenGLContext(QOpenGLContext *context)
@@ -4355,7 +4358,7 @@ void QGLWidget::resizeOverlayGL(int, int)
}
/*!\reimp
- */
+*/
bool QGLWidget::event(QEvent *e)
{
Q_D(QGLWidget);
diff --git a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc
index a02f93968d..b26255553f 100644
--- a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc
+++ b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc
@@ -208,3 +208,4 @@
Returns the unsigned integer result of calling the function or
UINT_MAX if the function was not found.
*/
+
diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
index 65cdabdf5b..c41061a9fd 100644
--- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
+++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
@@ -55,23 +55,24 @@ QT_BEGIN_NAMESPACE
void QBasicFontDatabase::populateFontDatabase()
{
QString fontpath = fontDir();
+ QDir dir(fontpath);
- if(!QFile::exists(fontpath)) {
+ if (!dir.exists()) {
qWarning("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?",
qPrintable(fontpath));
return;
}
- QDir dir(fontpath);
- dir.setNameFilters(QStringList() << QLatin1String("*.ttf")
- << QLatin1String("*.ttc") << QLatin1String("*.pfa")
- << QLatin1String("*.pfb")
- << QLatin1String("*.otf"));
- dir.refresh();
- for (int i = 0; i < int(dir.count()); ++i) {
- const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i]));
-// qDebug() << "looking at" << file;
- addTTFile(QByteArray(), file);
+ QStringList nameFilters;
+ nameFilters << QLatin1String("*.ttf")
+ << QLatin1String("*.ttc")
+ << QLatin1String("*.pfa")
+ << QLatin1String("*.pfb")
+ << QLatin1String("*.otf");
+
+ foreach (const QFileInfo &fi, dir.entryInfoList(nameFilters, QDir::Files)) {
+ const QByteArray file = QFile::encodeName(fi.absoluteFilePath());
+ QBasicFontDatabase::addTTFile(QByteArray(), file);
}
}
@@ -176,18 +177,9 @@ QFontEngine *QBasicFontDatabase::fontEngine(const QByteArray &fontData, qreal pi
return fe;
}
-QStringList QBasicFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
-{
- Q_UNUSED(family);
- Q_UNUSED(style);
- Q_UNUSED(script);
- Q_UNUSED(styleHint);
- return QStringList();
-}
-
QStringList QBasicFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
{
- return addTTFile(fontData,fileName.toLocal8Bit());
+ return QBasicFontDatabase::addTTFile(fontData, fileName.toLocal8Bit());
}
void QBasicFontDatabase::releaseHandle(void *handle)
@@ -198,7 +190,7 @@ void QBasicFontDatabase::releaseHandle(void *handle)
extern FT_Library qt_getFreetype();
-QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file, QSupportedWritingSystems *supportedWritingSystems)
+QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file)
{
FT_Library library = qt_getFreetype();
@@ -237,8 +229,6 @@ QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByt
if (cm->encoding == FT_ENCODING_ADOBE_CUSTOM
|| cm->encoding == FT_ENCODING_MS_SYMBOL) {
writingSystems.setSupported(QFontDatabase::Symbol);
- if (supportedWritingSystems)
- supportedWritingSystems->setSupported(QFontDatabase::Symbol);
break;
}
}
@@ -257,8 +247,6 @@ QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByt
};
writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
- if (supportedWritingSystems)
- *supportedWritingSystems = writingSystems;
if (os2->usWeightClass) {
weight = QPlatformFontDatabase::weightFromInteger(os2->usWeightClass);
diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h
index 3fe1a04b0f..f78587e296 100644
--- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h
@@ -63,11 +63,10 @@ public:
void populateFontDatabase() Q_DECL_OVERRIDE;
QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE;
QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE;
- QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const Q_DECL_OVERRIDE;
QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE;
void releaseHandle(void *handle) Q_DECL_OVERRIDE;
- static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file, QSupportedWritingSystems *supportedWritingSystems = 0);
+ static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file);
};
QT_END_NAMESPACE
diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro
index 898f06e7c7..2a5048bb1c 100644
--- a/src/plugins/imageformats/gif/gif.pro
+++ b/src/plugins/imageformats/gif/gif.pro
@@ -5,6 +5,7 @@ PLUGIN_CLASS_NAME = QGifPlugin
load(qt_plugin)
include(../../../gui/image/qgifhandler.pri)
+INCLUDEPATH += ../../../gui/image
SOURCES += $$PWD/main.cpp
HEADERS += $$PWD/main.h
OTHER_FILES += gif.json
diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
index 45bf7bbd43..e33fde1cdb 100644
--- a/src/plugins/imageformats/jpeg/jpeg.pro
+++ b/src/plugins/imageformats/jpeg/jpeg.pro
@@ -9,6 +9,7 @@ QT += core-private
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-jpeg)"
include(../../../gui/image/qjpeghandler.pri)
+INCLUDEPATH += ../../../gui/image
SOURCES += main.cpp
HEADERS += main.h
OTHER_FILES += jpeg.json
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 19ab051162..cd40b7eec2 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -443,6 +443,11 @@ static void *startMainMethod(void */*data*/)
if (m_applicationClass)
QJNIObjectPrivate::callStaticMethod<void>(m_applicationClass, "quitApp", "()V");
+ // All attached threads should be detached before returning from this function.
+ JavaVM *vm = QtAndroidPrivate::javaVM();
+ if (vm != 0)
+ vm->DetachCurrentThread();
+
return 0;
}
diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
index 9b60ab291c..be1a3d7bdf 100644
--- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
+++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
@@ -45,26 +45,20 @@ QString QAndroidPlatformFontDatabase::fontDir() const
void QAndroidPlatformFontDatabase::populateFontDatabase()
{
QString fontpath = fontDir();
+ QDir dir(fontpath);
- if (!QFile::exists(fontpath)) {
+ if (!dir.exists()) {
qFatal("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?",
qPrintable(fontpath));
}
- QDir dir(fontpath);
- QList<QFileInfo> entries = dir.entryInfoList(QStringList() << QStringLiteral("*.ttf") << QStringLiteral("*.otf"), QDir::Files);
- for (int i = 0; i < int(entries.count()); ++i) {
- const QByteArray file = QFile::encodeName(entries.at(i).absoluteFilePath());
- QSupportedWritingSystems supportedWritingSystems;
- QStringList families = addTTFile(QByteArray(), file, &supportedWritingSystems);
+ QStringList nameFilters;
+ nameFilters << QLatin1String("*.ttf")
+ << QLatin1String("*.otf");
- extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem);
- for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
- if (i == QFontDatabase::Any || supportedWritingSystems.supported(QFontDatabase::WritingSystem(i))) {
- QChar::Script script = QChar::Script(qt_script_for_writing_system(QFontDatabase::WritingSystem(i)));
- m_fallbacks[script] += families;
- }
- }
+ foreach (const QFileInfo &fi, dir.entryInfoList(nameFilters, QDir::Files)) {
+ const QByteArray file = QFile::encodeName(fi.absoluteFilePath());
+ QBasicFontDatabase::addTTFile(QByteArray(), file);
}
}
@@ -73,15 +67,16 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami
QFont::StyleHint styleHint,
QChar::Script script) const
{
- Q_UNUSED(family);
- Q_UNUSED(style);
-
+ QStringList result;
if (styleHint == QFont::Monospace || styleHint == QFont::Courier)
- return QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";") + m_fallbacks[script];
+ result.append(QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";"));
else if (styleHint == QFont::Serif)
- return QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(";") + m_fallbacks[script];
+ result.append(QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(";"));
+ else
+ result.append(QString(qgetenv("QT_ANDROID_FONTS")).split(";"));
+ result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script));
- return QString(qgetenv("QT_ANDROID_FONTS")).split(";") + m_fallbacks[script];
+ return result;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.h b/src/plugins/platforms/android/qandroidplatformfontdatabase.h
index 45de47a58c..89a9ed8bc0 100644
--- a/src/plugins/platforms/android/qandroidplatformfontdatabase.h
+++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.h
@@ -47,9 +47,6 @@ public:
QFont::Style style,
QFont::StyleHint styleHint,
QChar::Script script) const;
-
-private:
- QHash<QChar::Script, QStringList> m_fallbacks;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 4309702fd5..edcbd16dca 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1435,8 +1435,12 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
if (eventType == QEvent::KeyPress) {
- if (m_composingText.isEmpty())
- m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(focusWindow, timestamp, keyCode, modifiers, text, [nsevent isARepeat], 1);
+ if (m_composingText.isEmpty()) {
+ QKeyEvent override(QEvent::ShortcutOverride, keyCode, modifiers,
+ nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1);
+ override.setTimestamp(timestamp);
+ m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutOverrideEvent(focusWindow, &override);
+ }
QObject *fo = QGuiApplication::focusObject();
if (m_sendKeyEvent && fo) {
diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h
index e550efe7c3..ec678fee44 100644
--- a/src/plugins/platforms/ios/qioscontext.h
+++ b/src/plugins/platforms/ios/qioscontext.h
@@ -50,15 +50,15 @@ public:
QIOSContext(QOpenGLContext *context);
~QIOSContext();
- QSurfaceFormat format() const;
+ QSurfaceFormat format() const Q_DECL_OVERRIDE;
- void swapBuffers(QPlatformSurface *surface);
+ void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
- bool makeCurrent(QPlatformSurface *surface);
- void doneCurrent();
+ bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
+ void doneCurrent() Q_DECL_OVERRIDE;
- GLuint defaultFramebufferObject(QPlatformSurface *) const;
- QFunctionPointer getProcAddress(const QByteArray &procName);
+ GLuint defaultFramebufferObject(QPlatformSurface *) const Q_DECL_OVERRIDE;
+ QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE;
bool isSharing() const Q_DECL_OVERRIDE;
bool isValid() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm
index f0b6afce2d..761a89c989 100644
--- a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm
+++ b/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm
@@ -304,7 +304,7 @@ public:
return g_iteratorCurrentUrl.localData();
}
- QFileInfo currentFileInfo() const
+ QFileInfo currentFileInfo() const Q_DECL_OVERRIDE
{
return QFileInfo(currentFileName());
}
diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h
index 0fe318dce7..7d23fe1d62 100644
--- a/src/plugins/platforms/ios/qiosintegration.h
+++ b/src/plugins/platforms/ios/qiosintegration.h
@@ -54,26 +54,26 @@ public:
QIOSIntegration();
~QIOSIntegration();
- bool hasCapability(Capability cap) const;
+ bool hasCapability(Capability cap) const Q_DECL_OVERRIDE;
- QPlatformWindow *createPlatformWindow(QWindow *window) const;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
- QPlatformFontDatabase *fontDatabase() const;
- QPlatformClipboard *clipboard() const;
- QPlatformInputContext *inputContext() const;
+ QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
+ QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE;
+ QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
QPlatformServices *services() const Q_DECL_OVERRIDE;
- QVariant styleHint(StyleHint hint) const;
+ QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE;
- QStringList themeNames() const;
- QPlatformTheme *createPlatformTheme(const QString &name) const;
+ QStringList themeNames() const Q_DECL_OVERRIDE;
+ QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE;
- QAbstractEventDispatcher *createEventDispatcher() const;
- QPlatformNativeInterface *nativeInterface() const;
+ QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
+ QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
QTouchDevice *touchDevice();
QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE;
@@ -86,7 +86,7 @@ public:
// -- QPlatformNativeInterface --
- void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
+ void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE;
void setDebugWindowManagement(bool);
bool debugWindowManagement() const;
diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm
index b4050b8f62..eaff0daf19 100644
--- a/src/plugins/platforms/ios/qiosintegration.mm
+++ b/src/plugins/platforms/ios/qiosintegration.mm
@@ -81,7 +81,7 @@ QIOSIntegration::QIOSIntegration()
// QPlatformBackingStore.
qApp->setAttribute(Qt::AA_ShareOpenGLContexts, true);
// And that context must match the format used for the backingstore's context.
- QSurfaceFormat fmt;
+ QSurfaceFormat fmt = QSurfaceFormat::defaultFormat();
fmt.setDepthBufferSize(16);
fmt.setStencilBufferSize(8);
QSurfaceFormat::setDefaultFormat(fmt);
diff --git a/src/plugins/platforms/ios/qiosmenu.h b/src/plugins/platforms/ios/qiosmenu.h
index 15f200bb27..4fa0416df7 100644
--- a/src/plugins/platforms/ios/qiosmenu.h
+++ b/src/plugins/platforms/ios/qiosmenu.h
@@ -112,7 +112,7 @@ public:
static id menuActionTarget() { return m_currentMenu ? m_currentMenu->m_menuController : 0; }
protected:
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
private:
quintptr m_tag;
diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h
index a638210c00..a0aa922a31 100644
--- a/src/plugins/platforms/ios/qiosscreen.h
+++ b/src/plugins/platforms/ios/qiosscreen.h
@@ -50,17 +50,17 @@ public:
QIOSScreen(UIScreen *screen);
~QIOSScreen();
- QRect geometry() const;
- QRect availableGeometry() const;
- int depth() const;
- QImage::Format format() const;
- QSizeF physicalSize() const;
- QDpi logicalDpi() const;
- qreal devicePixelRatio() const;
+ QRect geometry() const Q_DECL_OVERRIDE;
+ QRect availableGeometry() const Q_DECL_OVERRIDE;
+ int depth() const Q_DECL_OVERRIDE;
+ QImage::Format format() const Q_DECL_OVERRIDE;
+ QSizeF physicalSize() const Q_DECL_OVERRIDE;
+ QDpi logicalDpi() const Q_DECL_OVERRIDE;
+ qreal devicePixelRatio() const Q_DECL_OVERRIDE;
- Qt::ScreenOrientation nativeOrientation() const;
- Qt::ScreenOrientation orientation() const;
- void setOrientationUpdateMask(Qt::ScreenOrientations mask);
+ Qt::ScreenOrientation nativeOrientation() const Q_DECL_OVERRIDE;
+ Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE;
+ void setOrientationUpdateMask(Qt::ScreenOrientations mask) Q_DECL_OVERRIDE;
UIScreen *uiScreen() const;
UIWindow *uiWindow() const;
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index d86f545154..e2c61e1161 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -221,6 +221,8 @@
self.keyboardType = UIKeyboardTypePhonePad;
else if (hints & Qt::ImhLatinOnly)
self.keyboardType = UIKeyboardTypeASCIICapable;
+ else if (hints & Qt::ImhPreferNumbers)
+ self.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
else
self.keyboardType = UIKeyboardTypeDefault;
diff --git a/src/plugins/platforms/ios/qiostheme.h b/src/plugins/platforms/ios/qiostheme.h
index 9ef179b4dc..58144cb239 100644
--- a/src/plugins/platforms/ios/qiostheme.h
+++ b/src/plugins/platforms/ios/qiostheme.h
@@ -47,7 +47,7 @@ public:
~QIOSTheme();
const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
- QVariant themeHint(ThemeHint hint) const;
+ QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE;
QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE;
@@ -55,7 +55,7 @@ public:
bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE;
QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE;
- const QFont *font(Font type = SystemFont) const;
+ const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE;
static const char *name;
diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h
index c53eee1afd..0c65cf8aa5 100644
--- a/src/plugins/platforms/ios/qioswindow.h
+++ b/src/plugins/platforms/ios/qioswindow.h
@@ -54,29 +54,29 @@ public:
explicit QIOSWindow(QWindow *window);
~QIOSWindow();
- void setGeometry(const QRect &rect);
+ void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
- void setWindowState(Qt::WindowState state);
- void setParent(const QPlatformWindow *window);
- void handleContentOrientationChange(Qt::ScreenOrientation orientation);
- void setVisible(bool visible);
+ void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE;
+ void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE;
+ void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) Q_DECL_OVERRIDE;
void setOpacity(qreal level) Q_DECL_OVERRIDE;
bool isExposed() const Q_DECL_OVERRIDE;
void propagateSizeHints() Q_DECL_OVERRIDE {}
- void raise() { raiseOrLower(true); }
- void lower() { raiseOrLower(false); }
+ void raise() Q_DECL_OVERRIDE{ raiseOrLower(true); }
+ void lower() Q_DECL_OVERRIDE { raiseOrLower(false); }
bool shouldAutoActivateWindow() const;
- void requestActivateWindow();
+ void requestActivateWindow() Q_DECL_OVERRIDE;
- qreal devicePixelRatio() const;
+ qreal devicePixelRatio() const Q_DECL_OVERRIDE;
- bool setMouseGrabEnabled(bool grab) { return grab; }
- bool setKeyboardGrabEnabled(bool grab) { return grab; }
+ bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; }
+ bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; }
- WId winId() const { return WId(m_view); };
+ WId winId() const Q_DECL_OVERRIDE { return WId(m_view); }
void clearAccessibleCache();
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index 8b67f235bb..2189938248 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -689,7 +689,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildI
return E_INVALIDARG;
QAccessibleInterface *acc = childPointer(accessible, varChildID);
- if (acc) {
+ if (acc && acc->isValid()) {
*ppdispChild = QWindowsAccessibility::wrap(acc);
return S_OK;
}
@@ -778,7 +778,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDescription(VARIANT var
QString descr;
if (varID.lVal) {
QAccessibleInterface *child = childPointer(accessible, varID);
- if (!child)
+ if (!child || !child->isValid())
return E_FAIL;
descr = child->text(QAccessible::Description);
} else {
@@ -803,7 +803,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accHelp(VARIANT varID, BST
QString help;
if (varID.lVal) {
QAccessibleInterface *child = childPointer(accessible, varID);
- if (!child)
+ if (!child || !child->isValid())
return E_FAIL;
help = child->text(QAccessible::Help);
} else {
@@ -862,7 +862,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BST
QString name;
if (varID.lVal) {
QAccessibleInterface *child = childPointer(accessible, varID);
- if (!child)
+ if (!child || !child->isValid())
return E_FAIL;
name = child->text(QAccessible::Name);
if (name.isEmpty()) {
@@ -910,7 +910,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VAR
QAccessible::Role role;
if (varID.lVal) {
QAccessibleInterface *child = childPointer(accessible, varID);
- if (!child)
+ if (!child || !child->isValid())
return E_FAIL;
role = child->role();
} else {
@@ -947,7 +947,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accState(VARIANT varID, VA
QAccessible::State state;
if (varID.lVal) {
QAccessibleInterface *child = childPointer(accessible, varID);
- if (!child)
+ if (!child || !child->isValid())
return E_FAIL;
state = child->state();
} else {
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index 4cea845c36..925427ac30 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -69,25 +69,28 @@ static const char formatTextHtmlC[] = "text/html";
\ingroup qt-lighthouse-win
*/
-QDebug operator<<(QDebug d, const QMimeData &m)
+static QDebug operator<<(QDebug d, const QMimeData *mimeData)
{
QDebugStateSaver saver(d);
d.nospace();
- const QStringList formats = m.formats();
- d << "QMimeData: " << formats.join(QStringLiteral(", ")) << '\n'
- << " Text=" << m.hasText() << " HTML=" << m.hasHtml()
- << " Color=" << m.hasColor() << " Image=" << m.hasImage()
- << " URLs=" << m.hasUrls() << '\n';
- if (m.hasText())
- d << " Text: '" << m.text() << "'\n";
- if (m.hasHtml())
- d << " HTML: '" << m.html() << "'\n";
- if (m.hasColor())
- d << " Color: " << qvariant_cast<QColor>(m.colorData()) << '\n';
- if (m.hasImage())
- d << " Image: " << qvariant_cast<QImage>(m.imageData()).size() << '\n';
- if (m.hasUrls())
- d << " URLs: " << m.urls() << '\n';
+ d << "QMimeData(";
+ if (mimeData) {
+ const QStringList formats = mimeData->formats();
+ d << "formats=" << formats.join(QStringLiteral(", "));
+ if (mimeData->hasText())
+ d << ", text=" << mimeData->text();
+ if (mimeData->hasHtml())
+ d << ", html=" << mimeData->html();
+ if (mimeData->hasColor())
+ d << ", colorData=" << qvariant_cast<QColor>(mimeData->colorData());
+ if (mimeData->hasImage())
+ d << ", imageData=" << qvariant_cast<QImage>(mimeData->imageData());
+ if (mimeData->hasUrls())
+ d << ", urls=" << mimeData->urls();
+ } else {
+ d << '0';
+ }
+ d << ')';
return d;
}
@@ -297,7 +300,7 @@ QMimeData *QWindowsClipboard::mimeData(QClipboard::Mode mode)
void QWindowsClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode)
{
- qCDebug(lcQpaMime) << __FUNCTION__ << mode << *mimeData;
+ qCDebug(lcQpaMime) << __FUNCTION__ << mode << mimeData;
if (mode != QClipboard::Clipboard)
return;
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 27323a2fd6..717adcc47f 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -918,7 +918,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::InputMethodRequest:
return QWindowsInputContext::instance()->handleIME_Request(wParam, lParam, result);
case QtWindows::GestureEvent:
- return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
+#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+ return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
+#else
+ return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
+#endif
case QtWindows::InputMethodOpenCandidateWindowEvent:
case QtWindows::InputMethodCloseCandidateWindowEvent:
// TODO: Release/regrab mouse if a popup has mouse grab.
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 1c5b114efd..3b27964b0e 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -933,7 +933,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
}
static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric,
- int type, LPARAM)
+ int type, LPARAM registerAlias)
{
const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName);
const uchar charSet = f->elfLogFont.lfCharSet;
@@ -943,13 +943,13 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr
// NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is
// identical to a TEXTMETRIC except for the last four members, which we don't use
// anyway
- addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type, false);
+ addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type, registerAlias);
// keep on enumerating
return 1;
}
-void QWindowsFontDatabase::populateFamily(const QString &familyName)
+void QWindowsFontDatabase::populateFamily(const QString &familyName, bool registerAlias)
{
qCDebug(lcQpaFonts) << familyName;
if (familyName.size() >= LF_FACESIZE) {
@@ -962,10 +962,15 @@ void QWindowsFontDatabase::populateFamily(const QString &familyName)
familyName.toWCharArray(lf.lfFaceName);
lf.lfFaceName[familyName.size()] = 0;
lf.lfPitchAndFamily = 0;
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, 0, 0);
+ EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, (LPARAM)registerAlias, 0);
ReleaseDC(0, dummy);
}
+void QWindowsFontDatabase::populateFamily(const QString &familyName)
+{
+ populateFamily(familyName, false);
+}
+
namespace {
// Context for enumerating system fonts, records whether the default font has been encountered,
// which is normally not enumerated by EnumFontFamiliesEx().
@@ -1075,11 +1080,7 @@ QWindowsFontDatabase::~QWindowsFontDatabase()
QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script)
{
- if (script == QChar::Script_Common)
- return new QWindowsMultiFontEngine(fontEngine, script);
- // ### as long as fallbacksForFamily() does not take script parameter into account,
- // prefer QFontEngineMulti's loadEngine() implementation for complex scripts
- return QPlatformFontDatabase::fontEngineMulti(fontEngine, script);
+ return new QWindowsMultiFontEngine(fontEngine, script);
}
QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle)
@@ -1382,7 +1383,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData,
// Fonts based on files are added via populate, as they will show up in font enumeration.
for (int j = 0; j < families.count(); ++j)
- populateFamily(families.at(j));
+ populateFamily(families.at(j), true);
}
m_applicationFonts << font;
@@ -1661,11 +1662,10 @@ QString QWindowsFontDatabase::familyForStyleHint(QFont::StyleHint styleHint)
QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
{
- QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script);
- if (!result.isEmpty())
- return result;
+ QStringList result;
result.append(QWindowsFontDatabase::familyForStyleHint(styleHint));
result.append(QWindowsFontDatabase::extraTryFontsForFamily(family));
+ result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script));
qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint
<< script << result;
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h
index 3615612c78..efb5421996 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.h
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h
@@ -100,6 +100,7 @@ public:
static QString familyForStyleHint(QFont::StyleHint styleHint);
private:
+ void populateFamily(const QString &familyName, bool registerAlias);
void removeApplicationFonts();
struct WinApplicationFont {
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index ad75a0bd54..795554698c 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -661,9 +661,7 @@ QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qrea
QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
{
- QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script);
- if (!result.isEmpty())
- return result;
+ QStringList result;
result.append(QWindowsFontDatabase::familyForStyleHint(styleHint));
@@ -679,6 +677,8 @@ QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QF
result.append(QWindowsFontDatabase::extraTryFontsForFamily(family));
+ result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script));
+
qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint
<< script << result;
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 05c7e6b240..f97c23c207 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -487,7 +487,7 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co
switch (hint) {
case QPlatformIntegration::CursorFlashTime:
if (const unsigned timeMS = GetCaretBlinkTime())
- return QVariant(int(timeMS) * 2);
+ return QVariant(timeMS != INFINITE ? int(timeMS) * 2 : 0);
break;
#ifdef SPI_GETKEYBOARDSPEED
case KeyboardAutoRepeatRate:
diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.h b/src/plugins/platforms/windows/qwindowsinternalmimedata.h
index 09ab417268..6a60a9676a 100644
--- a/src/plugins/platforms/windows/qwindowsinternalmimedata.h
+++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.h
@@ -55,8 +55,6 @@ protected:
virtual void releaseDataObject(IDataObject *) const {}
};
-QDebug operator<<(QDebug d, const QMimeData &m);
-
QT_END_NAMESPACE
#endif // QWINDOWSINTERNALMIME_H
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index a8aea05fd8..200eb11855 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -465,12 +465,11 @@ bool QWindowsMouseHandler::translateScrollEvent(QWindow *window, HWND,
}
// from bool QApplicationPrivate::translateTouchEvent()
-bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd,
+bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
QtWindows::WindowsEventType,
MSG msg, LRESULT *)
{
#ifndef Q_OS_WINCE
- Q_UNUSED(hwnd);
typedef QWindowSystemInterface::TouchPoint QTouchPoint;
typedef QList<QWindowSystemInterface::TouchPoint> QTouchPointList;
@@ -537,8 +536,24 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd,
QWindowSystemInterface::handleTouchEvent(window,
m_touchDevice,
touchPoints);
+#else // !Q_OS_WINCE
+ Q_UNUSED(window)
+ Q_UNUSED(msg)
+#endif
return true;
-#else //Q_OS_WINCE
+
+}
+
+bool QWindowsMouseHandler::translateGestureEvent(QWindow *window, HWND hwnd,
+ QtWindows::WindowsEventType,
+ MSG msg, LRESULT *)
+{
+#ifndef Q_OS_WINCE
+ Q_UNUSED(window)
+ Q_UNUSED(hwnd)
+ Q_UNUSED(msg)
+ return false;
+#else // !Q_OS_WINCE
GESTUREINFO gi;
memset(&gi, 0, sizeof(GESTUREINFO));
gi.cbSize = sizeof(GESTUREINFO);
@@ -617,9 +632,8 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd,
QWindowSystemInterface::handleEnterEvent(window);
m_windowUnderMouse = window;
}
-
return true;
-#endif
+#endif // Q_OS_WINCE
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h
index ce3e6b6fc4..61aa8d6084 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.h
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.h
@@ -59,6 +59,9 @@ public:
bool translateTouchEvent(QWindow *widget, HWND hwnd,
QtWindows::WindowsEventType t, MSG msg,
LRESULT *result);
+ bool translateGestureEvent(QWindow *window, HWND hwnd,
+ QtWindows::WindowsEventType,
+ MSG msg, LRESULT *);
bool translateScrollEvent(QWindow *window, HWND hwnd,
MSG msg, LRESULT *result);
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
index 6e58c55bbe..db8b2ec094 100644
--- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
@@ -135,7 +135,9 @@ QVariantMap QWindowsNativeInterface::windowProperties(QPlatformWindow *window) c
void *QWindowsNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
{
-#ifndef QT_NO_OPENGL
+#ifdef QT_NO_OPENGL
+ Q_UNUSED(resource)
+#else
if (resourceType(resource) == GlHandleType)
return QWindowsIntegration::staticOpenGLContext()->moduleHandle();
#endif
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 87747a74fd..1b5d7b87bc 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -2270,6 +2270,7 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins)
void *QWindowsWindow::surface(void *nativeConfig, int *err)
{
#ifdef QT_NO_OPENGL
+ Q_UNUSED(err)
Q_UNUSED(nativeConfig)
return 0;
#else
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 1fe46ff290..15d3575e60 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -55,7 +55,6 @@
#include <algorithm>
-#include <dlfcn.h>
#include <stdio.h>
#include <errno.h>
#include <xcb/shm.h>
@@ -77,6 +76,25 @@
#include <xcb/render.h>
#endif
+#if defined(Q_CC_GNU) && defined(Q_OF_ELF)
+static xcb_generic_event_t *local_xcb_poll_for_queued_event(xcb_connection_t *c)
+ __attribute__((weakref("xcb_poll_for_queued_event")));
+
+static inline void checkXcbPollForQueuedEvent()
+{ }
+#else
+#include <dlfcn.h>
+typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c);
+static XcbPollForQueuedEventFunctionPointer local_xcb_poll_for_queued_event;
+
+static inline void checkXcbPollForQueuedEvent()
+{
+#ifdef RTLD_DEFAULT
+ local_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event");
+#endif
+}
+#endif
+
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input")
@@ -252,16 +270,32 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
otherScreen->addVirtualSibling(screen);
m_screens << screen;
QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary());
+
+ // Windows which had null screens have already had expose events by now.
+ // They need to be told the screen is back, it's OK to render.
+ foreach (QWindow *window, QGuiApplication::topLevelWindows()) {
+ QXcbWindow *xcbWin = static_cast<QXcbWindow*>(window->handle());
+ if (xcbWin)
+ xcbWin->maybeSetScreen(screen);
+ }
}
// else ignore disabled screens
} else if (screen) {
// Screen has been disabled -> remove
if (output.crtc == XCB_NONE && output.mode == XCB_NONE) {
- qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled";
- m_screens.removeOne(screen);
- foreach (QXcbScreen *otherScreen, m_screens)
- otherScreen->removeVirtualSibling((QPlatformScreen *) screen);
- QXcbIntegration::instance()->destroyScreen(screen);
+ xcb_randr_get_output_info_cookie_t outputInfoCookie =
+ xcb_randr_get_output_info(xcb_connection(), output.output, output.config_timestamp);
+ QScopedPointer<xcb_randr_get_output_info_reply_t, QScopedPointerPodDeleter> outputInfo(
+ xcb_randr_get_output_info_reply(xcb_connection(), outputInfoCookie, NULL));
+ if (outputInfo->crtc == XCB_NONE) {
+ qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled";
+ m_screens.removeOne(screen);
+ foreach (QXcbScreen *otherScreen, m_screens)
+ otherScreen->removeVirtualSibling((QPlatformScreen *) screen);
+ QXcbIntegration::instance()->destroyScreen(screen);
+ } else {
+ qCDebug(lcQpaScreen) << "output" << screen->name() << "has been temporarily disabled for the mode switch";
+ }
} else {
// Just update existing screen
screen->updateGeometry(output.config_timestamp);
@@ -1153,21 +1187,13 @@ void QXcbConnection::addPeekFunc(PeekFunc f)
QXcbEventReader::QXcbEventReader(QXcbConnection *connection)
: m_connection(connection)
- , m_xcb_poll_for_queued_event(0)
{
-#ifdef RTLD_DEFAULT
- m_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event");
-#endif
-
-#ifdef Q_XCB_DEBUG
- if (m_xcb_poll_for_queued_event)
- qDebug("Using threaded event reader with xcb_poll_for_queued_event");
-#endif
+ checkXcbPollForQueuedEvent();
}
void QXcbEventReader::start()
{
- if (m_xcb_poll_for_queued_event) {
+ if (local_xcb_poll_for_queued_event) {
connect(this, SIGNAL(eventPending()), m_connection, SLOT(processXcbEvents()), Qt::QueuedConnection);
connect(this, SIGNAL(finished()), m_connection, SLOT(processXcbEvents()));
QThread::start();
@@ -1193,7 +1219,7 @@ void QXcbEventReader::registerEventDispatcher(QAbstractEventDispatcher *dispatch
// flush the xcb connection before the EventDispatcher is going to block
// In the non-threaded case processXcbEvents is called before going to block,
// which flushes the connection.
- if (m_xcb_poll_for_queued_event)
+ if (local_xcb_poll_for_queued_event)
connect(dispatcher, SIGNAL(aboutToBlock()), m_connection, SLOT(flush()));
}
@@ -1203,7 +1229,7 @@ void QXcbEventReader::run()
while (m_connection && (event = xcb_wait_for_event(m_connection->xcb_connection()))) {
m_mutex.lock();
addEvent(event);
- while (m_connection && (event = m_xcb_poll_for_queued_event(m_connection->xcb_connection())))
+ while (m_connection && (event = local_xcb_poll_for_queued_event(m_connection->xcb_connection())))
addEvent(event);
m_mutex.unlock();
emit eventPending();
@@ -1227,7 +1253,7 @@ void QXcbEventReader::addEvent(xcb_generic_event_t *event)
QXcbEventArray *QXcbEventReader::lock()
{
m_mutex.lock();
- if (!m_xcb_poll_for_queued_event) {
+ if (!local_xcb_poll_for_queued_event) {
while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection->xcb_connection()))
m_events << event;
}
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 7016b99425..4a0348aa0c 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -324,9 +324,6 @@ private:
QMutex m_mutex;
QXcbEventArray m_events;
QXcbConnection *m_connection;
-
- typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c);
- XcbPollForQueuedEventFunctionPointer m_xcb_poll_for_queued_event;
};
class QXcbWindowEventListener
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 4a347a3706..5a2ea74258 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -306,14 +306,13 @@ void QXcbConnection::xi2Select(xcb_window_t window)
const bool pointerSelected = isAtLeastXI22() && xi2MouseEvents();
QSet<int> tabletDevices;
#ifndef QT_NO_TABLETEVENT
- if (!m_tabletData.isEmpty() && !pointerSelected) {
+ if (!m_tabletData.isEmpty()) {
unsigned int tabletBitMask;
unsigned char *xiTabletBitMask = reinterpret_cast<unsigned char *>(&tabletBitMask);
QVector<XIEventMask> xiEventMask(m_tabletData.count());
- tabletBitMask = XI_ButtonPressMask;
- tabletBitMask |= XI_ButtonReleaseMask;
- tabletBitMask |= XI_MotionMask;
- tabletBitMask |= XI_PropertyEventMask;
+ tabletBitMask = XI_PropertyEventMask;
+ if (!pointerSelected)
+ tabletBitMask |= XI_ButtonPressMask | XI_ButtonReleaseMask | XI_MotionMask;
for (int i = 0; i < m_tabletData.count(); ++i) {
int deviceId = m_tabletData.at(i).deviceId;
tabletDevices.insert(deviceId);
@@ -458,17 +457,6 @@ static inline qreal fixed1616ToReal(FP1616 val)
}
#endif // defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT)
-#if defined(XCB_USE_XINPUT21)
-static qreal valuatorNormalized(double value, XIValuatorClassInfo *vci)
-{
- if (value > vci->max)
- value = vci->max;
- if (value < vci->min)
- value = vci->min;
- return (value - vci->min) / (vci->max - vci->min);
-}
-#endif // XCB_USE_XINPUT21
-
void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
{
if (xi2PrepareXIGenericDeviceEvent(event, m_xiOpCode)) {
@@ -481,9 +469,11 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
case XI_ButtonPress:
case XI_ButtonRelease:
case XI_Motion:
+#ifdef XCB_USE_XINPUT22
case XI_TouchBegin:
case XI_TouchUpdate:
case XI_TouchEnd:
+#endif
{
xiDeviceEvent = reinterpret_cast<xXIDeviceEvent *>(event);
eventListener = windowEventListenerFromId(xiDeviceEvent->event);
@@ -548,6 +538,15 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
}
#ifdef XCB_USE_XINPUT22
+static qreal valuatorNormalized(double value, XIValuatorClassInfo *vci)
+{
+ if (value > vci->max)
+ value = vci->max;
+ if (value < vci->min)
+ value = vci->min;
+ return (value - vci->min) / (vci->max - vci->min);
+}
+
void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindow)
{
xXIDeviceEvent *xiDeviceEvent = static_cast<xXIDeviceEvent *>(xiDevEvent);
@@ -973,6 +972,8 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData, Q
// the pen on the XI 2.2+ path.
if (xi2MouseEvents() && eventListener)
eventListener->handleXIMouseEvent(reinterpret_cast<xcb_ge_event_t *>(event));
+#else
+ Q_UNUSED(eventListener);
#endif
switch (xiEvent->evtype) {
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 6c95de6806..0cd9159052 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -336,8 +336,10 @@ QXcbCursor::~QXcbCursor()
if (!--cursorCount)
xcb_close_font(conn, cursorFont);
+#ifndef QT_NO_CURSOR
foreach (xcb_cursor_t cursor, m_cursorHash)
xcb_free_cursor(conn, cursor);
+#endif
}
#ifndef QT_NO_CURSOR
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 29262b5847..c6e48dc8c4 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -708,7 +708,7 @@ static inline void formatSizeF(QDebug &debug, const QSizeF s)
debug << s.width() << 'x' << s.height() << "mm";
}
-Q_XCB_EXPORT QDebug operator<<(QDebug debug, const QXcbScreen *screen)
+QDebug operator<<(QDebug debug, const QXcbScreen *screen)
{
const QDebugStateSaver saver(debug);
debug.nospace();
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index 4f8eaba85a..2cecf61573 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -1092,12 +1092,20 @@ void QPrinter::setCreator(const QString &creator)
To obtain the current page margins use pageLayout().pageMargins().
- Returns true if the page margins was successfully set to \a margins.
+ Returns \c true if the page margins was successfully set to \a margins.
\sa pageLayout(), setPageLayout()
*/
/*!
+ \fn bool QPrinter::setPageMargins(const QMarginsF &margins)
+
+ Set the page margins to \a margins using the current units.
+ Returns \c true if the page margins were set successfully.
+
+ \sa pageLayout(), setPageLayout()
+*/
+/*!
\fn QPageLayout QPrinter::pageLayout() const
\since 5.3
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 2d9bae5f31..0070cdb271 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -99,7 +99,14 @@ mac {
# Exclude these headers from the clean check if their dependencies aren't
# being built
-contains(QT_CONFIG, no-widgets): HEADERSCLEAN_EXCLUDE += qtest_widgets.h
-contains(QT_CONFIG, no-gui): HEADERSCLEAN_EXCLUDE += qtest_gui.h
+!qtHaveModule(gui) {
+ HEADERSCLEAN_EXCLUDE += qtest_gui.h \
+ qtestaccessible.h \
+ qtestkeyboard.h \
+ qtestmouse.h \
+ qtesttouch.h
+}
+
+!qtHaveModule(widgets): HEADERSCLEAN_EXCLUDE += qtest_widgets.h
load(qt_module)
diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp
index 9f722abe9b..5153b0de5c 100644
--- a/src/tools/qdoc/generator.cpp
+++ b/src/tools/qdoc/generator.cpp
@@ -932,14 +932,16 @@ void Generator::generateFileList(const DocumentNode* dn,
if (!file.isEmpty()) {
QDir dirInfo;
QString userFriendlyFilePath;
+ const QString prefix("/images/used-in-examples/");
QString srcPath = Config::findFile(dn->location(),
QStringList(),
exampleDirs,
file,
exampleImgExts,
userFriendlyFilePath);
+ outFileNames_ << prefix.mid(1) + userFriendlyFilePath;
userFriendlyFilePath.truncate(userFriendlyFilePath.lastIndexOf('/'));
- QString imgOutDir = outDir_ + "/images/used-in-examples/" + userFriendlyFilePath;
+ QString imgOutDir = outDir_ + prefix + userFriendlyFilePath;
if (!dirInfo.mkpath(imgOutDir))
dn->location().fatal(tr("Cannot create output directory '%1'").arg(imgOutDir));
Config::copyFile(dn->location(), srcPath, file, imgOutDir);
diff --git a/src/tools/qdoc/helpprojectwriter.cpp b/src/tools/qdoc/helpprojectwriter.cpp
index 996cf03f32..8161913f1f 100644
--- a/src/tools/qdoc/helpprojectwriter.cpp
+++ b/src/tools/qdoc/helpprojectwriter.cpp
@@ -202,13 +202,7 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const
{
QStringList details;
- if (node->isQmlProperty() || node->isJsProperty()) {
- // "name"
- details << node->name();
- // "id"
- details << node->parent()->parent()->name()+"::"+node->name();
- }
- else if (node->parent() && !node->parent()->name().isEmpty()) {
+ if (node->parent() && !node->parent()->name().isEmpty()) {
// "name"
if (node->type() == Node::Enum || node->type() == Node::Typedef)
details << node->parent()->name()+"::"+node->name();
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 911b91991f..18d2af5810 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -2663,7 +2663,7 @@ QString HtmlGenerator::generateLowStatusMemberFile(Aggregate *inner,
out() << "<p><b>The following members of class "
<< "<a href=\"" << linkForNode(inner, 0) << "\">"
<< protectEnc(inner->name()) << "</a>"
- << "are part of the "
+ << " are part of the "
"Qt compatibility layer.</b> We advise against "
"using them in new code.</p>\n";
}
diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp
index 4470c8f07f..537051956e 100644
--- a/src/tools/qlalr/lalr.cpp
+++ b/src/tools/qlalr/lalr.cpp
@@ -238,11 +238,11 @@ void Grammar::buildExtendedGrammar ()
non_terminals.insert (accept_symbol);
}
-struct _Nullable: public std::unary_function<Name, bool>
+struct Nullable: public std::unary_function<Name, bool>
{
Automaton *_M_automaton;
- _Nullable (Automaton *aut):
+ Nullable (Automaton *aut):
_M_automaton (aut) {}
bool operator () (Name name) const
@@ -300,7 +300,7 @@ void Automaton::buildNullables ()
for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule)
{
- NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (_Nullable (this)));
+ NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (Nullable (this)));
if (nn == rule->rhs.end ())
changed |= nullables.insert (rule->lhs).second;
@@ -635,7 +635,7 @@ void Automaton::buildIncludesDigraph ()
if (! _M_grammar->isNonTerminal (*A))
continue;
- NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (_Nullable (this)));
+ NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (Nullable (this)));
if (first_not_nullable != rule->rhs.end ())
continue;
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 335c70eeb6..81beccd5c8 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -189,7 +189,9 @@ Q_GLOBAL_STATIC(QUrl, lastVisitedDir)
\value AnyFile The name of a file, whether it exists or not.
\value ExistingFile The name of a single existing file.
\value Directory The name of a directory. Both files and
- directories are displayed.
+ directories are displayed. However, the native Windows
+ file dialog does not support displaying files in the
+ directory chooser.
\value ExistingFiles The names of zero or more existing files.
This value is obsolete since Qt 4.5:
@@ -2414,9 +2416,12 @@ QUrl QFileDialog::getSaveFileUrl(QWidget *parent,
pass. To ensure a native file dialog, \l{QFileDialog::}{ShowDirsOnly} must
be set.
- On Windows, and OS X, this static function will use the
- native file dialog and not a QFileDialog. On Windows CE, if the device has
- no native file dialog, a QFileDialog will be used.
+ On Windows and OS X, this static function will use the
+ native file dialog and not a QFileDialog. However, the native Windows file
+ dialog does not support displaying files in the directory chooser. You need
+ to pass \l{QFileDialog::}{DontUseNativeDialog} to display files using a
+ QFileDialog. On Windows CE, if the device has no native file dialog, a
+ QFileDialog will be used.
On Unix/X11, the normal behavior of the file dialog is to resolve and
follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp},
@@ -2424,7 +2429,7 @@ QUrl QFileDialog::getSaveFileUrl(QWidget *parent,
\a options includes DontResolveSymlinks, the file dialog will treat
symlinks as regular directories.
- On Windows the dialog will spin a blocking modal event loop that will not
+ On Windows, the dialog will spin a blocking modal event loop that will not
dispatch any QTimers, and if \a parent is not 0 then it will position the
dialog just below the parent's title bar.
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 255ffbd258..95c4877eb9 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -58,14 +58,9 @@ QT_BEGIN_NAMESPACE
static QString qt_strippedText(QString s)
{
s.remove( QString::fromLatin1("...") );
- int i = 0;
- while (i < s.size()) {
- ++i;
- if (s.at(i-1) != QLatin1Char('&'))
- continue;
- if (i < s.size() && s.at(i) == QLatin1Char('&'))
- ++i;
- s.remove(i-1,1);
+ for (int i = 0; i < s.size(); ++i) {
+ if (s.at(i) == QLatin1Char('&'))
+ s.remove(i, 1);
}
return s.trimmed();
}
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 9195c1e5fa..1ebf782edf 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -12681,11 +12681,21 @@ void QWidget::initPainter(QPainter *painter) const
painter->d_func()->state->font = f;
}
+/*!
+ \internal
+
+ Do PaintDevice rendering with the specified \a offset.
+*/
QPaintDevice *QWidget::redirected(QPoint *offset) const
{
return d_func()->redirected(offset);
}
+/*!
+ \internal
+
+ A painter that is shared among other instances of QPainter.
+*/
QPainter *QWidget::sharedPainter() const
{
// Someone sent a paint event directly to the widget
@@ -12887,6 +12897,45 @@ QDebug operator<<(QDebug debug, const QWidget *widget)
}
#endif // !QT_NO_DEBUG_STREAM
+/*! \fn Qt::HANDLE QWidget::macCGHandle() const
+ \internal
+
+ Returns the CoreGraphics handle of the widget. Use of this function is not portable.
+ This function will return 0 if no painter context can be established, or if the handle
+ could not be created.
+
+ \warning This function is only available on OS X.
+*/
+/*! \fn Qt::HANDLE QWidget::macQDHandle() const
+ \internal
+
+ Returns the QuickDraw handle of the widget. Use of this function is not portable.
+ This function will return 0 if QuickDraw is not supported, or if the handle could
+ not be created.
+
+ \warning This function is only available on OS X.
+*/
+/*! \fn const QX11Info &QWidget::x11Info() const
+ \internal
+
+ Returns information about the configuration of the X display used to display
+ the widget.
+
+ \warning This function is only available on X11.
+*/
+
+/*! \fn Qt::HANDLE QWidget::x11PictureHandle() const
+ \internal
+
+ Returns the X11 picture handle of the widget for XRender
+ support. Use of this function is not portable. This function will
+ return 0 if XRender support is not compiled into Qt, if the
+ XRender extension is not supported on the X11 display, or if the
+ handle could not be created.
+
+ \warning This function is only available on X11.
+
+*/
QT_END_NAMESPACE
#include "moc_qwidget.cpp"
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index fff75d829f..69958636fd 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -74,7 +74,7 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
Q_UNUSED(widgetTextures);
Q_ASSERT(!region.isEmpty());
#else
- Q_ASSERT(!region.isEmpty() || (widgetTextures && widgetTextures->count()));
+ Q_ASSERT(!region.isEmpty() || widgetTextures);
#endif
Q_ASSERT(widget);
Q_ASSERT(backingStore);
@@ -1123,7 +1123,7 @@ void QWidgetBackingStore::doSync()
widgetTextures = new QPlatformTextureList;
findTextureWidgetsRecursively(tlw, tlw, widgetTextures);
}
- qt_window_private(tlw->windowHandle())->compositing = widgetTextures && !widgetTextures->isEmpty();
+ qt_window_private(tlw->windowHandle())->compositing = widgetTextures;
fullUpdatePending = false;
#endif
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 633e710853..58436a7d92 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -892,7 +892,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
QGuiApplication::sendSpontaneousEvent(qt_tablet_target, &ev);
}
- if (event->type() == QEvent::TabletRelease)
+ if (event->type() == QEvent::TabletRelease && event->buttons() == Qt::NoButton)
qt_tablet_target = 0;
}
#endif // QT_NO_TABLETEVENT
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 662e1f9b96..380b2b3939 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4156,7 +4156,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
switch (pe) {
case PE_FrameStatusBar: {
- QRenderRule subRule = renderRule(w->parentWidget(), opt, PseudoElement_Item);
+ QRenderRule subRule = renderRule(w ? w->parentWidget() : Q_NULLPTR, opt, PseudoElement_Item);
if (subRule.hasDrawable()) {
subRule.drawRule(p, opt->rect);
return;
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 2958d662c7..af085747ec 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -1765,6 +1765,7 @@ void QComboBox::setLineEdit(QLineEdit *edit)
delete d->lineEdit;
d->lineEdit = edit;
+ qt_widget_private(d->lineEdit)->inheritsInputMethodHints = 1;
if (d->lineEdit->parent() != this)
d->lineEdit->setParent(this);
connect(d->lineEdit, SIGNAL(returnPressed()), this, SLOT(_q_returnPressed()));
diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm
index 7a7492e717..46a43c4110 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.mm
+++ b/src/widgets/widgets/qmacnativewidget_mac.mm
@@ -142,6 +142,11 @@ QSize QMacNativeWidget::sizeHint() const
return QWidget::sizeHint();
}
+/*! \fn NSView *QMacNativeWidget::nativeView() const
+
+ Returns the native view backing the QMacNativeWidget.
+
+*/
NSView *QMacNativeWidget::nativeView() const
{
winId();
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 93f0b60058..69432761e6 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -897,7 +897,12 @@ void QToolButton::setDefaultAction(QAction *action)
return;
if (!actions().contains(action))
addAction(action);
- setText(action->text());
+ QString buttonText = action->iconText();
+ // If iconText() is generated from text(), we need to escape any '&'s so they
+ // don't turn into shortcuts
+ if (QActionPrivate::get(action)->iconText.isEmpty())
+ buttonText.replace(QLatin1String("&"), QLatin1String("&&"));
+ setText(buttonText);
setIcon(action->icon());
#ifndef QT_NO_TOOLTIP
setToolTip(action->toolTip());