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