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,16 +273,9 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
case Qt::Key_Down:
case Qt::Key_Left:
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);
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)
if (event->modifiers() & Qt::AltModifier)
{
QList <Node *> nodeList = m_activeNode->subtree();
foreach(Node *node, nodeList)
@ -294,6 +287,15 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
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();
}
}
else // move scene
{
QGraphicsView::keyPressEvent(event);
@ -302,34 +304,42 @@ 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)
if (event->modifiers() & Qt::AltModifier)
{
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
{
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)
if (event->modifiers() & Qt::AltModifier)
{
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
{
scaleView(1 / qreal(1.2));
@ -412,7 +422,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
}
QList <Node *> nodeList;
if (event->modifiers() == Qt::ShiftModifier)
if (event->modifiers() == Qt::AltModifier)
{
nodeList = m_activeNode->subtree();
}
@ -453,7 +463,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
case Qt::Key_C:
{
QList <Node *> nodeList;
if (event->modifiers() == Qt::ShiftModifier)
if (event->modifiers() == Qt::AltModifier)
{
nodeList = m_activeNode->subtree();
}
@ -482,7 +492,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
case Qt::Key_T:
{
QList <Node *> nodeList;
if (event->modifiers() == Qt::ShiftModifier)
if (event->modifiers() == Qt::AltModifier)
{
nodeList = m_activeNode->subtree();
}
@ -757,7 +767,6 @@ void GraphWidget::addFirstNode()
QString("<img src=:/qtmindmap.svg width=50 height=50></img>"));
m_scene->addItem(node);
node->setPos(-25, -25);
node->setBorder(false);
m_nodeList.append(node);

@ -86,9 +86,14 @@ void Node::setBorder(const bool &hasBorder)
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)
{
m_isActive = active;
setBorder(active);
update();
}
@ -361,19 +366,15 @@ void Node::paint(QPainter *painter,
else
{
m_hasBorder ?
painter->setPen(m_isActive ? Qt::red : Qt::blue) :
painter->setPen(QPen(QBrush(Qt::black), 1)) : // border is scaled
painter->setPen(Qt::transparent);
m_isActive?
// painter->setBrush(Node::m_orange) :
painter->setBrush(m_color.darker(120)) :
painter->setBrush(m_color);
painter->drawRoundedRect(boundingRect(), 20.0, 15.0);
}
painter->setBrush(Qt::NoBrush);
// the text itself
setDefaultTextColor(m_textColor);
QGraphicsTextItem::paint(painter, option, w);

Loading…
Cancel
Save