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

QTextEdit has mouse tracking enabled since Qt 5.14

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 5.14.0
    • None
    • Arch Linux qt5-base 5.14.0-1 (currently in the [testing] repository)
    • Linux/Wayland, Linux/X11

    Description

      Since Qt 5.14, mouse tracking is enabled by default for QTextEdit. This was not the case in Qt 5.13 and is in contradiction to the QWidget class documentation, which states that disabled mouse tracking is the default.

      The issue can be reproduced with the following minimal example:

      #include <QApplication>
      #include <QTextEdit>
      
      class MyTextEdit : public QTextEdit
      {
           public:
                MyTextEdit();
                void mouseMoveEvent(QMouseEvent *e);
      };
      
      MyTextEdit::MyTextEdit()
      {
           //setMouseTracking(false);
      }
      
      void MyTextEdit::mouseMoveEvent(QMouseEvent *e)
      {
           this->append("mouseMoveEvent");
      }
      
      int main(int argc, char **argv)
      {
           QApplication app(argc, argv);
           MyTextEdit myEdit;
           myEdit.show();
           return app.exec();
      }
      

      In Qt 5.14, moving the mouse pointer over the text field without pressing any mouse button will start spamming "mouseMoveEvent". In Qt 5.13 the text field will remain empty unless a mouse button is pressed while moving the mouse.

      Uncommenting "setMouseTracking(false)" in the constructor restores the expected behaviour on Qt 5.14, but should not be necessary according to the documentation.

      Attachments

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

        Activity

          People

            srutledg Shawn Rutledge
            diabonas Jonas Witschel
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes