summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* testlib: Deprecate QWARN() in favor of qWarning()Tor Arne Vestbø2021-08-0426-45/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | The QtTest best practices documentations recommends using output mechanisms such as qDebug() and qWarning() for diagnostic messages, and this is also what most of our own tests do. The QWARN() macro and corresponding internal QTest::qWarn() function was added when QtTest was first implemented, but was likely meant as an internal implementation detail, like its cousin QTestLog::info(), which does not have any corresponding macro. This theory is backed by our own QtTest self-test (tst_silent) describing the output from QWARN() as "an internal testlib warning". The only difference between QWARN() and qWarning(), besides the much richer feature set of the latter, is that qWarning() will not pass on file and line number information in release mode, but QWARN() will. This is an acceptable loss of functionality, considering that the user can override this behavior by defining QT_MESSAGELOGCONTEXT. [ChangeLog][QtTest] QWARN() has been deprecated in favor of qWarning() Pick-to: 6.2 Change-Id: I5a2431ce48c47392244560dd520953b9fc735c85 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Make qt6_wasm_add_target_helpers an internal functionJoerg Bornemann2021-08-043-13/+4
| | | | | | | | | This function is called by qt_add_executable. There is no need to expose it as public function. Fixes: QTBUG-95172 Change-Id: I85a1d906ecda42458e226db225e47c1d348a72f1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Enforce minimum CMake version in user projectsAlexandru Croitor2021-08-049-53/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces new behavior to error out when configuring user projects if the CMake version used is too old for Qt to work with. The main motivator is the requirement of new CMake features to ensure object libraries are placed in the proper place on the link line in static builds. The minimum CMake version is computed based on whether Qt was configured as shared or static libraries. At the moment the required versions for building and using Qt are the same. The minimum versions are defined in qtbase/.cmake.conf in the following variables QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_SHARED QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_STATIC QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_SHARED QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_STATIC Qt Packagers can disable the version check when configuring Qt by setting QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT and QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT. In this case it is the packagers responsibility to ensure such a Qt works correctly with the specified CMake version. User projects can also set QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT to disable the version check. Then it's the project's developer responsibility to ensure such a Qt works correctly. No official support is provided for these cases. Implementation notes. The versions required to build Qt are stored in QtBuildInternalsExtra.cmake whereas the versions required to use Qt are stored in a new QtConfigExtras.cmake. Also the policy range variables stored in QtBuildInternalsExtra.cmake are now regular variables instead of cache variables, to properly allow overrides per-repository. Some renaming of functions and variables was done for a bit more clarity and easier grep-ability. Pick-to: 6.2 Task-number: QTBUG-95018 Change-Id: I4279f2e10b6d3977319237ba21e2f4ed676aa48b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Bump min required CMake version for static Qt builds to 3.20Alexandru Croitor2021-08-043-25/+45
| | | | | | | | | | | | | | | | | | | | | | | Building a static library Qt configuration will now require a minimum CMake version of 3.20. Qt builders and packagers can still opt out of the mentioned minimum required version by configuring Qt with QT_FORCE_MIN_CMAKE_VERSION. Such a Qt configuration is /NOT SUPPORTED/. To facilitate these changes, the minimum version check has been moved to happen after the BUILD_SHARED_LIBS option is computed by either QtAutoDetect.cmake or set by a user provided cmake toolchain file. Introduce a new QT_MIN_SUPPORTED_CMAKE_VERSION_FOR_STATIC_QT variable in .cmake.conf to mark the minimum version for a static Qt build. Pick-to: 6.2 Task-number: QTBUG-95018 Change-Id: Idc1875729f26a7c635b6bd26ac0c1be973917c13 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io>
* QFileSystemModel: cache the name filters regexpsGiuseppe D'Angelo2021-08-042-12/+33
| | | | | | | | | | | | | | | | | | | | | In order to filter out file names based on the user's settings, QFileSystemModel used to have a loop that tested if a given file name matched one of the filters. The problem is that each filter (a wildcard) was converted to a QRegularExpression _inside_ the loop. This causes a quadratic behavior (number of files * number of filters). Instead, build the regexps once when the filters are set (or the case sensitivity is changed, as that affects the filtering), and simply _use_ them in the loop. Simplify and correct some related code as a drive by. Done-with: Jean-Michaël Celerier Fixes: QTBUG-95383 Pick-to: 6.2 6.1 5.15 Change-Id: I6bc336364c145bb05793a8f867545d7715d35832 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QMetaType: auto-unregister converters and mutable views againMarc Mutz2021-08-041-8/+37
| | | | | | | | | | | | | | | | | | | | | | | | | The port from hand-rolled function storage to std::function inadvertently removed the helper variable of static storage duration whose dtor would unregister the conversion function. This caused QTBUG-94831, where the cleanup of conversion functions attempts to call code (via std::function) from a library that has already been unloaded. Restore the 5.15 behavior by adding a static-storage-duration scope guard to unregister the conversion and view functions from Qt upon library unload (when static objects are destroyed). Unlike 5.15, only install the scope guard upon successful registration, ensuring that only the DLL which successfully registered its conversion function unregisters it again. Amends 0e4ae4fbf8e320d18c29a55b5db2bba25b3d9d50. Add some strategic std::move()s as a drive-by. Pick-to: 6.2 Task-number: QTBUG-94831 Change-Id: I391ca667420cf0d98a166676b9bb363d6e190306 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFsFileEngine: avoid triple(quadruple) lookup of the same keyMarc Mutz2021-08-042-7/+9
| | | | | | | | | | | | | Instead of contains(), 1-2x operator[](), and remove(), equalling 3-4 separate lookups, use find() + erase(), which does just one lookup. Since our erase() function is C++11-compliant these days and takes const_iterator instead of (mutable) iterator, we can use the const find() overload to delay a detach (attempt) until we actually erase(). Change-Id: I8e67a48e221e548528049fa093ab7ef2f1802f7e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix warnings about undocumented enum and parametersNico Vertriest2021-08-032-2/+6
| | | | | | | | | | - enum 'CaptivePortal' in QNetworkInformation::Feature - parameter 'debug' in QNetworkAddressEntry::operator<<() - parameter 'debug' in QNetworkInterface::operator<<() Pick-to: 6.2 Change-Id: I518bc06edee9fa4955dc6295786ab1a6be989727 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Consolidate documentation of floating-point formatting codeEdward Welbourne2021-08-037-201/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the documentation of the format and precision parameters to QLocale::toString(double, char, int), reference it from various QString methods (instead of repeating there and referencing one of those from QLocale). Add brief first lines for various documentation comments. Mention the special handling of negative precision in the moved documentation. Mention QLocale::FloatingPointShortest, add its type to \sa lines of methods it affects. Change a comment on some code implementing its special treatment to make clear that it does apply to 'e' and 'f' formats, not only to 'g', even though it has no overt special handling in that code; and update docs to report the undocumented behavior the comment previously described. Document how infinity and NaN are represented. Be somewhat more consistent about single-quoting the format names where referred to and applying \c to character constants. Make clear what things are different between different methods using these parameters. Reference QString::number() from QByteArray's relevant methods, since they share its quirks. In the process, rename the format and precision parameters of relevant functions so they're consistently named, replacing a mixture of abbreviated forms. Pick-to: 6.2 Change-Id: I077521b30346000e4b4f6968a8e750e934f72937 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QLibraryInfo: Add MSVC 2022Mårten Nordheim2021-08-031-1/+3
| | | | | | | Pick-to: 6.2 6.1 5.15 Change-Id: Ie66effde6832152ee2903c467269a2822ded6653 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QString::localeAwareCompare: adapt to QLocale::setDefault() being calledThiago Macieira2021-08-023-4/+25
| | | | | | | | | | | | | | | | | Because we're using a thread-specific global static, we need to recreate the QCollator type every time setDefault() is called. Since one is stored per-thread, we simply increment a generational counter and check that the next time that QString::localeAwareCompare is called in each thread. The issue was introduced on f6425da424b1a0d5927ee56fa657a9b31ca5afd1 (5.12) even though we were supposed to be using QCollator since commit 5279134935e858e6fa8565c936b17e88d7bded50 (5.3). Fixes: QTBUG-95050 Pick-to: 6.2 Change-Id: I7e0b82c2d2fe464082d8fffd1696a8c9f74e5b30 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QCollator/Win: Remove WinRT remnantsThiago Macieira2021-08-022-28/+1
| | | | | | | | USE_COMPARESTRINGEX is not defined anywhere. Its definition was removed by commit 45b0f1be686cfba8dcecb9be5c875cae59c69276 ("Remove winrt"). Change-Id: I7e0b82c2d2fe464082d8fffd1696a931fa301986 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QByteArray: don't coerce negative to unsigned for any baseEdward Welbourne2021-08-023-11/+11
| | | | | | | | | | | | | | | | This follows up on commit 98666c8afc80cccb80ca4426b97ec52916c6e610, which did the same for QString. If someone wants to get formatting suitable to an unsigned value, they can cast the value to that unsigned type and the correct overload shall pick it up. [ChangeLog][Important Behavior Changes] QByteArray's formatting of negative whole numbers to bases other than ten now, like QString's (since Qt 6.0), formats the absolute value and prepends a minus sign. Task-number: QTBUG-53706 Pick-to: 6.2 Change-Id: I91fee23d25ac0d5d5bcfcbeccbac1386627c004a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use correct MSVC runtime library for targets created by qt_add_*()Li Xinwei2021-08-031-0/+3
| | | | | | | | | | | Use _qt_internal_set_up_static_runtime_library() to set correct MSVC runtime library for targets created by qt_add_executable(), qt_add_library(), qt_add_plugin() and qt_add_big_resources(), to bring convenience to user projects. Pick-to: 6.2 Change-Id: Ia49f1e90989c464820824be3e1eef3df1351cdcf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Avoid to call _qt_internal_set_up_static_runtime_library() twiceLi Xinwei2021-08-036-7/+4
| | | | | | Pick-to: 6.2 Change-Id: I28985470b3e0b88befbbd2d62a027670d7d6c822 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Allow dragging of a floating dockwidget on macOS with a custom titlebarAndy Shaw2021-08-021-1/+1
| | | | | | | | | | This amends 3224c6d7d150164241c13ccf7d47377a39c0a6bb to account for the case when the dockwidget is already floating. Task-number: QTBUG-70137 Pick-to: 6.2 6.1 5.15 Change-Id: If8b345565b11b44beb3fb4b697cfe812c29c6396 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* rhi: Be more graceful when one destroys a resource after the QRhiLaszlo Agocs2021-08-028-127/+306
| | | | | | | | | | | | | | | | | | | | | One is a bad application or library in this case, but nonetheless we should handle this more gracefully then just crashing due to the QRhi already having been destroyed. Mainly because in Qt 5 one could get away with the same: releasing OpenGL objects underneath, for example, a QSGPlainTexture with no (or wrong) GL context did not generate any user visible fatal errors. So we should not crash in Qt 6 either with these code bases. In debug builds or when QT_RHI_LEAK_CHECK is set, one will get the unreleased resources warning printed in Qt 6, which is a step forward compared to Qt 5. So there is still some indication that something is badly designed, even if the application survives. Task-number: QTBUG-95394 Pick-to: 6.2 Change-Id: I944f4f425ff126e7363a82aff926b280ccf1dfc3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix PerMonitorV2 DPI aware NonCLientAreaScaling handlingMorten Johan Sørvig2021-08-021-3/+10
| | | | | | | | | | | | | | | | | | | | | | The value returned from shouldHaveNonClientDpiScaling() controls two related behaviors: 1) Should Qt call user32dll.enableNonClientDpiScaling() 2) Should Qt code treat NonClientAreaScaling as enabled. Commit c35643db updated shouldHaveNonClientDpiScaling() to account for the fact that PerMonitorV2 always enables NonCLientAreaScaling, with the intent to disable 1) However this also disables 2), which was not intended. Instead, make shouldHaveNonClientDpiScaling() always return true when PerMonitorV2 is enabled, and then also omit calling the user32dll API in this case. Change-Id: I1d06f36a3d06becc667351fadcb00ab28af6ec4b Pick-to: 6.2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* macOS: Stop relying on balanced CGDisplay reconfiguration callbacksTor Arne Vestbø2021-08-023-84/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were using CGDisplay callbacks to determine when a screen reconfiguration had happened, and when it had propagated to changes in NSScreen.screens, so that we could update our QScreen view of the world. Unfortunately the CGDisplay callbacks were not deterministic enough to use as a signal for when a reconfigure had completed. Since we can't rely on NSApplicationDidChangeScreenParametersNotification either (it comes in too late), we're now resorting to updating our QScreens at every chance we get: - On every CGDisplay reconfiguration ending - On QCocoaWindow::windowDidChangeScreen() as a result of AppKit moving the window. - On NSApplicationDidChangeScreenParametersNotification - On QCocoaScreen::get() as a last resort Since the result of these updates are only reflected as QScreen property updates or QGuiApplication signals if a change actually occurred, it should be safe to update early and often. Task-number: QTBUG-77656 Fixes: QTBUG-80193 Pick-to: 6.2 6.1 5.15 Change-Id: I98334a66767736d94ad2fcb169e65f0d8bc71a30 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* CMake: Bump project versionsAlexandru Croitor2021-08-022-2/+2
| | | | | | Fixes: QTBUG-95454 Change-Id: I2467d3ae27b54424e59a7a4ab00d364eaec517d5 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* QByteArray::number/setNum(double): Reverse dependencyMårten Nordheim2021-08-021-30/+27
| | | | | | | | | | | | | | | | Currently number(double) creates a QByteArray-instance and calls setNum(double). setNum(double) creates a QByteArray-instance and copy-assigns it to itself. By making setNum(double) call number(double) we can cut one creation from numbers(double)'s path, and making setNum no worse than it was. The other pairs of setNum/number are left alone as they don't have this issue. Change-Id: Ib611ebc78db64f74244a56cb8e384e42bc7d1758 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Pass QDeadlineTimer by value in runOnAndroidMainThread()Assam Boudjelthia2021-08-012-5/+3
| | | | | | | | Also change the timer default value to use QDeadlineTimer::Forever. Pick-to: 6.2 Change-Id: Ia6d0101872a5d01b04e146cd9b2f90315cb8eb2e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QLocalSocket: always open outer QIODevice in unbuffered modeAlex Trotsenko2021-08-012-1/+3
| | | | | | | | | | | The actual buffering is performed either in the inner socket (Unix), or in the pipeReader (Windows). To avoid unnecessary copying of data between buffers, enforce unbuffered mode for all implementations, which slightly improves read performance. Change-Id: Idb2a09f35823b9945c71231710290be12d9930f7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QIODevice: allow subclasses to enforce unbuffered modeAlex Trotsenko2021-08-011-9/+16
| | | | | | | | | | | | | | | For subclasses that implement alternative buffering (such as QLocalSocket), it would be useful to bypass the QIODevice's internal buffer, even if the QIODeviceBase::Unbuffered flag is not set when opened. By setting the readBufferChunkSize member to 0 in their constructors, these classes now unconditionally switch the base class to unbuffered mode, while still reporting buffering with openMode() function. Change-Id: I351bc57ac0ccb45c81f8c6be15f1745131aa26ba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Register mouse devices on cocoaShawn Rutledge2021-08-016-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | It would have been nice to ensure that a device is registered already in mouseEnteredImpl(); but in that context, NSEvent.deviceID is always 0, and we can't find out anything else about the device. QWindowSystemInterface::handleEnterEvent() doesn't currently take a QPointingDevice either. In handleMouseEvent() and scrollWheel(), deviceID seems unique for each trackpad or Magic Mouse, but 0 for any plain USB mouse. There, the first mouse that the user interacts with becomes primaryPointingDevice(): its deviceID is assigned to systemID (except if deviceID == 0, we use 1 instead, to avoid the auto-incrementing device ID assignment in the QInputDevicePrivate ctor.) When scrolling occurs, we update the capabilities to have PixelScroll if theEvent.hasPreciseScrollingDeltas. So over time, QInputDevice::devices() should build up to a complete list, with capabilities() also distinguishing plain mice from those that have the PixelScroll capability. And in the common case that the user has only one Apple pointing device, it becomes primaryPointingDevice(). Pick-to: 6.2 Task-number: QTBUG-46412 Task-number: QTBUG-63363 Task-number: QTBUG-72167 Change-Id: Id9771b4dfd765e49023bd57d42a2aa4d0635a3b2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Update QAbstractItemModelTester::FailureReportingMode documentationTor Arne Vestbø2021-08-011-2/+1
| | | | | | | | | | The key part of FailureReportingMode::QtTest is that it will result in a test failure (via QTest::qVerify); not that it's using the QtTest logging machinery. Pick-to: 6.2 Change-Id: I18472fba173ce1323748f1f87301a4defa87020e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QIODevice: rework validation policy for read() functionsAlex Trotsenko2021-08-014-60/+84
| | | | | | | | | | | - avoid calls to private and virtual functions, if the device is not open; - avoid repetitive checks in loops; - add missing checks in readLine() overloads; - remove check against unsuccessful resize(). Change-Id: I973d5931163b25db1c09c7c3b66f29ea90bb1b29 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QLocalSocket: do not emit aboutToClose() twiceAlex Trotsenko2021-08-013-2/+3
| | | | | | | | | This signal is emitted by the QIODevice itself, so we don't have to forward it from the internal socket. Pick-to: 6.1 6.2 Change-Id: I85745f36d7a27d92f339a9184de3b6e5d46f6f34 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QIODevice: fix converting OpenMode flag in debug outputAlex Trotsenko2021-07-311-3/+3
| | | | | | | | | | | | | Suppress error: src\corelib\io\qiodevice.cpp(791): error C2440: '<function-style-cast>': cannot convert from 'QIODeviceBase::OpenMode' to 'quint32' Pick-to: 6.1 6.2 Change-Id: I6b6e94790942d3af62bc2f38afad97c0b3c80817 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QUuid: port to QAnyStringViewMarc Mutz2021-07-304-42/+56
| | | | | | | | | | | | | | | | | Remove the QString/QStringView/QLatin1String/const char* overloads from the API, but not the ABI. As a drive-by, replace a use of QStringView::left() by truncate(), as suggested by a comment. [ChangeLog][QtCore][QUuid] The from-string constructor and the fromString() function now take QAnyStringView (was: overload set with a subset of QString, QByteArray, const char*, QLatin1String, QStringView each). Change-Id: If7fa26cfbef9280480c78b669d9f5f14118995ed Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWindowsFontDatabase: port local QSets to QDuplicateTrackerMarc Mutz2021-07-302-9/+8
| | | | | | | | | | Apart from a more fitting, minimal, API, QDuplicateTracker also transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or at least reduce, memory allocations. Change-Id: I155f5518190c5f8f6d21fbec3fcecd6bcc7ff852 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove mention of permission api in http exampleAssam Boudjelthia2021-07-301-8/+0
| | | | | | Pick-to: 6.2 Change-Id: I8b22633e1ad5372f92f87315b7184a4b499a0a0b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove app permission API from QCoreApplicationAssam Boudjelthia2021-07-306-423/+33
| | | | | | | | | | | | | From the API review session, a potential deadlock behavior might occur when using QFuture's synchronous APIs on the UI thread. Also the fact that this api currently have an implementation only for Android. For those reasons we thought this API could be postponed until Qt 6.3, when the QFuture concern is addressed and other platforms other than Android are implemented as well. Pick-to: 6.2 Change-Id: I1aef025488c24791da85d15fb57367d3e5e681be Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Correct a #include in a comment in qglobal.hEdward Welbourne2021-07-301-1/+1
| | | | | | | | | | | | | | | The comment indicates how to use QT_BUILD_REMOVED_API, which includes a #include of qglobal.h; but we have a tool, run somewhere in configure, that grumbles about this #include (unaware, I suspect, that it's in a comment), saying we should #include <QtCore/qglobal.h>; so change the comment to say that. Presumably this is our recommended way to do includes, so we should follow it when suggesting how to write code. This amends commit 0c8b98774cd0f3dad939d31e820e7e47c1da088a. Change-Id: I4683ad6f1c0eedec3eaa02ac40c5d017059a49b0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a few more cases to the QString::number(double) testMårten Nordheim2021-07-301-0/+4
| | | | | | | Formatting using scientific notation with extra precision wasn't tested Change-Id: I7a89a0f3d6468515604e43e52fc366dedf3c39ea Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove Windows 7, 8, and 8.1 codepathsOliver Wolff2021-07-305-60/+22
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-84432 Change-Id: I970d7d7e9ebdcf246a5be32d60066b4e5e948c27 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Windows QPA: Remove DwmIsCompositionEnabled() usagesYuhang Zhao2021-07-301-29/+5
| | | | | | | | | | | | | According to Microsoft Docs [1], DWM composition is always enabled and can't be disabled since Windows 8. Now that we are cleaning up pre-Windows 10 code, this apparently needs to be removed as well. [1] https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmiscompositionenabled Task-number: QTBUG-84432 Change-Id: I64dc049e0741600c8d0ae4db0e9e3bc98a211339 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* testlib: Regenerate test expectationsTor Arne Vestbø2021-07-298-63/+64
| | | | | | | | | | After c25687fa0b6e4be043e1f8c92c093d8b06ca06c4 and 539553a57216c4ece292ff54fb623807c334cdb6. Pick-to: 6.2 Change-Id: I34b436f20b9c480f6948aa97430228936955808e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* testlib: Update a few remaining instances of the deprecated -xunitxml formatTor Arne Vestbø2021-07-294-20/+29
| | | | | | | | The format was renamed in 27db9e458cef512fca3a6b5c9ebbcda7a8172428. Pick-to: 6.2 Change-Id: I53975c7467d8768dc9dc9ac2d89c42eefa12e22f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* testlib: Run test result expectation tests with stdout as outputTor Arne Vestbø2021-07-291-16/+20
| | | | | | | | | | | | | For historical reasons a few of the subtests are skipped when running with anything but the plain text logger to stdout. To ensure we have as broad test coverage as possible for the expected output of the various loggers we run these tests in stdout-mode. Pick-to: 6.2 Change-Id: I856905d1543afe89710533657a55bd599c0305fd Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Make WrapVulkanHeaders target optional for QtGui consumersAlexandru Croitor2021-07-299-8/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If Vulkan headers are present on the system when qtbase is configured, QtGui and QtOpenGL should be compiled with Vulkan support. If a user project uses a Qt built with Vulkan support, but their system is missing Vulkan headers, the project configuration needs to succeed. The project will get compilation errors if it uses Vulkan headers, but that's intended. This use case was broken when fixing Vulkan to be found when building Qt for Android. Fix the regression with a combination of things 1) Mark the WrapVulkanHeaders package as optional (already the case) 2) Use the include directories directly when compiling Gui and OpenGL 3) Propagate WrapVulkanHeaders::WrapVulkanHeaders link requirement to consumers only if the target exists. It won't exist if Vulkan include dirs are not found This also requires some changes in pri and prl file generation. For prl file generation, we don't want to link to the WrapVulkanHeaders target, so we filter out all dependencies that use TARGET_NAME_IF_EXISTS for anything that calls __qt_internal_walk_libs which includes qt_collect_libs. For pri files, we make sure to generate a uses=vulkan/nolink clause by inspecting a new _qt_is_nolink_target property on the target. We also don't add include dirs to the pri file if the new _qt_skip_include_dir_for_pri property is set. This is intended for Vulkan, because there is separate qmake logic to try and find the include dirs when configuring a user project. As a drive-by, fix nolink handling for WrapOpenSSLHeaders. Amends bb25536a3db657b41ae31e1690d230ef8722b57d Amends 7b9904849fe1a43f0db8216076a9e974ebca5c78 Pick-to: 6.2 Fixes: QTBUG-95391 Change-Id: I21e2f4be5c386f9e40033e4691f4786a91ba0e2d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix MoltenVK headers to be found on macOSAlexandru Croitor2021-07-291-0/+13
| | | | | | | | | | | | | | This fixes building Qt with Vulkan support on macOS which aside from the regular Vulkan headers also needs the location of the MoltenVK headers. This assumes the usage of the LunarG Vulkan SDK for macOS. Pick-to: 6.2 Fixes: QTBUG-80576 Change-Id: I030b2fdeaafdd7bf5ebe6fb4c9ea860917e84056 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* testlib: Accurately name JUnit test, and only run for JUnitXML reporterTor Arne Vestbø2021-07-2913-265/+33
| | | | | | | | | | | | | The JUnit reporter was initially named xunit, but the naming was inaccurate and the reporter was renamed in 27db9e458cef512fca3a6b5c9ebbcda7a8172428. The corresponding test has now been renamed as well, and as an added bonus we only run it for that reporter. Pick-to: 6.2 Change-Id: I59cb7d949514cdf46a0199a53a7a3e39f833207c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QByteArray: extend unit testsIvan Solovev2021-07-292-27/+687
| | | | | | | | | | | This patch introduces some test improvements to check the calls of different methods on an empty default-constructed string. Apart from that, many other tests are added to extend code coverage. Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: If86ef3d8611a678798b1bcc60a1a4f5598fd2179 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QByteArray: fix indexOf/lastIndexOfIvan Solovev2021-07-292-9/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixed two bugs in indexOf/lastIndexOf: 1. The lastIndexOf(char, qsizetype) overload was crashing with an empty QByteArray. It was unconditionally calling lastIndexOfCharHelper() which assumes that this QBA is not empty. An explicit check for the empty case is added. 2. The indexOf(QByteArray, qsizetype) overload was behaving incorrectly while searching for an empty QByteArray. In this case it unconditionally returned its second parameter (from). However, from can be negative, or even exceed the size of this QByteArray. This patch handles this cases properly. As a drive-by: this patch adjusts the QByteArray::indexOf(char, qsizetype) and QByteArray::lastIndexOf(char, qsizetype) overloads to match with the QByteArrayView implementation. This is done to have similar code paths in both cases and avoid tricky bugs in future. Ideally we had to adjust the QByteArrayView implementation, but it's fully inline, so can't be changed without breaking BC. Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: Iaef2fdc5b99cce6aa342cca2d17544a1ad7ca677 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QPrivateSlotBase: add empty base class optimizationMarc Mutz2021-07-292-6/+31
| | | | | | | | | | | | | | | There are few slots whose lambdas are empty; most will at least capture [this]. But there are a few in Qt examples that do, e.g. []{ qApp->quit(); }. Logging is also an example. So go the extra mile and optimize for empty functors by inheriting from them as opposed to storing them in a member variable. Change-Id: I3904f10db5ebe904ba889d29c08569edd804df3b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QString test compilation without QRegularExpressionIvan Solovev2021-07-291-5/+64
| | | | | | | | | | | The QString itself can be compiled without QRegularExpression, but the tests do not check if they are supported or not. This patch fixes the issue by introducing the proper #ifdef guards. Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: I797691f78a34d4f78a86af99c78bf06e26e846d1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSlotObjectBase: document relation between m_impl and Operation betterMarc Mutz2021-07-291-1/+4
| | | | | | | Change-Id: I02bfe1857a9c2b781f7ad891e813fd6818fab671 Reviewed-by: Ivan Tkachenko <me@ratijas.tk> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString benchmark: don't use %lsMårten Nordheim2021-07-291-1/+1
| | | | | | | | The vsnprintf we use in QTest doesn't not have a portable %ls: It accepts wchar_t, so it's UTF-32 on Linux and UTF-16 on Windows Change-Id: I9ebda1e92b6e8e4dbbb79c6f2e35a833c587a089 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QSslCertificate::verify - skip auto-testTimur Pocheptsov2021-07-291-0/+1
| | | | | | | | | | as a temporary fix for suddenly expired certificates situation (to be regenerated). Pick-to: 6.2 6.1 5.15 Task-number: QTBUG-95429 Change-Id: I00ad11cfd8824eeeffa2991dfcda6a7899726953 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>