aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_abstractbutton.qml
Commit message (Collapse)AuthorAgeFilesLines
* Fix clicked() being emitted after doubleClicked()Mitch Curtis2020-02-201-0/+23
| | | | | | | | | | | | Do as MouseArea does, and keep track of double clicks ourselves, otherwise we think the second click is a regular click. This is for mouse events only; for touch we have bigger problems to solve first: QTBUG-82146 Change-Id: I46e816d0cfa1bab98a0a1685915842ebd176e762 Fixes: QTBUG-82032 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickIcon: properly resolve implicit valuesKonstantin Ritt2019-09-061-1/+7
| | | | | | | | when the property has not been set explicitly, the resolved mask must not contain a respective bit set either Change-Id: Iab0bd600b5bf458e26ed4601d4d2f608021f1518 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* 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>
* Tie minor version of all imports to Qt's minor versionMitch Curtis2018-11-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* tst_abstractbutton.qml: fix test_trigger()Mitch Curtis2018-06-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | bdb8cf49daf4a1c7dfb9bd9caf14e19e3aa66293 in qtdeclarative fixed compliancy with the ES7 spec by correcting the order in which properties were created/assigned. When the qt5 submodules were updated, some rows of AbstractButton::test_trigger() started failing because they were unknowingly relying on the incorrect ordering: var control = createTemporaryObject(actionButton, testCase, {"enabled": data.button, "action.enabled": data.action}) control.action.enabled was set first, and then control.enabled was set. The Action's enabled property can affect the value of Control's enabled property: Control's enabled property is always used if explicitly specified, but if it's not explicitly specified, it is set to the value of Action's enabled property. The motivation for this behavior is explained in 146bc9517c56feda4eba34282d3cc53bd47b6267: "The idea is that you share a generic Action in different places in the UI, and then you override things locally in specific controls." This patch restores the test's previous behavior by swapping the order of the properties so that control.enabled is assigned last. Task-number: QTBUG-68665 Change-Id: I6082c57a8fdbf7f7251dacbb55289fa996393a6e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-121-15/+206
|\ | | | | | | Change-Id: I2934d3f51fea9626fd2d2512786eb297d9f7fe6c
| * Make AbstractButton's icon properties win over Action's when both are setMitch Curtis2018-02-051-15/+206
| | | | | | | | | | | | Task-number: QTBUG-65193 Change-Id: Idff23dcc35f3c3fe41406678613b022098149318 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-091-1/+174
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf src/quicktemplates2/qquickabstractbutton_p.h Change-Id: I265cbd2ce51beaf2afef99292c2e2798dadb4ba3
| * tst_abstractbutton: add more test cases for button vs. action textJ-P Nurmi2017-12-221-1/+85
| | | | | | | | | | Change-Id: Ibf226b2f7af681a825a71f345932f887cb447f9c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Make AbstractButton's text win over action's when both are specifiedMitch Curtis2017-12-221-0/+26
| | | | | | | | | | | | | | | | | | | | | | The idea is that you share a generic Action in different places in the UI, and then you override things locally in specific controls. This patch enforces that by changing QQuickAbstractButton::text() to return the Button's text if explicitly set (or there isn't an Action), or the action's text if one is set. Change-Id: Iae422abca35c9598f73ba7a1d3f1387c36037ec0 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
| * Fix double toggling through Action with checked AbstractButtonJoni Poikelin2017-12-131-0/+63
| | | | | | | | | | | | | | | | | | | | | | Action caused checked state of the button to be reset back to its original value if checked status had been change through click or key press. To avoid this, separate private function has been added to that does not change the status. Task-number: QTBUG-65108 Change-Id: I8a5aaa9aab739db3ba10d0202f5fb718cc7195bd Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devJ-P Nurmi2017-11-061-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quickcontrols2/qquickchecklabel.cpp src/quickcontrols2/qquickchecklabel_p.h src/quickcontrols2/qquickmnemoniclabel_p.h src/quicktemplates2/qquickbuttongroup_p.h src/quicktemplates2/qquickspinbox.cpp src/quicktemplates2/qquickswipedelegate.cpp Change-Id: I1278b78dcaf25be5698f34751193b83dc951eb3c
| * Visualize mnemonicsJ-P Nurmi2017-11-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately this comes a bit late in the 5.10 cycle, but this should be released together with the rest of the mnemonics stuff going out in 5.10, because it affects the value of AbstractButton/Menu(Bar)Item::text. As the removed TODO comments and altered tests indicate, previously the ampersand was blatantly stripped out. It would be worse to change it later once people have already started using mnemonics and rely on the behavior in custom styles. The necessary modifications to QQuickText were added in qtdeclarative commit 65ef4ba. Task-number: QTBUG-61422 Change-Id: Iaa73da8c012e9a6019743cf98f5bdc02527064e5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickAbstractButton: expose the press pointJ-P Nurmi2017-10-271-0/+107
|/ | | | | | | | | | | | | This has been frequently requested to make it possible to position context menus, for example. The initial press point is used for drag threshold, so we need to maintain the current press point separately. [ChangeLog][Controls][AbstractButton] Added pressX and pressY properties. Task-number: QTBUG-62811 Change-Id: Ibb7b9d254ccf68876d5a3049881fee29a45530e4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickAction: don't uncheck the checked action of an exclusive groupJ-P Nurmi2017-10-091-0/+41
| | | | | | | | The logic is adapted from QAction::activate(). Task-number: QTBUG-63674 Change-Id: I7af127ea917e40e6a8ca99c2528362cf6ad283b8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickAbstractButton: fix shortcut handling part 2J-P Nurmi2017-06-291-0/+14
| | | | | | | | Make sure to trigger the associated action if a button is activated via its shortcut. Change-Id: I73899a5540285c7c2b11a2481a9621ec6e83c6b8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickAbstractButton: fix shortcut handlingJ-P Nurmi2017-06-281-0/+16
| | | | | | | | | | | | QQuickAbstractButton::itemChange() already grabs and ungrabs the shortcut when the button's visibility changes, but setShortcut() was grabbing the shortcut without checking the button's visibility, so a hidden button ended up grabbing a shortcut. Furthermore, make sure to ungrab the shortcut on destruction to avoid leaving a dangling pointer to the application shortcut map. Change-Id: Ie93c2d073d7072abad271ba59a45428e3300cc28 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickAbstractButton: add preliminary support for mnemonicsJ-P Nurmi2017-06-141-0/+34
| | | | | | | | | | This patch adds mnemonic shortcut functionality. We don't have a nice way to visualize mnemonics yet, so we just remove the ampersands from the UI for now. Change-Id: I90f54bd18d5d17f11e02c18c8461bfc25ce51cf1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devJ-P Nurmi2017-05-111-3/+1
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I5c6398e4146e62109bef231fe358b7ed69fa9488
| * tst_controls: use TestCase::createTemporaryObject()J-P Nurmi2017-05-091-3/+1
| | | | | | | | | | Change-Id: Iec2e4fdba18402762c6d6580abf8e677d5ae583c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Make QQuickIcon a value typeJ-P Nurmi2017-05-101-19/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickIcon no longer inherits QObject, but becomes a light-weight implicitly shared Q_GADGET-type, that is passed by value the same way fonts and colors are. Before: SUB: OS: Fedora 25 (Workstation Edition) SUB: QPA: xcb SUB: GL_VENDOR: Intel Open Source Technology Center SUB: GL_RENDERER: Mesa DRI Intel(R) Haswell Desktop SUB: GL_VERSION: 3.0 Mesa 13.0.4 SUB: running: benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml SUB: 110 frames SUB: 109 frames SUB: 109 frames SUB: 109 frames SUB: 109 frames SUB: Average: SUB: 109.2 frames; using samples; MedianAll=109; StdDev=0.447214, CoV=0.00409536 After: [...] SUB: running: benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml SUB: 123 frames SUB: 124 frames SUB: 124 frames SUB: 122 frames SUB: 125 frames SUB: Average: SUB: 123.6 frames; using samples; MedianAll=124; StdDev=1.14018, CoV=0.00922472 Change-Id: I604532204fb94fc0726d0c9b8b6097f9ebc265e8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickIcon: fix the type of the source propertyJ-P Nurmi2017-04-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, something like: Button { icon.source: "../images/drawer.png" } did not work in the Gallery example, even though it works fine for Image elements etc. The URL needs to be resolved relative to the caller. By making the property an URL instead of a plain string, the QML engine does the correct thing automatically. Note: icon.source.length no longer works in auto tests, so it got replaced by a compare(). Change-Id: I5fdb3aa55003d2f04e5458b7636e4dae3fa9857c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add AbstractButton::actionJ-P Nurmi2017-04-101-1/+95
| | | | | | | | | | | | | | | | | | [ChangeLog][Controls][AbstractButton] Added AbstractButton::action property. Task-number: QTBUG-50705 Change-Id: I773459df336a9e0cb9dbf980471485f81bbdab71 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | AbstractButton: add support for iconsMitch Curtis2017-03-241-0/+45
|/ | | | | | | | | | | | | | | | | | | | | This patch adds the following properties to AbstractButton: - icon.name - icon.source - icon.width - icon.height - icon.color Derived types implement the behavior behind these properties using the new private IconImage type. [ChangeLog][Controls][AbstractButton] Added support for icons. The following properties are now available for derived types to use: icon.name, icon.source, icon.width, icon.height, icon.color. Task-number: QTBUG-49820 Change-Id: I3b5e4eaac390543deef60883e13539646a6bb060 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Update license headers to silence qtqa/tst_license warningsJ-P Nurmi2017-02-241-2/+12
| | | | | | | | | | Sync with the qtbase/header.XXX. The license headers were matching qtbase/header.XXX-OLD, which makes qtqa/tst_license flood warnings: Old license being used for foo.qdoc Change-Id: I199bf303a2d648e0d5f7bc01cb0814a5f945eeff Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2017-01-231-0/+36
|\ | | | | | | Change-Id: I70bce420ae7d82d1bd72ff3d6c4f034525272aba
| * QQuickAbstractButton: don't leak space key eventsJ-P Nurmi2017-01-231-0/+36
| | | | | | | | | | | | | | | | Unlike mouse events, key events are not accepted by default. Key events must be accepted to avoid event propagation. Change-Id: I8d9217e6f18d56515470bef2507d462edd274ce2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | tst_controls: update import versions for controls and templatesJ-P Nurmi2017-01-121-1/+1
| | | | | | | | | | Change-Id: I104bc44c361351719449cab94dcb14c96e91e32f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2017-01-111-1/+1
|\| | | | | | | Change-Id: If797ac58344b20e8de4379343131c097247ba2f2
| * Welcome to 2017J-P Nurmi2017-01-091-1/+1
| | | | | | | | | | Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | tst_abstractbutton: use TestCase's new createTemporaryObject functionsMitch Curtis2016-12-161-12/+5
|/ | | | | | | | This ensures that the appropriate objects are destroyed at the end of each test function. Change-Id: Ib63719e134eb207cfc712b3a38e015cf853b6ae6 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* AbstractButton: fix press-and-hold for checkable buttonsJ-P Nurmi2016-11-221-0/+22
| | | | | | | Don't toggle the checked state on release after press-and-hold. Change-Id: I06b6a0e86dc02c171eef10f3c0d564ff605796f0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8J-P Nurmi2016-10-031-0/+36
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/quickcontrols2/gallery/gallery.qrc src/imports/calendar/doc/snippets/qtlabscalendar-calendarmodel.qml src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow.qml src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid-layout.qml src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid.qml src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn.qml src/imports/controls/doc/qtquickcontrols2.qdocconf src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml src/imports/controls/doc/snippets/qtlabscalendar-monthgrid-layout.qml src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.qml src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml src/imports/controls/qtquickcontrols2plugin.cpp src/quicktemplates2/qquicktooltip.cpp src/quicktemplates2/qquicktooltip_p.h src/quicktemplates2/qquicktumbler.cpp tests/auto/controls/data/tst_spinbox.qml tests/auto/controls/data/tst_tumbler.qml tests/auto/qquickmaterialstyle/data/tst_material.qml Change-Id: I25b7473b47739043b6f768603bece30b18021318
| * Make a plain AbstractButton calculate suitable implicit sizeJ-P Nurmi2016-10-021-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just like commit 87b21a57 made Control do it, this applies the same logic to AbstractButton. The simple reasoning is that when customizing both the contentItem and the background, it is much better to use the AbstractButton type that does not have any default building blocks. Previously you would have to supply implicit size calculation as well, but this makes it much more convenient to use. [ChangeLog][Controls][AbstractButton] A plain AbstractButton now calculates its implicit size based on the implicit size of the content item plus paddings, and the implicit size of the background item. Change-Id: Ic380366b25940fbb9f28882c4622d58f4c042a07 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Bump up all controls and templates imports to version 2.1J-P Nurmi2016-07-081-1/+1
|/ | | | | | | | | | | | Controls must import templates version 2.1 in order to "inherit" 1-revisioned properties, methods, and signals. So far, this has been done case by case, but it's less error prone and more clear to change them all. For example, if you ever see a source file pasted/linked somewhere, it's easy to identify the version it belongs to. Change-Id: I41609ec1a22bc05ac3e79f953a147ca42d9e0786 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Move highlighted to subclasses that actually use itMitch Curtis2016-04-271-9/+0
| | | | | Change-Id: I70468b35b2a3a03c6e2d557a67443291697c8b42 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* import Qt.labs.controls 1.0 => QtQuick.Controls 2.0J-P Nurmi2016-04-211-1/+1
| | | | | | | | | Docs, resources, .metainfo and plugins.qmltypes will be updated in follow up commits. Change-Id: I4438c5bfb8802bff0fa15c56431cfd288f179861 Task-number: QTBUG-52549 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Tests: cleanup templates importsJ-P Nurmi2016-04-201-1/+1
| | | | | Change-Id: I160899629f8196d98637d649f7aed7eab8bf4244 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Promote Button::highlighted to AbstractButtonJ-P Nurmi2015-12-031-0/+9
| | | | | Change-Id: I0e17a6c25dfd89fdb547720e9a626c2ec9d7765a Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Expose AbstractButton.Mitch Curtis2015-11-041-0/+70
It will be used as the type that ButtonGroup (will be renamed from ExclusiveGroup) manages. Change-Id: Iedcf81a33ac8e7acad3e119159791995bc2ce2eb Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>