pub unsafe fn load_add_colour_variant_dialog(&self) -> Result<()> {
        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 whatever is selected. Do it through selection to avoid double saving breaking things.
            self.unit_variants_colours_list_view.selection_model().select_q_item_selection_q_flags_selection_flag(&self.unit_variants_colours_list_view.selection_model().selection(), SelectionFlag::Toggle.into());

            // 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 = QStandardItem::from_q_string(&new_colour_variant_name).into_ptr();

            // Perform the needed edits to the data, so it uses the new faction key.
            let mut data: HashMap<String, String> = HashMap::new();

            let unit_variants_colours_definition = Tool::get_table_definition("unit_variants_colours_tables")?;
            data.insert("unit_variants_colours_definition".to_owned(), serde_json::to_string(&unit_variants_colours_definition).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 `Add Colour Variant` dialog.
Function to load the `Add Colour Variant` dialog.
Function to load the ` Add Colour Variant ` dialog .
pub unsafe fn load_add_colour_variant_dialog(&self) -> Result<()> {
        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 whatever is selected. Do it through selection to avoid double saving breaking things.
            self.unit_variants_colours_list_view.selection_model().select_q_item_selection_q_flags_selection_flag(&self.unit_variants_colours_list_view.selection_model().selection(), SelectionFlag::Toggle.into());
            // 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 = QStandardItem::from_q_string(&new_colour_variant_name).into_ptr();
            // Perform the needed edits to the data, so it uses the new faction key.
            let mut data: HashMap<String, String> = HashMap::new();
            let unit_variants_colours_definition = Tool::get_table_definition("unit_variants_colours_tables")?;
            data.insert("unit_variants_colours_definition".to_owned(), serde_json::to_string(&unit_variants_colours_definition).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_add_colour_variant_dialog ( & self ) -> Result < ( ) > { 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 whatever is selected. Do it through selection to avoid double saving breaking things. self . unit_variants_colours_list_view . selection_model ( ) . select_q_item_selection_q_flags_selection_flag ( & self . unit_variants_colours_list_view . selection_model ( ) . selection ( ) , SelectionFlag :: Toggle . into ( ) ) ; // 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 = QStandardItem :: from_q_string ( & new_colour_variant_name ) . into_ptr ( ) ; // Perform the needed edits to the data, so it uses the new faction key. let mut data : HashMap < String , String > = HashMap :: new ( ) ; let unit_variants_colours_definition = Tool :: get_table_definition ( " " ) ? ; data . insert ( " " . to_owned ( ) , serde_json :: to_string ( & unit_variants_colours_definition ) . 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 `Add Colour Variant` dialog.
Function to load the ` Add Colour Variant ` dialog .
&self
&self