void OB_Browser::contextMenuPopup( QPopupMenu* menu )
{
- QValueList<int> cols;
+/* QValueList<int> cols;
for ( QMap<int, int>::ConstIterator it = myColumnIds.begin(); it != myColumnIds.end(); ++it )
{
if ( appropriateColumn( it.key() ) )
menu->setItemParameter( id, *iter );
}
if ( menu->count() != num )
- menu->insertSeparator();
+ menu->insertSeparator();*/
DataObjectList selected;
getSelected( selected );
myButton = but;
connect( myButton, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
-
- myPopup = new QPopupMenu( this );
- connect( myPopup, SIGNAL( activated( int ) ), this, SLOT( onShowHide( int ) ) );
+ }
+ else
+ {
+ header()->installEventFilter( this );
}
+ myPopup = new QPopupMenu( this );
+ connect( myPopup, SIGNAL( activated( int ) ), this, SLOT( onShowHide( int ) ) );
connect( header(), SIGNAL( sizeChange( int, int, int ) ), this, SLOT( onHeaderResized() ) );
}
}
}
-void QtxListView::onButtonClicked()
+void QtxListView::showPopup( const int x, const int y )
{
- if ( myHeaderState != HeaderButton )
- return;
-
myPopup->clear();
for ( int i = 0; i < columns(); i++ )
{
myPopup->setItemChecked( id, isShown( i ) );
}
}
- int x = myButton->x(),
- y = myButton->y() + myButton->height();
- if ( myPopup->count() )
+
+ if( myPopup->count() )
myPopup->exec( mapToGlobal( QPoint( x, y ) ) );
}
-void QtxListView::onShowHide( int id )
+void QtxListView::onButtonClicked()
{
if ( myHeaderState != HeaderButton )
return;
+ int x = myButton->x(),
+ y = myButton->y() + myButton->height();
+
+ showPopup( x, y );
+}
+
+void QtxListView::onShowHide( int id )
+{
+ //if ( myHeaderState != HeaderButton )
+ // return;
+
setShown( id, !isShown( id ) );
}
QListView::viewportResizeEvent( e );
onHeaderResized();
}
+
+bool QtxListView::eventFilter( QObject* o, QEvent* e )
+{
+ if( o==header() && e->type()==QEvent::MouseButtonPress )
+ {
+ QMouseEvent* me = ( QMouseEvent* )e;
+ if( me->button()==Qt::RightButton )
+ {
+ showPopup( me->x()+2, me->y()+2 );
+ return true;
+ }
+ }
+
+ return QObject::eventFilter( o, e );
+}