mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-05 01:25:25 +08:00
update
This commit is contained in:
@ -4,5 +4,5 @@ import QtGraphicalEffects 1.15
|
||||
DropShadow {
|
||||
radius: 5
|
||||
samples: 4
|
||||
color: FluApp.isDark ? "#80FFFFFF" : "#80000000"
|
||||
color: FluApp.isDark ? "#80FFFFFF" : "#40000000"
|
||||
}
|
||||
|
@ -1,41 +1,26 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Controls.impl 2.15
|
||||
import QtQuick.Templates 2.15 as T
|
||||
import QtQuick.Window 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
T.Menu {
|
||||
id: control
|
||||
Popup {
|
||||
id: popup
|
||||
default property alias content: container.children
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
contentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
contentHeight + topPadding + bottomPadding)
|
||||
margins: 0
|
||||
delegate: FluMenuItem { }
|
||||
|
||||
contentItem: ListView {
|
||||
implicitHeight: contentHeight
|
||||
model: control.contentModel
|
||||
interactive: Window.window ? contentHeight > Window.window.height : false
|
||||
clip: true
|
||||
currentIndex: control.currentIndex
|
||||
ScrollIndicator.vertical: ScrollIndicator {}
|
||||
}
|
||||
|
||||
background: Item {
|
||||
implicitWidth: 122
|
||||
implicitHeight: 30
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color: "#FFFFFF"
|
||||
layer.effect: FluDropShadow{}
|
||||
layer.enabled: true
|
||||
background: FluRectangle {
|
||||
implicitWidth: 140
|
||||
implicitHeight: container.height
|
||||
color:FluApp.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(237/255,237/255,237/255,1)
|
||||
radius: [5,5,5,5]
|
||||
layer.effect: FluDropShadow{}
|
||||
layer.enabled: true
|
||||
Column{
|
||||
spacing: 5
|
||||
topPadding: 5
|
||||
bottomPadding: 5
|
||||
id:container
|
||||
function closePopup(){
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,29 +1,40 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Controls.impl 2.15
|
||||
import QtQuick.Templates 2.15 as T
|
||||
import QtQuick.Shapes 1.15
|
||||
|
||||
T.MenuItem {
|
||||
id: control
|
||||
Item {
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding,
|
||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||
padding: 0
|
||||
spacing: 6
|
||||
id:root
|
||||
width: 140
|
||||
height: 32
|
||||
|
||||
contentItem: FluText {
|
||||
text: control.text
|
||||
property string text: "MenuItem"
|
||||
signal clicked
|
||||
|
||||
Rectangle{
|
||||
anchors.centerIn: parent
|
||||
width: 100
|
||||
height: 32
|
||||
radius: 4
|
||||
color:{
|
||||
if(mouse_area.containsMouse){
|
||||
return FluApp.isDark ? Qt.rgba(56/255,56/255,56/255,1) : Qt.rgba(230/255,230/255,230/255,1)
|
||||
}
|
||||
return FluApp.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(237/255,237/255,237/255,1)
|
||||
}
|
||||
|
||||
FluText{
|
||||
text: root.text
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
id:mouse_area
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
root.clicked()
|
||||
root.parent.closePopup()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
implicitWidth: 120
|
||||
implicitHeight: 30
|
||||
width: control.width
|
||||
height: control.height
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ Item{
|
||||
id:container
|
||||
width: root.width
|
||||
height: root.height
|
||||
visible: false
|
||||
opacity: 0
|
||||
color:root.color
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,9 @@ Item {
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
radius: 5
|
||||
samples: 4
|
||||
samples: 5
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 0
|
||||
color: "#40000000"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user