From 7d82c1eb347d743c4ba0ae74866e1edf516df509 Mon Sep 17 00:00:00 2001 From: Denes Matetelki Date: Wed, 22 Jun 2011 10:40:33 +0200 Subject: [PATCH] scale subtree with mouse wheel --- graphwidget.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/graphwidget.cpp b/graphwidget.cpp index 1e3de36..e018ff4 100644 --- a/graphwidget.cpp +++ b/graphwidget.cpp @@ -498,17 +498,23 @@ void GraphWidget::keyPressEvent(QKeyEvent *event) void GraphWidget::wheelEvent(QWheelEvent *event) { - if (QApplication::keyboardModifiers() == Qt::ControlModifier) + if (QApplication::keyboardModifiers() & Qt::ControlModifier) { - if (m_activeNode) + if (!m_activeNode) { - m_activeNode->setScale(pow((double)1.2, event->delta() / 120.0), - sceneRect()); + m_parent->statusBarMsg(tr("No active node.")); + return; + } + if (QApplication::keyboardModifiers() & Qt::ShiftModifier) + { + foreach(Node *node, m_activeNode->subtree()) + node->setScale(pow((double)1.2, event->delta() / 120.0), + sceneRect()); } else { - m_parent->statusBarMsg(tr("No active node.")); - return; + m_activeNode->setScale(pow((double)1.2, event->delta() / 120.0), + sceneRect()); } } else