How to draw a Rectangle and control if it is to show left or right borders or both using QtQuick 2?
Printable View
How to draw a Rectangle and control if it is to show left or right borders or both using QtQuick 2?
A Rectangle does not allow to control each border separately. In certain cases you can obtain the effect you want by composing the rectangle from two or more rectangles (some with borders enabled and some with disabled) with clipping enabled through a shader effect. Of course that's not very performance effective. Alternatively you can apply a custom shader effect on the rectangle directly that will handle proper border drawing.
Like @wysota said:
Code:
Rectangle { width: 100 height: 200 color: "blue" Rectangle { id: borderLeft width: 1 height: parent.height anchors.left: parent.left color: "red" } Rectangle { id: borderRight width: 1 height: parent.height anchors.right: parent.right color: "red" } }
Source: http://stackoverflow.com/questions/2...t-borders-show
Thanks
That's not exactly what I meant. This makes you unable to use the "radius" property.