fix: IconTextButton not impl'd properly
This commit is contained in:
parent
c4b932b910
commit
69fe7c1251
1 changed files with 27 additions and 4 deletions
|
|
@ -13,10 +13,27 @@ ButtonBase {
|
||||||
readonly property alias iconLabel: iconLabel
|
readonly property alias iconLabel: iconLabel
|
||||||
readonly property alias label: label
|
readonly property alias label: label
|
||||||
|
|
||||||
activeColour: type === IconTextButton.Filled ? Colours.palette.m3primary : Colours.palette.m3secondary
|
horizontalPadding: Tokens.padding.medium
|
||||||
inactiveColour: type === IconTextButton.Filled ? Colours.tPalette.m3surfaceContainer : Colours.palette.m3secondaryContainer
|
verticalPadding: Tokens.padding.small
|
||||||
activeOnColour: type === IconTextButton.Filled ? Colours.palette.m3onPrimary : Colours.palette.m3onSecondary
|
|
||||||
inactiveOnColour: type === IconTextButton.Filled ? Colours.palette.m3onSurface : Colours.palette.m3onSecondaryContainer
|
activeColour: type === TextButton.Filled ? Colours.palette.m3primary : Colours.palette.m3secondary
|
||||||
|
inactiveColour: {
|
||||||
|
if (!isToggle && type === TextButton.Filled)
|
||||||
|
return Colours.palette.m3primary;
|
||||||
|
return type === TextButton.Filled ? Colours.tPalette.m3surfaceContainer : Colours.palette.m3secondaryContainer;
|
||||||
|
}
|
||||||
|
activeOnColour: {
|
||||||
|
if (type === TextButton.Text)
|
||||||
|
return Colours.palette.m3primary;
|
||||||
|
return type === TextButton.Filled ? Colours.palette.m3onPrimary : Colours.palette.m3onSecondary;
|
||||||
|
}
|
||||||
|
inactiveOnColour: {
|
||||||
|
if (!isToggle && type === TextButton.Filled)
|
||||||
|
return Colours.palette.m3onPrimary;
|
||||||
|
if (type === TextButton.Text)
|
||||||
|
return Colours.palette.m3primary;
|
||||||
|
return type === TextButton.Filled ? Colours.palette.m3onSurface : Colours.palette.m3onSecondaryContainer;
|
||||||
|
}
|
||||||
|
|
||||||
implicitWidth: row.implicitWidth + horizontalPadding * 2
|
implicitWidth: row.implicitWidth + horizontalPadding * 2
|
||||||
implicitHeight: row.implicitHeight + verticalPadding * 2
|
implicitHeight: row.implicitHeight + verticalPadding * 2
|
||||||
|
|
@ -34,6 +51,11 @@ ButtonBase {
|
||||||
Layout.topMargin: Math.round(fontInfo.pointSize * 0.0575)
|
Layout.topMargin: Math.round(fontInfo.pointSize * 0.0575)
|
||||||
color: root.onColour
|
color: root.onColour
|
||||||
fill: root.internalChecked ? 1 : 0
|
fill: root.internalChecked ? 1 : 0
|
||||||
|
fontStyle: {
|
||||||
|
const f = Qt.font(root.font);
|
||||||
|
f.pointSize = Math.round(root.font.pointSize * 1.1);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
Behavior on fill {
|
Behavior on fill {
|
||||||
Anim {
|
Anim {
|
||||||
|
|
@ -48,6 +70,7 @@ ButtonBase {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.topMargin: -Math.round(iconLabel.fontInfo.pointSize * 0.0575)
|
Layout.topMargin: -Math.round(iconLabel.fontInfo.pointSize * 0.0575)
|
||||||
color: root.onColour
|
color: root.onColour
|
||||||
|
font: root.font
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue