rescale and setcolor on subtrees

master
Denes Matetelki 14 years ago
parent fe8983fce9
commit 6a075518f5

@ -302,20 +302,34 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
// zoom in/out
case Qt::Key_Plus:
if (event->modifiers() & Qt::ControlModifier)
if (event->modifiers() == Qt::ControlModifier)
{
m_activeNode->setScale(qreal(1.2),sceneRect());
}
else if (event->modifiers() & Qt::ControlModifier &&
event->modifiers() & Qt::ShiftModifier)
{
QList <Node *> nodeList = m_activeNode->subtree();
foreach(Node *node, nodeList)
node->setScale(qreal(1.2),sceneRect());
}
else
{
scaleView(qreal(1.2));
}
break;
case Qt::Key_Minus:
if (event->modifiers() & Qt::ControlModifier)
if (event->modifiers() == Qt::ControlModifier)
{
m_activeNode->setScale(qreal(1 / 1.2),sceneRect());
}
else if (event->modifiers() & Qt::ControlModifier &&
event->modifiers() & Qt::ShiftModifier)
{
QList <Node *> nodeList = m_activeNode->subtree();
foreach(Node *node, nodeList)
node->setScale(qreal(1 / 1.2),sceneRect());
}
else
{
scaleView(1 / qreal(1.2));
@ -423,29 +437,53 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
case Qt::Key_C:
{
QList <Node *> nodeList;
if (event->modifiers() == Qt::ShiftModifier)
{
nodeList = m_activeNode->subtree();
}
else
{
nodeList.push_back(m_activeNode);
}
QColorDialog dialog(this);
dialog.setWindowTitle(tr("Select node color"));
dialog.setCurrentColor(m_activeNode->color());
if (dialog.exec())
{
QColor color = dialog.selectedColor();
m_activeNode->setColor(color);
foreach (Edge * edge, m_activeNode->edgesToThis(false))
foreach(Node *node, nodeList)
{
node->setColor(color);
foreach (Edge * edge, node->edgesToThis(false))
edge->setColor(color);
}
}
break;
}
case Qt::Key_T:
{
QList <Node *> nodeList;
if (event->modifiers() == Qt::ShiftModifier)
{
nodeList = m_activeNode->subtree();
}
else
{
nodeList.push_back(m_activeNode);
}
QColorDialog dialog(this);
dialog.setWindowTitle(tr("Select text color"));
dialog.setCurrentColor(m_activeNode->textColor());
if (dialog.exec())
{
QColor color = dialog.selectedColor();
m_activeNode->setTextColor(color);
foreach(Node *node, nodeList)
node->setTextColor(color);
}
break;

Loading…
Cancel
Save