Salome HOME
Splash screen was implemented. Changes in packages SUIT and Session are integrated.
[modules/gui.git] / src / ObjBrowser / OB_ListView.cxx
index fb9ba2341d62acc33b186f191aa98644772ce367..c815071ff2b0134390292d2dbcb2076b399f3985 100755 (executable)
@@ -38,35 +38,13 @@ void OB_ListView::setFilter( OB_Filter* f )
   myFilter = f;
 }
 
-void OB_ListView::setSelected( QListViewItem* item, bool sel )
+bool OB_ListView::isOk( QListViewItem* item ) const
 {
-  bool on = sel;
-  if ( filter() )
-  {
-    SUIT_DataObject* obj = dataObject( item );
-    if ( obj )
-      on = on && filter()->isOk( obj );
-  }
-
-  QListView::setSelected( item, on );
-}
-
-int OB_ListView::addColumn( const QString& label, int width )
-{
-  int res = QListView::addColumn( label, width );
-
-  updateHeader();
-
-  return res;
-}
-
-int OB_ListView::addColumn( const QIconSet& iconset, const QString& label, int width )
-{
-  int res = QListView::addColumn( iconset, label, width );
-
-  updateHeader();
-
-  return res;
+  bool ok = true;
+  SUIT_DataObject* obj = dataObject( item );
+  if ( obj && filter() )
+    ok = filter()->isOk( obj );
+  return ok;
 }
 
 QDragObject* OB_ListView::dragObject()
@@ -109,6 +87,19 @@ void OB_ListView::dropEvent( QDropEvent* e )
   myItems.clear();
 }
 
+void OB_ListView::keyPressEvent( QKeyEvent* ke )
+{
+  if ( ( ke->key() == Qt::Key_Plus || ke->key() == Qt::Key_Minus ) && ke->state() & ControlButton )
+  {
+    bool isOpen = ke->key() == Qt::Key_Plus;
+    for ( QListViewItemIterator it( this ); it.current(); ++it )
+      if ( it.current()->childCount() )
+        it.current()->setOpen( isOpen );
+  }
+  else
+    QtxListView::keyPressEvent( ke );
+}
+
 QListViewItem* OB_ListView::dropItem( QDropEvent* e ) const
 {
   QListViewItem* item = 0;
@@ -153,8 +144,3 @@ bool OB_ListView::isDropAccepted( QListViewItem* drag, QListViewItem* drop ) con
 
   return dropObj->isDropAccepted( dragObj );
 }
-
-void OB_ListView::updateHeader()
-{
-
-}