Tour Preview

Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › ReferenceError In QMl Signal/Slot

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21680

    George kuria

    Hi,

    i have been having a ReferenceError problem where for the variable  “requestIDs” on all functions connected to the signal yet i have used the same principal in another page and the   “requestIDs” for the VPage is refrenced okay. Any one who has suggestions on how to solve the problem? Global is a singleton item VPage is modified felgo Page added some properties i.e requestIDs and functions. The code is down below: (This error occurrs even if i refrence by id i.e (page.requestIDs[0]))

    import Felgo 3.0
    import QtQuick 2.0
    import Global 1.0
    import "../components"
    
    VPage
    {
        id:page
        title:qsTr("Select Type Of Record")+translation.language
        sectionName: "SelectCorrectiveLinkedRecordDetailsPage"
        maximumRequestIDs: 1
    
        property string requestID
        property string facility_name_info
        property int facility_id_info
        property string corrective_type_info
        property int corrective_unique_id_info
    
        onPushed:
        {
            page.forceActiveFocus()
    
            selectPageType()
        }
    
        onReturnFocus:
        {
            page.forceActiveFocus()
    
            if(corrective_unique_id_info===0)
            {
                navigationStack.pop()
            }
        }
    
        onBackKeyPressed:
        {
            navigationStack.pop()
        }
    
        Component.onCompleted:
        {
            Global.behavioralObservationSelected.connect(behavioralObservationSelected)
            Global.contractorSelected.connect(contractorSelected)
            Global.chemicalSubstanceSpillSelected(chemicalSubstanceSpillSelected)
            Global.inspectionSelected.connect(inspectionSelected)
            Global.auditSelected.connect(auditSelected)
            Global.incidentSelected.connect(incidentSelected)
        }
    
        function behavioralObservationSelected(requestID,behavioral_observation_id,facility_name,facility_id,checklist_id,checklist_unique_id,checklist_name,person_type_id,person_type,person_type_name,work_observed_name,work_observed_location,work_observed_id,date_observed,time_observed,behavior_changed_during_observation)
        {
            console.log(requestID)
            console.log(requestIDs[0])
    
            if(requestID===requestIDs[0])
            {
                corrective_unique_id_info=behavioral_observation_id
    
                Global.correctiveLinkedRecordSelected(page.requestID,behavioral_observation_id)
    
                popTimer.start()
            }
        }
    
        function inspectionSelected(requestID,inspection_id,facility_name,facility_id,checklist_id,checklist_unique_id,checklist_name,person_type_id,person_type,person_type_name,facility_department_name,facility_department_id,date_inspected,time_inspected)
        {
            if(requestID===requestIDs[0])
            {
                corrective_unique_id_info=inspection_id
    
                Global.correctiveLinkedRecordSelected(page.requestID,inspection_id)
    
                popTimer.start()
            }
        }
    
        function auditSelected(requestID,audit_id,facility_name,facility_id,checklist_id,checklist_unique_id,checklist_name,person_type_id,person_type,person_type_name,audit_type,audit_date,audit_time)
        {
            if(requestID===requestIDs[0])
            {
                corrective_unique_id_info=audit_id
    
                Global.correctiveLinkedRecordSelected(page.requestID,audit_id)
    
                popTimer.start()
            }
        }
    
        function incidentSelected(requestID,incident_id,facility_id,facility_name,human_influence_details,substandard_action_details,substandard_condition_details,undesired_contact_details,job_influence_details,is_environmental_incident,incident_type_name,incident_type_id,facility_department_name,facility_department_id,person_type_name,person_type_id,person_type,capacity_in_filling_form,incident_person_performing_task,incident_description,exact_incident_location,incident_date,incident_time,immediate_action_taken,anyone_took_immediate_action,environmental_incident_nature_of_occurrence_details,incident_category_details,asset_details,no_of_injuries)
        {
            if(requestID===requestIDs[0])
            {
                corrective_unique_id_info=incident_id
    
                Global.correctiveLinkedRecordSelected(page.requestID,incident_id)
    
                popTimer.start()
            }
        }
    
        function chemicalSubstanceSpillSelected(requestID,chemical_substance_spill_id,chemical_substance_id,facility_name,facility_id,person_type_name,person_type_id,person_type,spill_location,spill_value,spill_unit,spill_date,remarks)
        {
            if(requestID===requestIDs[0])
            {
                corrective_unique_id_info=chemical_substance_spill_id
    
                Global.correctiveLinkedRecordSelected(page.requestID,chemical_substance_spill_id)
    
                popTimer.start()
            }
        }
    
        function contractorSelected(requestID,contractor_id,facility_id,facility_name,contractor_name,contractor_status,contractor_type,contractor_website,contractor_description)
        {
            if(requestID===requestIDs[0])
            {
                corrective_unique_id_info=contractor_id
    
                Global.correctiveLinkedRecordSelected(page.requestID,contractor_id)
    
                popTimer.start()
            }
        }
    
    
        Timer
        {
            id:popTimer
            interval: 500
            running: false
            repeat: false
            onTriggered: navigationStack.pop()
        }
    
        rightBarItem: NavigationBarRow
        {
            IconButtonBarItem
            {
                icon: IconType.infocircle
                showItem: showItemAlways
    
                onClicked:
                {
                    navigationStack.push(Qt.resolvedUrl("../pages/HelpPage.qml"),{page_index_info:sectionName})
                }
            }
        }
    
        function selectPageType()
        {
            if(corrective_type_info=='behavioral')
            {
                navigationStack.push(Qt.resolvedUrl("SelectBehavioralPage.qml"),{requestID:requestIDs[0],facility_id_info:facility_id_info,facility_name_info:facility_name_info,allowSelectionFromOtherFacilities:true})
            }
            else if(corrective_type_info=='contractor')
            {
                navigationStack.push(Qt.resolvedUrl("SelectFacilityContractorPage.qml"),{requestID:requestIDs[0],facility_id_info:facility_id_info,facility_name_info:facility_name_info,allowSelectionFromOtherFacilities:true})
            }
            else if(corrective_type_info=='contractor-project')
            {
                navigationStack.push(Qt.resolvedUrl("SelectContractorProjectObservationPage.qml"),{requestID:requestIDs[0],facility_id_info:facility_id_info,facility_name_info:facility_name_info,allowSelectionFromOtherFacilities:true})
            }
            else if(corrective_type_info=='inspection')
            {
                navigationStack.push(Qt.resolvedUrl("SelectInspectionPage.qml"),{requestID:requestIDs[0],facility_id_info:facility_id_info,facility_name_info:facility_name_info,allowSelectionFromOtherFacilities:true})
            }
            else if(corrective_type_info=='chemical-substance-spill')
            {
                navigationStack.push(Qt.resolvedUrl("SelectChemicalSpillPage.qml"),{requestID:requestIDs[0],facility_id_info:facility_id_info,facility_name_info:facility_name_info,allowSelectionFromOtherFacilities:true})
            }
            else if(corrective_type_info=='environmental-audit')
            {
                navigationStack.push(Qt.resolvedUrl("SelectAuditPage.qml"),{requestID:requestIDs[0],facility_id_info:facility_id_info,facility_name_info:facility_name_info,allowSelectionFromOtherFacilities:true,audit_type_info:'environmental',title:qsTr("Select Environmental Audit")+translation.language})
            }
            else if(corrective_type_info=='health-and-safety-audit')
            {
                navigationStack.push(Qt.resolvedUrl("SelectAuditPage.qml"),{requestID:requestIDs[0],facility_id_info:facility_id_info,facility_name_info:facility_name_info,allowSelectionFromOtherFacilities:true,audit_type_info:'health-and-safety',title:qsTr("Select Health & Safety Audit")+translation.language})
            }
            else if(corrective_type_info=='fire-safety-audit')
            {
                navigationStack.push(Qt.resolvedUrl("SelectAuditPage.qml"),{requestID:requestIDs[0],facility_id_info:facility_id_info,facility_name_info:facility_name_info,allowSelectionFromOtherFacilities:true,audit_type_info:'fire-safety',title:qsTr("Select Fire Safety Audit")+translation.language})
            }
            else if(corrective_type_info=='incident')
            {
                navigationStack.push(Qt.resolvedUrl("SelectIncidentPage.qml"),{requestID:requestIDs[0],facility_id_info:facility_id_info,facility_name_info:facility_name_info,allowSelectionFromOtherFacilities:true})
            }
            else
            {
                navigationStack.pop()
            }
        }
    }
    

     

    #21698

    Günther
    Felgo Team

    Hi,

    The requestIDs property is not part of the page you posted above, it only has a maximumRequestIDs and a requestID property.

    Best,

    Günther

    #21762

    George kuria

    requestIDs Is a property defined in VPage

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.