summaryrefslogtreecommitdiffstats
path: root/sigmodr/tree/SigmodrTree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmodr/tree/SigmodrTree.cpp')
-rw-r--r--sigmodr/tree/SigmodrTree.cpp14
1 files changed, 12 insertions, 2 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*>());