Possibly fix sizing issue
This commit is contained in:
@@ -15,7 +15,6 @@ BackgroundRectangle {
|
||||
property var notification: null
|
||||
property bool startTimer: false
|
||||
property int timerDuration: 2000
|
||||
property bool firstTime: true
|
||||
|
||||
property string image: {
|
||||
if (hasImage) {
|
||||
@@ -26,62 +25,66 @@ BackgroundRectangle {
|
||||
}
|
||||
return Quickshell.iconPath(notification?.appIcon);
|
||||
}
|
||||
property real targetHeight: notifLayout.implicitHeight + 20
|
||||
|
||||
property bool collapsed: false
|
||||
|
||||
implicitWidth: 400
|
||||
implicitHeight: 0
|
||||
// implicitHeight: Math.max(notifLayout.implicitHeight, 100)
|
||||
readonly property real contentHeight: Math.max(notifLayout.implicitHeight + 20, 100)
|
||||
|
||||
Component.onCompleted: {
|
||||
root.implicitHeight = targetHeight;
|
||||
}
|
||||
clip: true
|
||||
height: collapsed ? 0 : contentHeight
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Behavior on height {
|
||||
SequentialAnimation {
|
||||
NumberAnimation {
|
||||
duration: 150
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
ScriptAction {
|
||||
script: {
|
||||
if (clicked)
|
||||
if (root.clicked)
|
||||
root.dismissed();
|
||||
if (root.implicitHeight === 0)
|
||||
if (root.height === 0)
|
||||
root.timedout();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clip: true
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
root.clicked = true;
|
||||
root.implicitHeight = 0;
|
||||
root.collapsed = true;
|
||||
root.dismissed();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: notifTimer
|
||||
|
||||
interval: timerDuration
|
||||
running: root.startTimer
|
||||
repeat: false
|
||||
|
||||
onTriggered: {
|
||||
root.implicitHeight = 0;
|
||||
root.collapsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: notifLayout
|
||||
|
||||
implicitHeight: Math.max(iconImage.implicitHeight, gridRoot.implicitHeight)
|
||||
Layout.preferredHeight: Math.max(iconImage.implicitHeight, gridRoot.implicitHeight)
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: 10
|
||||
}
|
||||
|
||||
|
||||
IconImage {
|
||||
id: iconImage
|
||||
|
||||
@@ -89,7 +92,7 @@ BackgroundRectangle {
|
||||
Layout.leftMargin: 10
|
||||
implicitSize: 80
|
||||
visible: root.image ? true : false
|
||||
source: root.image
|
||||
source: root.image ? root.image : ""
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
@@ -115,9 +118,8 @@ BackgroundRectangle {
|
||||
|
||||
StyledText {
|
||||
id: summaryText
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
wrapMode: Text.WordWrap
|
||||
text: root.notification ? root.notification.summary : ""
|
||||
}
|
||||
}
|
||||
@@ -137,9 +139,8 @@ BackgroundRectangle {
|
||||
}
|
||||
StyledText {
|
||||
id: bodyText
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
wrapMode: Text.WordWrap
|
||||
text: root.notification ? root.notification.body : ""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user