#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <iostream>

#include "animaux.hpp"

using namespace std;

int main(int argc, char *argv[])
{
    Animaux gerard{"Lapin"}, boris{"Paon"};

    QObject::connect(&gerard, &Animaux::nameChanged,
                     &boris,  &Animaux::setName
    );

    gerard.setName("Lièvre");

    qWarning() << gerard.name() << boris.name() << "\n";


    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    QObject::connect(
        &engine,
        &QQmlApplicationEngine::objectCreationFailed,
        &app,
        []() { QCoreApplication::exit(-1); },
        Qt::QueuedConnection);
    engine.loadFromModule("signaux", "Main");

    return app.exec();
}
