summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
Commit message (Collapse)AuthorAgeFilesLines
* Make QFontDatabase member functions staticEskil Abrahamsen Blomfeldt2020-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | QFontDatabase is a singleton and all instances would share a single, mutex-protected global data pointer. But some functions were implemented as non-static functions. This caused a lot of code on the form QFontDatabase().families(...) since there was no static access. Other functions were implemented as static. To consolidate, we make all functions static. This should be source-compatible, but not binary compatible. [ChangeLog][QtGui][Fonts] Some functions in QFontDatabase were in principle static, but previously not implemented as such. All member functions have now been made static, so that constructing objects of QFontDatabase is no longer necessary to access certain functionality. Fixes: QTBUG-83284 Change-Id: Ifd8c15016281c71f631b53387402c942cd9c43f6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Add missing enumeration case in tst_QMacStyle::setSizeTor Arne Vestbø2020-07-291-0/+2
| | | | | Change-Id: Iade36b03c6f8bdaa8feb82ef89744a399f92e21d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix misplaced nullptr, used for a flag valueEdward Welbourne2020-07-271-1/+1
| | | | | | Task-number: QTBUG-85700 Change-Id: I34b1aa8430842d96eb515d709b49de4e60976ac9 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix warnings about unused variables and functions in testsTor Arne Vestbø2020-07-263-12/+3
| | | | | Change-Id: Ia758a91384083c13fb4d743f500fef7a6629dfd5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QGraphicsSceneIndex::clear: Don't assume only one repaintTor Arne Vestbø2020-07-231-1/+1
| | | | | | Change-Id: I037b51ebad525ced536945b2c39b0f59280e6bad Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qnsview: don't active QWindows inside NSWindows that are not keyRichard Moe Gustavsen2020-07-222-0/+31
| | | | | | | | | | | | A QWindow should only become Active when it's inside an NSWindow that is Key. If the NSWindow is not key, we need to wait for it to be so, and handle window activation from QCocoaWindow::windowDidBecomeKey() instead. Otherwise Qt will report a QWindow as Active when, in reality, it is not. Change-Id: Ib7e63b374f26af527a668c7f7d863c4168a4446d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QTestlib: Enable comparing QList against initializer lists/arraysFriedemann Kleint2020-07-212-43/+41
| | | | | | | | | | | | | | | | | | | | | It is unnecessary to create a QList container just for comparison. Split out helpers for comparing sequence sizes and sequences from qCompare(QList) and add a template for an array with a non-type template parameter for the size. One can then write something like: const int expected[] = {10, 12,...}; QCOMPARE(QFontDatabase.pointSizes(...), expected) Unfortunately, any commas in such an array will be misread by macro expansion as macro argument separators, so any expected array with more than one entry needs an extra macro expanding __VA_ARGS__. Change-Id: Ie7c8dc20bf669bbb25f6d7f8562455f8d03968c8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Ensure styles always get to polish the application paletteTor Arne Vestbø2020-07-212-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before 0a93db4d82c051164923a10e4382b12de9049b45 we would polish the application palette even when it was the default palette, as we always recreated the system palette each time a style was set. After the change we skipped polishing the palette unless it was set by the user, under the assumption that the style would set its own default palette if it wanted to override the system palette. This turned out to break the style's ability to slightly tweak the palette via polish (versus the more full on standardPalette approach). We now polish both the default palette and user palettes, and we do so as part of the normal palette update logic. This ensures that the style also gets a chance to polish the palette when the platform theme changes. The polish will not have an effect on the resolve mask of the palette, as the polish is conceptually the same as a base palette, and should not affect e.g. Qt::AA_SetPalette. Fixes: QTBUG-85469 Fixes: QTBUG-85188 Pick-to: 5.15 Change-Id: I869e9c442b177de4f1dc49eb75220709306f4d12 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Change QWindow/QWidget::map(To/From)(Global/Parent) to operate in floatFriedemann Kleint2020-07-141-0/+4
| | | | | | | | | | | | | | | Change the functions to operate in float and add the QPoint versions as overload calling them. This is more in-line with the event accessors using float and allows for removing some workarounds using a delta when converting touch points. Leave QPlatformWindow::map(To/From)Global() as is for now and add helpers for float. Change-Id: I2d46b8dbda8adff26539e358074b55073dc80b6f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QVariant::setValue(): enable move semanticsGiuseppe D'Angelo2020-07-131-4/+4
| | | | | | | | | | | | Given we optimize for the case where the new value is of the same type of the one already stored in the variant, enable move assignment for that case. As a drive-by, avoid a path to detach() for data() if we know we're detached. Change-Id: I9abbdc10637ce77ebb747b49d83e1ef914d997bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Refactor pointer event hierarchyShawn Rutledge2020-07-104-97/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some goals that have hopefully been achieved are: - make QPointerEvent and QEventPoint resemble their Qt Quick counterparts to such an extent that we can remove those wrappers and go back to delivering the original events in Qt Quick - make QEventPoint much smaller than QTouchEvent::TouchPoint, with no pimpl - remove most public setters - reduce the usage of complex constructors that take many arguments - don't repeat ourselves: move accessors and storage upwards rather than having redundant ones in subclasses - standardize the set of accessors in QPointerEvent - maintain source compatibility as much as possible: do not require modifying event-handling code in any QWidget subclass To avoid public setters we now introduce a few QMutable* subclasses. This is a bit like the Builder pattern except that it doesn't involve constructing a separate disposable object: the main event type can be cast to the mutable type at any time to enable modifications, iff the code is linked with gui-private. Therefore event classes can have less-"complete" constructors, because internal Qt code can use setters the same way it could use the ones in QTouchEvent before; and the event classes don't need many friends. Even some read-accessors can be kept private unless we are sure we want to expose them. Task-number: QTBUG-46266 Fixes: QTBUG-72173 Change-Id: I740e4e40165b7bc41223d38b200bbc2b403e07b6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Tests: Use QVERIFY instead of QCOMPARE for empty listsFriedemann Kleint2020-07-101-4/+4
| | | | | | Pick-to: 5.15 Change-Id: I4da02fa11583eca3844bf42efcdf818b8bbd6a94 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Qt::Modifier: do some cleanupsGiuseppe D'Angelo2020-07-091-5/+5
| | | | | | | | | | | | | | | | | | Qt::UNICODE_ACCEL had no effect since at least Qt 4.0. We can drop it in Qt 6. The whole Qt::Modifier enumeration is still widely used, so we can't drop it yet, but we should aim at doing so in Qt 7. Add a note. [ChangeLog][QtCore][Qt::Modifier] The Qt::UNICODE_ACCEL enumerator has been removed. It had no effect since Qt 4.0. [ChangeLog][QtCore][Qt::Modifier] Usage of the enumerators in the Qt::Modifier enumeration is discouraged. The enumeration will likely get removed in the next major version of Qt. Change-Id: If25f30d920878d32903b91a38044f5da042c7eab Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Regenerate subdir test projectsAlexandru Croitor2020-07-094-10/+13
| | | | | | | | And generate a few more test projects that were missing. Change-Id: I5df51106549aa5ae09bc3c42360e14b143719547 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Regenerate tests with new qt_ prefixed APIsAlexandru Croitor2020-07-09125-152/+152
| | | | | | | | Use pro2cmake with '--api-version 2' to force regenerate projects to use the new prefixed qt_foo APIs. Change-Id: I055c4837860319e93aaa6b09d646dda4fc2a4069 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-076-16/+16
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use QList instead of QVector in other qtbase testsJarek Kobus2020-07-071-1/+1
| | | | | | Task-number: QTBUG-84469 Change-Id: Ie0455c890c048c52eacad1badd6d21df999badf9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use qsizetype in QListLars Knoll2020-07-063-15/+15
| | | | | | | | | | | | | | | | | | | | The change creates a slight source incompatibility. The main things to take care of are * code using printf statements on list.size(). Using qsizetype in printf statements will always require a cast to work on both 32 and 64 bit. * A few places where overloads now get ambiguous. One example is QRandomGenerator::bounded() that has overloads for int, uint and double, but not int64. * Streaming list.size() to a QDataStream will change the format depending on the architecture. [ChangeLog][QtCore][QList] QList now uses qsizetype to index into elements. Change-Id: Iaff562a4d072b97f458417b670f95971bd47cbc6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Avoid use of Q_UNUSED by eliminating the parameter namesLars Schmertmann2020-07-031-4/+3
| | | | | | | | | This change only happens to files touched by the commit to add missing ; to Q_UNUSED. Task-number: QTBUG-82978 Change-Id: I10e6993a2bb3952cf9a262708b8573550e0dbe63 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QTabBar: make sure the tab is repainted after releasing mouseWang Chuan2020-07-021-0/+38
| | | | | | | | | | | | | | The tab has to be repainted even f the mouse release event happened outside the tab bar, otherwise it will look like the tab is still pressed. As a drive-by, replace the repaint() call with update(); there is no need for synchronous painting in an event handler. Pick-to: 5.15 Fixes: QTBUG-81637 Change-Id: Ia55182be906511ac3b462f00add8a621c6c05fc3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix delivery of MouseMove events to newly opened popup windowsVolker Hilsheimer2020-07-011-0/+186
| | | | | | | | | | | | | | | | | | | | | | | | Amend d934fd7f54eae24ea3f719890e2c4dbbc445049d, which was too naive in assuming that any change to the popup stack while a popup had been pressed into should result in mouse move events to be delivered without buttons. Instead, add a new flag that is set explicitly when the qt_popup_down widget is closed, and remove buttons from the move move events only when that flag is set. Add the sorely missing test case as well, even if we have to accept that not all behavior can be tested reliably. Ie. on macOS, the simulated mouse event differs from the event we do get from the QPA plugin or the system; on Xcb, some of the behavior depends on the window manager. This is something we could try to clean up for Qt 6. Change-Id: Ibf0a0a6fb7d401915057365788947e5a35aa20c3 Fixes: QTBUG-84926 Task-number: QTBUG-82538 Pick-to: 5.15 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Liang Qi <liang.qi@qt.io>
* QFileDialog: remove deprecated mode QFileDialog::DirectoryOnlyChristian Ehrlicher2020-06-262-11/+1
| | | | | Change-Id: Ia06e80c1bbed3e5bb80793aebd0a4780eb81a36b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use QList instead of QVector in widgets testsJarek Kobus2020-06-2528-287/+270
| | | | | | Task-number: QTBUG-84469 Change-Id: I490fdb237afad2d8a15954fe34d6b549a83fa4aa Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Skip proxy widgets that can't take focus when (back)tabbingVolker Hilsheimer2020-06-251-0/+46
| | | | | | | | | | | | | | Fixes regression introduced in b4981f9d4ca914c6ecaa49bfdd69e51806a3671a, due to which it was possible to back-tab into a widget even though it or its focusProxy had a NoFocus policy. As a drive-by, split the complicated if-statement up a bit for improved readability. Change-Id: Ib0ac2604076e812e340b11534c23ae8ae958d082 Fixes: QTBUG-76924 Pick-to: 5.15 5.12 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Remove deprecated QStyleOption::init()Christian Ehrlicher2020-06-214-12/+12
| | | | | | | | Even it was not marked as deprecated the replacement function initFrom() is available since Qt4 times (and init() is deprecated since then) Change-Id: I09a4ebbf66b01fbe7aec67691dc68d2e42d1cd78 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-4/+4
| | | | | | | | | | | | | | | | | There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Introduce QInputDevice hierarchy; replace QTouchDeviceShawn Rutledge2020-06-167-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have seen during the Qt 5 series that QMouseEvent::source() does not provide enough information: if it is synthesized, it could have come from any device for which mouse events are synthesized, not only from a touchscreen. By providing in every QInputEvent as complete information about the actual source device as possible, we will enable very fine-tuned behavior in the object that handles each event. Further, we would like to support multiple keyboards, pointing devices, and named groups of devices that are known as "seats" in Wayland. In Qt 5, QPA plugins registered each touchscreen as it was discovered. Now we extend this pattern to all input devices. This new requirement can be implemented gradually; for now, if a QTWSI input event is received wtihout a device pointer, a default "core" device will be created on-the-fly, and a warning emitted. In Qt 5, QTouchEvent::TouchPoint::id() was forced to be unique even when multiple devices were in use simultaneously. Now that each event identifies the device it came from, this hack is no longer needed. A stub of the new QPointerEvent is added; it will be developed further in subsequent patches. [ChangeLog][QtGui][QInputEvent] Every QInputEvent now carries a pointer to an instance of QInputDevice, or the subclass QPointingDevice in case of mouse, touch and tablet events. Each platform plugin is expected to create the device instances, register them, and provide valid pointers with all input events. If this is not done, warnings are emitted and default devices are created as necessary. When the device has accurate information, it provides the opportunity to fine-tune behavior depending on device type and capabilities: for example if a QMouseEvent is synthesized from a touchscreen, the recipient can see which touchscreen it came from. Each device also has a seatName to distinguish users on multi-user windowing systems. Touchpoint IDs are no longer unique on their own, but the combination of ID and device is. Fixes: QTBUG-46412 Fixes: QTBUG-72167 Task-number: QTBUG-69433 Task-number: QTBUG-52430 Change-Id: I933fb2b86182efa722037b7a33e404c5daf5292a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix breakage of QPushButton on macOS when a style sheet was setVolker Hilsheimer2020-06-111-0/+41
| | | | | | | | | | | | | | | | | | | | | Amends comment 6e1d70ae12baae4610356ec7b69635ad75a97b4e, which introduced SE_PushButtonBevel so that QPushButton could ignore clicks outside of the button's bevel. In the macOS style, make sure that the framerect we pass to NSButton::alignmentRectForFrame is the rect we receive from QPushButton in the style options. The frame property of the shared NSButton* object might not be initialized. In the style sheet style, handle SE_PushButtonBevel the same ways as Contents and FocusRect, as it is not a separately styleable property. Change-Id: I12eb1b046c864a02b34d276e6352e2e16d44231e Fixes: QTBUG-84852 Fixes: QTBUG-84879 Task-number: QTBUG-81452 Pick-to: 5.15 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Phase 2 of removing QDesktopWidgetVolker Hilsheimer2020-06-0810-13/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove QDestopWidget public header, simplify the implementation that maintains a Qt::Desktop type QWidget for each QScreen, and turn QWidget's initial target screen into a QScreen pointer. QApplication::desktop() now takes an optional QScreen pointer, and returns a QWidget pointer, so that applications and widgets can get access to the root widget for a specific screen without having to resort to private APIs. QDesktopWidgetPrivate implementations to look up a screen for an index, widget, or point are now all inline functions that thinly wrap QGuiApplication::screens/screenAt calls. We should consider adding those as convenience APIs to QScreen instead. Note that QWidget::screen is assumed to return a valid pointer; there is code that handles the case that it returns nullptr (but also code that trusts that it never is nullptr), so this needs to be defined, verified with tests, and asserted. We can then simplify the code further. Change-Id: Ifc89be65a0dce265b6729feaf54121c35137cb94 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Replace calls to deprecated QEvent accessor functionsShawn Rutledge2020-06-082-4/+4
| | | | | | | Many of these were generated by clazy using the new qevent-accessors check. Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove winrtOliver Wolff2020-06-0678-533/+103
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix to crash in QWindow::event when delete this called on closeEventMiika Pernu2020-06-041-0/+19
| | | | | | | | | | | | | Starting from Qt 5.11 QWindow::event is called after QDialog::closeEvent which would cause a crash if "delete this" was called on closeEvent. The commit that changed this was e0b5ff4ad583befbecbcbe462998e3ed80899531. Added a check before QWindow::event call utilizing QPointer to prevent the function call in case object is destroyed by a user in close event handler. Change-Id: I64a4a0f3271714e55bf7e806177f0d8b39b67fa3 Fixes: QTBUG-84222 Pick-to: 5.15 5.12 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove the deprecated QDirModelVolker Hilsheimer2020-06-0416-873/+0
| | | | | | | | | QFileSystemModel is the documented replacement. It uses threads to populate the model, which QDirModel doesn't. Change-Id: I7818ecd8f849eb566ac176612f382e17a0471c47 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* BLACKLIST QWidget tests for CentOSHeikki Halmet2020-05-251-0/+2
| | | | | | | | | Tests focusProxyAndInputMethods and multipleToplevelFocusCheck will be blacklisted Task-number: QTBUG-84259 Change-Id: I7d5baf1e700192eed3c7c8dcfe671e247f11b8c7 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* Reduce QDesktopWidget API to bare minimumVolker Hilsheimer2020-05-155-202/+0
| | | | | | | | | | | | | | | | | The class is documented as obsolete, and the majority of APIs is marked as deprecated. In this first phase, remove all explicitly deprecated APIs and trivial implementations. The test case is complete removed; what's left when code that uses any of those deprecated methods is removed is not testing anything meaningful. For some methods, there is no practical replacement using QScreen yet, and QDesktopWidget is still used in QWidget internals. Those require refactoring to only use QScreen before the rest can be removed. Change-Id: I8f7c968ec566820077221d37b817843758d51d49 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Deprecate QGuiApplication::paletteChanged() signalAndy Shaw2020-05-151-0/+35
| | | | | | | | | | | | | | Rather than have a paletteChanged() signal which can be connected to for tracking when the application palette has changed, then it is better to use the event that is sent to all windows and the application itself. That way it is easy for a window/widget or item that cares about the change to the application font to catch it in the event() function. [ChangeLog][QtGui][QGuiApplication] Deprecated paletteChanged() signal in favor of QEvent::ApplicationPaletteChanged. Change-Id: I95da211e30590e357007cc14d8ee266baceba7b3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QBasicDrag: Send QDragMoveEvent when modifiers changeAlexander Volkov2020-05-141-3/+24
| | | | | | | | | | | ... without moving the mouse. This allows to update drop action and cursor. Task-number: QTBUG-56218 Task-number: QTBUG-82934 Pick-to: 5.15 Change-Id: I8b0ac2a008a9dbcc4c2d6abce282e6f169c2f542 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QApplication: refactor delivery and propagation of wheel eventsVolker Hilsheimer2020-05-131-18/+55
| | | | | | | | | | | | | | | | | | | | | | | | Handle wheel grabbing via wheel_widget in a single place, and propagate events in the same way for all (spontaneous) events. Handle ScrollMomentum the same way as ScrollUpdate to allow partial sequences. Fix the incorrect ignoring of wheel events by default; like all other input events, they are now again accepted by default and ignored in the default event handler implementation of QWidget. This way, implementing the handle suffices to accept the event. Note that QWidget::wheelEvent doesn't need to be changed, as the event is ignored there today (an oversight of the change made in f253f4c3, perhaps). This also fixes changing of direction of a wheel event while the event sequence is grabbed by a widget. Change-Id: Ia0f03c14dede80322d690ca50d085898a0497dbe Fixes: QTBUG-67032 Task-number: QTBUG-79102 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tst_QShortcut: avoid int -> QChar conversionsMarc Mutz2020-05-121-10/+10
| | | | | | | They're being made explicit/deprecated/removed. Change-Id: I2d849d85e51c58b1f837c6795f3d45371f773a92 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make qtbase compile without QT_CONFIG(timezone)Andrei Golubev2020-05-112-0/+16
| | | | | | | | Fixes: QTBUG-83795 Pick-to: 5.15 Change-Id: I05eaaf57d87a9111d3609ebab81bc707f8af98f0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QGraphicsAnchorLayout: port to QHVContainer [4/4]: sweep Orientation -> ↵Marc Mutz2020-05-091-5/+1
| | | | | | | | | | Qt::Orientation This part of the patch changes all remaining occurrences of the local versions of Orientation to Qt::Orientation. Change-Id: Ic9ec19b8f069f614061f319abd30841e10cdd626 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QComboBox: Remove deprecated auto-completion propertiesVolker Hilsheimer2020-05-061-18/+0
| | | | | | | | | | | | The replacement is to set, and configure, a QCompleter directly via setCompleter. With the removal of the separate properties in QComboBox, the configuration of the completer is not maintained if the line edit is replaced. A QCompleter is created and set implicitly when the line edit is set, unless the line edit came with a completer. This is what the auto test verifies as well. Change-Id: I9a4c73db5e39a2558aad346c0904be6deb4f1cd2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Don't move focus away from previous proxy in QWidget::setFocusProxyVolker Hilsheimer2020-05-051-7/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | This amends 23b998fa454ca021aa595f66d2e1964da4a119a4, and the commits 3e7463411e549100eee7abe2a8fae16fd965f8f6 and 947883141d9d8b3079a8a21981ad8a5ce3c4798e. This change restores the pre-5.13.1 behavior of setFocusProxy to not move focus away from a previously set focus proxy. With the previous changes, focus would move away from a proxy when a new proxy is set, if the old proxy had focus. While there are arguments in favor of this behavior, it is a change of behavior that shouldn't be introduced to 20+ years old functionality in order to fix the real bugs addressed by the initial commits. Instead, move focus only to the new proxy when the focus widget was the widget that gets a focus proxy. [ChangeLog][QtWidgets][QWidget] setFocusProxy no longer moves focus away from a previously set focus proxy, restoring pre-Qt 5.13.1 behavior. Change-Id: Icf2ad7cba5b860014aeef91cb274c442a2ab9d42 Fixes: QTBUG-83720 Pick-to: 5.15 Reviewed-by: David Faure <david.faure@kdab.com>
* tst_QDialogButtonBox: Port away from QAbstractButton::animateClick()Friedemann Kleint2020-04-291-40/+38
| | | | | | | | | | Use QAbstractButton::click(). Refactor and polish the tests to use QTRY_VERIFY() instead of qWait(), speeding them up. Pick-to: 5.15 Task-number: QTBUG-81845 Change-Id: I119bede8143ec1db5f5250517dee38b576d5a8d2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove deprecated QComboBox::SizeAdjustPolicy enum valueVolker Hilsheimer2020-04-271-12/+1
| | | | | Change-Id: Ia8ae2eb11b86bc615e1297d7fabd1afcb821557c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QApplication: deliver all wheel events to widget that accepts the firstVolker Hilsheimer2020-04-251-0/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For kinetic wheel events, Qt tries to make sure that all events in the stream go to the widget that accepted the first wheel event. It did so by directing all events from the stream to the widget from which the spontaneous event was returned as accepted. However, that widget might have passed the event on to some other widgets; e.g QScrollArea forwards wheel events from the viewport to the relevant scroll bar. The event might then have come back accepted only because parent propagation kicked in (the scrollbar might not accept the event, so the parents get a chance, and some parent's scrollbar ultimately accepts the event). In this scenario, the wheel widget would be the viewport under the mouse, when it should have been the scrollbar of the parent. The next events from the stream were then delivered to a widget that didn't scroll; and parent propagation is not (and should not be) implemented for the case where Qt has a wheel widget. Instead, make the first widget that accepts any initial wheel event the wheel widget, even if the event was not spontaneous. With this change, all events from the stream are delivered to the widget that actually handled the event. That has the effect that ie. a viewport of a scroll area only gets the first event; all following events are delivered directly to the scrollbar. The test case added simulates the different scenarios - nesting of scroll areas, classic wheel events and a stream of kinetic wheel events. [ChangeLog][QtWidgets][QApplication] Wheel events from a device that creates an event stream are correctly delivered to the widget that accepts the first wheel event in the stream. Change-Id: I5ebfc7789b5c32ebc8d881686f450fa05ec92cfe Fixes: QTBUG-79102 Pick-to: 5.15 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Don't send QEvent::Hide to an already hidden top level widgetVolker Hilsheimer2020-04-241-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | When hiding a popup by clicking outside of its area, a window is closed. Depending on the platform specific implementation details, this can result in multiple calls to QWidgetPrivate::setVisible(false). The first one from the handling of the close event in QWidgetWindow::event; the second from the destruction of the window in QWindow::event. Since the first call already sets the Qt::WA_WState_Hidden flag before calling QWidgetPrivate::hide_helper, we can test if the flag is set and skip the second call if it is. The included test does not reproduce the issue, as that issue only reproduces if the close event is generated by the mouse event handling in the Cocoa platform plugin (which doesn't call QWidget::close, but rather sends a native close event to the platform window). However, it verifies that the fix doesn't introduce any regressions. Change-Id: Id0eda9326a8adf0cc1f6a3840f9ac0b635ab39a1 Fixes: QTBUG-79134 Pick-to: 5.15 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove deprecated ApplicationAttribute enum valuesVolker Hilsheimer2020-04-241-12/+11
| | | | | | | | In the declaration, leave them in as comments so that the gaps in the numbering of the values doesn't create confusion. Change-Id: I92ff299416896c471e7c7d80b988cd4642b6b756 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Deprecate QGuiApplication::fontChanged() signalAndy Shaw2020-04-241-8/+42
| | | | | | | | | | | | | | Rather than have a fontChanged() signal which can be connected to for tracking when the application font has changed, then it is better to use the event that is sent to all windows and the application itself. That way it is easy for a window/widget or item that cares about the change to the application font to catch it in the event() function. [ChangeLog][QtGui][QGuiApplication] Deprecated fontChanged() signal in favor of QEvent::ApplicationFontChanged. Change-Id: Iae8e832238fc85e385a52305bc04f16e597454b0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QWidget: fix regression when changing focus proxy while it has focusVolker Hilsheimer2020-04-231-0/+94
| | | | | | | | | | | | | | | | | | | | | | | This follows up on commits 3e7463411e549100eee7abe2a8fae16fd965f8f6 and 947883141d9d8b3079a8a21981ad8a5ce3c4798e. The changing of the pointer of QApplicationPrivate does not transfer focus properly. It updates the pointer, but it doesn't deliver events or update the widget hierarchy's focus chain. The result is that multiple line edits might show a blinking cursor. Instead, use QWidget::setFocus when the focus proxy has changed while it had focus, and pass OtherFocusReason rather than NoFocusReason. Add a basic test for QWidget::focusProxy, which exercises this code path and verifies that pointers are consistent when focus changes as a side effect of modifying the focusProxy. Change-Id: I15a4d868bab2b590cfe4a1daa6a3c8cebc9c9ca2 Fixes: QTBUG-83720 Fixes: QTBUG-79707 Pick-to: 5.15 Reviewed-by: David Faure <david.faure@kdab.com>