aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/qquickpopup.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix QQuickPopupPositionerJ-P Nurmi2016-03-221-3/+3
| | | | | | | | | | | tst_tooltip revealed a bug that QQuickPopupPositioner wasn't cleaning up its ancestor listeners properly. When QQuickPopup was destructed, it left a listener on the window root item. When the root item got later destructed, it tried to call a listener (the popup) that was already deleted. Change-Id: If041458da24be927f0bad19b9549dcabd1931977 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Popup: fix marginsJ-P Nurmi2016-03-211-1/+13
| | | | | | Change-Id: I09f974a00a5a2a8f14645ff5d9bfbd6bad03d324 Task-number: QTBUG-51990 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Change locale inheritance for popupsJ-P Nurmi2016-03-171-2/+0
| | | | | | | | | | The last one in the series of making Popup inherit its properties from the parent window instead of the parent item. The same change was done for font and style already. Change-Id: I7024cce13f501e92024e9110e87ed33bbae6533d Task-number: QTBUG-50984 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Fix popup fontsJ-P Nurmi2016-03-111-3/+1
| | | | | | | | | | | This is a partial revert of a405919. This change makes popups inherit the window font instead of the parent item font. Change-Id: Ie360e3831aadbd167859e17d381edf3a28945300 Task-number: QTBUG-50984 Task-number: QTBUG-51696 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* QQuickPopup: fix possible referencing of a destroyed parent itemJ-P Nurmi2016-03-101-0/+1
| | | | | | | | | | The internal popup positioner is already listening for itemDestroyed() of the parent item, so it may as well reset the parent item pointer of the popup to avoid having the popup referencing a destroyed parent in complex tooltip auto test cases coming up in 5.7. Change-Id: I463403e528c33285ea7d51b68d0f5020a239e98e Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Fix QQuickPopupItemPrivate::implicitWidthChanged()J-P Nurmi2016-03-101-1/+1
| | | | | Change-Id: Ib822b57da21b338c7b11cae115f1bb6a178d7328 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* Fix QQuickPopup::setParentItem()J-P Nurmi2016-03-021-1/+1
| | | | | | | | Don't call naturalControlFont() or calcLocale() with a null pointer, because it will crash. Change-Id: Ib4b6dba85e6c55832c30b5178b74ebf39429a5f8 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* QQuickPopup: fix uninitialized variableJ-P Nurmi2016-02-251-0/+1
| | | | | Change-Id: I339fdb284d65859b5df3a120fc806beaf950031b Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Implement accessibility support for Popup and MenuJ-P Nurmi2016-02-251-0/+15
| | | | | | Change-Id: I55067bb1cb9888be8e0e991fb73c9365d93d04f4 Task-number: QTBUG-51316 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* Fix QQuickPopup to respect explicit sizeJ-P Nurmi2016-02-241-1/+4
| | | | | | | | | Don't resize the popup (clamping to its implicit size) unless the popup really has to be resized in order to fit the screen. Change-Id: I81201b77a1001ac22291ede1fc685f7208ff2916 Task-number: QTBUG-51322 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Popup: use available size and paddings from the popup itemJ-P Nurmi2016-02-191-168/+67
| | | | | | | | | | | | | | | | Now that the internal popup item inherits Control, which already provides these features, we may use them directly instead of re-doing them in Popup. NOTE: QQuickMenu code has lots of direct references to the content item, which used to be stored in QQuickPopupPrivate, which is the base class of QQuickMenuPrivate. Now that the content item is stored by QQuickPopupItem instead, the direct references don't work. Thus, as a temporary solution to avoid this patch growing large, we'll store the content item in QQuickMenuPrivate. Change-Id: I80a16d34432131a4326c1b6ae54419470be53f96 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* Recommend the use of ApplicationWindow with popupsMitch Curtis2016-02-191-1/+34
| | | | | | | | It's important to mention that ApplicationWindow provides some extra support for popups. Change-Id: Iecea78d9d4446bbc4694fcde0166d1b1c2fb62ee Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
* Controls: fix locale inheritance for popupsLiang Qi2016-02-191-1/+3
| | | | | | | | | QQuickPopup is a QObject, not a QQuickControl. Then need to make QQuickPopup::popupItem() inherit its locale from QQuickPopup::parentItem(). Task-number: QTBUG-50984 Change-Id: Ie5908f86a154502962d6406dd4067b46cc527de7 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Controls: fix font inheritance for popupsLiang Qi2016-02-181-3/+6
| | | | | | | | | QQuickPopup is a QObject, not a QQuickControl. Then need to make QQuickPopup::popupItem() inherit its font from QQuickPopup::parentItem(). Task-number: QTBUG-50984 Change-Id: I7f417474172b533b744eb668a0476cdcbabba868 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Docs: fix typos in margins linksJ-P Nurmi2016-02-061-4/+4
| | | | | Change-Id: I26b519e03700d163af12ec2d08097b1d51d9e119 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* QQuickPopup: add some missing propertiesJ-P Nurmi2016-02-061-3/+101
| | | | | Change-Id: I7df64587bf3ba289ba027f6dbe9872362532ec41 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Make popups work without ApplicationWindow, to some degreev5.6.0-rc1v5.6.0J-P Nurmi2016-01-301-40/+89
| | | | | | | | | | | | | | Using ApplicationWindow is highly recommended. First of all, with a plain Window, QQuickPopup attempts to set a high z-value, but cannot guarantee correct stacking order. Secondly, we cannot provide style- specific background dimming for modal popups, because it is styled as part of ApplicationWindow. Last but not least, QQuickPopup has to install a window-level event filter, which is far less efficient than how event handling done in QQuickOverlay. Change-Id: I08915abce7a1764177b92f7539eef77c054a405a Task-number: QTBUG-49921 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Try harder to keep popups inside the windowJ-P Nurmi2016-01-301-5/+26
| | | | | Change-Id: If9010f5694c1012a1eb7fb93dcb8958f0af49e9b Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Add Popup::marginsJ-P Nurmi2016-01-301-2/+224
| | | | | | | | | | | | Allow specifying margins around the popup that are taken into account while positioning the popup. For example, the Material style draws a drop shadow that goes outside the popups bounds. This allows it to specify margins so that the drop shadow doesn't get clipped. Other use case is to specify the margins so that the popup doesn't overlap with window header or footer. Change-Id: I018d961259fa8b960d86b77de01413eefb75a59b Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Popup: improve positioningJ-P Nurmi2016-01-301-4/+9
| | | | | | | | | | | Don't spend time repositioning while hidden, but make sure to reposition when the popup item is resized, or when the popup itself becomes visible. This fixes the issue that a ComboBox popup wasn't positioned inside the window when shown initially, until the ComboBox itself moved. Change-Id: I1456dc647e35b6eb9ec2c60dbe9bc9229f932e24 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Add QQuickPopup::popupItem()J-P Nurmi2016-01-281-0/+6
| | | | | | | | | | | | | | Even though I didn't want to expose this, because I'm still hoping we could make QQuickPopup inherit QQuickControl in the future, the fact that QQuickPopupPrivate::get(popup)->popupItem was used in so many places is a good indicator that accessing the popup item is often required when dealing with popups. In any case, this is C++ only API and not exposed to QML, so it's not that big deal... and we can always deprecate it later and make it return "this" should the item plans come true. Change-Id: I6b99a499327d838ee61eae70f8ebf8e77f00ae39 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Replace Popup::pressed|releasedOutside with close policy flagsJ-P Nurmi2016-01-281-0/+3
| | | | | Change-Id: I3e09c4e2b6cbbe39bdf9e943905664e5dc1fe954 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Add Popup::closePolicyJ-P Nurmi2016-01-281-0/+38
| | | | | Change-Id: Ie3d0f50a59aeaab36ec388af897cbf2596269ce3 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Add Popup::transformOriginJ-P Nurmi2016-01-251-3/+24
| | | | | Change-Id: I4a52468234f0479c1b8feb102e07686e3235ba3f Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Add Popup::setVisible()J-P Nurmi2016-01-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | This allows nice bindings such as: Slider { id: slider Popup { y: -height - 1 x: -width / 2 + slider.handle.width / 2 parent: slider.handle visible: slider.pressed // <--- Label { text: slider.position.toFixed(2) } } } Change-Id: Iebde004205636de31d0f0dd0f6404f0755aaf0df Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Popup: remove the warning about not being visibleJ-P Nurmi2016-01-231-2/+1
| | | | | | | | Same as 89e058, but for close(). If the popup is already closed, then close() should be just a no-op. Change-Id: Icf1a3c5f67aad9b76432608802aa345881f5b960 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Popup: add implicit & content sizesJ-P Nurmi2016-01-231-12/+182
| | | | | | | Behaves the same way than the Pane/Frame/GroupBox container controls. Change-Id: I370f3961b77a363a63a0a64fc629cc5da6dfd53f Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Popup: stay within window boundsJ-P Nurmi2016-01-231-4/+16
| | | | | | | | | If the popup doesn't fit on the screen, try flipping it around so that a popup that is requested to be positioned below the parent item is tried to fit above, and vice versa. Change-Id: I59d3b5e5cb1a45f894122f0aff459efd5065e2e9 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Add Popup::parentJ-P Nurmi2016-01-231-4/+187
| | | | | | | | | | | | | | | The parent defaults to the QML parent object where Popup is declared. Popup::x/y are relative to the parent, and the popup also automatically follows the parent as appropriate. QQuickPopupPositioner has been adapted from Qt Quick Controls 1. It was called QQuickScenePosListener, and it was implemented for the text selection handle popups. ComboBox's popup now follows the control eg. when scrolling, but the below/above positioning feature is temporarily gone missing. It will be restored in a follow up commit. Change-Id: I8a6b58cd74e07f33930abc35d0ab9da056685128 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Forward input events from the internal QQuickPopupItem to QQuickPopupJ-P Nurmi2016-01-221-0/+100
| | | | | | | | | Popup accepts/blocks all input events by default, to avoid them leaking throgh. Subclasses may override the event handlers to implement eg. key navigation (menu). Change-Id: I726b6a3f61a397e4f95d736c6617dd77a35b01dc Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Refactor PopupJ-P Nurmi2016-01-221-11/+437
| | | | | | | | | | | Added relevant properties to make it almost like a Control: x, y, width, height, padding, background... This change makes popup use an internal item where the style/user-supplied contentItem and background are re-parented. This way we can provide a default style (background) for Popup. Change-Id: I3e7933562464c5c852e4ba4bc37d9ac25691c714 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Add QQuickPopup::contentItemChange()J-P Nurmi2016-01-221-0/+7
| | | | | | | | | Works the same way than QQuickControl::contentItemChange(). This is more efficient and correct (in theory, supports changing the content item at run time) than connecting to the contentItemChanged() signal. Change-Id: I09db809760ddf2c7d62cc2937a6b821f0cd4dad7 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Popup: remove the annoying warning about being already openJ-P Nurmi2016-01-221-2/+1
| | | | | | | | | | | | For example, in Gallery, if I don't hide the menu button under the menu and click the button while the menu is open: qrc:/gallery.qml:323:5: QML Menu: popup already open in windowQQuickApplicationWindow(0x1c235b0) If it's already open, then open() should be just a no-op. Change-Id: I73123097ddd016f8aa54a0ab7edb7e5d0f093a00 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Add QQuickPopup::isComponentComplete()J-P Nurmi2016-01-211-0/+16
| | | | | | | Needed for the next commit. Change-Id: Icb34d6f772dd1ab662b050580aa776fdc78afa49 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Docs: add notes about the Qt.labs moduleJ-P Nurmi2016-01-191-0/+2
| | | | | Change-Id: I65c37f661689bf30e7a9119bb877dce68eeb634c Reviewed-by: Topi Reiniƶ <topi.reinio@theqtcompany.com>
* Allow closing an opening popupJ-P Nurmi2015-12-191-2/+2
| | | | | Change-Id: I4937808275c138fca09fa866b5df4d54d084357d Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Just tidy up QQuickPopup a bitJ-P Nurmi2015-12-191-30/+26
| | | | | Change-Id: Ibc8097299f0796f943682f0c1de628a8da87e430 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Rename Popup transitionsJ-P Nurmi2015-12-191-32/+34
| | | | | | | | | Use Android-inspired enter & exit, which eliminates the need of using a "transition" suffix, and also less prone to appear in auto-completion when new users try to open/show/close/hide popups. Change-Id: I3a448d3e9be33fbfffbf08488858aa63a70233f2 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Popup: rename show()/hide() to open()/close()J-P Nurmi2015-12-141-13/+13
| | | | | | | | | QML popups have traditionally used more explicit open() and close(). Renaming them to show() and hide() at this stage doesn't seem to have any real advantages. Change-Id: I1e7c8c4817c67e62cef965525e00f5bf125a7d76 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Rename Panel to PopupJ-P Nurmi2015-12-091-0/+330
Popup is a more descriptive name. Furthermore, this name change opens the door for another type called Pane. It gives the appropriate background color for the current style & theme. Change-Id: Idb91d37e807f62e870b50f0b656e84ee2d43a9fb Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>