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

QTextEdit and QPlainTextEdit should open the context menu regardless of its focus policy.

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.5.1, 5.9.2
    • None
    • ArchLinux
      qt-base 5.9.2

      Ubuntu 16.04
      qt-base 5.5.1

    Description

      First of all, I'm sorry if my English is hard to understand.

      Currently, QWidgetTextControlPrivate::contextMenuEvent() checks its focus state and immediately returns if it is not focused.
      https://github.com/qt/qtbase/blob/c4cf90b1f739c47383672de3d66b1d9d5427f5db/src/widgets/widgets/qwidgettextcontrol.cpp#L1887

      As a result, if the focus policy of these widgets(QTextEdit and QPlainTextEdit) is set to Qt::NoFocus, the context menu will not be displayed.
      Other widgets like QLineEdit will display a context menu like Copy/SelectAll regardless of its focus policy.

      If I remove this check, it works like QLineEdit as I expected.
      Is there any adverse effect when removing this check?
       

      Attachments

        1. test.cc
          2 kB
        2. test.pro
          0.0 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              richard Richard Moe Gustavsen
              tyamada taro yamada
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes