aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/snippets/qml
Commit message (Collapse)AuthorAgeFilesLines
* Flickable: add positionViewAtChild, flickToChild, flickTo(position)Xavier BESSON5 days2-0/+64
| | | | | | Fixes: QTBUG-141747 Change-Id: Icc194fb35da84f580b3bdfcb64944f5834b766dc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Fix qml lint binding warningsAndreas Eliasson2025-10-291-5/+5
| | | | | | | | | These snippets show up in the Qt Quick States documentation. Fixes: QTBUG-140487 Pick-to: 6.10 Change-Id: I897865e16a356c1c561715adc4daa97a4bd3dd67 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* IntValidator docs: Provide guidance on intermediate resultsFabian Kosmale2025-10-101-2/+1
| | | | | | | | | | | | | | | | | | | | | Validators in QML do not actually expose the three states (Valid, Invalid, Intermediate) directly, but only support their usage through TextField. This makes it slightly tricky to raise awareness about intermediate results. Nevertheless, we can expand the example to avoid confusion how IntValidator restricts input, and to encourage users to create a visual indicator based on acceptableInput. The color can also be a binding in the snippet. Amends 17a777a5dfa72e47d02c3e6b4c3a137d923d50bc Pick-to: 6.10 6.8 Fixes: QTBUG-85490 Change-Id: Ia3f7d21d6d7c13943cc2469c4ab8f3c00fd2eada Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Replace nokia.com logo URLs with something that works for nowShawn Rutledge2025-09-262-2/+2
| | | | | | | | | If only the qt.io website could be relied upon to have a Qt logo in the same path for eternity... Pick-to: 6.8 6.10 Change-Id: Ie221bd85152af42bdf36655083932ca8341c7d2a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* doc: Make transform snippets runnableShawn Rutledge2025-04-022-5/+18
| | | | | | | | | | | | | It's not clear at this point where qt.png was supposed to come from, but the modern Qt logo seems to work well enough. In the case of Item with two transforms, perhaps this was not tested before; that's the trouble with inline qml code. It's a little easier to visualize the effect with an Image of which you can see more than one edge (although parts of it remain hidden now too). Pick-to: 6.9 6.8 Change-Id: I64c685d4dc9568080b0ddb4921d987b07eb17c41 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Modernize some model/view/delegate snippetsUlf Hermann2025-03-133-13/+38
| | | | | | | | | Use required properties where possible and unclutter the formatting. Pick-to: 6.9 6.8 Change-Id: Ib170676892e4eed514fa025d0dc1fd9562ab1a08 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* PathRectangle: add bevel propertiesMitch Curtis2025-03-042-0/+70
| | | | | | | | | | | These are needed for the RectangleShape from QtQuick.Shapes.DesignHelpers. [ChangeLog][Shapes] Added bevel properties. Task-number: QDS-13283 Change-Id: I904d6bd9b02bc0fccd271cba5e764040f20de995 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Doc: Add example to QML IntValidator and DoubleValidatorDheerendra Purohit2025-02-242-0/+34
| | | | | | | | | | Add code snippet for IntValidator and Doublevalidator in Doc. Update with suggested improvements. Fixes: QTBUG-16051 Pick-to: 6.8 6.9 Change-Id: Ia34afb23338ca78a9b853b049f9959f2700b8334 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make SafeArea.additionalMargins actually add to the margins, not unionTor Arne Vestbø2025-01-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The semantics of SafeArea.additionalMargins was initially to union the additional margins with the inherited margins, as this fit nicely with the case of adding margins for a header that lives in the non-safe area of the window. But for the case of a header that lives within the existing safe area, but wants to add additional margins for its container's children, the API was awkward, requiring the user to include the inherited margins explicitly. The name additionalMargins was also not correct given these semantics. We now follow the semantics of addition, which makes the use-case of a header that lives in the non-safe area a bit more explicit, but also clearer on exactly how much additional margins is added. The new semantics also match how AppKit/UIKit handles additional safe area insets, so the behavior should be familiar to anyone coming from those platforms. Pick-to: 6.9 Change-Id: I05e42e68da4237c0c7963457452ffea034ea3ae1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* TreeViewDelegate: hasChildren should be bool, not intRichard Moe Gustavsen2025-01-091-1/+1
| | | | | | | | | The documentation and the manual test declares 'hasChildren' as 'int'. It should be 'bool'. Pick-to: 6.9 6.8 Change-Id: Ied8c66f3758e759b5803cf0e08135555644747b8 Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
* Doc: add "Hiding Delegates" section to ListView's docsMitch Curtis2024-11-281-0/+27
| | | | | | | | This comes up often online, so let's document the official advice. Pick-to: 6.5 6.8 Change-Id: I926326bc3b033d38746a508e5c448b5b055effeb Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Doc: add "Avoid Storing State in Delegates" section to ListView's docsMitch Curtis2024-11-282-0/+46
| | | | | | | | | | | This is mentioned in a couple of places, so add a dedicated section and link to it. Also add a section to the Qt Quick best practices page. Pick-to: 6.5 6.8 Change-Id: I0ba528e6c37b0c9c82ca1847817251f176b7f978 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add SafeArea attached propertyTor Arne Vestbø2024-11-283-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | The SafeArea attached type provides information about the areas of an Item or Window where content may risk being overlapped by other UI elements, such as system title bars or status bars. This information can be used to lay out children of an item within the safe area of the item, while still allowing a background color or effect to span the entire item. The attached type also provides a writable property to add additional margins, which are reflected through the item's and any children's safe area margins. This is useful for informing child items about elements such as headers or footers, that may overlap the other child items. Task-number: QTBUG-125373 Change-Id: Id83e384f31f9770367c98e6455ec44e1086beb8a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Modify the Listview snippet to fix Unqualified access warningsMate Barany2024-11-181-2/+7
| | | | | | | | | | | | | | | | Probably has not been updated for a while now, copy pasting and running the example leads to unqualified access warnings. https://doc.qt.io/qt-6/qtquick-modelviewsdata-modelview.html "In most cases you should use required properties to pass model data into your delegates." Fix the snippet by using required properties. Pick-to: 6.8 6.5 Change-Id: I4a46f1ff29712238dd22bf4455a6674d8bdc0f49 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Modify snippet so the screenshot looks accurateMate Barany2024-11-081-1/+1
| | | | | | | | | | | | When using the example code in listview-decorations.qml the result does not look like as the attached screenshot: the gray highlight does not extend until the end of the line, it stops at the end of the name. Modify the snippet to match the screenshot. Change-Id: Ib1b810381427fc37052c70082a8b1bba1d2fb4a6 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: Remove QML versioning from TableView code snippetsKai Köhne2024-08-212-2/+1
| | | | | | | | | | The versioning is irrelevant for the snippet purpose - see https://doc.qt.io/qt-6/qml-qtquick-tableview.html#example-usage Pick-to: 6.8 Change-Id: I5b6abb3334d66453689b10651ed0ddffaf9ab697 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: Update Rectangle gradient code example; improve runnabilityAndreas Eliasson2024-07-041-13/+21
| | | | | | | | | | | | | | | | There was an example using rotation to create a horizontal gradient. Add a Rectangle that uses the Gradient orientation property (new in Qt 5.12). Also use Grid, to avoid setting explicit coordinates and avoid overlapping. Use two different gradient presets. Amends 1771d298f33543a3fe47decfe0fff10609b01ab1 Fixes: QTBUG-126432 Pick-to: 6.8 6.7 Change-Id: Iddb73a2b589395e4b4240a66ea7013709336f1e4 Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Docs: Clarify the snippet about Editing Cells in a TableViewAlexei Cazacov2024-06-171-1/+1
| | | | | | | | | | This commit corrects the code snippet provided for editing cells in TableView. Fixes: QTBUG-125157 Pick-to: 6.8 6.7 6.5 Change-Id: I639926d7a1b4316dad84f8fbff35e9088e19fa95 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Improve font documentationMitch Curtis2024-05-231-0/+22
| | | | | | | | | | | - Move snippets into a file so they are tested by tst_quick_examples. - Add snippet that shows how to construct a standalone font, which is useful for sharing fonts among Components, for example. Pick-to: 6.5 6.7 Change-Id: I87ef72c601060b6874d727aa4800f254c62f3eaf Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: explain that Window doesn't apply palette.window automaticallyMitch Curtis2024-05-201-0/+2
| | | | | | | Fixes: QTBUG-124357 Pick-to: 6.5 6.7 Change-Id: Id899833d750fab69c0ca7c2a7a01d9e1f109e0e5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Correct doc snippet licenseLucie Gérard2024-03-2214-14/+14
| | | | | | | | | | | | | | All file under doc/snippet should be license as Documentation snippets and according to QUIP-18 [1] thi is LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 6.7.0 Task-number: QTBUG-121787 Change-Id: Iee9bc9b8c2a81695c5825a36768b36db2726bd35 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Add TextDocument.errorString propertyShawn Rutledge2024-02-271-5/+2
| | | | | | | | | | | | | | In bec8df96b7615c6ce419867254027773ea7fd6b1 we added status and removed the translated error string. But actually it's a common pattern to have the error string available too, so as to avoid needing to generate it from an enum value. Also, in the textEditStatusSwitch.qml snippet, setting textFormat is necessary after fdbacf2d5c0a04925bcb3aecd7bf47da5fb69227 Pick-to: 6.7 Change-Id: Ie880efa4bf347b70eb6cc4005283b1fc50e15508 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add imageSourceSize property to QQuickDragWang Zichong2024-02-242-0/+54
| | | | | | | | | | | | | | | | | | | | | | Currently we can only assign an image URL to QQuickDrag to represent the data during the drag and drop operation. We made it easier to load arbitrary images in ac78bf7074c4aa2414b4da38db5b574bec9e4b71 : it does not have to come from Item.grabToImage(). But the image size depended only on the image provider's default behavior. Now we give developers the ability to set a preferred image size when needed. The revision of this new property and its signal is omitted because of QTBUG-33179. [ChangeLog][Qt Quick][Drag] The attaching type Drag has a new imageSourceSize property, which can be used like Image.sourceSize to scale the drag image during loading. Fixes: QTBUG-122705 Task-number: QTBUG-120489 Task-number: QTBUG-33179 Change-Id: I92996b8f70b7ca1c9ab783d7ed9f21649d512ab9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Replace TextEdit.textDocument.error signal with status propertyShawn Rutledge2024-01-233-0/+180
| | | | | | | | | | | | | | | If we make loading and saving asynchronous later, we'll need the same sort of status property as in Image, Loader etc. to let the user QML know when it's done, or when it has failed. Bindings are more flexible than signal handlers; so we might as well have better-prepared API now. To make use of the Status enum in QML, we need to de-anonymize TextDocument and make it merely uncreatable. Anyway, it was already referred to as the TextDocument type in the docs. Pick-to: 6.7 Change-Id: Ia4354feba77995759797030382891308b941f0af Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Remove qml locale and dynamicscene examplesLucie Gérard2023-11-281-0/+13
| | | | | | | | | locale example has no documentation dynamicscene example does not promote good behavior Task-number: QTBUG-119117 Change-Id: I782375e2ac50b73535d51a031711222efc15b3ad Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* TreeView: document how to implement expanding indicatorsRichard Moe Gustavsen2023-11-271-18/+51
| | | | | | | | | | | | | | | | | | | | Being able to rotate the expanded/collapsed indicator in a TreeView is assumed to be a normal request. But it's not very intuitive to implement, since TreeView will do a relayout when you expand or collapse a node, which will cause existing delegates to be reused. If a delegate has an ongoing animations at this point, it will look weird. In order to solve that, you need to use the TableView.onPooled/onReused signals, which is not intuitive. Until (and if) we have have a more explicit API to support this, at least show in the documented example how it can be done. Pick-to: 6.6 6.5 Change-Id: Ibf08fd8518d74ba12a4a6f7db71f3f56a8970fac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* doc: Set Drag.imageSource before Drag.active to avoid race conditionShawn Rutledge2023-11-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | grabToImage() is asynchronous. 4b982c744f538a24e21a2af146c45f93d27dd1cb started it on mouse press, which generally gave it enough time before the QDrag became active; but 5971a6faaa1124f5ef3f0b42d4ed0298cf8096a3 changed it to call grabToImage() in DragHandler.onActiveChanged, which means waiting until the drag threshold is exceeded. (DragHandler doesn't offer a way to detect when the point is pressed. One could probably use a separate TapHandler or PointHandler just to detect the press; but that's also inefficient and inconvenient.) If we also bind Drag.active to DragHandler.active, it's very likely that the binding is updated before grabToImage() is done; and as documented, setting imageSource after the drag has started has no effect (that in turn is a limitation in QDrag and the platform support, probably a limitation on actual platforms). So just wait until the screen-grab is done before setting Drag.active, as a workaround for now. This is a step back in declarativeness, using JS rather than a binding. But setting imageSource to a screen-grab unfortunately requires JS anyway; so we might as well delay making the Drag active until the screen-grab is done. Fixes: QTBUG-112673 Fixes: QTBUG-115491 Pick-to: 6.2 6.5 6.6 Change-Id: I0317613aa0288ad99b55ebd8a470500432b2ea02 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QtQml: Document QML_ADDED_IN_VERSION and QML_REMOVED_IN_VERSIONUlf Hermann2023-10-161-1/+1
| | | | | | | | | | | | In turn, deprecate QML_ADDED_IN_MINOR_VERSION and QML_REMOVED_IN_MINOR_VERSION. These are dangerous because you don't quite know what major version they refer to. Pick-to: 6.6 6.5 Fixes: QTBUG-116895 Change-Id: I9d6d169430944e1dfa4e78bda74c8b71f739e331 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Fix unqualified access in PathView exampleSze Howe Koh2023-09-131-2/+7
| | | | | | | Pick-to: 6.6 6.5 6.2 5.15 Change-Id: Idb7e0f0dea262592ca39e8d42298bb51c91281cd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Mike Trahearn <mtrahearn@topcon.com>
* Doc: Don't use versioned Qt imports in QML snippetsKai Köhne2023-06-30153-161/+161
| | | | | | | | | | | We don't promote versioned imports anymore in Qt 6. Patch done by find . -path "*/snippets/*.qml" -exec perl -pi -e "s/import Qt([\.a-zA-Z]*) \d\.\d+/import Qt\\1/g" {} ; Pick-to: 6.5 6.6 Change-Id: I20a5bf52f7cdd99124626f85ce9794af74382977 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* doc: Add Window.visibility property snippet; link to Window exampleShawn Rutledge2023-05-201-0/+29
| | | | | | | | | | | | Probably we'll keep the Window and Screen example: it has walkthrough docs already. Snippets can be used to illustrate some simplified scenarios, while the example is a bit fancier. Likewise, link to the Window and Screen example from the Screen docs. Pick-to: 6.2 6.5 Change-Id: I20c803affd1f4b6d44b41520782e5ad3c69fc871 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* doc: Use part of window example for Window.flags property snippetShawn Rutledge2023-05-162-0/+57
| | | | | | Pick-to: 6.2 6.5 Change-Id: I5b5c1663f626ce3bfe4c01edbc5480729a1b91f6 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* doc: Make Window snippets testable; remove import versionsShawn Rutledge2023-05-172-0/+33
| | | | | | Pick-to: 6.2 6.5 Change-Id: I35ba013152628591d016c632828a1c4e64cf5978 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* doc: Clarify usage of palette; testable snippetsShawn Rutledge2023-05-171-0/+38
| | | | | | | | | | | | | | | | | - color groups are better shown with copyable monospace syntax rather than capitalized - clarify that using palette grouped-property syntax does not imply that you must define every color - Window has a palette property, inited from SystemPalette: it's not only ApplicationWindow - testable snippets - reuse part of the windowPalette snippet for the Window.active property (switching colors might be the main use case) - make more links Pick-to: 6.2 6.5 Change-Id: I5974351ba66fc9aeec34cb6a4aba1eb85289f536 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Doc: make grabToImage example snippet more usefulVolker Hilsheimer2023-05-091-2/+3
| | | | | | | | | | | | | The example doesn't work as is (when run with the qml binary) because by the time Component.onCompleted is called, there might not be a window yet. Use a key press handler instead (which then needs focus to be set). Fixes: QTBUG-113312 Change-Id: I2986334aca4ca670e206ceadf1093a87aa304e8e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* doc: Improve BorderImage; make snippets scaleable, detailed; screenshotsShawn Rutledge2023-03-286-35/+406
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - This started with QTBUG-112322: introduce the border property next to the first snippet where it's used. - Give declarative-scalegrid.png a white background rather than transparent, to be consistent with the screenshots and to look better with a dark documentation style. - Make the snippets resizable so that it's possible to test the effects of the horizontalTileMode and verticalTileMode properties. - Get the borderframe.svg and .png files from the qtdoc repo (which ought to have been in this repo already, but perhaps not). - Resize borderframe.svg to 120x120 and set document size to match (in Inkscape); this makes it possible to use the svg directly in BorderImage, to test that QTBUG-25244 is really fixed. - Make the snippets match the screenshots (all 182px wide, with grey rectangle borders as shown). - It seems our scaling is smoother (less jagged) than in the old screenshots, so the new ones make a better impression. - Add region index labels to snippets and screenshots to be a bit less confusing next to the paragraphs that are talking about "parts of image in regions 2 and 8" and so on. Too bad they have to be so tiny. - Use \value rather than \li for enum values. Amends 1a84b190bd1a2781d03f13fa43ab92bf34809041 Pick-to: 6.2 6.5 Task-number: QTBUG-25244 Fixes: QTBUG-112322 Change-Id: I697ae1356eee62990b7903601cc493a04d3647a2 Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QQuickTableView: fix minor documentation issuesRichard Moe Gustavsen2023-03-221-2/+2
| | | | | | | | | Several documentation errors have sneaked in here and there. This patch will fix those issues. Pick-to: 6.5 Change-Id: I57beb9a39a06a8302e1e83f91078a8f3c1c50670 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Update documentation on model/view/delegatesUlf Hermann2023-03-214-8/+23
| | | | | | | | | | | You should generally use required properties for all of this. Furthermore, correct some grammar problems, and synchronize the documentation to the examples it references. Remove the non-working ListElement in a C++-defined model. Pick-to: 6.5 Change-Id: I1be9b9997a86dc1028a71bdd5a94d6919c0f8a81 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Add snippet to demonstrate keyboard navigationAndreas Eliasson2023-01-301-0/+71
| | | | | | | | | | | Add example to showcase keybord navigation for the TableView QML type together with 'current' and 'selected' properties. Fixes: QTBUG-107889 Pick-to: 6.5 6.4 Change-Id: Ie95d85aa09e574bee16c23a2dff27056bc0bcd05 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Revamp Qt Quick Layouts overview documentationPaul Wicking2022-12-213-1/+100
| | | | | | | | | | | | | | | | | | | | | | | | | * Use sentence capitalization in section titles * Move sections around for improved reading experience. * Reflow text to conform to 80 column documentation width convention. * Add a section that describes spacing in more detail. * Add new snippet that shows the impact of default spacing on layouts. * Add new snippet that shows spans in a GridLayout. * Add information about Spans, and how unneeded spans and empty columns are ignored. * Update screenshot with improved color choice, add screenshot as visual aid to new text. * Describe how the size hints of items can be (ab)used in order to specify size weights/ratios on each item. * Describe how each item is aligned inside a cell. * Emphasize that size hints should never depend on "external" factors. Pick-to: 6.5 Fixes: QTBUG-109437 Fixes: QTBUG-98991 Fixes: QTBUG-91040 Task-number: QTBUG-103976 Change-Id: Ia69b4e679eece56a5e6bf1a49038118a320b76f6 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: improve grabToImage snippetsMitch Curtis2022-12-142-50/+39
| | | | | | | | | | | | | | - Change the code that is quoted so that the indenting looks sane - Make it possible to copy and run the first snippet without modification - Make it easier to copy and run the second snippet without modification - Move itemGrab.qml to item sub-directory - Generally tidy up Pick-to: 6.2 6.4 6.5 Change-Id: I608b7a6025b9866c14b84420ae64827965a7519f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QQuickTableView: let the edit delegate be a child of the cell delegateRichard Moe Gustavsen2022-12-071-2/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first version parented the edit delegate to the content item of QQuickTableView. This approach, however, turned out make it really difficult to implement an edit delegate that relied on the geometry of items inside the tableview delegate. E.g for a TreeViewDelegate, we would like to show an editable TextField on top of the label while editing. But only on top of the label, not the whole delegate (including e.g the expanded/collapsed indicator). Moreover, we don't want to hide the whole delegate while editing, only the label that is underneatch (a possible semi-transparent) edit delegate. For this to be possible, we therefore need to parent the edit delegate to the TableView delegate instead, so that the edit delegate can e.g more easily query the geometry of the items inside the delegate (like the label) to position its own items (like a TextField). Since we also want the developer to then have more control over which items get hidden, we offer a property: "required property bool editing" to the tableview delegate. This can be used to e.g hide items inside the delegate while its being edited (or to implement other kinds of transitions). This new solution should also be easier to work with, and understand, for application developers, since the parent-child structure now mirrors the location where the edit delegate is written in QML. Change-Id: Ieeae28c8297f8bb1fb2d90d152fd575b4f41f36f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQuickTableView: add layoutChanged() signalRichard Moe Gustavsen2022-12-051-0/+46
| | | | | | | | | | | | Add a new signal to TableView that tells when the layout has changed. This signal can be used to reposition any overlay on the content item, including e.g SelectionHandles. [ChangeLog][Quick][TableView] Added new signal 'layoutChanged()' Change-Id: I5b89a064521c2831279accbc889deb768d9b1a1b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: implement TableView.editDelegateRichard Moe Gustavsen2022-12-011-0/+52
| | | | | | | | | | | | | | | | | | | This patch will implement support for editing cells in TableView. It enables you to attach an edit delegate to the tableview delegate, using the attached property TableView.editDelegate. The application can initiate editing by calling TableView.edit() (and TableView.closeEditor()) explicitly, or implicitly by using edit triggers. The EditTriggers enum in TableView mirrors the EditTriggers in QTableView (Widgets). [ChangeLog][Quick][TableView] Added support for editing cells Fixes: QTBUG-108838 Change-Id: I25df93a7eeabf9d8a4c4c6248e020d8eba6d5bd7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-11157-7527/+314
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickTableView: keep selection model and tableview model in syncRichard Moe Gustavsen2022-04-111-3/+1
| | | | | | | | | | | | | | | The source model in the selection model will always need to be the same as the source model in TableView. So TableView might as well forward its own model to the selection model, so that the user don't need to worry about setting the model explicitly. The same is also done in QTableView. Still, it's always possible to force (perhaps by accident?) the two models to be different. To avoid confusion, we choose to print a warning if that happens. Change-Id: I9fec1d3de4cfe83cf28950ebdedd38a010df16a3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* doc: TreeView and delegate doc and warning improvementsShawn Rutledge2022-04-051-6/+8
| | | | | | | | | | | | | | | - a delegate Item is not "root"; that ID could clash with the user's root item when copy-pasting code - choose "▸" triangle character because it looks better with some fonts (such as the default font on Linux in Qt Quick, Assistant and even gitk); rotate it when the tree is expanded rather than risking a mismatched rotated triangle character - fix singular form in phrase "only accepts a model of type..." - Shorten phrase "An example of how a custom delegate could look like" Pick-to: 6.3 Change-Id: Ic91f07be4b79a88c8532d4e2e49914fbdc529e36 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Replace paintedWidth/Height with contentWidth/HeightTasuku Suzuki2022-03-271-2/+2
| | | | | | | | | They were renamed in 51b7425329e0fa221c319e8d75595c19f664aedb Pick-to: 6.2 6.3 Task-number: QTBUG-15160 Change-Id: If30f69d47adf391d2d1c795caaf2bbe15f6bc32a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* quick: add qquicktreeviewRichard Moe Gustavsen2021-12-041-0/+90
| | | | | | | | | | | | | This patch adds TreeView to Qt Quick. It is more or less a copy from the TreeView in Marketplace, but with some modifications to make it more equal to the already existing TableView, ListView, and GridView. [ChangeLog][Item Views] A new view is added: TreeView Fixes: QTBUG-61630 Change-Id: Ibb9d22cf9c9df021e77d03287872134c2682682a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use generalized grouped properties in QQuickPropertyChangesUlf Hermann2021-10-281-2/+7
| | | | | | | | Process deferred bindings like custom parsed ones. Task-number: QTBUG-95117 Change-Id: Ia4d8ca81e789c1e57bf947c40f76356db3bad8da Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>