Item

API ReferenceRendererItem

Source


Item.New()

Static method of
Item
Parameters
  • options — Objectoptional
Returns
Item

Source


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: function(){
        // boom!
    }
}

on$Change()

Parameters
  • property — String
  • oldValue — Any
Type
Signal

Source


query

Type
String
Read Only

Source


node

Type
Document.Element
Read Only

onNodeChange()

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

Source


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


onAnimationFrame()

Parameters
  • miliseconds — Integer
Type
Signal

Source


id

Type
String
Read Only

children

Type
Object

Source


onChildrenChange()

Parameters
  • added — Item
  • removed — Item
Type
Signal

Source


children.firstChild

Type
Item
Read Only

Source


children.lastChild

Type
Item
Read Only

Source


children.bottomChild

Type
Item
Read Only

Source


children.topChild

Type
Item
Read Only

Source


children.length

Type
Integer
Read Only

Source


children.layout

Type
Item

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


children.onLayoutChange()

Parameters
  • oldValue — Item
Type
Signal

Source


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.


children.onTargetChange()

Parameters
  • oldValue — Item
Type
Signal

Source


children.get()

Parameters
  • index — Integer
Returns
Item

Returns an item with the given index.

Source


children.index()

Parameters
  • value — Item
Returns
Integer

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

Source


children.has()

Parameters
  • value — Item
Returns
Boolean

Returns true if the given item is an item child.

Source


children.clear()

Removes all children from the item.

Source


parent

Type
Item
Default
null

onParentChange()

Parameters
  • oldParent — Item
Type
Signal

Source


previousSibling

Type
Item

Source


onPreviousSiblingChange()

Parameters
  • oldValue — Item
Type
Signal

Source


nextSibling

Type
Item

Source


onNextSiblingChange()

Parameters
  • oldValue — Item
Type
Signal

Source


belowSibling

Type
Item
Read Only

Source


aboveSibling

Type
Item
Read Only

Source


index

Type
Integer

Source


visible

Type
Boolean
Default
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
    }
}

onVisibleChange()

Parameters
  • oldValue — Boolean
Type
Signal

Source


clip

Type
Boolean
Default
false

onClipChange()

Parameters
  • oldValue — Boolean
Type
Signal

Source


width

Type
Float
Default
0

onWidthChange()

Parameters
  • oldValue — Float
Type
Signal

Source


height

Type
Float
Default
0

onHeightChange()

Parameters
  • oldValue — Float
Type
Signal

Source


x

Type
Float
Default
0

onXChange()

Parameters
  • oldValue — Float
Type
Signal

Source


y

Type
Float
Default
0

onYChange()

Parameters
  • oldValue — Float
Type
Signal

Source


z

Type
Float
Default
0

onZChange()

Parameters
  • oldValue — Float
Type
Signal

Source


scale

Type
Float
Default
1

onScaleChange()

Parameters
  • oldValue — Float
Type
Signal

Source


rotation

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

onRotationChange()

Parameters
  • oldValue — Float
Type
Signal

Source


opacity

Type
Float
Default
1

onOpacityChange()

Parameters
  • oldValue — Float
Type
Signal

Source


linkUri

Type
String
Default
''

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


onLinkUriChange()

Parameters
  • oldValue — String
Type
Signal

Source


background

Type
Item

An item used as a background for the item.

By default, background is filled to his parent.


onBackgroundChange()

Parameters
  • oldValue — Item
Type
Signal

Source


overlap()

Parameters
  • item — Item

Returns true if two items overlaps.

Source


anchors

Type
Item.Anchors

onAnchorsChange()

Parameters
  • property — String
  • oldValue — Array
Type
Signal

Source


layout

Type
Item.Layout

onLayoutChange()

Parameters
  • property — String
  • oldValue — Any
Type
Signal

Source


pointer

Type
Item.Pointer

Source


margin

Type
Item.Margin

onMarginChange()

Parameters
  • property — String
  • oldValue — Any
Type
Signal

Source


keys

Type
Item.Keys

Source

results matching ""

    No results matching ""