Details
Description
After starting a QOrientationSensor, the event queue is inundated with timer events, to the point where any calls to processEvents will simply hang until the timeout.
To compound this problem there is a QOrientationSensor created for each QWebFrame which cannot be stopped or otherwise controled. Any calls to QWebPage::mainFrame will create a QWebFrame and thus a QOrientationSensor.
Aside from causing processEvents to freeze, this has performance and battery life implications.
#include <QtWidgets/QApplication> #include <QtWebKitWidgets/QWebView> #include <QtSensors/QOrientationSensor> class myapp : public QApplication { public: myapp(int& argc, char** argv, int f = ApplicationFlags) : QApplication(argc, argv, f) {} virtual bool notify(QObject* o, QEvent* e) { fprintf(stderr, "%s, %d\n", o->metaObject()->className(), e->type()); return QApplication::notify(o, e); } }; int main(int argc, char** argv) { myapp app(argc, argv); #if 1 QWebView view; view.page()->mainFrame(); view.show(); #else QWidget w; QOrientationSensor *s = new QOrientationSensor; s->start(); w.show(); #endif app.exec(); }