From 7b373a2a860d1e779664fffe98db769be34d5591 Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 26 Feb 2012 08:54:00 +0100 Subject: Implement PicturesWidget Create a tab to show the archived pictures. It's far from complete, but it already does: * show pictures * hover * delete pictures from archive --- mappingtreewidget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mappingtreewidget.cpp') 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()){ -- cgit v1.2.3-70-g09d2