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