Units of measurement for sizes, spacing, margin, etc. More...

Import Statement: import Ubuntu.Components 1.3



  • real dp(real value)
  • real gu(real value)

Detailed Description

Units provides facilities for measuring UI elements in a variety of units other than just pixels.

A global instance of Units is exposed as the units context property. Example usage:

import QtQuick 2.4
import Ubuntu.Components 1.2
Item {
width: units.gu(2)
height: units.gu(5)

See also Resolution Independence.

Property Documentation

gridUnit : real

The number of pixels 1 grid unit corresponds to.

Method Documentation

real dp(real value)

Returns the number of pixels value density independent pixels correspond to.

real gu(real value)

Returns the number of pixels value grid units correspond to.