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

QTest::mouseClick() not clicked on QRadioButton

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.0 RC2
    • Testing: qtestlib
    • None
    • Qt 5.15, Qt Creator 4.13
    • Windows

    Description

       

      auto rb1 = f->findChild<QRadioButton *>("radioButton");
      QTest::mouseClick(rb1, Qt::LeftButton); 

      If rb1 has not been pressed earlier, then rb1->isChecked() return false.

      In the documentation for QTest::mouseClick() - The position of the click is defined by pos; the default position is the center of the widget.

      If I specify cursor position manualy:

      QTest::mouseClick(rb1, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(rb1->size().width()/2, rb1->size().height()/2)); 

      then it's all right.

       

      Attachments

        1. form.cpp
          0.4 kB
        2. form.h
          0.3 kB
        3. form.ui
          1 kB
        4. tst_megatest.cpp
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            macadder Jason McDonald
            dethwyn Dmitriy Snitsaruk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes