Something like https://codereview.qt-project.org/#/c/89178/:
This is useful to automatically detect warnings that
should not occur, as there is often no way to do so if no state is
changed as a result of the problem the warning is alerting us to.
For warnings that should occur, QTest::ignoreMessage() can still be
used as previously.
The feature is especially useful in QML, where it's not possible to
fail on warnings.