roviz  0.7
Code Documentation of roviz
item_templates_model.h
1 #ifndef ITEMTEMPLATESMODEL_H
2 #define ITEMTEMPLATESMODEL_H
3 
4 #include <QStandardItemModel>
5 #include <QMimeData>
6 #include <QDomDocument>
7 
9 
10 class ItemTemplatesModel : public QStandardItemModel
11 {
12  Q_OBJECT
13 
14 public:
15  using Template = QPair<QString, QDomDocument>;
16  using TemplatesContainer = QVector<Template>;
17 
18  explicit ItemTemplatesModel(QObject* parent = nullptr);
19  bool canDropMimeData(QMimeData const* data, Qt::DropAction action, int row, int column, QModelIndex const& parent) const;
20  QMimeData* mimeData(QModelIndexList const& indexes) const;
21  bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
22  QStringList mimeTypes() const;
23  bool setData(const QModelIndex &index, const QVariant &value, int role);
24  bool isDuplicate(QString const& text) const;
25  void deleteTemplates(QModelIndexList const& indexes);
26 
27  static void init();
28 
29 signals:
30  void templateRenamed(QString const& oldName, QString const& newName);
31 
32 private:
33  TemplatesContainer _templates;
34 
35  void loadTemplates();
36  void loadTemplates(TemplatesContainer const& templates);
37 };
38 
39 Q_DECLARE_METATYPE(ItemTemplatesModel::TemplatesContainer)
40 Q_DECLARE_METATYPE(ItemTemplatesModel::Template)
41 
43 
44 #endif // ITEMTEMPLATESMODEL_H
#define STARTUP_ADD_COMPONENT(type)
This macro will automatically call StartupHelper::addComponent() for the passed Type before the app s...
Definition: startup_helper.h:80
Definition: item_templates_model.h:10