diff --git a/mkedit.cpp b/mkedit.cpp index 5d12e21..e558a24 100644 --- a/mkedit.cpp +++ b/mkedit.cpp @@ -57,8 +57,6 @@ void MkEdit::initialialCursorPosition() this->verticalScrollBar()->setSliderPosition(0); int savedBlockNumber = cursor.blockNumber(); - selectRange.start = this->textCursor().selectionStart(); - selectRange.end = this->textCursor().selectionEnd(); emit cursorPosChanged( textCursor().hasSelection(), savedBlockNumber , getVisibleRect(), &selectRange); connectSignals(); @@ -208,7 +206,7 @@ void MkEdit::showSelectionAfterUndo(){ selectRange.hasSelection = false; } - disconnectSignals(); + QObject::disconnect(this,&MkEdit::cursorPositionChanged,this,&MkEdit::cursorPositionChangedHandle); { //first show all the Markdown symbols in the editor emit cursorPosChanged( range.hasSelection, currentBlockNo, getVisibleRect(), &selectRange); @@ -226,8 +224,8 @@ void MkEdit::showSelectionAfterUndo(){ //highlight the selection this->setTextCursor(textCursor); - } - connectSignals(); + } + QObject::connect(this,&MkEdit::cursorPositionChanged,this,&MkEdit::cursorPositionChangedHandle); } void MkEdit::quoteLeftKey() diff --git a/mktextdocument.h b/mktextdocument.h index 3231c48..2e7cb07 100644 --- a/mktextdocument.h +++ b/mktextdocument.h @@ -62,8 +62,6 @@ class FormatCollection{ #define NO_SELECTION_POS -1 struct SelectRange{ - int start = NO_SELECTION_POS; - int end = NO_SELECTION_POS; int startBlock = NO_SELECTION_POS; int endBlock = NO_SELECTION_POS; bool hasSelection = false;