aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
Commit message (Collapse)AuthorAgeFilesLines
* Native style/Slider: Fix tickmarks and groove for fractional numbersJan Arve Sæther2020-10-191-6/+13
| | | | | | | | | In QQuickSlider, this was very noticeable for very short ranges (e.g. a range less than 1). It also caused wrong rendering of the groove on macOS style. Change-Id: I8a88b2e107e543f5b0cef5a7093b94b08ebeb398 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Nativestyle: Slider on WindowsJan Arve Sæther2020-10-193-29/+51
| | | | | Change-Id: Iab1f01a2cccad21e178aaf13ea21469a5ce98fea Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Native style, macOS: don't draw a background behind the GroupBox labelRichard Moe Gustavsen2020-10-191-0/+19
| | | | | | | | | | | | | | | On macOS, the controls are semi-transparent. This means that if you use a different color for e.g the window background, all the controls will get a different color too. For this reason, we should avoid drawing a background color for the GroupBox label. And to achieve that, we need to override the default background set from DefaultGroupBox, to use an Item instead of a Rectangle. Change-Id: I60c496c19744763adb2ec683670c4a9c64cc32fa Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* nativestyle, ScrollView: don't resize scroll bars according to paddingRichard Moe Gustavsen2020-10-192-8/+8
| | | | | | | | | | | | | | | | | | | | | Depending on if you see the scroll bars as a part of the contents, the background, or neither, they should respect either padding, insets, or none of them. The styles that use transient scrollbars see them partly as a part of the contents (judging from their implementation), which means that their width and height will respect padding, but their position will not (they will always be glued to the right or the bottom side of the control). Letting width and height be affected by padding doesn't work so well with non-transient scroll bars. In that case the scroll bars should normally be "connected" at the bottom-right edge. So change the code so that the scrollbars ignore padding, and instead use the full width and height of the control. Change-Id: Ifa5a7708a51b3773a63ebdd50781eb3845be4744 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Remove QtQuick.Window imports from basic styleEskil Abrahamsen Blomfeldt2020-10-153-3/+0
| | | | | | | | | Window is now part of the main QtQuick import, and the compatibility import does not work with static builds. Change-Id: Ib80f54250902f0728fb57d6d2579f95b3f425956 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* nativestyle, transitionDuration: make property CONSTANTRichard Moe Gustavsen2020-10-142-3/+2
| | | | | | | | | | | | | | Even if the value of transitionDuration never change, the QML engine will still complain if you use the property in a binding, saying that it's not notifyable. So to silence the engine, make it CONSTANT. Also, in macos/ScrollBar.qml, ensure we actually read the transitionDuration from a styleitem (parent is apparently not). Change-Id: I58e89e8771dd645ecd8a0b75a7e3871845d270be Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* nativestyle, ProgressBar: fix copy/paste mistake related to nativeIndicatorRichard Moe Gustavsen2020-10-141-1/+1
| | | | | | | | DefaultProgressBar.qml doesn't have any property called "nativeIndicator". Instead it should use "__nativeBackground". Change-Id: I848f82a9e093476cb806ea7fc436238c281591ac Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* nativestyle, ComboBox: remove insetsRichard Moe Gustavsen2020-10-141-5/+0
| | | | | | | | | | The styleitem no longer has any property called "insets". This was removed a long time ago in favor of layoutRect (which will not affect insets). Change-Id: I460a5062711d03c01fc7de27aea7ac381068b951 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* nativestyle, GroupBox: get groupBoxPadding from the styleitemRichard Moe Gustavsen2020-10-141-1/+1
| | | | | Change-Id: I58f63b22b97ba985f1e4287f20a65f9759257502 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* nativestyle/ScrollBar: don't show the scrollbar if the policy is AlwaysOffRichard Moe Gustavsen2020-10-141-1/+1
| | | | | | | | | As it stood, we would always show the scrollbar if its size was less than 1.0. This is wrong, we should only do that if the policy is also "AsNeeded". Change-Id: I516219dc27e0c3ef80e0e7bc2e11b36a8836e22d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* ScrollView: always clip implicitly created FlickableRichard Moe Gustavsen2020-10-141-1/+0
| | | | | | | | | | | | | | We almost always want to clip the flickable so that flickable contents doesn't show up outside the scrollview. The only time this is not really needed, is when the scrollview covers the whole window and the scrollbars are transient. But for that corner case, if this optimization is needed, the user can simply create his own flickable child inside the scrollview, and control clipping on it explicit. [ChangeLog][ScrollView] ScrollView now clips its contents by default. Change-Id: I44bd7a8c397b90e14d0b9d5db8ec6523da205648 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* macOS/ScrollView: don't create contentItem too earlyRichard Moe Gustavsen2020-10-141-5/+0
| | | | | | | | | | | | | | When creating the binding "contentItem.clip:" we accidentally also created the contentItem before the component was completed. Since the contentItem of a ScrollView is a Flickable, it meant that we ended up always creating an internal flickable from QQuickScrollViewPrivate::ensureFlickable, instead of using the Flickable child if there was one. So this binding cannot be used. Change-Id: I2e7ca63f64693adb1b524966fec82aef2b3fb658 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Have templates depend on QtQuickUlf Hermann2020-10-123-0/+5
| | | | | | | | | | | | Templates defines a number of C++-based QML types, most of those are derived from QQuickItem. Therefore, it actually needs QtQuick although it never explicitly imports QtQuick. In order for tools to figure that out, declare the QtQuick dependency in the qmldir file. Task-number: QTBUG-87164 Change-Id: I982b4ee57102ac62b0ee6e8559e34c5e203a7a0f Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add optional imports for all the styles to controls/qmldirUlf Hermann2020-10-123-0/+23
| | | | | | | | This allows qmllint to find them. Change-Id: I33b8ad4b2a736d914e7522761c2e574e482b9460 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style, macOS: add scrollviewcornerRichard Moe Gustavsen2020-10-124-0/+188
| | | | | | | | | | | | | On macOS (Big Sur), when a ScrollView has both a vertical and a horizontal scrollbar, we should draw a corner item between them so that they look 'connected'. Since we don't have a way to draw that item using QStyle, we simply grab a section of the center of a ScrollBar groove, and use that to create a corner item. Change-Id: I4e4df25b6769e810e6b046f6842f4424450fecb3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style, macOS: always draw a TextField using NSTextFieldRichard Moe Gustavsen2020-10-121-30/+1
| | | | | | | | | | | | | There is no apparent reason as to why we should let QCommonStyle fill the background before it calls PE_FrameLineEdit in QMacStyle. The NSTextField cell already draws the correct background, which is supposede to be semi-transparent in dark-mode. Therefore, just let PE_PanelLineEdit and PE_FrameLineEdit be drawn the same way. Change-Id: Iacd4f1b1802e1b0c2b96a92cf271b681c10b8cff Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: add a function imageSize() rather than overriding minimumSizeRichard Moe Gustavsen2020-10-122-9/+14
| | | | | | | | | | | When not using nine patch scaling, we used to override minimumSize to instead be the actual size of the item, since we use minimumSize to also be the size of the image we draw. But this turns out to be confusing, especially while debugging. So introduce a more explicit imageSize() function instead, and leave minimumSize unchanged. Change-Id: I8d3ec25603d430a94b124713fad01bf6d277bbe5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: ensure ScrollView contents doesn't go under the scrollbarsRichard Moe Gustavsen2020-10-092-0/+6
| | | | | | | | | On macOS the scrollbars are not transient. The contentItem of a ScrollView should therefore be aligned to the side of the scrollbars, rather than to the side of the ScrollView. Change-Id: Ie58753d61c04c979270995deb6e3b2650fa643db Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style, macOS: clip content view when ScrollView is clippedRichard Moe Gustavsen2020-10-091-0/+5
| | | | | | | | | | | | | On macOS, if a ScrollView has a clip set, we should clip the contentItem as well. This because the scrollbars are semi-transparent and non-transient (doesn't float on top), and in that case, the contents will show through them. So we assume that if the user sets a clip on the ScrollView, he want's to make sure that the contents is not showing outside the area where the contents are supposed to be. Change-Id: I7fff89843c0db38ec1caa6d18464e964788743c1 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix static buildEskil Abrahamsen Blomfeldt2020-10-0914-1/+46
| | | | | | | | The register_types() function was optimized away by the linker and the imports would not be found. Change-Id: I3d98602daf78996399630b7b1296cc5dc0d3da05 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix typo in Fusion impl's qmldirMitch Curtis2020-10-092-2/+2
| | | | | | | | | | This led to the following error: qtbug86891_qml_plugin_import.cpp:7: undefined reference to `qt_static_plugin_QtQuickControls2FusionStyleImpPlugin()' Change-Id: I5ec6b5c47215944281ce570dcb70a89e1afe72d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Only add a shortcut if the sequence is not emptyAndy Shaw2020-10-081-2/+6
| | | | | | | | | If the sequence is empty then reset m_shortcutId to -1 so it does not have a shortcut attached to it. Change-Id: I16945950145d9d3ca7da73e998b28d64997501d0 Pick-to: 5.15 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-0727-54/+97
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I4a690095fcd4b1141550de86b6820ae2dd579429 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Native style, StyleItem: add property 'minimumSize'Richard Moe Gustavsen2020-10-063-2/+17
| | | | | | | | | | | | | Some items, like the scrollbar handle, can scale the handle down to 0 if no minimumSize is set. This will truncate the image drawn by QStyle. This patch will expose the minimum size read from QStyle to the QML control. We can then set ScrollBar.minimumSize to the correct value. Change-Id: Ib87e3ca7ea661bf41ab8057941fec7364b606177 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Native style, macOS: handle focus frame special case from c++Richard Moe Gustavsen2020-10-062-8/+23
| | | | | | | | | | Move the expression that finds the correct target for TextArea from QML to C++. Keeping the code in QML simply became to messy when trying to also detect if a TextArea is inside a ScrollView. Change-Id: I3906dd37df73eaceffd60413d2378db7eab5f1bb Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* nativestyle: SpinBox on WindowsJan Arve Sæther2020-10-064-38/+38
| | | | | Change-Id: I334af68282a59099698e46020b0644318eae5cce Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix build after qtbase changesAllan Sandfeld Jensen2020-10-051-10/+10
| | | | | | | | | | 93dad2bf91d414a41c6e2c7db6c75171b4917d4d requires adaptation on declarations. Note the declarations should probably end up removed for Qt6. Change-Id: I8aef41f9be32374506212a953aceecd1ddc75eae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickStyleMargins: use lowercase for QML type nameMitch Curtis2020-10-021-1/+2
| | | | | | | | | | Value types must be lowercase. Fixes the following error: Invalid QML element name "StyleMargins"; value type names must begin with a lowercase letter Change-Id: I2b0ff7ed60bd8844dec95fa57d196e868c1d671d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* macOS: don't set the nine-patch margin exactly on the button widthRichard Moe Gustavsen2020-09-301-1/+1
| | | | | | | | | There is a subtle shadow line at the exact button width, which becomes visible for wide comboboxes. So move the margin one pixel to the left so that we don't scale the image on top of the line. Change-Id: I8780874fdd39178e7cf2fde24117589f222ea324 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: improve debug outputRichard Moe Gustavsen2020-09-302-35/+55
| | | | | | | | | | | | | Improve the debug implementation so that you don't need to modify the application to get debug output. You can now instead just do e.g: QQC2_NATIVESTYLE_DEBUG="myButton output contentRect" QQC2_NATIVESTYLE_DEBUG="combobox ninepatchmargins" QQC2_NATIVESTYLE_DEBUG="all layoutrect" Change-Id: I58cbcfb241bc0be20cae73735bc277d0662a476a Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Native style: don't use transient scrollbarsRichard Moe Gustavsen2020-09-301-1/+1
| | | | | | | | We don't want to hide the scrollbars on desktop when it's not moving. Change-Id: I6ce555b06a598560a7253e2b8e6db71405b9322b Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* NativeStyle: add focus frame to the macOS styleRichard Moe Gustavsen2020-09-2915-0/+462
| | | | | | | | | | | | | | This patch will add a focus frame to the macOS style. We use one focus frame item that we move around according to changes to the focus object. It's normally the background delegate's responsibility to draw a focus frame, so we take care to only draw the native focus frame for controls with default delegates. (to be consistent with the other styles) Change-Id: Iaa7202675c1aad2fc19682563ac1afb6e686c105 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Implement ScrollView.qml in all stylesRichard Moe Gustavsen2020-09-2922-0/+341
| | | | | | | | | | | | | | | | ScrollView.qml makes use of ScrollBar. While most of the styles override ScrollBar.qml, almost none override ScrollView.qml. This means that the ScrollView in Basic style will be used, and that ScrollView will always use it's own scrollbars, regardless if the overridden style provides another ScrollBar.qml. This patch will override ScrollView.qml for all the internal styles so that the correct scrollbars will be used. Change-Id: I1d9ba17f225a82b2dfaae6caba6ac4519f79a705 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* windows: Add hover animation to Button and CheckBoxJan Arve Sæther2020-09-297-22/+108
| | | | | | | | Move the hover animation handling API from macOS ScrollBar down to QQuickStyleItem. Change-Id: I36c8b173a15d0f4e10a59b7f3ccfe635e05c73e7 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* NativeStyle: add focusFrameRadius to QStyleRichard Moe Gustavsen2020-09-2912-0/+48
| | | | | | | | | | | To be able to show a focus frame around a control from QML, we need to know the control's geometry and radius. For the geometry we can use the already existing layout rect. But for the latter we need to add focusFrameRadius enums to QStyle using the already existing pixel metric function. Change-Id: I45619194766cccbf824d93073a4dcea3a0893fbe Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* NativeStyle, macOS: adjust layout rectsRichard Moe Gustavsen2020-09-281-59/+38
| | | | | | | | | Go trough the layout rects, and adjust them so the look correct (by using nativestyle manual test and PixelTool). Change-Id: Idbd132b75fb2f87f8ff24cbe3a490ba6b3d2adc6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* CMake: Regenerate projects before API changeAlexandru Croitor2020-09-255-5/+0
| | | | | | | Task-number: QTBUG-86815 Change-Id: Ie0688d13b1787da3c1fc241a7d864aa014ca1d70 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* NativeStyle, macOS: don't draw focus from QStyleRichard Moe Gustavsen2020-09-252-160/+0
| | | | | | | | | We're no longer going to draw a static focus frame from QStyle. Subsequent patches will add a dynamic focus frame in combination with QML. Change-Id: I08b13b4c51cab74cd1bc6ec66b879b49774ad267 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* NativeStyle: rename 'nativeBackground' to '__nativeBackground'Richard Moe Gustavsen2020-09-2514-74/+70
| | | | | | | | | Since all properties that we add to the QML style files will bleed into the API of the control, prepend '__' to nativeBackground to mark it as private. Change-Id: I0cb474e054c3a3824985cf39b4bb675fb57b0696 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Add Qt 6 changes filesPaul Wicking2020-09-246-0/+138
| | | | | | Task-number: QTBUG-84051 Change-Id: Ibfd1750b571f65bf76a3922f89510b6c6fd4eff9 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Support compile-time style selectionMitch Curtis2020-09-243-73/+74
| | | | | | | | | | | | | | By allowing importing styles without first importing QtQuick.Controls, which does runtime style selection. [ChangeLog][Styles] It's now possible to select a style at compile-time by importing that style explicitly instead of QtQuick.Controls. This avoids the need to do run-time style selection and hence deploy the QtQuick.Controls plugin with the application. Change-Id: I666d6dc7727fffd2c7b05743855f2086f076465a Fixes: QTBUG-86284 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove QtQuick.Controls imports from styles' QML filesMitch Curtis2020-09-24194-194/+0
| | | | | | | | | | This is necessary to support compile-time style selection. If we don't do this, QtQuickControls2Plugin (which is now only used for run-time style selection) will be loaded unnecessarily. Task-number: QTBUG-86284 Change-Id: Id5338f147e3e97f25574ec98377d26b111f8341a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Rename "Default" style to "Basic"Mitch Curtis2020-09-24127-271/+271
| | | | | | | | | | | | [ChangeLog][Styles] The Default style was renamed to Basic to account for the introduction of the platform styles (macOS, Windows), which will be used by default (where possible) when no style is specified. Fixes: QTBUG-85984 Task-number: QTBUG-68814 Task-number: QTBUG-86403 Change-Id: I22b3199c8662e4ee5d55a1be1a51c9856ac62376 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix fallback styles overwriting themesMitch Curtis2020-09-2424-92/+230
| | | | | | | | | | | | | | | | | | | | | In Qt 5, QtQuickControls2Plugin::registerTypes() was responsible for calling initializeTheme() on each style plugin. Now that we delegate more work to the QML engine, each style plugin calls initializeTheme() via registerTypes(). To avoid fallback styles overwriting font and palette data set by the current style, we need to check if the theme has been intialized before calling initializeTheme(). To do this, we add a static "themeInitialized" bool that QQuickStylePlugin sets to true after calling intializeTheme() for the first time. It checks this value and avoids calling intializeTheme() if it's true. We also need to make QQuickStylePlugin ensure that the theme it's initializing belongs to the current style. Fixes: QTBUG-86303 Change-Id: Ie65e646677c78622829f4949c41cb79204cf5786 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QtQuickControls2Plugin: store style values returned from QQuickStyle APIMitch Curtis2020-09-241-18/+26
| | | | | | | | | | | | | In follow-up commits, QQuickStylePlugin will be reponsible for calling QQuickStylePrivate::reset(), which may happen before ~QtQuickControls2Plugin is called. To avoid issues, we need to store anything we need from QQuickStyle APIs so that we can be sure that it's valid in QtQuickControls2Plugin::unregisterTypes(). This also avoids unnecessary calls to QQuickStyleSpec::resolve(). Change-Id: I7f659b432741b96ee58452c4867b7ecd12c6cfde Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* NativeStyle, TextField: add missing layoutRectRichard Moe Gustavsen2020-09-241-0/+1
| | | | | | | | | QQuickStyleItemTextField didn't set a layoutRect. This was just an oversight, and causes layout issues when trying to read it to position the focus frame. Change-Id: Ic959fd315da38e9700dc079c75993feca29c0c61 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* nativestyle: Port Windows XP styleJan Arve Sæther2020-09-178-458/+336
| | | | | | | Some controls needs more care, but that's for follow-up commits Change-Id: Ia7afeccf06f2f12dbef1402bf5975807cad8adcb Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Native style: support progressbars with a range from 0 - 1Richard Moe Gustavsen2020-09-171-0/+5
| | | | | | | | | | | | | | A ProgressBar is based on floating point numbers, meaning that it can have e.g from == 0.5, to == 1.5, and value == 0.8. A ProgressBar in QStyle on the other hand is integer-based. So add some extra code to convert floats to ints before passing the values to QStyle. But only do this for ranges smaller than 100, to ensure that we don't overflow ranges that are really large. And let "to" start at 0 in case the range ends close to Number.MAX_VALUE. Change-Id: I2707647911ee31c91b435697d4ae840b304c5c69 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: implement implicit minimum sizeRichard Moe Gustavsen2020-09-176-10/+19
| | | | | | | | | | | | | | | | | | | | QStyle doesn't calculate a sensible minimum implicit size for us, only a implicit size that matches the size of the contents. This means that if the contents is empty (e.g a TextField that has no text), the implicit size will typically be smaller than what a sensible minimum should be. Note that for widgets, a sensible preffered size is set from the widgets themselves, and not QStyle. Which explains why the sizes we get from QStyle can sometimes be too small. Therefore, add a sensible minimum implicit size to all the controls that suffers from this problem. We let QStyle continue to calculate the actual minimum size given the contents as before (which will end up as the StyleItem's implicit size), and instead fix the recommended minimum size directly in the QML style files. Change-Id: Ic4097776e40d0de64312e4099d7fe4c7fc1ca9d1 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Remove "High-DPI Support in Qt Quick Controls" doc pageVolker Hilsheimer2020-09-163-69/+0
| | | | | | | | | | | It is probably wrong enough to require a thorough rewrite. Given that it has nuggest such as "There is currently no available solution for high-DPI support in applications wishing to mix Qt Quick Controls and Qt Quick Controls", starting from scratch seems best. Change-Id: Id1ae9d0bc58da452457cbf4bcdebf658f74cb377 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>