summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* 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 <lars.knoll@qt.io> (cherry picked from commit 4d47b18c81f74ae6855e16197a12b69a6bcfe68a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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ø <tor.arne.vestbo@qt.io> (cherry picked from commit 7c26d7f482b9c15cc6ff850d5954151031010226) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProcess: do not emit aboutToClose() twiceAlex Trotsenko2021-09-191-1/+0
| | | | | | | | | | 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 <thiago.macieira@intel.com> (cherry picked from commit efb90f6e7ed3e8d4f7b6c0fb96012cb3a9a9d037) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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ø <tor.arne.vestbo@qt.io> (cherry picked from commit f06f39779c11cabc9b4fc281f38c80edb65bd86a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make clear why QTestLog::addB?XFail() don't add to countersEdward Welbourne2021-09-131-2/+4
| | | | | | | | | | | | | 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 <marten.nordheim@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (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 <cullmann@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit 4e0082a9cacfdfd0c43e6105274bc0d41dd18801)
* Fix querying font aliases that share name with other fontsEskil Abrahamsen Blomfeldt2021-09-111-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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ø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit e0ad2cee55193696285cc84bf5c4922bb7247e9a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <timur.pocheptsov@qt.io> (cherry picked from commit 2e520f29a73fe4c3432a992d41c33220736a0d65) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* 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 <zhangjide@uniontech.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 25feb2fe3e393dd1820bb4ee8c4105fb088de045) Reviewed-by: Liang Qi <liang.qi@qt.io>
* Fix QtConcurrent::blockingMapped to work with non-template sequencesSona Kurazyan2021-09-081-1/+7
| | | | | | | | | | | | | | | | 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 <marten.nordheim@qt.io> (cherry picked from commit 28e194d3b25f5fc6e17cce8dddba7f7e16002c43) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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ø <tor.arne.vestbo@qt.io> (cherry picked from commit f3bc1f850046341745d42e2d6739724321634891) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix compilation for recursive Qt containersSona Kurazyan2021-09-077-32/+60
| | | | | | | | | | | | | | | | | | | | | 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 <fabian.kosmale@qt.io> (cherry picked from commit 9f13842fe61541cb8ab9822174ea963e418b5537) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <giuseppe.dangelo@kdab.com> (cherry picked from commit cca8ed0547405b1c018e995ad366ba0ab4c2a0e8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <giuseppe.dangelo@kdab.com> Task-number: QTBUG-88248 Task-number: QTBUG-87774 Change-Id: Id25f67a45dff49f740132a44d36e88740eb12070 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit c2839843f23fb5c289175cb9577981d48dd273fc) Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* 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 <thiago.macieira@intel.com> (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 <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit b656cea5deccab352b7c4c56d7023f5108578654)
* Fix QListView assert when the last row is moved in IconModeChunLin Wang2021-09-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 <volker.hilsheimer@qt.io> (cherry picked from commit ca69e5aeef2fef540e687475ac00a4f332fdc5f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <paul.wicking@qt.io> (cherry picked from commit a2abb0145174a8ed82572a06e537f550a6777b08) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <volker.hilsheimer@qt.io> (cherry picked from commit ba8f9d8d92ba4fd9aaf6e0885b56b56e25acfc45) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <volker.hilsheimer@qt.io> (cherry picked from commit c9830c2fb902f26dc8b2df61dfadc2d7a7d2b30e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QGraphicsProxyWidget: forward Window(De)Activate eventsVolker Hilsheimer2021-08-261-0/+4
| | | | | | | | | | | | | | | | | | | 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 <richard.gustavsen@qt.io> (cherry picked from commit 01aeb5f7e4fd977e9698fffdc7650897664ecb82) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Forward touchEvents to children inside QGraphicsProxyWidgetVolker Hilsheimer2021-08-263-12/+19
| | | | | | | | | | | | | | | | | | | | | 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 <shawn.rutledge@qt.io> (cherry picked from commit 1ecf2212fae176b78c9951a37df9e33eb24d4f2d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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/com.apple.dt.Xcode.plist\n.app' Check that the error variable is empty before assigning. Amends 4d838dae5a821e9e5f013ba1d5a494ece1b5180e Task-number: QTBUG-95838 Change-Id: I3a7241528590ae3e9986cfa1f3e91ac983ef54f6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 5a437d2590765a80236efad82e79654ebb3b4469) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Unicode: fix the grapheme clustering algorithmGiuseppe D'Angelo2021-08-241-15/+27
| | | | | | | | | | | | | | | | | | | | 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 <thiago.macieira@intel.com> (cherry picked from commit d48058f1970a795afb4cedaae54dde7ca69cb252) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <allan.jensen@qt.io> (cherry picked from commit ca604964f651b71f2b2a45a65e741167f520b714) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <robert.loehning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 279a434c1c8689f00b1ab8ed571f8732a803a7eb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <thomas.hartmann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 1971250de5729386d2ac4ebb1b99c4b84d195a6a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <ville.voutilainen@qt.io> (cherry picked from commit 760e24e8676d52e2851ef8556770194a97eae831) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <volker.hilsheimer@qt.io> (cherry picked from commit d2670601890a188e2d083460b6e65f9df1e8f6fe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QScroller::scrollTo failing in QGraphicsView with movable itemChunLin Wang2021-08-201-1/+1
| | | | | | | | | | | | 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 <richard.gustavsen@qt.io> (cherry picked from commit 9ba4c6beeff394d8526503b43ba471d82c27df9c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <morten.sorvig@qt.io> (cherry picked from commit b7150d22c8ea6349b5d1fd61d5059e0fbe2745ed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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ø <tor.arne.vestbo@qt.io> (cherry picked from commit 70b94eea10d7af83cced09296755a8af28e167b5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix bug with NoFontMerging when font does not support scriptEskil Abrahamsen Blomfeldt2021-08-193-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <qt_ci_bot@qt-project.org> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 43a63901f4eb61ad8a29f4cc7a1700685f88ec35) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QRegularExpression: fix matching over null/empty QString(View)Giuseppe D'Angelo2021-08-191-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | 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 <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit f0d1f50e0294e5a55a0e450993e0810bd4dbf63d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <karsten.heimrich@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 8aefbe67bf445d51f41c16ec00bc5ce3ec18ded5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <alexandru.croitor@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 213755a86622ae8b3ed3d7ad34a6aecd051b2b03) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <paul.wicking@qt.io> (cherry picked from commit fd86939eaf73c5e58e12b7eb2cd0563c03d33ba9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 <lars.knoll@qt.io> (cherry picked from commit 7188e650775ffd2bf4f2574094b6472c86468fba) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QtConcurrent::run: support non default-constructible return typesSona Kurazyan2021-08-182-26/+11
| | | | | | | | | | | | | | | 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 <jaroslaw.kobus@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 642b9fce81b46e23b35b17e8284bd81bdba57fdd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QVarLengthArray: add missing default-ctor documentationMarc Mutz2021-08-181-0/+5
| | | | | | | | | | Was lost when we un-explicit'ed the default ctor in c34242c679aaea6ee1badf6c1e5f274f925f5f50. Change-Id: Ifb4943b9e9647ae59c1cc6d5fc5076e8620b73ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 874c8c56a4883383e49a1e59262113f8eb29486f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Don't wipe NSWindowStyleMaskFullSizeContentView if set manuallyTor Arne Vestbø2021-08-171-1/+3
| | | | | | | | | | | The NSWindow may have style masks set by the user via winId(). We don't want to wipe those just because we're recomputing the style mask. Fixes: QTBUG-69975 Change-Id: Ibca8388d45b623f4cdfaff4b256c4eb012e2ffac Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit d627d351bedb96c727aa6e3b7cb2cc2d678c5606) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix Style java code format and warningsAssam Boudjelthia2021-08-173-536/+346
| | | | | | | | | | | The code had many bad formating and syntax or API usage warnings, as well as some unused methods or classes which are fixed with this patch. Task-number: QTBUG-71590 Change-Id: Ib113a0dc05703afb5190ec880b27daf75274cb1e Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit dc9075554135160bb07aa54708aba69d127160e2)
* Don't crash in high-precision wheel scrolls on a QGraphicsProxyWidgetVolker Hilsheimer2021-08-172-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For high-precision wheel scrolling sequences, the widget that gets the first (typically ScrollBegin) event grabs the wheel. Qt directs all future wheel events within the same sequence (i.e. until ScrollEnd) to that widget. QGraphicsView passes wheel events through to the item under the mouse, and QGraphicsProxyWidget implements wheelEvent to forward a synthesized QWheelEvent to the embedded widget. Since QGraphicsView's viewport has already grabbed the wheel, any forwarded event would end up back in QGraphicsView, resulting in infinite recursion (if the assert doesn't fail first in debug builds). The correct fix requires that QGraphicsProxyWidget knows that this is a high-precision wheel event, allowing it to adjust the wheel grabber temporarily to the embedded widget. However, QGraphicsSceneWheelEvent doesn't provide this information. To fix the infinite recursion, mark the generated event as synthesized by Qt (but still send it spontaneously to enable propagarion within the proxy widget hierarchy). In QApplication's notification routine, interpret such events then to override the wheel grabber. Add a test case for the various scenarios. This 6.1 compatible fix does not pass all situations. A follow up commit that introduces the missing APIs to QGraphicsSceneWheelEvent then fixes those as well. Task-number: QTBUG-95552 Change-Id: I78400ceae8da7a4e22a988c06ed58f99f1a979f4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 4982c872efef7ce8673ed257dce24b971e456a08) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Accept the QWheelEvent before each propagation stepVolker Hilsheimer2021-08-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | Input events in Qt are accepted when constructed, and ignored by the default event handler (so overriding the event handler is enough to accept an event). Since we use the same QWheelEvent instance for each propagation step, we need to reset the event to be accepted before each delivery so that an earlier child ignoring the event doesn't result in the event being ignored without explicit acceptance. Amends the refactoring of wheel event delivery in 92df790f46b3a8b17aec2f385d6472fd3f8647f6. Task-number: QTBUG-95552 Task-number: QTBUG-79102 Task-number: QTBUG-67032 Change-Id: Ib3f99792518364cf6e635cf4c6fda088051a7848 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 1653ae13db69a2e703a1b44d3e67b55e927a5eca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Don't treat null-key as potential shortcut keyTor Arne Vestbø2021-08-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When mapping virtual keys and modifiers to their corresponding characters via a keyboard layout we may hit combinations that do not produce any characters. This can happen if there's no <key> element defined for the virtual key, or if the output attribute of the element is empty (despite the spec saying there should always be one UTF-16 code point in the output). https://developer.apple.com/library/archive/technotes/tn2056/_index.html When that happens QAppleKeyMapper::keyMapForKey() will map the combination to a null-QChar, resulting in the "key" being 0. We do not want to propagate this back to the QShortcutMap machinery, as QShortcutMap does not validate the keys coming out of QKeyMapper::possibleKeys(). In particular, it doesn't check the isEmpty() or count() of the QKeySequences it creates. And even if it did, QKeySequence itself seems to treat Qt::Key(0) + Qt::SomeModifier as a non-empty sequence, so passing on 0-keys would still give weird bugs. The user-visible result of passing back 0-keys is that QShortcutMap will treat it as a partial match for any incoming key combination (as long as some modifier is pressed that triggers the QShortcutMap machinery), which resulting in eating the key press. This compounded the issue in QTBUG-95471. Regression after fab3dfff7d53d496a31c5d2df972ddacfe861a4d. Task-number: QTBUG-95471 Change-Id: I2e51ec86f4df2a708e1757be827ab74859be3c8b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 99a4419647df14bf81d1837d22c9636957fd6257) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Map dead keys directly to their terminator when building key mapTor Arne Vestbø2021-08-162-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a key press comes in we may end up in QAppleKeyMapper::possibleKeys() as part of checking whether the key press should trigger a QShortcut. The function builds on QAppleKeyMapper::keyMapForKey(), which provides a map from the given virtual key to all the possible Qt::Keys that can be produced by applying different modifier key combinations. The map is built using the Carbon function UCKeyTranslate, that takes the current keyboard layout, virtual key, and modifiers, and produces the resulting characters. The function also maintains a running dead key state via one of the arguments. When mapping a dead key, the state variable will be updated to the current dead key state, which then affects the next call to the function (for the next key press). The problem is that we're not calling UCKeyTranslate for each key press. We are calling it in a loop, for a single key press, to build up a map of all the possible characters produced by varying the modifier keys. And in doing so, we are passing on the dead key state from one call to the next, even if these are for different modifiers. The result is that the first call, for the dead key, results in mapping to \0, as UCKeyTranslate produces no output, it only modifies the dead key state. And then the next call, for the next modifier key combination, results in mapping to a character that incorrectly incorporates the dead key state (resetting it in the process). What we really want is to directly map the initial modifier combination to the dead key terminator character, if one is defined. This is the character produced if the dead key state is cancelled, for example by pressing a key that's not defined in the dead key state. To achieve this we pass kUCKeyTranslateNoDeadKeysMask as the translate options to UCKeyTranslate, and always reset the dead key state before every call. Another common way to achieve the same result would be to call UCKeyTranslate a second time when detecting that the first call produced a dead key state, for example with a synthetic space key, to trigger the terminator output. But this can potentially fail if the space key actually has a defined output in the dead key state. Fixes: QTBUG-95471 Change-Id: Icdae7639fd9a641a86c9d6615679bd93d380ff5c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 853c350cca4e00d2f890672ad8144a55ad75541e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix button type to update coordinates when draggingCathy Park2021-08-161-1/+4
| | | | | | | | | | | | | A move position (x,y) can be delivered to the MouseArea only if button is Qt::NoButton during mouse move (dragging). Otherwise mouse move does not cause positionChanged in MouseArea. Task-number: QTBUG-95453 Change-Id: I298943dc4f6f30714e940f4029c62dd52c176b93 Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 3727683bd5f57666926603b84bccdf24d3839c98) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix hidden API access for Android styleAssam Boudjelthia2021-08-132-833/+787
| | | | | | | | | | | | | | | | | | | | Use public API and attributes to retrieve part of the Android style values instead of using reflection to access hidden or private fields. This latter method, was throwing lots of warnings or exceptions at the start of apps making it big annoyance to deal with. This patch doesn't handle drawables though, so the "full" and "default" Android style will be somehow broken still for now. For that reason, the default style extraction method is set to minimal to avoid getting warnings about it, and Fusion style could be used for Widgets apps, and for QML apps, it's recommended to use the Material style from Quick Controls 2. Task-number: QTBUG-71590 Change-Id: If87895dc66751e23c9f4ea840e9f3e611aaa8833 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit b5b9c264ddff6c6eebb08038d9d3f2282df5c0ec)
* Doc: Ensure deprecated APIs in Qt Sql are documented as suchNico Vertriest2021-08-131-18/+18
| | | | | | | | | Added \deprecated where needed Fixes: QTBUG-94585 Change-Id: Id6d1fee1bbb6f8194e90a494673edef34530482b (cherry picked from commit fbf836657f06f2f302aaaf6bb6416f19d979f2aa) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* StyleSheet: Use rule for ComboBox in embedded QLineEditVolker Hilsheimer2021-08-121-6/+5
| | | | | | | | | | | | | | | | | | An editable combobox uses an embedded QLineEdit as an implementation detail. That lineedit should use the rules that are set for the combobox to render itself, similar to what was already implemented for the lineedit used in a QAbstractSpinBox. The containerWidget helper function provides the logic for identifying the container of the rendered widget, returning the QAbstractSpinBox or the QComboBox for an embedded QLineEdit. Use that method rather than duplicating the logic. Fixes: QTBUG-95631 Change-Id: I50bc92a62715608b11c2c923f8f9215f56bfd15e Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit adafa5ee1f37739f33f6417f27c8ee7308aaad9c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>