aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickcontrol.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Popup: ensure that "palette" is reevaluated when enabled state changesMitch Curtis2019-02-051-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Doc: clarify event handlingMitch Curtis2018-12-031-4/+14
| | | | | | | | | | | | | | | | | | | | | | The current documentation says: "All controls, except non-interactive indicators, do not let clicks and touches through to items below them. For example, if Pane is used as the header or footer of ApplicationWindow, items underneath it will not get mouse or touch events." This can be confusing, because a Pane declared as a child of a MouseArea is "below" the MouseArea in code, but is "above" the MouseArea in the scene. Add a code example to make it less ambiguous. Also, link to the Event Handling section from Pane's docs. Task-number: QTBUG-71735 Change-Id: I97f4d6501af410bd5d5c0c0e48b14ca65605357d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix compilation with gcc 4.8Ville Voutilainen2018-12-031-1/+1
| | | | | | | GCC 4.8 doesn't like using QPointer in signal connections. Change-Id: Idc61984b155b0af8d1afb9d43c9eaf44ca9073cd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-281-0/+20
|\ | | | | | | Change-Id: Icd5d8a4292be3a335000a7bd0f30384ad83ff36d
| * Doc: add a note about the best way to set paddingMitch Curtis2018-07-241-0/+20
| | | | | | | | | | | | | | | | | | | | | | As the styles are subject to change over time, it's best to use the most fine-grained properties for specifying padding (topPadding, bottomPadding, etc.). Using these specific properties will ensure that what the user specifies always wins over what the style specifies. Task-number: QTBUG-69551 Change-Id: I4163e9918010fad0cb6ec701b49dbc59b086cf47 Reviewed-by: J-P Nurmi <jpnurmi@gmail.com>
* | QQuickControl: only set hasBackgroundWidth/Height when necessaryMitch Curtis2018-06-061-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following binding in the Fusion style's TabButton.qml implementation causes the last tab's background not to cover its full width: height: control.height - (control.checked ? 0 : 2) It seems that this line is executed upon the completion of deferred execution of the background, which somehow results in the early return check in itemGeometryChanged() not being executed. After that, there are these two lines: extra.value().hasBackgroundWidth = p->widthValid; extra.value().hasBackgroundHeight = p->heightValid; Even though this was just a change in height, hasBackgroundWidth was set to true early on (when the width was 8; the combined left and right padding), preventing the control from setting a width on the background in the future. This patch fixes the issue by only setting hasBackgroundWidth if the width was changed, and only setting hasBackgroundHeight if the height was changed. Task-number: QTBUG-68556 Change-Id: I4c7dbc60d8e73c60c025e5d6c65f3917e6e4ea08 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | QQuickTheme: rename themeFont() and themePalette()J-P Nurmi2018-05-221-4/+4
| | | | | | | | | | | | | | We don't have the conflicting virtual getters anymore. Change-Id: Ia20bfa0a0b1aa67c35a23270eb0241018f8e0ada Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-05-071-43/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quicktemplates2/qquickabstractbutton_p_p.h src/quicktemplates2/qquickcombobox.cpp src/quicktemplates2/qquickcontainer.cpp src/quicktemplates2/qquickcontrol.cpp src/quicktemplates2/qquickcontrol_p_p.h src/quicktemplates2/qquickdialog_p_p.h src/quicktemplates2/qquickdialogbuttonbox.cpp src/quicktemplates2/qquickdialogbuttonbox_p_p.h src/quicktemplates2/qquickdrawer.cpp src/quicktemplates2/qquickmenubar.cpp src/quicktemplates2/qquickmenubar_p_p.h src/quicktemplates2/qquickpage.cpp src/quicktemplates2/qquickpage_p_p.h src/quicktemplates2/qquickpane.cpp src/quicktemplates2/qquickpane_p_p.h src/quicktemplates2/qquickpopup.cpp src/quicktemplates2/qquickpopup_p_p.h src/quicktemplates2/qquickrangeslider.cpp src/quicktemplates2/qquickscrollview.cpp src/quicktemplates2/qquickslider.cpp src/quicktemplates2/qquickspinbox.cpp src/quicktemplates2/qquickswipeview.cpp src/quicktemplates2/qquicktabbar.cpp src/quicktemplates2/qquicktextarea_p_p.h src/quicktemplates2/qquicktextfield_p_p.h src/quicktemplates2/qquicktheme_p.h Change-Id: I6e2b8fe99e51e3e26c87546aa66af045bc429ec4
| * Templates: use C++11 default member initializationJ-P Nurmi2018-05-041-25/+0
| | | | | | | | | | | | | | | | | | | | | | The code is more readable and less error-prone (this patch caught a few uninitialized members) when the members are initialized in the same place where they are declared. In many cases, empty default destructors can be entirely removed, and we get faster implicitly declared inline default constructors defined by the compiler. Change-Id: I14c5448afc901f9b2ac5965f28c1c26c0b646c08 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add missing implicitBackground{Width|Height} to non-QQuickControlsJ-P Nurmi2018-05-021-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Same as 5bd9d44b for QQuickControl. [ChangeLog][Controls][Label] Added implicitBackgroundWidth and implicitBackgroundHeight properties that can be used to simplify complex implicit size bindings. [ChangeLog][Controls][TextArea] Added implicitBackgroundWidth and implicitBackgroundHeight properties that can be used to simplify complex implicit size bindings. [ChangeLog][Controls][TextField] Added implicitBackgroundWidth and implicitBackgroundHeight properties that can be used to simplify complex implicit size bindings. Change-Id: Idcc2d9af8df086b41c15f352506fd8afdbb2e3e7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Control: fix background sizeJ-P Nurmi2018-04-231-12/+39
| | | | | | | | | | | | | | | | | | | | | | | | Don't reset QQuickItemPrivate::widthValid and heightValid flags, because that will cause the item to update its geometry when its implicit size changes. Instead, keep track whether background has an explicit size at the time of assignment, or if the background changes its geometry outside of resizeBackground(). Task-number: QTBUG-66455 Change-Id: If14eeae6863f7e5e47ebf2d6dbdaf718fc8368d4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Control: add support for background insetsJ-P Nurmi2018-04-231-20/+229
| | | | | | | | | | | | | | | | | | | | [ChangeLog][Controls][Control] Added topInset, bottomInset, leftInset, and rightInset properties to control the geometry of the background similarly to how paddings control the geometry of the contentItem. Task-number: QTBUG-60156 Change-Id: Id8228d32f6a5fffeb771964a153ee062a5a083b5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Control: add implicitContentWidth|Height propertiesJ-P Nurmi2018-04-131-3/+131
| | | | | | | | | | | | | | | | | | [ChangeLog][Controls][Control] Added implicitContentWidth and implicitContentHeight properties that can be used to simplify complex implicit size bindings. Change-Id: I6ccef572c013605058808ce2ad17f8bd82f49ef0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Control: add implicitBackgroundWidth|Height propertiesJ-P Nurmi2018-04-121-0/+95
| | | | | | | | | | | | | | | | | | | | [ChangeLog][Controls][Control] Added implicitBackgroundWidth and implicitBackgroundHeight properties that can be used to simplify complex implicit size bindings. Task-number: QTBUG-60156 Change-Id: Ia68df187c2a458c84de19f867d76a643134e8b69 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickControl: update baseline offset automaticallyJ-P Nurmi2018-04-041-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | ...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>
* | Fix QQuickControl::contentItemChange()J-P Nurmi2018-03-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All other similar change() virtuals, such as fontChange(), localeChange() and paletteChange(), are called _after_ the value has been applied. The old value is passed as an argument. Use the same order for contentItem. This allows calling such methods from contentItemChange(), that rely on d->contentItem being set. If d->contentItem points to the old content item, all methods need to take the new item as an argument, which gets ugly especially if the same methods are used from elsewhere too. This is very well visible in QQuickPanePrivate: - bool updateContentWidth(QQuickItem *item); - bool updateContentHeight(QQuickItem *item); - void updateContentSize(QQuickItem *item); These are called with "newItem" from contentItemChange(), and with "d->contentItem" from many other places. Note: if a pre-notifications were required for something in the future, it would be probably better to add "aboutToChange" counterparts. Change-Id: I67dfdcce0e5f1cd9d9a37a63a0a9fdeaf82eafe6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add QQuickTheme::ScopeJ-P Nurmi2018-03-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | Replace the old enums that were originally copied from QPlatformTheme, including irrelevant entries for DockWidget, MdiSubWindow, MessageBox, with a unified enum that will be matched to cover everything needed for theming fonts and palettes for Qt Quick Controls 2. Task-number: QTBUG-67062 Change-Id: Ia99d092f28c00210c0c7f24d4241eb5a5d9ceb5b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Move QQuickControlPrivate::themeFont|Palette() to QQuickThemeJ-P Nurmi2018-02-151-35/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QPlatformTheme is too limited for our theming purposes. We need support for separate palettes (and later, icon colors) in dark and light themes. Also, the fact that Qt Quick Controls 2 injects a platform proxy theme does have undesired side effects in Qt Widgets and Qt Quick Controls 1. Therefore, we start separating QPlatformTheme and QQuickTheme. The first step is to eliminate some direct QPlatformTheme access in QQuickControl and route it via QQuickTheme instead. Task-number: QTBUG-51921 Change-Id: I055471a75ed6f26968796496efd1892975447c98 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devJ-P Nurmi2018-02-151-3/+11
|\| | | | | | | Change-Id: Id3333e9bb67ced4c6dbae5845512fe1927a7b858
| * Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-121-3/+11
| |\ | | | | | | | | | Change-Id: I2934d3f51fea9626fd2d2512786eb297d9f7fe6c
| | * Merge remote-tracking branch 'origin/5.9' into 5.105.10Liang Qi2018-02-091-3/+11
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ia407f277cccfdd96242ebfdbe294d699e26e6b1d
| | | * QQuickControl: respect wheel focus policy for focus scopesJ-P Nurmi2018-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][Controls][Control] Fixed focus scope controls to respect wheel focus policy. Task-number: QTBUG-66133 Change-Id: If963feba4b6e59b87ca54af5f6606805093eb0cc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| | | * QQuickControl: respect click focus policy for focus scopesJ-P Nurmi2018-02-051-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a focus scope explicitly requests click focus, make it gain active focus by clearing the sub-focus child. Pane { focusPolicy: Qt.ClickFocus TextField { } } [ChangeLog][Controls][Control] Fixed focus scope controls, such as Frame, GroupBox, Page, and Pane, to respect click focus policy by clearing a potential sub-focus child. This makes it possible to close the virtual keyboard by clicking the background of a Pane that has Qt.ClickFocus set as its focusPolicy, for example. Task-number: QTBUG-66133 Change-Id: I582f3c66aa6f11e229d89c4f610fae3c6259104d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | | Add Control::horizontal|verticalPaddingJ-P Nurmi2018-02-131-54/+155
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common pattern for paddings: padding: X topPadding: Y bottomPadding: Y This pattern can be simplified by providing separate horizontalPadding and verticalPadding properties: padding: X horizontalPadding: Y The actual style changes will be applied separately. As a bonus, the size of QQuickControlPrivate can be reduced a bit since we can move the (has)top/left/right/bottomPadding members to ExtraData. [ChangeLog][Controls][Control] Added horizontalPadding and verticalPadding properties as a convenient way to set both left and right, or top and bottom paddings in one go. Change-Id: I3a93b6f9ab988d806b1f263e74b6bd6b5427fbbe Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into 5.11J-P Nurmi2018-01-311-0/+1
|\| | | | | | | | | | | Change-Id: I7c0333dbf959124f6cf5be7837a305b65c08d290
| * | Merge remote-tracking branch 'origin/5.9' into 5.10J-P Nurmi2018-01-311-0/+1
| |\| | | | | | | | | | Change-Id: I697f98d5214f487c915032d744ec593da05368a8
| | * Control: fix background size regression caused by deferred executionJ-P Nurmi2018-01-221-0/+1
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-65880 Change-Id: Ic4f9fb087f4a78bd4c6257828011240186b6b22e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devJ-P Nurmi2018-01-161-25/+20
|\| | | | | | | | | | | Change-Id: Ibd1490e8d958361e55ac272dff75c9361239958b
| * | Merge remote-tracking branch 'origin/5.9' into 5.10J-P Nurmi2018-01-151-23/+0
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quicktemplates2/qquickcontrol.cpp tests/auto/sanity/tst_sanity.cpp Change-Id: I62a79fd7788fec635b9917fc91bacd7338b547fd
| | * Remove unused QQuickControlPrivate::destroyDelegate()J-P Nurmi2018-01-111-23/+0
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-65341 Change-Id: Ib64ec7ede42c140483554cf75e9bc16aa147be6c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * | Merge remote-tracking branch 'origin/5.9' into 5.10J-P Nurmi2018-01-101-2/+20
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/BusyIndicator.qml src/imports/controls/CheckBox.qml src/imports/controls/CheckDelegate.qml src/imports/controls/ComboBox.qml src/imports/controls/DelayButton.qml src/imports/controls/Dial.qml src/imports/controls/ItemDelegate.qml src/imports/controls/MenuItem.qml src/imports/controls/RadioButton.qml src/imports/controls/RadioDelegate.qml src/imports/controls/SwipeDelegate.qml src/imports/controls/Switch.qml src/imports/controls/SwitchDelegate.qml src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc src/imports/controls/material/CheckDelegate.qml src/imports/controls/material/ItemDelegate.qml src/imports/controls/material/MenuItem.qml src/imports/controls/material/RadioDelegate.qml src/imports/controls/material/SwipeDelegate.qml src/imports/controls/material/SwitchDelegate.qml src/imports/controls/qquickdefaultbusyindicator.cpp src/imports/controls/qquickdefaultbusyindicator_p.h src/imports/controls/qtquickcontrols2plugin.cpp src/imports/controls/universal/CheckDelegate.qml src/imports/controls/universal/ItemDelegate.qml src/imports/controls/universal/MenuItem.qml src/imports/controls/universal/RadioDelegate.qml src/imports/controls/universal/SwipeDelegate.qml src/imports/controls/universal/SwitchDelegate.qml src/quickcontrols2/quickcontrols2.pri src/quicktemplates2/qquickcontrol.cpp src/quicktemplates2/qquickmenu.cpp src/quicktemplates2/qquickpopup_p.h Change-Id: Ib25c8b4a7fe018b7c0ade9b02bfaaa6980118c15
| | * Fix deferred executionJ-P Nurmi2017-12-211-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the QML engine refuses to defer execution of a delegate (it contains an ID), we must make sure to cancel any pending deferred execution for the same delegate. Otherwise, we may end up overriding a custom (non- deferred) delegate with a default (deferred) delegate. This patch adds a new test style "identified" to tst_customization. This style contains delegates with IDs so we can test the behavior with IDs in base styles. Furthermore, overriding delegates is now tested in various ways (with and without IDs in the base and custom styles) in a separate test method. This is done by generating QML code to override delegates with dummy Item instances with appropriate IDs and names. Task-number: QTBUG-65341 Change-Id: Ie6dca287cb74672004d9d8f599760b9d32c3a380 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-091-11/+62
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/quicktemplates2/qquickabstractbutton_p.h Change-Id: I265cbd2ce51beaf2afef99292c2e2798dadb4ba3
| * | Merge remote-tracking branch 'origin/5.9' into 5.10J-P Nurmi2017-12-151-5/+41
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * Control: defer the execution of the content itemJ-P Nurmi2017-12-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Tumbler is excluded because test_customContentItemAtConstruction() starts failing if deferred execution is enabled for the content item. Task-number: QTBUG-50992 Change-Id: I11022c3c380311396453cf6229e068e4aae2d82a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| | * Control: defer the execution of the background itemJ-P Nurmi2017-12-151-0/+1
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-50992 Change-Id: I6372e143c68f0a5bf7212d759281acef3c81618e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| | * Migitate the performance regression caused by deferred executionJ-P Nurmi2017-12-121-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 458eb65f7 introduced a performance regression. Before 458eb65f7, qmlbench delegates_button.qml results were around 40 frames on a TX1. After 458eb65f, it dropped to 32. This patch is unfortunately not able to bring it on the original level, but at least improves the results to 37. For QQuickText, it is extremely important that implicitWidth() gets called before the component is completed, to avoid doing implicit size calculation multiple times. Deferred execution caused a performance regression by creating contentItem in "one go". We need to split the deferred execution to two parts so that bindings get first setup, and later enabled upon completion. This way, we utilize QQuickText's performance optimization for implicit size calculation. Task-number: QTBUG-50992 Change-Id: I4bf00af71b6d7dbf1d4b58b00fe547c6c321f8ed Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| | * Buttons: defer the execution of the delegatesJ-P Nurmi2017-12-111-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Doc: mention qtquickcontrols2.conf file in font docsMitch Curtis2017-12-111-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | Currently, there's no explicit mention of being able to customize the font via the qtquickcontrols2.conf file. Change-Id: I0c62e19b721a2d652021c303f876aaaa1098b880 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
| * | Doc: mention qtquickcontrols2.conf file in palette docsMitch Curtis2017-12-111-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | Currently, there's no explicit mention of being able to customize the palette via the qtquickcontrols2.conf file. Change-Id: I11f16a4e7dd759de2121e986df17ae9fdc651180 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devJ-P Nurmi2017-11-061-0/+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
| * | Document palette as a basic QML typeJ-P Nurmi2017-10-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately we need to manually add some \sa "palette QML Basic Type" links as a workaround until auto-linking to basic QML types in QML property headers is fixed in QDoc. Task-number: QTBUG-63469 Change-Id: I2ea853bfeda31905468741eb720f4daa242e703d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | Add QQuickSpinBox::displayTextJ-P Nurmi2017-10-251-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows styles to create a simple binding to display the textual value instead of calling the textFromValue() JS-function. Furthermore, this allows us to do the text<->value conversion in C++ using QLocale by default, unless custom textFromValue and/or valueFromText JS-functions are provided. Before: running: qmlbench/benchmarks/auto/creation/quick.controls2/delegates_spinbox.qml 100 frames 100 frames 99 frames Average: 99.6667 frames; using samples; MedianAll=100; StdDev=0.57735, CoV=0.00579281 After: running: qmlbench/benchmarks/auto/creation/quick.controls2/delegates_spinbox.qml 152 frames 150 frames 151 frames Average: 151 frames; using samples; MedianAll=151; StdDev=1, CoV=0.00662252 Change-Id: I66a5ebaf685d2c30613b58099724e6e7bbe00504 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10J-P Nurmi2017-09-111-1/+2
|\| | | | | | | | | | | | | | | | | Conflicts: src/quicktemplates2/qquicklabel.cpp src/quicktemplates2/qquicktextarea.cpp src/quicktemplates2/qquicktextfield.cpp Change-Id: Ibbf6bc48972f58fbc6779a87ac9e2434c56c4db8
| * Fix font inheritanceJ-P Nurmi2017-09-111-1/+2
| | | | | | | | | | | | | | | | | | | | In item views, it can happen during incubation that a control doesn't yet have a window associated when the parent item changes. Therefore we must make sure to resolve the font when the window changes. Task-number: QTBUG-63119 Change-Id: I890f70ae6faa232dcc2c094ccec02e76b371d2cb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Make use of QQuickItem::ItemEnabledHasChangedJ-P Nurmi2017-08-311-4/+3
| | | | | | | | | | | | | | | | It was added in qtdeclarative commit 286f14f1. Getting rid of the slow QObject::connect() gives a little boost of 1~2 frames in qmlbench. Change-Id: If027fe2bee9eedad572afe8828b302c2f44cffac Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Fix accessibility-related performance regressionsJ-P Nurmi2017-08-311-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before 089dd16f, we had a QQuickControlPrivate::accessibleAttached member that indicated whether accessibility was active. Since 4be38ab in qtdeclarative, it was possible to access QQuickAccessibleAttached:: attachedProperties() directly, but we ended up accidentally accessing it even when accessibility was not active, which added noticeable overhead. This improves those qmlbench test cases that call accessibility-aware setters such as QQuickAbstractButton::setChecked() a lot. For example, the test cases for CheckBox and RadioButton create large amounts of controls with a "checked: index % 2" binding. - CheckBox: 84 => 93 frames - RadioButton: 98 => 113 frames QAccessible::setActive(true) only notifies the observers, but does not really make accessibility active in the sense that the consequent calls to QAccessible::isActive() still return false. tst_accessible had to be changed to use QPlatformAccessible::setActive() instead. Change-Id: I8fd0fe2dddfd5633ce22a080bcda459f2d6e443e Reviewed-by: Liang Qi <liang.qi@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devJ-P Nurmi2017-07-111-13/+1
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf tests/auto/controls/data/tst_scrollindicator.qml Change-Id: I1f5581ae7814c0d4152e4c9b79a30a8af5a3a17b
| * Remove redundant code in touch event handlersJ-P Nurmi2017-07-071-13/+1
| | | | | | | | | | | | | | | | | | | | | | QEvent::TouchUpdate can contain touch points in any states. It iterates the list of points and calls handlePress/Move/Release(). We can re-use the same handling for QEvent::TouchBegin() (pressed) and QEvent::TouchEnd() (released). This change does not fix anything but makes the next steps easier. Change-Id: I29edd949579ab6a4bf923e455a1ef38adb05e3a5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devJ-P Nurmi2017-06-081-0/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/doc/src/qtquickcontrols2-index.qdoc src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc src/quicktemplates2/qquickapplicationwindow.cpp src/quicktemplates2/qquickmenu.cpp src/quicktemplates2/qquickmenu_p.h src/quicktemplates2/qquickpopup.cpp tests/auto/auto.pro Change-Id: I856a022d38abd84763127539f46ef032ddc53c3d