summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-16 01:01:29 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-16 01:01:30 +0100
commit11b9c813e6705b0349e4c241f9132a6649977431 (patch)
tree69df65cb06c9617ab305a55be413a6be63677913 /src
parent8cc8eb8f24b9d297a25c9841326c6fa8561cf80e (diff)
parent4554fa7b191566df0a6c07e686c642c78eb88095 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Diffstat (limited to 'src')
-rw-r--r--src/corelib/doc/snippets/signalsandslots/lcdnumber.h2
-rw-r--r--src/corelib/doc/src/objectmodel/signalsandslots.qdoc4
-rw-r--r--src/corelib/io/qloggingcategory.h49
-rw-r--r--src/corelib/io/qprocess.h20
-rw-r--r--src/corelib/serialization/qcborstream.cpp27
-rw-r--r--src/corelib/tools/qscopeguard.qdoc6
-rw-r--r--src/gui/image/qicon.h1
-rw-r--r--src/gui/kernel/qopenglcontext.cpp2
-rw-r--r--src/gui/opengl/qopengltexture.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp2
-rw-r--r--src/network/ssl/qsslsocket.cpp8
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.cpp69
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.h3
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeinterface.cpp9
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeinterface.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp132
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h6
-rw-r--r--src/tools/androiddeployqt/main.cpp2
-rw-r--r--src/tools/qfloat16-tables/gen_qfloat16_tables.cpp2
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp3
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp3
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp3
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp4
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp2
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp6
29 files changed, 268 insertions, 112 deletions
diff --git a/src/corelib/doc/snippets/signalsandslots/lcdnumber.h b/src/corelib/doc/snippets/signalsandslots/lcdnumber.h
index fbd31b08cf..b311586e8f 100644
--- a/src/corelib/doc/snippets/signalsandslots/lcdnumber.h
+++ b/src/corelib/doc/snippets/signalsandslots/lcdnumber.h
@@ -69,7 +69,7 @@ class LcdNumber : public QFrame
//! [6]
public:
//! [6] //! [7]
- LcdNumber(QWidget *parent = 0);
+ LcdNumber(QWidget *parent = nullptr);
//! [7]
//! [8]
diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
index fcf091458a..85fe4df2ce 100644
--- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
+++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
@@ -330,7 +330,7 @@
arguments can have default values. Consider QObject::destroyed():
\code
- void destroyed(QObject* = 0);
+ void destroyed(QObject* = nullptr);
\endcode
When a QObject is deleted, it emits this QObject::destroyed()
@@ -339,7 +339,7 @@
A suitable slot signature might be:
\code
- void objectDestroyed(QObject* obj = 0);
+ void objectDestroyed(QObject* obj = nullptr);
\endcode
To connect the signal to the slot, we use QObject::connect().
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
index 489e250087..91e3144300 100644
--- a/src/corelib/io/qloggingcategory.h
+++ b/src/corelib/io/qloggingcategory.h
@@ -120,15 +120,30 @@ private:
return category; \
}
-#define qCDebug(category, ...) \
+#if !defined(QT_NO_DEBUG_OUTPUT)
+# define qCDebug(category, ...) \
for (bool qt_category_enabled = category().isDebugEnabled(); qt_category_enabled; qt_category_enabled = false) \
QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).debug(__VA_ARGS__)
-#define qCInfo(category, ...) \
+#else
+# define qCDebug(category, ...) QT_NO_QDEBUG_MACRO()
+#endif
+
+#if !defined(QT_NO_INFO_OUTPUT)
+# define qCInfo(category, ...) \
for (bool qt_category_enabled = category().isInfoEnabled(); qt_category_enabled; qt_category_enabled = false) \
QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).info(__VA_ARGS__)
-#define qCWarning(category, ...) \
+#else
+# define qCInfo(category, ...) QT_NO_QDEBUG_MACRO()
+#endif
+
+#if !defined(QT_NO_WARNING_OUTPUT)
+# define qCWarning(category, ...) \
for (bool qt_category_enabled = category().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) \
QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).warning(__VA_ARGS__)
+#else
+# define qCWarning(category, ...) QT_NO_QDEBUG_MACRO()
+#endif
+
#define qCCritical(category, ...) \
for (bool qt_category_enabled = category().isCriticalEnabled(); qt_category_enabled; qt_category_enabled = false) \
QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).critical(__VA_ARGS__)
@@ -144,26 +159,28 @@ private:
}
// check for enabled category inside QMessageLogger.
-#define qCDebug qDebug
-#define qCInfo qInfo
-#define qCWarning qWarning
-#define qCCritical qCritical
-
-#endif // Q_COMPILER_VARIADIC_MACROS || defined(Q_MOC_RUN)
-
-#if defined(QT_NO_DEBUG_OUTPUT)
-# undef qCDebug
+#if !defined(QT_NO_DEBUG_OUTPUT)
+# define qCDebug qDebug
+#else
# define qCDebug(category) QT_NO_QDEBUG_MACRO()
#endif
-#if defined(QT_NO_INFO_OUTPUT)
-# undef qCInfo
+
+#if !defined(QT_NO_INFO_OUTPUT)
+# define qCInfo qInfo
+#else
# define qCInfo(category) QT_NO_QDEBUG_MACRO()
#endif
-#if defined(QT_NO_WARNING_OUTPUT)
-# undef qCWarning
+
+#if !defined(QT_NO_WARNING_OUTPUT)
+# define qCWarning qWarning
+#else
# define qCWarning(category) QT_NO_QDEBUG_MACRO()
#endif
+#define qCCritical qCritical
+
+#endif // Q_COMPILER_VARIADIC_MACROS || defined(Q_MOC_RUN)
+
QT_END_NAMESPACE
#endif // QLOGGINGCATEGORY_H
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index 42cf769698..a2e3c01f7c 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -48,22 +48,24 @@
QT_REQUIRE_CONFIG(processenvironment);
-QT_BEGIN_NAMESPACE
-
-class QProcessPrivate;
-
-#if !defined(Q_OS_WIN)
-typedef qint64 Q_PID;
-#else
-QT_END_NAMESPACE
+#ifdef Q_OS_WIN
typedef struct _PROCESS_INFORMATION *Q_PID;
+#endif
+
+#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
typedef struct _SECURITY_ATTRIBUTES Q_SECURITY_ATTRIBUTES;
typedef struct _STARTUPINFOW Q_STARTUPINFO;
-QT_BEGIN_NAMESPACE
#endif
+QT_BEGIN_NAMESPACE
+
+class QProcessPrivate;
class QProcessEnvironmentPrivate;
+#ifndef Q_OS_WIN
+typedef qint64 Q_PID;
+#endif
+
class Q_CORE_EXPORT QProcessEnvironment
{
public:
diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp
index e222bf5514..20a7e14dde 100644
--- a/src/corelib/serialization/qcborstream.cpp
+++ b/src/corelib/serialization/qcborstream.cpp
@@ -420,7 +420,7 @@ QDebug operator<<(QDebug dbg, QCborKnownTags tag)
\value IllegalSimpleType The CBOR stream contains a Simple Type encoded incorrectly (data is
corrupt and the error is not recoverable).
\value InvalidUtf8String The CBOR stream contains a text string that does not decode properly
- as UTF (data is corrupt and the error is not recoverable).
+ as UTF-8 (data is corrupt and the error is not recoverable).
\value DataTooLarge CBOR string, map or array is too big and cannot be parsed by Qt
(internal limitation, but the error is not recoverable).
\value NestingTooDeep Too many levels of arrays or maps encountered while processing the
@@ -429,6 +429,24 @@ QDebug operator<<(QDebug dbg, QCborKnownTags tag)
support (internal limitation, but the error is not recoverable).
*/
+// Convert from CborError to QCborError.
+//
+// Centralized in a function in case we need to make more adjustments in the
+// future.
+static QCborError fromCborError(CborError err)
+{
+ return { QCborError::Code(int(err)) };
+}
+
+// Convert to CborError from QCborError.
+//
+// Centralized in a function in case we need to make more adjustments in the
+// future.
+static CborError toCborError(QCborError c)
+{
+ return CborError(int(c.c));
+}
+
/*!
\variable QCborError::c
\internal
@@ -499,8 +517,8 @@ QString QCborError::toString() const
return QStringLiteral("Internal limitation: unsupported type");
}
- // get the error from TinyCBOR
- CborError err = CborError(int(c));
+ // get the error string from TinyCBOR
+ CborError err = toCborError(*this);
return QString::fromLatin1(cbor_error_string(err));
}
@@ -1839,8 +1857,7 @@ public:
if (err != CborErrorUnexpectedEOF)
corrupt = true;
- // our error codes are the same (for now)
- lastError = { QCborError::Code(err) };
+ lastError = fromCborError(err);
}
void updateBufferAfterString(qsizetype offset, qsizetype size)
diff --git a/src/corelib/tools/qscopeguard.qdoc b/src/corelib/tools/qscopeguard.qdoc
index 21b0bab9cf..5a9b7fd210 100644
--- a/src/corelib/tools/qscopeguard.qdoc
+++ b/src/corelib/tools/qscopeguard.qdoc
@@ -37,6 +37,12 @@ QT_BEGIN_NAMESPACE
a scope.
*/
+/*! \fn template <typename F> void QScopeGuard<F>::dismiss()
+
+ Disarms the scope guard, so that the function \e F will not be called at
+ the end of the scope.
+*/
+
/*!
\fn template <typename F> const QScopeGuard<F> qScopeGuard(F f)
\inmodule QtCore
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index 6a4fc8927a..8870950982 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
class QIconPrivate;
class QIconEngine;
+class QPainter;
class Q_GUI_EXPORT QIcon
{
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index acb6c3fe94..bf3403f2e4 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -313,7 +313,7 @@ QOpenGLContext *qt_gl_global_share_context()
\section1 Context Resource Sharing
- Resources, such as framebuffer objects, textures, and vertex buffer objects
+ Resources such as textures and vertex buffer objects
can be shared between contexts. Use setShareContext() before calling
create() to specify that the contexts should share these resources.
QOpenGLContext internally keeps track of a QOpenGLContextGroup object which
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index f25988585e..1e4d627e2a 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -4348,7 +4348,7 @@ QOpenGLTexture::DepthStencilMode QOpenGLTexture::depthStencilMode() const
*/
-/*
+/*!
\since 5.5
Sets the texture comparison function on this texture to \a function. The texture
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 66af6e3de3..afa540380f 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3407,7 +3407,7 @@ bool QRasterPaintEngine::requiresPretransformedGlyphPositions(QFontEngine *fontE
}
/*!
- Indicates whether glyph caching is supported by the font engine
+ Returns 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
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index fa012866e6..4e6caf3edd 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1128,8 +1128,8 @@ QList<QSslCertificate> QSslSocket::peerCertificateChain() const
handshake phase begins.
\sa QSslConfiguration::ciphers(), QSslConfiguration::setCiphers(),
- QSslConfiguration::setDefaultCiphers(),
- QSslConfiguration::defaultCiphers(),
+ QSslConfiguration::setCiphers(),
+ QSslConfiguration::ciphers(),
QSslConfiguration::supportedCiphers()
*/
QSslCipher QSslSocket::sessionCipher() const
@@ -1498,7 +1498,7 @@ QList<QSslCertificate> QSslSocket::caCertificates() const
Each SSL socket's CA certificate database is initialized to the
default CA certificate database.
- \sa QSslConfiguration::defaultCaCertificates(), addCaCertificates(),
+ \sa QSslConfiguration::caCertificates(), addCaCertificates(),
addDefaultCaCertificate()
*/
bool QSslSocket::addDefaultCaCertificates(const QString &path, QSsl::EncodingFormat encoding,
@@ -1524,7 +1524,7 @@ void QSslSocket::addDefaultCaCertificate(const QSslCertificate &certificate)
SSL socket's CA certificate database is initialized to the default
CA certificate database.
- \sa QSslConfiguration::defaultCaCertificates(), addCaCertificates()
+ \sa QSslConfiguration::caCertificates(), addCaCertificates()
*/
void QSslSocket::addDefaultCaCertificates(const QList<QSslCertificate> &certificates)
{
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
index 14222da807..63a764e741 100644
--- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
+++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
@@ -695,7 +695,12 @@ int QWasmEventTranslator::wheel_cb(int eventType, const EmscriptenWheelEvent *wh
int QWasmEventTranslator::touchCallback(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)
{
- QWasmEventTranslator *eventTranslator = static_cast<QWasmEventTranslator *>(userData);
+ auto translator = reinterpret_cast<QWasmEventTranslator*>(userData);
+ return translator->handleTouch(eventType, touchEvent);
+}
+
+int QWasmEventTranslator::handleTouch(int eventType, const EmscriptenTouchEvent *touchEvent)
+{
QList<QWindowSystemInterface::TouchPoint> touchPointList;
touchPointList.reserve(touchEvent->numTouches);
QWindow *window2;
@@ -704,50 +709,68 @@ int QWasmEventTranslator::touchCallback(int eventType, const EmscriptenTouchEven
const EmscriptenTouchPoint *touches = &touchEvent->touches[i];
- QPoint point(touches->canvasX, touches->canvasY);
- window2 = eventTranslator->screen()->compositor()->windowAt(point, 5);
-
+ QPoint point(touches->targetX, touches->targetY);
+ window2 = this->screen()->compositor()->windowAt(point, 5);
QWindowSystemInterface::TouchPoint touchPoint;
- auto cX = point.x();
- auto cY = point.y();
touchPoint.area = QRect(0, 0, 8, 8);
- touchPoint.area.moveCenter(QPointF(cX,cY)); // simulate area
-
touchPoint.id = touches->identifier;
- touchPoint.normalPosition = QPointF(cX / window2->width(), cY / window2->height());
+ touchPoint.pressure = 1.0;
+
+ const QPointF screenPos(point);
+
+ touchPoint.area.moveCenter(screenPos);
+
+ const auto tp = pressedTouchIds.constFind(touchPoint.id);
+ if (tp != pressedTouchIds.constEnd())
+ touchPoint.normalPosition = tp.value();
+
+ QPointF normalPosition(screenPos.x() / window2->width(),
+ screenPos.y() / window2->height());
+
+ const bool stationaryTouchPoint = (normalPosition == touchPoint.normalPosition);
+ touchPoint.normalPosition = normalPosition;
switch (eventType) {
case EMSCRIPTEN_EVENT_TOUCHSTART:
- touchPoint.state = Qt::TouchPointPressed;
+ if (tp != pressedTouchIds.constEnd()) {
+ touchPoint.state = (stationaryTouchPoint
+ ? Qt::TouchPointStationary
+ : Qt::TouchPointMoved);
+ } else {
+ touchPoint.state = Qt::TouchPointPressed;
+ }
+ pressedTouchIds.insert(touchPoint.id, touchPoint.normalPosition);
+
break;
case EMSCRIPTEN_EVENT_TOUCHEND:
touchPoint.state = Qt::TouchPointReleased;
+ pressedTouchIds.remove(touchPoint.id);
break;
case EMSCRIPTEN_EVENT_TOUCHMOVE:
- touchPoint.state = Qt::TouchPointMoved;
+ touchPoint.state = (stationaryTouchPoint
+ ? Qt::TouchPointStationary
+ : Qt::TouchPointMoved);
+
+ pressedTouchIds.insert(touchPoint.id, touchPoint.normalPosition);
break;
default:
- Q_UNREACHABLE();
+ break;
}
touchPointList.append(touchPoint);
}
- QWasmEventTranslator *wasmEventTranslator = (QWasmEventTranslator*)userData;
- QFlags<Qt::KeyboardModifier> keyModifier = wasmEventTranslator->translatKeyModifier(touchEvent);
+ QFlags<Qt::KeyboardModifier> keyModifier = translatKeyModifier(touchEvent);
+
+ QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(
+ window2, getTimestamp(), touchDevice, touchPointList, keyModifier);
- if (eventType != EMSCRIPTEN_EVENT_TOUCHCANCEL)
- QWindowSystemInterface::handleTouchEvent
- <QWindowSystemInterface::SynchronousDelivery>(window2, wasmEventTranslator->getTimestamp(),
- wasmEventTranslator->touchDevice,
- touchPointList, keyModifier);
- else
- QWindowSystemInterface::handleTouchCancelEvent(window2, wasmEventTranslator->getTimestamp(),
- wasmEventTranslator->touchDevice, keyModifier);
+ if (eventType == EMSCRIPTEN_EVENT_TOUCHCANCEL)
+ QWindowSystemInterface::handleTouchCancelEvent(window2, getTimestamp(), touchDevice, keyModifier);
QWasmEventDispatcher::maintainTimers();
- return 1;
+ return 0;
}
quint64 QWasmEventTranslator::getTimestamp()
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.h b/src/plugins/platforms/wasm/qwasmeventtranslator.h
index ba08dce946..d6043072ba 100644
--- a/src/plugins/platforms/wasm/qwasmeventtranslator.h
+++ b/src/plugins/platforms/wasm/qwasmeventtranslator.h
@@ -61,6 +61,7 @@ public:
void processEvents();
void initEventHandlers();
+ int handleTouch(int eventType, const EmscriptenTouchEvent *touchEvent);
Q_SIGNALS:
void getWindowAt(const QPoint &point, QWindow **window);
@@ -114,6 +115,8 @@ private:
{ Qt::Key_U, Qt::Key_Ucircumflex}
};
+ QMap <int, QPointF> pressedTouchIds;
+
private:
QWindow *draggedWindow;
QWindow *pressedWindow;
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
index 7b314878f5..9003e94c56 100644
--- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
@@ -291,4 +291,13 @@ QVariant QWindowsNativeInterface::gpu() const
return GpuDescription::detect().toVariant();
}
+QVariant QWindowsNativeInterface::gpuList() const
+{
+ QVariantList result;
+ const auto gpus = GpuDescription::detectAll();
+ for (const auto &gpu : gpus)
+ result.append(gpu.toVariant());
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.h b/src/plugins/platforms/windows/qwindowsnativeinterface.h
index d085a4afb3..e6f8aae8fb 100644
--- a/src/plugins/platforms/windows/qwindowsnativeinterface.h
+++ b/src/plugins/platforms/windows/qwindowsnativeinterface.h
@@ -66,6 +66,7 @@ class QWindowsNativeInterface : public QPlatformNativeInterface
Q_OBJECT
Q_PROPERTY(bool asyncExpose READ asyncExpose WRITE setAsyncExpose)
Q_PROPERTY(QVariant gpu READ gpu STORED false)
+ Q_PROPERTY(QVariant gpuList READ gpuList STORED false)
public:
void *nativeResourceForIntegration(const QByteArray &resource) override;
@@ -91,6 +92,7 @@ public:
void setAsyncExpose(bool value);
QVariant gpu() const;
+ QVariant gpuList() const;
QVariantMap windowProperties(QPlatformWindow *window) const override;
QVariant windowProperty(QPlatformWindow *window, const QString &name) const override;
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index 2046135725..840a3a11c4 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -62,19 +62,70 @@ QT_BEGIN_NAMESPACE
static const DWORD VENDOR_ID_AMD = 0x1002;
-GpuDescription GpuDescription::detect()
+static GpuDescription adapterIdentifierToGpuDescription(const D3DADAPTER_IDENTIFIER9 &adapterIdentifier)
+{
+ GpuDescription result;
+ result.vendorId = adapterIdentifier.VendorId;
+ result.deviceId = adapterIdentifier.DeviceId;
+ result.revision = adapterIdentifier.Revision;
+ result.subSysId = adapterIdentifier.SubSysId;
+ QVector<int> version(4, 0);
+ version[0] = HIWORD(adapterIdentifier.DriverVersion.HighPart); // Product
+ version[1] = LOWORD(adapterIdentifier.DriverVersion.HighPart); // Version
+ version[2] = HIWORD(adapterIdentifier.DriverVersion.LowPart); // Sub version
+ version[3] = LOWORD(adapterIdentifier.DriverVersion.LowPart); // build
+ result.driverVersion = QVersionNumber(version);
+ result.driverName = adapterIdentifier.Driver;
+ result.description = adapterIdentifier.Description;
+ return result;
+}
+
+class QDirect3D9Handle
+{
+public:
+ Q_DISABLE_COPY(QDirect3D9Handle)
+
+ QDirect3D9Handle();
+ ~QDirect3D9Handle();
+
+ bool isValid() const { return m_direct3D9 != nullptr; }
+
+ UINT adapterCount() const { return m_direct3D9 ? m_direct3D9->GetAdapterCount() : 0u; }
+ bool retrieveAdapterIdentifier(UINT n, D3DADAPTER_IDENTIFIER9 *adapterIdentifier) const;
+
+private:
+ QSystemLibrary m_d3d9lib;
+ IDirect3D9 *m_direct3D9 = nullptr;
+};
+
+QDirect3D9Handle::QDirect3D9Handle() :
+ m_d3d9lib(QStringLiteral("d3d9"))
{
- typedef IDirect3D9 * (WINAPI *PtrDirect3DCreate9)(UINT);
+ using PtrDirect3DCreate9 = IDirect3D9 *(WINAPI *)(UINT);
+ if (m_d3d9lib.load()) {
+ if (auto direct3DCreate9 = (PtrDirect3DCreate9)m_d3d9lib.resolve("Direct3DCreate9"))
+ m_direct3D9 = direct3DCreate9(D3D_SDK_VERSION);
+ }
+}
+
+QDirect3D9Handle::~QDirect3D9Handle()
+{
+ if (m_direct3D9)
+ m_direct3D9->Release();
+}
+
+bool QDirect3D9Handle::retrieveAdapterIdentifier(UINT n, D3DADAPTER_IDENTIFIER9 *adapterIdentifier) const
+{
+ return m_direct3D9
+ && SUCCEEDED(m_direct3D9->GetAdapterIdentifier(n, 0, adapterIdentifier));
+}
+
+GpuDescription GpuDescription::detect()
+{
GpuDescription result;
- QSystemLibrary d3d9lib(QStringLiteral("d3d9"));
- if (!d3d9lib.load())
- return result;
- PtrDirect3DCreate9 direct3DCreate9 = (PtrDirect3DCreate9)d3d9lib.resolve("Direct3DCreate9");
- if (!direct3DCreate9)
- return result;
- IDirect3D9 *direct3D9 = direct3DCreate9(D3D_SDK_VERSION);
- if (!direct3D9)
+ QDirect3D9Handle direct3D9;
+ if (!direct3D9.isValid())
return result;
D3DADAPTER_IDENTIFIER9 adapterIdentifier;
@@ -85,20 +136,8 @@ GpuDescription GpuDescription::detect()
// and D3D uses by default. Therefore querying any additional adapters is
// futile and not useful for our purposes in general, except for
// identifying a few special cases later on.
- HRESULT hr = direct3D9->GetAdapterIdentifier(0, 0, &adapterIdentifier);
- if (SUCCEEDED(hr)) {
- result.vendorId = adapterIdentifier.VendorId;
- result.deviceId = adapterIdentifier.DeviceId;
- result.revision = adapterIdentifier.Revision;
- result.subSysId = adapterIdentifier.SubSysId;
- QVector<int> version(4, 0);
- version[0] = HIWORD(adapterIdentifier.DriverVersion.HighPart); // Product
- version[1] = LOWORD(adapterIdentifier.DriverVersion.HighPart); // Version
- version[2] = HIWORD(adapterIdentifier.DriverVersion.LowPart); // Sub version
- version[3] = LOWORD(adapterIdentifier.DriverVersion.LowPart); // build
- result.driverVersion = QVersionNumber(version);
- result.driverName = adapterIdentifier.Driver;
- result.description = adapterIdentifier.Description;
+ if (direct3D9.retrieveAdapterIdentifier(0, &adapterIdentifier)) {
+ result = adapterIdentifierToGpuDescription(adapterIdentifier);
isAMD = result.vendorId == VENDOR_ID_AMD;
}
@@ -106,30 +145,41 @@ GpuDescription GpuDescription::detect()
// when starting apps on a screen connected to the Intel card) by looking
// for a default AMD adapter and an additional non-AMD one.
if (isAMD) {
- const UINT adapterCount = direct3D9->GetAdapterCount();
+ const UINT adapterCount = direct3D9.adapterCount();
for (UINT adp = 1; adp < adapterCount; ++adp) {
- hr = direct3D9->GetAdapterIdentifier(adp, 0, &adapterIdentifier);
- if (SUCCEEDED(hr)) {
- if (adapterIdentifier.VendorId != VENDOR_ID_AMD) {
- // Bingo. Now figure out the display for the AMD card.
- DISPLAY_DEVICE dd;
- memset(&dd, 0, sizeof(dd));
- dd.cb = sizeof(dd);
- for (int dev = 0; EnumDisplayDevices(nullptr, dev, &dd, 0); ++dev) {
- if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
- // DeviceName is something like \\.\DISPLAY1 which can be used to
- // match with the MONITORINFOEX::szDevice queried by QWindowsScreen.
- result.gpuSuitableScreen = QString::fromWCharArray(dd.DeviceName);
- break;
- }
+ if (direct3D9.retrieveAdapterIdentifier(adp, &adapterIdentifier)
+ && adapterIdentifier.VendorId != VENDOR_ID_AMD) {
+ // Bingo. Now figure out the display for the AMD card.
+ DISPLAY_DEVICE dd;
+ memset(&dd, 0, sizeof(dd));
+ dd.cb = sizeof(dd);
+ for (int dev = 0; EnumDisplayDevices(nullptr, dev, &dd, 0); ++dev) {
+ if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
+ // DeviceName is something like \\.\DISPLAY1 which can be used to
+ // match with the MONITORINFOEX::szDevice queried by QWindowsScreen.
+ result.gpuSuitableScreen = QString::fromWCharArray(dd.DeviceName);
+ break;
}
- break;
}
+ break;
}
}
}
- direct3D9->Release();
+ return result;
+}
+
+QVector<GpuDescription> GpuDescription::detectAll()
+{
+ QVector<GpuDescription> result;
+ QDirect3D9Handle direct3D9;
+ if (const UINT adapterCount = direct3D9.adapterCount()) {
+ for (UINT adp = 0; adp < adapterCount; ++adp) {
+ D3DADAPTER_IDENTIFIER9 adapterIdentifier;
+ if (direct3D9.retrieveAdapterIdentifier(adp, &adapterIdentifier))
+ result.append(adapterIdentifierToGpuDescription(adapterIdentifier));
+ }
+ }
return result;
}
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h
index 08628c2586..9576dfbae0 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.h
+++ b/src/plugins/platforms/windows/qwindowsopengltester.h
@@ -42,6 +42,7 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qflags.h>
+#include <QtCore/qvector.h>
#include <QtCore/qversionnumber.h>
QT_BEGIN_NAMESPACE
@@ -52,6 +53,7 @@ class QVariant;
struct GpuDescription
{
static GpuDescription detect();
+ static QVector<GpuDescription> detectAll();
QString toString() const;
QVariant toVariant() const;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 99be4882bb..8bf090bf03 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -746,7 +746,8 @@ QWindowsWindowData
const QWindowCreationContextPtr context(new QWindowCreationContext(w, data.geometry, rect, data.customMargins, style, exStyle));
QWindowsContext::instance()->setWindowCreationContext(context);
- QMargins invMargins = topLevel && !(result.flags & Qt::FramelessWindowHint) && QWindowsGeometryHint::positionIncludesFrame(w)
+ const bool hasFrame = (style & (WS_DLGFRAME | WS_THICKFRAME));
+ QMargins invMargins = topLevel && hasFrame && QWindowsGeometryHint::positionIncludesFrame(w)
? invisibleMargins(QPoint(context->frameX, context->frameY)) : QMargins();
qCDebug(lcQpaWindows).nospace()
@@ -777,6 +778,7 @@ QWindowsWindowData
result.geometry = context->obtainedGeometry;
result.fullFrameMargins = context->margins;
result.embedded = embedded;
+ result.hasFrame = hasFrame;
result.customMargins = context->customMargins;
return result;
@@ -2233,7 +2235,7 @@ void QWindowsWindow::setFullFrameMargins(const QMargins &newMargins)
QMargins QWindowsWindow::frameMargins() const
{
QMargins result = fullFrameMargins();
- if (isTopLevel() && !(m_data.flags & Qt::FramelessWindowHint))
+ if (isTopLevel() && m_data.hasFrame)
result -= invisibleMargins(geometry().topLeft());
return result;
}
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index b07bd15d2a..0d8096ddfa 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -112,6 +112,7 @@ struct QWindowsWindowData
QMargins customMargins; // User-defined, additional frame for NCCALCSIZE
HWND hwnd = 0;
bool embedded = false;
+ bool hasFrame = false;
static QWindowsWindowData create(const QWindow *w,
const QWindowsWindowData &parameters,
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 6747b237da..7cf25d41a6 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -185,10 +185,10 @@ public:
QXcbWindow *platformWindowFromId(xcb_window_t id);
inline xcb_timestamp_t time() const { return m_time; }
- inline void setTime(xcb_timestamp_t t) { if (t > m_time) m_time = t; }
+ inline void setTime(xcb_timestamp_t t) { if (timeGreaterThan(t, m_time)) m_time = t; }
inline xcb_timestamp_t netWmUserTime() const { return m_netWmUserTime; }
- inline void setNetWmUserTime(xcb_timestamp_t t) { if (t > m_netWmUserTime) m_netWmUserTime = t; }
+ inline void setNetWmUserTime(xcb_timestamp_t t) { if (timeGreaterThan(t, m_netWmUserTime)) m_netWmUserTime = t; }
xcb_timestamp_t getTimestamp();
xcb_window_t getSelectionOwner(xcb_atom_t atom) const;
@@ -264,6 +264,8 @@ private:
void destroyScreen(QXcbScreen *screen);
void initializeScreens();
bool compressEvent(xcb_generic_event_t *event) const;
+ inline bool timeGreaterThan(xcb_timestamp_t a, xcb_timestamp_t b) const
+ { return static_cast<int32_t>(a - b) > 0 || b == XCB_CURRENT_TIME; }
#if QT_CONFIG(xcb_xinput)
void xi2SetupDevice(void *info, bool removeExisting = true);
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp
index b8bc1a342d..fd7f72eebf 100644
--- a/src/tools/androiddeployqt/main.cpp
+++ b/src/tools/androiddeployqt/main.cpp
@@ -1722,7 +1722,7 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
QStringList importPaths;
importPaths += shellQuote(options->qtInstallDirectory + QLatin1String("/qml"));
- importPaths += rootPath;
+ importPaths += shellQuote(rootPath);
for (const QString &qmlImportPath : qAsConst(options->qmlImportPaths))
importPaths += shellQuote(qmlImportPath);
diff --git a/src/tools/qfloat16-tables/gen_qfloat16_tables.cpp b/src/tools/qfloat16-tables/gen_qfloat16_tables.cpp
index a9bf7e86e4..17fc978039 100644
--- a/src/tools/qfloat16-tables/gen_qfloat16_tables.cpp
+++ b/src/tools/qfloat16-tables/gen_qfloat16_tables.cpp
@@ -79,6 +79,7 @@ qint32 main(qint32 argc, char **argv)
fid.write("#include <QtCore/qfloat16.h>\n\n");
fid.write("QT_BEGIN_NAMESPACE\n\n");
+ fid.write("#if !defined(__F16C__) && !defined(__ARM_FP16_FORMAT_IEEE)\n\n");
fid.write("const quint32 qfloat16::mantissatable[2048] = {\n");
fid.write("0,\n");
@@ -155,6 +156,7 @@ qint32 main(qint32 argc, char **argv)
fid.write("};\n\n");
+ fid.write("#endif // !__F16C__ && !__ARM_FP16_FORMAT_IEEE\n\n");
fid.write("QT_END_NAMESPACE\n");
fid.close();
return 0;
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 35d77f0827..2fb3e502c5 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -752,9 +752,9 @@ void WriteInitialization::acceptWidget(DomWidget *node)
static const QLatin1String realPropertyNames[] = {
QLatin1String("visible"),
QLatin1String("cascadingSectionResizes"),
+ QLatin1String("minimumSectionSize"), // before defaultSectionSize
QLatin1String("defaultSectionSize"),
QLatin1String("highlightSections"),
- QLatin1String("minimumSectionSize"),
QLatin1String("showSortIndicator"),
QLatin1String("stretchLastSection"),
};
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 8bdce4af8b..19d9f25307 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -3324,6 +3324,9 @@ void QGraphicsScene::advance()
\l{QWidget::}{enterEvent()} and \l{QWidget::}{leaveEvent()}. Use this
function to obtain those events instead.
+ Returns \c true if \a event has been recognized and processed; otherwise,
+ returns \c false.
+
\sa contextMenuEvent(), keyPressEvent(), keyReleaseEvent(),
mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(),
mouseDoubleClickEvent(), focusInEvent(), focusOutEvent()
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index f69faa7572..ad3be5766d 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -1232,6 +1232,9 @@ QVariant QGraphicsWidget::propertyChange(const QString &propertyName, const QVar
event() or in any of the convenience functions; you should not have to
reimplement this function in a subclass of QGraphicsWidget.
+ Returns \c true if \a event has been recognized and processed; otherwise,
+ returns \c false.
+
\sa QGraphicsItem::sceneEvent()
*/
bool QGraphicsWidget::sceneEvent(QEvent *event)
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 59d3ed1d15..95631ffa5f 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1689,6 +1689,9 @@ bool QAbstractItemView::event(QEvent *event)
This? mode, if the given \a event is a QEvent::ToolTip,or a
QEvent::WhatsThis. It passes all other
events on to its base class viewportEvent() handler.
+
+ Returns \c true if \a event has been recognized and processed; otherwise,
+ returns \c false.
*/
bool QAbstractItemView::viewportEvent(QEvent *event)
{
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 43dd004530..2d49dd4421 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -244,6 +244,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
case QVariant::Bool: {
QBooleanComboBox *cb = new QBooleanComboBox(parent);
cb->setFrame(false);
+ cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy());
return cb; }
#endif
#if QT_CONFIG(spinbox)
@@ -252,12 +253,14 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
sb->setFrame(false);
sb->setMinimum(0);
sb->setMaximum(INT_MAX);
+ sb->setSizePolicy(QSizePolicy::Ignored, sb->sizePolicy().verticalPolicy());
return sb; }
case QVariant::Int: {
QSpinBox *sb = new QSpinBox(parent);
sb->setFrame(false);
sb->setMinimum(INT_MIN);
sb->setMaximum(INT_MAX);
+ sb->setSizePolicy(QSizePolicy::Ignored, sb->sizePolicy().verticalPolicy());
return sb; }
#endif
#if QT_CONFIG(datetimeedit)
@@ -284,6 +287,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
sb->setFrame(false);
sb->setMinimum(-DBL_MAX);
sb->setMaximum(DBL_MAX);
+ sb->setSizePolicy(QSizePolicy::Ignored, sb->sizePolicy().verticalPolicy());
return sb; }
#endif
#if QT_CONFIG(lineedit)
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 363422ac74..dc8765ad88 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -2930,7 +2930,7 @@ bool QPlainTextEdit::find(const QRegExp &exp, QTextDocument::FindFlags options)
#endif
/*!
- \fn bool QTextEdit::find(const QRegularExpression &exp, QTextDocument::FindFlags options)
+ \fn bool QPlainTextEdit::find(const QRegularExpression &exp, QTextDocument::FindFlags options)
\since 5.13
\overload
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index 884eface3c..adc329131c 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -1078,7 +1078,11 @@ bool QToolBarAreaLayout::insertGap(const QList<int> &path, QLayoutItem *item)
void QToolBarAreaLayout::remove(const QList<int> &path)
{
Q_ASSERT(path.count() == 3);
- docks[path.at(0)].lines[path.at(1)].toolBarItems.removeAt(path.at(2));
+ QToolBarAreaLayoutInfo &dock = docks[path.at(0)];
+ QToolBarAreaLayoutLine &line = dock.lines[path.at(1)];
+ line.toolBarItems.removeAt(path.at(2));
+ if (line.toolBarItems.isEmpty())
+ dock.lines.removeAt(path.at(1));
}
void QToolBarAreaLayout::remove(QLayoutItem *item)