1.1 --- a/branchitem.cpp Thu May 14 12:42:58 2009 +0000
1.2 +++ b/branchitem.cpp Fri May 15 15:22:15 2009 +0000
1.3 @@ -47,7 +47,6 @@
1.4
1.5 QString BranchItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) //FIXME-1
1.6 {
1.7 - cout << "BI::saveToDir: "<<getHeadingStd()<<endl;
1.8 // Cloudy stuff can be hidden during exports
1.9 if (hidden) return QString();
1.10
1.11 @@ -55,7 +54,6 @@
1.12 BranchObj *bo=(BranchObj*)lmo;
1.13
1.14 // Update of note is usually done while unselecting a branch
1.15 - // if (isNoteInEditor) getNoteFromTextEditor(); // FIXME-0 check that this still works...
1.16
1.17 QString scrolledAttr;
1.18 if (scrolled)
2.1 --- a/mainwindow.cpp Thu May 14 12:42:58 2009 +0000
2.2 +++ b/mainwindow.cpp Fri May 15 15:22:15 2009 +0000
2.3 @@ -228,6 +228,7 @@
2.4 restoreState (settings.value("/mainwindow/state",0).toByteArray());
2.5
2.6 updateGeometry();
2.7 +
2.8 }
2.9
2.10 Main::~Main()
2.11 @@ -882,52 +883,6 @@
2.12 actionListBranches.append(a);
2.13 actionDeleteChildren=a;
2.14
2.15 - // Shortcuts for navigating with cursor:
2.16 - a = new QAction(tr( "Select upper branch","Edit menu" ), this);
2.17 - a->setStatusTip ( tr( "Select upper branch" ));
2.18 - a->setShortcut (Qt::Key_Up );
2.19 - a->setShortcutContext (Qt::WindowShortcut);
2.20 - addAction (a);
2.21 - connect( a, SIGNAL( triggered() ), this, SLOT( editUpperBranch() ) );
2.22 - a = new QAction( tr( "Select lower branch","Edit menu" ),this);
2.23 - a->setStatusTip (tr( "Select lower branch" ));
2.24 - a->setShortcut ( Qt::Key_Down );
2.25 - a->setShortcutContext (Qt::WindowShortcut);
2.26 - addAction (a);
2.27 - connect( a, SIGNAL( triggered() ), this, SLOT( editLowerBranch() ) );
2.28 - a = new QAction(tr( "Select left branch","Edit menu" ), this);
2.29 - a->setStatusTip ( tr( "Select left branch" ));
2.30 - a->setShortcut (Qt::Key_Left );
2.31 - a->setShortcutContext (Qt::WindowShortcut);
2.32 - addAction (a);
2.33 - connect( a, SIGNAL( triggered() ), this, SLOT( editLeftBranch() ) );
2.34 - a = new QAction( tr( "Select child branch","Edit menu" ), this);
2.35 - a->setStatusTip (tr( "Select right branch" ));
2.36 - a->setShortcut (Qt::Key_Right);
2.37 - a->setShortcutContext (Qt::WindowShortcut);
2.38 - addAction (a);
2.39 - connect( a, SIGNAL( triggered() ), this, SLOT( editRightBranch() ) );
2.40 - a = new QAction( tr( "Select first branch","Edit menu" ), this);
2.41 - a->setStatusTip (tr( "Select first branch" ));
2.42 - a->setShortcut (Qt::Key_Home );
2.43 - a->setShortcutContext (Qt::WindowShortcut);
2.44 - addAction (a);
2.45 - a->setEnabled (false);
2.46 - editMenu->addAction (a);
2.47 - actionListBranches.append(a);
2.48 - actionSelectFirst=a;
2.49 - connect( a, SIGNAL( triggered() ), this, SLOT( editFirstBranch() ) );
2.50 - a = new QAction( tr( "Select last branch","Edit menu" ),this);
2.51 - a->setStatusTip (tr( "Select last branch" ));
2.52 - a->setShortcut ( Qt::Key_End );
2.53 - a->setShortcutContext (Qt::WindowShortcut);
2.54 - addAction (a);
2.55 - connect( a, SIGNAL( triggered() ), this, SLOT( editLastBranch() ) );
2.56 - a->setEnabled (false);
2.57 - editMenu->addAction (a);
2.58 - actionListBranches.append(a);
2.59 - actionSelectLast=a;
2.60 -
2.61 a = new QAction( tr( "Add Image...","Edit menu" ), this);
2.62 a->setStatusTip (tr( "Add Image" ));
2.63 connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) );
2.64 @@ -1766,24 +1721,19 @@
2.65 updateActions();
2.66 }
2.67
2.68 -VymView *Main::createView (VymModel *model)
2.69 -{
2.70 - VymView *vm=new VymView (model);
2.71 - return vm;
2.72 -}
2.73 -
2.74 void Main::fileNew()
2.75 {
2.76 - VymModel *m=new VymModel;
2.77 - tabModel.append (m);
2.78 - //MapEditor* me = new MapEditor (m);
2.79 - //me->setObjectName ("MapEditor");
2.80 -
2.81 - tabWidget->addTab (createView (m),tr("unnamed","MainWindow: name for new and empty file"));
2.82 + VymModel *vm=new VymModel;
2.83 + tabModel.append (vm);
2.84 +
2.85 + VymView *vv=new VymView (vm);
2.86 + tabWidget->addTab (vv,tr("unnamed","MainWindow: name for new and empty file"));
2.87 tabWidget->setCurrentIndex (tabModel.count() );
2.88 + vv->initFocus();
2.89 +
2.90
2.91 // For the very first map we do not have flagrows yet...
2.92 - m->select("mc:");
2.93 + vm->select("mc:");
2.94 }
2.95
2.96 void Main::fileNewCopy()
2.97 @@ -1860,10 +1810,12 @@
2.98 if ( lmode==NewMap && (!vm || !vm->isDefault() ) )
2.99 {
2.100 vm=new VymModel;
2.101 + VymView *vv=new VymView (vm);
2.102 tabModel.append (vm);
2.103 - tabWidget->addTab (createView (vm),fn);
2.104 + tabWidget->addTab (vv,fn);
2.105 tabIndex=tabWidget->count()-1;
2.106 tabWidget->setCurrentPage (tabIndex);
2.107 + vv->initFocus();
2.108 }
2.109
2.110 // Check, if file exists (important for creating new files
2.111 @@ -2965,43 +2917,6 @@
2.112 m->deleteSelection();
2.113 }
2.114
2.115 -void Main::editUpperBranch()
2.116 -{
2.117 - VymModel *m=currentModel();
2.118 - if (m) m->selectUpperBranch(); // FIXME-3 check also lower... this probably should go into view...
2.119 -}
2.120 -
2.121 -void Main::editLowerBranch() // FIXME-3 check also lower... this probably should go into view...
2.122 -
2.123 -{
2.124 - VymModel *m=currentModel();
2.125 - if (m) m->selectLowerBranch();
2.126 -}
2.127 -
2.128 -void Main::editLeftBranch()
2.129 -{
2.130 - VymModel *m=currentModel();
2.131 - if (m) m->selectLeftBranch();
2.132 -}
2.133 -
2.134 -void Main::editRightBranch()
2.135 -{
2.136 - VymModel *m=currentModel();
2.137 - if (m) m->selectRightBranch();
2.138 -}
2.139 -
2.140 -void Main::editFirstBranch()
2.141 -{
2.142 - VymModel *m=currentModel();
2.143 - if (m) m->selectFirstBranch();
2.144 -}
2.145 -
2.146 -void Main::editLastBranch()
2.147 -{
2.148 - VymModel *m=currentModel();
2.149 - if (m) m->selectLastBranch();
2.150 -}
2.151 -
2.152 void Main::editLoadImage()
2.153 {
2.154 VymModel *m=currentModel();
2.155 @@ -3693,14 +3608,13 @@
2.156 void Main::testFunction1()
2.157 {
2.158 if (!currentMapEditor()) return;
2.159 - currentMapEditor()->testFunction1();
2.160 - //editAttribute();
2.161 + currentMapEditor()->testFunction1();
2.162 }
2.163
2.164 void Main::testFunction2()
2.165 {
2.166 if (!currentMapEditor()) return;
2.167 - currentMapEditor()->testFunction2();
2.168 + currentMapEditor()->setFocus();
2.169 }
2.170
2.171 void Main::testCommand()
3.1 --- a/mainwindow.h Thu May 14 12:42:58 2009 +0000
3.2 +++ b/mainwindow.h Fri May 15 15:22:15 2009 +0000
3.3 @@ -42,9 +42,6 @@
3.4 void setProgressValue (int v);
3.5 void removeProgressBar();
3.6
3.7 -private:
3.8 - VymView* createView (VymModel*);
3.9 -
3.10 public slots:
3.11 void fileNew();
3.12 void fileNewCopy();
3.13 @@ -159,12 +156,6 @@
3.14 void editDeleteKeepChildren();
3.15 void editDeleteChildren();
3.16 void editDeleteSelection();
3.17 - void editUpperBranch();
3.18 - void editLowerBranch();
3.19 - void editLeftBranch();
3.20 - void editRightBranch();
3.21 - void editFirstBranch();
3.22 - void editLastBranch();
3.23 void editLoadImage();
3.24 void editSaveImage();
3.25 void editFollowXLink (QAction *);
3.26 @@ -317,8 +308,6 @@
3.27 QAction *actionImportAdd;
3.28 QAction *actionImportReplace;
3.29 QAction *actionSaveBranch;
3.30 - QAction *actionSelectFirst;
3.31 - QAction *actionSelectLast;
3.32 QAction *actionLoadImage;
3.33
3.34 QAction* actionFormatColor;
4.1 --- a/mapcenteritem.cpp Thu May 14 12:42:58 2009 +0000
4.2 +++ b/mapcenteritem.cpp Fri May 15 15:22:15 2009 +0000
4.3 @@ -17,24 +17,19 @@
4.4
4.5 QString MapCenterItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) //FIXME-1
4.6 {
4.7 - cout << "MCI::saveToDir: "<<getHeadingStd()<<endl;
4.8 -
4.9 // Cloudy stuff can be hidden during exports
4.10 if (hidden) return QString();
4.11
4.12 QString s,a;
4.13 BranchObj *bo=(BranchObj*)lmo;
4.14
4.15 - /*
4.16 - // Update of note is usually done while unselecting a branch
4.17 - if (isNoteInEditor) getNoteFromTextEditor();
4.18 -
4.19 QString scrolledAttr;
4.20 if (scrolled)
4.21 scrolledAttr=attribut ("scrolled","yes");
4.22 else
4.23 scrolledAttr="";
4.24
4.25 + /*
4.26 // save area, if not scrolled
4.27 QString areaAttr;
4.28 if (!((BranchObj*)(parObj))->isScrolled() )
4.29 @@ -59,7 +54,7 @@
4.30 s=beginElement ("mapcenter"
4.31 +getAttr()
4.32 // +getOrnXMLAttr()
4.33 - // +scrolledAttr
4.34 + +scrolledAttr
4.35 // +areaAttr
4.36 // +idAttr
4.37 // +getIncludeImageAttr()
5.1 --- a/mapeditor.cpp Thu May 14 12:42:58 2009 +0000
5.2 +++ b/mapeditor.cpp Fri May 15 15:22:15 2009 +0000
5.3 @@ -45,7 +45,6 @@
5.4 model=vm;
5.5 model->setScene (mapScene);
5.6 model->registerEditor(this);
5.7 -// model->addMapCenter(); // FIXME-3 create this in MapEditor until BO and MCO are independent of scene
5.8 model->makeDefault(); // No changes in model so far
5.9
5.10 setScene (mapScene);
5.11 @@ -58,7 +57,7 @@
5.12 CopyCursor=QCursor ( QPixmap(iconPath+"cursorcopy.png"), 1,1 );
5.13 XLinkCursor=QCursor ( QPixmap(iconPath+"cursorxlink.png"), 1,7 );
5.14
5.15 - setFocusPolicy (Qt::StrongFocus);
5.16 + //setFocusPolicy (Qt::StrongFocus); //FIXME-3
5.17
5.18 pickingColor=false;
5.19 drawingLink=false;
5.20 @@ -75,6 +74,45 @@
5.21 //model->reposition(); //FIXME-3 really still needed?
5.22
5.23
5.24 + // Shortcuts and actions
5.25 + QAction *a;
5.26 + a = new QAction("Select upper branch", this);
5.27 + a->setShortcut (Qt::Key_Up );
5.28 + a->setShortcutContext (Qt::WidgetShortcut);
5.29 + addAction (a);
5.30 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorUp() ) );
5.31 +
5.32 + a = new QAction( "Select lower branch",this);
5.33 + a->setShortcut ( Qt::Key_Down );
5.34 + a->setShortcutContext (Qt::WidgetShortcut);
5.35 + addAction (a);
5.36 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorDown() ) );
5.37 +
5.38 + a = new QAction( "Select left branch", this);
5.39 + a->setShortcut (Qt::Key_Left );
5.40 +// a->setShortcutContext (Qt::WindowShortcut);
5.41 + a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
5.42 + addAction (a);
5.43 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorLeft() ) );
5.44 +
5.45 + a = new QAction( "Select child branch", this);
5.46 + a->setShortcut (Qt::Key_Right);
5.47 + a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
5.48 + addAction (a);
5.49 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorRight() ) );
5.50 +
5.51 + a = new QAction( "Select first branch", this);
5.52 + a->setShortcut (Qt::Key_Home );
5.53 + a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
5.54 + addAction (a);
5.55 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorFirst() ) );
5.56 +
5.57 + a = new QAction( "Select last branch",this);
5.58 + a->setShortcut ( Qt::Key_End );
5.59 + a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
5.60 + addAction (a);
5.61 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorLast() ) );
5.62 +
5.63 // Action to embed LineEdit for heading in Scene
5.64 editingHeading=false;
5.65 lineEdit=new QLineEdit;
5.66 @@ -82,7 +120,7 @@
5.67 QGraphicsProxyWidget *pw=scene()->addWidget (lineEdit);
5.68 pw->setZValue (100);
5.69
5.70 - QAction *a = new QAction( tr( "Edit heading","MapEditor" ), this);
5.71 + a = new QAction( tr( "Edit heading","MapEditor" ), this);
5.72 a->setShortcut ( Qt::Key_Return ); //Edit heading
5.73 addAction (a);
5.74 connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
5.75 @@ -131,10 +169,6 @@
5.76 MapEditor::~MapEditor()
5.77 {
5.78 //cout <<"Destructor MapEditor for "<<model->getMapName().toStdString()<<endl;
5.79 - // No need to remove tmp files:
5.80 - // tmpMapDir is in tmpVymDir,
5.81 - // so it gets removed automagically when vym closes
5.82 -
5.83 model->unregisterEditor(this);
5.84 }
5.85
5.86 @@ -476,6 +510,38 @@
5.87 */
5.88 }
5.89
5.90 +void MapEditor::cursorUp()
5.91 +{
5.92 + model->selectUpperBranch();
5.93 +}
5.94 +
5.95 +void MapEditor::cursorDown()
5.96 +
5.97 +{
5.98 + model->selectLowerBranch();
5.99 +}
5.100 +
5.101 +void MapEditor::cursorLeft()
5.102 +{
5.103 + model->selectLeftBranch();
5.104 +}
5.105 +
5.106 +void MapEditor::cursorRight()
5.107 +{
5.108 + model->selectRightBranch();
5.109 +}
5.110 +
5.111 +void MapEditor::cursorFirst()
5.112 +{
5.113 + model->selectFirstBranch();
5.114 +}
5.115 +
5.116 +void MapEditor::cursorLast()
5.117 +{
5.118 + model->selectLastBranch();
5.119 +}
5.120 +
5.121 +
5.122 void MapEditor::editHeading()
5.123 {
5.124 if (editingHeading)
6.1 --- a/mapeditor.h Thu May 14 12:42:58 2009 +0000
6.2 +++ b/mapeditor.h Fri May 15 15:22:15 2009 +0000
6.3 @@ -58,6 +58,12 @@
6.4 void testFunction2(); // just testing new stuff
6.5
6.6 public slots:
6.7 + void cursorUp();
6.8 + void cursorDown();
6.9 + void cursorLeft();
6.10 + void cursorRight();
6.11 + void cursorFirst();
6.12 + void cursorLast();
6.13 void editHeading();
6.14 void editHeadingFinished();
6.15 private:
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/treeeditor.cpp Fri May 15 15:22:15 2009 +0000
7.3 @@ -0,0 +1,52 @@
7.4 +#include "treeeditor.h"
7.5 +
7.6 +#include <QAction>
7.7 +#include <iostream>
7.8 +using namespace std;
7.9 +
7.10 +#include "vymmodel.h"
7.11 +
7.12 +///////////////////////////////////////////////////////////////////////
7.13 +///////////////////////////////////////////////////////////////////////
7.14 +TreeEditor::TreeEditor(VymModel *m)
7.15 +{
7.16 + //cout << "Constructor TreeEditor "<<this<<endl;
7.17 +
7.18 + model=m;
7.19 +
7.20 + QAction *a;
7.21 + // Shortcuts for navigating with cursor:
7.22 + a = new QAction(tr( "Select upper object","Tree Editor" ), this);
7.23 + a->setStatusTip ( tr( "Select upper object" ));
7.24 + a->setShortcut (Qt::Key_Up );
7.25 +// a->setShortcutContext (Qt::WindowShortcut);
7.26 + a->setShortcutContext (Qt::WidgetShortcut);
7.27 +// a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
7.28 + addAction (a);
7.29 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorUp() ) );
7.30 +
7.31 + a = new QAction( tr( "Select lower object","Tree Editor" ),this);
7.32 + a->setStatusTip (tr( "Select lower object" ));
7.33 + a->setShortcut ( Qt::Key_Down );
7.34 +// a->setShortcutContext (Qt::WindowShortcut);
7.35 +// a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
7.36 + a->setShortcutContext (Qt::WidgetShortcut);
7.37 + addAction (a);
7.38 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorDown() ) );
7.39 +}
7.40 +
7.41 +TreeEditor::~TreeEditor()
7.42 +{
7.43 + //cout <<"Destructor TreeEditor for "<<model->getMapName().toStdString()<<endl;
7.44 +}
7.45 +
7.46 +void TreeEditor::cursorUp()
7.47 +{
7.48 + model->select (indexAbove (model->getSelectedIndex() ));
7.49 +}
7.50 +
7.51 +void TreeEditor::cursorDown()
7.52 +{
7.53 + model->select (indexBelow (model->getSelectedIndex() ));
7.54 +}
7.55 +
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/treeeditor.h Fri May 15 15:22:15 2009 +0000
8.3 @@ -0,0 +1,28 @@
8.4 +#ifndef TREEEDITOR_H
8.5 +#define TREEEDITOR_H
8.6 +
8.7 +#include <QTreeView>
8.8 +
8.9 +class VymModel;
8.10 +
8.11 +/*! \brief TreeView widget in vym to display and edit a map, based on
8.12 + * QTreeView */
8.13 +
8.14 +
8.15 +class TreeEditor : public QTreeView {
8.16 + Q_OBJECT
8.17 +
8.18 +public:
8.19 + TreeEditor(VymModel *m);
8.20 + ~TreeEditor();
8.21 +
8.22 +private slots:
8.23 + void cursorUp();
8.24 + void cursorDown();
8.25 +
8.26 +private:
8.27 + VymModel *model;
8.28 +};
8.29 +
8.30 +#endif
8.31 +
9.1 --- a/version.h Thu May 14 12:42:58 2009 +0000
9.2 +++ b/version.h Fri May 15 15:22:15 2009 +0000
9.3 @@ -7,7 +7,7 @@
9.4 #define __VYM_VERSION "1.13.0"
9.5 //#define __VYM_CODENAME "Codename: RC-1"
9.6 #define __VYM_CODENAME "Codename: development version, not for production!"
9.7 -#define __VYM_BUILD_DATE "2009-05-13"
9.8 +#define __VYM_BUILD_DATE "2009-05-15"
9.9
9.10
9.11 bool checkVersion(const QString &);
10.1 --- a/vym.pro Thu May 14 12:42:58 2009 +0000
10.2 +++ b/vym.pro Fri May 15 15:22:15 2009 +0000
10.3 @@ -78,6 +78,7 @@
10.4 showtextdialog.h\
10.5 simplescripteditor.h\
10.6 texteditor.h \
10.7 + treeeditor.h \
10.8 version.h \
10.9 vymmodel.h \
10.10 xlinkobj.h \
10.11 @@ -140,6 +141,7 @@
10.12 showtextdialog.cpp \
10.13 simplescripteditor.cpp \
10.14 texteditor.cpp \
10.15 + treeeditor.cpp \
10.16 treeitem.cpp \
10.17 treemodel.cpp \
10.18 version.cpp \
11.1 --- a/vymmodel.cpp Thu May 14 12:42:58 2009 +0000
11.2 +++ b/vymmodel.cpp Fri May 15 15:22:15 2009 +0000
11.3 @@ -238,7 +238,6 @@
11.4 // TODO constr. of FIO creates lots of objects, better do this in some other way...
11.5 FloatImageObj (mapScene).resetSaveCounter();// FIXME-2 this can be done local to vymmodel maybe...
11.6
11.7 - cout << "VM::saveToDir 0 " <<saveSel<<endl;
11.8 // Build xml recursivly
11.9 if (!saveSel || saveSel->getType()==TreeItem::MapCenter)
11.10 // Save all mapcenters as complete map, if saveSel not set
11.11 @@ -2211,7 +2210,6 @@
11.12 {
11.13 if (branch && dst)
11.14 {
11.15 - cout << "VM::relinkBranch "<<branch->getHeadingStd()<<" to "<<dst->getHeadingStd()<<" at "<<pos<<endl;
11.16 emit (layoutAboutToBeChanged() );
11.17 BranchItem *branchpi=(BranchItem*)branch->parent();
11.18 // Remove at current position
11.19 @@ -4603,11 +4601,16 @@
11.20
11.21 bool VymModel::select (TreeItem *ti)
11.22 {
11.23 - if (ti)
11.24 + if (ti) return select (index(ti));
11.25 + return false;
11.26 +}
11.27 +
11.28 +bool VymModel::select (const QModelIndex &index)
11.29 +{
11.30 + if (index.isValid() )
11.31 {
11.32 - QModelIndex ix=index(ti);
11.33 - selModel->select (ix,QItemSelectionModel::ClearAndSelect );
11.34 - ti->setLastSelectedBranch();
11.35 + selModel->select (index,QItemSelectionModel::ClearAndSelect );
11.36 + getSelectedItem()->setLastSelectedBranch();
11.37 return true;
11.38 }
11.39 return false;
12.1 --- a/vymmodel.h Thu May 14 12:42:58 2009 +0000
12.2 +++ b/vymmodel.h Fri May 15 15:22:15 2009 +0000
12.3 @@ -552,10 +552,11 @@
12.4 void setSelectionBlocked(bool);
12.5 bool isSelectionBlocked();
12.6
12.7 - bool select (); // select by using common QItemSlectionModel
12.8 - bool select (const QString &); // Select by string
12.9 - bool select (LinkableMapObj *lmo); // Select by pointer tog LMO
12.10 - bool select (TreeItem *ti ); // Select by point to TreeItem
12.11 + bool select (); //! select by using common QItemSelectionModel
12.12 + bool select (const QString &); //! Select by string
12.13 + bool select (LinkableMapObj *lmo); //! Select by pointer to LMO
12.14 + bool select (TreeItem *ti ); //! Select by pointer to TreeItem
12.15 + bool select (const QModelIndex &index); //! Select by ModelIndex
12.16 void unselect();
12.17 void reselect();
12.18
13.1 --- a/vymview.cpp Thu May 14 12:42:58 2009 +0000
13.2 +++ b/vymview.cpp Fri May 15 15:22:15 2009 +0000
13.3 @@ -6,6 +6,7 @@
13.4 #include "linkablemapobj.h"
13.5 #include "mainwindow.h"
13.6 #include "mapeditor.h"
13.7 +#include "treeeditor.h"
13.8
13.9 extern Main *mainWindow;
13.10
13.11 @@ -15,13 +16,13 @@
13.12 model=m;
13.13
13.14 // Create TreeView
13.15 - treeview=new QTreeView;
13.16 - treeview->setModel ((QAbstractItemModel*)model);
13.17 - //treeview->setMinimumWidth (50);
13.18 + treeEditor=new TreeEditor (model);
13.19 + treeEditor->setModel ((QAbstractItemModel*)model);
13.20 + //treeEditor->setMinimumWidth (50);
13.21
13.22 - treeview->setColumnWidth (0,350);
13.23 + treeEditor->setColumnWidth (0,350);
13.24
13.25 - selModel=treeview->selectionModel();
13.26 + selModel=treeEditor->selectionModel();
13.27 model->setSelectionModel (selModel);
13.28 connect (
13.29 selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
13.30 @@ -62,11 +63,10 @@
13.31 this, SLOT (showSelection() ) );
13.32
13.33
13.34 - //mapEditor->viewport()->setFocus(); //FIXmapEditor-3 needed?
13.35 mapEditor->setAntiAlias (mainWindow->isAliased());
13.36 mapEditor->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform());
13.37
13.38 - addWidget (treeview);
13.39 + addWidget (treeEditor);
13.40 addWidget (mapEditor);
13.41
13.42 // Set geometry
13.43 @@ -76,12 +76,17 @@
13.44 setSizes(widths);
13.45 }
13.46
13.47 +void VymView::initFocus()
13.48 +{
13.49 + mapEditor->setFocus();
13.50 +}
13.51 +
13.52 QItemSelectionModel* VymView::selectionModel()
13.53 {
13.54 - if (treeview)
13.55 + if (treeEditor)
13.56 return selModel;
13.57 else
13.58 - std::cout <<"VymView::selectionModel: hey, no treeview so far???\n";
13.59 + std::cout <<"VymView::selectionModel: hey, no treeEditor so far???\n";
13.60 return NULL;
13.61 }
13.62
13.63 @@ -104,12 +109,12 @@
13.64
13.65 void VymView::expandAll()
13.66 {
13.67 - treeview->expandAll();
13.68 + treeEditor->expandAll();
13.69 }
13.70
13.71 void VymView::showSelection()
13.72 {
13.73 - treeview->scrollTo(
13.74 + treeEditor->scrollTo(
13.75 model->getSelectedIndex(),
13.76 //QAbstractItemView::PositionAtCenter
13.77 QAbstractItemView::EnsureVisible
14.1 --- a/vymview.h Thu May 14 12:42:58 2009 +0000
14.2 +++ b/vymview.h Fri May 15 15:22:15 2009 +0000
14.3 @@ -3,10 +3,11 @@
14.4
14.5 #include <QItemSelectionModel>
14.6 #include <QSplitter>
14.7 -#include <QTreeView>
14.8 +
14.9
14.10 class VymModel;
14.11 class MapEditor;
14.12 +class TreeEditor;
14.13
14.14
14.15 class VymView : public QSplitter
14.16 @@ -14,6 +15,7 @@
14.17 Q_OBJECT
14.18 public:
14.19 VymView(VymModel *model);
14.20 + void initFocus();
14.21 QItemSelectionModel* selectionModel();
14.22
14.23 public slots:
14.24 @@ -23,7 +25,7 @@
14.25
14.26 private:
14.27 VymModel *model;
14.28 - QTreeView *treeview;
14.29 + TreeEditor *treeEditor;
14.30 QItemSelectionModel *selModel;
14.31 MapEditor *mapEditor;
14.32 };