aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
Commit message (Collapse)AuthorAgeFilesLines
...
* Doc: remove Qt Quick Templates' Qt 6 porting guideMitch Curtis2020-11-091-42/+0
| | | | | | | | | | | While Qt Quick Templates does define the API for each type, it and Qt Quick Controls are quite closely intertwined, and it doesn't serve much value to have the porting guides separated. Task-number: QTBUG-88158 Change-Id: I9d5ee403049a17da1dc5e45e7d26bbd6c7b5b986 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Fix qdoc warningsVenugopal Shivashankar2020-11-068-704/+48
| | | | | | | | | | | Mostly broken links to types and properties that are either dropped or renamed. Task-number: QTBUG-88141 Fixes: QTBUG-88141 Change-Id: I44789cdd1b8560a967b0b3868fd637deef488d88 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style/GroupBox: Add contentsMargins for GroupBox on WindowsJan Arve Sæther2020-11-061-0/+9
| | | | | | | | | | | QWindowsStyle did not add these margins because the layout did that. (It had a 9 pixel margin all around it) However, Qt Quick Controls2 expects that the contentPadding includes that margin. We therefore change the subControlRect implementation for (CC_GroupBox,SC_GroupBoxContents) to add those margins. Change-Id: I953a49340dc085716b4e9ecf736a5438e7cc4bbd Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QQuickStyleItem: use imageSize directlyRichard Moe Gustavsen2020-11-041-10/+9
| | | | | | | | There is no reason to calculate the image size over and over. Just calculate imgSize once. Change-Id: Idf49a64102de18ba535899d4a46085de79e7ca2f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQuickStyleItem: reuse QImage when painting, if possibleRichard Moe Gustavsen2020-11-041-2/+7
| | | | | | | | | | If the size of the QImage we draw on hasn't changed between subsequent calls to paintControlToImage, we can just reuse the one we already got. This way we avoid creating and throwing away images unnecessary. Change-Id: Icf65bb8d9008a21e7114e588df46bc1e4cbdea97 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Native style: add separate Info debug flagRichard Moe Gustavsen2020-11-022-19/+23
| | | | | | | | | | | | | | | Add an extra debug flag that lets us distinguish between general information, like geometry info, and explicit debug statements. E.g when writing: qqc2Debug() << "entering this block" ...you sometimes only want to print that line, and not all the additional "noise" you also get if this would print out general information. Change-Id: I86f60557f7c9b08e24c3de55bd0d526e095c6104 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Fix deprecation warnings related to QIcon::pixmap()Friedemann Kleint2020-11-021-27/+37
| | | | | Change-Id: I5eb7441ce557773e5253d3ce623be637819bab0d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix deprecation warnings related to QMetaTypeFriedemann Kleint2020-11-024-7/+7
| | | | | Change-Id: I4e6c1b03915c33f6225c0fb7f86e6acb7715cd4d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* nativestyle: refactor many functions to be constRichard Moe Gustavsen2020-11-0228-102/+102
| | | | | | | | Many of the virtual functions should be const, as they should not modify the state of the item. Change-Id: I94a7f9ae56204c8f8f737911e15d81f82d8add83 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* macOS: draw the handle as a part of the backgroundRichard Moe Gustavsen2020-10-302-1/+30
| | | | | | | | | | | | | | | | In dark mode, the slider handle is semi-transparent. If we draw the handle and the groove separately like we do today, the handle will end up _on top of_ the groove rather than as a part of it. The result is that you will see the groove behind the handle, which is wrong. Since we already draw the groove with tick marks without using a nine-patch image, we might as well draw the handle at the same time. This will give us the correct appearance. Change-Id: Ie582f99450c824d6955e3c0783dad89ab41160ef Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* macOS: clean up slider qstyle implementationRichard Moe Gustavsen2020-10-301-81/+31
| | | | | | | | | | | | | | | | | | | | | The current implementation doesn't work if drawing the groove and the handle together. The reason is that we transformed the CGContext as a way to flip the groove when drawing the slider in inverted (upside down) mode, which would also affect the position of the handle. Since we don't have an inverted API in Slider, we can simplify the code greatly in QStyle and remove all the transformation code. If we are to support inverted mode in the future, this can be achieved much easier by simply setting the scale on the Slider (or the style item) to -1. We also change the way we draw tick marks on both sides of the slider to use the API in NSSliderCell directly rather than manipulating the CGContext. Change-Id: I882a9e7eb69944da590d9d6b5ffb85c1f960cdaf Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Native style/Button: Avoid that the label gets elidedJan Arve Sæther2020-10-291-1/+1
| | | | | | | | | | | | | This was observed on Button on Windows style, where the labels size hint was a fractional number (e.g. 38.26). This got truncated by QQuickStyleItem::contentSize(), which caused the content item to get less space than it actually needed It was only observed on Button, but it was likely to also happen with other control types. Change-Id: I50b98fa7d54e5be2cedeeaf60018367689f168cf Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Change terminology to "look and feel"Jerome Pasion2020-10-292-3/+3
| | | | | | | | -should be "look and feel" Task-number: QTBUG-88010 Change-Id: I8fa72334a7fb0aab7e057422364966055ac39584 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QuickStyleItem: refactor updatePaintNode()Richard Moe Gustavsen2020-10-291-20/+23
| | | | | | | | | Refactor the padding part, since there is no reason to go through all the if-tests if we don't use nine patch image scaling. Change-Id: If89c13aec0e6de955f032145ee325974c7169d6c Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Regenerate CMake project filesMitch Curtis2020-10-289-0/+16
| | | | | Change-Id: I7f1fe2b07a6c22f02802b0fdc31917b398cbd770 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* macOS: Update slider metrics by explicitly asking it to layoutRichard Moe Gustavsen2020-10-281-33/+4
| | | | | | | Cherry-picked from qtbase:873579d1579 Change-Id: Icb9ba3cabe9d5bd6670a6e4659701d06ff048d13 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* macOS: Don't assume NSSlider is never flippedRichard Moe Gustavsen2020-10-281-7/+7
| | | | | | | Cherry-picked from qtbase:6f850c080aac36 Change-Id: Ib6fd2ffa918a8bd5c4e7f0a3198eff36b3298f6d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* macOS: stop using the deprecated APIRichard Moe Gustavsen2020-10-281-3/+0
| | | | | | Change-Id: If1481afbfbc2e655e2b09a232abb16aa2dd792fe Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* nativestyle: only draw the control if the control is visibleRichard Moe Gustavsen2020-10-282-1/+16
| | | | | | | | Check if the control is visible before taking the time to draw the image. Change-Id: Icb64b85355e1341279a95e9035ae18d91c14d6a8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickStyleItem: add proper constructorRichard Moe Gustavsen2020-10-282-2/+3
| | | | | | | | | QQuickStyleItem has been missing a proper constructor that calls the constructur of the base class. This patch will add one. Change-Id: I7ba16b84a548bf8674723aa0d569b929111d07cf Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* nativestyle, slider: ensure that we set correct slider positionRichard Moe Gustavsen2020-10-271-2/+1
| | | | | | | | | | slider.position is a number between 0 and 1. And when the position is 1, styleOption.sliderPosition should be equal to styleOption.maximum. So no reason to subtract "min" (which is also not a normalized number). Change-Id: I9f9ff2e112e224b3aa32bda12aa1963a6e74c6ca Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Native style: Add ComboBox for WindowsJan Arve Sæther2020-10-273-36/+150
| | | | | Change-Id: I59f64b3941bd0744bba6f6079b9ab3fc30063447 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Text color should not be bright when highlighted on WindowsJan Arve Sæther2020-10-271-2/+1
| | | | | Change-Id: I863764d6b3f957a92551d1cd51f2e69e980db9d3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Native style: Fix bug in layoutMargins()Jan Arve Sæther2020-10-262-3/+7
| | | | | | | | | | | | | | It should return margin of 0 if style()->subElementRect(XXXLayoutItem) returned an invalid rect. This means that we cannot rely on m_styleItemGeometry.layoutRect blindly. Change-Id: If6b5a40481c8199a63f3446abc9e7dd1c670d181 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Native style: Add ScrollBar on WindowsJan Arve Sæther2020-10-236-4/+131
| | | | | Change-Id: I82c8cf3e637550cd458ac77f2cc4f6490dc11802 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* nativestyle: add missing cmake fieldsRichard Moe Gustavsen2020-10-221-0/+2
| | | | | | Change-Id: Ic975da18b11fa3e9bc472dcc4c33d6ffcbc90519 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* CMake: Fix no-widgets buildAlexandru Croitor2020-10-212-6/+108
| | | | | | Task-number: QTBUG-86053 Change-Id: Ia2e3c3d0164550bb77b73edb3ef8f5e634e09ea7 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* 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>