Давайте рассмотрим следующий пример:QML герметизация без создания новых файлов
ColumnLayout
{
spacing: 10
Label { color: "green"; text: "one text" }
Label { color: "green"; text: "another text" }
Label { color: "green"; text: "some text" }
}
Было бы здорово, чтобы создать тип. Можно создать файл GreenLabel.qml
Label { color: "green" }
и сделать что-то вроде этого:
ColumnLayout
{
spacing: 10
GreenLabel { text: "one text" }
GreenLabel { text: "another text" }
GreenLabel { text: "some text" }
}
Можно ли это сделать без создания другого файла?