Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Communication within qml files using signals and slots

Communication within qml files using signals and slots

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 414 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Belluri Uthej Reddy
    wrote on last edited by A Former User
    #1

    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

    Upcoming.qml

    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() } );
            }
        }
    }
    

    new_departure.qml

    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]

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved