aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/glsleditor
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@theqtcompany.com>2016-04-14 09:00:05 +0200
committerDavid Schulz <david.schulz@theqtcompany.com>2016-05-25 13:55:50 +0000
commit7595aaa227305950c5ce03c7a636a340671400ce (patch)
treebda4fa5a864b5c6914e0ca59fbd37ab82ef5d6f4 /src/plugins/glsleditor
parent94fc57c00521e9b56d7b88759831a82cf9bff67e (diff)
Editor: Separate auto insert brace and quote magic.
To allow enabling/disabling both features separately. Change-Id: Ica154e3b400823de7cf22daf006958802d751c64 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/glsleditor')
-rw-r--r--src/plugins/glsleditor/glslautocompleter.cpp24
-rw-r--r--src/plugins/glsleditor/glslautocompleter.h20
2 files changed, 28 insertions, 16 deletions
diff --git a/src/plugins/glsleditor/glslautocompleter.cpp b/src/plugins/glsleditor/glslautocompleter.cpp
index b2e7d6313b..e0ff3df2e8 100644
--- a/src/plugins/glsleditor/glslautocompleter.cpp
+++ b/src/plugins/glsleditor/glslautocompleter.cpp
@@ -32,12 +32,18 @@
namespace GlslEditor {
namespace Internal {
-bool GlslCompleter::contextAllowsAutoParentheses(const QTextCursor &cursor,
- const QString &textToInsert) const
+bool GlslCompleter::contextAllowsAutoBrackets(const QTextCursor &cursor,
+ const QString &textToInsert) const
{
return CPlusPlus::MatchingText::contextAllowsAutoParentheses(cursor, textToInsert);
}
+bool GlslCompleter::contextAllowsAutoQuotes(const QTextCursor &cursor,
+ const QString &textToInsert) const
+{
+ return CPlusPlus::MatchingText::contextAllowsAutoQuotes(cursor, textToInsert);
+}
+
bool GlslCompleter::contextAllowsElectricCharacters(const QTextCursor &cursor) const
{
return CPlusPlus::MatchingText::contextAllowsElectricCharacters(cursor);
@@ -48,12 +54,16 @@ bool GlslCompleter::isInComment(const QTextCursor &cursor) const
return CPlusPlus::MatchingText::isInCommentHelper(cursor);
}
-QString GlslCompleter::insertMatchingBrace(const QTextCursor &cursor,
- const QString &text,
- QChar la,
- int *skippedChars) const
+QString GlslCompleter::insertMatchingBrace(const QTextCursor &cursor, const QString &text,
+ QChar lookAhead, int *skippedChars) const
+{
+ return CPlusPlus::MatchingText::insertMatchingBrace(cursor, text, lookAhead, skippedChars);
+}
+
+QString GlslCompleter::insertMatchingQuote(const QTextCursor &cursor, const QString &text,
+ QChar lookAhead, int *skippedChars) const
{
- return CPlusPlus::MatchingText::insertMatchingBrace(cursor, text, la, skippedChars);
+ return CPlusPlus::MatchingText::insertMatchingQuote(cursor, text, lookAhead, skippedChars);
}
QString GlslCompleter::insertParagraphSeparator(const QTextCursor &cursor) const
diff --git a/src/plugins/glsleditor/glslautocompleter.h b/src/plugins/glsleditor/glslautocompleter.h
index 1e1d1a0f84..59cfd3daed 100644
--- a/src/plugins/glsleditor/glslautocompleter.h
+++ b/src/plugins/glsleditor/glslautocompleter.h
@@ -33,15 +33,17 @@ namespace Internal {
class GlslCompleter : public TextEditor::AutoCompleter
{
public:
- virtual bool contextAllowsAutoParentheses(const QTextCursor &cursor,
- const QString &textToInsert = QString()) const;
- virtual bool contextAllowsElectricCharacters(const QTextCursor &cursor) const;
- virtual bool isInComment(const QTextCursor &cursor) const;
- virtual QString insertMatchingBrace(const QTextCursor &cursor,
- const QString &text,
- QChar la,
- int *skippedChars) const;
- virtual QString insertParagraphSeparator(const QTextCursor &cursor) const;
+ bool contextAllowsAutoBrackets(const QTextCursor &cursor,
+ const QString &textToInsert = QString()) const override;
+ bool contextAllowsAutoQuotes(const QTextCursor &cursor,
+ const QString &textToInsert = QString()) const override;
+ bool contextAllowsElectricCharacters(const QTextCursor &cursor) const override;
+ bool isInComment(const QTextCursor &cursor) const override;
+ QString insertMatchingBrace(const QTextCursor &cursor, const QString &text,
+ QChar lookAhead, int *skippedChars) const override;
+ QString insertMatchingQuote(const QTextCursor &cursor, const QString &text,
+ QChar lookAhead, int *skippedChars) const override;
+ QString insertParagraphSeparator(const QTextCursor &cursor) const override;
};
} // namespace Internal