kcms/{mouse,touchpad}: Make "Apply" button work all the time
The (more or less identical) instantiations of QQuickWidget in the
libinput backends of Mouse and Touchpad KCMs are connecting the
QML file's changeSignal()
to the C++ class's onChange()
slot.
However, this does not work when the QQuickWidget hasn't yet
completed loading of the QML file. The signal doesn't yet exist.
As a result, when System Settings is started with kcm_mouse or
kcm_touchpad explicitly (e.g. via KRunner or CLI), onChange()
is
never called and the "Apply" button remains greyed out, even if
changes are made in the UI.
The fix is to connect QQuickWidget::rootObject()
only once the
QQuickWidget itself has signaled its readiness, via statusChanged()
.
Connecting statusChanged()
is done before setSource()
is called,
to eliminate any concerns about when readiness is reached.
(It could be ready immediately if the resource was already loaded!)