aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickabstractbutton_p.h
Commit message (Collapse)AuthorAgeFilesLines
* AbstractButton: add implicitIndicatorWidth|HeightJ-P Nurmi2018-04-131-0/+10
| | | | | | | | [ChangeLog][Controls][AbstractButton] Added implicitIndicatorWidth and implicitIndicatorHeight properties. Change-Id: Ic9459efa76c12ba0df67dae0ffe103b14e011ee6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-091-1/+5
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf src/quicktemplates2/qquickabstractbutton_p.h Change-Id: I265cbd2ce51beaf2afef99292c2e2798dadb4ba3
| * Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into ↵J-P Nurmi2018-01-081-0/+3
| |\ | | | | | | | | | refs/staging/5.10
| | * Merge remote-tracking branch 'origin/5.9' into 5.10J-P Nurmi2017-12-151-0/+3
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/quickcontrols2/quickcontrols2.pro src/imports/controls/ComboBox.qml src/quicktemplates2/qquickabstractbutton.cpp src/quicktemplates2/qquickabstractbutton_p.h src/quicktemplates2/qquickapplicationwindow_p.h src/quicktemplates2/qquickcombobox.cpp src/quicktemplates2/qquickcontainer.cpp src/quicktemplates2/qquickcontrol.cpp src/quicktemplates2/qquickcontrol_p.h src/quicktemplates2/qquickcontrol_p_p.h src/quicktemplates2/qquicklabel_p.h src/quicktemplates2/qquicklabel_p_p.h src/quicktemplates2/qquickslider_p.h src/quicktemplates2/qquickspinbox.cpp src/quicktemplates2/qquicktextarea_p.h src/quicktemplates2/qquicktextarea_p_p.h src/quicktemplates2/qquicktextfield_p.h src/quicktemplates2/qquicktextfield_p_p.h tests/auto/auto.pro tests/auto/controls/data/tst_combobox.qml Change-Id: I34cdd5a9794e34e0f38f70353f2a2d04dfc11074
| | | * Buttons: defer the execution of the delegatesJ-P Nurmi2017-12-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In practice, deferring the execution of the delegates (until accessed) means that the default delegate item does not get created at all, when a custom control replaces it at construction time. Button { background: Rectangle { ... } } Before, such custom Button would never be faster than the original one, because the default delegate was first created and then thrown away at construction time. Originally, this was not considered a huge problem, because the plan was to keep the default delegates so light- weight that it wouldn't matter. However, then came the fancy styles with shadows and effects and thus, heavier default delegates. There's also a growing demand for more features, and the default delegates are slowly getting heavier... Now, after this patch, if you replace a heavy default delegate with a light and simple custom delegate, the result is a much faster control. For example, replacing Material style Button's background, which has a shadow effect, with a plain Rectangle gives a ~10x boost, because the default background with its heavy shadow effect is not executed at all. At the same time, deferring the execution of the default delegates avoids troubles with asynchronous incubation, because we don't need to destroy an object in the middle of the incubation process. Task-number: QTBUG-50992 Change-Id: I2274bff99b9ff126d3748278d58d859222910c98 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * | | Make AbstractButton's text win over action's when both are specifiedMitch Curtis2017-12-221-1/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Add comments for revision 4 membersJ-P Nurmi2017-11-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | The same was done for earlier revisions in 5.9 in commit 430fe83 and 5.10 commit 8a56c33. Change-Id: Ib3c0158ea1c8409ec12f37e3738fbb38ae52edb6 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devJ-P Nurmi2017-11-061-1/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Re-order revision 3 members and add explanatory commentsJ-P Nurmi2017-11-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've come to realize that even though it's tempting to group similar properties together, organizing the API so that revisions are grouped together makes future maintenance more pleasant. It's a lot easier to to see what was added and when. The same was done for earlier revisions in 5.9 in commit 430fe83. Change-Id: I738d7fdadd348c21737228c37d0f31e39b37f8e7 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
| * | Merge remote-tracking branch 'origin/5.9' into 5.10J-P Nurmi2017-11-061-1/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quicktemplates2/qquickabstractbutton_p.h src/quicktemplates2/qquickbuttongroup_p.h src/quicktemplates2/qquickrangeslider.cpp src/quicktemplates2/qquickrangeslider_p.h src/quicktemplates2/qquickswipeview_p.h src/quicktemplates2/qquicktextarea.cpp src/quicktemplates2/qquicktextarea_p.h src/quicktemplates2/qquicktextfield_p.h Change-Id: I7cba8783b1dd85a4db534222e36572ee05dd01d0
| | * Re-order all revisioned members and add explanatory commentsJ-P Nurmi2017-11-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've come to realize that even though it's tempting to group similar properties together, organizing the API so that revisions are grouped together makes future maintenance more pleasant. It's a lot easier to to see what was added and when. Change-Id: I47ba7725260f2c259048848cc2a9b17bce2f01c7 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | | QQuickAbstractButton: expose the press pointJ-P Nurmi2017-10-271-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Add QQuickAbstractButton::autoRepeatDelay and autoRepeatIntervalJ-P Nurmi2017-10-251-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][Controls][AbstractButton] Added autoRepeatDelay and autoRepeatInterval properties. Change-Id: Ib086ef429218c6507688865d82726fdcf838633c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | QQuickButton: promote autoRepeat back to QQuickAbstractButtonJ-P Nurmi2017-10-251-1/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original reason why autoRepeat was demoted to QQuickButton was that some subclasses, such as QQuickCheckBox, did not need this property. The same was done with the checkable property. It was first demoted, and then promoted back to QQuickAbstractButton. These can be useful for building custom AbstractButton-based controls. Now that we want to make auto-repeat configurable (autoRepeatInterval and autoRepeatDelay), and the logic has to be in the base class anyway, it makes more sense to expose all these in the base class instead of doing the property hiding tricks for all three properties. [ChangeLog][Controls][AbstractButton] The autoRepeat property was promoted from Button to AbstractButton. Change-Id: Ife105da00d7d87a74fc8160ec35762b6f71d3ad9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickAbstractButton: add preliminary support for mnemonicsJ-P Nurmi2017-06-141-0/+8
| | | | | | | | | | | | | | | | | | | | 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>
* | Mark properties as FINALJ-P Nurmi2017-06-061-1/+1
| | | | | | | | | | | | | | | | | | This is a little optimization trick for the QML engine. We basically tell it to not lookup overridden/overshadowed properties further in subclasses/composite types. Change-Id: I04168c58d00c07e5a354259cabefb3664ffd95b3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Make QQuickIcon a value typeJ-P Nurmi2017-05-101-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.9' into devJ-P Nurmi2017-04-211-5/+0
|\| | | | | | | | | | | | | | | Conflicts: src/imports/controls/RoundButton.qml src/imports/controls/universal/RadioDelegate.qml Change-Id: I4cb14c19bd5f6e19b70b03fb394c76712e6dda08
| * Override QQuickControlPrivate::handleXxx()J-P Nurmi2017-04-201-5/+0
| | | | | | | | | | | | Change-Id: I5c5be24142a758637e18df24b43847a8c6079346 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | Implement QQuickIconLabel::TextUnderIconJ-P Nurmi2017-04-111-1/+1
| | | | | | | | | | | | | | This will be the default for TabButton and RoundButton. Change-Id: I9ccb0d35f33a80fe7e3da26617ed6f42232afe17 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Add AbstractButton::actionJ-P Nurmi2017-04-101-1/+6
| | | | | | | | | | | | | | | | | | [ChangeLog][Controls][AbstractButton] Added AbstractButton::action property. Task-number: QTBUG-50705 Change-Id: I773459df336a9e0cb9dbf980471485f81bbdab71 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | AbstractButton: add display propertyMitch Curtis2017-03-281-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This property allows control over how icons and text are displayed within buttons, without having to implement custom delegates. It is also necessary for the upcoming Action type. [ChangeLog][Controls][AbstractButton] Added display property to allow control over how icons and text are displayed within buttons, without having to implement custom delegates. Task-number: QTBUG-49820 Change-Id: Ie924e2c54ed49961fd40129999875c8175606ecd Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | AbstractButton: add support for iconsMitch Curtis2017-03-241-0/+5
|/ | | | | | | | | | | | | | | | | | | | | 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>
* Port from QT_NO_ACCESSIBILITY to QT_CONFIG(accessibility)J-P Nurmi2017-02-241-1/+1
| | | | | Change-Id: I03deebff661746d49e537af5b1c8899b938efb0d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickAbstractButton: handle touch eventsJ-P Nurmi2017-01-241-0/+2
| | | | | | | | This makes it possible to interact with multiple buttons at the same time. Change-Id: Ice17efcb8b6dc5337455cd38ee88c39dfef2baae 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>
* | Add DelayButtonJ-P Nurmi2017-01-021-0/+1
| | | | | | | | | | | | | | [ChangeLog][Controls][DelayButton] Added DelayButton. Change-Id: I94820dfb41ba9b90f0a29cda01ac476b54cf3de8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add QQuickAbstractButton::buttonChange()J-P Nurmi2016-12-211-5/+8
| | | | | | | | | | | | | | | | | | | | Merge the various virtuals to a single method that takes an enum value indicating the type of the change. This way we don't need to keep adding more and more virtuals, but can just extend the enum. The next in line is ButtonPressedChanged for the upcoming DelayButton. Change-Id: I40ebf170470790730217aba48c80daff8118dfba Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add AbstractButton::toggled() signalJ-P Nurmi2016-12-021-0/+1
| | | | | | | | | | | | | | | | | | | | [ChangeLog][Controls][AbstractButton] Added a toggled() signal that is emitted whenever a checkable button is interactively toggled by the user by using either touch, mouse, or keys. Task-number: QTBUG-57203 Change-Id: If0b0d71d19cbed00f04d8a4309894a055c4254c6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2016-11-171-0/+2
|\| | | | | | | | | | | | | | | Conflicts: src/quickcontrols2/qquickstyle.cpp src/quicktemplates2/qquickslider.cpp Change-Id: Ie12132690680706def6f516334a6ef0ba27336b3
| * Restore AbstractButton::checkableJ-P Nurmi2016-11-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 7a8f055, we hid the checkable property from QQuickAbstractButton and exposed it only in QQuickButton and QQuickMenuItem. The reasoning was that QQuickCheckBox, QQuickRadioButton, QQuickSwitch and their delegate counterparts are inherently checkable, so having the checkable property available in QML didn't seem to make sense. While this still holds true, there are other factors to take into consideration. AbstractButton is meant to be a generic base class for all types of buttons, but the lack of a checkable property makes it unusable as a base class for custom QML-based checkable buttons. If we want to a hide the checkable property from CheckBox, RadioButton, and Switch to avoid having it popup in the auto-completion list, we can probably do it in a less disruptive way via tooling. [ChangeLog][Controls][AbstractButton] The checkable property has been made accessible from QML. Previously it was only exposed for Button and MenuItem, but it is now available for any AbstractButton to make it possible to create custom QML-based checkable buttons. Task-number: QTBUG-51554 Change-Id: I19e29fc87cd15811c43c9b9ebb29701d66cde72f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add QQuickAbstractButton::textChange()J-P Nurmi2016-11-161-0/+1
|/ | | | | | | So QQuickMenuItem can sync its platform menu item. Change-Id: Iee4b63006c5586417b6484e24f1503d3c4a7fcad Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Move highlighted to subclasses that actually use itMitch Curtis2016-04-271-5/+0
| | | | | Change-Id: I70468b35b2a3a03c6e2d557a67443291697c8b42 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Q_QUICKTEMPLATES2_EXPORT => Q_QUICKTEMPLATES2_PRIVATE_EXPORTMitch Curtis2016-04-271-1/+1
| | | | | | | They're all private classes. Change-Id: I2f1463429109c5651f9cca5bc7aabe5cf0f79637 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Move autoRepeat out of QQuickAbstractButtonMitch Curtis2016-04-231-2/+1
| | | | | | | | Subclasses like QQuickCheckBox don't need this. Change-Id: I885442b3286b0a497ba742d4dc7df0e89f8b02e8 Task-number: QTBUG-51554 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Add QQuickAbstractButton::downMitch Curtis2016-04-151-1/+7
| | | | | | | | | | | | | | | | | This property will determine whether or not the button is visually pressed. Having such a distinction allows users more control over their controls. The patch also fixes the problem with ComboBox where pressing on the ComboBox when it's open would cause a delegate in the popup to show as being pressed. Unless explicitly set, this property follows the value of the pressed property. To return to the default value, set it to undefined. Change-Id: I29ecf325ed2ede125613f0c878b0427937599866 Task-number: QTBUG-51005 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Templates: update license headersJ-P Nurmi2016-04-141-2/+2
| | | | | | | This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. Change-Id: I39ef9cbb00f55a32b7a43f11ffbdfbb40b84e124 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Templates: rename the C++ module to qtquicktemplates2J-P Nurmi2016-04-131-0/+146
Change-Id: I146da903b46f5c2caf865e37291c25376b49021a Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>