Python - User Activity Versus Inactivity Timer

I have been doing my best to bypass my QThread issues that came with Krita 5 and the only way I can think of is to kinda guess an inactivity moment from the part of the user to do a sneeky update.

Still am gonna do that report soon I don’t get what changed with Qthread but it is still the same Qt version so I imagine it is a bug.

So the concept idea I had is as follows:
1- Detect Mouse and or Tablet Press or Release if inside the Canvas if not it would report Inactive work load.
2- Detect the amount of time it is in that state.

The basic idea is if the user is a long time inactive it is not 0.5 seconds of calculations once that will disturb the peace.

So doing a request question to Krita would be something like:
activity = krita.Instance().user()

Returnning something like:
activity = [mouse_release, 245]
activity = [mouse_press, 462]
activity = [tablet_press, 21]
activity = [tablet_release, 234]
activity = [menu, 65]

Knowing more would not be bad also as it helps to make code lighter with less heavy interactions.

This because one thing is pressing in for a long time and another is to make a lot of quick presses. They are both the same action but if I don’t know how they are weighted with signals. I can be just be favouring quick presses or in opposition long presses. Mouse move counts signals not time per example.

As an alternative method to ask the same question would be to request the mouse press time and see what was the status for it if it was being pressed.

The bug report:
https://bugs.kde.org/show_bug.cgi?id=441956

Reason why I started imagining this odd work around for the lack of a working QThread but the available workarounds are too Hacky and way too Glitchy to work as a viable solution. Signals are dropped and if the canvas is changed it all has to be reset. This ultimately causes Krita to crash tons of times just by closing a document or after changing focus into another application…

If QThread worked again like in krita 4.4.5 it would be nice but knowing how active the user is would still be nice regardless as it would help lowering the weight of scripts that keep running.

minimal working example: