Skip to content

Instantly share code, notes, and snippets.

@HamedMasafi
Last active August 11, 2023 15:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HamedMasafi/9e28a14daa3953805e3e311a35aae5af to your computer and use it in GitHub Desktop.
Save HamedMasafi/9e28a14daa3953805e3e311a35aae5af to your computer and use it in GitHub Desktop.
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0
import QtQuick.Controls.Material 2.3
Popup {
id: globalPopUpDialog
property var title : "Unknown title"
property var description : "Unknown details"
property var type : "info"
parent: Overlay.overlay
anchors.centerIn: Overlay.overlay
modal: true
focus: true
implicitWidth: 300
implicitHeight: 200
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
dim: true
enter: Transition {
ParallelAnimation {
NumberAnimation {
property: "opacity";
from: 0.0;
to: 1.0;
//easing.type: Easing.InElastic;
duration: 300
}
NumberAnimation {
property: "scale";
from: 0.4;
to: 1.0;
easing.type: Easing.OutBack
duration: 300
}
}
}
exit: Transition {
ParallelAnimation {
NumberAnimation {
property: "opacity";
from: 1.0
to: 0.0;
duration: 300
}
NumberAnimation {
property: "scale";
from: 1.0
to: 0.8;
duration: 300
}
}
}
Overlay.modal: Item {
Rectangle{
color: 'black'
opacity: .3
anchors.fill: parent
}
ColumnLayout {
anchors.fill: parent
spacing: 0
FastBlur {
source: ApplicationWindow.header
height: ApplicationWindow.header === null
? 0
: ApplicationWindow.header.height
Layout.fillWidth: true
radius: 32 * globalPopUpDialog.opacity
}
FastBlur {
source: ApplicationWindow.contentItem
Layout.fillWidth: true
Layout.fillHeight: true
radius: 32 * globalPopUpDialog.opacity
}
FastBlur {
source: ApplicationWindow.footer
height: ApplicationWindow.footer === null
? 0
: ApplicationWindow.footer.height
Layout.fillWidth: true
radius: 32 * globalPopUpDialog.opacity
}
}
}
// background: Rectangle {
// // color: appStyle.backgroundActivated
// // border.color: appStyle.borderActivated
// border.width: 0
// radius: 5
// }
background: null
// RectangularGlow {
// anchors.fill: pane
// cornerRadius: 5
// spread: 17
// color: "red"
// }
contentItem : Pane {
id: pane
Material.elevation: 16
// background: Rectangle {
// radius: 5
// border.color: 'gray'
// color: 'white'
// }
ColumnLayout {
anchors.fill: parent
anchors.margins: 10
layoutDirection: Qt.RightToLeft
Text {
text: qsTr(title)
// font.family: fontSystem.getTitleFont.name
// font.pixelSize: appStyle.h6
font.bold: true
// color: {
// if(type=="info") {
// appStyle.primary
// } else if (type=="warning") {
// appStyle.warning
// } else if (type=="error") {
// appStyle.error
// } else if (type=="success") {
// appStyle.success
// } else {
// appStyle.primary
// }
// }
}
// Controls.HorizontalLine { }
Text {
text: qsTr(description)
// font.family: fontSystem.getContentFont.name
// font.pixelSize: appStyle.paragraph
font.weight: Font.Light
}
// Controls.VerticalSpacer { }
Button {
text: "فهمیدم!";
onClicked: {
globalPopUpDialog.close();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment