Solved QML - How to stop app from grabbing focus at startup
-
How can an QML app completely avoid grabbing focus at startup?
I want to run an app with qmlscene which displays its window but does not grab focus. In other words, keyboard and mouse stay focused on the (unrelated) window where they were before the app started (either by that other app, or a background activity).
For example, to display a notifications without forcing the user to respond immediately.
To get specific, how should the following be changed so that the Linux command
qmlscene file.qml &
does not take focus away from the terminal?
import QtQuick 2.12 import QtQuick.Controls 2.12 ApplicationWindow { visible:true Text{ text: "Take care of this later" } }
-
@jimav
untested, but try the following:ApplicationWindow { flags: Qt.Tool // or flags: Qt.Window | Qt.WindowDoesNotAcceptFocus }
Unfortunately the window flags are not supported the same on every platform.
-
@raven-worx flags works great, thanks.