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

Allow disabling built-in ContextMenus of TextField and TextArea with a global flag

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • Quick: Controls 2
    • None

    Description

      After https://codereview.qt-project.org/c/qt/qtdeclarative/+/622429, users who have their own text editing context Menu will only see that, despite the built-in ContextMenus added to TextField and TextArea in https://codereview.qt-project.org/c/qt/qtdeclarative/+/612253. Thanks to deferred execution, those menus should also never be created.

      Users who just don't want these ContextMenus can also do the following in a QML file and reuse that throughout their app:

      TextField {
          ContextMenu.menu: null
      }
      

      However, there are two issues I see with this:

      • The attached object is created regardless of whether the user actually uses ContextMenu. TextArea and TextField are controls that could potentially be created in large numbers, so this will result in increased memory usage (an extra QObject per control).
      • There is no convenient way to disable this with a global flag.

      If we make the currently private TextEditingContextMenu (name can be discussed) type public, we can create this from C++, as we do for ToolTip.

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change