Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Application stops when loosing focus



  • I have noticed that applications which do not need user interaction do stop running when they have no focus and continue when they get back focus. This is undesirable in these cases. How to keep a Qt application running without focus?


  • Lifetime Qt Champion

    hi
    on Android or what platform?



  • @mrjj On Desktop, Linux openSUSE 42.3, Qt 5.6.2, FVWM2 window manager.


  • Lifetime Qt Champion

    Hi @ck01,

    • what do you exactly mean with "stop running"?
    • can you provide a minimal example that exhibits that behavior?

    Thanks



  • @aha_1980 It would be quite some work to provide a minimum example, but I could try that. There is e.g. a Unix file system application which just has a GUI (simple table) to present the results. Even when this table is not displayed (it is an else window-less application) but some qt classes are constructed an destroyed qt stops processing at some point and starts again when it has focus again. In my example I leave X11 and switch to the virtual consoles with Ctrl+Meta+F1 (pure text consoles). When switch back after a long time there is little progress in the application. Is there some flag which can be set to tell Qt to not put the process in sleep mode when X11 is not displayed (but the virtual consoles instead)?


  • Lifetime Qt Champion

    Hi @ck01: I'm not aware of such a switch, and I don't think that's normal behavior. Normally you have to actually react on FocusOut to stop background operations, except on mobile OS like Android.

    To ask a different question: does it also happen if you stay in X11, but only minimize your app (or switch it to background)? I'm pretty sure going to text console is part of the problem. If it is really a but in Qt, a minimal example would nevertheless be needed to reproduce the behavior.

    Thanks



  • @aha_1980 It does seem to work when it is minimized only. This is somehow acceptable. So I mark this as solved though I would be interested in the switch-from-X11 solution...


Log in to reply