1 #include "treeeditor.h"
8 ///////////////////////////////////////////////////////////////////////
9 ///////////////////////////////////////////////////////////////////////
10 TreeEditor::TreeEditor(VymModel *m)
14 // FIXME-3 use proxmodel
15 //proxyModel = new MySortFilterProxyModel(this);
16 //setModel(proxyModel);
18 //proxyModel->setSourceModel(model);
21 // Shortcuts for navigating with cursor:
22 a = new QAction(tr( "Select upper object","Tree Editor" ), this);
23 a->setStatusTip ( tr( "Select upper object" ));
24 a->setShortcut (Qt::Key_Up );
25 a->setShortcutContext (Qt::WidgetShortcut);
27 connect( a, SIGNAL( triggered() ), this, SLOT( cursorUp() ) );
29 a = new QAction( tr( "Select lower object","Tree Editor" ),this);
30 a->setStatusTip (tr( "Select lower object" ));
31 a->setShortcut ( Qt::Key_Down );
32 a->setShortcutContext (Qt::WidgetShortcut);
34 connect( a, SIGNAL( triggered() ), this, SLOT( cursorDown() ) );
37 TreeEditor::~TreeEditor()
39 //cout <<"Destructor TreeEditor for "<<model->getMapName().toStdString()<<endl;
42 MySortFilterProxyModel* TreeEditor::getProxyModel()
47 QModelIndex TreeEditor::getSelectedIndex()
49 QModelIndexList list=selectionModel()->selectedIndexes();
57 void TreeEditor::setSortFilter(QString s)
59 proxyModel->setFilterRegExp(QRegExp(s, Qt::CaseInsensitive));
60 proxyModel->setFilterKeyColumn(0);
61 proxyModel->setDynamicSortFilter (true);
64 void TreeEditor::cursorUp()
66 QModelIndex ix=getSelectedIndex();
67 // FIXME-3 useproxymodel ix=proxyModel->mapToSource (indexAbove(ix));
73 void TreeEditor::cursorDown()
75 QModelIndex ix=getSelectedIndex();
76 //FIXME-3 useProxymodel ix=proxyModel->mapToSource (indexBelow(ix));