1.1 --- a/vymview.cpp Tue Mar 02 13:59:19 2010 +0000
1.2 +++ b/vymview.cpp Mon Mar 08 12:24:26 2010 +0000
1.3 @@ -1,7 +1,6 @@
1.4 #include "vymview.h"
1.5
1.6 #include "branchitem.h"
1.7 -#include "findwidget.h"
1.8 #include "mainwindow.h"
1.9 #include "mapeditor.h"
1.10 #include "treeeditor.h"
1.11 @@ -13,10 +12,6 @@
1.12 {
1.13 model=m;
1.14
1.15 - // Create findWidget
1.16 - findWidget=new FindWidget (this);
1.17 - findWidget->hide();
1.18 -
1.19 // Create TreeView
1.20 treeEditor=new TreeEditor (model);
1.21 //treeEditor->setModel ((QAbstractItemModel*)model);
1.22 @@ -25,10 +20,8 @@
1.23 treeEditor->setColumnWidth (0,150);
1.24 treeEditor->setAnimated (true);
1.25
1.26 - // FIXME-3 use proxySelModel=treeEditor->selectionModel();
1.27 selModel=new QItemSelectionModel (model);
1.28
1.29 - //model->setSelectionModel (proxySelModel);
1.30 model->setSelectionModel (selModel);
1.31 treeEditor->setSelectionModel (selModel);
1.32
1.33 @@ -37,26 +30,15 @@
1.34 if (!mapEditor) mapEditor=new MapEditor (model);
1.35
1.36 // Create Layout
1.37 - QVBoxLayout* mainLayout = new QVBoxLayout (this);
1.38 - QSplitter *splitter= new QSplitter;
1.39 + QVBoxLayout* mainLayout = new QVBoxLayout (this); //FIXME-4 not needed
1.40 + QSplitter *splitter= new QSplitter (this);
1.41
1.42 QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
1.43 - //sizePolicy.setHorizontalStretch(0);
1.44 - //sizePolicy.setVerticalStretch(0);
1.45 - //sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
1.46 splitter->setSizePolicy(sizePolicy);
1.47 mainLayout->addWidget (splitter);
1.48 - mainLayout->addWidget (findWidget);
1.49
1.50 // Connect selections
1.51
1.52 - // Proxymodel changed
1.53 - /*
1.54 - connect (
1.55 - proxySelModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
1.56 - this,SLOT (changeProxySelection(const QItemSelection &,const QItemSelection &)));
1.57 -*/
1.58 -
1.59 // Selection in Model changed
1.60 connect (
1.61 selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
1.62 @@ -103,19 +85,6 @@
1.63 model, SIGNAL (showSelection() ),
1.64 this, SLOT (showSelection() ) );
1.65
1.66 - // Find
1.67 - connect (
1.68 - model, SIGNAL (showFindWidget() ),
1.69 - this, SLOT (showFindWidget() ) );
1.70 -
1.71 - connect (
1.72 - findWidget , SIGNAL (hideFindWidget() ),
1.73 - this, SLOT (hideFindWidget() ) );
1.74 -
1.75 - connect (
1.76 - findWidget, SIGNAL (nextButton (QString) ),
1.77 - this, SLOT (findNext(QString) ) );
1.78 -
1.79 mapEditor->setAntiAlias (mainWindow->isAliased());
1.80 mapEditor->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform());
1.81
1.82 @@ -159,11 +128,6 @@
1.83 if (newsel.indexes().count()>0)
1.84 {
1.85
1.86 - /* FIXME-3 use proxymodel
1.87 - proxySelModel->select (
1.88 - treeEditor->getProxyModel()->mapSelectionFromSource (newsel),
1.89 - QItemSelectionModel::ClearAndSelect );
1.90 - */
1.91
1.92 QModelIndex ix=newsel.indexes().first();
1.93 selModel->setCurrentIndex (ix,QItemSelectionModel::ClearAndSelect );
1.94 @@ -173,30 +137,6 @@
1.95 }
1.96 }
1.97
1.98 -void VymView::changeProxySelection (const QItemSelection &newsel, const QItemSelection &)
1.99 -{
1.100 - // Notify mainwindow to update satellites, but map selection to
1.101 - // original model first
1.102 -
1.103 - //cout << "VV::changeProxySelection newsel.count="<<newsel.indexes().count()<<endl;
1.104 - if (!newsel.indexes().isEmpty())
1.105 - {
1.106 - /* FIXME-3 need to set current, too
1.107 - */
1.108 - proxySelModel->setCurrentIndex (
1.109 - newsel.indexes().first(),
1.110 - QItemSelectionModel::ClearAndSelect );
1.111 - treeEditor->setCurrentIndex (newsel.indexes().first() );
1.112 - }
1.113 -
1.114 - // Re-emit but map selection first
1.115 - selModel->select (
1.116 - treeEditor->getProxyModel()->mapSelectionToSource (newsel),
1.117 - QItemSelectionModel::ClearAndSelect );
1.118 -
1.119 - showSelection();
1.120 -}
1.121 -
1.122 void VymView::expandAll()
1.123 {
1.124 treeEditor->expandAll();
1.125 @@ -214,7 +154,6 @@
1.126 model->nextBranch(cur,prev);
1.127 while (cur)
1.128 {
1.129 - // FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
1.130 pix=model->index (cur);
1.131 d=cur->depth();
1.132 if (!treeEditor->isExpanded(pix) && d < level)
1.133 @@ -228,7 +167,6 @@
1.134 model->nextBranch(cur,prev);
1.135 while (cur)
1.136 {
1.137 - // FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
1.138 pix=model->index (cur);
1.139 d=cur->depth();
1.140 if (!treeEditor->isExpanded(pix) && d <= level && cur->branchCount()>0)
1.141 @@ -258,7 +196,6 @@
1.142 model->nextBranch(cur,prev);
1.143 while (cur)
1.144 {
1.145 - // FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
1.146 pix=model->index (cur);
1.147 d=cur->depth();
1.148 if (treeEditor->isExpanded(pix) && d > level)
1.149 @@ -272,7 +209,6 @@
1.150 model->nextBranch(cur,prev);
1.151 while (cur)
1.152 {
1.153 - // FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
1.154 pix=model->index (cur);
1.155 d=cur->depth();
1.156 if (treeEditor->isExpanded(pix) && d >= level)
1.157 @@ -288,34 +224,6 @@
1.158 mapEditor->scrollTo ( ix); // FIXME-3 also called from MapEditor::updateSelection...
1.159 }
1.160
1.161 -void VymView::showFindWidget()
1.162 -{
1.163 - findWidget->popup();
1.164 -}
1.165 -
1.166 -void VymView::hideFindWidget()
1.167 -{
1.168 - // findWidget hides itself, but we want to have focus back at mapEditor usually
1.169 - if (mapEditor) mapEditor->setFocus();
1.170 -}
1.171 -
1.172 -void VymView::findNext (QString s)
1.173 -{
1.174 - bool cs=false;
1.175 - BranchItem *bi=model->findText(s, cs);
1.176 - if (bi)
1.177 - findWidget->setStatus (FindWidget::Success);
1.178 - else
1.179 - findWidget->setStatus (FindWidget::Failed);
1.180 -
1.181 -}
1.182 -
1.183 -void VymView::findReset()
1.184 -{
1.185 - model->findReset();
1.186 - if (mapEditor) mapEditor->setFocus();
1.187 -}
1.188 -
1.189 void VymView::toggleTreeEditor()
1.190 {
1.191 if (treeEditor->isVisible() )