onEnabledChanged in Connections object
-
Having just upgraded to Qt 5.15, I am faced with a bunch of warnings about how my connections are defined in my
Connections
objects:... QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
Fair enough - I have seen this before when trying out my code in newer versions of Qt than I was officially using at the time. I therefore changed:
Connections { target: control onEnabledChanged: { ... } }
to
Connections { target: control function onEnabledChanged() { ... } }
But now I get an error:
... Duplicate method name: invalid override of property change signal or superclass signal
The reason being, I presume, that
Connections
has its ownenabled
property and anonEnabledChanged
function is defined on it.How do I resolve this?
-
Having just upgraded to Qt 5.15, I am faced with a bunch of warnings about how my connections are defined in my
Connections
objects:... QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
Fair enough - I have seen this before when trying out my code in newer versions of Qt than I was officially using at the time. I therefore changed:
Connections { target: control onEnabledChanged: { ... } }
to
Connections { target: control function onEnabledChanged() { ... } }
But now I get an error:
... Duplicate method name: invalid override of property change signal or superclass signal
The reason being, I presume, that
Connections
has its ownenabled
property and anonEnabledChanged
function is defined on it.How do I resolve this?
Found it in this bug report: https://bugreports.qt.io/browse/QTBUG-84746
It seems that the "fix" is to define a
property alias
toenabled
in the target component. Not nice, but it seems to work.I'll leave this for a while before marking as solved to see if there are any better solutions.
-