summaryrefslogtreecommitdiff
path: root/src/controls/qquickmenu.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Fix documentation warningsTopi Reinio2019-11-141-8/+8
| | | | | | | | | | | | | | | | | All warnings in qtquickcontrols were related to \qmlmethod or \qmlsignal parameters, except for the missing dependency to qtcore in Qt Quick Extras. There's some inconsistencies with how QDoc parses QML method parameters, especially for qml signals - in some cases the \a command is replaced with \e to clear the warning, even though the parameter name referenced with \a does exist. This commit brings the current warning count to zero. Fixes: QTBUG-79828 Change-Id: I3d3d02583498c5a579f6476273e10e75680d940c Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Menu: Provide a safe clear() functionUlf Hermann2018-09-271-22/+53
| | | | | | | | | | | | | The menu items are generally owned by QML. Therefore we cannot delete them on clear(). The containers, however, are owned by the menu, and we have to delete them also when clearing the QQmlListProperty for a proxy menu. The QQmlListProperty, when clearing the items for a non-proxy menu, will still delete them, as that seems to be the way QML expresses its desire to get rid of them. Fixes: QTBUG-64464 Change-Id: Ied0b86496b289c2e2a83f3d6fd53d7045929beb0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickMenu1::__popup(): Scale target rectangleJ-P Nurmi2018-02-021-1/+4
| | | | | | | | Same as 223c15 for QQC2. The QPlatform* classes operate in native pixels. Task-number: QTBUG-55251 Change-Id: I4a3fa64313a6035dab96906fa57a27240e080678 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* "to the empty string" => "to an empty string"Mitch Curtis2017-03-011-3/+3
| | | | | | Change-Id: I62f1fae431ce02c196c6ca582e0d033dbf38d836 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-271-0/+17
|\ | | | | | | | | | | | | Conflicts: tests/auto/qquicktreemodeladaptor/tst_qquicktreemodeladaptor.cpp Change-Id: I0b6018fdac65a5385136e4c3561fba1c52ecd32e
| * macOS: Fix native dangling menu still visible on screen and crashFilipe Azevedo2016-08-221-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | If the parent window gets destroyed while a QtQuick Controls menu is open the macOS native platform menu is not dismissed and you see a blank gray rectangle without any text. Also, at this point the QQmlEngine was already destroyed but it's still present on the call stack, so you get a crash when the stack unwinds to the original right mouse click that created the context menu. Change-Id: I638b0de13734815995d2994e6dd6603bcb0ebefc Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7v5.7.0-beta1Liang Qi2016-04-081-2/+3
|\ \ | |/ | | | | Change-Id: Ic78345c599719f3dd80b1d6a6004d46a085da4af
| * Doc: Add missing closing brace to a code snippetTopi Reinio2016-03-101-2/+3
| | | | | | | | | | | | | | | | And switch to use \qml instead of \code, as the snippet is valid QML. Change-Id: I0680eb0427fd3537ab052bb20ce5d7468545ccb0 Task-number: QTBUG-51715 Reviewed-by: Nico Vertriest <nico.vertriest@theqtcompany.com>
* | Controls: append "1" to all C++ classesMitch Curtis2016-03-181-33/+33
| | | | | | | | | | | | | | | | | | | | This is consistent with the classes that have already had this done. It prevents clashes with Qt Quick Controls 2. These classes are not available to the user, so it doesn't affect compatibility. Change-Id: Iee73ee6bc530182732ae95993e1f4fc3766eb8e0 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* | Disable platform menus on XCBJ-P Nurmi2016-02-251-6/+9
| | | | | | | | | | | | | | | | | | | | Context menus and combobox popups no longer work with QDBusPlatformMenu, which only works in the global menubar or system tray icon. Change-Id: I65d037c8eb9e8f0f462ddc2dfb36843c062714b3 Task-number: QTBUG-51372 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* | Unify license header usageAntti Kokko2016-02-041-12/+15
| | | | | | | | | | | | | | Update old header.LGPL3 to header.LGPL Change-Id: I3c851bc24da89f6300b94199387d1adf16ca4f48 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-211-59/+73
|\ \ | |/ | | | | | | | | | | Conflicts: src/controls/qquickmenubar.cpp Change-Id: I4b036212b6dadded2c4d60dd07e91f629e80d9c2
| * Suffix QQuickMenu, QQuickMenuBar & QQuickMenuItem with 1J-P Nurmi2015-12-161-62/+62
| | | | | | | | | | | | | | | | This avoids clashes between Qt Quick Controls and Qt Labs Controls. Change-Id: Ia1d367c271a3c80259d4f59be891c211ec061e01 Task-number: QTBUG-49794 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
| * Moved menuBar function from QQuickMenuPopupWindow to QQuickmenuv5.6.0-beta1Filippo Cucchetto2015-12-071-0/+14
| | | | | | | | | | Change-Id: I6628ac2b8b07634afc1062488a12788a4e3f66c0 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* | Replace foreach with range-based forAnton Kudryavtsev2016-01-161-1/+2
|/ | | | | Change-Id: Ieb9019b62696479a4e0317a590bceaeb30abf62c Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Fix proxy menu crashJ-P Nurmi2015-11-171-1/+7
| | | | | | | | | | | | Mobile-centric ApplicationWindowStyle implementations (Flat & Android) use a proxy menu to morph menubar items into a single menu button. The items are owned by the menubar and must not be deleted by the proxy menu. Otherwise, depending on the destruction order, the items would get deleted twice. Change-Id: I92d0c45fc3274574fd1edf34d8d3d081990f2727 Task-number: QTBUG-48927 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* qquickmenu: don't dismiss a native menu from __dismissAndDestroyRichard Moe Gustavsen2015-11-121-0/+3
| | | | | | | Task-number: QTBUG-49365 Change-Id: I34509ce9d961f0afb5c2f935af6dc4e574c39a77 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Simon Hausmann2015-10-021-12/+59
|\ | | | | | | Change-Id: Ie26c941c33fdd8baab49dc13b84d02e2b83af5e1
| * Menus: Clean popup hide and destroy logicGabriel de Dietrich2015-10-011-12/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a menu popup gets closed it usually needs to be destroyed right away since we don't recycle its contents. There is an exception, however, and it's when he user triggers a menu item. In this case, we need to proceed in three steps. First, we hide the menu popup, then we emit the triggered signal, and when that one returns, the menu contents can be disposed. If we did all in a single step, we may end up with a crash since we don't support deleting a QtQuick item while it's running a signal handler. Delayed deletions don't work either in the case when the triggered handler ends up running the event loop. Task-number: QTBUG-45182 Task-number: QTBUG-47682 Task-number: QTBUG-48382 Change-Id: Ic39717e09f38df602f641250cd81cf4931863db6 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* | Pass non-trivially-copyable or large types by const-refSergio Martins2015-07-221-2/+2
|/ | | | | | | Change-Id: I38af4720b916731451cb28aee0d16eed097d3350 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* Menu: Add aboutToShow, aboutToHide signalsGabriel de Dietrich2015-04-161-4/+31
| | | | | | | | | | | These do the same as for QMenu, and are emitted right before the pop-up is shown or hidden. On Mac, these signals are emitted by the QPA plugin and relayed by QQuickMenu. Task-number: QTBUG-40576 Change-Id: I59113d8d9cc8c5b3140f4f552772d33dd0b6e138 Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Liang Qi2015-04-151-11/+35
|\ | | | | | | | | | | | | Conflicts: src/controls/qquickmenupopupwindow_p.h Change-Id: Ic935bb56f5df70645eea30c890759f5980d68fe4
| * Menu: Separate dismiss and destroy actionsGabriel de Dietrich2015-03-271-11/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids issues when the action is triggered from a Menu and the slot ends up processing pending events, effectively deleting an object while one of its QML signal handlers is being executed. The reason being that we used to call deleteLater() on the menu popup window while still in the mouse event handler. Now, we do the same thing in three separate steps. 1. Close/dismiss the menu popups, 2. trigger the action, and 3. delete the popups. This keeps the menu popups and their contents alive until we return from the action triggered handler. We also need to take care of manually destroying any popup we may create. Finally, the menu content creation in Menu.qml had to be tweaked since we shouldn't rely on the popup visibility anymore. Task-number: QTBUG-45182 Change-Id: I9f1155bbf74dd3353c6c4066a24abf1cd2c3a283 Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com> Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* | Added QQuickMenu reference in QQuickMenuPopupWindowFilippo Cucchetto2015-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | QQuickMenuPopupWindow has not direct reference to the QQuickMenu that created it. This is useful for navigating back from the popup to the QQuickMenu Change-Id: I6b11641ef90c423df9961277bb3e89573d1ed0e0 Reviewed-by: Filippo Cucchetto <filippocucchetto@gmail.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* | Doc: Fix qtdoc warningsCaroline Chao2015-03-061-1/+1
| | | | | | | | | | | | | | | | | | Mostly link errors and missing documentation. And removed useless references to {QtQuick.Controls.Styles} in the doc. Change-Id: Iad211a574c0bd23c84e067e0cbcc18c3e719cde7 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Controls: update license headersJ-P Nurmi2015-02-111-15/+18
|/ | | | | | | Change-Id: I77e7a218a958d76ac7ef7780f4be52a81f76fa6b Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* Take all offsets into account also with PlatformMenuv5.4.05.4.0Laszlo Agocs2014-11-241-0/+1
| | | | | | Task-number: QTBUG-42314 Change-Id: I7e63d744bbed4a5c254d6cffdc8aba4c5e37d5c3 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* Fix popup menu position for QQuickWidgetPaul Olav Tvete2014-10-151-7/+11
| | | | | | | | | | | QQuickMenu::popup() did not handle the QQuickWidget case properly when mapping between screen and local coordinates. This meant that popups appeared in the wrong position for comboboxes, context menus and edit menus. Task-number: QTBUG-38116 Change-Id: Iedd7bed55648b1b4a576b9ccb8575b75427bd06f Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* QQuickRenderControl is now in public headersv5.4.0-beta1Oleg Shparber2014-10-111-1/+1
| | | | | Change-Id: I57d8ecd771eac00cc68de0ec5afa07706fee3671 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Get the popup mouse position for the right screenGiulio Camuffo2014-10-061-3/+5
| | | | | | | | If the parent window of the popup is not on the primary screen use the right one to get the mouse position. Change-Id: Ib9929e6fdf90dfae2457486edc9504719bdaad8b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* Allow sharing menu itemsJ-P Nurmi2014-09-301-2/+0
| | | | | | | | | | This is needed for mobile platforms that want to present the whole menubar as a single button. For example, if the menubar has only one menu, it will be shown directly. If there are multiple menus, they will be placed into a proxy menu (the removed assertion would fail). Change-Id: I83365253b89f6b450812f032af0e9fe3e4f847ff Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* qquickmenu: add support for providing a target rect to __popup()Richard Moe Gustavsen2014-09-301-8/+10
| | | | | | | | | | | | | | | | | Using a target rect as menu location instead of a position has been supported in QPlatformMenu for a while. The reason for specifying a rect instead of a position is that then the OS can decide if the popup should be placed above or below the target rect so that it fits inside the screen. A typical example is when showing an edit menu around a text selection. If the selection (target rectangle) is far up on the screen, the popup (with arrow) will be placed below the selection instead of above, which is the normal. Change-Id: Ie6cd6a92f1d9ef480c1e455960021c7f18f86569 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
* Revert "qquickmenu: implement support for __closeMenu when using native menus"Richard Moe Gustavsen2014-09-221-4/+1
| | | | | | | | | | | | This showed not to be the correct solution, since hiding a (sub) menu will make the menu appear removed from the parent menu the next time the parent menu opens. This reverts commit 1c40734f87fa10934d7cee430027b478c2ceaf58. Change-Id: Ife071348c93d630ad372aea66fd848885aef032b Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* qquickmenu: implement support for __closeMenu when using native menusRichard Moe Gustavsen2014-09-181-1/+4
| | | | | Change-Id: I6ba0924d0dd90b87426f4315bd36496cbd4ad7f5 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Update license headers and add new license filesAntti Kokko2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I470909ba0980db33ab551790d619c59a35978590 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* QQuickMenu: add enum MenuType that reflects QPlatformMenu::MenuTypeRichard Moe Gustavsen2014-08-061-1/+2
| | | | | | | | | | | | On mobile platforms several different popup menu types exist. E.g on iOS, you have a special popup just for selecting text. A recent patch added to QtBase added a new enum to QPlatformMenu that lets UI controls select/hint which one to use. This patch adds the same enum to QQuickMenu so that we can control this from Controls as well. Change-Id: Ibf4bdc84577b5a6527021b1cb15578b56bb4a92e Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* QQuickMenu: dismiss platform menu, not only QQuickMenuPopupWindowRichard Moe Gustavsen2014-08-041-6/+10
| | | | | | | | This patch will fill in the missing code path that tells a native platform menu to dismiss when requested. Change-Id: I2625fddd0a735ca9ec7fabaf783921a1f99caa1d Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* QQuickMenu: center menu when mouse not presentRichard Moe Gustavsen2014-08-041-0/+6
| | | | | | | | | | | | | | | | | | | | On touch platforms, QCursor::pos() will return the last touch synthesized to a mouse pos. Since this will only happen when the user taps on a control that does not handle the touch, the position you get can easily be very old. And in many cases, a mouse pos has never been synthesized at all, and the position you get is inf. As a quick fix, this patch checks if the mouse position is invalid, and center the menu. For a long term fix we need to find a way to expose touch events in QGuiApplication, and write logic that determines when to use touch and when to use mouse to position the menu, and if using touch, which touch point should be used. Change-Id: Ic4d2dd78372efcd0c2362204492e76f44ff0a49a Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Use the correct parent window for menu popupsLaszlo Agocs2014-07-011-2/+7
| | | | | | | | | The previous fix applied only to the non-platform menu case and was broken on OS X at least, when having a combobox in a QQuickWidget. Task-number: QTBUG-39908 Change-Id: I5dde103c2fe33d52a312cc80b36b47b13e72a188 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Menu: Properly relay enabled state to QPA menu objectGabriel de Dietrich2014-06-061-3/+17
| | | | | | Task-number: QTBUG-39384 Change-Id: I1b71912b4f35ea0aa9e06667a5c0ecedec30f980 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
* Menu: Fix QPA related crash on exitGabriel de Dietrich2014-05-041-0/+3
| | | | | | | | | | | | In QPA world, menus are always referenced by a menu item. (This is the menu item either on the menu bar or in the parent menu.) So, the same way that we set the menu item's menu in the menu's constructor, we must clear it. Specially since qtbase commit 8605f44097a986e10c2ddaf4b4eae0b2331d98d1 which checks for the menu reference in the menu item's destructor. Change-Id: Id196fc7c2082dbff1d9006cbd82b7237532c4e3c Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
* Popup Window: Privately expose popup geometryGabriel de Dietrich2014-03-071-0/+9
| | | | | Change-Id: I28a8edd657f02cecbd0c31965bd4085429cf4537 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
* Menu: Don't create platform item for QQuickMenuItemContainersGabriel de Dietrich2013-12-171-1/+1
| | | | | | | | | | They don't have any QPA counterpart as they're just plain containers. This also removes that "Menu does not contain the item to be removed" warning on Mac. Task-Number: QTBUG-32197 Change-Id: I06e08817194c2e3ad3efd7ded193bfac9d3a1948 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
* Menu: Extract QQuickMenuPopupWindow core popup behaviorGabriel de Dietrich2013-10-181-2/+2
| | | | | | | ... and put it in QQuickPopupWindow. Change-Id: I6920f5c13904483310faae990c7199db9f1c4708 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
* ComboBox: Make popup scrollableGabriel de Dietrich2013-09-191-0/+2
| | | | | | | | | | | | | | | | We factor out part the menu item container logic from Menu into ColumnMenuContent, which takes care of scrolling and mouse hovering, and selection. This makes possible to extend the menu items layout. The pop-over and pull-down look is specified by the menu style component by overriding the ScrollView style. The popup's maximum height is also specified by the menu style. The gallery example can finally use a font families combo box. Task-number: QTBUG-31568 Change-Id: I34a7278f476471c0eb51ef51dde3dd83e13002fe Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
* Merge branch 'stable' into devGabriel de Dietrich2013-09-181-1/+3
|\ | | | | | | | | | | | | Conflicts: src/controls/qquickaction.cpp Change-Id: I85255ba5c27c0d8ea023d0867e5963d43f8f1ddb
| * Menu: Enable mnemonic menu navigationGabriel de Dietrich2013-09-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | We also added a new mnemonic specific shortcut context matcher. This prevents two menu items with the same mnemonic but within different menus to be reported as ambiguous. Task-number: QTBUG-33030 ChangeLog: Added mnemonic navigation for menus Change-Id: I192c9aacba4d15851fe65bf9201251962fe976d5 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
* | Update imports to 1.1 and remove version from qmlmodule definitionJens Bache-Wiig2013-09-101-1/+1
| | | | | | | | | | Change-Id: Icb4c6d78225c072da787e4646a55d8cf71a5db7a Reviewed-by: Caroline Chao <caroline.chao@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devJ-P Nurmi2013-08-201-1/+13
|\ \ | |/ | | | | Change-Id: I97e6044a5d28ab875628e61ea67474f3c0a4ef4b
| * MenuBar: Make sure invisible menus appear soGabriel de Dietrich2013-08-131-1/+13
| | | | | | | | | | | | | | Task-number: QTBUG-32899 Change-Id: Id07baba90ff45ba420d563ce47ee58964d4e4d02 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>