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 model, SIGNAL (newChildObject(QModelIndex) ),
44 this,SLOT (updateChilds (QModelIndex) ) );
46 //me->viewport()->setFocus(); //FIXME needed?
47 me->setAntiAlias (mainWindow->isAliased());
48 me->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform());
60 QItemSelectionModel* VymView::selectionModel()
65 std::cout <<"VymView::selectionModel: hey, no treeview so far???\n";
70 void VymView::updateChilds (QModelIndex ix)
72 treeview->setExpanded (ix,true);
75 void VymView::changeSelection (const QItemSelection &, const QItemSelection &)
77 cout << "VymView::changeSelection (newsel,delsel)\n";
78 //treeview->expandAll(); //FIXME only for testing
80 // Show URL and link in statusbar
82 QString s=model->getURL();
83 if (!s.isEmpty() ) status+="URL: "+s+" ";
84 s=model->getVymLink();
85 if (!s.isEmpty() ) status+="Link: "+s;
86 if (!status.isEmpty() ) mainWindow->statusMessage (status);
88 // Update Toolbar // FIXME, was so far in BranchObj
89 //updateFlagsToolbar();
92 mainWindow->updateActions();