aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material/Button.qml
Commit message (Collapse)AuthorAgeFilesLines
* Material: account for accent color in flat highlighted button's rippleKonstantin Ritt2019-05-211-2/+1
| | | | | | | According to https://material.io/design/components/buttons.html#text-button Change-Id: Ia36a676864a8f738d204cf8db9430b797f1f2f99 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Tie minor version of all imports to Qt's minor versionMitch Curtis2018-11-021-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Material: use background insetsJ-P Nurmi2018-04-251-6/+3
| | | | | | | | | | Allows easily configuring the insets from the outside. Buttons have normally 6px insets, but for example a large Floating Action Button doesn't. Task-number: QTBUG-60156 Change-Id: I49121c5bd588ff83e7ab9032de42a93872e999e4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Replace Material.buttonHeight with Material.touchTargetJ-P Nurmi2018-04-251-1/+1
| | | | | | | | | | | | The visual height of a Material design Button is 36px in the normal variant, and 32px in the dense variant. The Button has 6px vertical insets to gain 48px touch target height. Rename the old buttonHeight property as touchTarget to make room for the visual buttonHeight that is needed when porting Button to use the newly introduced background insets. Change-Id: Ic2932f71ca75a626ff5e9b0ce9930e1b3f24cf00 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Take background insets into accountJ-P Nurmi2018-04-231-2/+2
| | | | | | Task-number: QTBUG-60156 Change-Id: I11f59a67f5a319ac5a4eae9b8ccea5d16a983de2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use implicitContentWidth and implicitContentHeightJ-P Nurmi2018-04-131-2/+2
| | | | | | | A simple search'n'replace change without hidden functional changes. Change-Id: I11c76846028665e66dfc6b4359adb33f77cd88ae Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use implicitBackgroundWidth and implicitBackgroundHeightJ-P Nurmi2018-04-121-2/+2
| | | | | | | A simple search'n'replace change without hidden functional changes. Change-Id: I8e42f8ad30977630005529094eea726efa15a26d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickControl: update baseline offset automaticallyJ-P Nurmi2018-04-041-1/+0
| | | | | | | | | | | | ...unless explicitly defined. All buttons repeated the same binding. [ChangeLog][Controls][Control] Unless explicitly specified, baselineOffset is now automatically updated based on the top padding of the control and the baselineOffset of the contentItem. Styles no longer need to specify the baselineOffset in QML. Change-Id: I9c6f61371fee05a06b5dd31b27d8baf9da0bdeeb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Bump import versionsJ-P Nurmi2018-03-011-5/+5
| | | | | | | | QT_VERSION in qtbase has been updated. All the import numbers that now follow the Qt version can be updated. Change-Id: I4e9698201766b39807737c9e0279d36d4da686e2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use horizontal|verticalPaddingJ-P Nurmi2018-03-011-2/+1
| | | | | | | A follow-up commit to 13d56b5. Somehow these were missed. Change-Id: Ief9831797cdda81dd3430b0df0aed2a6050093ca Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Bump QtQuick.Templates import versionsJ-P Nurmi2018-02-231-1/+1
| | | | | | | | | | Unlike the other imports that are waiting for a Qt version bump, QtQuick.Templates contains version 2.5 registrations and is therefore already available. Bump the template imports to make the newly added APIs available, so we can start using horizontal|verticalPadding. Change-Id: I651feeeeadcc9767904ca6f191e844a03b8ddea6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add Dense Material style variant for desktopMitch Curtis2018-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current Material style is based on the mobile variant of the design, which is far too large for desktop applications. From https://material.io/guidelines/components/lists.html#lists-usage: "When the mouse and keyboard are the primary input methods, measurements may be condensed to accommodate denser layouts." This patch adds a dense variant of the style where most controls like buttons and delegates are smaller in height and use smaller font sizes. Note that the Material design guidelines seem to distinguish between mobile, desktop and dense measurements, where "dense" seems to be a specialization of desktop. We cannot afford to/do not see sense in maintaining three separate variants, so the dense variant will be the only desktop version of the Material style. [ChangeLog][Material] Added Dense variant of the Material style for use on desktop platforms. Some controls are slightly smaller in height and use smaller font sizes. The variant can be enabled by setting QT_QUICK_CONTROLS_MATERIAL_VARIANT to Dense or setting Variant=Dense in the qtquickcontrols.conf file. Task-number: QTBUG-51109 Change-Id: I11846b7f6e61f7b5dcf3c146b18c220234a73ef2 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Bump import versionsMitch Curtis2017-09-191-6/+6
| | | | | | | | This brings all QtQuick 2.x and QtQuick.Controls.x 2.x imports in src/ up to 2.11 and 2.4, respectively. Change-Id: Ica2413b85f5da62a495a5d1b02ea54a9a92c0ecb Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Bump QtQuick 2.9 imports to 2.10Mitch Curtis2017-09-061-1/+1
| | | | | Change-Id: I274146911cd8a204fcbf439da9259b0a38c8092e Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Material: make icon color match text colorMitch Curtis2017-05-021-1/+3
| | | | | | Task-number: QTBUG-60502 Change-Id: Ia861155b0728cf5f8d1815dc2ff2af94a68b6b8f Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* QQuickIconLabel: create icon and label items lazilyJ-P Nurmi2017-04-111-15/+6
| | | | | | | | | | | | | | Before: Average: 120.2 frames; using samples; MedianAll=120; StdDev=0.447214, CoV=0.00372058 After: Average: 129.8 frames; using samples; MedianAll=130; StdDev=0.447214, CoV=0.00344541 Task-number: QTBUG-59746 Change-Id: I44b521688cd60e7e287968828f9d4062cc642a0d Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Buttons: remove superfluous alignment for the internal labelsJ-P Nurmi2017-04-111-2/+0
| | | | | | | | | | | | | In QQuickIconLabel::layout(), the label is resized to: min(availableSize, implicitSize) In other words, the label is never larger than its content. Specifying an alignment has therefore zero effect. This saves a few unnecessary QML expression evaluations and gives a few frames' boost in qmlbench. Change-Id: Ifa942d99a026fd2dca6e680bde2b538f9e526604 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Button.qml: cleanup unused iconImage IDsJ-P Nurmi2017-04-101-1/+0
| | | | | Change-Id: I486450550382e09f57d3e18bd8cdd23a2448b3ec Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickIconLabel: rename text property to labelMitch Curtis2017-04-081-1/+1
| | | | | | | | In preparation for the next patch which adds a "QString text" property to the API. Change-Id: Ie904108353c37a02cbc992c067f3e09aed9c2497 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Rename QQuickDisplayLayout to QQuickIconLabelMitch Curtis2017-04-071-1/+1
| | | | | | | | There are some performance improvements planned that require changes to the class, resulting in it no longer being a layout "container". Change-Id: Ie29f2f95eebb64b3b018746f93763fdbe79625f0 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* AbstractButton: add display propertyMitch Curtis2017-03-281-0/+1
| | | | | | | | | | | | | | 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>
* Button: add support for iconsMitch Curtis2017-03-241-9/+29
| | | | | | Task-number: QTBUG-49820 Change-Id: I7f2a72a4ef199d31b2b0041fdad42cfeb15f7b54 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Update the import statements 2.2->2.3J-P Nurmi2017-03-011-3/+3
| | | | | Change-Id: Ifa2a4cb46f0fc7db75b468a67000c979bf44848c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: remove color animation on various controls' backgroundMitch Curtis2017-02-241-6/+0
| | | | | | | | | This resulted in the background becoming very dark when toggling between enabled/disabled or editable/read-only states. Task-number: QTBUG-58828 Change-Id: I710fa97aefd26e490a219ba99833d5bfe47f2133 Reviewed-by: J-P Nurmi <jpnurmi@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>
* | Bump the QtQuick import versions in the stylesJ-P Nurmi2016-12-191-1/+1
| | | | | | | | | | | | | | Qt 5.9 == QtQuick 2.9 Change-Id: I7d4f749645011c4e78bdafe80824b83bd166e7c7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Update import versions in src/import/controls - part IIJ-P Nurmi2016-11-231-1/+1
| | | | | | | | | | | | | | The templates imports were missed in fb7c9541, sorry. Change-Id: I9742f1a86b01083ae1b7c6ae48b43098be8385c5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Update import versions in src/import/controlsJ-P Nurmi2016-11-231-2/+2
|/ | | | | Change-Id: Ic6cd0450a13b965578a0ab8f590270f4e52ffca6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: de-couple foreground and primaryTextColorJ-P Nurmi2016-11-161-1/+1
| | | | | | | | | | | | In order to get the ComboBox colors right, it must be possible to query the original primary text color value. It was very convenient to make Material.primaryTextColor return custom Material.foreground colors, because that way we didn't have to touch our QML files, but this approach is no longer usable. Task-number: QTBUG-57167 Change-Id: Iee003e96112b919dc7c84a906e4f5691b0f2a6ab Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Make hoverEnabled propagate to childrenJ-P Nurmi2016-10-171-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Hover effects can be sometimes a bit disturbing. This change makes it possible to conveniently disable hover effects for a tree of controls in one go. For example, to disable hover effects for a page including its header, footer, and all list items: Page { hoverEnabled: false header: ... footer: ... ListView { delegate: ... } } [ChangeLog][Controls][Important Behavior Changes] Control::hoverEnabled has been made to inherit to children, to make it possible to disable hover effects for a tree of controls in one place. Change-Id: Ia87144f2cc04957a32f89d3313816b91d97db635 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Update all QtQuick imports in src/imports/controlsJ-P Nurmi2016-10-041-1/+1
| | | | | | | | | Most were importing 2.6, some 2.4, and some 2.7. Use consistently the latest available Qt Quick version 2.8. This can be easily tracked to the corresponding Qt version. Change-Id: Ic231b3cc0cb5d2d5cf806fe11c4ff3fd557d09e0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: switch back to triggering ripples on pressJ-P Nurmi2016-09-301-1/+0
| | | | | | | | | | | | | | | | | | There is something wrong with the ripple effect's speed calculation when it's triggered on release. The ripple is supposed to grow slowly on press, and fast on release. But when triggered on release, it grows clearly too slow. We also got a bug report complaining about the trigger on release behavior. Ripples are triggered on press on Android 5, which is the Android version with the most market share. The proposal is to fix the ripple effect speed calculation when triggered on release later, and switch to trigger on release when later versions of Android have passed Android 5's market share. Task-number: QTBUG-55520 Change-Id: I67994e0df3c318af24f0d1f843bb2d0c26c4d656 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: determine the default hoverEnabled value from QStyleHintsJ-P Nurmi2016-07-221-0/+2
| | | | | | Task-number: QTBUG-50003 Change-Id: I4809638c7ddaa4ca6fb99dbc734edb3641ecea05 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: rename ripple color propertiesJ-P Nurmi2016-07-211-1/+1
| | | | | | | They are no longer specific to CheckBoxes, but used in most controls. Change-Id: I404aeab706479d0b666529ebdb09caa6b8085cae Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: revise Button visualsJ-P Nurmi2016-07-201-11/+14
| | | | | | | | | | | Pressed buttons were way too dark, and ripples weren't even visible for highlighted buttons. Now that we have ripples, we don't need to use so many different color shades to present various button states. Also, visualize the checked state with a little accented bar like the Android ToggleButton does. Change-Id: Id717b658bfe70ba211e4da5a6addc6e10a2df3e5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: improve Button's ripple effectJ-P Nurmi2016-07-191-2/+2
| | | | | | | | | Trigger ripples on press for flat buttons, on release for raised buttons. Use highlighted (colored) ripple for highlighted (colored) buttons, not for checked (not colored) buttons. Change-Id: Ic7a6de070e568792d39cc20af35229517b7fd69e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: trigger ripple effects on release for some controlsJ-P Nurmi2016-07-131-0/+1
| | | | | | | | | | Android 5 used to trigger ripple effects on press, but Android 6 made ripple effects a bit more subtle. For check boxes, radio buttons, and switches it still triggers on press, but these controls where the wave is larger, it's triggered on release instead. Change-Id: Ib4d301d5ccf72d5db106bcc6ad6afee30cef0b1e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: implement ripple effect for ButtonJ-P Nurmi2016-07-111-0/+10
| | | | | | Task-number: QTBUG-50003 Change-Id: Icc96eba2bb01847c369dbc7d07144c453aa6b324 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Bump up all controls and templates imports to version 2.1J-P Nurmi2016-07-081-3/+3
| | | | | | | | | | | | 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>
* Material: remove qdoc markersJ-P Nurmi2016-06-081-4/+0
| | | | | | | | | | | | | The original plan was to include the default implementation (of all styles, if we could make the snippets collapsiple) in the customization docs. Since the default implementations tend to include internal types, in the end we went the other way and wrote dedicated example snippets for the customization docs. Therefore these markers no longer server a purpose, but just add unnecessary extra bytes for the QML parser to read. Change-Id: Ic511d7ce7a032429626ee75517d69d21b21412a3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Controls: update all paddings to relative value with paddingLiang Qi2016-05-191-2/+2
| | | | | Change-Id: I7bf3a7fb9ca97e5c7ddf34f8f921d5d4be733861 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Add support for flat ButtonsJ-P Nurmi2016-05-181-9/+5
| | | | | | | Task-number: QTBUG-51054 Change-Id: Ib4b23b624bc34d16c5acc1568881b609d3fd64b8 Reviewed-by: Nikita Krupenko <krnekit@gmail.com> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: visualize Button::checked stateJ-P Nurmi2016-05-131-1/+1
| | | | | | | | It's not very well visible, but better than completely missing visuals. Task-number: QTBUG-53348 Change-Id: I16067bfb4f9f118ad5765f2831018b2fd89337f7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: remove obsolete imports of QtGraphicalEffectsNikita Krupenko2016-05-061-1/+0
| | | | | | | They are no needed anymore, as shadow implemented by an ElevationEffect. Change-Id: I75deb8fba69c96dfb82fc400ac24da543497a635 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Material: Add proper elevation supportMichael Spencer2016-05-041-18/+27
| | | | | | | | | | | | - Added an ElevationEffect component based on elevation shadows from Angular Material - Use it on Button, ToolBar, ComboBox, Drawer, Pane, Popup, Menu, and Switch - Add an elevation property to the Material attached object - Update the button colors based on the elevation property Change-Id: I5152e1a56bdcb1016cc4f945a16ef510e0cdece6 Task-number: QTBUG-51276 Reviewed-by: Nikita Krupenko <krnekit@gmail.com> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Control: rename activeKeyFocus to visualFocusJ-P Nurmi2016-04-261-2/+2
| | | | | | | | | This is a bit more flexible, because the name is not strictly coupled with key focus. We can even add a (re)setter later if we want. This change only renames the property. Change-Id: I6707e44040f584480a8712df1af0915ae2829d57 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* 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>
* import Qt.labs.templates 1.0 => QtQuick.Templates 2.0J-P Nurmi2016-04-211-1/+1
| | | | | | | | | | | | | | Even though there never was such thing is QtQuick.Templates 1.0, we'll use version 2.0 to keep it in sync with QtQuick.Controls 2.0 (next step). The templates define (and in the future, revision) the API of the controls, so the two must have the same version or it will get messy. Docs and plugins.qmltypes will be updated in follow up commits. Change-Id: Idc2e76f32f348ba35eb4b1fa167c6868300aa910 Task-number: QTBUG-52549 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Add QQuickAbstractButton::downMitch Curtis2016-04-151-2/+2
| | | | | | | | | | | | | | | | | 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>