alt is used to apply change to group, shilf needed to reach - and + in some keyboards

master
Denes Matetelki 14 years ago
parent 290881c066
commit 3f9c182c2d

@ -273,24 +273,26 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
case Qt::Key_Down: case Qt::Key_Down:
case Qt::Key_Left: case Qt::Key_Left:
case Qt::Key_Right: case Qt::Key_Right:
if (event->modifiers() == Qt::ControlModifier) if (event->modifiers() & Qt::ControlModifier)
{ {
if (event->key() == Qt::Key_Up) m_activeNode->moveBy(0, -20); if (event->modifiers() & Qt::AltModifier)
else if (event->key() == Qt::Key_Down) m_activeNode->moveBy(0, 20);
else if (event->key() == Qt::Key_Left) m_activeNode->moveBy(-20, 0);
else if (event->key() == Qt::Key_Right) m_activeNode->moveBy(20, 0);
contentChanged();
}
else if (event->modifiers() & Qt::ControlModifier &&
event->modifiers() & Qt::ShiftModifier)
{
QList <Node *> nodeList = m_activeNode->subtree();
foreach(Node *node, nodeList)
{ {
if (event->key() == Qt::Key_Up) node->moveBy(0, -20); QList <Node *> nodeList = m_activeNode->subtree();
else if (event->key() == Qt::Key_Down) node->moveBy(0, 20); foreach(Node *node, nodeList)
else if (event->key() == Qt::Key_Left) node->moveBy(-20, 0); {
else if (event->key() == Qt::Key_Right) node->moveBy(20, 0); if (event->key() == Qt::Key_Up) node->moveBy(0, -20);
else if (event->key() == Qt::Key_Down) node->moveBy(0, 20);
else if (event->key() == Qt::Key_Left) node->moveBy(-20, 0);
else if (event->key() == Qt::Key_Right) node->moveBy(20, 0);
contentChanged();
}
}
else
{
if (event->key() == Qt::Key_Up) m_activeNode->moveBy(0, -20);
else if (event->key() == Qt::Key_Down) m_activeNode->moveBy(0, 20);
else if (event->key() == Qt::Key_Left) m_activeNode->moveBy(-20, 0);
else if (event->key() == Qt::Key_Right) m_activeNode->moveBy(20, 0);
contentChanged(); contentChanged();
} }
} }
@ -302,34 +304,42 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
// zoom in/out // zoom in/out
case Qt::Key_Plus: 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(); if (event->modifiers() & Qt::AltModifier)
foreach(Node *node, nodeList) {
node->setScale(qreal(1.2),sceneRect()); QList <Node *> nodeList = m_activeNode->subtree();
foreach(Node *node, nodeList)
node->setScale(qreal(1.2),sceneRect());
}
else
{
m_activeNode->setScale(qreal(1.2),sceneRect());
}
} }
else else
{ {
scaleView(qreal(1.2)); scaleView(qreal(1.2));
} }
break; break;
case Qt::Key_Minus: 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(); if (event->modifiers() & Qt::AltModifier)
foreach(Node *node, nodeList) {
node->setScale(qreal(1 / 1.2),sceneRect()); QList <Node *> nodeList = m_activeNode->subtree();
foreach(Node *node, nodeList)
node->setScale(qreal(1 / 1.2),sceneRect());
}
else
{
m_activeNode->setScale(qreal(1 / 1.2),sceneRect());
}
} }
else else
{ {
scaleView(1 / qreal(1.2)); scaleView(1 / qreal(1.2));
@ -412,7 +422,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
} }
QList <Node *> nodeList; QList <Node *> nodeList;
if (event->modifiers() == Qt::ShiftModifier) if (event->modifiers() == Qt::AltModifier)
{ {
nodeList = m_activeNode->subtree(); nodeList = m_activeNode->subtree();
} }
@ -453,7 +463,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
case Qt::Key_C: case Qt::Key_C:
{ {
QList <Node *> nodeList; QList <Node *> nodeList;
if (event->modifiers() == Qt::ShiftModifier) if (event->modifiers() == Qt::AltModifier)
{ {
nodeList = m_activeNode->subtree(); nodeList = m_activeNode->subtree();
} }
@ -482,7 +492,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
case Qt::Key_T: case Qt::Key_T:
{ {
QList <Node *> nodeList; QList <Node *> nodeList;
if (event->modifiers() == Qt::ShiftModifier) if (event->modifiers() == Qt::AltModifier)
{ {
nodeList = m_activeNode->subtree(); nodeList = m_activeNode->subtree();
} }
@ -757,7 +767,6 @@ void GraphWidget::addFirstNode()
QString("<img src=:/qtmindmap.svg width=50 height=50></img>")); QString("<img src=:/qtmindmap.svg width=50 height=50></img>"));
m_scene->addItem(node); m_scene->addItem(node);
node->setPos(-25, -25); node->setPos(-25, -25);
node->setBorder(false);
m_nodeList.append(node); m_nodeList.append(node);

@ -86,9 +86,14 @@ void Node::setBorder(const bool &hasBorder)
update(); update();
} }
/** @note Used to have some disorder here, how does an active node looks like?
* Let is have border but the color shall not change, shadow is messy too.
*/
void Node::setActive(const bool &active) void Node::setActive(const bool &active)
{ {
m_isActive = active; m_isActive = active;
setBorder(active);
update(); update();
} }
@ -361,19 +366,15 @@ void Node::paint(QPainter *painter,
else else
{ {
m_hasBorder ? m_hasBorder ?
painter->setPen(m_isActive ? Qt::red : Qt::blue) : painter->setPen(QPen(QBrush(Qt::black), 1)) : // border is scaled
painter->setPen(Qt::transparent); painter->setPen(Qt::transparent);
m_isActive? painter->setBrush(m_color);
// painter->setBrush(Node::m_orange) :
painter->setBrush(m_color.darker(120)) :
painter->setBrush(m_color);
painter->drawRoundedRect(boundingRect(), 20.0, 15.0); painter->drawRoundedRect(boundingRect(), 20.0, 15.0);
} }
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);
// the text itself // the text itself
setDefaultTextColor(m_textColor); setDefaultTextColor(m_textColor);
QGraphicsTextItem::paint(painter, option, w); QGraphicsTextItem::paint(painter, option, w);

Loading…
Cancel
Save