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

Wrong mouse click behavior for QWidget

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Not Evaluated
    • None
    • 5.0.0
    • None
    • Windows 7 MSVC2010/ Ubuntu11.10
    • 3bb902495291c50a2f06e8e03a62a647db3e5cd4 (6.3.2012)

    Description

      When click on an widget, this widget often can not receive mouse release event.

      Following code can be used to reproduce this problem.

      #include <QtWidgets/QtWidgets>
      
      class Button:public QPushButton
      {
      public:
          explicit Button():QPushButton("Press Me!"){}
      
      protected:
          void mousePressEvent(QMouseEvent *e)
          {
              qDebug("press");
              QPushButton::mousePressEvent(e);
          }
          void mouseReleaseEvent(QMouseEvent *e)
          {
              qDebug("release");
              QPushButton::mouseReleaseEvent(e);
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          Button btn;
          btn.show();
          return a.exec();
      }
      

      The result will be

      press
      release
      press
      press
      release
      press
      press
      release
      press
      press
      release
      

      This problem caused by the way which is used to deal with mouse double click and mouse press.

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              dbzhang800 debao zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes