Files
qt5-legatus-legacy/Lts/Plugins/Evaluations/Gui/SchemaEdit/evl_edit_treemodel_schema.h
T
2026-08-13 18:33:10 +02:00

85 lines
2.0 KiB
C++
Executable File

/**
* @RDE_HEADER@
* $Id$
* $HeadURL$
* $Author$
*
* Created by Philipp Last, NLSE, 05.01.2018
*/
#pragma once
#include <Evaluations/logger.h>
#include "evl_edit_treemodel_general.h"
#include <QJsonDocument>
namespace Ui
{
class EditSchemaDialog;
}
namespace Evaluations
{
class TreeModelSchema : public TreeModelGeneral
{
Q_OBJECT
public:
TreeModelSchema(QObject *parent,
NGL::INGLLogger &logger);
void resetModel();
// We can only move elements around but not copy them
Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; }
Qt::DropActions supportedDragActions() const override { return Qt::MoveAction; }
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent) override;
QJsonDocument toJsonDocument() const;
bool fromQJsonDocument(const QJsonDocument &doc);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
ElementData getSelectedIndexDataAsElement(const QModelIndex &idx) const;
QVector<QString> getSelectedIndexHierarchy(const QModelIndex &idx) const;
// Comments
unsigned int cntComments() const
{
return m_cntComments;
}
unsigned int cntSentComments() const
{
return m_cntSentComments;
}
QModelIndex insertComment(const QModelIndex &parent, const ItemComment &data);
void insertComment(const ItemComment &data);
bool updateComment(const QModelIndex &index, const ItemComment &data);
void removeComment(const QModelIndex &idx);
// ElementData (Folder or Elements)
QModelIndex insertElementData(const QModelIndex &parent, const ElementData &data);
bool updateElementData(const QModelIndex &index, const ElementData &data);
signals:
void signalTriedToDropFolderToElement();
void signalSuccessfulDropPerformed(const QModelIndex &parent);
private:
void refreshElementDataIconState(const QModelIndex &idx);
void refreshAllIcons();
unsigned int m_cntComments{0};
unsigned int m_cntSentComments{0};
int m_elementId{1};
};
}