Verifying that an item was polished is quite common in Qt's auto tests:
- The Qt Quick auto tests have a util function for it: http://code.qt.io/cgit/qt/qtdeclarative.git/tree/tests/auto/quick/shared/visualtestutil.h#n103
- git grep polishScheduled – tests/auto | wc -l says that there are 269 usages of polishScheduled in Qt Quick auto tests.
- QQuickTableView's auto tests have their own function: http://code.qt.io/cgit/qt/qtdeclarative.git/tree/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp?h=5.12#n81
- More recently, QQuickMenu started requiring it: https://codereview.qt-project.org/#/c/225747/23/tests/auto/shared/menuutil.h
Any user applications that simulate user interaction will also need this API if they don't want to use unreliable qWait() calls.
I propose adding some functions that can be used to ensure that an item has been polished (and in my case, is ready for mouse events). Then, client code could look something like this: