1 #include "treeeditor.h"
6 #include "mainwindow.h"
9 extern Main *mainWindow;
11 ///////////////////////////////////////////////////////////////////////
12 ///////////////////////////////////////////////////////////////////////
13 TreeEditor::TreeEditor(VymModel *m)
16 if (model) setModel(model);
20 void TreeEditor::init()
22 setSelectionMode (QAbstractItemView::ExtendedSelection);
26 // Shortcuts for navigating with cursor:
27 a = new QAction(tr( "Select upper object","Tree Editor" ), this);
28 a->setShortcut (Qt::Key_Up );
29 a->setShortcutContext (Qt::WidgetShortcut);
31 connect( a, SIGNAL( triggered() ), this, SLOT( cursorUp() ) );
33 a = new QAction( tr( "Select lower object","Tree Editor" ),this);
34 a->setShortcut ( Qt::Key_Down );
35 a->setShortcutContext (Qt::WidgetShortcut);
37 connect( a, SIGNAL( triggered() ), this, SLOT( cursorDown() ) );
39 a = new QAction( this);
40 a->setShortcut ( Qt::Key_PageUp);
41 a->setShortcutContext (Qt::WidgetShortcut);
43 connect( a, SIGNAL( triggered() ), mainWindow, SLOT( editMoveUp() ) );
45 a = new QAction( this);
46 a->setShortcut ( Qt::Key_PageDown );
47 a->setShortcutContext (Qt::WidgetShortcut);
49 connect( a, SIGNAL( triggered() ), mainWindow, SLOT( editMoveDown() ) );
52 TreeEditor::~TreeEditor()
54 //qDebug()<<"Destructor TreeEditor for "<<model->getMapName();
57 QModelIndex TreeEditor::getSelectedIndex()
59 QModelIndexList list=selectionModel()->selectedIndexes();
66 void TreeEditor::cursorUp()
68 QModelIndex ix=getSelectedIndex();
74 void TreeEditor::cursorDown()
76 QModelIndex ix=getSelectedIndex();