Commit 72d33df1 authored by Ronan's avatar Ronan

feat(ui): remove `DropDownMenu` component, create a `Popup` component instead

parent f6f32adf
......@@ -231,7 +231,7 @@
<file>ui/modules/Common/Popup/AbstractDropDownMenu.qml</file>
<file>ui/modules/Common/Popup/DesktopPopup.qml</file>
<file>ui/modules/Common/Popup/DropDownDynamicMenu.qml</file>
<file>ui/modules/Common/Popup/DropDownMenu.qml</file>
<file>ui/modules/Common/Popup/Popup.qml</file>
<file>ui/modules/Common/Popup/PopupShadow.qml</file>
<file>ui/modules/Common/qmldir</file>
<file>ui/modules/Common/Styles/Animations/BusyIndicatorStyle.qml</file>
......
import Utils 1.0
// =============================================================================
// Menu which supports menu like `ActionMenu` or `Menu`.
// =============================================================================
AbstractDropDownMenu {
function _computeHeight () {
return _content[0].height
}
}
import QtQuick 2.7
import QtQuick.Controls 2.1 as Controls
import Utils 1.0
// =============================================================================
Item {
// Optionnal parameters, set the position of popup relative to this item.
property var relativeTo
property int relativeX: 0
property int relativeY: 0
default property alias _content: popup.contentItem
// ---------------------------------------------------------------------------
visible: false
function show () {
if (popup.visible) {
return
}
if (relativeTo) {
var parent = Utils.getTopParent(this)
popup.x = Qt.binding(function () {
return relativeTo ? relativeTo.mapToItem(null, relativeX, relativeY).x : 0
})
popup.y = Qt.binding(function () {
return relativeTo ? relativeTo.mapToItem(null, relativeX, relativeY).y : 0
})
} else {
popup.x = Qt.binding(function () {
return x
})
popup.y = Qt.binding(function () {
return y
})
}
popup.open()
}
function hide () {
if (!popup.visible) {
return
}
popup.x = 0
popup.y = 0
popup.close()
}
// ---------------------------------------------------------------------------
Controls.Popup {
id: popup
background: Rectangle {
height: popup.height
width: popup.width
layer {
enabled: true
effect: PopupShadow {}
}
}
contentItem: Column {
id: internalData
}
padding: 0
Component.onCompleted: parent = Utils.getTopParent(this)
}
}
......@@ -73,7 +73,7 @@ Paned 1.0 Misc/Paned.qml
AbstractDropDownMenu 1.0 Popup/AbstractDropDownMenu.qml
DesktopPopup 1.0 Popup/DesktopPopup.qml
DropDownDynamicMenu 1.0 Popup/DropDownDynamicMenu.qml
DropDownMenu 1.0 Popup/DropDownMenu.qml
Popup 1.0 Popup/Popup.qml
PopupShadow 1.0 Popup/PopupShadow.qml
TooltipArea 1.0 Tooltip/TooltipArea.qml
......
......@@ -59,13 +59,12 @@ ListView {
: 'burger_menu'
iconSize: CallsStyle.entry.iconMenuSize
onClicked: menu.showMenu()
onClicked: popup.show()
DropDownMenu {
id: menu
Popup {
id: popup
implicitWidth: actionMenu.width
launcher: button
relativeTo: callControls
relativeX: callControls.width
......@@ -82,7 +81,7 @@ ListView {
entryName: modelData.name
onClicked: {
menu.hideMenu()
popup.hide()
params.actions[index].handler()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment