Тип QML ButtonStyle
Предоставляет настраиваемую стилизацию для Button. Подробнее...
| Заявление об импорте: | import QtQuick.Controls.Styles 1.4 |
| С: | Qt 5.1 |
Свойства
- background : Component
- control : Button
- label : Component
Подробное описание
Вы можете создать настраиваемую кнопку, заменив делегат "background" типа ButtonStyle на свой пользовательский дизайн.
Пример:
Button {
text: "A button"
style: ButtonStyle {
background: Rectangle {
implicitWidth: 100
implicitHeight: 25
border.width: control.activeFocus ? 2 : 1
border.color: "#888"
radius: 4
gradient: Gradient {
GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
}
}
}
} Если вам нужна настраиваемая метка, вы можете заменить элемент метки.
Документация по свойствам
background : Component
Определяет фон кнопки.
[только для чтения] control : Button
Кнопка Button, к которой прикреплен этот стиль.
label : Component
Определяет метку кнопки.
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.12/qml-qtquick-controls-styles-buttonstyle.html