From ed4044061fc3dfd561325a042675b754cd17362b Mon Sep 17 00:00:00 2001 From: Le Tan Date: Mon, 11 Sep 2017 19:49:00 +0800 Subject: [PATCH] bug-fix: move to the end of document after inserting title when creating a new note --- src/vfilelist.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vfilelist.cpp b/src/vfilelist.cpp index c90c3600..a0d70acd 100644 --- a/src/vfilelist.cpp +++ b/src/vfilelist.cpp @@ -321,9 +321,9 @@ void VFileList::newFile() QWidget *wid = QApplication::focusWidget(); VMdEdit *edit = dynamic_cast(wid); if (edit && edit->getFile() == file) { - QKeyEvent *downEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, - Qt::NoModifier); - QCoreApplication::postEvent(edit, downEvent); + QTextCursor cursor = edit->textCursor(); + cursor.movePosition(QTextCursor::End); + edit->setTextCursor(cursor); } } }