Important: Please read the Qt Code of Conduct -

Override onPropertyChanged in inherited

  • Hi all,

    I have a specialized SpinBox in a .qml in which I implemented a default onValueModified:

    # MySpinBox.qml
    SpinBox {
      onValueModified: { print("modified in Base") }

    Now I use this in my QML:

    MySpinBox  {
      onValueModified: { print("modified in inherited") }

    My problem is that I get the two messages printed. I thought that "on property changed" will be overriden in the inherited class. This happens like this for functions.

    How can I manage so that only the code in the inherited implementation will be executed ?

    Thank you

  • @dextermagnific said in Override onPropertyChanged in inherited:


    • Can you please tell me why you want to call valueModified() signal from SpinBox { } when you can directly use it from MySpinBox { } ?

    To avoid your problem you can define your own signal and use it.


    SpinBox {
        id: root
        signal valueChanged()
        onValueModified: {

    And in main.qml just use onValueChanged

        MySpinBox {
            onValueChanged: {
                console.log("Value :: ", value)

Log in to reply