2020-06-17 19:31:01 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2020-05-27 21:09:12 +00:00
|
|
|
import "../imports"
|
2020-06-25 13:23:17 +00:00
|
|
|
import "../shared"
|
2020-05-27 20:42:24 +00:00
|
|
|
|
|
|
|
Menu {
|
|
|
|
property alias arrowX: bgPopupMenuTopArrow.x
|
2020-05-28 01:42:22 +00:00
|
|
|
closePolicy: Popup.CloseOnPressOutsideParent
|
2020-05-27 20:42:24 +00:00
|
|
|
id: popupMenu
|
2020-07-02 15:14:31 +00:00
|
|
|
topPadding: Style.current.padding
|
|
|
|
bottomPadding: Style.current.padding
|
2020-05-27 20:42:24 +00:00
|
|
|
delegate: MenuItem {
|
|
|
|
id: popupMenuItem
|
|
|
|
implicitWidth: 200
|
|
|
|
implicitHeight: 40
|
|
|
|
font.pixelSize: 15
|
2020-07-02 15:14:31 +00:00
|
|
|
icon.color: popupMenuItem.action.icon.color != "#00000000" ? popupMenuItem.action.icon.color : Style.current.blue
|
2020-05-27 20:42:24 +00:00
|
|
|
contentItem: Item {
|
2020-06-22 21:04:16 +00:00
|
|
|
id: menuItemContent
|
2020-05-27 20:42:24 +00:00
|
|
|
Item {
|
|
|
|
id: menuIcon
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 12
|
2020-06-22 21:04:16 +00:00
|
|
|
height: popupMenuItemIcon.height
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-06-25 13:23:17 +00:00
|
|
|
SVGImage {
|
2020-05-27 20:42:24 +00:00
|
|
|
id: popupMenuItemIcon
|
|
|
|
source: popupMenuItem.icon.source
|
|
|
|
visible: false
|
2020-06-25 13:23:17 +00:00
|
|
|
width: 25
|
|
|
|
height: 25
|
2020-05-27 20:42:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ColorOverlay {
|
2020-06-25 13:23:17 +00:00
|
|
|
cached: true
|
2020-05-27 20:42:24 +00:00
|
|
|
anchors.fill: popupMenuItemIcon
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
source: popupMenuItemIcon
|
2020-07-02 15:14:31 +00:00
|
|
|
color: popupMenuItem.highlighted ? Style.current.white : popupMenuItem.action.icon.color
|
2020-05-27 20:42:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-05-27 20:42:24 +00:00
|
|
|
anchors.left: menuIcon.right
|
|
|
|
anchors.leftMargin: 32
|
2020-05-28 02:26:01 +00:00
|
|
|
topPadding: 4
|
2020-05-27 20:42:24 +00:00
|
|
|
text: popupMenuItem.text
|
|
|
|
font: popupMenuItem.font
|
2020-07-02 15:14:31 +00:00
|
|
|
color: popupMenuItem.highlighted ? Style.current.white : Style.current.black
|
2020-05-27 20:42:24 +00:00
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
implicitWidth: 220
|
|
|
|
implicitHeight: 40
|
2020-06-12 14:01:46 +00:00
|
|
|
color: popupMenuItem.highlighted ? popupMenuItem.icon.color : "transparent"
|
2020-05-27 20:42:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
id: bgPopupMenu
|
|
|
|
implicitWidth: 220
|
|
|
|
color: "transparent"
|
|
|
|
Rectangle {
|
|
|
|
id: bgPopupMenuTopArrow
|
2020-07-02 15:14:31 +00:00
|
|
|
color: Style.current.white2
|
2020-05-27 20:42:24 +00:00
|
|
|
height: 14
|
|
|
|
width: 14
|
|
|
|
rotation: 135
|
|
|
|
x: bgPopupMenu.width / 2 - width / 2
|
|
|
|
layer.enabled: true
|
|
|
|
layer.effect: DropShadow{
|
|
|
|
width: bgPopupMenuTopArrow.width
|
|
|
|
height: bgPopupMenuTopArrow.height
|
|
|
|
x: bgPopupMenuTopArrow.x
|
|
|
|
y: bgPopupMenuTopArrow.y + 10
|
|
|
|
visible: bgPopupMenuTopArrow.visible
|
|
|
|
source: bgPopupMenuTopArrow
|
|
|
|
horizontalOffset: 0
|
|
|
|
verticalOffset: 5
|
|
|
|
radius: 10
|
|
|
|
samples: 15
|
|
|
|
color: "#22000000"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: bgPopupMenuContent
|
|
|
|
y: 7
|
|
|
|
implicitWidth: bgPopupMenu.width
|
|
|
|
implicitHeight: bgPopupMenu.height
|
2020-07-02 15:14:31 +00:00
|
|
|
color: Style.current.white2
|
2020-05-27 20:42:24 +00:00
|
|
|
radius: 16
|
|
|
|
layer.enabled: true
|
|
|
|
layer.effect: DropShadow{
|
|
|
|
width: bgPopupMenuContent.width
|
|
|
|
height: bgPopupMenuContent.height
|
|
|
|
x: bgPopupMenuContent.x
|
|
|
|
y: bgPopupMenuContent.y + 10
|
|
|
|
visible: bgPopupMenuContent.visible
|
|
|
|
source: bgPopupMenuContent
|
|
|
|
horizontalOffset: 0
|
|
|
|
verticalOffset: 7
|
|
|
|
radius: 10
|
|
|
|
samples: 15
|
|
|
|
color: "#22000000"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-06-04 14:53:10 +00:00
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|