diff -r 382a444f5b0c -r a6931cd6309a mapeditor.cpp --- a/mapeditor.cpp Thu May 14 12:42:58 2009 +0000 +++ b/mapeditor.cpp Fri May 15 15:22:15 2009 +0000 @@ -45,7 +45,6 @@ model=vm; model->setScene (mapScene); model->registerEditor(this); -// model->addMapCenter(); // FIXME-3 create this in MapEditor until BO and MCO are independent of scene model->makeDefault(); // No changes in model so far setScene (mapScene); @@ -58,7 +57,7 @@ CopyCursor=QCursor ( QPixmap(iconPath+"cursorcopy.png"), 1,1 ); XLinkCursor=QCursor ( QPixmap(iconPath+"cursorxlink.png"), 1,7 ); - setFocusPolicy (Qt::StrongFocus); + //setFocusPolicy (Qt::StrongFocus); //FIXME-3 pickingColor=false; drawingLink=false; @@ -75,6 +74,45 @@ //model->reposition(); //FIXME-3 really still needed? + // Shortcuts and actions + QAction *a; + a = new QAction("Select upper branch", this); + a->setShortcut (Qt::Key_Up ); + a->setShortcutContext (Qt::WidgetShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( cursorUp() ) ); + + a = new QAction( "Select lower branch",this); + a->setShortcut ( Qt::Key_Down ); + a->setShortcutContext (Qt::WidgetShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( cursorDown() ) ); + + a = new QAction( "Select left branch", this); + a->setShortcut (Qt::Key_Left ); +// a->setShortcutContext (Qt::WindowShortcut); + a->setShortcutContext (Qt::WidgetWithChildrenShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( cursorLeft() ) ); + + a = new QAction( "Select child branch", this); + a->setShortcut (Qt::Key_Right); + a->setShortcutContext (Qt::WidgetWithChildrenShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( cursorRight() ) ); + + a = new QAction( "Select first branch", this); + a->setShortcut (Qt::Key_Home ); + a->setShortcutContext (Qt::WidgetWithChildrenShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( cursorFirst() ) ); + + a = new QAction( "Select last branch",this); + a->setShortcut ( Qt::Key_End ); + a->setShortcutContext (Qt::WidgetWithChildrenShortcut); + addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( cursorLast() ) ); + // Action to embed LineEdit for heading in Scene editingHeading=false; lineEdit=new QLineEdit; @@ -82,7 +120,7 @@ QGraphicsProxyWidget *pw=scene()->addWidget (lineEdit); pw->setZValue (100); - QAction *a = new QAction( tr( "Edit heading","MapEditor" ), this); + a = new QAction( tr( "Edit heading","MapEditor" ), this); a->setShortcut ( Qt::Key_Return ); //Edit heading addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) ); @@ -131,10 +169,6 @@ MapEditor::~MapEditor() { //cout <<"Destructor MapEditor for "<getMapName().toStdString()<unregisterEditor(this); } @@ -476,6 +510,38 @@ */ } +void MapEditor::cursorUp() +{ + model->selectUpperBranch(); +} + +void MapEditor::cursorDown() + +{ + model->selectLowerBranch(); +} + +void MapEditor::cursorLeft() +{ + model->selectLeftBranch(); +} + +void MapEditor::cursorRight() +{ + model->selectRightBranch(); +} + +void MapEditor::cursorFirst() +{ + model->selectFirstBranch(); +} + +void MapEditor::cursorLast() +{ + model->selectLastBranch(); +} + + void MapEditor::editHeading() { if (editingHeading)