treeeditor.cpp
changeset 788 78ba80b54bc4
parent 769 a6931cd6309a
child 791 f1006de05c54
     1.1 --- a/treeeditor.cpp	Sat Aug 08 21:58:26 2009 +0000
     1.2 +++ b/treeeditor.cpp	Tue Aug 18 12:39:07 2009 +0000
     1.3 @@ -1,35 +1,47 @@
     1.4  #include "treeeditor.h"
     1.5  
     1.6  #include <QAction>
     1.7 +#include <QSortFilterProxyModel>
     1.8 +#include <QRegExp>
     1.9 +
    1.10  #include <iostream>
    1.11  using namespace std;
    1.12  
    1.13  #include "vymmodel.h"
    1.14  
    1.15 +#include "mysortfilterproxymodel.h"
    1.16 +
    1.17  ///////////////////////////////////////////////////////////////////////
    1.18  ///////////////////////////////////////////////////////////////////////
    1.19  TreeEditor::TreeEditor(VymModel *m)
    1.20  {
    1.21 -	//cout << "Constructor TreeEditor "<<this<<endl;
    1.22 -	
    1.23  	model=m;
    1.24  
    1.25 +/*
    1.26 +//	MySortFilterProxyModel *proxyModel = new MySortFilterProxyModel(this);	// FIXME-0 trying to use proxy...
    1.27 +	QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel (this);
    1.28 +
    1.29 +	proxyModel->setSourceModel(model);
    1.30 +
    1.31 +	proxyModel->setFilterRegExp(QRegExp("x", Qt::CaseInsensitive));
    1.32 +	proxyModel->setFilterKeyColumn(0);
    1.33 +	proxyModel->setDynamicSortFilter (true);
    1.34 +//	setModel(proxyModel);
    1.35 +*/
    1.36 +	setModel(model);
    1.37 +
    1.38  	QAction *a;
    1.39  	// Shortcuts for navigating with cursor:
    1.40      a = new QAction(tr( "Select upper object","Tree Editor" ), this);
    1.41  	a->setStatusTip ( tr( "Select upper object" ));
    1.42  	a->setShortcut (Qt::Key_Up );
    1.43 -//	a->setShortcutContext (Qt::WindowShortcut);
    1.44  	a->setShortcutContext (Qt::WidgetShortcut);
    1.45 -//	a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
    1.46  	addAction (a);
    1.47      connect( a, SIGNAL( triggered() ), this, SLOT( cursorUp() ) );
    1.48  
    1.49      a = new QAction( tr( "Select lower object","Tree Editor" ),this);
    1.50  	a->setStatusTip (tr( "Select lower object" ));
    1.51  	a->setShortcut ( Qt::Key_Down );
    1.52 -//	a->setShortcutContext (Qt::WindowShortcut);
    1.53 -//	a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
    1.54  	a->setShortcutContext (Qt::WidgetShortcut);
    1.55  	addAction (a);
    1.56      connect( a, SIGNAL( triggered() ), this, SLOT( cursorDown() ) );