Commit message (Collapse)AuthorAgeFilesLines
* opengl: fix a typo in QOpenGLPaintDevice::dotsPerMeterY()6.1Liang Qi2021-10-261-1/+1
| | | | | | | | Fixes: QTBUG-95005 Change-Id: I88ab9b757a5cfee520e07ac6280e31f9211342f0 Reviewed-by: Laszlo Agocs <> (cherry picked from commit 85831bcfe6ce36740c524d641ada79c65aadd89b) Reviewed-by: Qt Cherry-pick Bot <>
* Fix compilation error with MSVC 2019 and C++20Sona Kurazyan2021-10-111-1/+1
| | | | | | | | Fixes: QTBUG-97425 Change-Id: Id327e3494d1deae852f953211c0409a80beafe88 Reviewed-by: Giuseppe D'Angelo <> (cherry picked from commit 64e931246484eb36b2b921cdec38263b21167523) Reviewed-by: Qt Cherry-pick Bot <>
* gl: Try the local CacheLocation when the shared one failsLaszlo Agocs2021-10-082-20/+45
| | | | | | | | | | | | | | | | | | | | | | | We prefer the shared cache path, because there is no reason to give up benefitting from sharing the content between applications. If that path is not QFileInfo().isWritable(), we fall back to the local cache path. However, there are reportedly systems with security solutions such as AppArmor where the writable check passes and yet attempting to create a file still fails. Then there is no cache in effect, because nothing ever gets written out. Handle this better: if writing the file fails and we still use our first choice, the global cache location, fall back to the secondary choice (the app-local path) and try again. Fixes: QTBUG-96789 Change-Id: Ifea32e9af0cf85aa70f3069256ed3d6a7e2fbe90 Reviewed-by: Qt CI Bot <> Reviewed-by: Dalton Durst <> Reviewed-by: Andy Nichols <> (cherry picked from commit 46e6a9a759ae89f905107ccad191ca5ddf442e53) Reviewed-by: Qt Cherry-pick Bot <>
* Revert "Support family names that end/start with space"Eskil Abrahamsen Blomfeldt2021-10-071-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 7fd9ed32012bd9001e78ad692a4802e0e3366e44. While trimming the font name worked for cases with application fonts, it actually introduced an assert for system fonts that ended with a space, because enumerating these failed. So the original assumption that all Windows APIs also trimmed the family name was wrong. The original bug was that the font with the trailing space could not be selected, but when using setFamilies(), it can. So there is a perfectly fine way around the original bug when using a font that has this problem. Therefore, no additional fix is needed for that. [ChangeLog][Windows] Fixed an assert that happened when the system had a font with a trailing or leading space in its name. Fixes: QTBUG-93885 Task-number: QTBUG-79140 Change-Id: I6d9df31a4f2c6555d38d51da374f69b6fb0f1ecb Reviewed-by: Lars Knoll <> (cherry picked from commit 4d47b18c81f74ae6855e16197a12b69a6bcfe68a) Reviewed-by: Qt Cherry-pick Bot <>
* Cocoa: Don't call makeKeyAndOrderFront for native app-modal dialogsDoris Verria2021-09-242-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | We show non-modal and Qt::WindowModal native dialogs as modeless panels by calling makeKeyAndOrderFront on the panel. When we exec() a dialog on the other hand, we start a modal event loop by calling runModalForWindow. This method will display the dialog and make it a key window before running the modal event loop. So we don't need to and shouldn't call makeKeyAndOrderFront explicitly before that. Doing so will make Cocoa lose the reference to the previous active window (as it maintains only one level of previous active window) and wrongly choose the main window as key after the dialog closes. Avoiding the call to showModelessPanel for Qt::ApplicationModal dialogs fixes it. Also, in order to display a modal when show() is called and app modality is set via setModality, display it as a modeless dialog as well. This keeps the same behavior we have currently, but it is still not the right way to handle it as we don't respect the modality set by the user. A clean-up of that logic to come in a follow-up commit. Fixes: QTBUG-42661 Change-Id: I8f33e3866b191d775a64a5d9ec3dd65736114e62 Reviewed-by: Tor Arne Vestbø <> (cherry picked from commit 7c26d7f482b9c15cc6ff850d5954151031010226) Reviewed-by: Qt Cherry-pick Bot <>
* QProcess: do not emit aboutToClose() twiceAlex Trotsenko2021-09-192-1/+2
| | | | | | | | | | This signal is emitted by the QIODevice itself, so we don't have to emit it from QProcess::close(). Change-Id: I9165b3eebadc17a66cc834d5ef54441d13f23d7d Reviewed-by: Thiago Macieira <> (cherry picked from commit efb90f6e7ed3e8d4f7b6c0fb96012cb3a9a9d037) Reviewed-by: Qt Cherry-pick Bot <>
* QPlatformWindow: fix isAncestorOf not breaking recursionRichard Moe Gustavsen2021-09-131-1/+1
| | | | | | | | | | | | | The current implementation got stuck always asking for the parent of the same child This patch will make sure we actually walk up the parent chain. Change-Id: I9f67f6305e0143526f53952a563d496e760ac2e7 Reviewed-by: Tor Arne Vestbø <> (cherry picked from commit f06f39779c11cabc9b4fc281f38c80edb65bd86a) Reviewed-by: Qt Cherry-pick Bot <>
* Make clear why QTestLog::addB?XFail() don't add to countersEdward Welbourne2021-09-133-9/+11
| | | | | | | | | | | | | This reverts commit 904617dfb83f39a6a379635b64fea6fcd00f241a and makes clear to future readers why that wouldn't be a sensible change. Update the test's data, eliminating a case of duplicate counting that was caused by the reverted commit. Task-number: QTBUG-95661 Change-Id: Ice6d3ab06ca171e0d6eb0fac757f1ab774e229f0 Reviewed-by: Mårten Nordheim <> Reviewed-by: Tor Arne Vestbø <> (cherry picked from commit 7af79ba09148dbfe5c1fc8b130d564dcca7ae4b3)
* Allow destruction of QWinEventNotifier in its signalAlex Trotsenko2021-09-111-1/+3
| | | | | | | | | | | | Avoid use-after-free issue in QProcess. Fixes: QTBUG-96285 Fixes: QTBUG-96359 Change-Id: I953d7a8ecaf301ec3a27db37e13748f905c3d097 Reviewed-by: Christoph Cullmann <> Reviewed-by: Thiago Macieira <> Reviewed-by: Oswald Buddenhagen <> (cherry picked from commit 4e0082a9cacfdfd0c43e6105274bc0d41dd18801)
* Fix querying font aliases that share name with other fontsEskil Abrahamsen Blomfeldt2021-09-112-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a332f3fabc29f796526202648eddf35a24f1cb67 disabled resolving all fonts on the system for every font lookup, which was a significant startup time improvement. But it also caused a regression: When a font has an alias which shares the name of a proper font, then this would not be resolved correctly. This is fairly typical on Windows/GDI due to backwards-compatibility. Instead of being collected under a shared typographical family, fonts are disambiguated by adding the style name to the family name. The proper typographical name is still available, but this is not enumerated by the system. So "Segoe UI" for instance, will be available as "Segoe UI", "Segoe UI Light", "Segoe UI Bold" etc. When we populate family aliases, we register that "Segoe UI Light" is actually "Segoe UI" with Light weight, and prior to a332f3fabc29f796526202648eddf35a24f1cb67 this would be done implicitly. But after the optimization, we would only populate family aliases once we stumbled over a font request for a non-existent font. For "Segoe UI", we would simply return the regular weight font as the best imperfect match. The fix is to populate font family aliases not only when the family is non-existent, but when the match is imperfect, e.g. if we are asking for a Light weight font and only finding a regular one. User code can still avoid this somewhat expensive operation by using the full family names on Windows. This also requires a fix to a test. When removeApplicationFont() is called, we invalidate the font database, so it will be reset to a state that does not contain the family aliases. Therefore we cannot guarantee that it is identical to what it was before the test started, since this depends on what has happened previously in the application. [ChangeLog][QtGui][Text] Fixed an issue where some font styles and weights would not be selectable. This was especially noticeable on Windows. Fixes: QTBUG-94835 Change-Id: I892855edd1c8e3d3734aace396f6000d897d2ec4 Reviewed-by: Tor Arne Vestbø <> Reviewed-by: Qt CI Bot <> (cherry picked from commit e0ad2cee55193696285cc84bf5c4922bb7247e9a) Reviewed-by: Qt Cherry-pick Bot <>
* tst_http2: Fix flaky authentication testMårten Nordheim2021-09-101-0/+5
| | | | | | | | | | | | The h2 server is running in a separate thread, so while the previous test was finished and the server was deleted, it could still emit and have a queued emission in-flight which would be picked up by the next running test. Change-Id: I26b1bc711df7473032d6078f35f8aca37c40137e Reviewed-by: Timur Pocheptsov <> (cherry picked from commit c942bae4ebf903a60a8bd3da9500f7733c71b04d) Reviewed-by: Qt Cherry-pick Bot <>
* qdevice.pri: Use cmake separators for the pathMårten Nordheim2021-09-101-0/+2
| | | | | | | | | | Because otherwise we may end up with trailing backslashes Change-Id: I7ad24ec34c35f0a7b32241751bbcd2b26a8a23ea Reviewed-by: Alexey Edelev <> Reviewed-by: Joerg Bornemann <> (cherry picked from commit a2653331330340c4f44457c49005f4c7226b8316) Reviewed-by: Qt Cherry-pick Bot <>
* OpenSSL: Let people opt-in to use TLS 1.3 PSK callbackMårten Nordheim2021-09-101-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a workaround for the workaround... If TLS 1.3 was explicitly chosen and the PSK callback is set then without this patch the callback is never called since, with TLS 1.3, PSK would only be queried once at the start of a connection. It can now be re-enabled with an environment variable. A new API should be added to address the new requirements of PSK with TLS 1.3: For session resumption the connection MUST use the same hash algorithm as in the original session. For new sessions the hash algorithm must be decided ahead of time, or a default will be used (as defined by the standard). A user can also pass along multiple identity+key pairs and the server will pick one it recognizes. This is not something we can currently do with the preSharedKeyAuthenticationRequired callback. [ChangeLog][Network][QSslSocket][OpenSSL] When using TLS 1.3 we suppress the first callback from OpenSSL about pre-shared keys, as it doesn't conform to the past behavior which preSharedKeyAuthenticationRequired provided. With this update you can opt-out of that workaround by setting the QT_USE_TLS_1_3_PSK environment variable Task-number: QTBUG-95670 Change-Id: Ia7454bbbf394cbcb859de333b371d0890b42a1c3 Reviewed-by: Timur Pocheptsov <> (cherry picked from commit 2e520f29a73fe4c3432a992d41c33220736a0d65) Reviewed-by: Qt CI Bot <> Reviewed-by: Edward Welbourne <>
* Skip tst_QReadWriteLock::multipleReadersLoop on QEMUSona Kurazyan2021-09-102-0/+6
| | | | | | | | | | | The test is randomly failing in the CI on QEMU. Couldn't reproduce it on the actual armv7 hardware, so most likely it's not a Qt bug. Fixes: QTBUG-96103 Change-Id: I60b7264c6ce44b3b327fdd0dbcede006717c65a6 Reviewed-by: Edward Welbourne <> (cherry picked from commit ba8d1da4a971a6351318e86fc613f74843bb2c49) Reviewed-by: Mårten Nordheim <>
* xcb: update connection time when possibleLiang Qi2021-09-092-3/+19
| | | | | | | | | | At least we try to do it with all events triggered by user. Change-Id: I28b399a2517600f7da2c91a50fecdf58b9d81fb6 Reviewed-by: JiDe Zhang <> Reviewed-by: Shawn Rutledge <> (cherry picked from commit 25feb2fe3e393dd1820bb4ee8c4105fb088de045) Reviewed-by: Liang Qi <>
* Fix QtConcurrent::blockingMapped to work with non-template sequencesSona Kurazyan2021-09-084-1/+202
| | | | | | | | | | | | | | | | The code for deducing the type of output sequence was assuming that the input sequence is always a template class and was trying to use the corresponding container type for the output sequence. Fixed the deduction code, to assume that the output sequence has the same type as the input sequence, when it's not a template class. Also added tests to verify that all QtConcurrent functions support non-template input sequences. Fixes: QTBUG-30617 Change-Id: I486fe99f3207cfff5dcceb3712cc7de863067edb Reviewed-by: Mårten Nordheim <> (cherry picked from commit 28e194d3b25f5fc6e17cce8dddba7f7e16002c43) Reviewed-by: Qt Cherry-pick Bot <>
* Cocoa: Make sure we can display multiple sheets for the same NSWindowDoris Verria2021-09-071-1/+5
| | | | | | | | | | | | | | | | On macOS, to display a modal with Qt::WindowModality set, or of type Qt::Sheet, we call beginSheet:completinHandler:. However, this method won't display the specified sheet unless the current active one is dismissed, which is a different behavior than what we expect for this case. Use beginCriticalSheet:completionHandler: whenever we already have an active sheet attached to the NSWindow, which allows us to display multiple sheets for the same window. Fixes: QTBUG-91059 Change-Id: I86bdbcbd63758edbbc48a8aade0178917dcb0e5b Reviewed-by: Tor Arne Vestbø <> (cherry picked from commit f3bc1f850046341745d42e2d6739724321634891) Reviewed-by: Qt Cherry-pick Bot <>
* Fix compilation for recursive Qt containersSona Kurazyan2021-09-078-32/+204
| | | | | | | | | | | | | | | | | | | | | The operator checks cause compilation errors when trying to check for their existence for recursive containers. This happens because of trying to check for the operators on the template parameter type(s), that inherit from the container itself, which leads to compilation errors. Introduced alternative versions of the operator checks (with _container suffix), that first check if the container is recursive, i.e. any of its template parameter types inherits from the given container, and skips the operator check, if that's the case. The fix is done for all Qt container types that had the problem, except for QVarLengthArray and QContiguousCache, which don't compile with recursive parameter types for unrelated reasons. Fixes: QTBUG-91707 Change-Id: Ia1e7240b4ce240c1c44f00ca680717d182df7550 Reviewed-by: Fabian Kosmale <> (cherry picked from commit 9f13842fe61541cb8ab9822174ea963e418b5537) Reviewed-by: Qt Cherry-pick Bot <>
* QPaintEngineEx: solve compile errorZhang Hao2021-09-071-1/+1
| | | | | | | | | | Use the same variable name in function Amends 6869d2463a2e0d71bd04dbc82f5d6ef4933dc510 Change-Id: If710a53993e84d048f9052f4fcf92eb57635f585 Reviewed-by: Giuseppe D'Angelo <> (cherry picked from commit cca8ed0547405b1c018e995ad366ba0ab4c2a0e8) Reviewed-by: Qt Cherry-pick Bot <>
* QObject: cleanup the orphaned connection lists on destructionGiuseppe D'Angelo2021-09-061-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a signal/slot connection is broken, it gets added to the sender's list of "orphaned connections", to clean up later. This cleanup happens when the sender gets destroyed or as soon as it emits any signal. This may cause soft memory leaks in case receivers get destroyed, and the sender is a long living object and doesn't emit signals for a while (e.g. QThread). For some reason, an explicit disconnection cleans up the list (either by using the QMetaObject::Connection object, or in case of string-based connect, using a string-based disconnect). This raises lots of doubts about why having this list in the first place. Fix the soft-leak by cleaning up the orphaned connection list when destroying a receiver. Note: I still believe that we shouldn't have any "orphaned" connection list, and rather cleanup on disconnect/deletion (otherwise, emitting a signal may cause a CPU spike because it triggers a cleanup). If we allow for any "impredictability" during signal activation we're just admitting that signals/slots aren't suitable for e.g. low-latency codepaths. That's why I'm not marking the problem as fixed. Original-patch-by: Giuseppe D'Angelo <> Task-number: QTBUG-88248 Task-number: QTBUG-87774 Change-Id: Id25f67a45dff49f740132a44d36e88740eb12070 Reviewed-by: Thiago Macieira <> Reviewed-by: Qt CI Bot <> (cherry picked from commit c2839843f23fb5c289175cb9577981d48dd273fc) Reviewed-by: Lars Knoll <>
* Add binary compatibility files for 6.1Milla Pohjanheimo2021-09-0311-0/+93568
| | | | | | | | Binary compatibility files added. Pick-to: 6.2 dev Change-Id: Ie575c774b13b3eae24412e535fa68be8c0ff5fb6 Reviewed-by: Jani Heikkinen <>
* Fix build on riscv32Fabrice Fontaine2021-09-021-0/+5
| | | | | | | | | | | | | | | | | | riscv32 fails to build because __NR_futex is not defined on this architecture: In file included from thread/qmutex_linux.cpp:45, from thread/qmutex.cpp:804: thread/qfutex_p.h: In function 'int QtLinuxFutex::_q_futex(int*, int, int, quintptr, int*, int)': thread/qfutex_p.h:116:30: error: '__NR_futex' was not declared in this scope; did you mean '_q_futex'? 116 | int result = syscall(__NR_futex, addr, op | FUTEX_PRIVATE_FLAG, val, val2, addr2, val3); | ^~~~~~~~~~ | _q_futex Fixes: QTBUG-96067 Change-Id: Ib6a9bcc496f37e69ac39362cb0a021fccaf311f5 Reviewed-by: Thiago Macieira <> (cherry picked from commit 035dc537bee26e3b63a211b2835d8560439e161f)
* Fix corner case in QTimeZonePrivate::dataForLocalTime()Edward Welbourne2021-09-021-13/+19
| | | | | | | | | | | | | | | If the local time for which we want data is after the last known transition, the two transitions we get to bracket it are the last known and an invalid one. The code checked the former was valid, but neglected to check the latter, leading to nonsense arithmetic later in the function. In this situation we unequivocally want the last known transition, so the problem is easily solved. Fixes: QTBUG-96152 Change-Id: I6fc830ce538e8a572093cd8dfe832e10689bf904 Reviewed-by: Andrei Golubev <> Reviewed-by: Mårten Nordheim <> (cherry picked from commit b656cea5deccab352b7c4c56d7023f5108578654)
* Fix QListView assert when the last row is moved in IconModeChunLin Wang2021-09-012-2/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | After the last row is moved, 0 will be returned when obtaining row and column data. At this time, QListView::doitemslayout will not call d->doitemslayout, so the QBspTree data structure will not be cleaned up, leaving a stale tree structure behind. This will trigger an assert during paintEvent handling if QListView is set to IconMode In QListView::ListMode the test for a valid model index doesn't use an assert. Call QListViewPrivate::clear explicitly if the column count is 0 so that the QBspTree and other data structures are cleared. Add a test case that simulates this scenario by implementing a model that returns a 0 column count for an index after the model structure was changed through a move of rows. Done-with: Volker Hilsheimer Fixes: QTBUG-95463 Change-Id: I36419be5459b8ced930c619f538482ea1db4ad03 Reviewed-by: Volker Hilsheimer <> (cherry picked from commit ca69e5aeef2fef540e687475ac00a4f332fdc5f3) Reviewed-by: Qt Cherry-pick Bot <>
* Doc: Replace the example for QFileInfo::setFileLuca Di Sera2021-08-283-10/+22
| | | | | | | | | | | | | | | | | The example in the documentation of `QFileInfo::setFile` made no use of `setFile` and only showed a use of `QDir::setCurrent`. The example was replaced with a new example showing how `setFile` changes the file that the information are retrieved from. The old example was moved under the documentation for `QDir::setCurrent` as it shows its working. Fixes: QTBUG-87128 Change-Id: I8227876cfcb4d582040bda9b4b7f3f7debea1e07 Reviewed-by: Paul Wicking <> (cherry picked from commit a2abb0145174a8ed82572a06e537f550a6777b08) Reviewed-by: Qt Cherry-pick Bot <>
* Fix deprecation of QMouseEvent::source() and flags()Shawn Rutledge2021-08-272-1/+3
| | | | | | | | | | | Amends 53496e67f0b78645c6080e9218c7a36bc5a9d76d: - move flags() out of the QT_DEPRECATED_SINCE block in the header - add QT_DEPRECATED_SINCE block around source() implementation Change-Id: Id52fa6b04a13efbede3e6ac440060f90b283e773 Reviewed-by: Volker Hilsheimer <> (cherry picked from commit ba8f9d8d92ba4fd9aaf6e0885b56b56e25acfc45) Reviewed-by: Qt Cherry-pick Bot <>
* QToolButton: reimplement the fix for QTBUG-95255Giuseppe D'Angelo2021-08-272-7/+10
| | | | | | | | | | | | | | | | | | The code in 188d739400e10fc8571bbf2ec86d5cd338b04a5d uses a connect() to a lambda, passing UniqueConnection to avoid establishing the connection more than once. The problem is that UniqueConnection does not work with lambdas; it works only with "regular" PMFs to QObject subclasses. Re-do the same fix, but without a connection: use the checkStateSet() virtual from the base class that will notify us if setChecked() is being called on the tool button, and from there synchronize the state of the default action. Change-Id: Id512812c562cd6d20bc1a489753b33c269919d32 Fixes: QTBUG-95255 Reviewed-by: Volker Hilsheimer <> (cherry picked from commit c9830c2fb902f26dc8b2df61dfadc2d7a7d2b30e) Reviewed-by: Qt Cherry-pick Bot <>
* QGraphicsProxyWidget: forward Window(De)Activate eventsVolker Hilsheimer2021-08-262-0/+59
| | | | | | | | | | | | | | | | | | | The nested widget might be a QGraphicsView as well (documented to be supported), and QGraphicsScene maintains it's own activation status by counting Window(De)Activate events. We need to make sure that the embedded widget is informed about its activation status so that deeper nested children can receive focus. Forward WindowActivate/Deactivate events to the nested widget, which will pass it on to all its children. Add test case, which without this fix fails when verifying the inner scene's isActive state, or later when testing that focusInEvent is delivered to the embedded widget. Fixes: QTBUG-94091 Change-Id: I4e0ecef50685ed081d15c7f76b6c1a4a40ed2682 Reviewed-by: Richard Moe Gustavsen <> (cherry picked from commit 01aeb5f7e4fd977e9698fffdc7650897664ecb82) Reviewed-by: Qt Cherry-pick Bot <>
* Forward touchEvents to children inside QGraphicsProxyWidgetVolker Hilsheimer2021-08-264-12/+187
| | | | | | | | | | | | | | | | | | | | | Just sending the event to the embedded widget is not enough, we have to perform hit-testing for the different touch points, and send the event to the child widget under the point. Fortunately, QApplicationPrivate::translateRawTouchEvent provides the logic that generates multiple events for groups of touch points. Since that helper always sent events spontaneously, add an optional parameter to allow sending of non-spontaneous events. Add a test case that simulates touch events to different widget configurations inside a QGraphicsProxyWidget. Fixes: QTBUG-67819 Task-number: QTBUG-45737 Change-Id: Iffd5c84c64ee2ceadc7e31863675fdf227582c81 Reviewed-by: Shawn Rutledge <> (cherry picked from commit 1ecf2212fae176b78c9951a37df9e33eb24d4f2d) Reviewed-by: Qt Cherry-pick Bot <>
* CMake: Fix automatic iOS bundle id extractionAlexandru Croitor2021-08-241-1/+1
| | | | | | | | | | | | | | | | | | | If no Xcode preferences file was found, _qt_internal_get_ios_bundle_identifier_prefix accidentally assigned the error output of running PlistBuddy to the bundle id property. That resulted in a bundle id called '${team_id}.Doesn't Exist, Will Create: /Users/qt/Library/Preferences/\' Check that the error variable is empty before assigning. Amends 4d838dae5a821e9e5f013ba1d5a494ece1b5180e Task-number: QTBUG-95838 Change-Id: I3a7241528590ae3e9986cfa1f3e91ac983ef54f6 Reviewed-by: Joerg Bornemann <> (cherry picked from commit 5a437d2590765a80236efad82e79654ebb3b4469) Reviewed-by: Qt Cherry-pick Bot <>
* Unicode: fix the grapheme clustering algorithmGiuseppe D'Angelo2021-08-242-15/+128
| | | | | | | | | | | | | | | | | | | | An oversight in the code kept the algorithm in the GB11 state, even if the codepoint that is being processed wouldn't allow for that (for instance a sequence of ExtPic, Ext and Any). Refactor the code of GB11/GB12/GB13 to deal with code points that break the sequences (falling back to "normal" handling). Add some manual tests; interestingly enough, the failing cases are not covered by Unicode's tests, as we now pass the entire test suite. Amends a794c5e287381bd056008b20ae55f9b1e0acf138. Fixes: QTBUG-94951 Change-Id: If987d5ccf7c6b13de36d049b1b3d88a3c4b6dd00 Reviewed-by: Thiago Macieira <> (cherry picked from commit d48058f1970a795afb4cedaae54dde7ca69cb252) Reviewed-by: Qt Cherry-pick Bot <>
* Painting: handle large and negative dash offset valuesEirik Aavitsland2021-08-242-3/+6
| | | | | | | | | | The mapping of the dash offset into the dash pattern was susceptible to int overflow. Change-Id: I254ed40b323ef516d10abc8e6008b14cfc23d2a0 Reviewed-by: Allan Sandfeld Jensen <> (cherry picked from commit ca604964f651b71f2b2a45a65e741167f520b714) Reviewed-by: Qt Cherry-pick Bot <>
* QDashStroker: cap the number of repetitions of the patternEirik Aavitsland2021-08-244-24/+39
| | | | | | | | | | | | | | Since the dashing is computed even outside the clipping and device area, painting very long dashed lines could consume unexpected amounts of time and resources. Fix by placing a limit on the dashing, and fall back to solid line drawing if hit. Fixes: QTBUG-95594 Change-Id: Ida05ecd8fe6df402c9e669206fd5cec4a9f5386a Reviewed-by: Robert Löhning <> Reviewed-by: Allan Sandfeld Jensen <> (cherry picked from commit 279a434c1c8689f00b1ab8ed571f8732a803a7eb) Reviewed-by: Qt Cherry-pick Bot <>
* Fix default line thickness for fontsEskil Abrahamsen Blomfeldt2021-08-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | When we are unable to get the line thickness from a font, we fall back to calculating this based on pixel size and weight. But the font weight scale has changed in Qt 6, causing the calculated font weight to be 10x as thick as it should. This happened e.g. for Titillium Web, but only when using 100% UI scaling, because the GDI engine was unable to get the correct line thickness from the font, whereas the DirectWrite engine succeeded. [ChangeLog][Windows] Fixes an issue where underlines and other decorations would be too thick for some fonts. Fixes: QTBUG-94529 Change-Id: Id2c88f0a145776151be0399ee646f28b3bdf9072 Reviewed-by: Thomas Hartmann <> Reviewed-by: Lars Knoll <> (cherry picked from commit 1971250de5729386d2ac4ebb1b99c4b84d195a6a) Reviewed-by: Qt Cherry-pick Bot <>
* Android: guard getStateCount() with correct VERSION.SDK_INTAssam Boudjelthia2021-08-231-1/+7
| | | | | | | | | | The call getStateCount() was introduced in 29, so cases for lower API should be handled. Change-Id: I7f58541c0b16fed91835e6f390afa89378a7af3e Reviewed-by: Ville Voutilainen <> (cherry picked from commit 760e24e8676d52e2851ef8556770194a97eae831) Reviewed-by: Qt Cherry-pick Bot <>
* QLineEdit: account for the placeholderText when computing lineRectZhang Hao2021-08-231-3/+10
| | | | | | | | | | | | | | | | If in a QLineEdit the placeholderText uses e.g. Tibetan language, then the height of font as reported by QFontMetrics might be less than the height of the boundingRect calculated for the placeholderText. This can cause the placeholderText to display incompletely. Fix this by using QFontMetrics::boundingRect instead of QFontMetrics::height when computing lineRect. Fixes: QTBUG-95341 Change-Id: I9eef35fd89c5c1d79f6dd703355634d6905ca967 Reviewed-by: Volker Hilsheimer <> (cherry picked from commit d2670601890a188e2d083460b6e65f9df1e8f6fe) Reviewed-by: Qt Cherry-pick Bot <>
* tst_QPluginLoader: Simplify creating a fake pointer in fakeplugin.cppMartin Storsjö2021-08-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When assigning multiple variables to a specific section, both GCC and Clang legitimately error out if those variables wouldn't end up in the same section (e.g. if one of them is going to a read-only section while the other one is going to a read-write section). In C++, when a seemingly const variable needs dynamic initialization, it needs to be stored in a read-write section. Clang 13 changed internals for how some constants are materialized. Now, when a variable is initialized with an expression containing plain old fashioned casts, it is considered to be potentially runtime initialized (at the point when section assignment conflicts is evaluated). Therefore, Clang 13 errors out on fakeplugin.cpp with errors like: fakeplugin.cpp:36:39: error: 'message' causes a section type conflict with 'pluginSection' QT_PLUGIN_METADATA_SECTION const char message[] = "QTMETADATA"; ^ fakeplugin.cpp:32:40: note: declared here QT_PLUGIN_METADATA_SECTION void *const pluginSection = (void*)(0xc0ffeec0ffeeL); ^ See for discussion on the matter in Clang. To simplify things, just initialize the fake pointers as regular uintptr_t instead, avoiding the whole matter. This produces the exact same contents in the section as before. For what it's worth, the actual manually constructed metadata in fakeplugin.cpp doesn't seem to have any effect on running the QPluginLoader tests on either ELF or MachO right now. Change-Id: Ib84a2ceb20cb8e3a1bb5132a5715538e08049616 Reviewed-by: Thiago Macieira <> (cherry picked from commit 70df6052d8e651d0d84e026ca113c654e89c6cc2) Reviewed-by: Qt Cherry-pick Bot <>
* Fix QScroller::scrollTo failing in QGraphicsView with movable itemChunLin Wang2021-08-202-1/+31
| | | | | | | | | | | | When forcing software scrolling through QScroller::scrollTo, it will start from (0, 0). QGraphicsViewPrivate::canStartScrollingAt should consider the locationof points, not just the flags of item. Fixes: QTBUG-70255 Change-Id: Iebdd5568baa3bdb41c705204dadb2895cfe9c0e2 Reviewed-by: Richard Moe Gustavsen <> (cherry picked from commit 9ba4c6beeff394d8526503b43ba471d82c27df9c) Reviewed-by: Qt Cherry-pick Bot <>
* QCocoaTheme: add ButtonText color to standard paletteRichard Moe Gustavsen2021-08-201-1/+2
| | | | | | | | | | | | | | | | | The standard palette had no value set for ButtonText. The result was the we drew button text in QtQuickControls2 using Text color instead, which would be wrong in dark mode, and result in a dark color instead of white. Note: Widgets hardcode the color "white" directly in the mac style, and was not affected by the missing value. Fixes: QTBUG-89177 Change-Id: Ie2d99bfac9fcc70d45e5bd40ea45becf3fd70d87 Reviewed-by: Morten Johan Sørvig <> (cherry picked from commit b7150d22c8ea6349b5d1fd61d5059e0fbe2745ed) Reviewed-by: Qt Cherry-pick Bot <>
* Improve lancelot test of dashed line paintingEirik Aavitsland2021-08-203-4/+70
| | | | | | | | | | | | Add painting of sets of lines, both connected and unconnected, that go outside the device area. This prepares for fixes & improvements in the painting code. Change-Id: I9cffc760524e9ade42362c9a04949270ac24180f Reviewed-by: Allan Sandfeld Jensen <> (cherry picked from commit 587fe1a95ad2789c2f284fb1384f19b7f5b09917) Reviewed-by: Qt Cherry-pick Bot <>
* macOS: close popups on mousedown within the window frameVolker Hilsheimer2021-08-193-34/+53
| | | | | | | | | | | | | | | | | On macOS, we close active popups when handling mouse-down events in the NSView, but not for such events in the window frame. This allows users to close a window that has a context menu open via the window's close button, which then leaves open popups behind. Factor the popup-closing code out into a dedicated method that we can call from within the NSWindow::sendEvent implementation for mouse down events. Fixes: QTBUG-30522 Change-Id: I9c354efc449cfefff3ed84fa34b1cd8a0da3b4a7 Reviewed-by: Tor Arne Vestbø <> (cherry picked from commit 70b94eea10d7af83cced09296755a8af28e167b5) Reviewed-by: Qt Cherry-pick Bot <>
* Attempt to unwedge tst_QThread::wait3_slowDestructor()Edward Welbourne2021-08-191-13/+15
| | | | | | | | | | | | | | | | | When the test failed, it never released the blocking slot, so the tested thread remained blocked indefinitely. Blacklisting doesn't rescue that: the test run gets killed by Coin's watchdog. Use a QScopeGuard() to release the clocked slot on failure. replacing the release that was happening only on success. As drive-by clean-up, smarten up the code a little and remove an unused enum. Change-Id: Ie035dafe6e4b1d82aea5de38ceb31c0f7fcf81d7 Reviewed-by: Sona Kurazyan <> (cherry picked from commit 2684deaf26e7c7af1ac504f562231a4cc4fbd733) Reviewed-by: Qt Cherry-pick Bot <>
* Use a scope-guard to take care of process deletion in a testEdward Welbourne2021-08-191-6/+5
| | | | | | | | | | | Doing the deletion at the end of the block only works if the test passes. Drive-by: remove spurious braces from single-line bodies of single-line controls. The QTest macros are done properly. Change-Id: I83002547dba49ab9792f4db44d73151b1c036900 Reviewed-by: Sona Kurazyan <> (cherry picked from commit 4ccbd751f1eee5c27ce5d4c9868d65092630d991) Reviewed-by: Qt Cherry-pick Bot <>
* Fix bug with NoFontMerging when font does not support scriptEskil Abrahamsen Blomfeldt2021-08-194-6/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using NoFontMerging, no fallbacks should be resolved. If the font does not support a specific character in the text, we should display a box instead of merging it with another font. But in practice, Qt would still apply the fallback mechanism for one specific case: If the font itself does not support the script of the text, we would get no match and do a search for a fallback instead. Since NoFontMerging is set, we would then force this as preresolved for *all* scripts in the QFont's private data (logically, the match should only have a single response for NoFontMerging). The end result was that if you set the font family before updating the text, you would get broken rendering. This can happen e.g. in Qt Quick, where you could update the font family of a text label while it contains characters which are not supported by the new font. Qt would then pick a fallback instead. When you subsequently update the text, the fallback would already be preresolved for whatever script this is. If it does not support the updated text, we would then see boxes, even if the requested font actually would have supported it. The fix is simply to do an additional pass if NoFontMerging is set and we were not able to match with the specified script. Since the same family might be available in different foundries, with different writing system support, we still want to do a pass first to see if we can match the exact script of the text. Note that QRawFont::fromFont() exploited the bug by using NoFontMerging for getting the fallback font for a specific writing system. To keep this working without having to rewrite fromFont() and risk introducing regressions, we add an argument to make the findFont() function behave as before. It isn't super-pretty, but since it is private API it is hopefully fine. [ChangeLog][QtGui][Text] Fixed an issue with NoFontMerging and changing font families dynamically, where boxes would be seen in place of the correct text. Done-with: Andy Shaw Fixes: QTBUG-81770 Change-Id: Ide9a36d7528a1040172c5864fa99e7a82eac4e83 Reviewed-by: Qt CI Bot <> Reviewed-by: Konstantin Ritt <> Reviewed-by: Lars Knoll <> (cherry picked from commit 43a63901f4eb61ad8a29f4cc7a1700685f88ec35) Reviewed-by: Qt Cherry-pick Bot <>
* QRegularExpression: fix matching over null/empty QString(View)Giuseppe D'Angelo2021-08-192-4/+37
| | | | | | | | | | | | | | | | | | | | | | | | An empty QString(View) is allowed to have nullptr as its data pointer (of course, only if its size is 0). This wasn't properly checked in QRegularExpression, which passed such nullptr to PCRE, and that resulted in PCRE raising an error (PCRE_ERROR_NULL). Detect this case and pass a dummy pointer to keep PCRE happy. Fixing and testing this in turn exposed a problem with QStringView support in QRegularExpression when used over a null QString: the code is supposed to use the QStringView(QString) constructor and NOT qToStringViewIgnoringNull. That's because QRE distinguishes null and empty subjects; when using qToStringViewIgnoringNull over a null QString, one gets a non-null QStringView (!). Again, this in turn exposed a problem with a QRegularExpression autotest that assumed that a null match could only mean "no match" (instead, it can happen at position 0 of a null QString(View)). Change-Id: Ifb3cf14dec42ce76fcdbcb07ea1d80784d52ef65 Reviewed-by: Thiago Macieira <> Reviewed-by: Edward Welbourne <> (cherry picked from commit f0d1f50e0294e5a55a0e450993e0810bd4dbf63d) Reviewed-by: Qt Cherry-pick Bot <>
* QtConcurrent: fix examples of overloaded methods in docsSona Kurazyan2021-08-184-8/+18
| | | | | | | | | | | | | Wrap the overloaded methods in qOverload(), to make the examples compile. Also remove the extra whitespaces when declaring nested templates. Change-Id: If438caa6d705d9036dae45278fb26e080918da89 Reviewed-by: Karsten Heimrich <> Reviewed-by: Mårten Nordheim <> (cherry picked from commit 8aefbe67bf445d51f41c16ec00bc5ce3ec18ded5) Reviewed-by: Qt Cherry-pick Bot <>
* rhi: metal: Make base vertex and instance support optionalLaszlo Agocs2021-08-183-14/+34
| | | | | | | | | | | | | | | | | | | | | | | | Like we do for OpenGL. Conveniently enough the QRhi feature flags are readily available. This should prevent errors such as: MTLValidateFeatureSupport:3901: failed assertion `Base Vertex Instance Drawing is not supported on this device' on the iOS Simulator. It is not clear since which version or SDK this became a fatal problem, but the base vertex/instance support is indeed an optional feature according to the Metal Feature set tables, so not calling the drawIndexedPrimitives variant taking baseVertex and baseInstance when the reported iOS GPU family is too low is the right thing to do regardless. Fixes: QTBUG-95795 Change-Id: I47c54a77a66a0410b86b8d4e5a1863dc730490f4 Reviewed-by: Alexandru Croitor <> Reviewed-by: Andy Nichols <> (cherry picked from commit 213755a86622ae8b3ed3d7ad34a6aecd051b2b03) Reviewed-by: Qt Cherry-pick Bot <>
* Doc: Add missing links to methods to QSet documentation pageLuca Di Sera2021-08-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some internal links to `QSet` methods were missing from the documentation. In particular, all methods that were written with one attribute. It seems that QDoc might automatically recognize method/function links only if they have zero parameters, such that the identifier is followed by `()` directly. To avoid this problem while keeping the current parameter-containing form of the text; each function of the form `functioname(\a parametername)` was changed to `\l {functionname()} {functioname(\a parametername)}. Furthermore, one of those text instances was modified to use `\a` for the parameter name, instead of the previously used `\e`, to enhance consistency. An instance of `operator<<()` was not recognized as a link. To resolve this it was marked with the `\l` command. Fixes: QTBUG-95389 Change-Id: I16b2a7a2fbaf4785c2c6bfa5017a3db46d9db2f4 Reviewed-by: Paul Wicking <> (cherry picked from commit fd86939eaf73c5e58e12b7eb2cd0563c03d33ba9) Reviewed-by: Qt Cherry-pick Bot <>
* QTabBar: don't overwrite data, fix refactoring error for vertical tabsVolker Hilsheimer2021-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | Amends 359616066e64eed947c6c91cb8902285ed79dd0d, which incorrectly changed - tabList[i].minRect = QRect(0, miny, sz.width(), sz.height()); + tab->data = QRect(0, miny, sz.width(), sz.height()); in the code laying out verticals tabs (correct done for the horizontal case). Since QDockWidget uses the user data for tabs to maintain the mapping between tabs and dock widget, this broke the layout logic. Fixes: QTBUG-95841 Change-Id: Ie785e1205b426bbc4954b965f619f4c603490f76 Reviewed-by: Lars Knoll <> (cherry picked from commit 7188e650775ffd2bf4f2574094b6472c86468fba) Reviewed-by: Qt Cherry-pick Bot <>
* QtConcurrent::run: support non default-constructible return typesSona Kurazyan2021-08-184-30/+27
| | | | | | | | | | | | | | | The QtConcurrent::RunFunctionTask class keeps a variable to store the result of QtConcurrent::run when it becomes available, so that it can be reported afterwards. This requires the result type to be default-constructible. However there's no need in storing the result, it can be reported immediately after it becomes available. Fixes: QTBUG-95214 Change-Id: I95f3dbff0ab41eaa81b104a8834b37d10a0d193a Reviewed-by: Jarek Kobus <> Reviewed-by: Andrei Golubev <> (cherry picked from commit 642b9fce81b46e23b35b17e8284bd81bdba57fdd) Reviewed-by: Qt Cherry-pick Bot <>