Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Tobias Hunger
qt-creator
Commits
87b3755b
Commit
87b3755b
authored
May 07, 2010
by
mae
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Missing actions in keyboard options
Task-number: QTCREATORBUG-61
parent
283f86bd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
205 additions
and
0 deletions
+205
-0
src/plugins/texteditor/basetexteditor.cpp
src/plugins/texteditor/basetexteditor.cpp
+83
-0
src/plugins/texteditor/basetexteditor.h
src/plugins/texteditor/basetexteditor.h
+17
-0
src/plugins/texteditor/texteditoractionhandler.cpp
src/plugins/texteditor/texteditoractionhandler.cpp
+71
-0
src/plugins/texteditor/texteditoractionhandler.h
src/plugins/texteditor/texteditoractionhandler.h
+18
-0
src/plugins/texteditor/texteditorconstants.h
src/plugins/texteditor/texteditorconstants.h
+16
-0
No files found.
src/plugins/texteditor/basetexteditor.cpp
View file @
87b3755b
...
...
@@ -739,6 +739,89 @@ void BaseTextEditor::gotoBlockEndWithSelection()
}
}
void
BaseTextEditor
::
gotoLineStart
()
{
handleHomeKey
(
false
);
}
void
BaseTextEditor
::
gotoLineStartWithSelection
()
{
handleHomeKey
(
true
);
}
void
BaseTextEditor
::
gotoLineEnd
()
{
moveCursor
(
QTextCursor
::
EndOfLine
);
}
void
BaseTextEditor
::
gotoLineEndWithSelection
()
{
moveCursor
(
QTextCursor
::
EndOfLine
,
QTextCursor
::
KeepAnchor
);
}
void
BaseTextEditor
::
gotoNextLine
()
{
moveCursor
(
QTextCursor
::
NextRow
);
}
void
BaseTextEditor
::
gotoNextLineWithSelection
()
{
moveCursor
(
QTextCursor
::
NextRow
,
QTextCursor
::
KeepAnchor
);
}
void
BaseTextEditor
::
gotoPreviousLine
()
{
moveCursor
(
QTextCursor
::
PreviousRow
);
}
void
BaseTextEditor
::
gotoPreviousLineWithSelection
()
{
moveCursor
(
QTextCursor
::
PreviousRow
,
QTextCursor
::
KeepAnchor
);
}
void
BaseTextEditor
::
gotoPreviousCharacter
()
{
moveCursor
(
QTextCursor
::
PreviousCharacter
);
}
void
BaseTextEditor
::
gotoPreviousCharacterWithSelection
()
{
moveCursor
(
QTextCursor
::
PreviousCharacter
,
QTextCursor
::
KeepAnchor
);
}
void
BaseTextEditor
::
gotoNextCharacter
()
{
moveCursor
(
QTextCursor
::
NextCharacter
);
}
void
BaseTextEditor
::
gotoNextCharacterWithSelection
()
{
moveCursor
(
QTextCursor
::
NextCharacter
,
QTextCursor
::
KeepAnchor
);
}
void
BaseTextEditor
::
gotoPreviousWord
()
{
moveCursor
(
QTextCursor
::
PreviousWord
);
}
void
BaseTextEditor
::
gotoPreviousWordWithSelection
()
{
moveCursor
(
QTextCursor
::
PreviousWord
,
QTextCursor
::
KeepAnchor
);
}
void
BaseTextEditor
::
gotoNextWord
()
{
moveCursor
(
QTextCursor
::
NextWord
);
}
void
BaseTextEditor
::
gotoNextWordWithSelection
()
{
moveCursor
(
QTextCursor
::
NextWord
,
QTextCursor
::
KeepAnchor
);
}
static
QTextCursor
flippedCursor
(
const
QTextCursor
&
cursor
)
{
QTextCursor
flipped
=
cursor
;
...
...
src/plugins/texteditor/basetexteditor.h
View file @
87b3755b
...
...
@@ -231,6 +231,23 @@ public slots:
void
gotoBlockStartWithSelection
();
void
gotoBlockEndWithSelection
();
void
gotoLineStart
();
void
gotoLineStartWithSelection
();
void
gotoLineEnd
();
void
gotoLineEndWithSelection
();
void
gotoNextLine
();
void
gotoNextLineWithSelection
();
void
gotoPreviousLine
();
void
gotoPreviousLineWithSelection
();
void
gotoPreviousCharacter
();
void
gotoPreviousCharacterWithSelection
();
void
gotoNextCharacter
();
void
gotoNextCharacterWithSelection
();
void
gotoPreviousWord
();
void
gotoPreviousWordWithSelection
();
void
gotoNextWord
();
void
gotoNextWordWithSelection
();
void
selectBlockUp
();
void
selectBlockDown
();
...
...
src/plugins/texteditor/texteditoractionhandler.cpp
View file @
87b3755b
...
...
@@ -292,6 +292,59 @@ void TextEditorActionHandler::createActions()
command
=
am
->
registerAction
(
m_joinLinesAction
,
Constants
::
JOIN_LINES
,
m_contextId
);
command
->
setDefaultKeySequence
(
QKeySequence
(
tr
(
"Ctrl+J"
)));
connect
(
m_joinLinesAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
joinLines
()));
QAction
*
a
=
0
;
a
=
new
QAction
(
tr
(
"Goto Line Start"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_LINE_START
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoLineStart
()));
a
=
new
QAction
(
tr
(
"Goto Line End"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_LINE_END
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoLineEnd
()));
a
=
new
QAction
(
tr
(
"Goto Next Line"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_NEXT_LINE
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoNextLine
()));
a
=
new
QAction
(
tr
(
"Goto Previous Line"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_PREVIOUS_LINE
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoPreviousLine
()));
a
=
new
QAction
(
tr
(
"Goto Previous Character"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_PREVIOUS_CHARACTER
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoPreviousCharacter
()));
a
=
new
QAction
(
tr
(
"Goto Next Character"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_NEXT_CHARACTER
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoNextCharacter
()));
a
=
new
QAction
(
tr
(
"Goto Previous Word"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_PREVIOUS_WORD
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoPreviousWord
()));
a
=
new
QAction
(
tr
(
"Goto Next Word"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_NEXT_WORD
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoNextWord
()));
a
=
new
QAction
(
tr
(
"Goto Line Start With Selection"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_LINE_START_WITH_SELECTION
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoLineStartWithSelection
()));
a
=
new
QAction
(
tr
(
"Goto Line End With Selection"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_LINE_END_WITH_SELECTION
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoLineEndWithSelection
()));
a
=
new
QAction
(
tr
(
"Goto Next Line With Selection"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_NEXT_LINE_WITH_SELECTION
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoNextLineWithSelection
()));
a
=
new
QAction
(
tr
(
"Goto Previous Line With Selection"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_PREVIOUS_LINE_WITH_SELECTION
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoPreviousLineWithSelection
()));
a
=
new
QAction
(
tr
(
"Goto Previous Character With Selection"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_PREVIOUS_CHARACTER_WITH_SELECTION
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoPreviousCharacterWithSelection
()));
a
=
new
QAction
(
tr
(
"Goto Next Character With Selection"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_NEXT_CHARACTER_WITH_SELECTION
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoNextCharacterWithSelection
()));
a
=
new
QAction
(
tr
(
"Goto Previous Word With Selection"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_PREVIOUS_WORD_WITH_SELECTION
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoPreviousWordWithSelection
()));
a
=
new
QAction
(
tr
(
"Goto Next Word With Selection"
),
this
);
command
=
am
->
registerAction
(
a
,
Constants
::
GOTO_NEXT_WORD_WITH_SELECTION
,
m_contextId
);
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoNextWordWithSelection
()));
}
bool
TextEditorActionHandler
::
supportsAction
(
const
QString
&
/*id */
)
const
...
...
@@ -455,6 +508,24 @@ FUNCTION(copyLineUp)
FUNCTION
(
copyLineDown
)
FUNCTION
(
joinLines
)
FUNCTION
(
gotoLineStart
)
FUNCTION
(
gotoLineStartWithSelection
)
FUNCTION
(
gotoLineEnd
)
FUNCTION
(
gotoLineEndWithSelection
)
FUNCTION
(
gotoNextLine
)
FUNCTION
(
gotoNextLineWithSelection
)
FUNCTION
(
gotoPreviousLine
)
FUNCTION
(
gotoPreviousLineWithSelection
)
FUNCTION
(
gotoPreviousCharacter
)
FUNCTION
(
gotoPreviousCharacterWithSelection
)
FUNCTION
(
gotoNextCharacter
)
FUNCTION
(
gotoNextCharacterWithSelection
)
FUNCTION
(
gotoPreviousWord
)
FUNCTION
(
gotoPreviousWordWithSelection
)
FUNCTION
(
gotoNextWord
)
FUNCTION
(
gotoNextWordWithSelection
)
void
TextEditorActionHandler
::
updateCurrentEditor
(
Core
::
IEditor
*
editor
)
{
m_currentEditor
=
0
;
...
...
src/plugins/texteditor/texteditoractionhandler.h
View file @
87b3755b
...
...
@@ -118,6 +118,24 @@ private slots:
void
joinLines
();
void
updateCurrentEditor
(
Core
::
IEditor
*
editor
);
void
gotoLineStart
();
void
gotoLineStartWithSelection
();
void
gotoLineEnd
();
void
gotoLineEndWithSelection
();
void
gotoNextLine
();
void
gotoNextLineWithSelection
();
void
gotoPreviousLine
();
void
gotoPreviousLineWithSelection
();
void
gotoPreviousCharacter
();
void
gotoPreviousCharacterWithSelection
();
void
gotoNextCharacter
();
void
gotoNextCharacterWithSelection
();
void
gotoPreviousWord
();
void
gotoPreviousWordWithSelection
();
void
gotoNextWord
();
void
gotoNextWordWithSelection
();
private:
QAction
*
m_undoAction
;
QAction
*
m_redoAction
;
...
...
src/plugins/texteditor/texteditorconstants.h
View file @
87b3755b
...
...
@@ -68,6 +68,22 @@ const char * const SELECT_ENCODING = "TextEditor.SelectEncoding";
const
char
*
const
REWRAP_PARAGRAPH
=
"TextEditor.RewrapParagraph"
;
const
char
*
const
GOTO_OPENING_PARENTHESIS
=
"TextEditor.GotoOpeningParenthesis"
;
const
char
*
const
GOTO_CLOSING_PARENTHESIS
=
"TextEditor.GotoClosingParenthesis"
;
const
char
*
const
GOTO_LINE_START
=
"TextEditor.GotoLineStart"
;
const
char
*
const
GOTO_LINE_END
=
"TextEditor.GotoLineEnd"
;
const
char
*
const
GOTO_NEXT_LINE
=
"TextEditor.GotoNextLine"
;
const
char
*
const
GOTO_PREVIOUS_LINE
=
"TextEditor.GotoPreviousLine"
;
const
char
*
const
GOTO_PREVIOUS_CHARACTER
=
"TextEditor.GotoPreviousCharacter"
;
const
char
*
const
GOTO_NEXT_CHARACTER
=
"TextEditor.GotoNextCharacter"
;
const
char
*
const
GOTO_PREVIOUS_WORD
=
"TextEditor.GotoPreviousWord"
;
const
char
*
const
GOTO_NEXT_WORD
=
"TextEditor.GotoNextWord"
;
const
char
*
const
GOTO_LINE_START_WITH_SELECTION
=
"TextEditor.GotoLineStartWithSelection"
;
const
char
*
const
GOTO_LINE_END_WITH_SELECTION
=
"TextEditor.GotoLineEndWithSelection"
;
const
char
*
const
GOTO_NEXT_LINE_WITH_SELECTION
=
"TextEditor.GotoNextLineWithSelection"
;
const
char
*
const
GOTO_PREVIOUS_LINE_WITH_SELECTION
=
"TextEditor.GotoPreviousLineWithSelection"
;
const
char
*
const
GOTO_PREVIOUS_CHARACTER_WITH_SELECTION
=
"TextEditor.GotoPreviousCharacterWithSelection"
;
const
char
*
const
GOTO_NEXT_CHARACTER_WITH_SELECTION
=
"TextEditor.GotoNextCharacterWithSelection"
;
const
char
*
const
GOTO_PREVIOUS_WORD_WITH_SELECTION
=
"TextEditor.GotoPreviousWordWithSelection"
;
const
char
*
const
GOTO_NEXT_WORD_WITH_SELECTION
=
"TextEditor.GotoNextWordWithSelection"
;
const
char
*
const
C_TEXTEDITOR_MIMETYPE_TEXT
=
"text/plain"
;
const
char
*
const
C_TEXTEDITOR_MIMETYPE_XML
=
"application/xml"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment