diff options
20 files changed, 109 insertions, 34 deletions
diff --git a/.qmake.conf b/.qmake.conf index 57938d9989..16b4b3995d 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -4,4 +4,4 @@ CONFIG += warning_clean QT_SOURCE_TREE = $$PWD QT_BUILD_TREE = $$shadowed($$PWD) -MODULE_VERSION = 5.9.5 +MODULE_VERSION = 5.9.6 diff --git a/examples/widgets/animation/sub-attaq/mainwindow.cpp b/examples/widgets/animation/sub-attaq/mainwindow.cpp index 106404682d..b08a7d9f98 100644 --- a/examples/widgets/animation/sub-attaq/mainwindow.cpp +++ b/examples/widgets/animation/sub-attaq/mainwindow.cpp @@ -84,8 +84,13 @@ MainWindow::MainWindow() : QMainWindow(0) view->setAlignment(Qt::AlignLeft | Qt::AlignTop); scene->setupScene(newAction, quitAction); #ifndef QT_NO_OPENGL - view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); + QGLWidget *glWidget = new QGLWidget(QGLFormat(QGL::SampleBuffers)); + if (glWidget->context()->isValid()) { + view->setViewport(glWidget); + } else { + qWarning("Unable to create an Open GL context with sample buffers, not using Open GL."); + delete glWidget; + } #endif - setCentralWidget(view); } diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index f7adb021b6..993230e184 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -427,15 +427,15 @@ QString qt_readEscapedFormatString(const QString &format, int *idx); bool qt_splitLocaleName(const QString &name, QString &lang, QString &script, QString &cntry); int qt_repeatCount(const QString &s, int i); -enum { AsciiSpaceMask = (1 << (' ' - 1)) | - (1 << ('\t' - 1)) | // 9: HT - horizontal tab - (1 << ('\n' - 1)) | // 10: LF - line feed - (1 << ('\v' - 1)) | // 11: VT - vertical tab - (1 << ('\f' - 1)) | // 12: FF - form feed - (1 << ('\r' - 1)) }; // 13: CR - carriage return +enum { AsciiSpaceMask = (1u << (' ' - 1)) | + (1u << ('\t' - 1)) | // 9: HT - horizontal tab + (1u << ('\n' - 1)) | // 10: LF - line feed + (1u << ('\v' - 1)) | // 11: VT - vertical tab + (1u << ('\f' - 1)) | // 12: FF - form feed + (1u << ('\r' - 1)) }; // 13: CR - carriage return Q_DECL_CONSTEXPR inline bool ascii_isspace(uchar c) { - return c >= 1U && c <= 32U && (uint(AsciiSpaceMask) >> uint(c - 1)) & 1U; + return c >= 1u && c <= 32u && (AsciiSpaceMask >> uint(c - 1)) & 1u; } #if defined(Q_COMPILER_CONSTEXPR) diff --git a/src/dbus/Qt5DBusMacros.cmake b/src/dbus/Qt5DBusMacros.cmake index 0bd7364637..b381ab0934 100644 --- a/src/dbus/Qt5DBusMacros.cmake +++ b/src/dbus/Qt5DBusMacros.cmake @@ -61,8 +61,7 @@ function(QT5_ADD_DBUS_INTERFACE _sources _interface _basename) COMMAND ${Qt5DBus_QDBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile} DEPENDS ${_infile} VERBATIM) - set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) - set_source_files_properties("${_header}" PROPERTIES SKIP_AUTOMOC TRUE) + set_source_files_properties("${_impl}" "${_header}" PROPERTIES SKIP_AUTOMOC TRUE) qt5_generate_moc("${_header}" "${_moc}") @@ -147,8 +146,7 @@ function(QT5_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optio endif() qt5_generate_moc("${_header}" "${_moc}") - set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) - set_source_files_properties("${_header}" PROPERTIES SKIP_AUTOMOC TRUE) + set_source_files_properties("${_impl}" "${_header}" PROPERTIES SKIP_AUTOMOC TRUE) macro_add_file_dependencies("${_impl}" "${_moc}") list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h index 167f725143..dc7a4dfe8c 100644 --- a/src/gui/painting/qblendfunctions_p.h +++ b/src/gui/painting/qblendfunctions_p.h @@ -137,6 +137,16 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl, // this bounds check here is required as floating point rounding above might in some cases lead to // w/h values that are one pixel too large, falling outside of the valid image area. + const int ystart = srcy >> 16; + if (ystart >= srch && iy < 0) { + srcy += iy; + --h; + } + const int xstart = basex >> 16; + if (xstart >= (int)(sbpl/sizeof(SRC)) && ix < 0) { + basex += ix; + --w; + } int yend = (srcy + iy * (h - 1)) >> 16; if (yend < 0 || yend >= srch) --h; @@ -248,6 +258,16 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl, // this bounds check here is required as floating point rounding above might in some cases lead to // w/h values that are one pixel too large, falling outside of the valid image area. + const int ystart = srcy >> 16; + if (ystart >= srch && iy < 0) { + srcy += iy; + --h; + } + const int xstart = basex >> 16; + if (xstart >= (int)(sbpl/sizeof(quint32)) && ix < 0) { + basex += ix; + --w; + } int yend = (srcy + iy * (h - 1)) >> 16; if (yend < 0 || yend >= srch) --h; diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 3013d2cf3e..5307b6cbc5 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -558,6 +558,16 @@ void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, // this bounds check here is required as floating point rounding above might in some cases lead to // w/h values that are one pixel too large, falling outside of the valid image area. + const int ystart = srcy >> 16; + if (ystart >= srch && iy < 0) { + srcy += iy; + --h; + } + const int xstart = basex >> 16; + if (xstart >= (int)(sbpl/sizeof(quint32)) && ix < 0) { + basex += ix; + --w; + } int yend = (srcy + iy * (h - 1)) >> 16; if (yend < 0 || yend >= srch) --h; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 33dc27983a..e8b91cabe6 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -2864,7 +2864,7 @@ Q_GUI_EXPORT QStringList qt_sort_families_by_writing_system(QChar::Script script uint order = i; if (testFamily == nullptr || (testFamily->writingSystems[writingSystem] & QtFontFamily::Supported) == 0) { - order |= 1 << 31; + order |= 1u << 31; } supported.insert(order, family); diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri index a8a37492b7..44ff5b7b39 100644 --- a/src/network/socket/socket.pri +++ b/src/network/socket/socket.pri @@ -73,7 +73,7 @@ qtConfig(localserver) { SOURCES += socket/qlocalsocket.cpp \ socket/qlocalserver.cpp - intergrity|winrt { + integrity|winrt { SOURCES += socket/qlocalsocket_tcp.cpp \ socket/qlocalserver_tcp.cpp DEFINES += QT_LOCALSOCKET_TCP diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index aeeef55598..86fd7b8a9f 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1608,7 +1608,7 @@ QCocoaGLContext *QCocoaWindow::currentContext() const */ bool QCocoaWindow::isChildNSWindow() const { - return m_view.window.parentWindow != nil; + return window()->parent() != nullptr && m_view.window.parentWindow != nil; } /*! diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 78287b482c..968018c894 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -638,8 +638,12 @@ static bool _q_dontOverrideCtrlLMB = false; NSPoint screenPoint; if (theEvent) { NSPoint windowPoint = [theEvent locationInWindow]; - NSRect screenRect = [[theEvent window] convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 1, 1)]; - screenPoint = screenRect.origin; + if (qIsNaN(windowPoint.x) || qIsNaN(windowPoint.y)) { + screenPoint = [NSEvent mouseLocation]; + } else { + NSRect screenRect = [[theEvent window] convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 1, 1)]; + screenPoint = screenRect.origin; + } } else { screenPoint = [NSEvent mouseLocation]; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index cda6c99ad0..5d444f503d 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -1075,7 +1075,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::LeaveEvent: { QWindow *window = platformWindow->window(); - while (window->flags() & Qt::WindowTransparentForInput) + while (window && (window->flags() & Qt::WindowTransparentForInput)) window = window->parent(); if (!window) return false; diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index cfddb3cc71..1f7ce081fb 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -387,9 +387,6 @@ Qt::ScreenOrientation QWindowsScreen::orientationPreference() */ QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTypeHint() const { -#if !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) - return QPlatformScreen::Subpixel_None; -#else QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint(); if (type == QPlatformScreen::Subpixel_None) { QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Avalon.Graphics\\DISPLAY1"), QSettings::NativeFormat); @@ -410,7 +407,6 @@ QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTy } } return type; -#endif } /*! diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 4d3ccb8680..c44502c953 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -674,6 +674,9 @@ void Moc::parse() if (test(NAMESPACE)) { while (test(SCOPE) || test(IDENTIFIER)) ; + // Ignore invalid code such as: 'using namespace __identifier("x")' (QTBUG-63772) + if (test(LPAREN)) + until(RPAREN); next(SEMIC); } break; diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 21d1d4cb85..bef7214c75 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -226,7 +226,7 @@ static quintptr tabId(const QDockAreaLayoutItem &item) static const int zero = 0; QDockAreaLayoutInfo::QDockAreaLayoutInfo() - : sep(&zero), dockPos(QInternal::LeftDock), o(Qt::Horizontal), mainWindow(0) + : restoredSizeHint(0,0), sep(&zero), dockPos(QInternal::LeftDock), o(Qt::Horizontal), mainWindow(0) #if QT_CONFIG(tabbar) , tabbed(false), tabBar(0), tabBarShape(QTabBar::RoundedSouth) #endif @@ -236,7 +236,7 @@ QDockAreaLayoutInfo::QDockAreaLayoutInfo() QDockAreaLayoutInfo::QDockAreaLayoutInfo(const int *_sep, QInternal::DockPosition _dockPos, Qt::Orientation _o, int tbshape, QMainWindow *window) - : sep(_sep), dockPos(_dockPos), o(_o), mainWindow(window) + : restoredSizeHint(0,0), sep(_sep), dockPos(_dockPos), o(_o), mainWindow(window) #if QT_CONFIG(tabbar) , tabbed(false), tabBar(0), tabBarShape(static_cast<QTabBar::Shape>(tbshape)) #endif @@ -407,6 +407,9 @@ QSize QDockAreaLayoutInfo::sizeHint() const if (isEmpty()) return QSize(0, 0); + if (!restoredSizeHint.isNull()) + return restoredSizeHint; + int a = 0, b = 0; int min_perp = 0; int max_perp = QWIDGETSIZE_MAX; @@ -2373,6 +2376,7 @@ bool QDockAreaLayout::restoreState(QDataStream &stream, const QList<QDockWidget* stream >> size; if (!testing) { docks[pos].rect = QRect(QPoint(0, 0), size); + docks[pos].restoredSizeHint = size; } if (!docks[pos].restoreState(stream, dockwidgets, testing)) { stream.setStatus(QDataStream::ReadCorruptData); @@ -2674,6 +2678,8 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list, center_rect.setBottom(rect.bottom() - docks[QInternal::BottomDock].rect.height() - sep); QSize left_hint = docks[QInternal::LeftDock].size(); + if (!docks[QInternal::LeftDock].restoredSizeHint.isNull()) + left_hint = docks[QInternal::LeftDock].restoredSizeHint; if (left_hint.isNull() || fallbackToSizeHints) left_hint = docks[QInternal::LeftDock].sizeHint(); QSize left_min = docks[QInternal::LeftDock].minimumSize(); @@ -2681,6 +2687,8 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list, left_hint = left_hint.boundedTo(left_max).expandedTo(left_min); QSize right_hint = docks[QInternal::RightDock].size(); + if (!docks[QInternal::RightDock].restoredSizeHint.isNull()) + right_hint = docks[QInternal::RightDock].restoredSizeHint; if (right_hint.isNull() || fallbackToSizeHints) right_hint = docks[QInternal::RightDock].sizeHint(); QSize right_min = docks[QInternal::RightDock].minimumSize(); @@ -2688,6 +2696,8 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list, right_hint = right_hint.boundedTo(right_max).expandedTo(right_min); QSize top_hint = docks[QInternal::TopDock].size(); + if (!docks[QInternal::TopDock].restoredSizeHint.isNull()) + top_hint = docks[QInternal::TopDock].restoredSizeHint; if (top_hint.isNull() || fallbackToSizeHints) top_hint = docks[QInternal::TopDock].sizeHint(); QSize top_min = docks[QInternal::TopDock].minimumSize(); @@ -2695,6 +2705,8 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list, top_hint = top_hint.boundedTo(top_max).expandedTo(top_min); QSize bottom_hint = docks[QInternal::BottomDock].size(); + if (!docks[QInternal::BottomDock].restoredSizeHint.isNull()) + bottom_hint = docks[QInternal::BottomDock].restoredSizeHint; if (bottom_hint.isNull() || fallbackToSizeHints) bottom_hint = docks[QInternal::BottomDock].sizeHint(); QSize bottom_min = docks[QInternal::BottomDock].minimumSize(); @@ -3276,6 +3288,10 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or int delta = 0; int index = separator.last(); + for (int i = 0; i < QInternal::DockCount; ++i) + if (!docks[i].restoredSizeHint.isNull()) + docks[i].restoredSizeHint = QSize(0, 0); + if (separator.count() > 1) { QDockAreaLayoutInfo *info = this->info(separator); delta = pick(info->o, dest - origin); diff --git a/src/widgets/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h index 82244c192e..ea397e00ac 100644 --- a/src/widgets/widgets/qdockarealayout_p.h +++ b/src/widgets/widgets/qdockarealayout_p.h @@ -189,6 +189,7 @@ public: QMainWindowLayout *mainWindowLayout() const; + QSize restoredSizeHint; const int *sep; mutable QVector<QWidget*> separatorWidgets; QInternal::DockPosition dockPos; diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp index 9d9b47b61e..989eb43575 100644 --- a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -32,6 +32,7 @@ #include <QString> #include <QChar> +#include <QScopedArrayPointer> #include <QStringRef> #include <QLatin1String> #include <QVector> @@ -68,6 +69,19 @@ MAKE_ALL(const char*, QChar) #undef MAKE_RELOP // END FIXME +// Return a plain ASCII row name consisting of maximum 16 chars and the +// size for data +static QByteArray rowName(const QByteArray &data) +{ + const int size = data.size(); + QScopedArrayPointer<char> prettyC(QTest::toPrettyCString(data.constData(), qMin(16, size))); + QByteArray result = prettyC.data(); + result += " ("; + result += QByteArray::number(size); + result += ')'; + return result; +} + class tst_QStringApiSymmetry : public QObject { Q_OBJECT @@ -323,7 +337,7 @@ void tst_QStringApiSymmetry::toLocal8Bit_data() QString s; for (char c : ba) s += QLatin1Char(c); - QTest::addRow("\"%s\" (%d)", ba.left(16).constData(), ba.size()) << s << ba; + QTest::newRow(rowName(ba).constData()) << s << ba; }; QTest::addRow("null") << QString() << QByteArray(); @@ -358,7 +372,7 @@ void tst_QStringApiSymmetry::toLatin1_data() QString s; for (char c : ba) s += QLatin1Char(c); - QTest::addRow("\"%s\" (%d)", ba.left(16).constData(), ba.size()) << s << ba; + QTest::newRow(rowName(ba).constData()) << s << ba; }; QTest::addRow("null") << QString() << QByteArray(); @@ -391,7 +405,7 @@ void tst_QStringApiSymmetry::toUtf8_data() auto add = [](const char *u8) { QByteArray ba(u8); QString s = ba; - QTest::addRow("\"%s\" (%d)", ba.left(16).constData(), ba.size()) << s << ba; + QTest::newRow(rowName(ba).constData()) << s << ba; }; QTest::addRow("null") << QString() << QByteArray(); @@ -429,7 +443,7 @@ void tst_QStringApiSymmetry::toUcs4_data() s += QLatin1Char(c); ucs4.append(uint(uchar(c))); } - QTest::addRow("\"%s\" (%d)", ba.left(16).constData(), ba.size()) << s << ucs4; + QTest::newRow(rowName(ba).constData()) << s << ucs4; }; QTest::addRow("null") << QString() << QVector<uint>(); diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index de42b251af..cb18651091 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -15,12 +15,9 @@ ubuntu-14.04 ubuntu-14.04 ubuntu-16.04 osx ci -windows ci [modalDialogClosingOneOfTwoModal] osx [modalWindowModallity] osx [testInputEvents] rhel-7.4 -# QTBUG-66798 -windows diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index 202c4cc426..1ee767cc97 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -186,7 +186,13 @@ def generateTestData(testname, clean, def main(name, *args): """Minimal argument parsing and driver for the real work""" - os.environ['LC_ALL'] = 'C' + os.environ.update( + LC_ALL = 'C', # Use standard locale + # Avoid interference from any qtlogging.ini files, e.g. in + # /etc/xdg/QtProject/, (must match tst_selftests.cpp's + # processEnvironment()'s value): + QT_LOGGING_RULES = '*.debug=true;qt.*=false') + herePath = os.getcwd() cleaner = Cleaner(herePath, name) diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index e7123fc059..8164c53b67 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -567,6 +567,10 @@ static QProcessEnvironment processEnvironment() if (useVariable) result.insert(key, systemEnvironment.value(key)); } + // Avoid interference from any qtlogging.ini files, e.g. in /etc/xdg/QtProject/: + result.insert(QStringLiteral("QT_LOGGING_RULES"), + // Must match generate_expected_output.py's main()'s value: + QStringLiteral("*.debug=true;qt.*=false")); } return result; } diff --git a/tests/auto/tools/moc/namespace.h b/tests/auto/tools/moc/namespace.h index 43d00e82f3..7f1e46cd62 100644 --- a/tests/auto/tools/moc/namespace.h +++ b/tests/auto/tools/moc/namespace.h @@ -76,6 +76,7 @@ namespace FooNamespace { #ifdef Q_MOC_RUN namespace __identifier("<AtlImplementationDetails>") {} // QTBUG-56634 +using namespace __identifier("<AtlImplementationDetails>"); // QTBUG-63772 #endif #endif // NAMESPACE_H |