diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-09-13 01:00:38 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-09-13 01:00:39 +0200 |
commit | f5bf8ca9c31d98fbfd2d7691724f5339deacbe1c (patch) | |
tree | a606b82ed39f3d89fd757d0d2e2064b2cc268fe6 | |
parent | d5891036de4622e18cf4d68750610224ad201ee0 (diff) | |
parent | 0d1481b4d26997bab9ab9a6200776b27b9826ba6 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: Icd201bf6b634e44e0e2ab05eaf91a7d8588d7f05
29 files changed, 211 insertions, 61 deletions
diff --git a/bin/syncqt.pl b/bin/syncqt.pl index 8890b31770..77ce90c164 100755 --- a/bin/syncqt.pl +++ b/bin/syncqt.pl @@ -1111,7 +1111,7 @@ foreach my $lib (@modules_to_sync) { elsif (!$shadow) { $pri_install_pfiles.= "$pri_install_iheader ";; } - $pri_injections .= fixPaths($iheader, "$out_basedir/include/$lib") + $pri_injections .= fixPaths($iheader, $out_basedir) .":".($no_stamp ? "^" : "").fixPaths($oheader, "$out_basedir/include/$lib") .$injection." " if ($shadow); } diff --git a/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp b/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp index 67ae0ca5dc..257191ef4e 100644 --- a/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp +++ b/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp @@ -223,6 +223,16 @@ bool VulkanRenderer::createTextureImage(const QSize &size, VkImage *image, VkDev VkMemoryRequirements memReq; m_devFuncs->vkGetImageMemoryRequirements(dev, *image, &memReq); + if (!(memReq.memoryTypeBits & (1 << memIndex))) { + VkPhysicalDeviceMemoryProperties physDevMemProps; + m_window->vulkanInstance()->functions()->vkGetPhysicalDeviceMemoryProperties(m_window->physicalDevice(), &physDevMemProps); + for (uint32_t i = 0; i < physDevMemProps.memoryTypeCount; ++i) { + if (!(memReq.memoryTypeBits & (1 << i))) + continue; + memIndex = i; + } + } + VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, nullptr, @@ -294,12 +304,12 @@ void VulkanRenderer::ensureTexture() barrier.oldLayout = VK_IMAGE_LAYOUT_PREINITIALIZED; barrier.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - barrier.srcAccessMask = 0; // VK_ACCESS_HOST_WRITE_BIT ### no, keep validation layer happy (??) + barrier.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT; barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT; barrier.image = m_texImage; m_devFuncs->vkCmdPipelineBarrier(cb, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); @@ -312,7 +322,7 @@ void VulkanRenderer::ensureTexture() barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; barrier.image = m_texStaging; m_devFuncs->vkCmdPipelineBarrier(cb, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); diff --git a/mkspecs/common/winrt_winphone/qmake.conf b/mkspecs/common/winrt_winphone/qmake.conf index 8c1a767dfa..375e084127 100644 --- a/mkspecs/common/winrt_winphone/qmake.conf +++ b/mkspecs/common/winrt_winphone/qmake.conf @@ -8,7 +8,9 @@ MAKEFILE_GENERATOR = MSBUILD QMAKE_COMPILER = msvc QMAKE_PLATFORM = winrt win32 CONFIG = package_manifest $$CONFIG incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target rtti -DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT Q_BYTE_ORDER=Q_LITTLE_ENDIAN +# MSVC 2017 15.8+ fixed std::aligned_storage but compilation fails without +# _ENABLE_EXTENDED_ALIGNED_STORAGE flag since the fix breaks binary compatibility. +DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT Q_BYTE_ORDER=Q_LITTLE_ENDIAN _ENABLE_EXTENDED_ALIGNED_STORAGE QMAKE_COMPILER_DEFINES += _WIN32 DEPLOYMENT_PLUGIN += qwinrt diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf index 1848f00e90..3bb3823a8e 100644 --- a/mkspecs/features/qt_build_paths.prf +++ b/mkspecs/features/qt_build_paths.prf @@ -12,7 +12,8 @@ # Find the module's source root dir. isEmpty(_QMAKE_CONF_): error("Project has no top-level .qmake.conf file.") MODULE_BASE_INDIR = $$dirname(_QMAKE_CONF_) -MODULE_BASE_OUTDIR = $$shadowed($$MODULE_BASE_INDIR) +REAL_MODULE_BASE_OUTDIR = $$shadowed($$MODULE_BASE_INDIR) +MODULE_BASE_OUTDIR = $$REAL_MODULE_BASE_OUTDIR !isEmpty(MODULE_BASE_DIR): MODULE_SYNCQT_DIR = $$MODULE_BASE_DIR # compat for webkit isEmpty(MODULE_SYNCQT_DIR): MODULE_SYNCQT_DIR = $$MODULE_BASE_INDIR isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf index bbded56b42..70d3520e5c 100644 --- a/mkspecs/features/qt_module_headers.prf +++ b/mkspecs/features/qt_module_headers.prf @@ -123,7 +123,7 @@ MODULE_INC_OUTDIR = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME isEmpty(MODULE_CFG_FILE): MODULE_CFG_FILE = qt$${MODULE}-config exists($$OUT_PWD/$${MODULE_CFG_FILE}.h) { - fwd_rel = $$relative_path($$OUT_PWD, $$MODULE_INC_OUTDIR) + fwd_rel = $$relative_path($$OUT_PWD, $$REAL_MODULE_BASE_OUTDIR) SYNCQT.INJECTIONS += \ $$fwd_rel/$${MODULE_CFG_FILE}.h:$${MODULE_CFG_FILE}.h \ $$fwd_rel/$${MODULE_CFG_FILE}_p.h:$$MODULE_VERSION/$$MODULE_INCNAME/private/$${MODULE_CFG_FILE}_p.h @@ -131,7 +131,7 @@ exists($$OUT_PWD/$${MODULE_CFG_FILE}.h) { for (injection, SYNCQT.INJECTIONS) { injects = $$split(injection, :) - dst_hdr = $$absolute_path($$member(injects, 0), $$MODULE_INC_OUTDIR) + dst_hdr = $$absolute_path($$member(injects, 0), $$REAL_MODULE_BASE_OUTDIR) ofwd_hdr = $$member(injects, 1) fwd_hdr = $$replace(ofwd_hdr, ^\\^, ) MAIN_FWD = $$MODULE_INC_OUTDIR/$$fwd_hdr diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 582e403e4c..4b1031daaf 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6499,7 +6499,13 @@ static void qInitDrawhelperFunctions() #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN extern void QT_FASTCALL convertARGB32ToARGB32PM_neon(uint *buffer, int count, const QVector<QRgb> *); extern void QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, int count, const QVector<QRgb> *); + extern const uint *QT_FASTCALL fetchARGB32ToARGB32PM_neon(uint *buffer, const uchar *src, int index, int count, + const QVector<QRgb> *, QDitherInfo *); + extern const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM_neon(uint *buffer, const uchar *src, int index, int count, + const QVector<QRgb> *, QDitherInfo *); + qPixelLayouts[QImage::Format_ARGB32].fetchToARGB32PM = fetchARGB32ToARGB32PM_neon; qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_neon; + qPixelLayouts[QImage::Format_RGBA8888].fetchToARGB32PM = fetchRGBA8888ToARGB32PM_neon; qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_neon; #endif diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index 44d4037c0d..98995f485a 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -1163,6 +1163,20 @@ void QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, int count, const Q convertARGBToARGB32PM_neon<true>(buffer, buffer, count); } +const uint *QT_FASTCALL fetchARGB32ToARGB32PM_neon(uint *buffer, const uchar *src, int index, int count, + const QVector<QRgb> *, QDitherInfo *) +{ + convertARGBToARGB32PM_neon<false>(buffer, reinterpret_cast<const uint *>(src) + index, count); + return buffer; +} + +const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM_neon(uint *buffer, const uchar *src, int index, int count, + const QVector<QRgb> *, QDitherInfo *) +{ + convertARGBToARGB32PM_neon<true>(buffer, reinterpret_cast<const uint *>(src) + index, count); + return buffer; +} + #endif // Q_BYTE_ORDER == Q_LITTLE_ENDIAN QT_END_NAMESPACE diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 41e81c5fbe..b70b29e54e 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1297,7 +1297,7 @@ void QPainterPrivate::updateState(QPainterState *newState) itself and its bounding rectangle: The bounding rect contains pixels with alpha == 0 (i.e the pixels surrounding the primitive). These pixels will overwrite the other image's pixels, - affectively clearing those, while the primitive only overwrites + effectively clearing those, while the primitive only overwrites its own area. \table 100% @@ -1387,7 +1387,7 @@ void QPainterPrivate::updateState(QPainterState *newState) clip. \li Composition Modes \c QPainter::CompositionMode_Source and - QPainter::CompositionMode_SourceOver + QPainter::CompositionMode_SourceOver. \li Rounded rectangle filling using solid color and two-color linear gradients fills. @@ -8259,6 +8259,7 @@ void QPainter::setTransform(const QTransform &transform, bool combine ) } /*! + Alias for worldTransform(). Returns the world transformation matrix. \sa worldTransform() diff --git a/src/gui/util/qktxhandler.cpp b/src/gui/util/qktxhandler.cpp index c7831f8143..7eda4c46fb 100644 --- a/src/gui/util/qktxhandler.cpp +++ b/src/gui/util/qktxhandler.cpp @@ -43,6 +43,11 @@ #include <QSize> //#define KTX_DEBUG +#ifdef KTX_DEBUG +#include <QDebug> +#include <QMetaEnum> +#include <QOpenGLTexture> +#endif QT_BEGIN_NAMESPACE @@ -68,7 +73,7 @@ struct KTXHeader { quint32 bytesOfKeyValueData; }; -static const int headerSize = sizeof(KTXHeader); +static const quint32 headerSize = sizeof(KTXHeader); // Currently unused, declared for future reference struct KTXKeyValuePairItem { @@ -111,7 +116,8 @@ QTextureFileData QKtxHandler::read() return QTextureFileData(); QByteArray buf = device()->readAll(); - if (buf.size() < headerSize || !canRead(QByteArray(), buf)) { + const quint32 dataSize = quint32(buf.size()); + if (dataSize < headerSize || !canRead(QByteArray(), buf)) { qCDebug(lcQtGuiTextureIO, "Invalid KTX file %s", logName().constData()); return QTextureFileData(); } @@ -130,13 +136,17 @@ QTextureFileData QKtxHandler::read() texData.setGLInternalFormat(decode(header->glInternalFormat)); texData.setGLBaseInternalFormat(decode(header->glBaseInternalFormat)); - //### For now, ignore any additional mipmap levels - texData.setNumLevels(1); - int preambleSize = headerSize + decode(header->bytesOfKeyValueData); - if (buf.size() >= preambleSize + int(sizeof(KTXMipmapLevel))) { - texData.setDataOffset(preambleSize + sizeof(quint32)); // for the imageSize - const KTXMipmapLevel *level = reinterpret_cast<const KTXMipmapLevel *>(buf.constData() + preambleSize); - texData.setDataLength(decode(level->imageSize)); + texData.setNumLevels(decode(header->numberOfMipmapLevels)); + quint32 offset = headerSize + decode(header->bytesOfKeyValueData); + const int maxLevels = qMin(texData.numLevels(), 32); // Cap iterations in case of corrupt file. + for (int i = 0; i < maxLevels; i++) { + if (offset + sizeof(KTXMipmapLevel) > dataSize) // Corrupt file; avoid oob read + break; + const KTXMipmapLevel *level = reinterpret_cast<const KTXMipmapLevel *>(buf.constData() + offset); + quint32 levelLen = decode(level->imageSize); + texData.setDataOffset(offset + sizeof(KTXMipmapLevel::imageSize), i); + texData.setDataLength(levelLen, i); + offset += sizeof(KTXMipmapLevel::imageSize) + levelLen + (3 - ((levelLen + 3) % 4)); } if (!texData.isValid()) { @@ -147,7 +157,7 @@ QTextureFileData QKtxHandler::read() texData.setLogName(logName()); #ifdef KTX_DEBUG - qDebug() << "KTX file handler read" << texData.data(); + qDebug() << "KTX file handler read" << texData; #endif return texData; diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp index e45a16170e..2e65ab49c5 100644 --- a/src/gui/vulkan/qvulkanwindow.cpp +++ b/src/gui/vulkan/qvulkanwindow.cpp @@ -989,7 +989,7 @@ bool QVulkanWindowPrivate::createDefaultRenderPass() attDesc[1].samples = sampleCount; attDesc[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; attDesc[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - attDesc[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; + attDesc[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; attDesc[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attDesc[1].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; attDesc[1].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; @@ -999,7 +999,7 @@ bool QVulkanWindowPrivate::createDefaultRenderPass() attDesc[2].format = colorFormat; attDesc[2].samples = sampleCount; attDesc[2].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; - attDesc[2].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; + attDesc[2].storeOp = VK_ATTACHMENT_STORE_OP_STORE; attDesc[2].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; attDesc[2].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attDesc[2].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; @@ -2164,8 +2164,8 @@ void QVulkanWindowPrivate::addReadback() barrier.image = frameGrabImage; devFuncs->vkCmdPipelineBarrier(image.cmdBuf, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, + VK_PIPELINE_STAGE_HOST_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); } @@ -2298,6 +2298,11 @@ uint32_t QVulkanWindow::hostVisibleMemoryIndex() const \note Calling this function is only valid from the invocation of QVulkanWindowRenderer::initResources() up until QVulkanWindowRenderer::releaseResources(). + + \note It is not guaranteed that this memory type is always suitable. The + correct, cross-implementation solution - especially for device local images + - is to manually pick a memory type after checking the mask returned from + \c{vkGetImageMemoryRequirements}. */ uint32_t QVulkanWindow::deviceLocalMemoryIndex() const { diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index 1c21879a89..97309ea990 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -106,6 +106,36 @@ static QRegExp whitespaceRegex = QRegExp(QStringLiteral("\\s*")); return QCocoaScreen::mapToNative(maximizedFrame); } +#pragma clang diagnostic push +// NSDisableScreenUpdates and NSEnableScreenUpdates are deprecated, but the +// NSAnimationContext API that replaces them doesn't handle the use-case of +// cross-thread screen update synchronization. +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)frameSize +{ + qCDebug(lcQpaWindow) << window << "will resize to" << QSizeF::fromCGSize(frameSize) + << "- disabling screen updates temporarily"; + + // There may be separate threads rendering to CA layers in this window, + // and if any of them do a swap while the resize is still in progress, + // the visual bounds of that layer will be updated before the visual + // bounds of the window frame, resulting in flickering while resizing. + + // To prevent this we disable screen updates for the whole process until + // the resize is complete, which makes the whole thing visually atomic. + NSDisableScreenUpdates(); + + return frameSize; +} + +- (void)windowDidResize:(NSNotification *)notification +{ + NSWindow *window = notification.object; + qCDebug(lcQpaWindow) << window << "was resized - re-enabling screen updates"; + NSEnableScreenUpdates(); +} +#pragma clang diagnostic pop + - (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu { Q_UNUSED(window); diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json index d1e9f85247..b618d8567a 100644 --- a/src/plugins/platforms/windows/openglblacklists/default.json +++ b/src/plugins/platforms/windows/openglblacklists/default.json @@ -141,6 +141,18 @@ "features": [ "disable_desktopgl", "disable_d3d11", "disable_d3d9" ] + }, + { + "id": 12, + "description": "Intel HD Graphics 620 crash in conjunction with shader caches (QTBUG-64697)", + "vendor_id": "0x8086", + "device_id": [ "0x5916" ], + "os": { + "type": "win" + }, + "features": [ + "disable_program_cache" + ] } ] } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 4824de5c9c..0694435427 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -418,6 +418,10 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate() } const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers(); + if (supportedRenderers.testFlag(QWindowsOpenGLTester::DisableProgramCacheFlag) + && !QCoreApplication::testAttribute(Qt::AA_DisableShaderDiskCache)) { + QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache); + } if (supportedRenderers & QWindowsOpenGLTester::DesktopGl) { if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) { if ((supportedRenderers & QWindowsOpenGLTester::DisableRotationFlag) diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index 6af9f168a5..9a630aff4f 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -301,6 +301,10 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c qCDebug(lcQpaGl) << "Disabling rotation: " << gpu; result |= DisableRotationFlag; } + if (features.contains(QStringLiteral("disable_program_cache"))) { + qCDebug(lcQpaGl) << "Disabling program cache: " << gpu; + result |= DisableProgramCacheFlag; + } srCache->insert(qgpu, result); return result; #endif // !QT_NO_OPENGL diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h index 22170f30b0..bec87c1f86 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.h +++ b/src/plugins/platforms/windows/qwindowsopengltester.h @@ -83,7 +83,8 @@ public: GlesMask = Gles | AngleBackendMask, SoftwareRasterizer = 0x0020, RendererMask = 0x00FF, - DisableRotationFlag = 0x0100 + DisableRotationFlag = 0x0100, + DisableProgramCacheFlag = 0x0200 }; Q_DECLARE_FLAGS(Renderers, Renderer) diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp index 547eb2043d..daf9686b5e 100644 --- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp +++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp @@ -72,6 +72,7 @@ inline static QString fromSQLTCHAR(const QVarLengthArray<SQLTCHAR>& input, int s { QString result; + // Remove any trailing \0 as some drivers misguidedly append one int realsize = qMin(size, input.size()); if(realsize > 0 && input[realsize-1] == 0) realsize--; @@ -458,7 +459,6 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni // more data can be fetched, the length indicator does NOT // contain the number of bytes returned - it contains the // total number of bytes that CAN be fetched - // colSize-1: remove 0 termination when there is more data to fetch int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : int(lengthIndicator / sizeof(SQLTCHAR)); fieldVal += fromSQLTCHAR(buf, rSize); if (lengthIndicator < SQLLEN(colSize*sizeof(SQLTCHAR))) { @@ -499,9 +499,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni // more data can be fetched, the length indicator does NOT // contain the number of bytes returned - it contains the // total number of bytes that CAN be fetched - // colSize-1: remove 0 termination when there is more data to fetch int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : lengthIndicator; - fieldVal += QString::fromUtf8((const char *)buf.constData(), rSize); + // Remove any trailing \0 as some drivers misguidedly append one + int realsize = qMin(rSize, buf.size()); + if (realsize > 0 && buf[realsize - 1] == 0) + realsize--; + fieldVal += QString::fromUtf8(reinterpret_cast<const char *>(buf.constData()), realsize); if (lengthIndicator < SQLLEN(colSize)) { // workaround for Drivermanagers that don't return SQL_NO_DATA break; diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index 5e0f7626b4..5796644d34 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -1465,8 +1465,11 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const precision = -1; } QString defVal = query.value(5).toString(); - if (!defVal.isEmpty() && defVal.at(0) == QLatin1Char('\'')) - defVal = defVal.mid(1, defVal.length() - 2); + if (!defVal.isEmpty() && defVal.at(0) == QLatin1Char('\'')) { + const int end = defVal.lastIndexOf(QLatin1Char('\'')); + if (end > 0) + defVal = defVal.mid(1, end - 1); + } QSqlField f(query.value(0).toString(), qDecodePSQLType(query.value(1).toInt()), tablename); f.setRequired(query.value(2).toBool()); f.setLength(len); diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index e1bf0f2d47..81b5776a7c 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -917,13 +917,20 @@ static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString &tableName, bool only if (onlyPIndex && !isPk) continue; QString typeName = q.value(2).toString().toLower(); + QString defVal = q.value(4).toString(); + if (!defVal.isEmpty() && defVal.at(0) == QLatin1Char('\'')) { + const int end = defVal.lastIndexOf(QLatin1Char('\'')); + if (end > 0) + defVal = defVal.mid(1, end - 1); + } + QSqlField fld(q.value(1).toString(), qGetColumnType(typeName), tableName); if (isPk && (typeName == QLatin1String("integer"))) // INTEGER PRIMARY KEY fields are auto-generated in sqlite // INT PRIMARY KEY is not the same as INTEGER PRIMARY KEY! fld.setAutoValue(true); fld.setRequired(q.value(3).toInt() != 0); - fld.setDefaultValue(q.value(4)); + fld.setDefaultValue(defVal); ind.append(fld); } return ind; diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 9364122593..ff36beadcb 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -1802,24 +1802,23 @@ void tst_QLocale::macDefaultLocale() // Depending on the configured time zone, the time string might not // contain a GMT specifier. (Sometimes it just names the zone, like "CEST") - if (timeString.contains(QString("GMT"))) { - QString expectedGMTSpecifierBase("GMT"); - if (diff >= 0) - expectedGMTSpecifierBase.append(QLatin1Char('+')); - else - expectedGMTSpecifierBase.append(QLatin1Char('-')); - - QString expectedGMTSpecifier = expectedGMTSpecifierBase + QString("%1").arg(qAbs(diff)); - QString expectedGMTSpecifierZeroExtended - = expectedGMTSpecifierBase + QString("0%1").arg(qAbs(diff)); - - QVERIFY2(timeString.contains(expectedGMTSpecifier) - || timeString.contains(expectedGMTSpecifierZeroExtended), - qPrintable(QString("timeString `%1', expectedGMTSpecifier `%2' or `%3'") - .arg(timeString) - .arg(expectedGMTSpecifier) - .arg(expectedGMTSpecifierZeroExtended) - )); + QLatin1String gmt("GMT"); + if (timeString.contains(gmt) && diff) { + QLatin1Char sign(diff < 0 ? '-' : '+'); + QString number(QString::number(qAbs(diff))); + const QString expect = gmt + sign + number; + + if (diff < 10) { + const QString zeroed = gmt + sign + QLatin1Char('0') + number; + + QVERIFY2(timeString.contains(expect) || timeString.contains(zeroed), + qPrintable(QString("timeString `%1', expected GMT specifier `%2' or `%3'") + .arg(timeString).arg(expect).arg(zeroed))); + } else { + QVERIFY2(timeString.contains(expect), + qPrintable(QString("timeString `%1', expected GMT specifier `%2'") + .arg(timeString).arg(expect))); + } } QCOMPARE(locale.dayName(1), QString("Monday")); QCOMPARE(locale.dayName(7), QString("Sunday")); diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index d1f14de794..e9a0d44ba7 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -8,6 +8,7 @@ osx-10.12 ci ubuntu-16.04 # QTBUG-66851 opensuse +opensuse-leap # QTBUG-69160 android [setVisible] diff --git a/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc b/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc index 74f33d57ad..ab882b5db2 100644 --- a/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc +++ b/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc @@ -2,5 +2,6 @@ <qresource prefix="/"> <file>texturefiles/car.ktx</file> <file>texturefiles/pattern.pkm</file> + <file>texturefiles/car_mips.ktx</file> </qresource> </RCC> diff --git a/tests/auto/gui/util/qtexturefilereader/texturefiles/car_mips.ktx b/tests/auto/gui/util/qtexturefilereader/texturefiles/car_mips.ktx Binary files differnew file mode 100644 index 0000000000..82822e6c0b --- /dev/null +++ b/tests/auto/gui/util/qtexturefilereader/texturefiles/car_mips.ktx diff --git a/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp b/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp index f480184067..9ff4f0ccf2 100644 --- a/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp +++ b/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp @@ -44,26 +44,38 @@ void tst_qtexturefilereader::checkHandlers_data() QTest::addColumn<QSize>("size"); QTest::addColumn<quint32>("glFormat"); QTest::addColumn<quint32>("glInternalFormat"); - // todo: glBaseInternalFormat + QTest::addColumn<quint32>("glBaseInternalFormat"); QTest::addColumn<int>("levels"); - QTest::addColumn<int>("dataOffset"); - QTest::addColumn<int>("dataLength"); + QTest::addColumn<QList<int>>("dataOffsets"); + QTest::addColumn<QList<int>>("dataLengths"); QTest::addRow("pattern.pkm") << QStringLiteral(":/texturefiles/pattern.pkm") << QSize(64, 64) << quint32(0x0) << quint32(0x8d64) + << quint32(0x0) << 1 - << 16 - << 2048; + << (QList<int>() << 16) + << (QList<int>() << 2048); QTest::addRow("car.ktx") << QStringLiteral(":/texturefiles/car.ktx") << QSize(146, 80) << quint32(0x0) << quint32(0x9278) + << quint32(0x1908) << 1 - << 68 - << 11840; + << (QList<int>() << 68) + << (QList<int>() << 11840); + + QTest::addRow("car_mips.ktx") << QStringLiteral(":/texturefiles/car_mips.ktx") + << QSize(146, 80) + << quint32(0x0) + << quint32(0x9274) + << quint32(0x1907) + << 8 + << (QList<int>() << 68 << 5992 << 7516 << 7880 << 8004 << 8056 << 8068 << 8080) + << (QList<int>() << 5920 << 1520 << 360 << 120 << 48 << 8 << 8 << 8); + } void tst_qtexturefilereader::checkHandlers() @@ -73,8 +85,8 @@ void tst_qtexturefilereader::checkHandlers() QFETCH(quint32, glFormat); QFETCH(quint32, glInternalFormat); QFETCH(int, levels); - QFETCH(int, dataOffset); - QFETCH(int, dataLength); + QFETCH(QList<int>, dataOffsets); + QFETCH(QList<int>, dataLengths); QFile f(fileName); QVERIFY(f.open(QIODevice::ReadOnly)); @@ -88,8 +100,10 @@ void tst_qtexturefilereader::checkHandlers() QCOMPARE(tex.glFormat(), glFormat); QCOMPARE(tex.glInternalFormat(), glInternalFormat); QCOMPARE(tex.numLevels(), levels); - QCOMPARE(tex.dataOffset(), dataOffset); - QCOMPARE(tex.dataLength(), dataLength); + for (int i = 0; i < tex.numLevels(); i++) { + QCOMPARE(tex.dataOffset(i), dataOffsets.at(i)); + QCOMPARE(tex.dataLength(i), dataLengths.at(i)); + } } QTEST_MAIN(tst_qtexturefilereader) diff --git a/tests/auto/other/gestures/BLACKLIST b/tests/auto/other/gestures/BLACKLIST index ff6d2fa48e..269bac5750 100644 --- a/tests/auto/other/gestures/BLACKLIST +++ b/tests/auto/other/gestures/BLACKLIST @@ -5,6 +5,7 @@ ubuntu-18.04 # QTBUG-67254 ubuntu opensuse +opensuse-leap [graphicsItemGesture] ubuntu-18.04 [graphicsItemTreeGesture] diff --git a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp index 7bfa29ec8e..15190b0f3e 100644 --- a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp @@ -54,6 +54,18 @@ private slots: void formatValue(); }; +static bool driverSupportsDefaultValues(QSqlDriver::DbmsType dbType) +{ + switch (dbType) { + case QSqlDriver::SQLite: + case QSqlDriver::PostgreSQL: + case QSqlDriver::Oracle: + return true; + default: + break; + } + return false; +} void tst_QSqlDriver::initTestCase_data() { @@ -81,8 +93,9 @@ void tst_QSqlDriver::recreateTestTables(QSqlDatabase db) doubleField = "more_data double precision"; else doubleField = "more_data double(8,7)"; + const QString defValue(driverSupportsDefaultValues(dbType) ? QStringLiteral("DEFAULT 'defaultVal'") : QString()); QVERIFY_SQL( q, exec("create table " + relTEST1 + - " (id int not null primary key, name varchar(20), title_key int, another_title_key int, " + doubleField + QLatin1Char(')'))); + " (id int not null primary key, name varchar(20) " + defValue + ", title_key int, another_title_key int, " + doubleField + QLatin1Char(')'))); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(1, 'harry', 1, 2, 1.234567)")); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(2, 'trond', 2, 1, 8.901234)")); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(3, 'vohi', 1, 2, 5.678901)")); @@ -127,7 +140,7 @@ void tst_QSqlDriver::record() //check we can get records using an unquoted mixed case table name QSqlRecord rec = db.driver()->record(tablename); - QCOMPARE(rec.count(), 5); + QCOMPARE(rec.count(), fields.size()); QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); // QTBUG-1363: QSqlField::length() always return -1 when using QODBC3 driver and QSqlDatabase::record() @@ -141,6 +154,9 @@ void tst_QSqlDriver::record() for (int i = 0; i < fields.count(); ++i) QCOMPARE(rec.fieldName(i), fields[i]); + if (driverSupportsDefaultValues(dbType)) + QCOMPARE(rec.field(QStringLiteral("name")).defaultValue().toString(), QStringLiteral("defaultVal")); + if (dbType == QSqlDriver::Interbase || dbType == QSqlDriver::Oracle || dbType == QSqlDriver::DB2) tablename = tablename.toUpper(); else if (dbType == QSqlDriver::PostgreSQL) diff --git a/tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST b/tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST index 0f7c377194..c6aeebc8f8 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST +++ b/tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST @@ -5,3 +5,4 @@ opensuse-42.3 ci [comboBox] # QTBUG-67282 opensuse +opensuse-leap diff --git a/tests/auto/widgets/kernel/qapplication/BLACKLIST b/tests/auto/widgets/kernel/qapplication/BLACKLIST index ca0efdff8a..d7de7bf16e 100644 --- a/tests/auto/widgets/kernel/qapplication/BLACKLIST +++ b/tests/auto/widgets/kernel/qapplication/BLACKLIST @@ -1,3 +1,4 @@ [touchEventPropagation] # QTBUG-66745 opensuse +opensuse-leap diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 2be016e99b..d8654e5768 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -16,6 +16,7 @@ linux [raise] # QTBUG-68175 opensuse +opensuse-leap [setWindowGeometry] osx [windowMoveResize] @@ -36,6 +37,7 @@ osx-10.12 ci osx-10.13 ci [maskedUpdate] opensuse +opensuse-leap [moveInResizeEvent] ubuntu-16.04 [moveChild:right] diff --git a/tests/auto/widgets/widgets/qspinbox/BLACKLIST b/tests/auto/widgets/widgets/qspinbox/BLACKLIST index cc049df942..a38511bfb4 100644 --- a/tests/auto/widgets/widgets/qspinbox/BLACKLIST +++ b/tests/auto/widgets/widgets/qspinbox/BLACKLIST @@ -1,2 +1,3 @@ [stepModifierPressAndHold] opensuse ci # QTBUG-69492 +opensuse-leap ci |