From a08314bfd4d999ea8b81d3b257462ae78ef032c4 Mon Sep 17 00:00:00 2001 From: stv Date: Tue, 7 Jun 2005 05:11:43 +0000 Subject: [PATCH] Some functions for columns management were added. --- src/ObjBrowser/OB_Browser.cxx | 36 ++++++++++++++++++++++++++++++----- src/ObjBrowser/OB_Browser.h | 2 ++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/ObjBrowser/OB_Browser.cxx b/src/ObjBrowser/OB_Browser.cxx index fe451d4b1..286eed874 100755 --- a/src/ObjBrowser/OB_Browser.cxx +++ b/src/ObjBrowser/OB_Browser.cxx @@ -430,7 +430,7 @@ void OB_Browser::setColumnTitle( const int id, const QIconSet& icon, const QStri bool OB_Browser::isColumnVisible( const int id ) const { - myColumnIds.contains( id ) && myView->isShown( myColumnIds[id] ); + return myColumnIds.contains( id ) && myView->isShown( myColumnIds[id] ); } void OB_Browser::setColumnShown( const int id, const bool on ) @@ -441,6 +441,14 @@ void OB_Browser::setColumnShown( const int id, const bool on ) myView->setShown( myColumnIds[id], on ); } +QValueList OB_Browser::columns() const +{ + QValueList lst; + for ( QMap::ConstIterator it = myColumnIds.begin(); it != myColumnIds.end(); ++it ) + lst.append( it.key() ); + return lst; +} + void OB_Browser::updateTree( SUIT_DataObject* o ) { updateTree( o ? o : getRootObject(), false ); @@ -460,7 +468,12 @@ void OB_Browser::updateTree( SUIT_DataObject* obj, const bool notify ) SUIT_DataObject* curObj = storeState( selObjs, openObjs, selKeys, openKeys, curKey ); if ( notify ) + { + bool upd = isAutoUpdate(); + setAutoUpdate( false ); emit aboutRefresh(); + setAutoUpdate( upd ); + } createConnections( obj ); updateView( obj ); @@ -887,14 +900,27 @@ void OB_Browser::updateText( QListViewItem* item ) item->setText( it.data(), obj->text( it.key() ) ); } -bool OB_Browser::eventFilter(QObject* watched, QEvent* e) +bool OB_Browser::eventFilter( QObject* o, QEvent* e ) { - if ( watched == myView && e->type() == QEvent::ContextMenu ) + if ( o == myView && e->type() == QEvent::ContextMenu ) { - contextMenuRequest( (QContextMenuEvent*)e ); + QContextMenuEvent* ce = (QContextMenuEvent*)e; + if ( ce->reason() != QContextMenuEvent::Mouse ) + contextMenuRequest( ce ); return true; } - return QFrame::eventFilter(watched, e); + if ( o == myView && e->type() == QEvent::MouseButtonRelease ) + { + QMouseEvent* me = (QMouseEvent*)e; + if ( me->button() == RightButton ) + { + QContextMenuEvent ce( QContextMenuEvent::Mouse, me->pos(), me->globalPos(), me->state() ); + contextMenuRequest( &ce ); + return true; + } + } + + return QFrame::eventFilter( o, e ); } void OB_Browser::contextMenuPopup( QPopupMenu* menu ) diff --git a/src/ObjBrowser/OB_Browser.h b/src/ObjBrowser/OB_Browser.h index 2534a0d96..c1cf4ef5f 100755 --- a/src/ObjBrowser/OB_Browser.h +++ b/src/ObjBrowser/OB_Browser.h @@ -83,6 +83,8 @@ public: bool isColumnVisible( const int ) const; virtual void setColumnShown( const int, const bool ); + QValueList columns() const; + virtual bool eventFilter(QObject* watched, QEvent* e); QListView* listView() const; -- 2.39.2