Home > Software engineering >  Qt/QML Windows App very slow when grammarly app is running
Qt/QML Windows App very slow when grammarly app is running

Time:01-14

We are developing a large Qt/QML Application and recently experienced an interesting issue: The application is unusable slow if "grammarly" is installed. Grammarly seems to use Windows Accessibilty and tries to "read" or process our apps screen. This makes it unusable slow.

Everything works fine if grammarly is closed before starting our app.

Is there a way to fix this in our app? I tried setting"QT_ACCESSIBILITY=0" in the environment, but this did not help.

Do I have rebuild Qt by my own to disable this?

BTW: We are using Qt 5.15.2 opensource.

I anyone wants to try this out:

Grammarly: https://www.grammarly.com/desktop

App "Oxygen": https://ccc.dewetron.com/dl/634d2acf-ff00-457c-ae48-4e56d9c49a3c

Thanks for your answers.

CodePudding user response:

When Qt discovers that an accessibility client is running, then it generates a stream of notifications for those accessibility clients. This does introduce overhead. Some of that overhead might be substantial, as data structures in the application or Qt need to be mapped to a "tree of indexed objects" structure that accessibility frameworks usually operate on.

By disabling this entire machinery via no-op handlers, your application is now no longer accessible. And if grammarly indeed uses accessibility infrastructure to access data in the application, then it will probably also become less useful.

Perhaps there are things that can be optimized in Qt so that accessibility being enabled doesn't result in such a high load. For that to happen, please report a bug to the Qt project and include a reproducer that is representative of what your applications is doing.

https://wiki.qt.io/Reporting_Bugs

CodePudding user response:

I found a working solution for our problem. Install custom empty handler for updates and the QObject root object:

void DummyUpdateHandler(QAccessibleEvent* event)
{
}

void DummyRootObjectHandler(QObject*)
{
}

void initQML(QQuickView* view)
{
#ifdef WIN32 
        QAccessible::installUpdateHandler(DummyUpdateHandler);
        QAccessible::installRootObjectHandler(DummyRootObjectHandler);
#endif
        view->setSource(qml_file);
} 

The application is no longer slowed down by grammarly or other accessibility tools.

bye Gunther

  • Related