Use of real values in anchor margin
-
Hi All,
I was going through the QML documentation which says that the anchor margins can be real values.
e.g.
anchor
{
top: parent.top
topMargin: 10 // This is valid
left: parent.left
leftMargin: 80.45 // This is also valid
}But somehow, the real value is getting rounded off to the nearest integer values. Then what is the real use of having a real value for margin?
In case my, UX designer is giving me a real value for margin, how I will be able to translate the same in the code? Or, there is no way to do the same in QML?
-
Hi All,
I was going through the QML documentation which says that the anchor margins can be real values.
e.g.
anchor
{
top: parent.top
topMargin: 10 // This is valid
left: parent.left
leftMargin: 80.45 // This is also valid
}But somehow, the real value is getting rounded off to the nearest integer values. Then what is the real use of having a real value for margin?
In case my, UX designer is giving me a real value for margin, how I will be able to translate the same in the code? Or, there is no way to do the same in QML?
I've used a rectangle with the margins you give, of course if I use console log, it will print what is given in each anchor. This only tells us what is already entered in those elements.
What evidence can you give of the integers being rounded off?, how do you know this?, please paste a working portion of code that is allowing you arrive at your current conclusion.
You can always use some js;
Math.floor(80.45) yields = 80 Math.ceil(80.45 yields = 81; Math.max(80.45) yields = 80.45