summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Windows: Add synthesized fonts also when there is a style name"Eskil Abrahamsen Blomfeldt2021-06-302-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a partial revert of commit f385b8827a75688b8a2cbd51e8da8a602d7f9567. This causes issues because we may overwrite genuine styles with synthetic ones. Lets say for instance that we register "Roboto Bold" and then later we register "Roboto Thin". When we register "Roboto Thin" we also register an alternative font which is called "Roboto" (because this is the typographical family name of the font) with bold weight, because we know Windows can synthesize this. This would work fine, except that on Windows we also store the original face name of the font as a user-pointer in the database. This contains the legacy name of the font: "Roboto Thin". This will override the font that is already stored. When we look up "Roboto" + bold weight in the database later, we will find this synthetic font, replace the requested family name with the legacy one "Roboto Thin" and use this instead. The right fix for now is to revert the cause of the regression. If we want to re-fix the original bug, we might be able to reintroduce f385b8827a75688b8a2cbd51e8da8a602d7f9567 and then make sure we always prefer the "real" font when there are conflicts (this would mean marking synthetic fonts in the database). [ChangeLog][Windows] Fixed a regression where different font styles and/or weights would not be available. Fixes: QTBUG-94781 Task-number: QTBUG-91398 Pick-to: 5.15 6.1 6.2 Change-Id: I092022b14ebf1d56685eaa3b8efe55f015659adc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* fc: Clean up current config on shutdownEskil Abrahamsen Blomfeldt2021-06-302-0/+6
| | | | | | | | | | | | | | | | | | | The FontConfig database had a static leak because we never dereferenced the current config. To make address sanitizer output less noisy, we clean this up on shutdown. From FcConfigDestroy docs: "Note that calling this function with the return from FcConfigGetCurrent will cause a new configuration to be created for use as current configuration." So this should be safe even if application execution continues after Qt shutdown, but it could trigger creation of a new current config in that case, if FontConfig calls are made. Fixes: QTBUG-92477 Pick-to: 5.15 6.1 6.2 Change-Id: I596055a84edc1a1b06157e2adf6c8627c6802db1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QDBusMenuConnection: Close open D-Bus connectionJonas Kvinge2021-06-302-0/+9
| | | | | | | | | | | | | | Using QSystemTrayIcon::isSystemTrayAvailable() generates a new connection from QDBusTrayIcon::isSystemTrayAvailable() with a new unique instance ID. These were never closed, so calling QSystemTrayIcon::isSystemTrayAvailable() frequently leads to crash when it runs out of file descriptors. Fixes: QTBUG-94839 Pick-to: 5.15 6.1 6.2 Change-Id: Ib71441a6b680d8633707cc02f9b6081c0f02472b Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add Qt7 TODOs for reducing the size of QColorUlf Hermann2021-06-302-0/+8
| | | | | | | | It could fit into QVariant's inline storage if we didn't waste so much space. Change-Id: Ie9e592a49c955b0a97a202e0bd875183396af993 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QWinSettings: port readKey() helper to std::optionalMarc Mutz2021-06-301-28/+15
| | | | | | | | | Less boilerplate code and no more impedance mismatch with recently-ported QSettingsPrivate::get(). Change-Id: I5e113a44a48274aecb20fc9cb5d8db02c6cd0a35 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port QSettingsPrivate::get() to std::optionalMarc Mutz2021-06-305-31/+25
| | | | | | | | ... instead of a bool return and a QVariant out parameter. Change-Id: I9d937668ede668075d1de5bb57f61e4c260aaddc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray: fix aliasing error in insert(it, n, v)Marc Mutz2021-06-281-1/+1
| | | | | | | | | | | | | | | | | Taking the copy after the resize is completely pointless: the copy is there to ensure that `t`, being a reference potentially aliasing an element in [begin(), end()[ before the resize(), isn't invalidated by the resize(), so it must be taken before resize(). Add a comment so the next rewrite doesn't cause this to be mixed up again. [ChangeLog][QtCore][QVarLengthArray] Fixed an aliasing bug affecting insertions of objects aliasing existing elements. Pick-to: 6.2 6.1 6.0 5.15 5.12 Change-Id: I26bc449fa99bf8d09a19147a12a69ac4314cc61d Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix usage of logging category on AndroidAssam Boudjelthia2021-06-281-1/+7
| | | | | | | | | | | | | | | Android logs have a tag/category field in each log entry, which currently if defined by Qt, it's being included as part of the message and not used as a tag as it's supposed to be. This patch fixes that behavior. If a non-default category is defined, it will be used as a tag, otherwise the application name is used as before. Pick-to: 6.2 Fixes: QTBUG-94708 Change-Id: Ie56187f23a47cda6d82e14fdec7c8903d3ee40b6 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Fix harfbuzz-ng compilation for IntegrityTatiana Borisova2021-06-281-0/+6
| | | | | | | | Add --restrict definition, because GHS compiler doesn't support it by default Pick-to: 6.2 Change-Id: I6766f2fe309802ad9de333edd6ed43f7a187616f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Documentation: Remove section advertising AmazonFriedemann Kleint2021-06-281-13/+0
| | | | | | Pick-to: 6.2 6.1 5.15 Change-Id: Ibf61cdf4ccb08c00c74c88e66aac200971be62d1 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* wasm: fix mouse, touch and wheel event propagationLorn Potter2021-06-262-11/+13
| | | | | | | | | Otherwise touch pad and wheel + ctrl cause the window to be zoomed, which is not what happens on desktop. Pick-to: 6.2 Change-Id: Ic841b7c2ab56846db9f030abaeb9efa7d3dd4dcf Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Migrate to autogenerated cpp exportsAlexey Edelev2021-06-2521-132/+21
| | | | | | | | | Replace the hardcoded cpp exports with a generated one where it's applicable. Task-number: QTBUG-90492 Change-Id: Idc160b594987b2c765e75bd669aae851b4366282 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: Use https for links to unicode.orgPaul Wicking2021-06-255-20/+18
| | | | | | | | | | * Change all outbound links in user-facing documentation. * Reflow lines that exceed 100 cols as mandated by clang-format. * Add unicode.org as a global \externalsite. Pick-to: 6.2 6.1 5.15 Change-Id: I2ba1e434aa913e678406d62c2801f1a8b2d9e4f4 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: Improve QTransform documentationPaul Wicking2021-06-253-12/+31
| | | | | | | | | | | | * Explain QTransform's model of vector/matrix operations. * Improve snippets used to illuminate QTransform's behavior. Fixes: QTBUG-83869 Pick-to: 6.2 6.1 5.15 Change-Id: I84c3b1a221c139ee992f82c3ee4aebadeef8ee63 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QFutureInterface: remove the inconsistent and unneeded includeSona Kurazyan2021-06-251-1/+0
| | | | | | | | | QMutexLocker is declared in qmutex.h, which is already included. Pick-to: 6.2 Task-number: QTBUG-94407 Change-Id: I78e0630c27ef7f85feae68e98f8cdcbe4e142cd8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use qMod(, 7) rather than % 7 in day-of-week calculationEdward Welbourne2021-06-251-1/+1
| | | | | | | | | | | | Otherwise, for the first day of a negative year, we'd get an invalid day of the week (required to be in the range 1 through 7). This is a follow-up to commit 1f4b237dade9d0d2ed5439e3834ac22985797561. Change-Id: If1afcd42065c26d5fa5799b0cd47921a3d424dc8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Schannel: Get rid of Windows < 10 codeMårten Nordheim2021-06-251-7/+4
| | | | | | | | | No need to check if we're running on windows 8.1 or above. We always are. Pick-to: 6.2 Change-Id: I9f2e7a58631064e573725705882a603e900c7e39 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QTlsBackend: Find mismatches faster in ciphersuite-string creationMårten Nordheim2021-06-251-10/+16
| | | | | Change-Id: I5744fc3673e8d318b8dd859a281ed0e766649578 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* TLS: Mark TLS 1.0, 1.1 and DTLS 1.0 deprecatedMårten Nordheim2021-06-2513-15/+84
| | | | | | | | | | | | As per the best practice laid forth in RFC-8996. TLS 1.2 was recommended from 2008 until TLS 1.3 was released in 2018. [ChangeLog][QtNetwork][QSslSocket] TLS 1.0, 1.1 and DTLS 1.0 are now deprecated, as recommended by RFC-8996. Fixes: QTBUG-92880 Change-Id: I90cebcfb07cfce623af7ac9f2b66ce9d02586b54 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QSslSocket: Set isEncrypted to false on disconnectMårten Nordheim2021-06-252-0/+2
| | | | | | | | | Since we're no longer connected, much less encrypted. Was done in schannel backend, but not in ST or OpenSSL Pick-to: 6.2 Change-Id: Ia49387be0088f899a0c89091f7e468dba1c0eee6 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Consistent indentation for all Q_PROPERTYsAndreas Buhr2021-06-2434-77/+155
| | | | | | | | Task-number: QTBUG-94407 Pick-to: 6.2 Change-Id: I8c97a0b2de2bed78456322be271724fc47479d83 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Schannel: fix compilation with QSSLSOCKET_DEBUGMårten Nordheim2021-06-241-1/+1
| | | | | | | Small leftover mistake Change-Id: I0cb55fe78a2666665a3c56b41200c127a42df0c2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_http2: use the supportedFeatures() instead of macrosTimur Pocheptsov2021-06-241-0/+4
| | | | | | | | | | | With the recent change, 'system' headers gone: not in the test code anymore, so, for example OPENSSL_VERSION_NUMBER is undefined, making the test to select a wrong code-path - 'h2c', instead of encrypted h2. Pick-to: 6.2 Pick-to: 6.1 Change-Id: I3b201e21fac56875c9045c7463e2ae69af4c6470 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Migrate to autogenerated cpp exportsAlexey Edelev2021-06-243-14/+3
| | | | | | | | Use autogeneratedd cpp exports in the Gui module. Task-number: QTBUG-90492 Change-Id: Ifc5d3dd138ef9f86f6003ed9adb66a9eefdd64db Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Consistent indentation for BINDABLE propertiesAndreas Buhr2021-06-248-16/+23
| | | | | | | | | Triggered by API review in Gerrit patch 355960. Task-number: QTBUG-94407 Pick-to: 6.2 Change-Id: I7cafc1cc9d4b929040b53c6bf92c91d73c3b39f2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* xcb: fix cursorTheme update issueTang Haixiang2021-06-241-2/+6
| | | | | | | | | | | | | | | Clear the cache when cursor theme changed. Idealy we should subscribe root window's RESOURCE_MANAGER property to update cursor theme via Xcursor. KDE already has a daemon KDE GTK Configurator to sync KDE settings to GTK. Then we can register the fallback there both for KDE and GTK changes. See also https://invent.kde.org/plasma/kde-gtk-config Fixes: QTBUG-94538 Pick-to: 6.2 6.1 6.0 5.15 Change-Id: Ia4de30930a0dc1dc306c61e1553970c3dab67bd6 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Remove const from signalAndreas Buhr2021-06-241-1/+1
| | | | | | | | | | We made a signal const. This does not make sense. Task-number: QTBUG-94407 Pick-to: 6.2 Change-Id: I372da9c045ba880f8fba48399e441b53c1683e93 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Put SVG versions of several built-in icons under version controlVolker Hilsheimer2021-06-2424-0/+416
| | | | | | | | | | | This is a collection of SVGs provided in the process of addressing QTBUG-38776. As of now, they are converted to PNGs or XPMs in different resolutions, which are then built into Qt as resources that are loaded into QIcon instances at runtime. Task-number: QTBUG-38776 Change-Id: Ib03f82cf1b1d2dc6260845fc46ad193046aff44c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use On icon for pressed dock widget title buttons without frameVolker Hilsheimer2021-06-241-2/+4
| | | | | | | | | | | | | | | The QCommonStyle provides explicit pixmaps for the SP_TitleBarCloseButton and SP_TitleBarNormalButton, but never showed the "down" pixmap on macOS because the button has no frame, so the On state flag was never set. Set the style states so that the "down" pixmap is used on a button that is either pressed or checked if it doesn't have a frame. Since QIcon only has two states, use the "On" state for both pressed and checked. Pick-to: 6.2 Task-number: QTBUG-38776 Change-Id: Ic04070196b97a4fb66d7a2669e9894fd7960230e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* SCTP: fix qsizetype missThiago Macieira2021-06-231-2/+2
| | | | | | | | | | Found by clang 12: qsctpsocket.cpp:172:56: error: result of comparison of constant 9223372036854775782 with expression of type 'int' is always true [-Werror,-Wtautological-constant-out-of-range-compare] Q_ASSERT((datagramSize + int(bytesToRead)) < MaxByteArraySize); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~ Change-Id: I7246c3e7bb894e0d9521fffd168af11764956d8f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Extend documentation for QFile:copy()Paul Wicking2021-06-232-10/+15
| | | | | | | | | | | | - Add information about symlinks and file metadata. - Reflow text. - Extract text common to both overloads to a .qdocinc file for consistency and to avoid duplication. Pick-to: 6.2 6.1 5.15 Fixes: QTBUG-94706 Change-Id: I3c730fd63f4018a1a573bb56751fedd2270a3247 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QObject::disconnect: remove dead codeFabian Kosmale2021-06-231-8/+0
| | | | | Change-Id: Id82ee3d0fb04d89e498cf05d0c0be33c4fe03e86 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use UTC when parsing only a date or only a time, not a date-timeEdward Welbourne2021-06-233-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | This should reduce the amount of fall-out from DST complications. Also document the assumptions of QDateTimeParser's two fromString() methods (and fix the punctuation on the QDateTime parameter). Adjusted some tests to match. Since only QDateTime-returning methods will show the difference, and it's at least somewhat odd to be using those on QDateEdit or QTimeEdit, this should have little impact on API users. [ChangeLog][QtCore][Behavior Change] QDateEdit and QTimeEdit now operate in UTC, to avoid spurious complications arising from time-zone transitions (e.g. DST) causing the implicit other half to combine with the part being edited to make an invalid result. Returns from their dateTime() and other methods returning QDateTime (max/min) shall thus be in UTC where previously they were in local time. QDateTimeEdit continues using local time. The default can be over-ridden by setTimeSpec(), as ever. Change-Id: I44fece004c12342fe536bbe3048217d236fd97b2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix coding-style violation in QUtf8StringView::operator==()Edward Welbourne2021-06-231-3/+3
| | | | | | | Task-number: QTBUG-94407 Pick-to: 6.2 Change-Id: I00a9c14963fe8f8d1b524350aec5544ff5dd609c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename PermisionType to spell permission correctlyEdward Welbourne2021-06-236-13/+16
| | | | | | | | | Thanks to Giuseppe for pointing it out in API change review. Task-number: QTBUG-94407 Pick-to: 6.2 Change-Id: I3b8fb653b5efa7ded51f81aadb35d361e7dbf19c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Coding style: remove redundant braces, break long lineEdward Welbourne2021-06-231-4/+6
| | | | | | | Task-number: QTBUG-94407 Pick-to: 6.2 Change-Id: Id9bbc3871bc3350fa5cc656f4248de8e6511ff05 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix handling of day-of-week in QDateTimeParser and QDateTimeEditEdward Welbourne2021-06-232-28/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDTP's absoluteMax(), setDigit() and getDigit() simply treated day-of-week as synonym for day-of-month. Consequently, QDTE::stepBy() did the same. This meant that wrapping happened at the month boundary, so would jump within the week if it wrapped around, otherwise the up/down arrow would "jam" at a particular day of the week when further steps would leave the month. Instead, when wrapping, wrap round the week while still moving the day-of-month to match, jumping back or forward a week to stay within the month on hitting a month boundary; otherwise, stop backwards stepping on hitting the locale-specific day of the week, or forward stepping when the step would be to or past this first day. Fixed various bugs found in the course of testing this. [ChangeLog][QtWidgets][QDateTimeEdit] Corrected handling of weekdays. Previously, changes to the week-day were simply changes to the day of the month. Weekday fields are now handled as such: changes to them do change the day of the month, but a change that would step past the end (or start) of the month is adjusted to the relevant day of the nearest week within the month. When wrapping is disabled, the locale-specific first and last days of the week are the bounds. Formats which specify day of week but not day of month will now preserve day of week when changing month or year, selecting the nearest day of month that matches. Change-Id: I7868b000fea7a4bc17a1b5687c44bcd56d42ae90 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Unregister screen notification handlers on QGuiApplication shutdownTor Arne Vestbø2021-06-232-3/+16
| | | | | | | | | | | | In the case of a plugin, the plugin might be unloaded, and destroy its QGuiApplication. We don't want the screen notification handlers to outlive the application, as that results in crashes. Fixes: QTBUG-91919 Pick-to: 6.2 6.1 5.15 Done-with: Yang Yang Change-Id: I3a4c0fcf97b785357516d1dac34489511400f154 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Enable QT_TYPESAFE_FLAGS for bootstrap and QtCoreGiuseppe D'Angelo2021-06-232-0/+2
| | | | | | Change-Id: I5c64a29ffecece9e527f5db78cceb912836153d3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QF*Engine: port a couple of QFlags->int implicit conversions to toInt()Giuseppe D'Angelo2021-06-232-4/+4
| | | | | Change-Id: Iafc3527941a0b56a680322e3bc05b4046e560e89 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: port away from QFlags<->int conversionsGiuseppe D'Angelo2021-06-231-2/+2
| | | | | | | Use fromInt/toInt. Change-Id: I4af833e432fec2156c4ab96211b2bbc48aedd7cd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: bump the OpenSSL minimum supported version to 1.1.1Tasuku Suzuki2021-06-231-2/+2
| | | | | | Pick-to: 5.15 6.1 6.2 Change-Id: Ibfc8b64be23eb023dafb875f367da98b7c7bb5f6 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* wasm: remove QEventLoop workaroundsMorten Sørvig2021-06-231-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | In general, QEventLoop::exec() _can_ be used as-is on WebAssembly, provided that the event dispatcher supports the use case. Use cases that can work include calling exec() on a secondary thread, or calling exec() on the main thread if asyncify is used. Some use cases will still require special casing for Wasm, such as the non-asyncified QApplication::exec(), but that can be handles closer to where the workarounds needed, for example in QApplication. This removes the partial support for nested event loops on the main thread, which did not really work. Also, we no longer call emscripten_force_exit() on QEvetLoop::exit(), which makes it possible to exit a top-level event loop without exiting the process. Task-number: QTBUG-70185 Change-Id: I3a28f41b8547ed3ba1bdf6a835e6662483e34449 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: do not quit() on beforeunload()Morten Sørvig2021-06-232-15/+0
| | | | | | | | | | | | | | | | | | | | | This is the wrong event: exiting the app here it is not compatible with the back/forward cache for instance. See the the MDN docs for the “Window: unload” event. Instead, make the Qt default be that we assume the app process will live “forever” until the browser terminates it, much like modern process handling on e.g. iOS. We may want to come back to app lifecycle handling at a later point. This might require changes to application code: implementing main() in such that it supports clean shutdowns and auditing showdown code to make sure it is web-compatible. Change-Id: I0f32026a3af76c9cc79e3aab31e8aaed7b8f8023 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Long live QT_TYPESAFE_FLAGS!Giuseppe D'Angelo2021-06-234-16/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds an opt-in mechanism to kill type-unsafe functions and implicit conversions of QFlags, therefore removing an entire category of bugs that QFlags itself is supposed to protect against: QFlags<E> f; f == 3.14; // OK; f->int, int->double, then operator==(double,double) f & UnrelatedEnum; // OK if of unscoped enum, calls operator&(int) f &= 123; // calls QFlags::operator&=(int) int i = f * 42; // f->int, then operator*(int, int) Thankfully, operator+ and operator- had already been deleted. By defining QT_TYPESAFE_FLAGS one: * disables operators taking (u)int, forcing the usage of an enumeration or another QFlags object; * turns the implicit conversions towards integers/bool in explicit (one can always use fromInt/toInt instead); * adds a convenience set of (in)equality operators against literal 0, in order to keep code like `(flag & bit) == 0` compile. This set can't be added normally otherwise it would add ambiguity; * adds the unary operator~(Enum), turning it into a flag. This is a source incompatible change, in general, so it's opt-in. This is a Qt-internal macro at this point. It can't be offered to users yet because we need to fix some public API flaws first: in some places (e.g. QPainter::drawText) we ask users to do type-unsafe manipulation of flags. A user enabling the macro wouldn't be able to properly use the functions in question. This macro will be enabled in a follow-up commit. Change-Id: I796f2256b446bafc12cdcbaf7de417d12bd3619e Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStringBuilder: fix warning about memcpying onto QCharThiago Macieira2021-06-221-1/+1
| | | | | | | | | | | | | Which is not a trivial class. qstringbuilder.h: In instantiation of 'static void QConcatenable<const char16_t [N]>::appendTo(const char16_t*, QChar*&) [with long long int N = 6]': qstringbuilder.h:402:35: required from 'static void QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::appendTo(const type&, T*&) [with T = QChar; A = char16_t [6]; B = QString; QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::type = QStringBuilder<char16_t [6], QString>]' qstringbuilder.h:460:52: required from 'QString& operator+=(QString&, const QStringBuilder<A, B>&) [with A = char16_t [6]; B = QString]' /home/tjmaciei/src/qt/qt6-release/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:1762:75: required from here qstringbuilder.h:338:15: error: 'void* memcpy(void*, const void*, size_t)' copying an object of non-trivial type 'class QChar' from an array of 'const char16_t' [-Werror=class-memaccess] Change-Id: Iddb933f281024939b6acfffd1689cf320c84873c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QPodArrayOps: re-enable -Wstringop-overflowGiuseppe D'Angelo2021-06-231-6/+0
| | | | | | | | | | The spurious warning is not emitted any more by GCC 10 / 11. Even if it's still emitted by earlier GCC versions, now it's no longer an error. Change-Id: Ia8bf3e10905909c097ecc025bf89f818410a8dae Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: Respect precision when reading data for %.*s format stringUlf Hermann2021-06-221-4/+8
| | | | | | | | | | | If we disregard the precision we may read a very large string that we subsequently discard. Furthermore, people use this to read non-null-terminated strings, which randomly crashes. Pick-to: 5.15 6.1 6.2 Change-Id: Ifa255dbe71c82d3d4fb46adfef7a9dc74bd40cee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qsimd: Don't force RDRND on if __AVX2__Thiago Macieira2021-06-221-5/+4
| | | | | | | | | | | | Like AESNI, RDRAND is an optional extra feature that is not always enabled in all parts. Probably something to do with export restrictions, but I've only seen that in low-end parts. Drive-by removal of "AES" where it was no longer relevant. Pick-to: 6.2 Change-Id: I7246c3e7bb894e0d9521fffd168af3fc0fb638a1 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Tidy up in OCI driver codeEdward Welbourne2021-06-221-36/+42
| | | | | | | | | | | | | Use nullptr instead of 0 for null pointers. Compare OCIHandleAlloc() return values to OCI_SUCCESS rather than 0. Initialize instance variables in the class where possible, rather than in the constructor. Conform to coding style o long lines and braces. Assert pointers are null before allocating and overwriting them, so we might have a chance of catching leaks. Change-Id: Ia885ec18f46de5219a51fb6f9f23f474b3046585 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io>