insilmaril@769
|
1 |
#include "treeeditor.h"
|
insilmaril@769
|
2 |
|
insilmaril@769
|
3 |
#include <QAction>
|
insilmaril@769
|
4 |
#include <iostream>
|
insilmaril@769
|
5 |
using namespace std;
|
insilmaril@769
|
6 |
|
insilmaril@769
|
7 |
#include "vymmodel.h"
|
insilmaril@769
|
8 |
|
insilmaril@769
|
9 |
///////////////////////////////////////////////////////////////////////
|
insilmaril@769
|
10 |
///////////////////////////////////////////////////////////////////////
|
insilmaril@769
|
11 |
TreeEditor::TreeEditor(VymModel *m)
|
insilmaril@769
|
12 |
{
|
insilmaril@769
|
13 |
//cout << "Constructor TreeEditor "<<this<<endl;
|
insilmaril@769
|
14 |
|
insilmaril@769
|
15 |
model=m;
|
insilmaril@769
|
16 |
|
insilmaril@769
|
17 |
QAction *a;
|
insilmaril@769
|
18 |
// Shortcuts for navigating with cursor:
|
insilmaril@769
|
19 |
a = new QAction(tr( "Select upper object","Tree Editor" ), this);
|
insilmaril@769
|
20 |
a->setStatusTip ( tr( "Select upper object" ));
|
insilmaril@769
|
21 |
a->setShortcut (Qt::Key_Up );
|
insilmaril@769
|
22 |
// a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@769
|
23 |
a->setShortcutContext (Qt::WidgetShortcut);
|
insilmaril@769
|
24 |
// a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
|
insilmaril@769
|
25 |
addAction (a);
|
insilmaril@769
|
26 |
connect( a, SIGNAL( triggered() ), this, SLOT( cursorUp() ) );
|
insilmaril@769
|
27 |
|
insilmaril@769
|
28 |
a = new QAction( tr( "Select lower object","Tree Editor" ),this);
|
insilmaril@769
|
29 |
a->setStatusTip (tr( "Select lower object" ));
|
insilmaril@769
|
30 |
a->setShortcut ( Qt::Key_Down );
|
insilmaril@769
|
31 |
// a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@769
|
32 |
// a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
|
insilmaril@769
|
33 |
a->setShortcutContext (Qt::WidgetShortcut);
|
insilmaril@769
|
34 |
addAction (a);
|
insilmaril@769
|
35 |
connect( a, SIGNAL( triggered() ), this, SLOT( cursorDown() ) );
|
insilmaril@769
|
36 |
}
|
insilmaril@769
|
37 |
|
insilmaril@769
|
38 |
TreeEditor::~TreeEditor()
|
insilmaril@769
|
39 |
{
|
insilmaril@769
|
40 |
//cout <<"Destructor TreeEditor for "<<model->getMapName().toStdString()<<endl;
|
insilmaril@769
|
41 |
}
|
insilmaril@769
|
42 |
|
insilmaril@769
|
43 |
void TreeEditor::cursorUp()
|
insilmaril@769
|
44 |
{
|
insilmaril@769
|
45 |
model->select (indexAbove (model->getSelectedIndex() ));
|
insilmaril@769
|
46 |
}
|
insilmaril@769
|
47 |
|
insilmaril@769
|
48 |
void TreeEditor::cursorDown()
|
insilmaril@769
|
49 |
{
|
insilmaril@769
|
50 |
model->select (indexBelow (model->getSelectedIndex() ));
|
insilmaril@769
|
51 |
}
|
insilmaril@769
|
52 |
|