Signal handler name clash

This warning category is spelled [signal-handler-name-clash] by qmllint.

Property is interpreted as a signal handler

What happened?

You declared a property whose name follows the on<Signal> pattern QML uses for signal handlers, and the object also has a member the handler could belong to: either a signal <signal> from the type itself or one of its base types, or a property <signal> declared in the same object.

Why is this bad?

The signal handler interpretation wins. Any binding to such a property, including the property's own initializer, is compiled as a signal handler rather than as a property binding. A literal initializer makes the component fail to load with Cannot assign a value to a signal (expecting a script to be run), and an expression initializer is silently run as a signal handler, leaving the property at its default value.

Example

 import QtQuick

 Item {
     property color primary: "green"
     property color onPrimary: "white" // not ok: read as a handler for "primary"

     signal accepted()
     property bool onAccepted: false   // not ok: read as a handler for the "accepted" signal
 }

To fix this warning, rename the properties so that they do not start with on followed by an upper-case letter:

 import QtQuick

 Item {
     property color primary: "green"
     property color textOnPrimary: "white"

     signal accepted()
     property bool acceptedState: false
 }