方法支持。
此范例构建于:
						The Methods Example has an additional method in the
						
BirthdayParty
						
						类:
						
invite()
						
						.
						
invite()
						
						is declared with
						
							Q_INVOKABLE
						
						so that it can be called from QML.
					
    Q_INVOKABLE void invite(const QString &name);
					
					
						在
						
example.qml
						
						,
						
invite()
						
						method is called in the
						
							Component.onCompleted
						
						signal handler:
					
import QtQuick 2.0 import People 1.0 BirthdayParty { host: Person { name: "Bob Jones" shoeSize: 12 } guests: [ Person { name: "Leo Hodges" }, Person { name: "Jack Smith" }, Person { name: "Anne Brown" } ] Component.onCompleted: invite("William Green") }