diff -r fac2248e2afa -r 832e96c9abb6 vymview.cpp --- a/vymview.cpp Mon Mar 08 12:22:15 2010 +0000 +++ b/vymview.cpp Mon Mar 08 12:24:26 2010 +0000 @@ -1,7 +1,6 @@ #include "vymview.h" #include "branchitem.h" -#include "findwidget.h" #include "mainwindow.h" #include "mapeditor.h" #include "treeeditor.h" @@ -13,10 +12,6 @@ { model=m; - // Create findWidget - findWidget=new FindWidget (this); - findWidget->hide(); - // Create TreeView treeEditor=new TreeEditor (model); //treeEditor->setModel ((QAbstractItemModel*)model); @@ -25,10 +20,8 @@ treeEditor->setColumnWidth (0,150); treeEditor->setAnimated (true); - // FIXME-3 use proxySelModel=treeEditor->selectionModel(); selModel=new QItemSelectionModel (model); - //model->setSelectionModel (proxySelModel); model->setSelectionModel (selModel); treeEditor->setSelectionModel (selModel); @@ -37,26 +30,15 @@ if (!mapEditor) mapEditor=new MapEditor (model); // Create Layout - QVBoxLayout* mainLayout = new QVBoxLayout (this); - QSplitter *splitter= new QSplitter; + QVBoxLayout* mainLayout = new QVBoxLayout (this); //FIXME-4 not needed + QSplitter *splitter= new QSplitter (this); QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - //sizePolicy.setHorizontalStretch(0); - //sizePolicy.setVerticalStretch(0); - //sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth()); splitter->setSizePolicy(sizePolicy); mainLayout->addWidget (splitter); - mainLayout->addWidget (findWidget); // Connect selections - // Proxymodel changed - /* - connect ( - proxySelModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), - this,SLOT (changeProxySelection(const QItemSelection &,const QItemSelection &))); -*/ - // Selection in Model changed connect ( selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), @@ -103,19 +85,6 @@ model, SIGNAL (showSelection() ), this, SLOT (showSelection() ) ); - // Find - connect ( - model, SIGNAL (showFindWidget() ), - this, SLOT (showFindWidget() ) ); - - connect ( - findWidget , SIGNAL (hideFindWidget() ), - this, SLOT (hideFindWidget() ) ); - - connect ( - findWidget, SIGNAL (nextButton (QString) ), - this, SLOT (findNext(QString) ) ); - mapEditor->setAntiAlias (mainWindow->isAliased()); mapEditor->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform()); @@ -159,11 +128,6 @@ if (newsel.indexes().count()>0) { - /* FIXME-3 use proxymodel - proxySelModel->select ( - treeEditor->getProxyModel()->mapSelectionFromSource (newsel), - QItemSelectionModel::ClearAndSelect ); - */ QModelIndex ix=newsel.indexes().first(); selModel->setCurrentIndex (ix,QItemSelectionModel::ClearAndSelect ); @@ -173,30 +137,6 @@ } } -void VymView::changeProxySelection (const QItemSelection &newsel, const QItemSelection &) -{ - // Notify mainwindow to update satellites, but map selection to - // original model first - - //cout << "VV::changeProxySelection newsel.count="<setCurrentIndex ( - newsel.indexes().first(), - QItemSelectionModel::ClearAndSelect ); - treeEditor->setCurrentIndex (newsel.indexes().first() ); - } - - // Re-emit but map selection first - selModel->select ( - treeEditor->getProxyModel()->mapSelectionToSource (newsel), - QItemSelectionModel::ClearAndSelect ); - - showSelection(); -} - void VymView::expandAll() { treeEditor->expandAll(); @@ -214,7 +154,6 @@ model->nextBranch(cur,prev); while (cur) { - // FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur)); pix=model->index (cur); d=cur->depth(); if (!treeEditor->isExpanded(pix) && d < level) @@ -228,7 +167,6 @@ model->nextBranch(cur,prev); while (cur) { - // FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur)); pix=model->index (cur); d=cur->depth(); if (!treeEditor->isExpanded(pix) && d <= level && cur->branchCount()>0) @@ -258,7 +196,6 @@ model->nextBranch(cur,prev); while (cur) { - // FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur)); pix=model->index (cur); d=cur->depth(); if (treeEditor->isExpanded(pix) && d > level) @@ -272,7 +209,6 @@ model->nextBranch(cur,prev); while (cur) { - // FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur)); pix=model->index (cur); d=cur->depth(); if (treeEditor->isExpanded(pix) && d >= level) @@ -288,34 +224,6 @@ mapEditor->scrollTo ( ix); // FIXME-3 also called from MapEditor::updateSelection... } -void VymView::showFindWidget() -{ - findWidget->popup(); -} - -void VymView::hideFindWidget() -{ - // findWidget hides itself, but we want to have focus back at mapEditor usually - if (mapEditor) mapEditor->setFocus(); -} - -void VymView::findNext (QString s) -{ - bool cs=false; - BranchItem *bi=model->findText(s, cs); - if (bi) - findWidget->setStatus (FindWidget::Success); - else - findWidget->setStatus (FindWidget::Failed); - -} - -void VymView::findReset() -{ - model->findReset(); - if (mapEditor) mapEditor->setFocus(); -} - void VymView::toggleTreeEditor() { if (treeEditor->isVisible() )