Define my own anchor lines?
-
Can i defines my own anchor lines? For example, i have a custom item of a button with an image in it, That image includes a bottom shadow. Now the vertical center line is the center of the image, including the shadow. On the screen it doesn't look centered.
Now i want to have the center anchor line of my custom item shifted up some pixels. Same applies for the bottom anchor line.
Can i do that in Qml in my item? -
Wouldn't it be easier to modify your image so that the center of the image aligns with the center of the actual button, and you just have some empty (transparent) pixels padding on the sides where you don't have the shadow?
-
You can shift the anchor using anchor margins:
@
Something {
anchors.leftMargin: 5
anchors.topMargin: 6
}
@ -
[quote author="sierdzio" date="1420624791"]You can shift the anchor using anchor margins:
@
Something {
anchors.leftMargin: 5
anchors.topMargin: 6
}
@[/quote]
True also. Note that the margins can also be negative. -
maybe {
anchors.margin: auto;
}probably center all margins horizontal and vertical. This is from CSS3.