Alias method in QML component

  • I am writing a component like so:

    import QtQuick 2.0
    import NDDQuickItem 1.0
    Item {
      property alias source: ndd.nddContentPath
      function goToSlide(component,slide){ ndd.goToSlide(component,slide) }
      NDDQuickItem {
        id: ndd
        width:parent.width; height:parent.height

    I can use property alias to "promote" properties of the NDDQuickItem to the root of the component. However, as shown, I'm currently writing global methods that just re-call a method on the NDDQuickItem.

    Is there an equivalent to property alias that works for methods? Something like:

    method alias goToSlide: ndd.goToSlide # not valid QML


    goToSlide = ndd.goToSlide             # not valid QML

  • Lifetime Qt Champion


    AFAIK, there's no such feature. You can check the bug report system to see if there's already something about it.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.