Browse Source

bug-fix: move to the end of document after inserting title when creating a new note

Le Tan 8 years ago
parent
commit
ed4044061f
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/vfilelist.cpp

+ 3 - 3
src/vfilelist.cpp

@@ -321,9 +321,9 @@ void VFileList::newFile()
             QWidget *wid = QApplication::focusWidget();
             VMdEdit *edit = dynamic_cast<VMdEdit *>(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);
             }
         }
     }