aboutsummaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-beta2Qt Forward Merge Bot2019-04-063-34/+25
|\ | | | | | | Change-Id: I5b112e0e4021191c387da86bb5b0477fe0c4da30
| * tst_dialogbuttonbox.qml: consolidate two similar testsMitch Curtis2019-03-291-24/+11
| | | | | | | | | | | | | | into one data-driven one. Change-Id: I7507765747dd984530e50df5cd08152b9d71cb66 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * tst_dialogbuttonbox.qml: use tryVerify() consistently to avoid flakinessMitch Curtis2019-03-291-8/+12
| | | | | | | | | | | | Change-Id: Ic18cca692b09f55818b9c99379aae4be72ba4159 Fixes: QTBUG-74711 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * Attempt to stabilize Tumbler::test_itemsCorrectlyPositionedMitch Curtis2019-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | I'm not sure if this will help (because I haven't been able to reproduce the flakiness, even in a CI VM), but the tumbler should really not still be spinning after we got the position of its items, so make sure it's stopped before doing any comparisons. Task-number: QTBUG-70597 Change-Id: I72555747b2ea4ef136cdaa13f7b0757be2624e73 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * Mark BaseValidator::throwRecursionDepthError() as finalUlf Hermann2019-03-271-1/+1
| | | | | | | | | | | | Task-number: QTBUG-74512 Change-Id: I7b154d793c134a93aa3a48ade7d3ae785c44e7ea Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-271-0/+29
|\| | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I37f9f88a11946d5d67935c682273eb0aa8593f9b
| * DialogButtonBox: don't sort buttons based on their memory addressesMitch Curtis2019-03-221-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When two buttons' roles are equal, the code would fall back to comparing the buttons' memory addresses. This leads to random results, which are especially noticeable on Windows and with release builds. This patch fixes the issue by instead returning false if the roles are equal. This still satisfies the "comp(a,a)==false" requirement of strict weak ordering: https://en.cppreference.com/w/cpp/named_req/Compare The patch also changes the sorting algorithm used from std::sort() to std::stable_sort(). Although it doesn't appear to be necessary from the testing that I did, it is good to ensure that the order of equal elements is maintained. Fixes: QTBUG-70451 Change-Id: I47561604108b12bf8ec0c794a2372767f0b2e04e Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-201-0/+6
|\| | | | | | | Change-Id: Id548fd29dd5cc357c4bd00c3c842006f2d62c758
| * Handle recursion depth errors in tst_sanity.cppUlf Hermann2019-03-181-0/+6
| | | | | | | | | | | | | | | | Implementations of QQmlJS::AST::Visitor are required to do so. Fixes: QTBUG-74512 Change-Id: I19d40d2d3a5d3588cad4caa7f0a48c13919077a0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-161-2/+134
|\| | | | | | | Change-Id: If27c142786ad2457a80ce1ef65220834eda81e94
| * Fix DialogButtonBox content size calculationMitch Curtis2019-03-151-2/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some history: - f1f884d3 worked around an issue in DialogButtonBox. - c2fd8f7d fixed it by using contentWidth; i.e. the implicit width of the contentItem. It caused QTBUG-72372. - I tried to fix QTBUG-72372 with 6476de0b, but created (or exposed) QTBUG-73860. The problem in QTBUG-73860 can be seen with the following example: Dialog { id: dialog visible: true standardButtons: Dialog.Ok } The single 'Ok' button here will go outside of the dialog. The underlying issue can be seen by looking into DialogButtonBox.qml: implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, (control.count === 1 ? contentWidth * 2 : contentWidth) + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, contentHeight + topPadding + bottomPadding) The implicit width of the box in this case is contentWidth * 2 (there is one button, so control.count === 1). This should result in the button taking half the width of the box and being aligned to the right: alignment: count === 1 ? Qt.AlignRight : undefined ... delegate: Button { width: control.count === 1 ? control.availableWidth / 2 : undefined } What actually happens is that the contentItem (ListView) is temporarily 0 until it gets its final size of 100. However, QQuickDialogButtonBox doesn't respond to this change in the ListView's contentWidth. This problem can be fixed by returning to c2fd8f7d's resizeContent() implementation, which uses contentWidth. Then, there is a second issue: Dialog { id: dialog visible: true standardButtons: Dialog.Ok width: 300 } The button here is also positioned outside of the box. The problem is that the contentWidth is based on implicitContentWidth: QQuickContainerPrivate::updateContentWidth() { // ... contentWidth = implicitContentWidth; // ... } implicitContentWidth is calculated by calling getContentWidth(): void QQuickControlPrivate::updateImplicitContentWidth() { // ... implicitContentWidth = getContentWidth(); // ... } In the case of horizontal alignment, QQuickDialogButtonBoxPrivate::getContentWidth() uses the implicit width of the largest button: for (int i = 0; i < count; ++i) { QQuickItem *item = q->itemAt(i); if (item) { totalWidth += item->implicitWidth(); maxWidth = qMax(maxWidth, item->implicitWidth()); } } // ... if ((alignment & Qt::AlignHorizontal_Mask) == 0) totalWidth = qMax(totalWidth, count * maxWidth + totalSpacing); The Default style button has an implicitWidth of 100. The DialogButtonBox in the example above is 300 pixels wide, so the button should be 150, and it is, thanks to its width binding. However, the DialogButtonBox uses contentWidth to size its contentItem (ListView), and the contentWidth is, as mentioned, 100: the implicit width of the button. So, the button ends up hanging over the side of the box, as it's larger than the box thinks it is. This problem is fixed by setting DialogButtonBox's contentWidth to the contentWidth of the contentItem (ListView). This makes DialogButtonBox use the explicit widths of the buttons rather than their implicit widths. Since the contentWidth is no longer implicit, we must also change any use of contentWidth in the implicitWidth binding to implicitContentWidth. While writing auto tests for this, they caught an issue where contentWidth wasn't updated, so now we call resizeContent() in QQuickContainer::setContentWidth(). Change-Id: I99ffda21b47aeb14d4382e453e87c4312f343a1c Fixes: QTBUG-72886 Fixes: QTBUG-73860 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Fix SplitView crash when using certain attached propertiesv5.13.0-beta1Mitch Curtis2019-03-111-7/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the attached property object was created on an item that SplitView doesn't manage, then its m_splitView member will be null, so check for that. Sometimes, an attached SplitView object will be created on an item that SplitView _does_ manage, but SplitView's own contentItem hasn't been created yet (see the comment in the QQuickSplitViewAttached constructor). In that case the SplitView will see the item added as a child of its contentItem eventually, and we just have to wait. While we are waiting, check access to our members in case they are null. Fixes: QTBUG-74276 Change-Id: I70b7f017e621e0d15c239b962f0407743eb70b15 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-092-0/+154
|\| | | | | | | Change-Id: I34009799fe4016339920a7f0884af4dbe6d71418
| * Fix attached ToolTips using the timeout of the last shown tool tipMitch Curtis2019-03-081-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Attached ToolTips share a single ToolTip item and set properties (such as delay) on it before showing it. Before 63899f3185, this wasn't a problem, but now QQuickToolTip has its own show() function that QQuickToolTipAttached calls. QQuickToolTipAttached passes -1 by default, which QQuickToolTip sees as the "default" and hence doesn't set a timeout at all. However, since that QQuickToolTip instance is shared, it still has a previous timeout value from the last time it was shown by a different QQuickToolTipAttached object. So, instead of QQuickToolTipAttached passing the timeout to QQuickToolTip::show(), make it set it on the QQuickToolTip instead. This ensures that it has the correct value if no timeout was specified for an attached tool tip. Task-number: QTBUG-74226 Change-Id: Iceed17bbb640a929fae3b9c975519df36cc2d210 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
| * QQuickScrollView: respect the content size set on/by the flickableRichard Moe Gustavsen2019-03-051-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the flickable inside a scrollview has an explicit content size assigned, or if the flickable was created by the application, then don't fall back to calculate the content size. The reason is that it should not try to change the content size of a flickable that is controlled by the application (or by the flickable itself, in the case of ListView, ScrollView and TextArea). Sometimes e.g ListView will report a negative contentWidth, which is not considered illegal. From before we used to just check if the child flickable had a negative content size, and if so, take that as a evidence that the flickable was owned by the scrollview. But with this patch, we instead add two extra variables that keeps explicit track of whether or not we should read the content size from the flickable, regardless of the values it might return. With the two new variables, we also no longer need the "ownsFlickable" property, as we can instead use the new variables to check for the same. Fixes: QTBUG-72536 Fixes: QTBUG-74000 Fixes: QTBUG-72940 Change-Id: Iec87cc953557bf8c1bdb32a3c11b721c607fc19a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | SplitView: fix revisions, imports and \since versionsMitch Curtis2019-03-074-10/+10
| | | | | | | | | | | | | | | | Work was probably started before 5.12 but the patch ended up getting merged in time for 5.13. It seems that I forgot to update the versions. Change-Id: I19edf08158cca0967a7a536b3aee326e3b393d4c Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-0211-1/+670
|\| | | | | | | Change-Id: Ibd3a8a111ce70643199c64f41143f332a34826f8
| * Fix tst_cursor::controls(containers) test failing after change in the ↵Friedemann Kleint2019-03-011-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | Windows QPA The test failed in case the mouse cursor was within the view to be created. Move the cursor away to prevent that. Fixes: QTBUG-74130 Change-Id: I8d77fc9b4cc5380ddb06ba128bca7c1666357b50 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
| * QQuickMenu: allow enter/return to be used to activate itemsMitch Curtis2019-02-281-1/+30
| | | | | | | | | | | | | | | | | | | | | | Before this patch, only space was allowed. Windows 10 and macOS 10.14.2 both allow using enter to activate menu items. Change-Id: I64476347669ff73f233efd129563a18ba51618a5 Fixes: QTBUG-73354 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * Add dialogs manual testMitch Curtis2019-02-227-0/+529
| | | | | | | | | | | | | | | | | | | | As with the buttons manual test, there are a lot of possible combinations of dialogs, which makes automated testing very difficult. This test will allow us to see lots of different combinations all at once for a particular style. Change-Id: I42fa5a1e027c9f56bebf859078d3e54fe1902228 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
| * Drawer: fix infinite positioning loopMitch Curtis2019-02-222-0/+94
| | | | | | | | | | | | | | | | | | This fixes the issue where Drawer would try to reposition itself forever, but does not address the fact that it is incorrectly positioned afterwards. Task-number: QTBUG-71290 Change-Id: Ibbd4baa84b66ab446ce3af2ef326f8c50e74216d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | gifrecorder: fix process timing outMitch Curtis2019-02-251-1/+2
| | | | | | | | | | | | | | Give conversion a longer time to finish. Change-Id: Iacc403906f9094ffc688f8c98c401b88bc935961 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | gifrecorder: improve the codeMitch Curtis2019-02-251-22/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Rename startProcess() to waitForProcessToStart(), since that's what it does, and it makes it consistent with waitForProcessToFinish(). - Add ProcessWaitResult struct for error reporting and make both waitForProcessToStart() and waitForProcessToFinish() use it. This allows us to stop using QFAIL in helper functions, which will not abort the test. - Add some double quotes in debug output to help readability. - Add code comments to explain stuff that I've forgotten and had to look up. Change-Id: Ie54c0ee752d57acd3501b72025fc1eb482dfa238 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | gifrecorder: Use ffmpeg instead of the deprecated avconvVenugopal Shivashankar2019-02-251-7/+7
| | | | | | | | | | | | | | | | | | The libav-tools that provides the avconv tool is deprecated since Ubuntu 18.04 release. The ffmpeg pkg is the alternative suggested. Change-Id: I5d3d3b9409448402f67a7481827f0f1925cbb89f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Fix heap-use-after-free in tst_gifsMitch Curtis2019-02-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The return value of qPrintable should not be stored. The shortened ASAN output: ================================================================= ==23322==ERROR: AddressSanitizer: heap-use-after-free on address 0x6060002b4e58 at pc 0x7f8b035f7569 bp 0x7fff7ea38530 sp 0x7fff7ea38520 READ of size 1 at 0x6060002b4e58 thread T0 #0 0x7f8b035f7568 in QMetaObject::indexOfProperty(char const*) const /home/mitch/dev/qt5-dev/qtbase/src/corelib/kernel/qmetaobject.cpp:1015 #1 0x7f8b03687194 in QObject::property(char const*) const /home/mitch/dev/qt5-dev/qtbase/src/corelib/kernel/qobject.cpp:3891 #2 0x55a59f4cc085 in tst_Gifs::checkables() /home/mitch/dev/qt5-dev/qtquickcontrols2/tests/manual/gifs/tst_gifs.cpp:737 0x6060002b4e58 is located 24 bytes inside of 64-byte region [0x6060002b4e40,0x6060002b4e80) freed by thread T0 here: #0 0x7f8b0708c7b8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8) #1 0x7f8b02fcc0a2 in QArrayData::deallocate(QArrayData*, unsigned long, unsigned long) /home/mitch/dev/qt5-dev/qtbase/src/corelib/tools/qarraydata.cpp:167 #2 0x55a59f4cbf5c in QTypedArrayData<char>::deallocate(QArrayData*) /home/mitch/dev/qt5-dev-debug/qtbase/include/QtCore/../../../../qt5-dev/qtbase/src/corelib/tools/qarraydata.h:239 #3 0x55a59f4cbf5c in QByteArray::~QByteArray() /home/mitch/dev/qt5-dev-debug/qtbase/include/QtCore/../../../../qt5-dev/qtbase/src/corelib/tools/qbytearray.h:476 #4 0x55a59f4cbf5c in tst_Gifs::checkables() /home/mitch/dev/qt5-dev/qtquickcontrols2/tests/manual/gifs/tst_gifs.cpp:736 previously allocated by thread T0 here: #0 0x7f8b0708cf40 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40) #1 0x7f8b02fcb451 in reallocateData /home/mitch/dev/qt5-dev/qtbase/src/corelib/tools/qarraydata.cpp:83 #2 0x7f8b02fcbf7f in QArrayData::reallocateUnaligned(QArrayData*, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>) /home/mitch/dev/qt5-dev/qtbase/src/corelib/tools/qarraydata.cpp:146 #3 0x7f8b02fd58fa in QTypedArrayData<char>::reallocateUnaligned(QTypedArrayData<char>*, unsigned long, QFlags<QArrayData::AllocationOption>) ../../include/QtCore/../../../../qt5-dev/qtbase/src/corelib/tools/qarraydata.h:233 #4 0x7f8b02fd58fa in QByteArray::reallocData(unsigned int, QFlags<QArrayData::AllocationOption>) /home/mitch/dev/qt5-dev/qtbase/src/corelib/tools/qbytearray.cpp:1914 #5 0x7f8b02fd63c1 in QByteArray::resize(int) /home/mitch/dev/qt5-dev/qtbase/src/corelib/tools/qbytearray.cpp:1875 #6 0x7f8b0373c3a0 in QUtf8::convertFromUnicode(QChar const*, int, QTextCodec::ConverterState*) /home/mitch/dev/qt5-dev/qtbase/src/corelib/codecs/qutfcodec.cpp:456 #7 0x7f8b0373c653 in QUtf8Codec::convertFromUnicode(QChar const*, int, QTextCodec::ConverterState*) const /home/mitch/dev/qt5-dev/qtbase/src/corelib/codecs/qutfcodec.cpp:983 #8 0x7f8b0374918b in QTextCodec::fromUnicode(QStringView) const /home/mitch/dev/qt5-dev/qtbase/src/corelib/codecs/qtextcodec.cpp:846 #9 0x7f8b0311c01a in qt_convert_to_local_8bit /home/mitch/dev/qt5-dev/qtbase/src/corelib/tools/qstring.cpp:5369 #10 0x7f8b031366cb in QString::toLocal8Bit_helper(QChar const*, int) /home/mitch/dev/qt5-dev/qtbase/src/corelib/tools/qstring.cpp:5359 #11 0x55a59f4cbd70 in QString::toLocal8Bit() && /home/mitch/dev/qt5-dev-debug/qtbase/include/QtCore/../../../../qt5-dev/qtbase/src/corelib/tools/qstring.h:556 #12 0x55a59f4cbd70 in tst_Gifs::checkables() /home/mitch/dev/qt5-dev/qtquickcontrols2/tests/manual/gifs/tst_gifs.cpp:736 Change-Id: I5a967607e7ebff5177261f32222b9f50ee65d35e Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-02-0913-1/+731
|\| | | | | | | Change-Id: I8aded0949d38315d4d22fa511f83331d7caf3145
| * Popup: ensure that "palette" is reevaluated when enabled state changesMitch Curtis2019-02-052-0/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When changing the enabled state of a Menu after component completion, the background would not change. The problem was that QQuickPopup::paletteChanged() was not being emitted when the enabled state changed, resulting in QQuickControl::palette() (which QQuickPopup::palette() forwards calls to via its popupItem) not being called. QQuickControl::palette() changes the palette's current color group to QPalette::Disabled when it is disabled, so if it's not called, the popup's colors won't change. Fix the issue by adding a virtual enabledChange() function to QQuickControl, which QQuickPopupItem can override to emit both QQuickPopup::enabledChanged() (saving a connection in the process) and QQuickPopup::paletteChanged(). This ensures that bindings to QQuickPopup::palette are re-evaluated. The patch adds a virtual instead of just emitting paletteChanged() in QQuickPopup::setEnabled(), because we also want to be notified of indirect enabled state changes, such as those coming from parent items. Change-Id: Ibdbd05f27b5a74fe731bda9d6698cbf6b8f81785 Fixes: QTBUG-73447 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * QQuickMenu: don't give focus to disabled menu itemsMitch Curtis2019-02-042-0/+138
| | | | | | | | | | | | Change-Id: I7eb394ca3991eae585fbbd8e665c46b11ef64a07 Fixes: QTBUG-70181 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
| * Menu: fix disabled sub-menu items being highlightedMitch Curtis2019-02-042-0/+202
| | | | | | | | | | | | | | | | | | | | | | 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>
| * Fix font and palette settings in .conf files not being respectedMitch Curtis2019-02-047-1/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 5.11, the font palette read from the qtquickcontrols2.conf file was respected. After some large architectural changes (around the time of 94780538) required to fix a crash, 5.12 stopped respecting these settings. This patch fixes the issue by setting the default font as the System scope font, because that's what QQuickControlPrivate::parentFont() uses as its fallback if no parent item has a font explicitly set. QQuickControlPrivate::parentFont() is used as the starting point for font inheritance/resolution for each control. The same fix is used for palettes. Change-Id: I706a9f109c9959b8ea6b91f842146dbfc876cb2b Fixes: QTBUG-72023 Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
| * Fix Menu not being dismissed when the triggered item disables itselfMitch Curtis2019-02-042-0/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem Consider the following code: Menu { title: "Menu" Action { text: "Item" onTriggered: enabled = false } } A MenuItem (AbstractButton) is created for the Action, and when it is clicked, this function is called: void QQuickAbstractButtonPrivate::trigger() { Q_Q(QQuickAbstractButton); if (action && action->isEnabled()) QQuickActionPrivate::get(action)->trigger(q, false); else if (effectiveEnable) emit q->clicked(); } QQuickActionPrivate::get(action)->trigger(q, false) results in this function being called: void QQuickAbstractButtonPrivate::click() { Q_Q(QQuickAbstractButton); if (effectiveEnable) emit q->clicked(); } Since the action (and hence the menu item) was disabled in the signal handler, the effectiveEnable check fails and clicked() is not emitted. This causes the menu to not be dismissed. Solution Before calling QQuickActionPrivate::get(action)->trigger(), store the button's enabled state. If triggering the action causes the action to be disabled (due to the signal handler), we can then choose whether or not we emit QQuickAbstractButton::clicked(). Specifically, we emit clicked() if: - we were enabled before triggering the action, and - we have no associated action, or it's no longer enabled Task-number: QTBUG-69682 Change-Id: Ib4e3c313b776decc74089a6beffe415605c430be Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-alpha1Qt Forward Merge Bot2019-02-022-0/+11139
|\| | | | | | | Change-Id: I13c6458d7a7f92daf58c12e4c120d99a1f56cbfa
| * Merge remote-tracking branch 'origin/5.12.1' into 5.12Qt Forward Merge Bot2019-02-011-0/+11123
| |\ | | | | | | | | | Change-Id: I555418c45b33fa9bc02072b32736403090f1bdbc
| | * QQuickAbstractButton: fix clicked() not being emitted after long pressv5.12.1Mitch Curtis2019-01-251-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a button is pressed long enough (QStyleHints::mousePressAndHoldInterval()) and there is a connection (e.g. signal handler) to the pressAndHold() signal, it is emitted. If nothing is connected to the signal, clicked() is emitted. Before this patch, QQuickAbstractButton used QObjectPrivate::isSignalConnected() to check whether or not anything was connected to pressAndHold(). The problem with this function is described by Olivier: "[...] there is an optimisation for the first 64 signals we store a bit in a 64bit integer to quickly see if a signal is connected. There is also the problem that it can return true even if the signal has been disconnected." This is also mentioned in a comment in the code: Returns \c true if the signal with index \a signal_index from object \a sender is connected. Signals with indices above a certain range are always considered connected (see connectedSignals in QObjectPrivate). When 5adce04 added inset signals to QQuickControl, it meant that signals in QQuickAbstractButton (which derives from QQuickControl) were pushed outside of that 64 signal range, resulting in the IS_SIGNAL_CONNECTED macro returning true. This patch fixes the issue by using QObject::isSignalConnected(), which does not use the 64 signal optimization. Fixes: QTBUG-72811 Change-Id: Ic6e54d6cab062e528522ef7e3cf27c1023d31347 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit bbc81363f082ab6a2736f8de83968a3941e367e2) Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
| | * Merge 5.12 into 5.12.1Kari Oikarinen2019-01-082-0/+31
| | |\ | | | | | | | | | | | | Change-Id: I442b103e352bc49b35fb816104c87c112e2fd958
| | * | Add binary compatibility file for QtQuickĆontrols2 for Qt 5.12Milla Pohjanheimo2018-12-181-0/+11123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Binary compatibility file added. Change-Id: Icc07524dfd195642a2e5fc2d566f4270e4f505e0 Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
| * | | QQuickAbstractButton: fix clicked() not being emitted after long pressMitch Curtis2019-01-231-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a button is pressed long enough (QStyleHints::mousePressAndHoldInterval()) and there is a connection (e.g. signal handler) to the pressAndHold() signal, it is emitted. If nothing is connected to the signal, clicked() is emitted. Before this patch, QQuickAbstractButton used QObjectPrivate::isSignalConnected() to check whether or not anything was connected to pressAndHold(). The problem with this function is described by Olivier: "[...] there is an optimisation for the first 64 signals we store a bit in a 64bit integer to quickly see if a signal is connected. There is also the problem that it can return true even if the signal has been disconnected." This is also mentioned in a comment in the code: Returns \c true if the signal with index \a signal_index from object \a sender is connected. Signals with indices above a certain range are always considered connected (see connectedSignals in QObjectPrivate). When 5adce04 added inset signals to QQuickControl, it meant that signals in QQuickAbstractButton (which derives from QQuickControl) were pushed outside of that 64 signal range, resulting in the IS_SIGNAL_CONNECTED macro returning true. This patch fixes the issue by using QObject::isSignalConnected(), which does not use the 64 signal optimization. Fixes: QTBUG-72811 Change-Id: Ic6e54d6cab062e528522ef7e3cf27c1023d31347 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | | | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2019-01-212-0/+98
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ib3b90cce1f4422b308515b06e89b1c4a0bf7f474
| * | | QQuickPopupPositioner: fix crash on application exitMitch Curtis2019-01-142-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't add duplicate change listeners, since only one of them will be removed. Coincidentally, this is the same fix as d56c193e, which was reverted for unrelated reasons as part of a bulk revert in d3545dbd. Change-Id: If6fde09f884929c7928f3a1f78625559c9fcbf07 Fixes: QTBUG-72746 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | | | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-10670-1511/+1599
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/imports/controls/qtquickcontrols2plugin.cpp Change-Id: I27f1260b539354e084beb28be78385e57fda63e1
| * | | DialogButtonBox: fix issue where single button would go outside boxMitch Curtis2019-01-081-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c2fd8f7d made the following changes to the geometry calculation of QQuickDialogButtonBox's contentItem: @@ -244,11 +252,8 @@ void QQuickDialogButtonBoxPrivate::resizeContent() return; QRectF geometry = q->boundingRect().adjusted(q->leftPadding(), q->topPadding(), -q->rightPadding(), -q->bottomPadding()); - if (alignment != 0) { - qreal cw = (alignment & Qt::AlignHorizontal_Mask) == 0 ? q->availableWidth() : contentItem->property("contentWidth").toReal(); - qreal ch = (alignment & Qt::AlignVertical_Mask) == 0 ? q->availableHeight() : contentItem->property("contentHeight").toReal(); - geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(cw, ch), geometry); - } + if (alignment != 0) + geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(contentWidth, contentHeight), geometry); It turns out that this breaks the use case of a fixed width box (e.g. where a Dialog is assigned a width of 400 and the box assumes that width) with a single button. For example, in the case of the Default style, QQuickDialogButtonBox::contentWidth is 100 because Button's implicitWidth is 100. Since contentWidth is "used for calculating the total implicit width" of the box, it's not useful for positioning items which have an explicit width. The result is that QQuickDialogButtonBox thinks the contentItem is smaller than it really is, and therefore the ListView is positioned too far to the right. Only the Default and Universal styles are affected, as they are the only styles that resize the button to cover half of the button box. This patch fixes the issue by reverting the code above to its original state, where the content size of the contentItem is used instead of the contentWidth of the box. Change-Id: Idd2f94f3b4d3413fc2057c0ade2efdd66d701c08 Fixes: QTBUG-72372 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * | | Fix incorrect font size in certain styles on WindowsMitch Curtis2019-01-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a style is loaded, QtQuickControls2Plugin::loadStylePlugins() is called. This function uses QPluginLoader to search the style directory for the style plugin. On Windows, the code was looking for the plugin without the debug "d" suffix, causing the style plugin to fail to load for debug builds. This results in the QQuickTheme subclasses not being created, causing controls to be shown with default font sizes. This patch fixes the issue by appending the "d" suffix on Windows. Change-Id: I706dbe39325a104bcd6ce72cb0a8d37025adb055 Fixes: QTBUG-71902 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * | | Slider: fix wheel event propagationMassimo Callegari2019-01-081-0/+57
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | Don't propagate wheel events when reaching the limits. Sync the behavior with Qt widgets and SpinBox/ComboBox. Task-number: QTBUG-72750 Change-Id: Iefb8562c1d9632badc4a39bc4c301bd96b8a515b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * | Fix TextField background not respecting control's widthMitch Curtis2018-12-211-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After 6858d4e9, the background of the Material style TextField does not respect the width of the control if the control is resized (e.g. due to being in a layout). - The first time resizeBackground() is called, !extra.isAllocated() returns true - that is, extra has not been allocated yet. - The if statement is executed and the background's width is set to the available width of the control (e.g. 120). - As a result of the background's width being set, its widthValid flag is set to true. This would previously be undone directly afterwards by setting widthValid flag to false. - In the case of the test case, the implicitWidth was already 120, so geometryChanged is not emitted. However, when the height of the background is set, this *does* cause itemGeometryChanged() to be called, which in turn does the following: extra.value().hasBackgroundWidth = p->widthValid; extra.value().hasBackgroundHeight = p->heightValid; resizeBackground(); So now all of the following checks evaluate to false: (!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) This prevents the background from being resized. This patch fixes the issue by unsetting the widthValid (and heightValid) flags of the background directly after setting its width. To be safe, it also only unsets it if we were the ones to set it. By doing this, the check mentioned above succeeds because p->widthValid and extra->hasBackgroundWidth are both now false. It also adds some extra safety into itemGeometryChanged() that ensures that extra.value().hasBackgroundWidth is only set if necessary, and therefore prevents the extra data from unnecessarily being allocated. This is not necessary for the fix, but feels like the right thing to do. Change-Id: I051e281718bd8a2a20c100767d929fb71497ce1b Fixes: QTBUG-71875 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * | tst_QQuickStyle::availableStyles(): Ignore case when checking paths on WindowsFriedemann Kleint2018-12-121-0/+4
| |/ | | | | | | | | | | | | | | It is actually possible to get the test to fail in command line environments. Change-Id: I9e37e968bd259e3c7ad4acdb8bf289a64f199891 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Merge remote-tracking branch 'origin/5.12.0' into 5.12Qt Forward Merge Bot2018-12-05666-1511/+1318
| |\ | | | | | | | | | Change-Id: I7fe9e74beff3cdbfbf02ee0f129a8204ad31046e
| | * Revert all Menu delegate patchesv5.12.0-rc2v5.12.0-rc1v5.12.0Mitch Curtis2018-11-159-620/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * QQuickPage: fix a typo to avoid a crashLiang Qi2018-11-091-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * tst_qquickmenu: add a test for MenuItems before and after a Repeaterv5.12.0-beta4Mitch Curtis2018-11-022-1/+119
| | | | | | | | | | | | | | | | | | | | | | | | Just to verify that it works, as a similar test was added for Instantiator in another patch. Change-Id: I1ab55d98a3726bff1a2984db0d81ae444e05d630 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>