pub unsafe fn load_clone_colour_variant_dialog(&self) -> Result<()> {
        let source_selection = self.unit_variants_colours_list_view.selection_model().selection();
        let source_indexes = source_selection.indexes();

        if source_indexes.is_empty() {
            return Err(ErrorKind::GenericHTMLError("No colour variant selected".to_string()).into());
        }

        let source_model_index = self.unit_variants_colours_list_filter.map_to_source(source_indexes.at(0));
        self.new_colour_variant_button_box.button(q_dialog_button_box::StandardButton::Ok).set_enabled(false);

        let dialog: QPtr<QDialog> = self.new_colour_variant_widget.static_downcast();
        if dialog.exec() == 1 {

            // Save the source colour variant.
            self.save_unit_variants_colours_from_detailed_view(source_model_index.as_ref());

            // Clone the source colour variant, updating its relevant keys in the process.
            let new_colour_variant_name = self.new_colour_variant_name_combobox.current_text();
            let new_item = (*self.unit_variants_colours_list_model.item_from_index(source_model_index.as_ref())).clone();
            new_item.set_text(&new_colour_variant_name);

            // Perform the needed edits to the data, so it uses the new faction key.
            //let mut data: HashMap<String, String> = serde_json::from_str(&new_item.data_1a(UNIT_DATA).to_string().to_std_string()).unwrap();
            //new_item.set_data_2a(&QVariant::from_q_string(&QString::from_std_str(&serde_json::to_string(&data).unwrap())), UNIT_DATA);

            // Append the new item.
            self.unit_variants_colours_list_model.append_row_q_standard_item(new_item);
        }

        Ok(())
    }
/// Function to load the `Clone Colour Variant` dialog.
Function to load the `Clone Colour Variant` dialog.
Function to load the ` Clone Colour Variant ` dialog .
pub unsafe fn load_clone_colour_variant_dialog(&self) -> Result<()> {
        let source_selection = self.unit_variants_colours_list_view.selection_model().selection();
        let source_indexes = source_selection.indexes();
        if source_indexes.is_empty() {
            return Err(ErrorKind::GenericHTMLError("No colour variant selected".to_string()).into());
        }
        let source_model_index = self.unit_variants_colours_list_filter.map_to_source(source_indexes.at(0));
        self.new_colour_variant_button_box.button(q_dialog_button_box::StandardButton::Ok).set_enabled(false);
        let dialog: QPtr<QDialog> = self.new_colour_variant_widget.static_downcast();
        if dialog.exec() == 1 {
            // Save the source colour variant.
            self.save_unit_variants_colours_from_detailed_view(source_model_index.as_ref());
            // Clone the source colour variant, updating its relevant keys in the process.
            let new_colour_variant_name = self.new_colour_variant_name_combobox.current_text();
            let new_item = (*self.unit_variants_colours_list_model.item_from_index(source_model_index.as_ref())).clone();
            new_item.set_text(&new_colour_variant_name);
            // Perform the needed edits to the data, so it uses the new faction key.
            //let mut data: HashMap<String, String> = serde_json::from_str(&new_item.data_1a(UNIT_DATA).to_string().to_std_string()).unwrap();
            //new_item.set_data_2a(&QVariant::from_q_string(&QString::from_std_str(&serde_json::to_string(&data).unwrap())), UNIT_DATA);
            // Append the new item.
            self.unit_variants_colours_list_model.append_row_q_standard_item(new_item);
        }
        Ok(())
    }
pub unsafe fn load_clone_colour_variant_dialog ( & self ) -> Result < ( ) > { let source_selection = self . unit_variants_colours_list_view . selection_model ( ) . selection ( ) ; let source_indexes = source_selection . indexes ( ) ; if source_indexes . is_empty ( ) { return Err ( ErrorKind :: GenericHTMLError ( " " . to_string ( ) ) . into ( ) ) ; } let source_model_index = self . unit_variants_colours_list_filter . map_to_source ( source_indexes . at ( 0 ) ) ; self . new_colour_variant_button_box . button ( q_dialog_button_box :: StandardButton :: Ok ) . set_enabled ( false ) ; let dialog : QPtr < QDialog > = self . new_colour_variant_widget . static_downcast ( ) ; if dialog . exec ( ) == 1 { // Save the source colour variant. self . save_unit_variants_colours_from_detailed_view ( source_model_index . as_ref ( ) ) ; // Clone the source colour variant, updating its relevant keys in the process. let new_colour_variant_name = self . new_colour_variant_name_combobox . current_text ( ) ; let new_item = ( * self . unit_variants_colours_list_model . item_from_index ( source_model_index . as_ref ( ) ) ) . clone ( ) ; new_item . set_text ( & new_colour_variant_name ) ; // Perform the needed edits to the data, so it uses the new faction key. //let mut data: HashMap<String, String> = serde_json::from_str(&new_item.data_1a(UNIT_DATA).to_string().to_std_string()).unwrap(); //new_item.set_data_2a(&QVariant::from_q_string(&QString::from_std_str(&serde_json::to_string(&data).unwrap())), UNIT_DATA); // Append the new item. self . unit_variants_colours_list_model . append_row_q_standard_item ( new_item ) ; } Ok ( ( ) ) }
Function to load the `Clone Colour Variant` dialog.
Function to load the ` Clone Colour Variant ` dialog .
&self
&self