diff --git a/examples/quick/controls/gallery/content/Controls.qml b/examples/quick/controls/gallery/content/Controls.qml
index 64df4ebdb37736a3a8395226ce348a6803f644c6..a8adf8a590f7fb1bbee85b4334bf8b9e02537e93 100644
--- a/examples/quick/controls/gallery/content/Controls.qml
+++ b/examples/quick/controls/gallery/content/Controls.qml
@@ -216,13 +216,7 @@ Item {
                 wrapMode: wrapCheck.checked ? TextEdit.WordWrap : TextEdit.NoWrap
                 Layout.fillWidth: true
                 Layout.fillHeight: true
-                MouseArea {
-                    id: contextMenu
-                    parent: area.viewport
-                    anchors.fill: parent
-                    acceptedButtons: Qt.RightButton
-                    onPressed: editmenu.popup()
-                }
+                menu: editmenu
             }
         }
     }