1.1 --- a/vymview.cpp Mon Oct 06 11:10:20 2008 +0000
1.2 +++ b/vymview.cpp Wed Oct 29 17:42:34 2008 +0000
1.3 @@ -1,20 +1,29 @@
1.4 #include "vymview.h"
1.5
1.6 +#include <iostream>
1.7 +
1.8 #include "mapeditor.h"
1.9
1.10 VymView::VymView(VymModel *model)
1.11 {
1.12 // Create TreeView
1.13 - QTreeView *treeview=new QTreeView;
1.14 + treeview=new QTreeView;
1.15 treeview->setModel ((QAbstractItemModel*)model);
1.16 treeview->setMinimumWidth (350);
1.17 treeview->setColumnWidth (0,350);
1.18
1.19 + // ItemSelectionModel
1.20 + selModel=treeview->selectionModel();
1.21 + connect (
1.22 + selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
1.23 + this,SLOT (changeSelection(const QItemSelection &,const QItemSelection &)));
1.24 + model->setSelectionModel (selModel);
1.25 +
1.26 // Create good old MapEditor
1.27 MapEditor* me=model->getMapEditor();
1.28 if (!me) me=new MapEditor (model);
1.29
1.30 - me->setSelectionModel (treeview->selectionModel() );
1.31 + me->setSelectionModel (selModel);
1.32
1.33 //me->viewport()->setFocus();
1.34 //FIXME me->setAntiAlias (actionViewToggleAntiAlias->isOn());
1.35 @@ -32,8 +41,17 @@
1.36
1.37 QItemSelectionModel* VymView::selectionModel()
1.38 {
1.39 - if (treeview) return treeview->selectionModel();
1.40 + if (treeview) return selModel;
1.41 + else std::cout <<"hey, no treeview so far???\n";
1.42 return NULL;
1.43 }
1.44
1.45
1.46 +void VymView::changeSelection (const QItemSelection &newSel, const QItemSelection &delSel)
1.47 +{
1.48 + // FIXME Currently this works only from treeview->ME
1.49 + treeview->expandAll(); //FIXME only for testing
1.50 +
1.51 + ((VymModel*)treeview->model())->select ();
1.52 +}
1.53 +