1.1 --- a/vymview.cpp Wed Nov 25 10:58:21 2009 +0000
1.2 +++ b/vymview.cpp Wed Nov 25 15:27:22 2009 +0000
1.3 @@ -4,6 +4,7 @@
1.4 using namespace std;
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 @@ -15,6 +16,9 @@
1.12 {
1.13 model=m;
1.14
1.15 + // Create findWidget
1.16 + findWidget=new FindWidget (this);
1.17 +
1.18 // Create TreeView
1.19 treeEditor=new TreeEditor (model);
1.20 //treeEditor->setModel ((QAbstractItemModel*)model);
1.21 @@ -34,6 +38,18 @@
1.22 mapEditor=model->getMapEditor();
1.23 if (!mapEditor) mapEditor=new MapEditor (model);
1.24
1.25 + // Create Layout
1.26 + QVBoxLayout* mainLayout = new QVBoxLayout (this);
1.27 + QSplitter *splitter= new QSplitter;
1.28 +
1.29 + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
1.30 + //sizePolicy.setHorizontalStretch(0);
1.31 + //sizePolicy.setVerticalStretch(0);
1.32 + //sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
1.33 + splitter->setSizePolicy(sizePolicy);
1.34 + mainLayout->addWidget (splitter);
1.35 + mainLayout->addWidget (findWidget);
1.36 +
1.37 // Connect selections
1.38
1.39 // Proxymodel changed
1.40 @@ -89,18 +105,27 @@
1.41 model, SIGNAL (showSelection() ),
1.42 this, SLOT (showSelection() ) );
1.43
1.44 + // Find
1.45 + connect (
1.46 + model, SIGNAL (showFindWidget() ),
1.47 + this, SLOT (showFindWidget() ) );
1.48 +
1.49 + connect (
1.50 + findWidget, SIGNAL (nextButton (QString) ),
1.51 + this, SLOT (findNext(QString) ) );
1.52 +
1.53
1.54 mapEditor->setAntiAlias (mainWindow->isAliased());
1.55 mapEditor->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform());
1.56
1.57 - addWidget (treeEditor);
1.58 - addWidget (mapEditor);
1.59 + splitter->addWidget (treeEditor);
1.60 + splitter->addWidget (mapEditor);
1.61
1.62 // Set geometry
1.63 QList <int> widths;
1.64 widths<<200;
1.65 widths<<600;
1.66 - setSizes(widths);
1.67 + splitter->setSizes(widths);
1.68 }
1.69
1.70 VymView::~VymView()
1.71 @@ -262,3 +287,24 @@
1.72 mapEditor->scrollTo ( ix); // FIXME-3 also called from MapEditor::updateSelection...
1.73 }
1.74
1.75 +void VymView::showFindWidget()
1.76 +{
1.77 + findWidget->show();
1.78 +}
1.79 +
1.80 +void VymView::findNext (QString s)
1.81 +{
1.82 + bool cs=false;
1.83 + BranchItem *bi=model->findText(s, cs);
1.84 + if (bi)
1.85 + {
1.86 + //statusBar()->message( "Found: " + bi->getHeading(), statusbarTime );
1.87 + cout << "VV::Found!\n";
1.88 + } else
1.89 + {
1.90 + cout << "VV::Nothing found!\n";
1.91 + //QMessageBox::information( findWindow, tr( "VYM -Information:" ),
1.92 + // tr("No matches found for \"%1\"").arg(s));
1.93 + }
1.94 +
1.95 +}