diff --git a/tests/resources.qrc b/tests/resources.qrc
index db2c1c484..6a9c3a51f 100644
--- a/tests/resources.qrc
+++ b/tests/resources.qrc
@@ -49,6 +49,7 @@
ui/modules/Common/Image/Icon.qml
ui/modules/Common/Image/RoundedImage.qml
ui/modules/Common/InvertedMouseArea.qml
+ ui/modules/Common/Menu/ActionMenuEntry.qml
ui/modules/Common/Menu/ActionMenu.qml
ui/modules/Common/Menu/Menu.qml
ui/modules/Common/Paned.qml
diff --git a/tests/ui/modules/Common/Menu/ActionMenu.qml b/tests/ui/modules/Common/Menu/ActionMenu.qml
index 1e2e2db8a..d394ac4f8 100644
--- a/tests/ui/modules/Common/Menu/ActionMenu.qml
+++ b/tests/ui/modules/Common/Menu/ActionMenu.qml
@@ -10,51 +10,8 @@ import Common.Styles 1.0
ColumnLayout {
id: menu
- signal clicked (int entry)
-
spacing: ActionMenuStyle.spacing
property int entryHeight
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)
- }
- }
- }
}
diff --git a/tests/ui/modules/Common/Menu/ActionMenuEntry.qml b/tests/ui/modules/Common/Menu/ActionMenuEntry.qml
new file mode 100644
index 000000000..530210dca
--- /dev/null
+++ b/tests/ui/modules/Common/Menu/ActionMenuEntry.qml
@@ -0,0 +1,48 @@
+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
+ }
+}
diff --git a/tests/ui/modules/Common/qmldir b/tests/ui/modules/Common/qmldir
index 3b24043b3..c097b1f51 100644
--- a/tests/ui/modules/Common/qmldir
+++ b/tests/ui/modules/Common/qmldir
@@ -50,6 +50,7 @@ InvertedMouseArea 1.0 InvertedMouseArea.qml
# Menu
ActionMenu 1.0 Menu/ActionMenu.qml
+ActionMenuEntry 1.0 Menu/ActionMenuEntry.qml
Menu 1.0 Menu/Menu.qml
# Paned
diff --git a/tests/ui/modules/Linphone/Call/CallControls.qml b/tests/ui/modules/Linphone/Call/CallControls.qml
index 1e72eec73..06b087c04 100644
--- a/tests/ui/modules/Linphone/Call/CallControls.qml
+++ b/tests/ui/modules/Linphone/Call/CallControls.qml
@@ -62,15 +62,23 @@ RowLayout {
entryHeight: 22
entryWidth: 120
- entries: [
- qsTr('acceptAudioCall'),
- qsTr('acceptVideoCall'),
- qsTr('hangup')
- ]
- onClicked: {
- console.log('entry', entry)
- menu.hideMenu()
+ ActionMenuEntry {
+ text: qsTr('acceptAudioCall')
+
+ onClicked: menu.hideMenu()
+ }
+
+ ActionMenuEntry {
+ text: qsTr('acceptVideoCall')
+
+ onClicked: menu.hideMenu()
+ }
+
+ ActionMenuEntry {
+ text: qsTr('hangup')
+
+ onClicked: menu.hideMenu()
}
}
}