aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/layouts/qquicklayout_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Quick.Layouts: Make plugin optionalFabian Kosmale2021-01-181-366/+0
| | | | | | | | | This moves the Layouts types into a new library and is meant to make them availabe to the QML compiler at some point in the future. Change-Id: I9b2b31a78b0e9ca8b6c0db1fc9272d9941c61814 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Follow layoutMirroring in Layout marginsDavid Edmundson2020-08-261-0/+9
| | | | | | | | | | | | | | | If a layout is laid out left to right using the layoutDirection property, we want left Margins on the left, and rightMargin still on the right However, if a layout is mirrored, not only should the layout direction change but also the left margin should now be on the right and vice versa. Task-number: QTBUG-62989 Pick-to: 5.15 Change-Id: Iaae4bc436fd1eb7f1947869563ac325f3d6b79bb Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Improve performance when dynamically adding items to a layoutJan Arve Sæther2020-05-041-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was especially noticeable when a Repeater was populating the children of a layout, and its model was dynamically changed: When the model was changed, the repeater removed one item at a time until all items were removed, then applied the new model and then added all the new items for the new model. The layout reacted to that by doing a full sync of the QML layout into the internal gridlayout engine each time an item got removed or added. For very large layouts (or layouts that have complex size hints to calculate), this caused a major slowdown. This patch fixes that by postponing the sync until we get a updatePolish(), basically replacing most calls to updateLayoutItems() (which does the sync) with a call to invalidate() (which schedules a polish). It will also get rid of some binding loop warnings due to this change. This means that there is a small change in behavior: impicitWidth, implicitHeight and Layout.{min,max}imum{Width,Height} might in some cases be incorrect until the updatePolish() have been done. (This is however consistent with how Row/Column/Grid behaves) The creation test in qmlbench was quite simple, so it did not suffer from the most severe performance issues, but we did not regress: > compareresults: auto/creation/layouts/delegates_rowlayout.qml: improvement by 3.91% auto/creation/layouts/delegates_columnlayout.qml: improvement by 6.59% auto/creation/layouts/delegates_gridlayout.qml: improvement by 1.83% Overall average of differences: 4.11% And for the gridlayout_large.qml (Repeater with 1000 dynamically changing items): > compareresults: auto/layouts/gridlayout_large.qml: improvement by 66477.78% Overall average of differences: 66477.78% [ChangeLog][Qt Quick Layouts] Performance improvements to Qt Quick Layouts. This has the small side-effect that size hints (implicitWidth/implicithHeight etc) changes are not immediately emitted after a layout has been modified (e.g item added) Pick-to: 5.15 Fixes: QTBUG-71839 Fixes: QTBUG-65121 Fixes: QTBUG-66017 Change-Id: I6922efe449134246df66b177992e4442747bc8fb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickItem: rename geometryChanged to geometryChangeMitch Curtis2020-04-231-1/+1
| | | | | | | | | | | | | | | | | | This brings it in line with the existing convention in this and other modules, where virtual handlers are named "nounChange"; e.g. itemChange. Signals are named "nounChanged". This also allows adding a geometryChanged signal, which would enable users to listen to one signal for all changes to x/y/width/height. [ChangeLog][QQuickItem] Renamed geometryChanged to geometryChange in order to follow existing naming conventions and have consistency with existing API, such as itemChange. Task-number: QTBUG-82994 Change-Id: I0547358c796a0047982ccfbf2c38bab952e7a634 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add _q_dumpLayoutTree() for debugging purposesJan Arve Sæther2020-04-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I found this quite useful for debugging layouts in order to get a snapshot of the layout hierarchy at any point. It will show the hierarchy and the relevant properties that affect the layouting. It's basically QObject::dumpObjectTree() specialized for Qt Quick Layouts (except it will dump it as QML-ish). For the leaf nodes it will leave out unspecified information. Example on how a dump looks like: RowLayout { // Effective calculated values: sizeHintDirty: 1 sizeHint.min : [ 100, 20] sizeHint.pref: [ 100, 20] sizeHint.max : [ inf, 20] RowLayout { // Effective calculated values: sizeHintDirty: 1 sizeHint.min : [ 100, 20] sizeHint.pref: [ 100, 20] sizeHint.max : [ inf, 20] Rectangle { implicitWidth: 100 implicitHeight: 20 } Rectangle { implicitHeight: 20 Layout.fillWidth: true } } } Pick-to: 5.15 Change-Id: Ie2fcd56d522395cb9d6f55a1ea3f882a7a9da709 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use categorized logging instead of quickLayoutDebug()Jan Arve Sæther2020-04-211-6/+1
| | | | | | Pick-to: 5.15 Change-Id: I4db3ebb02a5b541ca8e50e65b9056d398570e331 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add major version to all Q_REVISIONsUlf Hermann2020-02-191-0/+1
| | | | | Change-Id: Id72fbe10c16de61bd847773d0055d83cfe03f63c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-131-1/+3
|\ | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine.cpp Change-Id: I61f41672e2dfe7e542ca30fed5f173d0a9ee3412
| * Fix a bug where a layout could crash or become non-responsiveJan Arve Sæther2020-02-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This happened because of that QQuickText is ill-behaving: When the width on a QQuickText with word wrap enabled is changed to something less than its implicitWidth, its implicitHeight is changed to reflect the height it needs in order to fit all lines. This will cause the layout to be invalidated, and rearranged again. However, at the same time it will also change its implicitWidth actually become wider than its initial implicitWidth (this seems to be a bug). So the next time it is rearranged it will actually be wide enough so that it doesn't need to wrap. This again will cause its implicitWidth and implicitHeight to change to reflect that only one line is needed, which again will cause it to rearrange, but since the item has a too small width for that it will again change the implicitHeight to reflect that it needs more lines..... This went on forever until there was a stack overflow. In addition it also caused an endless (that is, if it didn't stack overflow) updatePolish()/polish() loop (basically polish() was called from within updatePolish() continuously). To make the layout more robust for such "ill-behaving" items we have to add one recursion guard, and one polish-loop guard. Change-Id: I9f752ed320a100c8d0f0fd340347a556e63318e5 Task-number: QTBUG-73683 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-231-1/+1
|\| | | | | | | Change-Id: I88e94fe3398a59f10c5a8b142204db5f3ccb2657
| * Initialize boolean m_hasItemChangeListenersDavid Edmundson2020-01-211-1/+1
| | | | | | | | | | | | | | Found by a valgrind warning of an unintialized jump. Change-Id: I24279c97042e1971eaff35c3363fc1250e5c6c6e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Specify parameters of type registration in class declarationsUlf Hermann2019-09-261-1/+4
|/ | | | | | | | | | | | | | | | | | | | | Using this technique we can automatically register all necessary revisions and minor versions of a type, using the metaobject system. This greatly reduces the potential for mistakes and resulting incompatibilities between versions of imports. We assume that for each type we need to register all revisions of its super types and its attached type, and that the revisions match. That is, if you import version X of type A, you will also get version X of its attached type and of any super types. As we previously didn't take these dependencies into account when manually registering the types, a number of extra revisions are now registered for some types. Potentially, we can now generate the qmltypes files at compile time, using moc. Change-Id: I7abb8a5c39f5e63ad1a0cb41a783f2c91909491b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Warn if a layout has children with anchorsJan Arve Sæther2017-11-281-0/+1
| | | | | | | | | We get several bug reports due to this mistake. Print a warning about it and that it *might* eat your cats. Task-number: QTBUG-63303 Change-Id: I0b1ae21dc4419efee88623765a8d6dd302fbc1f4 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Fix positioning and placement of initially invisible items in layoutsSascha Siebert2017-11-221-0/+3
| | | | | | | | | | | Instead of misusing implicitWidth/Height as a storage mechanism in scenarios where width/height is used for preferred size evaluation, new members are created to hold this information to prevent incorrect sizing in mentioned scenario and get rid of blocking signals. Task-number: QTBUG-57455 Change-Id: I102c45805c4106e5829b17b65c2e247b2381573f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Replace Q_DECL_OVERRIDE with overrideKevin Funk2017-09-251-9/+9
| | | | | Change-Id: I176f91a8c51e81a2df3fe91733118261491223ee Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Avoid needless notifications when destroying layoutsJan Arve Saether2017-01-121-0/+2
| | | | | | | | | | | | | | | | | When deleting a layout with children, it ends up in ~QQuickItem(), which in turn will call setParentItem(0). setParentItem(0) will in turn call setEffectiveVisibleRecur(), which will recurse down all its descendants. Therefore, deleting a top level layout might trigger item change listeners for *all* its descendants, not only its direct children. This behavior might even cause crashes: The visibility changes will then trigger an invalidation of the layout, which will propagate up the parent hierarchy, and potentially call invalidate() on a partially-destroyed layout, which then might crash. Change-Id: I48e11d57f69e9011ced6c3a0b51e3d89b24ad5c1 Task-number: QTBUG-55103 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Layouts: Use QQuickItemChangeListener for more thingsRobin Burchell2016-11-301-0/+4
| | | | | | | | | | | | Signal connections are expensive: even with qmlobject_connect, there's a bunch of memory allocation. By avoiding the signal connections, we can do the same thing essentially, a little faster. This gives me another 15-20 RowLayout instances per frame when testing with RowLayout containing 5 Rectangles on qmlbench (from ~139 to ~155 ops/frame). Change-Id: I4448a28128dc251e40b6b06d642bae716af212f4 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Move QtQuick.Layouts to qtdeclarative from qtquickcontrolsJan Arve Saether2016-02-261-0/+326
This is in order for it to be available without having to install Qt Quick Controls Change-Id: I3f0d0dc108829947cd189b7861944e556e00cef3 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>