Communication within qml files using signals and slots

  • Hi

    I have two qml files naming Upcoming.qml, New_departure.qml, New_departureForm.ui.qml. I need to communicate between the Upcoming.qml and New_departure.qml. I have used the dynamic objects for the creation for communication and the code is working fine to get the mouse values of the upcoming.qml but the upcoming and new_departure qmls are overlapping witheach other my code is as follows


    Item {
        property var ambObj: null
        signal xy(var x);
        property var ambObj1: null
            onReleased: {
                var component = Qt.createComponent("New_departure_time.qml");
                if (component.status === Component.Ready)
                    ambObj = component.createObject(window_mode)
                var component_1 = Qt.createComponent("Clicked_image.qml");
                if (component_1.status === Component.Ready)
                    ambObj1 = component_1.createObject(item_highlight)
                console.log("Enter Sending")
                ambObj.close.connect( function(a) { ambObj.destroy(); ambObj1.destroy() } );


    Item {
        signal close(string cl);
        property var cmbObj: null
        id: new_departure_time_item;
        Info_popup {
            id: info_popup_item;
        Select_date {
            id: select_date_item;
        Charging_popup {
            id: charging_item;
        Notification_bar { 
            id: notify_bar;
            visible: false;
            x: 298;
            y: 0;
        Component.onCompleted: {
            var component = Qt.createComponent("Upcoming_days.qml");
            if (component.status === Component.Ready)
                cmbObj = component.createObject(new_departure_time_item);
            cmbObj.xy.connect( function (a) { console.log(a) } )

    [Edit: Added code tags -- @Wieland]

Log in to reply

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