From 25be849e58dec1dc57533567a9bf1a3be541b3e7 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 1 Sep 2021 15:29:26 +0200 Subject: Shapes example: give each qml file's root item a default size Each square is resized anyway in shapegallery.qml; but for the sake of running individual examples on the command line with qml, the content being shown should be visible. Without this fix, each item had a 0,0 size by default; but the shapes themselves have their own sizes and are centered in the zero-size root item. But when a window is created, the window system does not allow it to have zero size, so it expands; and then the shape would be centered at the top-left corner, and you could only see part of it. Change-Id: I42a537421430aea8233106353e9c2033f5bc5774 Reviewed-by: Oliver Eftevaag Reviewed-by: Shawn Rutledge (cherry picked from commit 38ac4b4ec2c08a6ea4ae693514e8c3520eb00c2a) Reviewed-by: Qt Cherry-pick Bot --- examples/quick/shapes/arcDirection.qml | 2 ++ examples/quick/shapes/arcRotation.qml | 2 ++ examples/quick/shapes/capStyles.qml | 1 + examples/quick/shapes/cubicCurve.qml | 2 ++ examples/quick/shapes/dashPattern.qml | 2 ++ examples/quick/shapes/ellipticalArcs.qml | 2 ++ examples/quick/shapes/fillRules.qml | 2 ++ examples/quick/shapes/gradientSpreadModes.qml | 2 ++ examples/quick/shapes/joinStyles.qml | 2 ++ examples/quick/shapes/largeOrSmallArc.qml | 2 ++ examples/quick/shapes/linearGradient.qml | 2 ++ examples/quick/shapes/quadraticCurve.qml | 2 ++ examples/quick/shapes/radialGradient.qml | 2 ++ examples/quick/shapes/strokeOrFill.qml | 1 + examples/quick/shapes/tapableTriangle.qml | 4 ++-- examples/quick/shapes/text.qml | 2 ++ examples/quick/shapes/tigerLoader.qml | 2 ++ 17 files changed, 32 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/quick/shapes/arcDirection.qml b/examples/quick/shapes/arcDirection.qml index 2c0fdfa623..428e7056b8 100644 --- a/examples/quick/shapes/arcDirection.qml +++ b/examples/quick/shapes/arcDirection.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Rectangle { width: 100 diff --git a/examples/quick/shapes/arcRotation.qml b/examples/quick/shapes/arcRotation.qml index 3530e5e0fb..20be8a8446 100644 --- a/examples/quick/shapes/arcRotation.qml +++ b/examples/quick/shapes/arcRotation.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Repeater { model: 2 diff --git a/examples/quick/shapes/capStyles.qml b/examples/quick/shapes/capStyles.qml index cc06a48501..2eb5047fb1 100644 --- a/examples/quick/shapes/capStyles.qml +++ b/examples/quick/shapes/capStyles.qml @@ -53,6 +53,7 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256; height: 256 Shape { anchors.centerIn: parent diff --git a/examples/quick/shapes/cubicCurve.qml b/examples/quick/shapes/cubicCurve.qml index 38ecb302ba..319942ecb1 100644 --- a/examples/quick/shapes/cubicCurve.qml +++ b/examples/quick/shapes/cubicCurve.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Item { width: 200 diff --git a/examples/quick/shapes/dashPattern.qml b/examples/quick/shapes/dashPattern.qml index bcf6c40c3c..f64f02c5d9 100644 --- a/examples/quick/shapes/dashPattern.qml +++ b/examples/quick/shapes/dashPattern.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Shape { width: 200 height: 150 diff --git a/examples/quick/shapes/ellipticalArcs.qml b/examples/quick/shapes/ellipticalArcs.qml index 09cc2c8211..de9379f35e 100644 --- a/examples/quick/shapes/ellipticalArcs.qml +++ b/examples/quick/shapes/ellipticalArcs.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Shape { id: shape width: 220 diff --git a/examples/quick/shapes/fillRules.qml b/examples/quick/shapes/fillRules.qml index 6300ced608..8bddc29737 100644 --- a/examples/quick/shapes/fillRules.qml +++ b/examples/quick/shapes/fillRules.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Shape { width: 100 height: 100 diff --git a/examples/quick/shapes/gradientSpreadModes.qml b/examples/quick/shapes/gradientSpreadModes.qml index 6e39a90f55..c0b42c8832 100644 --- a/examples/quick/shapes/gradientSpreadModes.qml +++ b/examples/quick/shapes/gradientSpreadModes.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Rectangle { border.color: "black" width: 200 diff --git a/examples/quick/shapes/joinStyles.qml b/examples/quick/shapes/joinStyles.qml index ed34c1de77..140151d0f0 100644 --- a/examples/quick/shapes/joinStyles.qml +++ b/examples/quick/shapes/joinStyles.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Shape { width: 120 diff --git a/examples/quick/shapes/largeOrSmallArc.qml b/examples/quick/shapes/largeOrSmallArc.qml index b7fa8fa6ab..3079b9c2ad 100644 --- a/examples/quick/shapes/largeOrSmallArc.qml +++ b/examples/quick/shapes/largeOrSmallArc.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Repeater { model: 2 diff --git a/examples/quick/shapes/linearGradient.qml b/examples/quick/shapes/linearGradient.qml index 426fb144c2..c427e35c38 100644 --- a/examples/quick/shapes/linearGradient.qml +++ b/examples/quick/shapes/linearGradient.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Shape { id: shape anchors.fill: parent diff --git a/examples/quick/shapes/quadraticCurve.qml b/examples/quick/shapes/quadraticCurve.qml index c4ef8ccf79..311ff471d0 100644 --- a/examples/quick/shapes/quadraticCurve.qml +++ b/examples/quick/shapes/quadraticCurve.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Item { width: 200 diff --git a/examples/quick/shapes/radialGradient.qml b/examples/quick/shapes/radialGradient.qml index 0eb9a4631e..9ac48187ff 100644 --- a/examples/quick/shapes/radialGradient.qml +++ b/examples/quick/shapes/radialGradient.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Shape { width: 200 height: 150 diff --git a/examples/quick/shapes/strokeOrFill.qml b/examples/quick/shapes/strokeOrFill.qml index 47841f1a68..fdb93bf0d8 100644 --- a/examples/quick/shapes/strokeOrFill.qml +++ b/examples/quick/shapes/strokeOrFill.qml @@ -53,6 +53,7 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256; height: 256 Shape { id: circ1 diff --git a/examples/quick/shapes/tapableTriangle.qml b/examples/quick/shapes/tapableTriangle.qml index cc33bae9a0..b224a95034 100644 --- a/examples/quick/shapes/tapableTriangle.qml +++ b/examples/quick/shapes/tapableTriangle.qml @@ -52,8 +52,8 @@ import QtQuick import QtQuick.Shapes Rectangle { - width: 120 - height: 120 + width: 256 + height: 256 color: th.pressed ? "steelBlue" : "lightGray" containmentMask: ctr diff --git a/examples/quick/shapes/text.qml b/examples/quick/shapes/text.qml index c61b070405..3914fe2085 100644 --- a/examples/quick/shapes/text.qml +++ b/examples/quick/shapes/text.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Shape { anchors.centerIn: parent diff --git a/examples/quick/shapes/tigerLoader.qml b/examples/quick/shapes/tigerLoader.qml index 366d8e329b..d220fcdd7d 100644 --- a/examples/quick/shapes/tigerLoader.qml +++ b/examples/quick/shapes/tigerLoader.qml @@ -53,6 +53,8 @@ import QtQuick.Shapes Rectangle { color: "lightGray" + width: 256 + height: 256 Item { anchors.fill: parent -- cgit v1.2.3