qtdeclarative/tests/auto/quick
Mitch Curtis 2556bfdab4 Positioners: allow distinguishing between implicit/explicit child size
In Qt Quick Controls 2, we plan on using positioners to layout an icon
next to text in a button, for example.

Consider the following example:

    AbstractButton {
       id: button
       text: "Button"
       contentItem: Row {
           Text {
               text: button.text
               width: parent.width
           }
       }
       background: Rectangle {
           radius: 5
           color: "lightsteelblue"
           opacity: button.pressed ? 1.0 : 0.8
       }
    }

In Qt Quick Controls 2, implicit size propagates "up" from the
delegates/building blocks to the control, whereas explicit size
propagates "down" from the control to the delegates/building blocks.
Providing a reasonable implicit size is important to make controls
behave well in layouts, etc., and the internal building blocks must
follow the size of the control to retain sensible looks when a control
is resized.

In the example above, contentItem needs to have a "natural" (implicit)
size representing the ideal fit of the content, but it needs to respect
the explicitly provided size from the control too.

With the current behavior, as the explicit width of the Row is 0, the
Text item (via the width binding) sets explicit width to 0, and Row
uses that explicit width rather than the implicit width, thus, Row here
will have an implicit width of 0, which is not what the control wants.

This patch:

- Allows subclasses of positioners to set
  QQuickBasePositionerPrivate::useImplicitSize to true in order to tell
  positioners to use implicit size rather than explicit size. This is
  not exposed as public API, as this behavior is typically not
  something desirable in the positioners themselves. For example,
  Row { Rectangle { width: 100; height: 100 } } would have an implicit
  size of 0, as Rectangle has no implicit size.
- Adds QQuickImplicitRow and QQuickImplicitGrid, which are private
  subclasses of their respective positioners that simply set
  useImplicitSize to true in their constructors.
- Exports the wrappers privately so that they can be registered by
  other modules as QML types.

Change-Id: Ie68aabd7fbf6c76375badf6e338f2f238f3fc392
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
2017-02-23 13:45:52 +00:00
..
drawingmodes Tests for various OpenGL drawing modes in conjunction with batching 2016-10-12 08:30:17 +00:00
examples tests: Remove some vestigial references 2017-01-16 15:13:54 +00:00
geometry Fix enums in QSGGeometry 2016-10-12 09:57:43 +00:00
nodes
nokeywords Get rid of most QT_NO_FOO usages 2016-11-29 10:10:27 +00:00
qquickaccessible
qquickanchors QML: Remove internal field padding from QQuickAnchorPrivate. 2016-05-10 08:17:00 +00:00
qquickanimatedimage Skip mirroring tests with software adaptation 2016-06-07 09:18:08 +00:00
qquickanimatedsprite Merge remote-tracking branch 'origin/5.6' into 5.7 2016-06-29 10:11:25 +02:00
qquickanimationcontroller
qquickanimations PathAnimation: fix bug when PathSvg or PathLine is the last item in Path 2017-01-20 00:13:24 +00:00
qquickanimators
qquickapplication Add QQuickApplication::displayName property 2016-10-18 18:00:43 +00:00
qquickbehaviors
qquickborderimage Get rid of most QT_NO_FOO usages 2016-11-29 10:10:27 +00:00
qquickcanvasitem Canvas test: make sure canvas is ready 2016-07-04 15:33:47 +00:00
qquickdesignersupport
qquickdrag Merge remote-tracking branch 'origin/5.6' into 5.7 2016-05-06 09:17:24 +02:00
qquickdroparea
qquickdynamicpropertyanimation
qquickflickable Flickable: add horizontal/verticalOvershoot properties 2016-12-29 11:43:59 +00:00
qquickflipable
qquickfocusscope
qquickfontloader
qquickfontloader_static
qquickfontmetrics
qquickframebufferobject Merge remote-tracking branch 'origin/5.6' into 5.7 2016-08-05 09:02:17 +02:00
qquickgraphicsinfo test: fix tst_QQuickGraphicsInfo::testProperties() 2017-01-12 06:49:49 +00:00
qquickgridview ListView, GridView: fix missing keyNavigationEnabled property 2016-12-20 11:51:24 +00:00
qquickimage Remove remnants of blackberry platform support 2017-01-16 17:10:14 +00:00
qquickimageprovider
qquickitem Keys: add shortcutOverride signal 2016-12-18 14:57:54 +00:00
qquickitem2 Get rid of most QT_NO_FOO usages 2016-11-29 10:10:27 +00:00
qquickitemlayer Remove remnants of blackberry platform support 2017-01-16 17:10:14 +00:00
qquicklayouts StackLayout: propagate rearrange() call to child layouts 2017-01-19 23:02:54 +00:00
qquicklistview ListView: allow flicking to both directions 2017-01-16 15:46:28 +00:00
qquickloader Do not leak the item, and use a QScopedPointer to guarantee cleanup 2017-01-23 09:02:58 +00:00
qquickmousearea Add pressAndHoldInterval to MouseArea 2016-12-16 18:28:44 +00:00
qquickmultipointtoucharea autotests: remove qWait(1) in touch sequences 2016-08-13 15:07:09 +00:00
qquickopenglinfo Merge remote-tracking branch 'origin/5.6' into 5.7 2016-08-05 09:02:17 +02:00
qquickpainteditem Get rid of most QT_NO_FOO usages 2016-11-29 10:10:27 +00:00
qquickpath
qquickpathview PathView: fix crash on path remove 2017-01-11 18:19:02 +00:00
qquickpincharea Fix tst_QQuickPinchArea::cancel 2016-07-25 22:04:27 +00:00
qquickpixmapcache Get rid of most QT_NO_FOO usages 2016-11-29 10:10:27 +00:00
qquickpositioners Positioners: allow distinguishing between implicit/explicit child size 2017-02-23 13:45:52 +00:00
qquickrectangle
qquickrepeater
qquickscreen Enable making window-screen associations from QML 2016-10-10 11:48:57 +00:00
qquickshadereffect Merge remote-tracking branch 'origin/5.7' into dev 2016-08-02 18:34:30 +02:00
qquickshortcut Shortcut: add support for multiple key sequences 2016-11-16 17:33:41 +00:00
qquicksmoothedanimation
qquickspringanimation
qquickspritesequence
qquickstates QML: Remove internal field padding from QQuickAnchorPrivate. 2016-05-10 08:17:00 +00:00
qquickstyledtext
qquicksystempalette
qquicktext Add fontInfo property to Text 2017-01-31 08:22:14 +00:00
qquicktextdocument
qquicktextedit Merge remote-tracking branch 'origin/5.8' into dev 2016-12-14 19:01:23 +01:00
qquicktextinput Add TextInput::textEdited() 2016-12-30 17:46:15 +00:00
qquicktextmetrics
qquicktimeline
qquickview Stabilize tst_QQuickView::resizemodeitem 2016-07-19 09:25:28 +00:00
qquickvisualdatamodel Merge remote-tracking branch 'origin/5.6' into 5.7 2016-09-16 23:21:16 +02:00
qquickwindow Merge remote-tracking branch 'origin/5.9' into dev 2017-02-14 08:21:39 +01:00
qquickxmllistmodel Q_ENUMS -> Q_ENUM and Q_FLAGS -> Q_FLAG 2017-01-19 11:54:27 +00:00
rendernode Merge remote-tracking branch 'origin/5.7' into 5.8 2016-10-20 08:28:16 +02:00
scenegraph Get rid of most QT_NO_FOO usages 2016-11-29 10:10:27 +00:00
shared Get rid of most QT_NO_FOO usages 2016-11-29 10:10:27 +00:00
touchmouse tst_touchmouse: Have a go at some stabilisation & improvements 2017-01-11 23:10:27 +00:00
quick.pro Tests for various OpenGL drawing modes in conjunction with batching 2016-10-12 08:30:17 +00:00