Ver Fonte

move cursor to end when create new note with title (#1408)

* disable qtquickcompiler

* move cursor to end when create new note with title
tootal há 5 anos atrás
pai
commit
8a549ea323
3 ficheiros alterados com 8 adições e 6 exclusões
  1. 2 2
      src/src.pro
  2. 3 1
      src/vfilelist.cpp
  3. 3 3
      src/vmdtab.h

+ 2 - 2
src/src.pro

@@ -14,6 +14,8 @@ DEFINES += QT_MESSAGELOGCONTEXT
 TARGET = VNote
 TEMPLATE = app
 
+CONFIG -= qtquickcompiler
+
 RC_ICONS = resources/icons/vnote.ico
 ICON = resources/icons/vnote.icns
 
@@ -316,8 +318,6 @@ HEADERS  += vmainwindow.h \
 RESOURCES += \
     vnote.qrc \
     translations.qrc
-    
-QTQUICK_COMPILER_SKIPPED_RESOURCES += vnote.qrc
 
 macx {
     LIBS += -L/usr/local/lib

+ 3 - 1
src/vfilelist.cpp

@@ -431,8 +431,10 @@ void VFileList::newFile()
 
         // Move cursor down if content has been inserted.
         if (moveCursorEnd) {
-            const VMdTab *tab = dynamic_cast<VMdTab *>(editArea->getCurrentTab());
+            VMdTab *tab = dynamic_cast<VMdTab *>(editArea->getCurrentTab());
             if (tab) {
+                // It will init markdown editor (within 50 ms)
+                // See VMdTab::VMdTab --> QTimer::singleShot(50, ...
                 VMdEditor *edit = tab->getEditor();
                 if (edit && edit->getFile() == file) {
                     QTextCursor cursor = edit->textCursor();

+ 3 - 3
src/vmdtab.h

@@ -71,6 +71,9 @@ public:
     void clearSearchedWordHighlight() Q_DECL_OVERRIDE;
 
     VWebView *getWebViewer() const;
+    
+    // Get the markdown editor. If not init yet, init and return it.
+    VMdEditor *getEditor();
 
     VMdEditor *getEditor() const;
 
@@ -226,9 +229,6 @@ private:
     // Focus the proper child widget.
     void focusChild() Q_DECL_OVERRIDE;
 
-    // Get the markdown editor. If not init yet, init and return it.
-    VMdEditor *getEditor();
-
     // Restore from @p_fino.
     // Return true if succeed.
     bool restoreFromTabInfo(const VEditTabInfo &p_info) Q_DECL_OVERRIDE;