1 #include "treeeditor.h"
11 ///////////////////////////////////////////////////////////////////////
12 ///////////////////////////////////////////////////////////////////////
13 TreeEditor::TreeEditor(VymModel *m)
17 // FIXME-2 use proxmodel
18 //proxyModel = new MySortFilterProxyModel(this);
19 //setModel(proxyModel);
21 //proxyModel->setSourceModel(model);
24 // Shortcuts for navigating with cursor:
25 a = new QAction(tr( "Select upper object","Tree Editor" ), this);
26 a->setStatusTip ( tr( "Select upper object" ));
27 a->setShortcut (Qt::Key_Up );
28 a->setShortcutContext (Qt::WidgetShortcut);
30 connect( a, SIGNAL( triggered() ), this, SLOT( cursorUp() ) );
32 a = new QAction( tr( "Select lower object","Tree Editor" ),this);
33 a->setStatusTip (tr( "Select lower object" ));
34 a->setShortcut ( Qt::Key_Down );
35 a->setShortcutContext (Qt::WidgetShortcut);
37 connect( a, SIGNAL( triggered() ), this, SLOT( cursorDown() ) );
40 TreeEditor::~TreeEditor()
42 //cout <<"Destructor TreeEditor for "<<model->getMapName().toStdString()<<endl;
45 MySortFilterProxyModel* TreeEditor::getProxyModel()
50 QModelIndex TreeEditor::getSelectedIndex()
52 QModelIndexList list=selectionModel()->selectedIndexes();
60 void TreeEditor::setSortFilter(QString s)
62 proxyModel->setFilterRegExp(QRegExp(s, Qt::CaseInsensitive));
63 proxyModel->setFilterKeyColumn(0);
64 proxyModel->setDynamicSortFilter (true);
67 void TreeEditor::cursorUp()
69 QModelIndex ix=getSelectedIndex();
70 // FIXME-3 useproxymodel ix=proxyModel->mapToSource (indexAbove(ix));
76 void TreeEditor::cursorDown()
78 QModelIndex ix=getSelectedIndex();
79 //FIXME-3 useProxymodel ix=proxyModel->mapToSource (indexBelow(ix));