00001 #ifndef _TREESCREEN_H_ 00002 #define _TREESCREEN_H_ 00003 00004 #include <QtGlobal> 00005 #include <QWidget> 00006 #include <QListView> 00007 #include <QToolButton> 00008 #include <QHBoxLayout> 00009 #include <QVBoxLayout> 00010 #include <QTreeView> 00011 #include <QToolBar> 00012 #include <QInputDialog> 00013 00014 #include "knowtreemodel.h" 00015 00016 class treescreen : public QWidget 00017 { 00018 Q_OBJECT 00019 00020 public: 00021 treescreen(QWidget *parent=0); 00022 virtual ~treescreen(); 00023 00024 knowtreemodel *kntrmodel; 00025 00026 void save_knowtree(void); 00027 00028 void update_selected_branch(void); 00029 00030 int get_first_selected_item_index(void); 00031 QModelIndex get_current_item_index(void); 00032 00033 QItemSelectionModel *get_selection_model(void); 00034 00035 // Установка курсора на указанный элемент 00036 void set_cursor_to_index(QModelIndex index); 00037 00038 private slots: 00039 void expand_all_subbranch(void); 00040 void collapse_all_subbranch(void); 00041 void expand_or_collapse_recurse(QModelIndex index,bool mode); 00042 void ins_subbranch(void); 00043 void ins_branch(void); 00044 void edit_branch(void); 00045 void del_branch(void); 00046 void move_up_branch(void); 00047 void move_dn_branch(void); 00048 00049 // Действия при клике на ветку дерева 00050 void on_knowtree_clicked(const QModelIndex &index); 00051 00052 // Открытие контекстного меню 00053 void on_customContextMenuRequested(const QPoint &pos); 00054 00055 private: 00056 QToolBar *tools_line; 00057 00058 QTreeView *knowtree; 00059 00060 QVBoxLayout *treescreen_layout; 00061 00062 QAction *action_expand_all_subbranch; 00063 QAction *action_collapse_all_subbranch; 00064 QAction *action_ins_branch; 00065 QAction *action_ins_subbranch; 00066 QAction *action_edit_branch; 00067 QAction *action_del_branch; 00068 QAction *action_move_up_branch; 00069 QAction *action_move_dn_branch; 00070 00071 void setup_ui(void); 00072 void setup_signals(void); 00073 void setup_actions(void); 00074 void assembly(void); 00075 00076 void init_knowtree(void); 00077 00078 void insert_new_branch(void); 00079 00080 void move_updn_branch(int direction); 00081 bool move_check_enable(void); 00082 00083 }; 00084 00085 00086 #endif // _TREESCREEN_H_ 00087