summaryrefslogtreecommitdiffstats
path: root/mappingtreewidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mappingtreewidget.cpp')
-rw-r--r--mappingtreewidget.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/mappingtreewidget.cpp b/mappingtreewidget.cpp
index 00f4738..d9ea7da 100644
--- a/mappingtreewidget.cpp
+++ b/mappingtreewidget.cpp
@@ -40,6 +40,8 @@ MappingTreeWidget::MappingTreeWidget(QWidget *parent) : QWidget(parent){
mTree->setColumnHidden(2, true);
mTree->setAlternatingRowColors(true);
mTree->expandAll();
+ connect(mModel, SIGNAL(needExpansion()), mTree, SLOT(expandAll()));
+ connect(mTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged()));
mTypeBox = new QComboBox;
mTypeBox->setModel(mTypesModel);
connect(mTypeBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(typeChanged(QString)));
@@ -208,6 +210,12 @@ void MappingTreeWidget::editChild(){
}
}
+void MappingTreeWidget::selectionChanged(){
+ QModelIndex sel = selected();
+ QModelIndex real = mProxy->mapToSource(sel);
+ emit mappingChanged(real.data(MappingTreeModel::IdRole).toInt());
+}
+
const QModelIndex MappingTreeWidget::selected() const{
QModelIndexList sel = mTree->selectionModel()->selectedRows();
if(sel.isEmpty()){