2015-12-16 17:16:15 +00:00
|
|
|
/*
|
2016-05-13 17:40:36 +00:00
|
|
|
Copyright 2006-2016 The QElectroTech Team
|
2015-12-16 17:16:15 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef XMLPROJECTELEMENTCOLLECTIONITEM_H
|
|
|
|
#define XMLPROJECTELEMENTCOLLECTIONITEM_H
|
|
|
|
|
|
|
|
#include "elementcollectionitem.h"
|
|
|
|
|
|
|
|
#include <QDomElement>
|
2015-12-30 09:39:22 +00:00
|
|
|
#include <QIcon>
|
2015-12-16 17:16:15 +00:00
|
|
|
|
|
|
|
class QETProject;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The XmlProjectElementCollectionItem class
|
|
|
|
* This class specialise ElementCollectionItem for manage an xml collection embedded in a project.
|
|
|
|
*/
|
|
|
|
class XmlProjectElementCollectionItem : public ElementCollectionItem
|
|
|
|
{
|
2016-02-24 10:43:40 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2015-12-16 17:16:15 +00:00
|
|
|
public:
|
|
|
|
XmlProjectElementCollectionItem(QETProject *project, ElementCollectionItem *parent = nullptr);
|
|
|
|
private:
|
|
|
|
XmlProjectElementCollectionItem (QETProject *project, const QDomElement &dom_element, ElementCollectionItem *parent = nullptr);
|
|
|
|
public:
|
|
|
|
~XmlProjectElementCollectionItem();
|
|
|
|
|
|
|
|
enum {Type = UserType + 2};
|
|
|
|
virtual int type() const {return Type;}
|
|
|
|
|
|
|
|
virtual QVariant data(int column, int role);
|
2016-03-31 17:28:44 +00:00
|
|
|
virtual void clearData();
|
2015-12-16 17:16:15 +00:00
|
|
|
virtual QMimeData *mimeData();
|
2016-02-21 18:53:40 +00:00
|
|
|
virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column) const;
|
|
|
|
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column);
|
2015-12-16 17:16:15 +00:00
|
|
|
virtual Qt::ItemFlags flags();
|
|
|
|
|
|
|
|
virtual bool isCollectionRoot() const;
|
|
|
|
virtual QString name();
|
|
|
|
virtual bool isValid() const;
|
|
|
|
QETProject *project() const;
|
|
|
|
virtual bool isDir() const;
|
|
|
|
virtual bool isElement() const;
|
|
|
|
QString collectionPath() const;
|
2015-12-30 09:39:22 +00:00
|
|
|
QString embeddedPath() const;
|
2016-01-08 17:01:51 +00:00
|
|
|
virtual QString collectionName() const;
|
|
|
|
void insertNewItem(const QString &collection_name);
|
|
|
|
|
2015-12-16 17:16:15 +00:00
|
|
|
private:
|
|
|
|
void populate();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QETProject *m_project;
|
|
|
|
QDomElement m_dom_element;
|
2015-12-30 09:39:22 +00:00
|
|
|
QIcon m_icon;
|
2015-12-16 17:16:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // XMLPROJECTELEMENTCOLLECTIONITEM_H
|