aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Register native styles under 2.0 in addition to 6.0Mitch Curtis2020-11-1111-68/+121
| | | | | | | | | | | | | | | | | | Since we changed the logic that decides the default style, users with QML that imports 2.x versions of QtQuick.Controls will get errors if the default style that is chosen is a native style: qrc:/main.qml:53:1: module "QtQuick.Controls.macOS" version 2.15 is not installed qrc:/main.qml: Failed to load dependencies for module "QtQuick.Controls" version 2.15 We use PAST_MAJOR_VERSIONS to register the module for 2.x, and not just 6.0, and register the types of those styles under version 2.0 in addition to 6.0. This should not cause any problems for existing QML code. Fixes: QTBUG-87658 Change-Id: I976078c0aea3fbebe4e04f5ba4d8056c0ca7a0e6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickStackView: Allow URLs in createElement()Ulf Hermann2020-11-111-0/+20
| | | | | | | | | | The value is intended to be a URL, therefore only accepting the string form is not enough. Task-number: QTBUG-88372 Change-Id: I4d31d1c5eacd49b7591f087c2e82c31b70a3bc1d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Follow up on change of QQmlListProperty to qsizetypeVolker Hilsheimer2020-11-1115-68/+68
| | | | | | | | | | | | | This deals with d7008c79d4ec023527ebfc118ad47f40075f244d in qtdeclarative which aligned QQmlListProperty with our container types. Note: not changing the respective APIs of the QQuick classes in this change. Ie. QQuickPlatformMenu::insertItem still operates on int as index, and QQuickMenuPrivate still stores currentIndex as int. This might need to be addressed in a follow-up commit. Fixes: QTBUG-88362 Change-Id: Ia663cfa47fa91c55997cdef288b2a866107a5f25 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlDesigner: Remove duplicate of repeatThomas Hartmann2020-11-102-13/+3
| | | | | | | | | | The autoRepeat property is already part of AbstractButton. I renamed "Repeat" to "Auto Repeat" Pick-to: 5.15 Change-Id: I4f22ebc18a2094e67c8f48263f84ab9eb7d497b6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Document how to use Controls types in property declarationsMitch Curtis2020-11-094-2/+77
| | | | | | | Fixes: QTBUG-88222 Change-Id: I26ac9ce14fc86b3ada4e3024cb70b1ed4ce4755b Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Rename "Porting" pages to "Changes"Jerome Pasion2020-11-095-5/+5
| | | | | | | | | | | | | | The content in the porting guides are closer to a changelog than a porting guide. At this point, it is easier for maintainers and contributors to write in a changelog than a guide. This change should help with readability and is closer to the usage of "Changes" in documentation. Part of a rename in other submodules. Task-number: QTBUG-87156 Change-Id: Ib34fc9e3e5719c75fcd7d18d9d2cc7dd994c3116 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Fix broken links and other warningsVenugopal Shivashankar2020-11-094-4/+8
| | | | | | | | | | | | | | | | Fixed these warnings: qt5/qtquickcontrols2/src/quicktemplates2/qquickdialog.cpp:515: (qdoc) warning: Missing '}' qt5/qtquickcontrols2/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc:28: (qdoc) warning: Can't link to 'Creating Qt Quick Projects' qt5/qtquickcontrols2/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc:28: (qdoc) warning: Can't link to 'Differences with Qt Quick Controls 1' qt5/qtquickcontrols2/src/quicktemplates2/qquickdialog.cpp:505: (qdoc) warning: Can't link to 'Popup::' Change-Id: I7f66c7e3baa317af0890876ec7a7e9084997f324 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: use correct casing for Material style nameMitch Curtis2020-11-091-4/+4
| | | | | Change-Id: Ia2d10b9fd27c8e83bfd8ed8ae021391ba1df50f1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Qt Labs Platform - Qt 6 porting guideMitch Curtis2020-11-091-1/+14
| | | | | | Task-number: QTBUG-88158 Change-Id: Idce6ec14216d5f09b4cc729677b17084defdee1b Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Qt Quick Controls 2 - Qt 6 porting guideMitch Curtis2020-11-091-0/+250
| | | | | | Fixes: QTBUG-88158 Change-Id: I25eb0d0fef161fdb7c63ae66d27244bb359ce0c2 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: remove all instances of \qmlpropertygroupMitch Curtis2020-11-0910-12/+0
| | | | | | | | This is apparently no longer necessary. Pick-to: 5.15 Change-Id: I0f45a84ced5118d248ffab4e745c4e2f2ce5738f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: fix Qt Labs Platform Menu icon documentationMitch Curtis2020-11-091-4/+4
| | | | | | | | It was probably copy-pasted from MenuItem. Pick-to: 5.15 Change-Id: I20f7e107252346f52bf8c061fe18e1ca6a0bf150 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Doc: update Versions sectionMitch Curtis2020-11-091-5/+14
| | | | | | | | | Since not everyone will switch to Qt 6 instantly, and the Qt 6 docs will become the "current" docs that users see when they search online, it's good to keep the information about older versions around. Change-Id: I7efa6efa5a25a10f292160f5cb53b2ef17ad6d57 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* 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-0616-723/+66
| | | | | | | | | | | 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>
* Doc: fix SplitView's inheritanceMitch Curtis2020-11-051-1/+1
| | | | | | | | | It inherits Container. Fixes: QTBUG-88184 Pick-to: 5.15 Change-Id: Ic4878c2b240dad2294569a48c4f39e82d377133a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Native style: Enable windows styleJan Arve Sæther2020-11-041-7/+5
| | | | | | Task-number: QTBUG-86399 Change-Id: I634db1d4514a685743504748251e53703676881a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix QQuickHeaderView models to pass model testerVolker Hilsheimer2020-11-041-3/+8
| | | | | | | | | | | | | | | | Following 72e0d699cec09458ca9325035d477d4899e8e47b in qtbase, the model tester exercises additional code paths to verify correct row/columnCount implementations for flat models. This revealed a few bugs in the models used in QQuickHeaderView and the unit test: * neither QHeaderDataProxyModel nor the test models handled a valid parent index for calls to row/columnCount * QHeaderDataProxyModel::sibling passed the index on as parent Change-Id: I612e18030d837275614d61ce8987c93fff7f20a9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Filter touch presses and releases in QQDrawer::childMouseEventFilter()Shawn Rutledge2020-11-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | For pressPoint to be set, we must enter QQuickPopupPrivate::handlePress() but until now, Drawer has filtered a synthetic mouse press in order to get there. Now that Flickable is handling touch events directly, we have a new rule that if an item has acceptTouchEvents() == true, and also filters mouse or touch events, then it must filter touch events: QQuickWindowPrivate::sendFilteredPointerEventImpl() no longer constructs a synth-mouse event for that item, because it has declared that it knows how to handle touch events. This rule applies to Drawer. Setting pressPoint is also unnecessary, because it should always be the same as QEventPoint::scenePressPosition(). But refactoring all functions like handlePress(QQuickItem *item, const QPointF &point, ulong timestamp) (and handleMove and handleRelease) to take QEventPoint instead will be a larger refactoring. But until then, when pressPoint is not set, QQuickDrawerPrivate::grabTouch() usually sees the drag threshold being exceeded when it compares the current scene position against 0,0 which is why it takes the grab from some control inside (e.g. Slider). Fixes: QTBUG-88170 Change-Id: Ia88aed59695feb3d5fdabbbf276241e427ac9d89 Reviewed-by: Mitch Curtis <mitch.curtis@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-025-8/+8
| | | | | 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>
* QQuickAbstractButton: don't accept key release if we're not pressedMitch Curtis2020-10-211-1/+1
| | | | | | | | | | | | | A control should have been pressed if it's going to accept a release. This prevents an issue where a menu opened by pressing enter (handled via attached Keys property) would instantly trigger the first menu item. Pick-to: 5.15 5.12 Fixes: QTBUG-83698 Change-Id: I6b1afbb76f37623012472b2b1148b4862c159239 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@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>
* ScrollView: document how you can make ScrollView scroll in only one directionRichard Moe Gustavsen2020-10-151-1/+7
| | | | | | | | | | | It's not obvious how you can make a ScrollView resize the content size in such a way that you're only allowed to scroll in one direction (taking any scroll bars or padding into account). So add a line the explains how you can do it. Pick-to: 5.15 Change-Id: I2d4594d99eab2390d7a5f24710a7e381dbac4c2b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>