pub unsafe fn new_view(tips_widget: &Arc<QBox<QWidget>>, path: &[String]) -> Arc<Self> {

        let layout: QPtr<QGridLayout> = tips_widget.layout().static_downcast();
        let list = QListView::new_1a(tips_widget.as_ptr());
        let filter = QSortFilterProxyModel::new_1a(tips_widget.as_ptr());
        let model = QStandardItemModel::new_1a(tips_widget.as_ptr());
        let new_button = QPushButton::from_q_string_q_widget(&qtr("new_tip"), tips_widget.as_ptr());
        list.set_context_menu_policy(ContextMenuPolicy::CustomContextMenu);
        list.set_model(&filter);
        filter.set_source_model(&model);

        layout.add_widget_5a(&list, 0, 0, 1, 1);
        layout.add_widget_5a(&new_button, 1, 0, 1, 1);

        new_tips_item_delegate_safe(&list.static_upcast::<QObject>().as_ptr(), true);

        let context_menu = QMenu::from_q_widget(&list);
        let context_menu_edit = context_menu.add_action_q_string(&qtr("tip_edit"));
        let context_menu_delete = context_menu.add_action_q_string(&qtr("tip_delete"));
        let context_menu_publish = context_menu.add_action_q_string(&qtr("tip_publish"));

        context_menu_edit.set_enabled(false);
        context_menu_delete.set_enabled(false);
        context_menu_publish.set_enabled(false);

        let view = Arc::new(Self {
            path: Arc::new(RwLock::new(path.to_vec())),
            list,
            filter,
            model,
            new_button,
            context_menu,
            context_menu_edit,
            context_menu_delete,
            context_menu_publish
        });

        let slots = slots::TipSlots::new(&view);
        connections::set_connections(&view, &slots);

        if !path.is_empty() {
            view.load_data(path);
        }

        view
    }
/// This function creates a new TipsView, and sets up his slots and connections.
This function creates a new TipsView, and sets up his slots and connections.
This function creates a new TipsView and sets up his slots and connections .
pub unsafe fn new_view(tips_widget: &Arc<QBox<QWidget>>, path: &[String]) -> Arc<Self> {
        let layout: QPtr<QGridLayout> = tips_widget.layout().static_downcast();
        let list = QListView::new_1a(tips_widget.as_ptr());
        let filter = QSortFilterProxyModel::new_1a(tips_widget.as_ptr());
        let model = QStandardItemModel::new_1a(tips_widget.as_ptr());
        let new_button = QPushButton::from_q_string_q_widget(&qtr("new_tip"), tips_widget.as_ptr());
        list.set_context_menu_policy(ContextMenuPolicy::CustomContextMenu);
        list.set_model(&filter);
        filter.set_source_model(&model);
        layout.add_widget_5a(&list, 0, 0, 1, 1);
        layout.add_widget_5a(&new_button, 1, 0, 1, 1);
        new_tips_item_delegate_safe(&list.static_upcast::<QObject>().as_ptr(), true);
        let context_menu = QMenu::from_q_widget(&list);
        let context_menu_edit = context_menu.add_action_q_string(&qtr("tip_edit"));
        let context_menu_delete = context_menu.add_action_q_string(&qtr("tip_delete"));
        let context_menu_publish = context_menu.add_action_q_string(&qtr("tip_publish"));
        context_menu_edit.set_enabled(false);
        context_menu_delete.set_enabled(false);
        context_menu_publish.set_enabled(false);
        let view = Arc::new(Self {
            path: Arc::new(RwLock::new(path.to_vec())),
            list,
            filter,
            model,
            new_button,
            context_menu,
            context_menu_edit,
            context_menu_delete,
            context_menu_publish
        });
        let slots = slots::TipSlots::new(&view);
        connections::set_connections(&view, &slots);
        if !path.is_empty() {
            view.load_data(path);
        }
        view
    }
pub unsafe fn new_view ( tips_widget : & Arc < QBox < QWidget > > , path : & [ String ] ) -> Arc < Self > { let layout : QPtr < QGridLayout > = tips_widget . layout ( ) . static_downcast ( ) ; let list = QListView :: new_1a ( tips_widget . as_ptr ( ) ) ; let filter = QSortFilterProxyModel :: new_1a ( tips_widget . as_ptr ( ) ) ; let model = QStandardItemModel :: new_1a ( tips_widget . as_ptr ( ) ) ; let new_button = QPushButton :: from_q_string_q_widget ( & qtr ( " " ) , tips_widget . as_ptr ( ) ) ; list . set_context_menu_policy ( ContextMenuPolicy :: CustomContextMenu ) ; list . set_model ( & filter ) ; filter . set_source_model ( & model ) ; layout . add_widget_5a ( & list , 0 , 0 , 1 , 1 ) ; layout . add_widget_5a ( & new_button , 1 , 0 , 1 , 1 ) ; new_tips_item_delegate_safe ( & list . static_upcast :: < QObject > ( ) . as_ptr ( ) , true ) ; let context_menu = QMenu :: from_q_widget ( & list ) ; let context_menu_edit = context_menu . add_action_q_string ( & qtr ( " " ) ) ; let context_menu_delete = context_menu . add_action_q_string ( & qtr ( " " ) ) ; let context_menu_publish = context_menu . add_action_q_string ( & qtr ( " " ) ) ; context_menu_edit . set_enabled ( false ) ; context_menu_delete . set_enabled ( false ) ; context_menu_publish . set_enabled ( false ) ; let view = Arc :: new ( Self { path : Arc :: new ( RwLock :: new ( path . to_vec ( ) ) ) , list , filter , model , new_button , context_menu , context_menu_edit , context_menu_delete , context_menu_publish } ) ; let slots = slots :: TipSlots :: new ( & view ) ; connections :: set_connections ( & view , & slots ) ; if ! path . is_empty ( ) { view . load_data ( path ) ; } view }
This function creates a new TipsView, and sets up his slots and connections.
This function creates a new TipsView and sets up his slots and connections .
tips_widget
&Arc<QBox<QWidget>>
path
&[String]
tips_widget
&Arc<QBox<QWidget>>
path
&[String]