Commit a4cfd667 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app): add `Menu/ActionMenuEntry`

parent f68e544a
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<file>ui/modules/Common/Image/Icon.qml</file> <file>ui/modules/Common/Image/Icon.qml</file>
<file>ui/modules/Common/Image/RoundedImage.qml</file> <file>ui/modules/Common/Image/RoundedImage.qml</file>
<file>ui/modules/Common/InvertedMouseArea.qml</file> <file>ui/modules/Common/InvertedMouseArea.qml</file>
<file>ui/modules/Common/Menu/ActionMenuEntry.qml</file>
<file>ui/modules/Common/Menu/ActionMenu.qml</file> <file>ui/modules/Common/Menu/ActionMenu.qml</file>
<file>ui/modules/Common/Menu/Menu.qml</file> <file>ui/modules/Common/Menu/Menu.qml</file>
<file>ui/modules/Common/Paned.qml</file> <file>ui/modules/Common/Paned.qml</file>
......
...@@ -10,51 +10,8 @@ import Common.Styles 1.0 ...@@ -10,51 +10,8 @@ import Common.Styles 1.0
ColumnLayout { ColumnLayout {
id: menu id: menu
signal clicked (int entry)
spacing: ActionMenuStyle.spacing spacing: ActionMenuStyle.spacing
property int entryHeight property int entryHeight
property int entryWidth property int entryWidth
property var entries
Repeater {
model: entries
Rectangle {
color: mouseArea.pressed
? ActionMenuStyle.entry.color.pressed
: (mouseArea.containsMouse
? ActionMenuStyle.entry.color.hovered
: ActionMenuStyle.entry.color.normal
)
height: menu.entryHeight
width: menu.entryWidth
Text {
anchors {
left: parent.left
leftMargin: ActionMenuStyle.entry.leftMargin
right: parent.right
rightMargin: ActionMenuStyle.entry.rightMargin
}
color: ActionMenuStyle.entry.text.color
elide: Text.ElideRight
font.pointSize: ActionMenuStyle.entry.text.fontSize
height: parent.height
text: modelData
verticalAlignment: Text.AlignVCenter
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: menu.clicked(index)
}
}
}
} }
import QtQuick 2.7
import Common.Styles 1.0
// ===================================================================
Rectangle {
id: entry
property alias text: text.text
signal clicked
color: mouseArea.pressed
? ActionMenuStyle.entry.color.pressed
: (mouseArea.containsMouse
? ActionMenuStyle.entry.color.hovered
: ActionMenuStyle.entry.color.normal
)
height: parent.entryHeight
width: parent.entryWidth
Text {
id: text
anchors {
left: parent.left
leftMargin: ActionMenuStyle.entry.leftMargin
right: parent.right
rightMargin: ActionMenuStyle.entry.rightMargin
}
color: ActionMenuStyle.entry.text.color
elide: Text.ElideRight
font.pointSize: ActionMenuStyle.entry.text.fontSize
height: parent.height
verticalAlignment: Text.AlignVCenter
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: entry.clicked
}
}
...@@ -50,6 +50,7 @@ InvertedMouseArea 1.0 InvertedMouseArea.qml ...@@ -50,6 +50,7 @@ InvertedMouseArea 1.0 InvertedMouseArea.qml
# Menu # Menu
ActionMenu 1.0 Menu/ActionMenu.qml ActionMenu 1.0 Menu/ActionMenu.qml
ActionMenuEntry 1.0 Menu/ActionMenuEntry.qml
Menu 1.0 Menu/Menu.qml Menu 1.0 Menu/Menu.qml
# Paned # Paned
......
...@@ -62,15 +62,23 @@ RowLayout { ...@@ -62,15 +62,23 @@ RowLayout {
entryHeight: 22 entryHeight: 22
entryWidth: 120 entryWidth: 120
entries: [
qsTr('acceptAudioCall'),
qsTr('acceptVideoCall'),
qsTr('hangup')
]
onClicked: { ActionMenuEntry {
console.log('entry', entry) text: qsTr('acceptAudioCall')
menu.hideMenu()
onClicked: menu.hideMenu()
}
ActionMenuEntry {
text: qsTr('acceptVideoCall')
onClicked: menu.hideMenu()
}
ActionMenuEntry {
text: qsTr('hangup')
onClicked: menu.hideMenu()
} }
} }
} }
......
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