summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Allow negative delta for designer animation driverAntti Määttä2021-10-182-2/+6
| | | | | | | | | | | | The designer animation driver needs the ability to drive the animation both forwards and backwards. Pick-to: 6.2 6.2.1 Task-number: QDS-4910 Change-Id: Ie2b1855d062bb254b28b216328cb618d90ee8454 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Prevent recursive calls to QWindow::closeTor Arne Vestbø2021-10-181-0/+2
| | | | | | | | | QWidget will call close() in its destructor, which we might end up in if a user deletes the widget in the closeEvent. Pick-to: 6.2 Change-Id: I39684aec0ca130033dad60f2bbf823364a5edcec Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Update UCD to Revision 28Ievgenii Meshcheriakov2021-10-187-6596/+7052
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This corresponds to Unicode version 14.0.0. Added the following scripts: * CyproMinoan * OldUyghur * Tangsa * Toto * Vithkuqi Full support of these scripts requires harfbuzz version 3.0.0, this version adds support for Unicode 14.0: https://github.com/harfbuzz/harfbuzz/releases/tag/3.0.0 With this release 10 test cases in tst_qurluts46 were fixed, one additional test case is failing in tst_qtextboundaryfinder and is commented out. In total 62 line break test cases and 44 word break test cases are failing. A comment in src/corelib/text/qt_attribution.json was updated to include the URL of the page containing UCD version number. Fixes: QTBUG-94359 Change-Id: Iefc9ff13f3df279f91cbdb1246d56f75b20ecb35 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QProperty: Eliminate further unnecessary TLS operationsUlf Hermann2021-10-182-6/+13
| | | | | | | | | If we don't have a binding, we don't need to remove it. We can figure this out without TLS lookup. Pick-to: 6.2 Change-Id: I0cb20f2a68a119df7742631e307002e3813eac03 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QProperty: Don't needlessly calculate inBindingWrapper()Ulf Hermann2021-10-181-14/+14
| | | | | | | | | If there is no binding data, we don't need it. inBindingWrapper() involves a TLS lookup. Pick-to: 6.2 Change-Id: I829f314d708b80821e907124eef4aec758bbbc6a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Don't hide dialogs before closing themTor Arne Vestbø2021-10-181-1/+7
| | | | | | | | | | | | | | | | | | | When a dialog was accepted or rejected via done(), we used to only hide it, but as of 0246bfd40a2cc5ea9cfc035146e6dd865b334c68 we now close it. Closing a widget results in hiding it as part of handleClose, so we do not need to explicitly hide it before calling close(). In fact doing so prevents the lastWindowClosed logic from checking whether the window was visible before handling the close event, which is documented to be a requirement for a window triggering lastWindowClosed. We still need to hide the widget in case we don't end up closing it ourselves, to ensure QDialog::closeEvent accepts the close. The reason for the code in closeEvent seems a bit dubious, but that's left for future adventures. Change-Id: Ic32b965d495c08996c3a199bbee798df0206216c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Decouple quitOnLastWindowClosed from quitLockEnabledTor Arne Vestbø2021-10-184-20/+43
| | | | | | | | | | | | | | | | | | | In a512e210ac5b032c5fc2edf1ddf72e5a414485fda512e21 quitOnLastWindowClosed was changed to be implemented in terms of quitLockEnabled, but without any documentation to that end. Although the two features are similar (automatic quit under certain conditions), and interact, it doesn't make sense to overlap them until we actually expose them as a single property (automaticQuit e.g.) The logic for determining whether we can can quit automatically has been refactored to take both properties into account, on both a Core and Gui level. The call sites still need to check the individual properties to determine whether to activate automatic quit for that particular code path. Change-Id: I38c3e8cb30db373ea73dd45f150e5048c0db2f4d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix indentation in inputMethodQuery implementationsTor Arne Vestbø2021-10-182-4/+4
| | | | | | Change-Id: I406194e084f62f16d432eae63845bcc3da148ac0 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix docs for comparison/debug/data stream operators of Qt containersSona Kurazyan2021-10-188-0/+161
| | | | | | | | | | | | | | Because of the constraints on comparison, debug and data stream operators, the return types for them look weird in docs. Conditionally use the actual return types, in case if Q_CLANG_QDOC is defined. Also add the docs of debug stream operators for types for which they were misssing. Task-number: QTBUG-97247 Pick-to: 6.2 Change-Id: I57f2c52bd3af805c7eeebb602c47de1e95ee09bd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* sqldrivers: Fix typo in error messageJonas Kvinge2021-10-181-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I6354275d04ee9474d4baeaaf0b14a52aca3dd70c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make sure Qt::Popup is treated like a dialogDavid Skoland2021-10-182-3/+2
| | | | | | | | | | | According to the documentation, Qt::Popup should have a proper frame with a title bar. To honor this, two functions had to be slightly altered. Change-Id: I4bbc18e6b7fbec5702fad6e22ef2226c09dea15a Fixes: QTBUG-94768 Pick-to: 5.15 6.2 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Fix cursor positioning on bidi boundariesVolker Hilsheimer2021-10-181-43/+74
| | | | | | | | | | | | | | | | | When the cursor is positioned between to script items that have different writing directions, prioritise the script item that has the same direction as the paragraph (i.e. the QTextEngine) when deciding where and how to display the cursor. If visual cursor movement is enabled, the behavior is unchanged. As a drive-by, clean up coding style and avoid shadowing of function- local variables. Task-number: QTBUG-88529 Pick-to: 6.2 Change-Id: I15227b10b1469d9caf1235b00e4d6f9f64a8b510 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix cursor placement at left and right ends of bidi textVolker Hilsheimer2021-10-181-26/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a text line that has a change of direction at either end of the text, the cursor needs to be positioned where the next character is inserted, or where backspace deletes the previous character. In bidi text, this is ambiguous as illustrated by this example: abcشزذ Depending on whether this string was typed in a left-to-right document or in a right-to-left document, it could be first latin, then arabic; or it could be first arabic, then latin. If a general left-to-right context, cursor position 0 should be in front of the 'a', and cursor position 6 should be at the end of the arabic text, in the visual middle of the line. Cursor position 3 can be either after the 'c' if the next character typed would be latin, or at the visual end of the line if the next character will be arabic. Qt calculated the cursor position past the right end of the text as 3 (which is not wrong, but 3 has two visual positions), and placed the cursor at the visual end of the line (favoring the right-to-left alternative). Backspace would then delete the 'c', writing a new latin character would insert a 'd' next to the 'c', writing a new arabic character would insert it also in the middle - none of these operations happen at the visual end of the line, where the cursor was blinking. To fix this, we take into account the general layout of the text, which is typically based on the document, or the user's locale setting and UI translation, and calculate the cursor position accordingly: if we are past the visual end of the document on either side, then the cursor position is either 0 or the last character of the text, depending on the direction of the QTextEngine used. This way, the cursor ends up in the middle of the document when we click beyond the end of the line, which is where characters are removed and inserted. Typing a 'd' at this point will make the cursor jump to the end, where the d is added. There are still corner cases: clicking on the right-most arabic character calculates the cursor position as 3, which is then ambiguous, as it can be either at the visual end of the string, or next to the 'c'. َQt makes the inconsistent choice to place the cursor at the visual end, showing the left-to-right indicator, but pressing a 'd' adds the 'd' after the 'c' in the middle of the text. Fixes: QTBUG-88529 Pick-to: 6.2 Change-Id: Idccd4c4deead2bce0e858189f9aef414857eb8af Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Q_GLOBAL_STATIC: suppress warning about expressions in noexcept()Thiago Macieira2021-10-181-1/+4
| | | | | | | | | | | | | | We use a simple statement to try and mark the holder as noexcept and that works for most cases (but not all). It triggers a warning when the expression is complex, though, like this in qlocale.cpp: Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate, (new QLocalePrivate(defaultData(), defaultIndex()))) Pick-to: 6.2 Change-Id: Iea05060bc2c046928536fffd16adf4be6126d039 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPlugin: Move the plugin metadata to a note in ELF platformsThiago Macieira2021-10-182-17/+249
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A few systems, like OpenWRT, may strip the section table off the resulting binaries (see [1]), making it impossible for us to pinpoint the exact location of the Qt plugin metadata. This commit moves the meta data to a location that is identifiable even in fully stripped binaries: an ELF note. By naming our section ".note.qt.metadata", we instruct the linker to place it along the other notes and to mark it in the program header section. Another advantage is that the notes are usually in the very beginning of the file, as they are used by the dynamic linker itself, so we'll need to read much less of the full contents. The unit test is modified not to attempt to strip the plugin of debugging data. In fact, we add something to the end that would, otherwise, be matched as (invalid) metadata. The following was produced with GCC 11 and GNU binutils ld 2.36.1. Section Headers: [Nr] Name Type Addr Off Size ES Flags Lk Inf Al [ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 [ 1] .note.gnu.property NOTE 00000000000002a8 000002a8 00000030 0 A 0 0 8 [ 2] .note.gnu.build-id NOTE 00000000000002d8 000002d8 00000024 0 A 0 0 4 [ 3] .note.qt.metadata NOTE 00000000000002fc 000002fc 000001ac 0 A 0 0 4 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align ... NOTE 0x0002a8 0x00000000000002a8 0x00000000000002a8 0x000030 0x000030 R 0x8 NOTE 0x0002d8 0x00000000000002d8 0x00000000000002d8 0x0001d0 0x0001d0 R 0x4 The Qt metadata note is 4-byte aligned and can thus be found in the second note section, which spans from 0x02d8 to 0x02d8+0xac=0x0384. GNU readelf -n can even show it: Displaying notes found in: .note.qt.metadata Owner Data size Description qt-project! 0x0000018f Unknown note type: (0x74510001) description data: 01 06 03 81 bf ...... ff I chose 0x7451 as the prefix for our notes, even though they're already namespaced by the owner in the first place, because eu-readelf mistakenly tries to interpret note 1 as a GNU ABI tag regardless of owner. The owner name was chosen to be 12 bytes long, so the ELF note header is 24 bytes in total. There's no space wasted because the payload needs to be aligned to 32-bit anyway and I didn't want to use only 4 characters (header total size 16 bytes) so we'd skip the "GNU" note on size, without string comparison. And I couldn't think of a 4-character representative string ("QtP" ?). [1] https://github.com/openwrt/video/issues/1 Fixes: QTBUG-96327 Change-Id: I2de1b4dfacd443148279fffd16a3987729346567 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QUtf32: remove set-but-not-used variableThiago Macieira2021-10-181-4/+0
| | | | | | | | | | | Found by clang 13: qstringconverter.cpp:1039:15: warning: variable 'length' set but not used [-Wunused-but-set-variable] Pick-to: 6.2 Change-Id: Iea05060bc2c046928536fffd16adf46d4934c37c Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add comment about the meaning of magic number in QWasmEventTranslatorDavid Skoland2021-10-181-0/+5
| | | | | | | | Without this comment, the button == 0 code is very cryptic. This comment helps in deciphering what exactly is being checked. Change-Id: Ied96118362d097d7036bafcc491b8574e1225de1 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Handle DPR in QPainter's drawing methods taking a brush parameterEirik Aavitsland2021-10-181-35/+31
| | | | | | | | | | | | | | The emulation paint engine is required not only for non-LogicalMode gradient brushes, but also for texture (pixmap/image) brushes with DPR != 1. fillRect(), strokePath() etc. would check for the former case, but not the latter. Fix by factoring out a common checking function. Pick-to: 6.2 5.15 Fixes: QTBUG-89101 Change-Id: I3cddf8a86a321de97b12c85a187069e77d2acea6 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QFontDatabase: suppress warning about its constructor being deprecatedThiago Macieira2021-10-161-1/+1
| | | | | | | | | | qmetatype.h:2263:76: warning: 'QFontDatabase' is deprecated: Call the static functions instead [-Wdeprecated-declarations] ... moc_qfontdatabase.cpp:159:1: note: in instantiation of variable template specialization 'qt_incomplete_metaTypeArray<qt_meta_stringdata_QFontDatabase_t, QtPrivate::TypeAndForceComplete<QFontDatabase, std::integral_constant<bool, true>>>' requested here qfontdatabase.h:113:7: note: 'QFontDatabase' has been explicitly marked deprecated here Change-Id: Iea05060bc2c046928536fffd16adf537be122db2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: remove set-but-unused variablesThiago Macieira2021-10-162-8/+0
| | | | | | | | | Found by clang 13: qlayoutengine.cpp:80:9: warning: variable 'cMax' set but not used [-Wunused-but-set-variable] Change-Id: Iea05060bc2c046928536fffd16adf54d1527e657 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Markdown importer: keep entities in HTML blocks with the HTMLShawn Rutledge2021-10-161-1/+4
| | | | | | | | | | | | If an entity occurs directly in markdown, we parse and insert it directly; but if it occurs in an HTML block, it has to be added to the HTML accumulator string for deferred parsing when the HTML block ends. Pick-to: 6.2 Fixes: QTBUG-91222 Fixes: QTBUG-94245 Change-Id: I0cf586d68d6751892ca035a98f77cd67950d3bc4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Don't require marked text before passing mouse down to input contextTor Arne Vestbø2021-10-161-6/+9
| | | | | | | | | | | | | | | | | There are situations where the input context might want the event, even if there's no marked text, for example when long-pressing A with a US keyboard layout and getting the accent popup. In that case we want a press somewhere else in the input item to move the cursor, and commit the current preedit. This is the same approach as NSTextView has, always calling handleEvent, and in line with the recommendation from Apple: https://lists.apple.com/archives/cocoa-dev/2012/May/msg00539.html Pick-to: 6.2 Change-Id: Iff0861a4e604ab594d1ad4ccbb9367d8e0ffe4ef Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Pass on mouse press if input context didn't handle itTor Arne Vestbø2021-10-161-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We follow the approach of [NSTextView mouseDown:] by bailing out if the input context handled the event, and otherwise passing it along to the input item. This allows moving the cursor with a single click in the input item, which will also commit the current preedit string as is, depending on the input context. For some reason 2-Set Korean input results in plain insertText calls for each step of the composition with an NSTextView, while we get marked text. The result is that when composing with 2-Set Korean, a native NSTextView will only require a single click to move the cursor, while for us it requires two, since the input context says it handled the event. We opt to follow the behavior of NSTextView to bail out if the input context handled the event, instead of trying to emulate the observed behavior for 2-Set Korean by always passing the mouse event on, as the former seems like a safer approach. This is also in line with the recommendations from Apple: https://lists.apple.com/archives/cocoa-dev/2012/May/msg00539.html Pick-to: 6.2 Change-Id: I372ac62ee3b8b20531cd7cfa2d412a5efea3eb68 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add implementation of QCocoaInputContext::commit()Tor Arne Vestbø2021-10-162-0/+28
| | | | | | | | | | Without this we end up treating input method commits from the input items as cancellations, as the base class implementation doesn't do anything. Pick-to: 6.2 Change-Id: Ieeed71404ee32ab51287b2f4f2d70ffcf9d8e7ef Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Only send mouse press to input context if clicking input itemTor Arne Vestbø2021-10-161-2/+13
| | | | | | | | | | | | | | | Our QNSView can represent many controls, not just the current input item, so we need to ensure the click happens inside the input item before we ask the input context to handle the event. This allows clicking controls such as buttons and check boxes while composing complex text, without cancelling or otherwise affecting the composition. Fixes: QTBUG-57347 Pick-to: 6.2 Change-Id: I8449c8d74fd21b1ee1d5bd75f960751b64d7e078 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deduplicate lastWindowClosed handlingTor Arne Vestbø2021-10-168-88/+56
| | | | | | | | | | | | | | | | | | | | | | | Whenever a window was closed, we had logic to check if it was the last window, and if so emitted lastWindowClosed and then tried to quit the application. But the automatic quit process also checked if there were any remaining windows, as this process could be triggered as a result of a QEventLoopLocker going out of scope. The two paths now share the same logic for determining if there are any remaining windows. The docs have been updated to reflect the original intent of the logic, dealing only with primary windows (top levels without a transient parent). This was how both the original code paths implemented their logic. For historical reasons the Qt::WA_QuitOnClose attribute is closely tied to the lastWindowClosed signal, and isn't merely limited to controlling whether we try an automatic quit when the last window closes. For now this behavior has been kept, but the docs have been updated to clarify how the attribute is handled in practice. Change-Id: If3d06b065236aad2e59e9091cac3146bc4cf79f6 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove unused parentWidget variable in QWidgetPrivate::handleCloseTor Arne Vestbø2021-10-161-1/+0
| | | | | | | | | It was a leftover from when the quitOnClose logic was duplicated in the handleClose function. Change-Id: I38903b7e30ef1cf1d0dce87f61097a83259aea8e Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove zlib from bootstrap libraryJoerg Bornemann2021-10-164-28/+2
| | | | | | | | | None of the bootstrapped tools use zlib anymore. Change-Id: I2cd7cb855ed671916a21c23449d9b6c4506f8546 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QList: deprecate iterator<->pointer implicit conversions (3/3)Giuseppe D'Angelo2021-10-161-2/+14
| | | | | | | | | | Follow-up of the previous commit: in case the implicit conversions between iterator and pointers are disabled, then reintroduce the non-template arithmetic operators for the iterator classes. Change-Id: I8cee60fe77ee3a47e189b4b53a08e39408f9db18 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QList: deprecate iterator<->pointer implicit conversions (2/3)Giuseppe D'Angelo2021-10-161-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The constructor from a raw pointer should be 1) constexpr, 2) explicit, and 3) *private*. We can do 1) without too much trouble. 2) is a (easy to fix) SIC in case of implicit conversions accidentally relied upon from somewhere. 3) cannot be "easily" fixed by user code (they have to refactor), and also, it's a BIC on Windows which encodes class members' access in symbols. Someone may have been exporting some QList subclass, in turn exporting the iterator classes, and therefore that someone now has the constructors' symbols with a given access. So, don't do 2+3 _just yet_ for user code, but set a deadline: Qt 6.5 is the last that will support this. On Qt 6.6, we switch. All of this on non-Windows, againt to avoid an ABI break. One can opt-in at any time via a suitable define. Given we have this define, use it to guard the other way around as well: conversions from an iterator to a raw pointer should never be explicit (there's std::to_address for this). [ChangeLog][QtCore][QList] Converting a QList's iterator from and to a raw pointer is deprecated, and will get removed in Qt 6.6. User code can prepare for the change by defining QT_STRICT_QLIST_ITERATORS. Change-Id: I0f34bfa3ac055c02af5a3ca159180304660dfc11 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QList: deprecate iterator<->pointer implicit conversions (1/3)Giuseppe D'Angelo2021-10-161-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | QList<T>::(const_)iterator both feature an implicit operator T*. This operator exists in order to keep compatibility with Qt 5 code, where QVector<T>::iterator _was_ indeed a T*. However, iterators are not proxy objects and should not convert to T* (at least, not implictly). In fact we've already seen compilers complain about ambiguous calls when e.g. moving an iterator through an arithmetic operation (say, operator+). For instance, if one does it + number and the numeric argument of that call is not precisely qsizetype (but, say, int), then the call is ambiguous between operator+(iterator, int promoted to qsizetype) operator+(pointer (converted from iterator), int) One can imagine similar failures in generic code. In short: let's deprecate (not remove) the implicit conversion, and let people use iterators for what they are. Task-number: QTBUG-96128 Change-Id: I008348beefe00e4449b2d95c21c842d676390a26 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mention a change to QDateTimeEdit::setDateTime()Edward Welbourne2021-10-161-1/+13
| | | | | | | | | | | I neglected to record the change in the Qt 6 changes documents that help folk migrate from Qt 5. This is a follow-up to commit 2a653fde48f7312ccd2f792d72d305061b410ae3 Fixes: QTBUG-97493 Pick-to: 6.2 6.2.1 Change-Id: Ie496fdd05759eeeac4c7610db40ab6745b5e0640 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* xcb: Use byte buffer for event masksPovilas Kanapickas2021-10-161-23/+30
| | | | | | | | | | This prepares for use of masks larger than 32 bits which happens on XI 2.4. Additionally, since the XI protocol always sends the masks using little-endian, the XI protocol support on big-endian machines was currently broken. Change-Id: Id22131e075059cea783b5be0691a673a457c7364 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix restoring main window state for maximized/fullscreen windowsVolker Hilsheimer2021-10-164-50/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On systems that asynchronously resize the window to maximized or full screen state, the window will become visible in its normal geometry before it gets the final size by the windowing system. This might cause multiple resize events, to each of which the widget's layout responds with a call to its setGeometry implementation. The QMainWindowLayout is special in that it will shrink dock widgets if there is not enough space for them, but it doesn't grow them back once there is. With the initial resize event being for a smaller size than what was restored, the state is not restored correctly, but remains in the state that fit into the smallest size with which setGeometry got called. To fix this, we have to keep the restored state around until the window either gets a size that is large enough for it to fit, or until we can be reasonably certain that the windowing system is done resizing the window while transitioning it to the maximized or full screen state. Since across the various platforms and windowing systems there is no reliable way to know when the window reaches its final size, we have to use a timer that we (re)start for each call to setGeometry with a size that's not large enough. Once the timer times out, we have to give up; then the last layout state calculated is the final state. To calculate the size of the layout, introduce a function to the QDockAreaLayout that returns the size required for the current sizes of the docks. Refactor sizeHint and minimumSize (which were identical) into a helper template that takes member-function pointers to call the respective method from the dock area layout's content items. Add a test case for various permutations of the scenario. The timeout of 150ms is based on running this test case repeatedly on various desktop platforms and X11 window managers. Fixes: QTBUG-46620 Change-Id: I489675c2c40d3308ac8194aeb4267172b2fb38be Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* widgets: Fix typos in source code commentsJonas Kvinge2021-10-1525-44/+44
| | | | | | Pick-to: 6.2 Change-Id: I22f71a53b0f7f0698450123343e25548c889c3e2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix high DPI position of foreign child windows on WindowsJoerg Bornemann2021-10-151-1/+2
| | | | | | | | | | | | | | | | | | | | Suppose you have a child window that is a foreign window. In the bug report's example it's a QAxWidget that wraps the Windows Media Player. This means, we have a non-top-level QWindow with a platformWindow assigned. If windows:dpiawareness is set to 1 (system-DPI aware) and the window is displayed on a screen with origin != (0, 0), then we called QPlatformWindow::setGeometry with a position in native coordinates. This moved the child window outside of the visible area. Fix this by calling QHighDpi::toNativeWindowGeometry instead of QHighDpi::toNativePixels. The former function takes child windows properly into account. Pick-to: 6.2 Fixes: QTBUG-96114 Change-Id: Ibb0f844b10aece8ede99cb34289c0430ac283fa0 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Clarify QWidget::normalGeometry documentationTor Arne Vestbø2021-10-151-13/+14
| | | | | | | | | | The property reflects the widget's current geometry if it is not in a full screen or maximized state. Pick-to: 6.2 Change-Id: I5816687119500995654a926aef952d788ad74886 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* When filling a pixmap after an assignment ensure the set DPR is not lostAndy Shaw2021-10-151-0/+1
| | | | | | Pick-to: 6.2 5.15 Change-Id: I649547ea277f9d074e6638e4b7b1206d3d3d976b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QOpenSSLBackend: Properly load 3.0 when compiled with 3.0Mårten Nordheim2021-10-151-3/+10
| | | | | | | | | | The naming updated but the version suffix is hardcoded on windows and it was overlooked when work was done to support OpenSSL 3. Fixes: QTBUG-97116 Pick-to: 6.2 5.15 6.2.1 Change-Id: Iec15d772c54ed214940ec5634a0929485478f771 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QList: add mixed comparison operators between (const_)iteratorsGiuseppe D'Angelo2021-10-151-2/+15
| | | | | | | | | | | | | It is currently possible to compare a QList iterator with a const_iterator and viceversa, even though these operations aren't defined, because they are actually routed through the relational operators between iterators and raw pointers after a conversion (!). With the deprecation of iterator->pointer implicit conversions, this is going to break, so add the missig mixed comparison operators. Change-Id: Ic645ab0246f79f64b04334ecd02e9fe8fa46f0fa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* dbus: Fix typosJonas Kvinge2021-10-144-4/+4
| | | | | | Pick-to: 5.15 6.2 Change-Id: I9efce6a3163ca6564d511c994776ff96999909b4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* xcb: Fix typos in source code commentsJonas Kvinge2021-10-146-6/+6
| | | | | Change-Id: I3a91f57d3c47d9e96215d5dc064664626a8f65e7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qwindowsdialoghelpers: Fix typo in documentationJonas Kvinge2021-10-141-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I23e096655f68d64c0c40c02a246582916c2d1743 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Fix typos in SQL driver documentationJonas Kvinge2021-10-141-2/+2
| | | | | | Pick-to: 5.15 6.2 Change-Id: I871f6eff908926485c371121113d4853064f808f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qxcbscreen: Fix typo in documentationJonas Kvinge2021-10-141-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I92f7d707a1395594ad6d1fe841fa77d21ae7c8b1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Markdown writer: indent fence consistent with code blockShawn Rutledge2021-10-141-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Under a list item, we've been indenting code blocks: ``` int main() ... ``` - But it's also ok *not* to indent (and github handles that better): ``` int main() ... ``` - There was a bug that when the code is not indented, the fence would be indented anyway: ``` int main() ... ``` and that was not OK, neither for md4c nor for github. Now with this change, either way is rewritable: you can read markdown into QTextDocument, make small edits and write it back out again, with the indentation being preserved (the code block is either part of the list item, thus indented, or else it's outside the list completely). Pick-to: 6.2 Task-number: QTBUG-92445 Change-Id: I5f51899e28ba9f09b88a71e640d9283416cce171 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Correctly record normalGeometry in Cocoa pluginVolker Hilsheimer2021-10-143-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cocoa sends QWidget the state-change notification after the window has been resized already, at which point we cannot store the normal geometry anymore. Handle zoom and full screen callbacks prior to the state changing to store the geometry in QCocoaWindow. We do not need to handle minimized state, as the window will still reflect the original geometry. Return the stored value from an override of QPlatformWindow::normalGeometry so that QWidget gets the correct values even though the new state is already active. Fix the tst_QWidget::normalGeometry test to make it pass on all platforms by waiting for the window to actually have transitioned to the new state before comparing geometries. Both macOS and Windows fully pass; on Xcb, deminimizing a window using setWindowState does not work, which is why the test was partially skipped (confirmed by visual testing). Move those problematic, complex test cases to the end so that most cases are covered on Xcb as well. Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Pick-to: 6.2 Change-Id: I518a5db9169b80e8fa25fe4fa2b50bd1ea0e6db3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QWidget: Don't rely on topextra to determine if window is top levelTor Arne Vestbø2021-10-141-1/+1
| | | | | | | | | | Doing so results in bailing out early for a widget that hasn't been shown yet, or otherwise resulted in creating extra and topextra, which means the normalGeometry will not reflect the widget's geometry. Pick-to: 6.2 Change-Id: Ieb85e9a6109ae34fe20d79e3c12f4517f827a590 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Tidy up in QGraphicsWidget::resize()Edward Welbourne2021-10-141-37/+28
| | | | | | | | | | | Simplify various conditions. Eliminate duplication from an overly-complex if/else cascade. Move the set-up of a QGraphicsSceneResizeEvent to only happen if it's going to be used. Change-Id: Ie51aa5de5f2bd1603478ae0cda0fd4279334f45a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Eliminate use of goto in QGraphicsWidget::resize()Edward Welbourne2021-10-141-17/+20
| | | | | | | | Get rid of the gotos by packaging the wrap-up code in a QScopeGuard. Thanks to Volker Hilsheimer for suggesting that solution. Change-Id: I71bebf59263ce05f111d1fcfcec93f4635a35428 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>