pub unsafe fn load_unit_variants_colours_to_detailed_view(&self, index: Ref<QModelIndex>) {
        let data: HashMap<String, String> = serde_json::from_str(&index.data_1a(UNIT_DATA).to_string().to_std_string()).unwrap();
        let mut errors: Vec<String> = vec![];

        if !self.unit_variants_colours_widget.is_enabled() {
            self.unit_variants_colours_widget.set_enabled(true);
        }

        // Log in debug mode, for debugging.
        if cfg!(debug_assertions) {
            log::info!("{:#?}", data.iter().sorted_by_key(|x| x.0).collect::<std::collections::BTreeMap<&String, &String>>());
        }

        if let Err(error) = self.tool.load_definition_to_detailed_view_editor(&data, "unit_variants_colours", &UNIT_VARIANTS_COLOURS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }

        self.tool.load_field_to_detailed_view_editor_string_combo(&data, &self.unit_variants_colours_faction_combobox, "unit_variants_colours_faction");
        self.tool.load_field_to_detailed_view_editor_string_combo(&data, &self.unit_variants_colours_subculture_combobox, "unit_variants_colours_subculture");
        self.tool.load_field_to_detailed_view_editor_string_combo(&data, &self.unit_variants_colours_soldier_type_combobox, "unit_variants_colours_soldier_type");

        self.tool.load_fields_to_detailed_view_editor_combo_color_split(&data, &self.unit_variants_colours_primary_colour_combobox, "unit_variants_colours_primary_colour_r", "unit_variants_colours_primary_colour_g", "unit_variants_colours_primary_colour_b");
        self.tool.load_fields_to_detailed_view_editor_combo_color_split(&data, &self.unit_variants_colours_secondary_colour_combobox, "unit_variants_colours_secondary_colour_r", "unit_variants_colours_secondary_colour_g", "unit_variants_colours_secondary_colour_b");
        self.tool.load_fields_to_detailed_view_editor_combo_color_split(&data, &self.unit_variants_colours_tertiary_colour_combobox, "unit_variants_colours_tertiary_colour_r", "unit_variants_colours_tertiary_colour_g", "unit_variants_colours_tertiary_colour_b");

        // If we have any errors, show them here.
        if !errors.is_empty() {
            show_message_warning(&self.tool.message_widget, errors.join("\n"));
        }
    }
/// This function loads the data of a faction into the detailed view.
This function loads the data of a faction into the detailed view.
This function loads the data of a faction into the detailed view .
pub unsafe fn load_unit_variants_colours_to_detailed_view(&self, index: Ref<QModelIndex>) {
        let data: HashMap<String, String> = serde_json::from_str(&index.data_1a(UNIT_DATA).to_string().to_std_string()).unwrap();
        let mut errors: Vec<String> = vec![];
        if !self.unit_variants_colours_widget.is_enabled() {
            self.unit_variants_colours_widget.set_enabled(true);
        }
        // Log in debug mode, for debugging.
        if cfg!(debug_assertions) {
            log::info!("{:#?}", data.iter().sorted_by_key(|x| x.0).collect::<std::collections::BTreeMap<&String, &String>>());
        }
        if let Err(error) = self.tool.load_definition_to_detailed_view_editor(&data, "unit_variants_colours", &UNIT_VARIANTS_COLOURS_CUSTOM_FIELDS) {
            errors.push(error.to_string());
        }
        self.tool.load_field_to_detailed_view_editor_string_combo(&data, &self.unit_variants_colours_faction_combobox, "unit_variants_colours_faction");
        self.tool.load_field_to_detailed_view_editor_string_combo(&data, &self.unit_variants_colours_subculture_combobox, "unit_variants_colours_subculture");
        self.tool.load_field_to_detailed_view_editor_string_combo(&data, &self.unit_variants_colours_soldier_type_combobox, "unit_variants_colours_soldier_type");
        self.tool.load_fields_to_detailed_view_editor_combo_color_split(&data, &self.unit_variants_colours_primary_colour_combobox, "unit_variants_colours_primary_colour_r", "unit_variants_colours_primary_colour_g", "unit_variants_colours_primary_colour_b");
        self.tool.load_fields_to_detailed_view_editor_combo_color_split(&data, &self.unit_variants_colours_secondary_colour_combobox, "unit_variants_colours_secondary_colour_r", "unit_variants_colours_secondary_colour_g", "unit_variants_colours_secondary_colour_b");
        self.tool.load_fields_to_detailed_view_editor_combo_color_split(&data, &self.unit_variants_colours_tertiary_colour_combobox, "unit_variants_colours_tertiary_colour_r", "unit_variants_colours_tertiary_colour_g", "unit_variants_colours_tertiary_colour_b");
        // If we have any errors, show them here.
        if !errors.is_empty() {
            show_message_warning(&self.tool.message_widget, errors.join("\n"));
        }
    }
pub unsafe fn load_unit_variants_colours_to_detailed_view ( & self , index : Ref < QModelIndex > ) { let data : HashMap < String , String > = serde_json :: from_str ( & index . data_1a ( UNIT_DATA ) . to_string ( ) . to_std_string ( ) ) . unwrap ( ) ; let mut errors : Vec < String > = vec ! [ ] ; if ! self . unit_variants_colours_widget . is_enabled ( ) { self . unit_variants_colours_widget . set_enabled ( true ) ; } // Log in debug mode, for debugging. if cfg ! ( debug_assertions ) { log :: info ! ( " " data iter ( ) sorted_by_key ( x x 0 ) collect std collections BTreeMap String String ( ) ) ; } if let Err ( error ) = self . tool . load_definition_to_detailed_view_editor ( & data , " " , & UNIT_VARIANTS_COLOURS_CUSTOM_FIELDS ) { errors . push ( error . to_string ( ) ) ; } self . tool . load_field_to_detailed_view_editor_string_combo ( & data , & self . unit_variants_colours_faction_combobox , " " ) ; self . tool . load_field_to_detailed_view_editor_string_combo ( & data , & self . unit_variants_colours_subculture_combobox , " " ) ; self . tool . load_field_to_detailed_view_editor_string_combo ( & data , & self . unit_variants_colours_soldier_type_combobox , " " ) ; self . tool . load_fields_to_detailed_view_editor_combo_color_split ( & data , & self . unit_variants_colours_primary_colour_combobox , " " , " " , " " ) ; self . tool . load_fields_to_detailed_view_editor_combo_color_split ( & data , & self . unit_variants_colours_secondary_colour_combobox , " " , " " , " " ) ; self . tool . load_fields_to_detailed_view_editor_combo_color_split ( & data , & self . unit_variants_colours_tertiary_colour_combobox , " " , " " , " " ) ; // If we have any errors, show them here. if ! errors . is_empty ( ) { show_message_warning ( & self . tool . message_widget , errors . join ( " \n " ) ) ; } }
This function loads the data of a faction into the detailed view.
This function loads the data of a faction into the detailed view .
&self
index
Ref<QModelIndex>
&self
index
Ref<QModelIndex>