1
/* This file is part of the Kate project.
2
* Based on the snippet plugin from KDevelop 4.
4
* Copyright (C) 2007 Robert Gruber <rgruber@users.sourceforge.net>
5
* Copyright (C) 2010 Milian Wolff <mail@milianw.de>
6
* Copyright (C) 2012 Christoph Cullmann <cullmann@kde.org>
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Library General Public
10
* License as published by the Free Software Foundation; either
11
* version 2 of the License, or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Library General Public License for more details.
18
* You should have received a copy of the GNU Library General Public License
19
* along with this library; see the file COPYING.LIB. If not, write to
20
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
* Boston, MA 02110-1301, USA.
27
#include <QStandardItem>
32
* One object of this class represents a single snippet.
33
* Multiple snippets are stored in one repository (XML-file).
35
* To access the snippet's name (which should also be used for matching
36
* during code completion) use @p QStandardItem::text().
38
* @author Robert Gruber <rgruber@users.sourceforge.net>
39
* @author Milian Wolff <mail@milianw.de>
41
class Snippet : public QStandardItem
45
* Construct an empty snippet.
51
* Returns the actual contents of this snippet.
53
QString snippet() const;
55
* Sets the actual contents of this snippet.
57
void setSnippet(const QString& snippet);
60
* Action to trigger insertion of this snippet.
64
void registerActionForView(QWidget* view);
66
virtual QVariant data(int role = Qt::UserRole + 1) const;
69
/// the actual snippet contents aka \code<fillin>\endcode
71
/// the insertion action for this snippet.
75
Q_DECLARE_METATYPE ( Snippet* )