Merge remote-tracking branch 'origin/5.13' into dev

Change-Id: Ief0a0b754c104d5348fee9ee15e967bd37c526f8
This commit is contained in:
Qt Forward Merge Bot 2019-03-16 01:01:29 +01:00
commit 11b9c813e6
33 changed files with 394 additions and 123 deletions

View File

@ -125,11 +125,8 @@ goto doneargs
:platform
shift
if "%~1" == "win32-msvc2012" goto msvc
if "%~1" == "win32-msvc2013" goto msvc
if "%~1" == "win32-msvc2015" goto msvc
if "%~1" == "win32-msvc2017" goto msvc
set PLATFORM=%~1
if "%PLATFORM:~0,10%" == "win32-msvc" goto msvc
goto nextarg
:msvc
echo. >&2
@ -150,7 +147,7 @@ goto doneargs
:doneargs
rem Find various executables
for %%C in (clang-cl.exe cl.exe icl.exe g++.exe perl.exe jom.exe) do set %%C=%%~$PATH:C
for %%C in (clang-cl.exe clang.exe cl.exe icl.exe g++.exe perl.exe jom.exe) do set %%C=%%~$PATH:C
rem Determine host spec
@ -161,6 +158,8 @@ if "%PLATFORM%" == "" (
set PLATFORM=win32-msvc
) else if not "%clang-cl.exe%" == "" (
set PLATFORM=win32-clang-msvc
) else if not "%clang.exe%" == "" (
set PLATFORM=win32-clang-g++
) else if not "%g++.exe%" == "" (
set PLATFORM=win32-g++
) else (
@ -172,7 +171,7 @@ if not exist "%QTSRC%\mkspecs\%PLATFORM%\qmake.conf" (
echo Host platform '%PLATFORM%' is invalid. Aborting. >&2
exit /b 1
)
if "%PLATFORM:win32-g++=%" == "%PLATFORM%" (
if "%PLATFORM:g++=%" == "%PLATFORM%" (
if "%MAKE%" == "" (
if not "%jom.exe%" == "" (
set MAKE=jom

View File

@ -69,7 +69,7 @@ class LcdNumber : public QFrame
//! [6]
public:
//! [6] //! [7]
LcdNumber(QWidget *parent = 0);
LcdNumber(QWidget *parent = nullptr);
//! [7]
//! [8]

View File

@ -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().

View File

@ -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
#if !defined(QT_NO_DEBUG_OUTPUT)
# define qCDebug qDebug
#else
# define qCDebug(category) QT_NO_QDEBUG_MACRO()
#endif
#if !defined(QT_NO_INFO_OUTPUT)
# define qCInfo qInfo
#else
# define qCInfo(category) QT_NO_QDEBUG_MACRO()
#endif
#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)
#if defined(QT_NO_DEBUG_OUTPUT)
# undef qCDebug
# define qCDebug(category) QT_NO_QDEBUG_MACRO()
#endif
#if defined(QT_NO_INFO_OUTPUT)
# undef qCInfo
# define qCInfo(category) QT_NO_QDEBUG_MACRO()
#endif
#if defined(QT_NO_WARNING_OUTPUT)
# undef qCWarning
# define qCWarning(category) QT_NO_QDEBUG_MACRO()
#endif
QT_END_NAMESPACE
#endif // QLOGGINGCATEGORY_H

View File

@ -48,22 +48,24 @@
QT_REQUIRE_CONFIG(processenvironment);
#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;
#endif
QT_BEGIN_NAMESPACE
class QProcessPrivate;
#if !defined(Q_OS_WIN)
typedef qint64 Q_PID;
#else
QT_END_NAMESPACE
typedef struct _PROCESS_INFORMATION *Q_PID;
typedef struct _SECURITY_ATTRIBUTES Q_SECURITY_ATTRIBUTES;
typedef struct _STARTUPINFOW Q_STARTUPINFO;
QT_BEGIN_NAMESPACE
#endif
class QProcessEnvironmentPrivate;
#ifndef Q_OS_WIN
typedef qint64 Q_PID;
#endif
class Q_CORE_EXPORT QProcessEnvironment
{
public:

View File

@ -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)

View File

@ -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

View File

@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
class QIconPrivate;
class QIconEngine;
class QPainter;
class Q_GUI_EXPORT QIcon
{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -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);
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);
QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(
window2, getTimestamp(), touchDevice, touchPointList, keyModifier);
if (eventType == EMSCRIPTEN_EVENT_TOUCHCANCEL)
QWindowSystemInterface::handleTouchCancelEvent(window2, getTimestamp(), touchDevice, keyModifier);
QWasmEventDispatcher::maintainTimers();
return 1;
return 0;
}
quint64 QWasmEventTranslator::getTimestamp()

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -62,19 +62,70 @@ QT_BEGIN_NAMESPACE
static const DWORD VENDOR_ID_AMD = 0x1002;
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"))
{
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()
{
typedef IDirect3D9 * (WINAPI *PtrDirect3DCreate9)(UINT);
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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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"),
};

View File

@ -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()

View File

@ -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)

View File

@ -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)
{

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -53,6 +53,7 @@ void tst_QNoDebug::noDebugOutput() const
// should do nothing
qDebug() << "foo";
qCDebug(cat) << "foo";
qCDebug(cat, "foo");
// qWarning still works, though
QTest::ignoreMessage(QtWarningMsg, "bar");

View File

@ -0,0 +1,111 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
// Test that the size of the saved state bytearray does not change due to moving a
// toolbar from one area to another. It should stay the same size as the first time
// it had that toolbar in it
#include <QApplication>
#include <QMainWindow>
#include <QToolBar>
#include <QPushButton>
#include <QLabel>
#include <QVBoxLayout>
#include <QMessageBox>
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow() : QMainWindow()
{
auto *tb = new QToolBar(this);
tb->setObjectName("Toolbar");
tb->addAction("Test action");
tb->addAction("Test action");
addToolBar(Qt::TopToolBarArea, tb);
auto *movableTb = new QToolBar(this);
movableTb->setObjectName("Movable Toolbar");
movableTb->addAction("Test action");
movableTb->addAction("Test action");
addToolBar(Qt::TopToolBarArea, movableTb);
auto *widget = new QWidget;
auto *vbox = new QVBoxLayout;
auto *label = new QLabel;
label->setText("1. Click on check state size to save initial state\n"
"2. Drag the movable toolbar in the top dock area to the left area."
" Click on check state size to save moved state\n"
"3. Drag the movable toolbar from the left dock area to the top area."
" Click on check state size to compare the state sizes.\n"
"4. Drag the movable toolbar in the top dock area to the left area."
" Click on check state size to compare the state sizes.\n"
"5. Drag the movable toolbar from the left dock area to the top area."
" Click on check state size to compare the state sizes.\n");
vbox->addWidget(label);
auto *pushButton = new QPushButton("Check state size");
connect(pushButton, &QPushButton::clicked, this, &MainWindow::checkState);
vbox->addWidget(pushButton);
widget->setLayout(vbox);
setCentralWidget(widget);
}
public slots:
void checkState()
{
stepCounter++;
QString messageText;
if (stepCounter == 1) {
beforeMoveStateData = saveState();
messageText = QLatin1String("Initial state saved");
} else if (stepCounter == 2) {
afterMoveStateData = saveState();
messageText = QLatin1String("Moved state saved");
} else {
const int currentSaveSize = saveState().size();
const int compareValue = (stepCounter == 4) ? afterMoveStateData.size() : beforeMoveStateData.size();
messageText = QString::fromLatin1("%1 step %2")
.arg((currentSaveSize == compareValue) ? QLatin1String("SUCCESS") : QLatin1String("FAIL"))
.arg(stepCounter);
}
QMessageBox::information(this, "Step done", messageText);
}
private:
int stepCounter = 0;
QByteArray beforeMoveStateData;
QByteArray afterMoveStateData;
};
#include "main.moc"
int main(int argc, char **argv)
{
QApplication a(argc, argv);
MainWindow mw;
mw.show();
return a.exec();
}

View File

@ -0,0 +1,4 @@
QT += widgets
TEMPLATE = app
TARGET = saveStateSize
SOURCES += main.cpp