20 : QAbstractItemModel(
parent)
34dbe::models::tree::type_index
41 return createIndex(row, column, down);
47dbe::models::tree::type_index
50 if (child.isValid()) {
54 return createIndex(up->
GetRow(), 0, up);
98 return (Qt::ItemIsEnabled | Qt::ItemIsSelectable);
102 return (Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled);
108 if (
index.isValid()) {
110 case Qt::ForegroundRole:
113 tref const& obj = onode->GetObject();
120 }
catch (daq::dbe::config_object_retrieval_result_is_null
const& e) {
128 case Qt::BackgroundRole:
131 tref const& obj = onode->GetObject();
138 }
catch (daq::dbe::config_object_retrieval_result_is_null
const& e) {
146 case Qt::ToolTipRole:
148 return cnode->GetData(
index.column(), role);
152 case Qt::DisplayRole:
153 case Qt::DecorationRole:
164 if ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole)) {
175 rows = onode->ChildCount();
177 beginInsertRows(
parent, position, position + rows - 1);
183 for (
auto const& i : objects) {
185 emit
ObjectFile(QString::fromStdString(i.contained_in()));
245 types <<
"application/vnd.text.list";
252 QMimeData*
mimeData =
new QMimeData();
253 QByteArray encodedData;
255 QDataStream stream(&encodedData, QIODevice::WriteOnly);
257 foreach (QModelIndex
index, indexes) {
263 QString ObjectUid = QString::fromStdString(Object.
UID());
264 QString ObjectClassName = QString::fromStdString(Object.
class_name());
266 Text.append(ObjectUid);
267 Text.append(ObjectClassName);
273 mimeData->setData(
"application/vnd.text.list", encodedData);
280 for (
int i = 0; i <
rowCount(RootIndex); ++i) {
281 QModelIndex ChildIndex =
index(i, 0, RootIndex);
284 if (NodeItem == ChildNode) {
288 QModelIndex ChildChildIndex =
getindex(NodeItem, ChildIndex);
290 if (ChildChildIndex.isValid()) {
291 return ChildChildIndex;
295 return QModelIndex();
308 if (
index.isValid()) {
318 if (index.isValid()) {
320 return ObjectItem->GetObject();
324 throw daq::dbe::cannot_handle_invalid_qmodelindex(
ERS_HERE);
327dunedaq::conffwk::class_t
330 treenode* Item = getnode(index);
333 ClassNode* ClassItem =
dynamic_cast<ClassNode*
>(Item);
335 if (ClassItem !=
nullptr) {
336 return ClassItem->GetClassInfo();
339 ObjectNode* ObjectItem =
dynamic_cast<ObjectNode*
>(Item);
341 if (ObjectItem !=
nullptr) {
342 tref Object = ObjectItem->GetObject();
346 RelationshipNode* RelationshipItem =
dynamic_cast<RelationshipNode*
>(Item);
348 if (RelationshipItem !=
nullptr) {
353 return dunedaq::conffwk::class_t();
382 auto found = [&obj, classnode](
int i) {
383 return obj.UID() == classnode->GetChild(i)->GetData(0).toString().toStdString();
387 int const childs = classnode->ChildCount();
389 for (; i < childs and not found(i); ++i)
393 QModelIndex parent_index = getindex(classnode);
395 return childs == i ? QModelIndex() : index(i, parent_index.column(), parent_index);
398 return QModelIndex();
406 layoutAboutToBeChanged();
411 emit layoutChanged();
418 if (index.isValid()) {
419 this->removeRows(index.row(), 1, index.parent());
425 if (index.isValid()) {
426 treenode* child = getnode(index);
427 child->rename(QString::fromStdString(obj.ref().UID()));
428 emit dataChanged(index, index);
436 if (index.isValid()) {
438 treenode* child = getnode(index);
440 if (treenode* parent = child->GetParent()) {
441 emit layoutAboutToBeChanged();
442 parent->RemoveChild(child);
444 emit layoutChanged();
#define TREEMODEL_REMOVE_ROWS_DEF(classname)
ClassNode(const dunedaq::conffwk::class_t &Info, treenode *ParentNode)
ObjectNode(dref ObjectData, bool IsCopy, treenode *ParentNode)
static QColor ObjectForeground
static QColor FileReadOnlyForeground
static QColor ObjectBackground
static QColor FileReadOnlyBackground
static cptr< datahandler > gethandler()
static bool check_file_rw(const QString &FileName)
static std::vector< dbe::inner::configobject::tref > objects(std::string const &cname, bool const keep_inherited=true)
static dunedaq::conffwk::class_t definition(std::string const &cn, bool direct_only)
static treenode * findchild(treenode *top, QString const &name)
std::string class_name() const
void update_multiple_objects(std::vector< type_object_info > const &)
void model_common_connections()
void objectsUpdated(const std::vector< dbe::dref > &objects)
void fetchMore(const type_index &parent) override
QVariant data(const type_index &index, int role=Qt::DisplayRole) const override
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
type_index getindex(treenode *NodeItem, type_index const &RootIndex=QModelIndex()) const
bool setData(const type_index &index, const QVariant &value, int role) override
type_datum * getnode(const type_index &index) const override
type_index index(int row, int column, const type_index &parent) const override
bool canFetchMore(const type_index &parent) const override
bool insertRows(int position, int rows, const type_index &parent) override
bool abstract_classes_selectable
void ToggleAbstractClassesSelectable(bool)
QStringList mimeTypes() const override
bool hasChildren(const type_index &parent) const override
int columnCount(const type_index &parent) const override
type_index parent(const type_index &child) const override
QMimeData * mimeData(const QModelIndexList &indexes) const override
tree(const QStringList &Headers, QObject *parent=nullptr)
Qt::ItemFlags flags(const type_index &index) const override
int rowCount(const type_index &parent) const override
treenode * GetParent() const
bool GetHasStructure() const
virtual tref GetObject() const
treenode * GetChild(const int Row) const
bool GetWasFetched() const
void SetWasFetched(bool Fetched)
#define MODEL_COMMON_INTERFACE_LOOKUP_IMPL(classname)
#define MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL(classname)
#define MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL(classname)
#define MODEL_COMMON_INTERFACE_DELETE_THAT_OBJ_IMPL(classname)
#define MODEL_COMMON_INTERFACE_SLOTS_DEF(classname)
#define MODEL_COMMON_INTERFACE_CREATE_THAT_OBJ_IMPL(classname)
inner::configobject::tref tref
virtual type_class_info getclass(type_index const &index) const =0
virtual type_object_ref getobject(type_index const &index) const =0
virtual QAbstractItemModel * ReturnSourceModel() const =0
char const *const dbe_lib_structure_version
Including QT Headers.
#define dbe_compiled_version