import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import QtQuick.Controls.Material 2.15 Item { property string input: idText.text property string name: "" anchors.topMargin: 5 width: parent.width height: 57 function clear() { idText.clear() } Label { id: idName anchors.left: parent.left text: parent.name + ":" y: 0 Material.foreground: "#167a72" font.pointSize: 10 visible: false } TextField { id: idText y: 10 horizontalAlignment: TextInput.AlignHCenter anchors.horizontalCenter: parent.horizontalCenter width: parent.width selectByMouse: true onTextChanged: { if (text === "") { placeholderText = name idName.visible = false } else { placeholderText = "" idName.visible = true } } placeholderText: name } }