From 3c535b29044614bfeef56b8afc5bfa319aca64b3 Mon Sep 17 00:00:00 2001 From: blacksun Date: Wed, 9 Aug 2017 09:03:04 +0000 Subject: [PATCH] Minor : fix warning git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5012 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/diagramview.cpp | 54 ++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index f6711e1d1..2db88c9a4 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -638,13 +638,18 @@ void DiagramView::focusInEvent(QFocusEvent *e) { } /** - Handles "key press" events. Reimplemented here to switch to visualisation - mode if needed. -*/ -void DiagramView::keyPressEvent(QKeyEvent *e) { - if (m_event_interface && m_event_interface->keyPressEvent(e)) return; + * @brief DiagramView::keyPressEvent + * Handles "key press" events. Reimplemented here to switch to visualisation + * mode if needed. + * @param e + */ +void DiagramView::keyPressEvent(QKeyEvent *e) +{ + if (m_event_interface && m_event_interface->keyPressEvent(e)) + return; + ProjectView *current_project = this->diagramEditor()->acessCurrentProject(); -switch(e -> key()) + switch(e -> key()) { case Qt::Key_PageUp: current_project->changeTabUp(); @@ -684,29 +689,38 @@ switch(e -> key()) case Qt::Key_ZoomIn: zoom(1.15); return; - case Qt::Key_Minus: + case Qt::Key_Minus: { if (e->modifiers() & Qt::ControlModifier) zoom(0.85); - case Qt::Key_Plus: + } + break; + case Qt::Key_Plus: { if (e->modifiers() & Qt::ControlModifier) zoom(1.15); - case Qt::Key_Up: - if(!(m_diagram->selectedContent().items(DiagramContent::All).isEmpty())){ + } + break; + case Qt::Key_Up: { + if(!(m_diagram->selectedContent().items(DiagramContent::All).isEmpty())) scrollOnMovement(e); - } - case Qt::Key_Down: - if(!(m_diagram->selectedContent().items(DiagramContent::All).isEmpty())){ + } + break; + case Qt::Key_Down: { + if(!(m_diagram->selectedContent().items(DiagramContent::All).isEmpty())) scrollOnMovement(e); - } - case Qt::Key_Left: - if(!(m_diagram->selectedContent().items(DiagramContent::All).isEmpty())){ + } + break; + case Qt::Key_Left: { + if(!(m_diagram->selectedContent().items(DiagramContent::All).isEmpty())) scrollOnMovement(e); - } - case Qt::Key_Right: - if(!(m_diagram->selectedContent().items(DiagramContent::All).isEmpty())){ + } + break; + case Qt::Key_Right: { + if(!(m_diagram->selectedContent().items(DiagramContent::All).isEmpty())) scrollOnMovement(e); - } + } + break; } + switchToVisualisationModeIfNeeded(e); QGraphicsView::keyPressEvent(e); }