// file: poc-qt/poc001/qml/main.qml

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import com.sasedev.hello

ApplicationWindow {
    visible: true
    width: 420
    height: 220
    title: "Rust + Qt Hello"

    Greeter {
        id: greeter
        message: "Hello"
    }

    ColumnLayout {
        anchors.fill: parent
        anchors.margins: 16
        spacing: 12

        TextField {
            Layout.fillWidth: true
            placeholderText: "Enter your name"
            text: greeter.name

            onTextChanged: {
                greeter.name = text
            }
        }

        Button {
            text: "Say Hello"
            onClicked: {
                greeter.sayHello()
            }
        }

        Label {
            Layout.fillWidth: true
            text: greeter.message
        }
    }
}
