QtObject QML Element

The QtObject element is the most basic element in QML. 更多...

Since: Qt 4.7
實例化: QObject

詳細描述

The QtObject element is a non-visual element which contains only the objectName property.

It can be useful to create a QtObject if you need an extremely lightweight element to enclose a set of custom properties:

import QtQuick 1.0
Item {
    QtObject {
        id: attributes
        property string name
        property int size
        property variant attributes
    }
    Text { text: attributes.name }
}
					

It can also be useful for C++ integration, as it is just a plain QObject 。見 QObject 文檔編製進一步瞭解細節。