// The filled Material button, painted explicitly. // // Relying on `highlighted: true` leaves the fill to the style, and under some // renderers that fill never appears — white text on a white surface. The // primary action on a page is exactly the thing that must never be invisible, // so it draws its own pill. import QtQuick import QtQuick.Controls.Material Button { id: control Material.foreground: "white" font.weight: Font.Medium leftPadding: 20 rightPadding: 20 implicitHeight: 40 background: Rectangle { radius: height / 2 color: control.enabled ? Material.accent : Material.buttonDisabledColor opacity: control.pressed ? 0.82 : (control.hovered ? 0.92 : 1) Behavior on opacity { NumberAnimation { duration: 120 } } } contentItem: Label { text: control.text font: control.font color: control.enabled ? "white" : Material.hintTextColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } }