<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Communication within qml files using signals and slots]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">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</p>
<p dir="auto"><strong>Upcoming.qml</strong></p>
<pre><code>Item {
    id:upcoming_days_Delegate
    property var ambObj: null
    signal xy(var x);
    property var ambObj1: null
    MouseArea{
        id:mousearea;width:44;height:80;x:185;y:0;
        onReleased: {
            var component = Qt.createComponent("New_departure_time.qml");
            if (component.status === Component.Ready)
                ambObj = component.createObject(window_mode)
            ambObj.anchors.fill=window_mode;
            var component_1 = Qt.createComponent("Clicked_image.qml");
            if (component_1.status === Component.Ready)
                ambObj1 = component_1.createObject(item_highlight)
            ambObj1.x=mouse.x+162;ambObj1.y=15;
            xy(mouse.x+162);
            console.log("Enter Sending")
            ambObj.close.connect( function(a) { ambObj.destroy(); ambObj1.destroy() } );
        }
    }
}
</code></pre>
<p dir="auto"><strong>new_departure.qml</strong></p>
<pre><code>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) } )
    }
}
</code></pre>
<p dir="auto"><em>[Edit: Added code tags -- @Wieland]</em></p>
]]></description><link>https://forum.qt.io/topic/76771/communication-within-qml-files-using-signals-and-slots</link><generator>RSS for Node</generator><lastBuildDate>Sat, 02 May 2026 02:19:24 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/76771.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Mar 2017 09:18:37 GMT</pubDate><ttl>60</ttl></channel></rss>