Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Use of real values in anchor margin
Forum Updated to NodeBB v4.3 + New Features

Use of real values in anchor margin

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 301 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BikashRDas
    wrote on last edited by
    #1

    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?

    MarkkyboyM 1 Reply Last reply
    0
    • B BikashRDas

      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?

      MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on last edited by Markkyboy
      #2

      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
      

      Don't just sit there standing around, pick up a shovel and sweep up!

      I live by the sea, not in it.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved