IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Extending QML - Methods Example

Methods Support.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Extending QML - Methods Example

This example builds on:

The Methods Example has an additional method in the BirthdayParty class: invite(). invite() is declared with Q_INVOKABLE so that it can be called from QML.

 
Sélectionnez
    Q_INVOKABLE void invite(const QString &name);

In example.qml, the invite() method is called in the Component.onCompleted signal handler:

 
Sélectionnez
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")
}

Example project

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+