forked from qt-creator/qt-creator
TextEditor: add actions to fold/unfold blocks recursively
Change-Id: Ie0d15ec02be7fb90e9b94ea0226b49ce724e4266 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -4234,6 +4234,14 @@ void TextEditorWidgetPrivate::registerActions()
|
|||||||
.setContext(m_editorContext)
|
.setContext(m_editorContext)
|
||||||
.addOnTriggered([this] { q->unfoldCurrentBlock(); })
|
.addOnTriggered([this] { q->unfoldCurrentBlock(); })
|
||||||
.setScriptable(true);
|
.setScriptable(true);
|
||||||
|
ActionBuilder(this, FOLD_RECURSIVELY)
|
||||||
|
.setContext(m_editorContext)
|
||||||
|
.addOnTriggered([this] { q->fold(q->textCursor().block(), true); })
|
||||||
|
.setScriptable(true);
|
||||||
|
ActionBuilder(this, UNFOLD_RECURSIVELY)
|
||||||
|
.setContext(m_editorContext)
|
||||||
|
.addOnTriggered([this] { q->unfold(q->textCursor().block(), true); })
|
||||||
|
.setScriptable(true);
|
||||||
m_unfoldAllAction = ActionBuilder(this, UNFOLD_ALL)
|
m_unfoldAllAction = ActionBuilder(this, UNFOLD_ALL)
|
||||||
.setContext(m_editorContext)
|
.setContext(m_editorContext)
|
||||||
.addOnTriggered([this] { q->toggleFoldAll(); })
|
.addOnTriggered([this] { q->toggleFoldAll(); })
|
||||||
|
@@ -131,6 +131,8 @@ const char TEXT_WRAPPING[] = "TextEditor.TextWrapping";
|
|||||||
const char UN_COMMENT_SELECTION[] = "TextEditor.UnCommentSelection";
|
const char UN_COMMENT_SELECTION[] = "TextEditor.UnCommentSelection";
|
||||||
const char FOLD[] = "TextEditor.Fold";
|
const char FOLD[] = "TextEditor.Fold";
|
||||||
const char UNFOLD[] = "TextEditor.Unfold";
|
const char UNFOLD[] = "TextEditor.Unfold";
|
||||||
|
const char FOLD_RECURSIVELY[] = "TextEditor.FoldRecursively";
|
||||||
|
const char UNFOLD_RECURSIVELY[] = "TextEditor.UnfoldRecursively";
|
||||||
const char UNFOLD_ALL[] = "TextEditor.UnFoldAll";
|
const char UNFOLD_ALL[] = "TextEditor.UnFoldAll";
|
||||||
const char AUTO_INDENT_SELECTION[] = "TextEditor.AutoIndentSelection";
|
const char AUTO_INDENT_SELECTION[] = "TextEditor.AutoIndentSelection";
|
||||||
const char AUTO_FORMAT_SELECTION[] = "TextEditor.AutoFormatSelection";
|
const char AUTO_FORMAT_SELECTION[] = "TextEditor.AutoFormatSelection";
|
||||||
|
@@ -512,6 +512,12 @@ void TextEditorPlugin::createEditorCommands()
|
|||||||
.setText(Tr::tr("Unfold"))
|
.setText(Tr::tr("Unfold"))
|
||||||
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+>")))
|
.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+>")))
|
||||||
.addToContainer(M_EDIT_ADVANCED, G_EDIT_COLLAPSING);
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_COLLAPSING);
|
||||||
|
TextActionBuilder(this, FOLD_RECURSIVELY)
|
||||||
|
.setText(Tr::tr("Fold Recursively"))
|
||||||
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_COLLAPSING);
|
||||||
|
TextActionBuilder(this, UNFOLD_RECURSIVELY)
|
||||||
|
.setText(Tr::tr("Unfold Recursively"))
|
||||||
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_COLLAPSING);
|
||||||
TextActionBuilder(this, UNFOLD_ALL)
|
TextActionBuilder(this, UNFOLD_ALL)
|
||||||
.setText(Tr::tr("Toggle &Fold All"))
|
.setText(Tr::tr("Toggle &Fold All"))
|
||||||
.addToContainer(M_EDIT_ADVANCED, G_EDIT_COLLAPSING);
|
.addToContainer(M_EDIT_ADVANCED, G_EDIT_COLLAPSING);
|
||||||
|
Reference in New Issue
Block a user