aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickmenu_p_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Follow up on change of QQmlListProperty to qsizetypeVolker Hilsheimer2020-11-111-3/+3
| | | | | | | | | | | | | This deals with d7008c79d4ec023527ebfc118ad47f40075f244d in qtdeclarative which aligned QQmlListProperty with our container types. Note: not changing the respective APIs of the QQuick classes in this change. Ie. QQuickPlatformMenu::insertItem still operates on int as index, and QQuickMenuPrivate still stores currentIndex as int. This might need to be addressed in a follow-up commit. Fixes: QTBUG-88362 Change-Id: Ia663cfa47fa91c55997cdef288b2a866107a5f25 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickMenu: fix contentModel memory leakMitch Curtis2020-09-291-0/+2
| | | | | | | | | | | Q_Q should not be used in a QObjectPrivate-derivative's constructor, as q will be null at that stage. Instead, add QQuickMenuPrivate::init() and create the contentModel there. Pick-to: 5.15 5.12 Fixes: QTBUG-86851 Change-Id: Ia2a955e718cc0486af5a05e24fcfcb1c4bacb48d Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-091-2/+2
| | | | | | Task-number: QTBUG-84469 Change-Id: Ic36741d2bcaec8d5e5dc96638b7122f8ce51bdb2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Remove old QQuickPalette implementationVitaly Fanaskov2020-03-181-0/+2
| | | | | | | | | | | | | | The existing implementation was removed in order to reduce massive code duplication and simplify color resolving process. Unit tests were fixed accordingly. See related changes in the qtdeclarative module for the further details. [ChangeLog][General] the palette API is a part of QQuickItem now. Change-Id: Ic94ab4632e626c11d9b26f035e2a8a119c9088ef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Menu: fix disabled sub-menu items being highlightedMitch Curtis2019-02-041-0/+2
| | | | | | | | | | | When a menu item with a sub-menu was triggered by key or mouse, it would open the sub-menu with the first menu item highlighted. This doesn't make sense for disabled menu items, so this patch makes it find the first enabled item. Change-Id: I9df1c750749e5a77b027b6f476b8ae1f5ea035bd Fixes: QTBUG-69540 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Revert all Menu delegate patchesv5.12.0-rc2v5.12.0-rc1v5.12.0Mitch Curtis2018-11-151-3/+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>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-111-0/+3
|\ | | | | | | Change-Id: I3fa0011d8b69db2a004feb177a7f89ccb75a724d
| * Menu: ensure the correct delegates are used when created via ComponentMitch Curtis2018-09-051-0/+3
| | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-05-071-6/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quicktemplates2/qquickabstractbutton_p_p.h src/quicktemplates2/qquickcombobox.cpp src/quicktemplates2/qquickcontainer.cpp src/quicktemplates2/qquickcontrol.cpp src/quicktemplates2/qquickcontrol_p_p.h src/quicktemplates2/qquickdialog_p_p.h src/quicktemplates2/qquickdialogbuttonbox.cpp src/quicktemplates2/qquickdialogbuttonbox_p_p.h src/quicktemplates2/qquickdrawer.cpp src/quicktemplates2/qquickmenubar.cpp src/quicktemplates2/qquickmenubar_p_p.h src/quicktemplates2/qquickpage.cpp src/quicktemplates2/qquickpage_p_p.h src/quicktemplates2/qquickpane.cpp src/quicktemplates2/qquickpane_p_p.h src/quicktemplates2/qquickpopup.cpp src/quicktemplates2/qquickpopup_p_p.h src/quicktemplates2/qquickrangeslider.cpp src/quicktemplates2/qquickscrollview.cpp src/quicktemplates2/qquickslider.cpp src/quicktemplates2/qquickspinbox.cpp src/quicktemplates2/qquickswipeview.cpp src/quicktemplates2/qquicktabbar.cpp src/quicktemplates2/qquicktextarea_p_p.h src/quicktemplates2/qquicktextfield_p_p.h src/quicktemplates2/qquicktheme_p.h Change-Id: I6e2b8fe99e51e3e26c87546aa66af045bc429ec4
| * Templates: use C++11 default member initializationJ-P Nurmi2018-05-041-6/+6
| | | | | | | | | | | | | | | | | | | | | | The code is more readable and less error-prone (this patch caught a few uninitialized members) when the members are initialized in the same place where they are declared. In many cases, empty default destructors can be entirely removed, and we get faster implicitly declared inline default constructors defined by the compiler. Change-Id: I14c5448afc901f9b2ac5965f28c1c26c0b646c08 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Replace QQuickMenuPrivate::reposition() with QQuickMenuPositionerJ-P Nurmi2018-05-031-1/+1
|/ | | | | Change-Id: Iea8c1b8609778604af06cc70eaefad21f00186bd Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Introduce MenuBarJ-P Nurmi2017-07-261-2/+4
| | | | | | | | | | | | | | 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>
* QQuickMenu: get rid of openSubMenu()J-P Nurmi2017-07-141-1/+1
| | | | | Change-Id: I8125971dd91614984379e734af21f5ff28852667 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickMenu: resolve the parent itemJ-P Nurmi2017-07-131-0/+1
| | | | | | | | | | | | A cascading sub-menu is parented to the menu item in its parent menu, but a non-cascading sub-menu is parented to the parent menu's parent item to be able to have the sub-menu visible while the parent menu is hidden (non-cascading menus are opened and closed one by one). Based on these conditions, resolve the parent item automatically instead of doing it by hand in openSubMenu(). Change-Id: I5dd38ee0978604cd604dabf6f40ac4fb5f3eebbe Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickMenu: override reposition() to position sub-menusJ-P Nurmi2017-07-121-0/+1
| | | | | Change-Id: Ia63148beee6b574e435a120be245601b3a0b3322 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add QQuickMenuPrivate::setParentMenu()J-P Nurmi2017-07-121-0/+1
| | | | | | | | To help propagating the cascade-property automatically, instead of doing it manually in openSubMenu() that we're trying to get rid of. Change-Id: I3a3d59cafccc85d6affc325eb60e717e22b8f812 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickMenu: control close policy from prepareEnterTransition()J-P Nurmi2017-07-121-0/+1
| | | | | | | Moving stuff away from openSubMenu() until we can remove it... Change-Id: I0a979a6a0de25584a213b59e1d29d3b9f78b184e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add QQuickMenu::dismiss()J-P Nurmi2017-07-111-1/+1
| | | | | | | | | [ChangeLog][Controls][Menu] Added a dismiss() method. Unlike close() that only closes a menu and its sub-menus, dismiss() closes the whole hierarchy of menus, including the parent menus. Change-Id: Ibde2102bbb542a5deefdf17843496b7b80021db4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add Menu::currentIndexJ-P Nurmi2017-06-211-3/+2
| | | | | | | | | | | | | | De-couple current index management from the content item. Instead of manipulating the content item's current index directly from C++, offer a currentIndex property that can be visualized by the style, also when not using a ListView. This is essentially the same technique ComboBox uses to control the highlighted index in the popup ListView. [ChangeLog][Controls][Menu] Added currentIndex property for styling purposes. Change-Id: Idf7746d9c08fc9ca9a0dfd15225ebae5a29243c9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devJ-P Nurmi2017-06-151-0/+3
|\ | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/ButtonGroup.qml tests/auto/controls/data/tst_container.qml tests/auto/menu/tst_menu.cpp Change-Id: Ie8ee7e4f83f3fda6a09507b060576ebda929a7cd
| * QQuickMenu: fix key navigationJ-P Nurmi2017-06-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | Skip non-focusable separators, and use a key focus reason (Qt::TabFocusReason & Qt::BacktabFocusReason) to give the items visual focus. [ChangeLog][Controls][Menu] Fixed key navigation to skip separators. Change-Id: I99affabc50703c7363ab8146e5ced9b45111de00 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickMenu: add a little delay for opening sub-menus on hoverJ-P Nurmi2017-06-131-0/+4
| | | | | | | | | | | | | | | | | | This improves the usability on desktop. When a menu has multiple sub- menu items, they don't all trigger a sub-menu (and close immediately) while moving mouse over the items. Change-Id: Ie4c9e409da8d6877e35506bffb94ed57f5985dcd Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Remove unnecessary QQuickMenuPrivate::onItemPressed()J-P Nurmi2017-06-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | QQuickMenu was developed before QQuickControl::focusPolicy was added. Now that QQuickAbstractButton sets Qt::StrongFocus, which includes Qt::ClickFocus, by default, it gains active focus automatically and there is no need to call forceActiveFocus() by hand. This patch does not include new tests, because QQuickMenuItem's focus behavior is already tested in tst_menu. Change-Id: Ia2c9bed34548c3edbb54b8e5dc1207b3c7520b22 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add support for cascading sub-menusJ-P Nurmi2017-06-131-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds initial support for cascading sub-menus by allowing one to nest declarative Menu declarations. A follow-up commit adds support for adding, inserting, and removing menus programmatically. [ChangeLog][Controls][Menu] Added support for cascading sub-menus. Task-number: QTBUG-60351 Change-Id: I0eee4f74d92a97c09333fcc4348b019782448535 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickMenu: update the highlighted item on mouse hoverJ-P Nurmi2017-06-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the expected behavior on desktop. NOTE: It must be possible to mix mouse hover highlighting, and keyboard navigation in the way that keyboard navigation must seamlessly continue from the item that was previously mouse highlighted. Furthermore, there should be only one item highlighted at a time. In order to be able to respect keyboard navigation while another item is hovered and vice versa, the visual highlight should be bound to MenuItem::highlighted instead of Control::activeFocus or Control::hovered. [ChangeLog][Controls][MenuItem] Menu has been fixed to highlight its items while key navigating and mouse hovering to ensure seamless item highlight between mouse hover and key navigation. In order to provide appropriate highlighting that works for key navigation and mouse hover, styles should bind their visual highlight to MenuItem::highlighted instead of Control::activeFocus or Control::hovered. Change-Id: I70cad5a5b441f2616d1ce2166e97974dc1ae063f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add QQuickMenuItem::menuJ-P Nurmi2017-06-061-0/+1
| | | | | | | | | | | | | | | | [ChangeLog][Controls][MenuItem] Added a "menu" property that provides access to the menu that contains the menu item. Change-Id: I5edbf860756ba7ba9aef93d4992720327c10d1df Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickMenu: add support for declaring ActionsJ-P Nurmi2017-06-021-0/+4
|/ | | | | | | | | [ChangeLog][Controls][Menu] Added support for declaring Actions. The new "delegate" property is used to define a Component that is used to create menu items that present the actions. Change-Id: If26f38f6910aa5592879703429a2b418193d5710 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2017-01-111-1/+1
|\ | | | | | | Change-Id: If797ac58344b20e8de4379343131c097247ba2f2
| * Welcome to 2017J-P Nurmi2017-01-091-1/+1
| | | | | | | | | | Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Whitespace cleanupsJ-P Nurmi2016-11-031-1/+0
|/ | | | | Change-Id: Ia075694a7dc43d72d07221b569467fcebdb411fb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-08-231-2/+1
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/material/qquickmaterialstyle.cpp src/imports/controls/universal/qquickuniversalstyle.cpp src/quicktemplates2/qquickpopup_p_p.h src/quicktemplates2/qquicktooltip.cpp tests/auto/auto.pro Change-Id: I88b347dd85278e14f7b2ca468e30648c6432b6f2
| * QQuickPopup: don't keep a reference to a destroyed parentJ-P Nurmi2016-08-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | Move the itemDestroyed() listener from QQuickPopupPositioner, which is only active while the popup is visible, to QQuickPopupPrivate instead. This way the popup gets a notification when the parent gets destroyed while the popup is hidden. Task-number: QTBUG-55347 Change-Id: Ic72206cc05996c23062e814799a030c369fc6288 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Fix build after QQuickItemChangeListener changesJ-P Nurmi2016-07-131-1/+1
|/ | | | | | | | qtdeclarative commit e2c296c changed the itemGeometryChanged() signature. Change-Id: Ibe163e1d6fe8535a4ec01de047d72a0d4863979d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Q_QUICKTEMPLATES2_EXPORT => Q_QUICKTEMPLATES2_PRIVATE_EXPORTMitch Curtis2016-04-271-1/+1
| | | | | | | They're all private classes. Change-Id: I2f1463429109c5651f9cca5bc7aabe5cf0f79637 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Templates: update license headersJ-P Nurmi2016-04-141-2/+2
| | | | | | | This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. Change-Id: I39ef9cbb00f55a32b7a43f11ffbdfbb40b84e124 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Templates: rename the C++ module to qtquicktemplates2J-P Nurmi2016-04-131-0/+102
Change-Id: I146da903b46f5c2caf865e37291c25376b49021a Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>