6 #include "mainwindow.h"
9 extern Main *mainWindow;
12 VymView::VymView(VymModel *m)
17 treeview=new QTreeView;
18 treeview->setModel ((QAbstractItemModel*)model);
19 treeview->setMinimumWidth (350);
20 treeview->setColumnWidth (0,350);
22 selModel=treeview->selectionModel();
23 model->setSelectionModel (selModel);
25 selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
26 this,SLOT (changeSelection(const QItemSelection &,const QItemSelection &)));
28 // Create good old MapEditor
29 MapEditor* me=model->getMapEditor();
30 if (!me) me=new MapEditor (model);
32 selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
33 me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
35 selModel, SIGNAL (currentChanged(const QModelIndex &, const QModelIndex &)),
36 me,SLOT (updateCurrent(const QModelIndex &,const QModelIndex &)));
38 // VymModel may want to update selection, e.g. during animation
40 model, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
41 me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
43 //me->viewport()->setFocus(); //FIXME needed?
44 me->setAntiAlias (mainWindow->isAliased());
45 me->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform());
57 QItemSelectionModel* VymView::selectionModel()
62 std::cout <<"VymView::selectionModel: hey, no treeview so far???\n";
67 void VymView::changeSelection (const QItemSelection &, const QItemSelection &)
69 cout << "VymView::changeSelection (newsel,delsel)\n";
70 //treeview->expandAll(); //FIXME only for testing
72 //((VymModel*)treeview->model())->select ();
74 // Show URL and link in statusbar
76 QString s=model->getURL();
77 if (!s.isEmpty() ) status+="URL: "+s+" ";
78 s=model->getVymLink();
79 if (!s.isEmpty() ) status+="Link: "+s;
80 if (!status.isEmpty() ) mainWindow->statusMessage (status);
82 /* FIXME, was so far in BranchObj
84 //updateFlagsToolbar();
89 mainWindow->updateActions();