5 #include "mainwindow.h"
8 extern Main *mainWindow;
11 VymView::VymView(VymModel *model)
14 treeview=new QTreeView;
15 treeview->setModel ((QAbstractItemModel*)model);
16 treeview->setMinimumWidth (350);
17 treeview->setColumnWidth (0,350);
19 selModel=treeview->selectionModel();
20 model->setSelectionModel (selModel);
22 selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
23 this,SLOT (changeSelection(const QItemSelection &,const QItemSelection &)));
25 // Create good old MapEditor
26 MapEditor* me=model->getMapEditor();
27 if (!me) me=new MapEditor (model);
29 selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
30 me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
32 selModel, SIGNAL (currentChanged(const QModelIndex &, const QModelIndex &)),
33 me,SLOT (updateCurrent(const QModelIndex &,const QModelIndex &)));
35 // VymModel may want to update selection, e.g. during animation
37 model, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
38 me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
40 //me->viewport()->setFocus(); //FIXME needed?
41 me->setAntiAlias (mainWindow->isAliased());
42 me->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform());
54 QItemSelectionModel* VymView::selectionModel()
59 std::cout <<"VymView::selectionModel: hey, no treeview so far???\n";
64 void VymView::changeSelection (const QItemSelection &newSel, const QItemSelection &delSel)
66 // FIXME Currently this works only from treeview->ME
67 treeview->expandAll(); //FIXME only for testing
69 //((VymModel*)treeview->model())->select ();