forked from qt-creator/qt-creator
Beautifier: Remove dead ends
Detected by Axivion plugin. Change-Id: If57596124e3bae663918a9a0161164321ea7a525 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -114,14 +114,6 @@ void ConfigurationDialog::setSettings(AbstractSettings *settings)
|
||||
m_editor->setSettings(m_settings);
|
||||
}
|
||||
|
||||
void ConfigurationDialog::clear()
|
||||
{
|
||||
m_name->clear();
|
||||
m_editor->clear();
|
||||
m_currentKey.clear();
|
||||
updateOkButton();
|
||||
}
|
||||
|
||||
QString ConfigurationDialog::key() const
|
||||
{
|
||||
return m_name->text().simplified();
|
||||
|
@@ -24,7 +24,6 @@ public:
|
||||
~ConfigurationDialog() override;
|
||||
void setSettings(AbstractSettings *settings);
|
||||
|
||||
void clear();
|
||||
QString key() const;
|
||||
void setKey(const QString &key);
|
||||
QString value() const;
|
||||
|
@@ -22,8 +22,6 @@ ConfigurationSyntaxHighlighter::ConfigurationSyntaxHighlighter(QTextDocument *pa
|
||||
const TextEditor::FontSettings fs = TextEditor::TextEditorSettings::fontSettings();
|
||||
m_formatKeyword = fs.toTextCharFormat(TextEditor::C_FIELD);
|
||||
m_formatComment = fs.toTextCharFormat(TextEditor::C_COMMENT);
|
||||
|
||||
m_expressionComment.setPattern("#[^\\n]*");
|
||||
}
|
||||
|
||||
void ConfigurationSyntaxHighlighter::setKeywords(const QStringList &keywords)
|
||||
@@ -41,11 +39,6 @@ void ConfigurationSyntaxHighlighter::setKeywords(const QStringList &keywords)
|
||||
m_expressionKeyword.setPattern("(?:\\s|^)(" + pattern.join('|') + ")(?=\\s|\\:|\\=|\\,|$)");
|
||||
}
|
||||
|
||||
void ConfigurationSyntaxHighlighter::setCommentExpression(const QRegularExpression &rx)
|
||||
{
|
||||
m_expressionComment = rx;
|
||||
}
|
||||
|
||||
void ConfigurationSyntaxHighlighter::highlightBlock(const QString &text)
|
||||
{
|
||||
QRegularExpressionMatchIterator it = m_expressionKeyword.globalMatch(text);
|
||||
@@ -54,7 +47,8 @@ void ConfigurationSyntaxHighlighter::highlightBlock(const QString &text)
|
||||
setFormat(match.capturedStart(), match.capturedLength(), m_formatKeyword);
|
||||
}
|
||||
|
||||
it = m_expressionComment.globalMatch(text);
|
||||
static const QRegularExpression expressionComment("#[^\\n]*");
|
||||
it = expressionComment.globalMatch(text);
|
||||
while (it.hasNext()) {
|
||||
const QRegularExpressionMatch match = it.next();
|
||||
setFormat(match.capturedStart(), match.capturedLength(), m_formatComment);
|
||||
@@ -93,11 +87,6 @@ void ConfigurationEditor::setSettings(AbstractSettings *settings)
|
||||
m_model->setStringList(keywords);
|
||||
}
|
||||
|
||||
void ConfigurationEditor::setCommentExpression(const QRegularExpression &rx)
|
||||
{
|
||||
m_highlighter->setCommentExpression(rx);
|
||||
}
|
||||
|
||||
// Workaround for handling "ESC" right when popup is shown.
|
||||
bool ConfigurationEditor::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
|
@@ -25,14 +25,12 @@ class ConfigurationSyntaxHighlighter : public QSyntaxHighlighter
|
||||
public:
|
||||
explicit ConfigurationSyntaxHighlighter(QTextDocument *parent);
|
||||
void setKeywords(const QStringList &keywords);
|
||||
void setCommentExpression(const QRegularExpression &rx);
|
||||
|
||||
protected:
|
||||
void highlightBlock(const QString &text) override;
|
||||
|
||||
private:
|
||||
QRegularExpression m_expressionKeyword;
|
||||
QRegularExpression m_expressionComment;
|
||||
QTextCharFormat m_formatKeyword;
|
||||
QTextCharFormat m_formatComment;
|
||||
};
|
||||
@@ -44,7 +42,6 @@ class ConfigurationEditor : public QPlainTextEdit
|
||||
public:
|
||||
explicit ConfigurationEditor(QWidget *parent = nullptr);
|
||||
void setSettings(AbstractSettings *settings);
|
||||
void setCommentExpression(const QRegularExpression &rx);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
|
Reference in New Issue
Block a user