diff --git a/src/controls/Card.qml b/src/controls/Card.qml --- a/src/controls/Card.qml +++ b/src/controls/Card.qml @@ -67,16 +67,21 @@ header: BannerImage { id: bannerImage - anchors.leftMargin: -root.leftPadding - anchors.topMargin: -root.topPadding - anchors.rightMargin: root.headerOrientation == Qt.Vertical ? -root.rightPadding : 0 - anchors.bottomMargin: root.headerOrientation == Qt.Horizontal ? -root.bottomPadding : 0 + anchors.leftMargin: -root.leftPadding + root.background.border.width + anchors.topMargin: -root.topPadding + root.background.border.width + anchors.rightMargin: root.headerOrientation == Qt.Vertical ? -root.rightPadding + root.background.border.width : 0 + anchors.bottomMargin: root.headerOrientation == Qt.Horizontal ? -root.bottomPadding + root.background.border.width : 0 //height: Layout.preferredHeight implicitWidth: root.headerOrientation == Qt.Horizontal ? sourceSize.width : Layout.preferredWidth - corners.topLeftRadius: root.background.radius - corners.topRightRadius: root.headerOrientation == Qt.Horizontal ? 0 : root.background.radius - corners.bottomLeftRadius: root.headerOrientation == Qt.Horizontal ? root.background.radius : 0 + readonly property real widthWithBorder: width + root.background.border.width * 2 + readonly property real heightWithBorder: height + root.background.border.width * 2 + readonly property real radiusFromBackground: root.background.radius - root.background.border.width + + corners.topLeftRadius: radiusFromBackground + corners.topRightRadius: (root.headerOrientation == Qt.Horizontal && widthWithBorder < root.width) ? 0 : radiusFromBackground + corners.bottomLeftRadius: (root.headerOrientation != Qt.Horizontal && heightWithBorder < root.height) ? 0 : radiusFromBackground + corners.bottomRightRadius: heightWithBorder < root.height ? 0 : radiusFromBackground } onHeaderChanged: { diff --git a/src/controls/private/BannerImage.qml b/src/controls/private/BannerImage.qml --- a/src/controls/private/BannerImage.qml +++ b/src/controls/private/BannerImage.qml @@ -92,6 +92,8 @@ corners.topLeftRadius: root.titleAlignment & Qt.AlignTop ? root.corners.topLeftRadius : 0 corners.topRightRadius: root.titleAlignment & Qt.AlignTop ? root.corners.topRightRadius : 0 + corners.bottomLeftRadius: root.titleAlignment & Qt.AlignBottom ? root.corners.bottomLeftRadius : 0 + corners.bottomRightRadius: root.titleAlignment & Qt.AlignBottom ? root.corners.bottomRightRadius : 0 } RowLayout { diff --git a/src/scenegraph/shaders/sdf.glsl b/src/scenegraph/shaders/sdf.glsl --- a/src/scenegraph/shaders/sdf.glsl +++ b/src/scenegraph/shaders/sdf.glsl @@ -230,7 +230,7 @@ // A constant for a default level of smoothing when rendering an sdf. // // This -const lowp float sdf_default_smoothing = 0.005; +const lowp float sdf_default_smoothing = 0.004; // Render an sdf shape. // @@ -244,8 +244,7 @@ // \return sourceColor with the sdf shape rendered on top. lowp vec4 sdf_render(in lowp float sdf, in lowp vec4 sourceColor, in lowp vec4 sdfColor) { - lowp float g = fwidth(sdf); - return mix(sourceColor, sdfColor, 1.0 - smoothstep(sdf_default_smoothing - g, sdf_default_smoothing + g, sdf)); + return mix(sourceColor, sdfColor, 1.0 - smoothstep(-sdf_default_smoothing, sdf_default_smoothing, sdf)); } // Render an sdf shape. @@ -257,8 +256,7 @@ // lowp vec4 sdf_render(in lowp float sdf, in lowp vec4 sourceColor, in lowp vec4 sdfColor, in lowp float smoothing) { - lowp float g = fwidth(sdf); - return mix(sourceColor, sdfColor, 1.0 - smoothstep(smoothing - g, smoothing + g, sdf)); + return mix(sourceColor, sdfColor, 1.0 - smoothstep(-smoothing, smoothing, sdf)); } // Render an sdf shape alpha-blended onto an existing color. @@ -271,6 +269,5 @@ // lowp vec4 sdf_render(in lowp float sdf, in lowp vec4 sourceColor, in lowp vec4 sdfColor, in lowp float alpha, in lowp float smoothing) { - lowp float g = fwidth(sdf); - return mix(sourceColor, sdfColor, alpha * (1.0 - smoothstep(smoothing - g, smoothing + g, sdf))); + return mix(sourceColor, sdfColor, alpha * (1.0 - smoothstep(-smoothing, smoothing, sdf))); } diff --git a/src/scenegraph/shadowedbordertexturematerial.cpp b/src/scenegraph/shadowedbordertexturematerial.cpp --- a/src/scenegraph/shadowedbordertexturematerial.cpp +++ b/src/scenegraph/shadowedbordertexturematerial.cpp @@ -31,9 +31,12 @@ auto material = static_cast(other); auto result = ShadowedBorderRectangleMaterial::compare(other); - if (result == 0 - && material->textureSource == textureSource) { - return 0; + if (result == 0) { + if (material->textureSource == textureSource) { + return 0; + } else { + return (material->textureSource < textureSource) ? 1 : -1; + } } return result; diff --git a/src/scenegraph/shadowedtexturematerial.cpp b/src/scenegraph/shadowedtexturematerial.cpp --- a/src/scenegraph/shadowedtexturematerial.cpp +++ b/src/scenegraph/shadowedtexturematerial.cpp @@ -31,9 +31,12 @@ auto material = static_cast(other); auto result = ShadowedRectangleMaterial::compare(other); - if (result == 0 - && material->textureSource == textureSource) { - return 0; + if (result == 0) { + if (material->textureSource == textureSource) { + return 0; + } else { + return (material->textureSource < textureSource) ? 1 : -1; + } } return result;