ui/qt/tree.cpp

changeset 69
419c8c3209e8
parent 66
8d490d97aab8
child 72
a00b46d92c54
equal deleted inserted replaced
68:bd9fb6476b80 69:419c8c3209e8
27 */ 27 */
28 28
29 #include "tree.h" 29 #include "tree.h"
30 #include "container.h" 30 #include "container.h"
31 31
32 #include <QTreeView>
33 #include <QTreeWidgetItem>
34
32 UIWIDGET ui_table_var(UiObject *obj, UiListPtr *list, UiModelInfo *modelinfo) { 35 UIWIDGET ui_table_var(UiObject *obj, UiListPtr *list, UiModelInfo *modelinfo) {
33 QTableView *view = new QTableView(); 36 QTreeView *view = new QTreeView();
34 TableModel *model = new TableModel(list, modelinfo); 37 TableModel *model = new TableModel(obj, view, list, modelinfo);
35 view->setModel(model); 38 view->setModel(model);
39
40 view->setItemsExpandable(false);
41 view->setRootIsDecorated(false);
42
43 view->setSelectionMode(QAbstractItemView::ExtendedSelection);
44 QItemSelectionModel *s = view->selectionModel();
45 QObject::connect(
46 s,
47 SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
48 model,
49 SLOT(selectionChanged(const QItemSelection &, const QItemSelection &)));
50 QObject::connect(
51 view,
52 SIGNAL(doubleClicked(const QModelIndex &)),
53 model,
54 SLOT(activate(const QModelIndex &)));
55
36 56
37 UiContainer *ct = uic_get_current_container(obj); 57 UiContainer *ct = uic_get_current_container(obj);
38 ct->add(view, true); 58 ct->add(view, true);
39 return view; 59 return view;
40 } 60 }

mercurial