diff --git a/graphwidget.cpp b/graphwidget.cpp index 11ee2b0..5325b4b 100644 --- a/graphwidget.cpp +++ b/graphwidget.cpp @@ -384,7 +384,7 @@ void GraphWidget::insertNode() QPointF pos(length * cos(angle), length * sin(angle)); Node *node = new Node(this); - node->setHtml(QString("new node")); + node->setHtml(QString("")); m_scene->addItem(node); node->setPos(m_activeNode->sceneBoundingRect().center() + pos - diff --git a/node.cpp b/node.cpp index 57da608..4f8c0b2 100644 --- a/node.cpp +++ b/node.cpp @@ -226,6 +226,10 @@ void Node::setEditable(const bool &editable) editable ? Qt::TextEditable : Qt::NoTextInteraction); + + QTextCursor c = textCursor(); + c.setPosition(c.document()->toPlainText().length()); + setTextCursor(c); } void Node::keyPressEvent(QKeyEvent *event)