aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
Commit message (Collapse)AuthorAgeFilesLines
* Revert all Menu delegate patchesv5.12.0-rc2v5.12.0-rc1v5.12.0Mitch Curtis2018-11-158-150/+35
| | | | | | | | | | | | | | | | | | | | | 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-092-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* QQuickPage: fix a typo to avoid a crashLiang Qi2018-11-091-1/+1
| | | | | | | | | when setting null to footer Fixes: QTBUG-71444 Change-Id: Id4b0a3fd7aa104357674b4e2be6206894f8878da Reviewed-by: J-P Nurmi <jpnurmi@gmail.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix Instantiator-created MenuItems disappearingMitch Curtis2018-11-021-4/+44
| | | | | | | | | | | | | | | When d5cb26bc fixed a bug in Menu, it also broke the use case of having an Instantiator create menu items. Using an Instantiator like this allows users to create a "Recent Files" menu, for example. The issue was that we would indiscriminately recreate items, even those owned by an Instantiator. This patch avoids recreating items owned by Instantiators. It also adds a logging category for Menu, to aid debugging. Fixes: QTBUG-71066 Change-Id: Ie0e46de1cbfaee81b43d63f3143435f2514371d5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Tie minor version of all imports to Qt's minor versionMitch Curtis2018-11-025-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-156-13/+60
|\ | | | | | | | | | | | | | | | | Conflicts: src/quicktemplates2/qquickmenubar.cpp src/quicktemplates2/qquickmenubar_p.h src/quicktemplates2/qquickmenubar_p_p.h Change-Id: I5c2115f05826f68f1b1f5ce6762273cd91e6997e
| * QQuickPopupPositioner: avoid adding duplicate item change listenersMitch Curtis2018-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue is that QQuickPopupPositioner::setParentItem() is called when the delegate has been created and assigned to the Repeater, then the ancestor listeners are added, and then straight after that, the benchmark item itself is parented to benchmarkRoot, which causes QQuickPopupPositioner::itemParentChanged() to be called, which adds a single ancestor listener: the QQuickRootItem (which was just added previously as a result of QQuickPopupPositioner::setParentItem() being called). The item could be arbitrarily high up in the ancestry tree, so there's no nice (i.e. fast) way of checking for duplicates in Controls 2 itself. Instead, use the new QQuickItemPrivate::updateOrAddItemChangeListener() function which only adds the listener if it doesn't already exist. This avoids a heap-use-after-free in qmlbench when creating Menus. Task-number: QTBUG-70729 Change-Id: I0efaa10167c4c9a9c4c1b65a5c34e683c3ec5732 Fixes: QTBUG-70729 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * MenuBar: ensure the correct delegates are used when created via ComponentMitch Curtis2018-10-024-12/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | QQuickStackView: Fix deprecated function call warningv5.12.0-alpha1Friedemann Kleint2018-09-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QV4::Object::getIndexed(uint) is deprecated in favor of get(uint). On this occasion, fix signedness warnings by changing j and len to be of type uint. Fixes: qquickstackview_p.cpp:103:66: warning: ‘QV4::ReturnedValue QV4::Object::getIndexed(uint, bool*) const’ is deprecated [-Wdeprecated-declarations] QV4::ScopedValue value(scope, array->getIndexed(j)); QT_DEPRECATED inline ReturnedValue getIndexed(uint idx, bool *hasProperty = nullptr) const qquickstackview_p.cpp:107:78: warning: ‘QV4::ReturnedValue QV4::Object::getIndexed(uint, bool*) const’ is deprecated [-Wdeprecated-declarations] QV4::ScopedValue props(scope, array->getIndexed(j + 1)); QT_DEPRECATED inline ReturnedValue getIndexed(uint idx, bool *hasProperty = nullptr) const Change-Id: I6c0b0d54dd4119a2531f847788c531daf92e6954 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-113-21/+49
|\| | | | | | | Change-Id: I3fa0011d8b69db2a004feb177a7f89ccb75a724d
| * Menu: ensure the correct delegates are used when created via ComponentMitch Curtis2018-09-052-17/+45
| | | | | | | | | | | | | | | | | | | | 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>
| * Doc: improve SwipeView docsMitch Curtis2018-09-031-4/+4
| | | | | | | | | | Change-Id: Ic1cc85ed76c3ee534b7dda43449140a791cff36d Reviewed-by: J-P Nurmi <jpnurmi@gmail.com>
* | Fix enum warningsMitch Curtis2018-08-233-20/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | QPlatformDialogHelper's meta-object is added to QQuickDialogButtonBox's meta-object as a related meta object, and all of its enums are merged into the same namespace by the QML engine. This produces a conflict with the enum values of the ButtonLayout in QQuickDialogButtonBox, which is a duplicate of the one that's already pulled in. Fixes: QTBUG-70141 Task-number: QTBUG-70141 Change-Id: Ib33dc8ddbe8aa80d03183eb23861658c9e978f04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QQuickContainer: call getContentItem() instead of using memberMitch Curtis2018-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | This ensures that the contentItem is created (lazily) in cases like SplitView, which creates an empty QQuickContentItem. If we don't do this, items added to SplitView don't show up because it has no contentItem. Change-Id: Ide3ce45a2173cc13ee7b194ad6dc501287d6fc6c Reviewed-by: J-P Nurmi <jpnurmi@gmail.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-181-1/+1
|\| | | | | | | Change-Id: I828b8ea2fef35e4e7ab0bb594e683f8643c793a1
| * QQuickStackView: fix crash on viewItemTransitionFinished()Alexandr Akulich2018-08-111-1/+1
| | | | | | | | | | | | | | | | | | | | Check transitioner for nullptr before access. The transitioner created only on some transition setter called and remain nullptr on base unstyled StackView from templates. Task-number: QTBUG-69897 Change-Id: I51564c5e7195112764f5a63b3b48c302a6d29146 Reviewed-by: J-P Nurmi <jpnurmi@gmail.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-281-0/+20
|\| | | | | | | Change-Id: Icd5d8a4292be3a335000a7bd0f30384ad83ff36d
| * Doc: add a note about the best way to set paddingMitch Curtis2018-07-241-0/+20
| | | | | | | | | | | | | | | | | | | | | | As the styles are subject to change over time, it's best to use the most fine-grained properties for specifying padding (topPadding, bottomPadding, etc.). Using these specific properties will ensure that what the user specifies always wins over what the style specifies. Task-number: QTBUG-69551 Change-Id: I4163e9918010fad0cb6ec701b49dbc59b086cf47 Reviewed-by: J-P Nurmi <jpnurmi@gmail.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-175-7/+38
|\| | | | | | | | | | | | | | | | | Conflicts: src/quickcontrols2/qquickstyle.cpp src/quicktemplates2/qquickscrollview.cpp tests/auto/qquickstyle/tst_qquickstyle.cpp Change-Id: I9afddf07a956f43cf0445e91b8d1a02f167b6bd5
| * Fix crash on exit when using a shader and a PopupSimon Hausmann2018-07-161-1/+1
| | | | | | | | | | | | | | | | | | 3b5143bb67cdaaff6b0eabedff1034e4add7ec87 already fixed a crash with the same stack trace in dev. The same fix works with the referenced bug report. Task-number: QTBUG-66483 Change-Id: I05450d2ff40f317d9b5b59e28991fa92b414022e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * Doc: add "Sizing" section to ScrollView's docsMitch Curtis2018-07-111-2/+16
| | | | | | | | | | | | | | | | Mention some important details about contentWidth and contentHeight. Task-number: QTBUG-69376 Change-Id: Iea6c6e36bb11436d30a0284a666c60ab7716f31b Reviewed-by: J-P Nurmi <jpnurmi@gmail.com>
| * Doc: Add AbstractButton.TextUnderIcon to display:enumeration listPaul Wicking2018-07-111-0/+1
| | | | | | | | | | | | Task-number: QTBUG-68298 Change-Id: I049ff1de079f065182429f43a20e1a3899f4a962 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Doc: provide code snippets for Overlay.modal and Overlay.modelessMitch Curtis2018-07-101-0/+10
| | | | | | | | | | Change-Id: I0ea789c0ba3a153b00ac3ab6501ecf10f6c733ce Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * Move all pendingCurrentIndex assignments to a private setterMitch Curtis2018-07-032-7/+13
| | | | | | | | | | | | | | | | | | This makes debugging significantly easier, in that it's now possible to use one qDebug() statement for the assignment rather than a handful at different places in the code. Change-Id: Ic6fdc2943b6eeb0496148b07d7a3ece0b6399c1b Reviewed-by: Liang Qi <liang.qi@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-07-031-1/+1
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/Menu.qml src/imports/controls/fusion/Menu.qml src/imports/controls/imagine/Menu.qml src/imports/controls/material/Menu.qml src/imports/controls/universal/Menu.qml Change-Id: I017949e5ac617c1cdeece71204e5aa519776fb39
| * QQuickTumblerAttachedPrivate: fix type of variable: int => qrealMitch Curtis2018-06-251-1/+1
| | | | | | | | | | | | | | Not sure why this was ever an integer... Change-Id: Ibfa2a547741328a7492c0da1c5cc87d5f6f885e1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-06-253-66/+98
|\| | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/imagine/TextArea.qml src/imports/controls/imagine/TextField.qml tests/auto/controls/data/tst_tumbler.qml Change-Id: I25a8228a4299fb7a53db70b7223663a1637ed933
| * QQuickSpinBox: Fix "function expressions as statements" warningMitch Curtis2018-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | Surround the function with parentheses as suggested: QWARN : tst_Snippets::verify(qtquickcontrols2-spinbox-custom) Warning: Using function expressions as statements in scripts is not compliant with the ECMAScript specification: "function(value, locale) { return Number(value).toLocaleString(locale, ..." This will throw a syntax error in Qt 5.12. If you want a function expression, surround it by parentheses. Change-Id: I39df9af9b3dc62ffaf6fcba071c04c8933698c07 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Fix Tumbler not respecting currentIndex changes in onModelChangedMitch Curtis2018-06-132-65/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The use case in the referenced bug report looks something like this: Tumbler { model: 4 // ... onModelChanged: { currentIndex = model - 2; } } The problem was that setting currentIndex in onModelChanged would cause the wrap to change to true, which in turn caused the internal view to change to PathView. This would cause the currentIndex to be set to 0 on successive model changes (i.e ++model). By keeping track of whether or not the user set the currentIndex during a model change, we can ignore changes in the internal view's currentIndex and restore the user's currentIndex afterwards. Task-number: QTBUG-68737 Change-Id: I25738f36cf58a331d1b8e50b5029b4aa1dd27db5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | QQuickControl: only set hasBackgroundWidth/Height when necessaryMitch Curtis2018-06-061-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following binding in the Fusion style's TabButton.qml implementation causes the last tab's background not to cover its full width: height: control.height - (control.checked ? 0 : 2) It seems that this line is executed upon the completion of deferred execution of the background, which somehow results in the early return check in itemGeometryChanged() not being executed. After that, there are these two lines: extra.value().hasBackgroundWidth = p->widthValid; extra.value().hasBackgroundHeight = p->heightValid; Even though this was just a change in height, hasBackgroundWidth was set to true early on (when the width was 8; the combined left and right padding), preventing the control from setting a width on the background in the future. This patch fixes the issue by only setting hasBackgroundWidth if the width was changed, and only setting hasBackgroundHeight if the height was changed. Task-number: QTBUG-68556 Change-Id: I4c7dbc60d8e73c60c025e5d6c65f3917e6e4ea08 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Create and init QQuickTheme from QtQuickControls2PluginJ-P Nurmi2018-05-223-34/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of creating and setting the QQuickTheme instance from each style plugin (e.g. QtQuickControls2MaterialStylePlugin), create the QQuickTheme instance in QtQuickControls2Plugin when the style is being resolved, and just pass the instance to be initialized by the style plugin(s). This avoids the problem that QQuickTheme API was virtual, and sub-classes created from plugins would have vtables destroyed before the QQuickTheme was destroyed. Task-number: QTBUG-67062 Task-number: QTBUG-68087 Change-Id: I19e9ced5296b708c2668c30163389cb3da6be7cf Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickTheme: rename themeFont() and themePalette()J-P Nurmi2018-05-2234-74/+74
| | | | | | | | | | | | | | We don't have the conflicting virtual getters anymore. Change-Id: Ia20bfa0a0b1aa67c35a23270eb0241018f8e0ada Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickTheme: add setters to make getters non-virtualJ-P Nurmi2018-05-223-31/+29
| | | | | | | | | | | | | | | | | | | | This allows us to add more themable attributes (on the side of fonts and palettes) after the QQuickTheme API has been made public, because it won't require adding virtuals. Only the resolve() method is virtual. Task-number: QTBUG-67062 Change-Id: I6a5cc8d15aeaa5a9a0fe9b6d2591077f8822daac Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Rename QQuickTheme::current to instanceJ-P Nurmi2018-05-163-13/+7
| | | | | | | | | | | | | | | | Avoid giving a wrong impression that the theme instance could be changed on the fly. Change-Id: Ifb5078422385d2f15da6a416d89cc9d6f46b0f40 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Dial: add inputMode propertyMitch Curtis2018-05-152-2/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This property adds two new ways of interacting with the dial: horizontally and vertically. These new input modes use a relative input system, which means that, unlike the old absolute input system, changes to the dial's position are "added" to its value. This results in a dial that is less "jumpy", making it safe for operations that could be harmful if done incorrectly, like adjusting audio levels. [ChangeLog][Controls][Dial] Added the inputMode property. This property controls how the dial is interacted with. The circular input mode (default, old behavior) operates on an absolute input system, whereas the horizontal and vertical input modes use a relative input system. Task-number: QTBUG-56323 Change-Id: Iab4e7f048b4797ab626741326ce709914e67bd31 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Non-QQuickControls: fix background resizingJ-P Nurmi2018-05-083-6/+6
| | | | | | | | | | | | | | | | | | | | When this code was copied from QQuickControl, it was accidentally inserted to a wrong place. We need to check widthValid and heightValid _before_ resizing the background. This will be implicitly tested by the next commit that makes the Imagine style use insets. Change-Id: I62532f5fd53d5814b05777459074079a24ed8cc6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-05-0780-1089/+431
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0483-1065/+406
| | | | | | | | | | | | | | | | | | | | | | 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>
| * Fix QQuickPopupPositionerJ-P Nurmi2018-05-042-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a double-regression caused by commits bcd1bed and 03a8c88. Both of these changes caused dangling pointers being left on the list of item change listeners. First, bcd1bed made QQuickPopupPositioner use QQuickItem::isAncestorOf() without noticing the difference that the old self-made isAncestorOf() conveniently returned true for the item itself, whereas the new built-in QQuickItem::isAncestorOf() doesn't. This had a nasty side effect that when the popup's parent item was removed from its parent, QQuickPopupPositioner::itemChildRemoved() no longer removed the ancestor listeners. Then, 03a8c88 made things worse by changing the stack allocation of QQuickPopupPositioner to heap allocation without ever deleting the positioner object. Valgrind output for tst_tooltip: ==14391== Invalid read of size 8 ==14391== at 0x79EFB9A: QQuickItemPrivate::itemChange(QQuickItem::ItemChange, QQuickItem::ItemChangeData const&) (qquickitem.cpp:6206) ==14391== by 0x79F3D98: QQuickItem::setParentItem(QQuickItem*) (qquickitem.cpp:2791) ==14391== by 0x79F3E87: QQuickItem::~QQuickItem() (qquickitem.cpp:2385) ==14391== by 0x7A16073: ~QQmlElement (qqmlprivate.h:103) ==14391== by 0x7A16073: QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement() (qqmlprivate.h:103) ==14391== by 0x7A9CFEE: QQuickView::~QQuickView() (qquickview.cpp:218) ==14391== by 0x4038215: quick_test_main_with_setup(int, char**, char const*, char const*, QObject*) (quicktest.cpp:512) ==14391== by 0x4038CFF: quick_test_main(int, char**, char const*, char const*) (quicktest.cpp:330) ==14391== by 0x400BD7: main (tst_default.cpp:44) ==14391== Address 0x1f2d3f10 is 0 bytes inside a block of size 32 free'd ==14391== at 0x4C2F29C: operator delete(void*) (vg_replace_malloc.c:576) ==14391== by 0x29CA2641: QQuickPopupPositioner::~QQuickPopupPositioner() (qquickpopuppositioner.cpp:68) ==14391== by 0x29CA004C: QQuickPopup::~QQuickPopup() (qquickpopup.cpp:783) ==14391== by 0x2A1A4CEE: ~QQuickToolTip (qquicktooltip_p.h:59) ==14391== by 0x2A1A4CEE: ~QQmlElement (qqmlprivate.h:103) ==14391== by 0x2A1A4CEE: QQmlPrivate::QQmlElement<QQuickToolTip>::~QQmlElement() (qqmlprivate.h:103) ==14391== by 0x6397A65: QObjectPrivate::deleteChildren() (qobject.cpp:1997) ==14391== by 0x6398DDA: QObject::~QObject() (qobject.cpp:1025) ==14391== by 0x79F41FA: QQuickItem::~QQuickItem() (qquickitem.cpp:2378) ==14391== by 0x7A897D5: QQuickMouseArea::~QQuickMouseArea() (qquickmousearea.cpp:452) ==14391== by 0x7A1699D: ~QQmlElement (qqmlprivate.h:103) ==14391== by 0x7A1699D: QQmlPrivate::QQmlElement<QQuickMouseArea>::~QQmlElement() (qqmlprivate.h:103) ==14391== by 0x639082D: qDeleteInEventHandler(QObject*) (qobject.cpp:4603) ==14391== by 0x6392478: QObject::event(QEvent*) (qobject.cpp:1242) ==14391== by 0x79F1D77: QQuickItem::event(QEvent*) (qquickitem.cpp:8006) ==14391== Block was alloc'd at ==14391== at 0x4C2E226: operator new(unsigned long) (vg_replace_malloc.c:334) ==14391== by 0x29C9F939: QQuickPopupPrivate::init() (qquickpopup.cpp:280) ==14391== by 0x29C9FD4E: QQuickPopup::QQuickPopup(QQuickPopupPrivate&, QObject*) (qquickpopup.cpp:771) ==14391== by 0x29CC6CBB: QQuickToolTip::QQuickToolTip(QQuickItem*) (qquicktooltip.cpp:171) ==14391== by 0x2A1A58DD: QQmlElement (qqmlprivate.h:98) ==14391== by 0x2A1A58DD: void QQmlPrivate::createInto<QQuickToolTip>(void*) (qqmlprivate.h:107) ==14391== by 0x5D0186D: QQmlType::create(QObject**, void**, unsigned long) const (qqmlmetatype.cpp:915) ==14391== by 0x5D81EFF: QQmlObjectCreator::createInstance(int, QObject*, bool) (qqmlobjectcreator.cpp:1163) ==14391== by 0x5D85AE2: QQmlObjectCreator::create(int, QObject*, QQmlInstantiationInterrupt*) (qqmlobjectcreator.cpp:203) ==14391== by 0x5D82230: QQmlObjectCreator::createInstance(int, QObject*, bool) (qqmlobjectcreator.cpp:1202) ==14391== by 0x5D82F65: QQmlObjectCreator::setPropertyBinding(QQmlPropertyData const*, QV4::CompiledData::Binding const*) (qqmlobjectcreator.cpp:825) ==14391== by 0x5D85105: QQmlObjectCreator::setupBindings(bool) (qqmlobjectcreator.cpp:777) ==14391== by 0x5D857C5: QQmlObjectCreator::populateInstance(int, QObject*, QObject*, QQmlPropertyData const*) (qqmlobjectcreator.cpp:1456) Change-Id: Id368e79146f4673708a84253a009fcdf24ab4a2c Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Document the default value of ComboBox's currentIndex propertyMitch Curtis2018-05-021-0/+2
| | | | | | | | | | Change-Id: I60dbf84127c800a5f0590ae46c4be3ece7ca3141 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Fix crash in tst_controlsSimon Hausmann2018-05-031-1/+1
| | | | | | | | | | | | | | | | After commit 127659c45020a83b80eeed7106c1f377a36c5c77 in qtdeclarative, QQuickWindow::contentItem() may now return a null pointer. Change-Id: I29e6aed43125d1fced620e800354abd449dfb3ae Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Make QQuickPopupPrivate::reposition() non-virtualJ-P Nurmi2018-05-031-1/+1
| | | | | | | | | | Change-Id: I3b028dd28cc7ca15a2d1319afdb529d4b8cacca9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Replace QQuickMenuPrivate::reposition() with QQuickMenuPositionerJ-P Nurmi2018-05-032-11/+29
| | | | | | | | | | Change-Id: Iea8c1b8609778604af06cc70eaefad21f00186bd Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Replace QQuickDrawerPrivate::reposition() with QQuickDrawerPositionerJ-P Nurmi2018-05-022-5/+24
| | | | | | | | | | Change-Id: I64567cf88b14d407e4888b8c2ae921322af0e154 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickPopup: prepare for overriding the positionerJ-P Nurmi2018-05-024-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Create the positioner lazily to make it possible for QQuickPopup sub-classes to override the positioner, and give the upcoming QQuickPopupPositioner sub-classes access to the popup instance. - QQuickDrawer has custom positioning along the window edges - QQuickMenu has custom positioning for cascading sub-menus - in the future, native menus, native tooltips, and top-level popups/dialogs will also need different positioners. Change-Id: I7c3ac2c38b00ef92410b2cdf4e51fa974efb534f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Cleanup QQuickPopupAnchorsJ-P Nurmi2018-05-024-40/+15
| | | | | | | | | | | | | | | | Don't access QQuickPopupPositioner directly, but call QQuickPopup's reposition() method instead so that we can lazy-create the positioner. Change-Id: Ieb6a6adf187fba8b4829e32e7656a25c5e82cfc3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | TextArea: add support for background insetsJ-P Nurmi2018-05-023-21/+239
| | | | | | | | | | | | | | | | | | | | | | Same as 5adce042 for QQuickControl. [ChangeLog][Controls][TextArea] Added topInset, bottomInset, leftInset, and rightInset properties to control the geometry of the background similarly to how paddings control the geometry of the contentItem. Change-Id: I1e1b3a79a9f477ec7b64ec4c6cc8021bbf48adc0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | TextField: add support for background insetsJ-P Nurmi2018-05-023-14/+250
| | | | | | | | | | | | | | | | | | | | | | Same as 5adce042 for QQuickControl. [ChangeLog][Controls][TextField] Added topInset, bottomInset, leftInset, and rightInset properties to control the geometry of the background similarly to how paddings control the geometry of the contentItem. Change-Id: Ic1e4c15fd4b06a58f229b5156668c9a986f7bc3f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Label: add support for background insetsJ-P Nurmi2018-05-023-14/+250
| | | | | | | | | | | | | | | | | | | | | | Same as 5adce042 for QQuickControl. [ChangeLog][Controls][Label] Added topInset, bottomInset, leftInset, and rightInset properties to control the geometry of the background similarly to how paddings control the geometry of the contentItem. Change-Id: I853efcdd6be1d3acfb067128b6195c253350de8d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add missing implicitBackground{Width|Height} to non-QQuickControlsJ-P Nurmi2018-05-0211-8/+294
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Same as 5bd9d44b for QQuickControl. [ChangeLog][Controls][Label] Added implicitBackgroundWidth and implicitBackgroundHeight properties that can be used to simplify complex implicit size bindings. [ChangeLog][Controls][TextArea] Added implicitBackgroundWidth and implicitBackgroundHeight properties that can be used to simplify complex implicit size bindings. [ChangeLog][Controls][TextField] Added implicitBackgroundWidth and implicitBackgroundHeight properties that can be used to simplify complex implicit size bindings. Change-Id: Idcc2d9af8df086b41c15f352506fd8afdbb2e3e7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>