govi1
18th July 2015, 04:00
I am trying to use QTest::keyClick to simulate key press for delegate item in a view.
But it seems I cannot simulate the operations below using qtest framework
QTest::keyClick(treeview_->focusWidget(), Qt::Key_Down);
QTest::keyClick(treeview_->focusWidget(), Qt::Key_Down);
QTest::keyClick(treeview_->focusWidget(), Qt::Key_Enter);
//after these code. the value of the cell should be 4.
These codes above works well, if I put them into a normal qt application.
But it doesn't work in qtest framework
I also tried mouseclick, but got the same issue.
My environment Qt5.5, ubuntu14.10
Attachment is the code to reproduce the issue. I made some changes base on the example of Qt5.5 : QT_DIR/Examples/Qt-5.5/widgets/itemviews/spinboxdelegate
1) after start spinboxdelegate, you can see that item(0,1) has changed to 4
2) running the test in "qt_test_not_work", it will fail.
11285
Thanks.
But it seems I cannot simulate the operations below using qtest framework
QTest::keyClick(treeview_->focusWidget(), Qt::Key_Down);
QTest::keyClick(treeview_->focusWidget(), Qt::Key_Down);
QTest::keyClick(treeview_->focusWidget(), Qt::Key_Enter);
//after these code. the value of the cell should be 4.
These codes above works well, if I put them into a normal qt application.
But it doesn't work in qtest framework
I also tried mouseclick, but got the same issue.
My environment Qt5.5, ubuntu14.10
Attachment is the code to reproduce the issue. I made some changes base on the example of Qt5.5 : QT_DIR/Examples/Qt-5.5/widgets/itemviews/spinboxdelegate
1) after start spinboxdelegate, you can see that item(0,1) has changed to 4
2) running the test in "qt_test_not_work", it will fail.
11285
Thanks.