Item

APIRendererItem

Source

Item.New(options)

Parameters:
  • options — Objectoptional
Returns:
Item

Source

Item::constructor()

Returns:
Item

This is a base class for everything which is visible.

Source

Custom properties

Item {
    id: main
    property currentLife: 0.8
    Text {
        text: "Life: " + main.currentLife
    }
}

Custom signals

Item {
    signal onPlayerCollision
    onPlayerCollision(){
        // boom!
    }
}

Item::query

Type:
String
Read Only

Source

Item::node

Type:
Document.Element
Read Only

Item::onNodeChange(oldValue)

Parameters:
  • oldValue — Document.Element
Type:
Signal
Text {
    text: this.node.props.value
}
Text {
    onNodeChange: function(){
        var inputs = this.node.queryAll('input[type=string]');
    }
}

Source

Item::ready()

Type:
Signal

Called when the Item is ready, that is, all properties have been set and it's ready to use.

Rectangle {
    width: 200
    height: 50
    color: 'green'
    Rectangle {
        width: parent.width / 2
        height: parent.height / 2
        color: 'yellow'
        onReady: function(){
            console.log(this.width, this.height);
            // 100, 25
        }
    }
}

Source

Item::onAnimationFrame(miliseconds)

Parameters:
  • miliseconds — Integer
Type:
Signal

Source

Item::id

Type:
String
Read Only

Item::children

Type:
Object

Source

Item::onChildrenChange(added, removed)

Parameters:
  • added — Item
  • removed — Item
Type:
Signal

Source

Item::children.firstChild

Type:
Item
Read Only

Source

Item::children.lastChild

Type:
Item
Read Only

Source

Item::children.bottomChild

Type:
Item
Read Only

Source

Item::children.topChild

Type:
Item
Read Only

Source

Item::children.length

Type:
Integer
Read Only

Source

Item::children.layout

Type:
Item

Item used to position children items. Can be e.g. Flow, Grid etc.

Item::children.onLayoutChange(oldValue)

Parameters:
  • oldValue — Item
Type:
Signal

Source

Item::children.target

Type:
Item

A new child trying to be added into the item with the children.target defined will be added into the target item.

Item::children.onTargetChange(oldValue)

Parameters:
  • oldValue — Item
Type:
Signal

Source

Item::children.get(index)

Parameters:
  • index — Integer
Returns:
Item

Returns an item with the given index.

Source

Item::children.index(value)

Parameters:
  • value — Item
Returns:
Integer

Returns an index of the given child in the children array.

Source

Item::children.has(value)

Parameters:
  • value — Item
Returns:
Boolean

Returns true if the given item is an item child.

Source

Item::children.clear()

Removes all children from the item.

Source

Item::parent

Type:
Item
Default value:
null

Item::onParentChange(oldParent)

Parameters:
  • oldParent — Item
Type:
Signal

Source

Item::previousSibling

Type:
Item

Source

Item::onPreviousSiblingChange(oldValue)

Parameters:
  • oldValue — Item
Type:
Signal

Source

Item::nextSibling

Type:
Item

Source

Item::onNextSiblingChange(oldValue)

Parameters:
  • oldValue — Item
Type:
Signal

Source

Item::belowSibling

Type:
Item
Read Only

Source

Item::aboveSibling

Type:
Item
Read Only

Source

Item::index

Type:
Integer

Source

Item::visible

Type:
Boolean
Default value:
true

Determines whether an item is visible or not.

Item {
    width: 100
    height: 100
    pointer.onClick: function(){
        rect.visible = !rect.visible;
        text.text = rect.visible ? "Click to hide" : "Click to show";
    }
    Rectangle {
        id: rect
        anchors.fill: parent
        color: 'blue'
    }
    Text {
        id: text
        text: "Click to hide"
        anchors.centerIn: parent
    }
}

Item::onVisibleChange(oldValue)

Parameters:
  • oldValue — Boolean
Type:
Signal

Source

Item::clip

Type:
Boolean
Default value:
false

Item::onClipChange(oldValue)

Parameters:
  • oldValue — Boolean
Type:
Signal

Source

Item::width

Type:
Float
Default value:
0

Item::onWidthChange(oldValue)

Parameters:
  • oldValue — Float
Type:
Signal

Source

Item::height

Type:
Float
Default value:
0

Item::onHeightChange(oldValue)

Parameters:
  • oldValue — Float
Type:
Signal

Source

Item::x

Type:
Float
Default value:
0

Item::onXChange(oldValue)

Parameters:
  • oldValue — Float
Type:
Signal

Source

Item::y

Type:
Float
Default value:
0

Item::onYChange(oldValue)

Parameters:
  • oldValue — Float
Type:
Signal

Source

Item::z

Type:
Float
Default value:
0

Item::onZChange(oldValue)

Parameters:
  • oldValue — Float
Type:
Signal

Source

Item::scale

Type:
Float
Default value:
1

Item::onScaleChange(oldValue)

Parameters:
  • oldValue — Float
Type:
Signal

Source

Item::rotation

Type:
Float
Default value:
0
Rectangle {
    width: 100
    height: 100
    color: 'red'
    rotation: Math.PI / 4
}

Item::onRotationChange(oldValue)

Parameters:
  • oldValue — Float
Type:
Signal

Source

Item::opacity

Type:
Float
Default value:
1

Item::onOpacityChange(oldValue)

Parameters:
  • oldValue — Float
Type:
Signal

Source

Item::linkUri

Type:
String
Default value:
''

Points to the URI which will be used when user clicks on this item.

Item::onLinkUriChange(oldValue)

Parameters:
  • oldValue — String
Type:
Signal

Source

Item::scaleInPoint(scale, pointX, pointY)

Parameters:
  • scale — Float
  • pointX — Float
  • pointY — Float

Source

Item::getGlobalComputes()

Returns:
Object

Returns globally computed x, y, scale, rotation, visible and opacity.

Source

Item::anchors

Type:
Item.Anchors

Item::onAnchorsChange(property, oldValue)

Parameters:
  • property — String
  • oldValue — Array
Type:
Signal

Source

Item::layout

Type:
Item.Layout

Item::onLayoutChange(property, oldValue)

Parameters:
  • property — String
  • oldValue — Any
Type:
Signal

Source

Item::pointer

Type:
Item.Pointer

Source

Item::margin

Type:
Item.Margin

Item::onMarginChange(property, oldValue)

Parameters:
  • property — String
  • oldValue — Any
Type:
Signal

Source

Item::keys

Type:
Item.Keys

Source