diff options
author | Eike Ziller <eike.ziller@qt.io> | 2017-04-24 15:52:04 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2017-04-25 12:03:08 +0000 |
commit | 9443f7104b9db282157ac3098b64f35110328bde (patch) | |
tree | 6035d4dec89aa878bcc3c8c2b2bdb40629a7cf90 /src/plugins/texteditor/snippets/snippetprovider.h | |
parent | 46b77013989fec0b529b318ec04012ab0872d504 (diff) | |
download | qt-creator-9443f7104b9db282157ac3098b64f35110328bde.tar.gz |
Remove the need to create ISnippetProvider subclasses
Change-Id: I1810aaa945136d9726a66dad41377429a6adc8e1
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor/snippets/snippetprovider.h')
-rw-r--r-- | src/plugins/texteditor/snippets/snippetprovider.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/plugins/texteditor/snippets/snippetprovider.h b/src/plugins/texteditor/snippets/snippetprovider.h new file mode 100644 index 0000000000..0bb0b0682c --- /dev/null +++ b/src/plugins/texteditor/snippets/snippetprovider.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include <texteditor/texteditor_global.h> + +#include <QObject> + +#include <functional> + +namespace TextEditor { + +class TextEditorWidget; + +class TEXTEDITOR_EXPORT SnippetProvider : public QObject +{ + Q_OBJECT +public: + using EditorDecorator = std::function<void(TextEditorWidget *)>; + + static void registerGroup(const QString &groupId, const QString &displayName, + EditorDecorator editorDecorator = EditorDecorator()); + + QString groupId() const; + QString displayName() const; + EditorDecorator editorDecorator() const; + + void decorateEditor(TextEditorWidget *editor) const; + +private: + SnippetProvider() = default; + + QString m_groupId; + QString m_displayName; + EditorDecorator m_editorDecorator; +}; + +} // TextEditor |