selecting destination at edge add/remove does not set the dest node the active one bugfix

master
Denes Matetelki 14 years ago
parent da74ca1a3e
commit e3b36decc3

@ -11,6 +11,11 @@ namespace Ui {
class MainWindow;
}
/** Responsibilities:
* - taking care of the menu and toolbars, file operations
* - displaying info in statusbar
* - handle content change
*/
class MainWindow : public QMainWindow
{
Q_OBJECT

@ -812,6 +812,7 @@ void GraphWidget::addEdge(Node *source, Node *destination)
if (destination == m_nodeList.first())
{
setActiveNode(destination);
emit notification(
tr("Root element cannot be an edge target."));
return;
@ -819,6 +820,7 @@ void GraphWidget::addEdge(Node *source, Node *destination)
if (source->isConnected(destination))
{
setActiveNode(destination);
emit notification(
tr("There is already an edge between these two nodes."));
}
@ -842,8 +844,9 @@ void GraphWidget::addEdge(Node *source, Node *destination)
// The Edge is secondary, because the Node already has a parent
// (it is already a destination of another Edge)
edge->setSecondary(sec);
m_scene->addItem(edge);
setActiveNode(destination);
emit contentChanged();
}
}
@ -858,11 +861,13 @@ void GraphWidget::removeEdge(Node *source, Node *destination)
if (!source->isConnected(destination))
{
setActiveNode(destination);
emit notification(tr("There no edge between these two nodes."));
}
else
{
source->deleteEdge(destination);
setActiveNode(destination);
emit contentChanged();
}
}
@ -893,7 +898,8 @@ void GraphWidget::setActiveNode(Node *node)
m_activeNode->setBorder(false);
m_activeNode = node;
m_activeNode->setBorder();
if (m_activeNode)
m_activeNode->setBorder();
}
// re-draw numbers

@ -53,6 +53,7 @@ void MainWindow::statusBarMsg(const QString &msg)
void MainWindow::contentChanged(const bool& changed)
{
// only care about the transitions
if (m_contentChanged == false && changed == true)
{
setWindowTitle(windowTitle().prepend("* "));
@ -276,12 +277,14 @@ void MainWindow::quit()
void MainWindow::closeEvent(QCloseEvent * event)
{
m_contentChanged && !closeFile() ? event->ignore() : event->accept();
m_contentChanged && !closeFile() ?
event->ignore() :
event->accept();
}
void MainWindow::keyPressEvent(QKeyEvent *event)
{
// incative action does not listen to signals
// inactive action does not listen to signals
if (event->modifiers() & Qt::ControlModifier)
{
if (event->key() == Qt::Key_M)

Loading…
Cancel
Save