Add FluPopup for universally use.
parent
0dbbba56da
commit
3007f8f3df
|
@ -4,15 +4,13 @@ import QtQuick.Controls
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Popup {
|
FluPopup {
|
||||||
id: popup
|
id: popup
|
||||||
property string title: "Title"
|
property string title: "Title"
|
||||||
property string message: "Message"
|
property string message: "Message"
|
||||||
property string neutralText: "Neutral"
|
property string neutralText: "Neutral"
|
||||||
property string negativeText: "Negative"
|
property string negativeText: "Negative"
|
||||||
property string positiveText: "Positive"
|
property string positiveText: "Positive"
|
||||||
property alias blurSource: blur.sourceItem
|
|
||||||
property bool blurBackground: true
|
|
||||||
signal neutralClicked
|
signal neutralClicked
|
||||||
signal negativeClicked
|
signal negativeClicked
|
||||||
signal positiveClicked
|
signal positiveClicked
|
||||||
|
@ -27,32 +25,7 @@ Popup {
|
||||||
return 400
|
return 400
|
||||||
return Math.min(Window.window.width,400)
|
return Math.min(Window.window.width,400)
|
||||||
}
|
}
|
||||||
modal:true
|
|
||||||
anchors.centerIn: Overlay.overlay
|
|
||||||
closePolicy: Popup.CloseOnEscape
|
|
||||||
background:Item{}
|
|
||||||
enter: Transition {
|
|
||||||
reversible: true
|
|
||||||
NumberAnimation {
|
|
||||||
properties: "opacity,scale"
|
|
||||||
from:0
|
|
||||||
to:1
|
|
||||||
duration: 167
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exit:Transition {
|
|
||||||
NumberAnimation {
|
|
||||||
properties: "opacity,scale"
|
|
||||||
from:1
|
|
||||||
to:0
|
|
||||||
duration: 167
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
contentItem:
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id:layout_content
|
id:layout_content
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -60,20 +33,6 @@ Popup {
|
||||||
implicitHeight: text_title.height + text_message.height + layout_actions.height
|
implicitHeight: text_title.height + text_message.height + layout_actions.height
|
||||||
color: 'transparent'
|
color: 'transparent'
|
||||||
radius:5
|
radius:5
|
||||||
FluAcrylic{
|
|
||||||
id:blur
|
|
||||||
anchors{
|
|
||||||
top:parent.top
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: layout_actions.bottom
|
|
||||||
}
|
|
||||||
height: parent.height
|
|
||||||
color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1)
|
|
||||||
rectX: popup.x
|
|
||||||
rectY: popup.y
|
|
||||||
acrylicOpacity:blurBackground ? 0.8 : 1
|
|
||||||
}
|
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
font: FluTextStyle.TitleLarge
|
font: FluTextStyle.TitleLarge
|
||||||
|
@ -107,7 +66,7 @@ Popup {
|
||||||
id:layout_actions
|
id:layout_actions
|
||||||
height: 68
|
height: 68
|
||||||
radius: 5
|
radius: 5
|
||||||
color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255, blurBackground ? blur.acrylicOpacity - 0.4 : 1) : Qt.rgba(243/255,243/255,243/255,blurBackground ? blur.acrylicOpacity - 0.4 : 1)
|
color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255, blurBackground ? blurOpacity - 0.4 : 1) : Qt.rgba(243/255,243/255,243/255,blurBackground ? blurOpacity - 0.4 : 1)
|
||||||
anchors{
|
anchors{
|
||||||
top:text_message.bottom
|
top:text_message.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Popup {
|
||||||
|
id: popup
|
||||||
|
padding: 0
|
||||||
|
modal:true
|
||||||
|
anchors.centerIn: Overlay.overlay
|
||||||
|
closePolicy: Popup.CloseOnEscape
|
||||||
|
property alias blurSource: blur.sourceItem
|
||||||
|
property bool blurBackground: true
|
||||||
|
property alias blurOpacity: blur.acrylicOpacity
|
||||||
|
|
||||||
|
enter: Transition {
|
||||||
|
reversible: true
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
from:0
|
||||||
|
to:1
|
||||||
|
duration: 167
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit:Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
from:1
|
||||||
|
to:0
|
||||||
|
duration: 167
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
background: FluAcrylic{
|
||||||
|
id:blur
|
||||||
|
color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1)
|
||||||
|
rectX: popup.x
|
||||||
|
rectY: popup.y
|
||||||
|
acrylicOpacity:blurBackground ? 0.8 : 1
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue