diff options
Diffstat (limited to 'sigmodr')
-rw-r--r-- | sigmodr/tree/SigmodrTree.cpp | 14 | ||||
-rw-r--r-- | sigmodr/tree/SigmodrTree.h | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/sigmodr/tree/SigmodrTree.cpp b/sigmodr/tree/SigmodrTree.cpp index 552fad0c..2caca70a 100644 --- a/sigmodr/tree/SigmodrTree.cpp +++ b/sigmodr/tree/SigmodrTree.cpp @@ -46,15 +46,25 @@ SigmodrTree::SigmodrTree(QWidget* parent) : setRootIndex(model->index(-1, 0, QModelIndex())); } -QString SigmodrTree::description(const QModelIndex& index) +QString SigmodrTree::description(const QModelIndex& index) const { - QString type = model()->data(index, BaseModel::TypeRole).toString(); + QString type = typeOf(index); QString name = model()->data(index, Qt::DisplayRole).toString(); if (type.isEmpty() && name.isEmpty()) return ""; return QString("%1: %2").arg(type).arg(name); } +QString SigmodrTree::typeOf(const QModelIndex& index) const +{ + return model()->data(index, BaseModel::TypeRole).toString(); +} + +QStringList SigmodrTree::dropTypes(const QModelIndex& index) const +{ + return model()->data(index, BaseModel::DropAcceptRole).toString().split(';'); +} + ObjectUI* SigmodrTree::editorWidget(const QModelIndex& index) { ObjectUI* widget = qobject_cast<ObjectUI*>(model()->data(index, BaseModel::WidgetRole).value<QWidget*>()); diff --git a/sigmodr/tree/SigmodrTree.h b/sigmodr/tree/SigmodrTree.h index e04c1eba..df808b15 100644 --- a/sigmodr/tree/SigmodrTree.h +++ b/sigmodr/tree/SigmodrTree.h @@ -52,7 +52,9 @@ class SIGMODRTREE_EXPORT SigmodrTree : public QTreeView public: SigmodrTree(QWidget* parent = 0); - QString description(const QModelIndex& index); + QString description(const QModelIndex& index) const; + QString typeOf(const QModelIndex& index) const; + QStringList dropTypes(const QModelIndex& index) const; Widgets::ObjectUI* editorWidget(const QModelIndex& index); KMenu* contextMenu(const QModelIndex& index); |