|
|
@ -39,6 +39,7 @@ |
|
|
|
#include "core/UBApplication.h" |
|
|
|
#include "core/UBApplication.h" |
|
|
|
#include "UBDocumentNavigator.h" |
|
|
|
#include "UBDocumentNavigator.h" |
|
|
|
#include "board/UBBoardController.h" |
|
|
|
#include "board/UBBoardController.h" |
|
|
|
|
|
|
|
#include "board/UBBoardView.h" |
|
|
|
#include "adaptors/UBThumbnailAdaptor.h" |
|
|
|
#include "adaptors/UBThumbnailAdaptor.h" |
|
|
|
#include "adaptors/UBSvgSubsetAdaptor.h" |
|
|
|
#include "adaptors/UBSvgSubsetAdaptor.h" |
|
|
|
#include "document/UBDocumentController.h" |
|
|
|
#include "document/UBDocumentController.h" |
|
|
@ -354,6 +355,120 @@ void UBDocumentNavigator::mouseReleaseEvent(QMouseEvent *event) |
|
|
|
mLongPressTimer.stop(); |
|
|
|
mLongPressTimer.stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBDocumentNavigator::keyPressEvent(QKeyEvent *event) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
UBBoardController* controller = UBApplication::boardController; |
|
|
|
|
|
|
|
// send to the scene anyway
|
|
|
|
|
|
|
|
QApplication::sendEvent (scene (), event); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!event->isAccepted ()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
switch (event->key ()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case Qt::Key_Up: |
|
|
|
|
|
|
|
case Qt::Key_PageUp: |
|
|
|
|
|
|
|
case Qt::Key_Left: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->previousScene (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case Qt::Key_Down: |
|
|
|
|
|
|
|
case Qt::Key_PageDown: |
|
|
|
|
|
|
|
case Qt::Key_Right: |
|
|
|
|
|
|
|
case Qt::Key_Space: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->nextScene (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case Qt::Key_Home: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->firstScene (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case Qt::Key_End: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->lastScene (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case Qt::Key_Insert: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->addScene (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case Qt::Key_Control: |
|
|
|
|
|
|
|
case Qt::Key_Shift: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->controlView()->setMultiselection(true); |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (event->modifiers () & Qt::ControlModifier) // keep only ctrl/cmd keys
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
switch (event->key ()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case Qt::Key_Plus: |
|
|
|
|
|
|
|
case Qt::Key_I: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->zoomIn (); |
|
|
|
|
|
|
|
event->accept (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case Qt::Key_Minus: |
|
|
|
|
|
|
|
case Qt::Key_O: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->zoomOut (); |
|
|
|
|
|
|
|
event->accept (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case Qt::Key_0: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->zoomRestore (); |
|
|
|
|
|
|
|
event->accept (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case Qt::Key_Left: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->handScroll (-100, 0); |
|
|
|
|
|
|
|
event->accept (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case Qt::Key_Right: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->handScroll (100, 0); |
|
|
|
|
|
|
|
event->accept (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case Qt::Key_Up: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->handScroll (0, -100); |
|
|
|
|
|
|
|
event->accept (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case Qt::Key_Down: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->handScroll (0, 100); |
|
|
|
|
|
|
|
event->accept (); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// NOOP
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if ctrl of shift was pressed combined with other keys - we need to disable multiple selection.
|
|
|
|
|
|
|
|
if (event->isAccepted()) |
|
|
|
|
|
|
|
controller->controlView()->setMultiselection(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBDocumentNavigator::longPressTimeout() |
|
|
|
void UBDocumentNavigator::longPressTimeout() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (QApplication::mouseButtons() != Qt::NoButton) |
|
|
|
if (QApplication::mouseButtons() != Qt::NoButton) |
|
|
|