Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-134903

Duplicate context menus when using custom context Menus in text controls

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P1: Critical P1: Critical
    • 6.11
    • 6.10
    • Quick: Controls 2
    • None
    • 64063946d (dev), 9ac0e70cd (dev), 4fc898246 (6.9), e5824ea91 (6.9), d1457b0d7 (dev), c5e36d2c9 (6.9), 3461a3549 (6.9.1), 6dbd71c3d (6.9.1), 91d3e6643 (6.9), 8f15bee62 (6.10), 0eb67e852 (6.10), 57ca19c11 (6.10)

      To reproduce:

      1. Open e.g. texteditor example
      2. Right click; our text editing context menu will be shown, but once it's closed, another native one will still be visible

      Windows isn't affected as it opens context menus on release.

      The workaround is to only open context menus on press on non-Windows systems:

          TapHandler {
              acceptedButtons: Qt.RightButton
              onPressedChanged: {
                  if (pressed == (Application.styleHints.contextMenuTrigger === Qt.ContextMenuTrigger.Press))
                      contextMenu.popup()
              }
          }
      

      If you don't want to use ContextMenu at all, you can avoid this with the following code in e.g. TextArea and reuse that TextArea throughout the app:

      ContextMenu.menu: null
      

        For Gerrit Dashboard: QTBUG-134903
        # Subject Branch Project Status CR V

            mitch_curtis Mitch Curtis
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: