parent
1c0f00d3c5
commit
01f724800f
1 changed files with 56 additions and 43 deletions
|
|
@ -413,13 +413,29 @@ StyledRect {
|
|||
Anim {}
|
||||
}
|
||||
|
||||
Action {
|
||||
modelData: QtObject {
|
||||
readonly property string text: qsTr("Close")
|
||||
function invoke(): void {
|
||||
root.modelData.notification.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: root.modelData.actions
|
||||
|
||||
delegate: StyledRect {
|
||||
delegate: Component {
|
||||
Action {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component Action: StyledRect {
|
||||
id: action
|
||||
|
||||
required property NotificationAction modelData
|
||||
required property var modelData
|
||||
|
||||
radius: Appearance.rounding.full
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3secondary : Colours.palette.m3surfaceContainerHigh
|
||||
|
|
@ -450,19 +466,16 @@ StyledRect {
|
|||
TextMetrics {
|
||||
id: actionTextMetrics
|
||||
|
||||
text: modelData.text
|
||||
text: action.modelData.text
|
||||
font.family: actionText.font.family
|
||||
font.pointSize: actionText.font.pointSize
|
||||
elide: Text.ElideRight
|
||||
elideWidth: {
|
||||
const numActions = root.modelData.actions.length;
|
||||
const numActions = root.modelData.actions.length + 1;
|
||||
return (inner.width - actions.spacing * (numActions - 1)) / numActions - Appearance.padding.normal * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component Anim: NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue