aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qquickmenubar
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Regenerate projectswip/cmakeAlexandru Croitor2020-03-171-9/+5
| | | | | | Change-Id: Ifd6b2289de6465a010f5f2a32789221767b4d5be Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/cmakeLeander Beernaert2019-11-252-0/+151
|\ | | | | | | Change-Id: I61919fabd4a3a07ed374f2c3c1fae2d589d6e124
| * QQuickMenuBar: let MenuBarItem lose highlight when Menu is dismissedWang Chuan2019-10-242-0/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When adding new MenuBarItem to MenuBar, MenuBar will first check the Menu pointer in MenuBarItem and then connect the Menu's signal [aboutToHide] to MenuBar's slot [onMenuAboutToHide] to unhighlight the MenuBarItem. In case of adding dynamic Menu, this operation will be performed before setting new Menu to MenuBarItem. So the Menu pointer in MenuBarItem is null, and the connection will not be performed. [ChangeLog][Controls][QQuickMenuBar] Fixed issue with dynamically menu bar items not losing their highlight when their menu was dismissed. Fixes: QTBUG-77306 Change-Id: Ibe987462505f65747b4290b3c206e9dfbcbbef57 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Regenerate projects to be in syncAlexandru Croitor2019-11-151-3/+3
| | | | | | | | | | | | Change-Id: I3a57449c9025e22414b8337fcffdeb0f4d769af2 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Convert QtQuickControls2 testsLeander Beernaert2019-10-081-0/+51
|/ | | | | | | | Initial conversion of QtQuickControls2 tests. Change-Id: I7e09e387ec90f89cc2856c7f7f2cb810b03b7fa3 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix Flaky testsDimitrios Apostolou2019-07-221-3/+3
| | | | | | | | | | | | These tests where failing sometimes in our CI, because centerOnScreen() was invoked which asks the window manager to move the window, but does not wait for the event's completion. The solution is to do all that *before* the initial qWaitForWindowActive(). Fixes: QTBUG-73128 Change-Id: I06c1f85d5ff9657dccab50f29084f7624cd7e194 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Revert all Menu delegate patchesv5.12.0-rc2v5.12.0-rc1v5.12.0Mitch Curtis2018-11-152-102/+0
| | | | | | | | | | | | | | | | | | | | | This reverts the following commits: d5cb26bc56a3b6f6e99c88654d4f7a65f43551ac - Menu: ensure the correct delegates are used when created via Component d923dd467c1aeb3e195a09949b04862084002f88 - MenuBar: ensure the correct delegates are used when created via Component d56c193eb4ceb640611d66f22e1f26aae91cd7d1 - QQuickPopupPositioner: avoid adding duplicate item change listeners 567a2de8cd493aabe0055d6dbc367b39447e70dd - Stabilize tst_qquickmenubar 953fbac6131823e4fce0eb4707a854469c4c04ff - Fix Instantiator-created MenuItems disappearing 936d31179d44220571ded15840bedeccb581c83b - tst_qquickmenu: add a test for MenuItems before and after a Repeater fc1832810f6c09505d9413685ed0b2d6295bea4a - QQuickMenuBar: fix menu not opening The fix for QTBUG-67559 has caused lots of issues, with the latest being a crash right before the 5.12 release. The bug that they fix is a P2, so it's not worth the hassle. The patches might be able to be resubmitted to dev after the crash is fixed. Change-Id: Ic192c7a302176bcdb2503b636b3462b10898a2ba Fixes: QTBUG-71770 Reviewed-by: J-P Nurmi <jpnurmi@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickMenuBar: fix menu not openingMitch Curtis2018-11-091-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a Menu is declared within a MenuBar, a MenuBarItem has to be created for it. Creation takes the following steps: - 1 Begin creation of the item - 1.1 Set the parent of the MenuBarItem to the MenuBar - 2 Set the menu on the item - 3 Complete creation of the item - 4 Add the item When setting the parent of the MenuBarItem, the following call stack can be observed: 1 QQuickContainer::itemChange qquickcontainer.cpp 757 0x7fff6e5f4544 2 QQuickItemPrivate::itemChange qquickitem.cpp 6213 0x7fff6aa226f7 3 QQuickItemPrivate::addChild qquickitem.cpp 2964 0x7fff6aa1e663 4 QQuickItem::setParentItem qquickitem.cpp 2753 0x7fff6aa0f57c 5 QQuickMenuBarPrivate::beginCreateItem qquickmenubar.cpp 100 0x7fff6e627c08 6 QQuickMenuBarPrivate::createItem qquickmenubar.cpp 115 0x7fff6e627c98 7 QQuickMenuBarPrivate::contentData_append qquickmenubar.cpp 263 0x7fff6e6285d9 In particular, the following function is called: void QQuickContainer::itemChange(ItemChange change, const ItemChangeData &data) { Q_D(QQuickContainer); QQuickControl::itemChange(change, data); if (change == QQuickItem::ItemChildAddedChange && isComponentComplete() && data.item != d->background && data.item != d->contentItem) { if (!QQuickItemPrivate::get(data.item)->isTransparentForPositioner() && d->contentModel->indexOf(data.item, nullptr) == -1) addItem(data.item); } } This check is for items that are added after component completion of the control (QQuickMenuBar), as there is a isComponentComplete() check. Before d923dd46, QQuickMenuBarItems were constructed the moment their QQuickMenus were appended to QQuickMenuBar's contentData, which was before component completion. This meant that the isComponentComplete() check above failed as expected and the item was instead added after its creation process was completed (step #4 in the list above): void QQuickMenuBarPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj) { QQuickMenuBar *menuBar = static_cast<QQuickMenuBar *>(prop->object); if (QQuickMenu *menu = qobject_cast<QQuickMenu *>(obj)) obj = QQuickMenuBarPrivate::get(menuBar)->createItem(menu); QQuickContainerPrivate::contentData_append(prop, obj); // leads to addItem() being called } Part of the process of an item being added to QQuickMenuBar involves connecting to the signals of its corresponding QQuickMenu (if it has a menu). Quoting the code from QQuickMenuBar::itemAdded(): if (QQuickMenu *menu = menuBarItem->menu()) QObjectPrivate::connect(menu, &QQuickPopup::aboutToHide, d, &QQuickMenuBarPrivate::onMenuAboutToHide); After d923dd46, QQuickMenuBarItems are now constructed *after* component completion to ensure that delegates declared outside of the menu bar have been completed. This means that the isComponentComplete() check in QQuickContainer::itemChange() no longer fails and the item is added before its QQuickMenu is set on it (step #2). As a result, it never connects to the QQuickPopup::aboutToHide() signal and hence it stays activated/highlighted even after the menu has been dismissed, which results in having to click twice on the QQuickMenuBarItem to open the menu the next time. This patch fixes the issue by simply setting the menu on the item before setting its parent: - 1 Begin creation of the item - 1.1 Set the menu on the item - 1.2 Set the parent of the MenuBarItem to the MenuBar - 2 Complete creation of the item - 3 Add the item This ensures that the item has a menu and the connection is made. Change-Id: I93edf7e5a8616a851595ce28ed43f0348078f0b5 Fixes: QTBUG-71583 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Tie minor version of all imports to Qt's minor versionMitch Curtis2018-11-023-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes all Qt Quick Controls 2 imports match the current Qt minor version, which is 12 as of this patch. It also updates all other Qt Quick imports to match. This will also make future version bumps easier as all version numbers in existing code/docs will match. The following commands were used to verify that no old versions remain: for i in `seq 0 11`; do git grep "import QtGraphicalEffects.*1.$i$"; done for i in `seq 0 11`; do git grep "import QtQuick 2.$i$"; done for i in `seq 0 11`; do git grep "import QtQuick.Layouts 1.$i$"; done for i in `seq 0 5`; do git grep "import QtQuick.Controls.*2.$i$"; done for i in `seq 0 11`; do git grep "import QtQuick.Templates 2.$i as T$"; done [ChangeLog] From Qt 5.12 onwards, all import versions in Qt Quick Controls 2 follow the same minor version as Qt's minor version number. For example, the import version for Qt 5.12 is: "import QtQuick.Controls 2.12". Change-Id: I6d87573f20912e041d9c3b7c773cc7bf7b152ec3 Fixes: QTBUG-71095 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12v5.12.0-beta3Liang Qi2018-10-152-0/+106
|\ | | | | | | | | | | | | | | | | Conflicts: src/quicktemplates2/qquickmenubar.cpp src/quicktemplates2/qquickmenubar_p.h src/quicktemplates2/qquickmenubar_p_p.h Change-Id: I5c2115f05826f68f1b1f5ce6762273cd91e6997e
| * MenuBar: ensure the correct delegates are used when created via ComponentMitch Curtis2018-10-022-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | Don't add items until we're complete, as the delegate could change in the meantime. Instead, add them to contentData and create them when we're complete. A similar fix was already done for Menu in d5cb26bc. Task-number: QTBUG-67559 Change-Id: Idb43b7a69fcf1c1ad6396c73a3c090b92e460ab8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Stabilize tst_qquickmenubarMitch Curtis2018-10-151-0/+8
|/ | | | | | | | | | Something about postponing delegate creation to component completion means that the fileMenuBarItem->isHighlighted() check fails occasionally. Give it a chance to sort itself out before sending move events. Change-Id: I140ec835b5cb4ec7d784215a20567469ad422c5b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Menu: ensure the correct delegates are used when created via ComponentMitch Curtis2018-09-052-0/+7
| | | | | | | | | | Don't add items until we're complete, as the delegate could change in the meantime. Instead, add them to contentData and create them when we're complete. Task-number: QTBUG-67559 Change-Id: I5f42129f49de861ff5f15d0069daeda0b4e5017c Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Bump QtQuick 2.9 imports to 2.10Mitch Curtis2017-09-062-2/+2
| | | | | Change-Id: I274146911cd8a204fcbf439da9259b0a38c8092e Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Fix tests for boot2qtSami Nurmenniemi2017-08-221-0/+4
| | | | | | | | | | | | | | The tests for boot2qt were disabled with commit 28063805bf22b77a93f22a4289ca8afa9f1cb201. The tests can be enabled since qtdeclarative now fallbacks to software renderer if OpenGL is not supported. Some tests involving mouse behavior and window grabbing need to be skipped on minimal/offscreen platforms. Task-number: QTBUG-60268 Change-Id: Ib468638df8d5001bf127dd17aee7dcfe38b11780 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix failing tests in tst_menu and tst_qquickmenubarMitch Curtis2017-08-092-5/+3
| | | | | | | | | | | | | | | As mentioned in the bug report for the failing tst_qquickmenubar test, the window is sometimes opened at the bottom right corner of the screen on the Ubuntu CI machines. However, even after centering the window on the screen, the old setPos() call still caused the tests to fail. So, we position the cursor past a different corner of the window, which works.. though I don't know why. Task-number: QTBUG-62363 Task-number: QTBUG-62383 Change-Id: I3649230002eaac5a6391daff24427e6f9f58cfa5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Blacklist qquickmenubar::mouse on Ubuntu 16.04 CI machinesMitch Curtis2017-08-071-0/+5
| | | | | | | Task-number: QTBUG-62363 Change-Id: I325b567ed32d6d584d31466fa67479b253ca5a66 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce MenuBarJ-P Nurmi2017-07-264-0/+736
MenuBar is an ordinary Item. It can be located basically anywhere, but the idea is to introduce a new ApplicationWindow::menuBar property in a follow-up commit. Currently the example snippets are using the header property. [ChangeLog][Controls][MenuBar] Introduced a MenuBar control. Task-number: QTBUG-60350 Change-Id: Ie66dc457a3d8edbe8362fab2a591dc49442c95e2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>