Salome HOME
Copyright update 2022
[modules/gui.git] / src / SalomeApp / SalomeApp_ListView.cxx
index af9b7c5c09cd3a7ccd48112786e785a256ccdba8..a2f0984c50218b79b794582ddfe1d21bb653b0a7 100644 (file)
@@ -1,58 +1,69 @@
-//  SALOME SalomeApp 
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2005  CEA/DEN, EDF R&D
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-//  File   : SalomeApp_ListView.cxx
-//  Author : Vadim SANDLER
-//  Module : SALOME
-//  $Header$
 
+// File   : SalomeApp_ListView.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
 #include "SalomeApp_ListView.h"
 #include "SalomeApp_Application.h"
 
 #include "SUIT_ResourceMgr.h"
 #include "SUIT_Session.h"
 
-#include <qheader.h>
-#include <qvalidator.h>
-#include <qapplication.h>
-#include <qtoolbutton.h>
-
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfReal.hxx>
-
 #include "utilities.h"
 
-using namespace std;
+#include <QValidator>
+#include <QToolButton>
+#include <QPixmap>
+#include <QHeaderView>
+#include <QKeyEvent>
 
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_ListView class implementation
-//////////////////////////////////////////////////////////////////////
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListOfReal.hxx>
 
-//================================================================
-// Function : computeEditGeometry
-// Purpose  : static function - used for resizing editing widget
-//================================================================
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfReal.hxx>
+
+/*!
+  Used for resizing editing widget
+*/
 void computeEditGeometry(SalomeApp_ListViewItem* theItem,
-                         SalomeApp_EntityEdit*   theWidget)  
+                         SalomeApp_EntityEdit*   theWidget)
 {
   if (!theItem)
     return;
-  QListView* aListView = theItem->listView();
+  QTreeWidget* aListView = theItem->treeWidget();
   int anEditColumn = theItem->getEditedColumn();
   if (anEditColumn < 0)
     return;
-  
+
   int aX = 0, aY = 0, aW = 0, aH = 0;
 
-  QRect aRect = aListView->itemRect(theItem);
-  aListView->contentsToViewport(aListView->header()->sectionPos(anEditColumn), 0, aX, aY);
+  QRect aRect = aListView->visualItemRect(theItem);
+  aX = aListView->header()->sectionViewportPosition(anEditColumn);
   if (aX < 0)
     aX = 0; // THIS CAN BE REMOVED
   QSize aSize = theWidget->getControl()->sizeHint();
-  aH = QMAX(aSize.height() , aRect.height() );
+  aH = qMax(aSize.height() , aRect.height() );
   aY = aRect.y() - ((aH - aRect.height()) / 2);
   //aW = aListView->columnWidth(anEditColumn); // CAN SUBSTITUTE NEXT 3 ROWS
   aW = aListView->viewport()->width() - aX;
@@ -61,38 +72,35 @@ void computeEditGeometry(SalomeApp_ListViewItem* theItem,
   theWidget->setGeometry(aX, aY, aW, aH);
 }
 
-//================================================================
-// Function : SalomeApp_ListView::SalomeApp_ListView
-// Purpose  : constructor
-//================================================================
-SalomeApp_ListView::SalomeApp_ListView(QWidget *parent) :
-QListView(parent) 
+/*!
+  Constructor
+*/
+SalomeApp_ListView::SalomeApp_ListView( QWidget* parent )
+  : QTreeWidget/*QtxListView*/( parent )
 {
   myMouseEnabled = true;
   myEditingEnabled = false;
-  setSelectionMode(Single);
-  setSorting(-1);
+  setSelectionMode(QAbstractItemView::SingleSelection);
   setRootIsDecorated(false);
   setAllColumnsShowFocus(false);
 //  header()->setClickEnabled(false);
-  header()->setMovingEnabled(false);
+  header()->setSectionsMovable(false);
 
   myEditedItem = 0;
   myEdit = 0;
 
   viewport()->installEventFilter(this);
 
-  connect(this, SIGNAL(selectionChanged()), 
-         this, SLOT(onSelectionChanged()));
-  connect(header(), SIGNAL(sizeChange(int, int, int)), 
-         this,     SLOT(onHeaderSizeChange(int, int, int)));
+  connect(this, SIGNAL(itemSelectionChanged()),
+          this, SLOT(onSelectionChanged()));
+  connect(header(), SIGNAL(sizeChange(int, int, int)),
+          this,     SLOT(onHeaderSizeChange(int, int, int)));
 }
 
-//================================================================
-// Function : SalomeApp_ListView::~SalomeApp_ListView
-// Purpose  : destructor
-//================================================================
-SalomeApp_ListView::~SalomeApp_ListView() 
+/*!
+  Destructor
+*/
+SalomeApp_ListView::~SalomeApp_ListView()
 {
   if (myEdit) {
     delete myEdit;
@@ -101,97 +109,90 @@ SalomeApp_ListView::~SalomeApp_ListView()
   myEditedItem = 0;
 }
 
-//================================================================
-// Function : SalomeApp_ListView::updateViewer
-// Purpose  : updates all data viewer
-//================================================================
-void SalomeApp_ListView::updateViewer() 
+/*!
+  Updates all data viewer
+*/
+void SalomeApp_ListView::updateViewer()
 {
   // temporary disconnecting selection changed SIGNAL
   blockSignals(true);
-  SalomeApp_ListViewItem* aRoot = (SalomeApp_ListViewItem*)firstChild();
+  QTreeWidgetItemIterator it( this );
+  SalomeApp_ListViewItem* aRoot = (SalomeApp_ListViewItem*)(*it);
   if (aRoot)
     aRoot->updateAllLevels();
-  updateContents();
+  update( contentsRect() );//updateContents();
   // connecting again selection changed SIGNAL
   blockSignals(false);
-  emit selectionChanged();
+  emit itemSelectionChanged();
 }
 
-//================================================================
-// Function : SalomeApp_ListView::updateSelected
-// Purpose  : updates currently selected item(s)
-//================================================================
-void SalomeApp_ListView::updateSelected() 
+/*!
+  Updates currently selected item(s)
+*/
+void SalomeApp_ListView::updateSelected()
 {
   // temporary disconnecting selection changed SIGNAL
   blockSignals(true);
-  SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)selectedItem();
+  SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)(selectedItems().first());
   if (aChild)
     aChild->updateAllLevels();
-  updateContents();
+  update( contentsRect() );//updateContents();
   // connecting again selection changed SIGNAL
   blockSignals(false);
-  emit selectionChanged();
+  emit itemSelectionChanged();
 }
 
-//================================================================
-// Function : SalomeApp_ListView::popupClientType
-// Purpose  : returns popup client type
-//================================================================
+/*!
+  Returns popup client type
+*/
 QString SalomeApp_ListView::popupClientType() const
 {
   return "SalomeApp_ListView";
 }
 
-//================================================================
-// Function : SalomeApp_ListView::contextMenuPopup
-// Purpose  : fills popup menu with items
-//================================================================
-void SalomeApp_ListView::contextMenuPopup( QPopupMenu* aPopup ) 
+/*!
+  Fills popup menu with items
+*/
+void SalomeApp_ListView::contextMenuPopup( QMenu* aPopup )
 {
   if (aPopup) {
     // add items here...
   }
 }
 
-//================================================================
-// Function : SalomeApp_ListView::clear
-// Purpose  : clears view
-//================================================================
-void SalomeApp_ListView::clear() 
+/*!
+  Clears view
+*/
+void SalomeApp_ListView::clear()
 {
   if (myEdit) {
     delete myEdit;
     myEdit = 0;
     myEditedItem = 0;
   }
-  QListView::clear();
+  QTreeWidget::clear();
 }
 
-//================================================================
-// Function : SalomeApp_ListView::isMouseEnabled
-// Purpose  : returms true if mouse events are enabled
-//================================================================
-bool SalomeApp_ListView::isMouseEnabled() 
+/*!
+  \return true if mouse events are enabled
+*/
+bool SalomeApp_ListView::isMouseEnabled()
 {
   return myMouseEnabled;
 }
 
-//================================================================
-// Function : SalomeApp_ListView::enableMouse
-// Purpose  : enabled/disables mouse events (excluding MouseMove)
-//================================================================
-void SalomeApp_ListView::enableMouse(bool enable) 
+/*!
+  Enables/disables mouse events (excluding MouseMove)
+*/
+void SalomeApp_ListView::enableMouse(bool enable)
 {
   myMouseEnabled = enable;
 }
 
-//================================================================
-// Function : SalomeApp_ListView::eventFilter
-// Purpose  : event filter
-//================================================================
-bool SalomeApp_ListView::eventFilter(QObject* object, QEvent* event) 
+/*!
+  Event filter
+*/
+bool SalomeApp_ListView::eventFilter(QObject* object, QEvent* event)
 {
   if (object == viewport() &&
        (event->type() == QEvent::MouseButtonPress   ||
@@ -200,14 +201,13 @@ bool SalomeApp_ListView::eventFilter(QObject* object, QEvent* event)
       !isMouseEnabled())
     return true;
   else
-    return QListView::eventFilter(object, event);
+    return QTreeWidget::eventFilter(object, event);
 }
 
-//================================================================
-// Function : SalomeApp_ListView::enableEditing
-// Purpose  : setting editing of items availbale/not available
-//================================================================
-void SalomeApp_ListView::enableEditing(bool theFlag) 
+/*!
+  Setting editing of items availbale/not available
+*/
+void SalomeApp_ListView::enableEditing(bool theFlag)
 {
   myEditingEnabled = theFlag;
   if (!myEditingEnabled) {
@@ -219,29 +219,26 @@ void SalomeApp_ListView::enableEditing(bool theFlag)
   }
 }
 
-//================================================================
-// Function : SalomeApp_ListView::isEnableEditing
-// Purpose  : says if editing is enabled
-//================================================================
-bool SalomeApp_ListView::isEnableEditing() 
+/*!
+  Says if editing is enabled
+*/
+bool SalomeApp_ListView::isEnableEditing()
 {
   return myEditingEnabled;
 }
 
-//================================================================
-// Function : SalomeApp_ListView::accept
-// Purpose  : calls finishEditing(true)...
-//================================================================
-void SalomeApp_ListView::accept() 
+/*!
+  Calls finishEditing(true)...
+*/
+void SalomeApp_ListView::accept()
 {
   finishEditing(true);
 }
 
-//================================================================
-// Function : QAD_ListView::onSelectionChanged
-// Purpose  : slot, called when selection changed in List Viewer
-//================================================================
-void SalomeApp_ListView::onSelectionChanged() 
+/*!
+  Slot, called when selection changed in List Viewer
+*/
+void SalomeApp_ListView::onSelectionChanged()
 {
   if (myEdit) {
     finishEditing(true);
@@ -249,14 +246,14 @@ void SalomeApp_ListView::onSelectionChanged()
     myEdit = 0;
     if (myEditedItem && !myEditedItem->isAccepted()) {
       delete myEditedItem;
-      updateContents();
+      update( contentsRect() );//updateContents();
     }
     myEditedItem = 0;
-  } 
+  }
   // editing is allowed in Single Selection Mode only
-  if (selectionMode() != Single || !isEnableEditing())
+  if (selectionMode() != QAbstractItemView::SingleSelection || !isEnableEditing())
     return;
-  SalomeApp_ListViewItem* anItem = (SalomeApp_ListViewItem*)selectedItem();
+  SalomeApp_ListViewItem* anItem = (SalomeApp_ListViewItem*)(selectedItems().first());
   if (anItem) {
     if (!anItem->isEditable())
       return;
@@ -271,67 +268,61 @@ void SalomeApp_ListView::onSelectionChanged()
   }
 }
 
-//================================================================
-// Function : SalomeApp_ListView::resizeEvent
-// Purpose  : called when Data Viewer is resized
-//================================================================
-void SalomeApp_ListView::resizeEvent( QResizeEvent * e) 
+/*!
+  Called when Data Viewer is resized
+*/
+void SalomeApp_ListView::resizeEvent( QResizeEvent * e)
 {
-  QListView::resizeEvent(e);
-  int aW = columnWidth(columns()-1);
-  int aX = header()->sectionPos(columns()-1);
+  QTreeWidget::resizeEvent(e);
+  int aW = columnWidth(columnCount()-1);
+  int aX = header()->sectionPosition(columnCount()-1);
   if (aW < width() - frameWidth() * 2 - aX - 1)
-    setColumnWidth(columns()-1, width() - frameWidth() * 2 - aX - 1);
-  updateContents();
+    setColumnWidth(columnCount()-1, width() - frameWidth() * 2 - aX - 1);
+  update( contentsRect() );//updateContents();
 }
 
-//================================================================
-// Function : SalomeApp_ListView::onHeaderSizeChange
-// Purpose  : slot, called when columns sizes are changed
-//================================================================
-void SalomeApp_ListView::onHeaderSizeChange(int, int, int) 
+/*!
+  Slot, called when columns sizes are changed
+*/
+void SalomeApp_ListView::onHeaderSizeChange(int, int, int)
 {
-  int aW = columnWidth(columns()-1);
-  int aX = header()->sectionPos(columns()-1);
+  int aW = columnWidth(columnCount()-1);
+  int aX = header()->sectionPosition(columnCount()-1);
   if (aW < width() - frameWidth() * 2 - aX - 1)
-    setColumnWidth(columns()-1, width() - frameWidth() * 2 - aX - 1);
+    setColumnWidth(columnCount()-1, width() - frameWidth() * 2 - aX - 1);
 }
 
-//================================================================
-// Function : SalomeApp_ListView::viewportPaintEvent
-// Purpose  : handler for paint event
-//================================================================
-void SalomeApp_ListView::viewportPaintEvent(QPaintEvent* e) 
+/*!
+  Handler for paint event
+*/
+void SalomeApp_ListView::viewportPaintEvent(QPaintEvent* e)
 {
-  QListView::viewportPaintEvent(e);
+  QTreeWidget::paintEvent(e);
   if (myEditedItem && myEdit) {
     computeEditGeometry(myEditedItem, myEdit);
   }
 }
 
-//================================================================
-// Function : SalomeApp_ListView::onEditOk
-// Purpose  : called when user finishes in editing of item
-//================================================================
-void SalomeApp_ListView::onEditOk() 
+/*!
+  Called when user finishes in editing of item
+*/
+void SalomeApp_ListView::onEditOk()
 {
   finishEditing(true);
 }
-  
-//================================================================
-// Function : SalomeApp_ListView::onEditCancel
-// Purpose  : called when user cancels item editing
-//================================================================
-void SalomeApp_ListView::onEditCancel() 
+
+/*!
+  Called when user cancels item editing
+*/
+void SalomeApp_ListView::onEditCancel()
 {
   finishEditing(false);
 }
 
-//================================================================
-// Function : SalomeApp_ListView::finishEditing
-// Purpose  : finishes editing of entity
-//================================================================
-UpdateType SalomeApp_ListView::finishEditing(bool ok) 
+/*!
+  Finishes editing of entity
+*/
+UpdateType SalomeApp_ListView::finishEditing(bool ok)
 {
   UpdateType aNeedsUpdate = utCancel;
   if (myEditedItem && myEdit)
@@ -342,10 +333,10 @@ UpdateType SalomeApp_ListView::finishEditing(bool ok)
     if (ok) {
       aNeedsUpdate = myEditedItem->finishEditing(myEdit);
       if (aNeedsUpdate == utCancel) {
-       // something to do here on Cancel...
+        // something to do here on Cancel...
       }
       else {
-       // something to do here on OK...
+        // something to do here on OK...
       }
       // updating contents
       switch (aNeedsUpdate) {
@@ -361,7 +352,7 @@ UpdateType SalomeApp_ListView::finishEditing(bool ok)
             SalomeApp_ListViewItem* aParent = (SalomeApp_ListViewItem*)(myEditedItem->parent());
             if (aParent)
               aParent->updateAllLevels();
-            else 
+            else
               myEditedItem->updateAllLevels();
           }
           break;
@@ -392,34 +383,33 @@ UpdateType SalomeApp_ListView::finishEditing(bool ok)
   return aNeedsUpdate;
 }
 
-//================================================================
-// Function : SalomeApp_ListView::tip
-// Purpose  : gets current tooltip for list view
-//            returns valid rect in success
-//================================================================
-QRect SalomeApp_ListView::tip(QPoint aPos, 
-                       QString& aText, 
-                       QRect& dspRect, 
-                       QFont& dspFnt) const 
+/*!
+  \return current tooltip for list view
+  \retval valid rect in success
+*/
+QRect SalomeApp_ListView::tip(QPoint aPos,
+                              QString& aText,
+                              QRect& dspRect,
+                              QFont& dspFnt) const
 {
   QRect result( -1, -1, -1, -1 );
   SalomeApp_ListViewItem* aItem = (SalomeApp_ListViewItem*)itemAt( aPos );
   if ( aItem ) {
-    for (int i = 0; i < columns(); i++) {
+    for (int i = 0; i < columnCount(); i++) {
       QRect aItemRect = aItem->itemRect(i);
       QRect aTextRect = aItem->textRect(i);
       if ( !aItem->text(i).isEmpty() &&
-          ( aItemRect.width()  > header()->sectionSize(i) ||
-            aTextRect.left()   < 0 || 
+           ( aItemRect.width()  > header()->sectionSize(i) ||
+             aTextRect.left()   < 0 ||
              aTextRect.top()    < 0 ||
              aTextRect.right()  > viewport()->width() ||
              aTextRect.bottom() > viewport()->height() ) ) {
         // calculating tip data
         aText   = aItem->tipText();
-       dspRect = aItem->tipRect();
-       dspFnt  = font();
+        dspRect = aItem->tipRect();
+        dspFnt  = font();
         if (dspRect.isValid()) {
-          result  = QRect(QPoint(0, aItemRect.top()), 
+          result  = QRect(QPoint(0, aItemRect.top()),
                           QSize(viewport()->width(), aItemRect.height()));
         }
       }
@@ -428,158 +418,120 @@ QRect SalomeApp_ListView::tip(QPoint aPos,
   return result;
 }
 
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_ListViewItem Class Implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-// Purpose  : constructor
-//================================================================
+/*!
+  Constructor
+*/
 SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent) :
-QListViewItem( parent ) 
+QTreeWidgetItem( parent )
 {
   init();
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-// Purpose  : constructor
-//================================================================
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent, 
-                                  SalomeApp_ListViewItem* after) :
-QListViewItem( parent, after ) 
+/*!
+  Constructor
+*/
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent,
+                                               SalomeApp_ListViewItem* after) :
+QTreeWidgetItem( parent, after )
 {
   init();
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-// Purpose  : constructor
-//================================================================
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent, 
-                                  const QString&    theName,
-                                  const bool        theEditable) :
-QListViewItem(parent, theName) 
+/*!
+  Constructor
+*/
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent,
+                                               const QStringList&    theStrings,
+                                               const bool        theEditable) :
+QTreeWidgetItem(parent, theStrings)
 {
   init();
   setEditable(theEditable);
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-// Purpose  : constructor
-//================================================================
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent, 
-                                  const QString&    theName,
-                                  const QString&    theValue,
-                                  const bool        theEditable) :
-QListViewItem(parent, theName, theValue) 
+/*!
+  Constructor
+*/
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
+                                               const QStringList&    theString,
+                                               const bool        theEditable) :
+QTreeWidgetItem(parent, theString)
 {
   init();
   setEditable(theEditable);
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-// Purpose  : constructor
-//================================================================
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, 
-                                  const QString&    theName,
-                                  const bool        theEditable) :
-QListViewItem(parent, theName)
+/*!
+  Constructor
+*/
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
+                                               SalomeApp_ListViewItem* after,
+                                               const QString&    theName,
+                                               const bool        theEditable) :
+QTreeWidgetItem(parent, after)
 {
+  setData(0,Qt::DisplayRole,QVariant(theName));
   init();
   setEditable(theEditable);
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-// Purpose  : constructor
-//================================================================
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, 
-                                  SalomeApp_ListViewItem* after, 
-                                  const QString&    theName,
-                                  const bool        theEditable) :
-QListViewItem(parent, after, theName)
+/*!
+  Constructor
+*/
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent,
+                                               SalomeApp_ListViewItem* after,
+                                               const QString&    theName,
+                                               const bool        theEditable) :
+QTreeWidgetItem(parent, after)
 {
+  setData(0,Qt::DisplayRole,QVariant(theName));
   init();
   setEditable(theEditable);
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-// Purpose  : constructor
-//================================================================
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent, 
-                                  SalomeApp_ListViewItem* after, 
-                                  const QString&    theName,
-                                  const bool        theEditable) :
-QListViewItem(parent, after, theName)
+/*!
+  Constructor
+*/
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
+                                               SalomeApp_ListViewItem* after,
+                                               const QString&    theName,
+                                               const QString&    theValue,
+                                               const bool        theEditable) :
+QTreeWidgetItem(parent, after)
 {
+  setData(0,Qt::DisplayRole,QVariant(theName));
+  setData(1,Qt::DisplayRole,QVariant(theValue));
   init();
   setEditable(theEditable);
 }
 
-
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-// Purpose  : constructor
-//================================================================
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, 
-                                  const QString&    theName,
-                                  const QString&    theValue,
-                                  const bool        theEditable) :
-QListViewItem(parent, theName, theValue)
+/*!
+  Constructor
+*/
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent,
+                                               SalomeApp_ListViewItem* after,
+                                               const QString&    theName,
+                                               const QString&    theValue,
+                                               const bool        theEditable) :
+QTreeWidgetItem(parent, after)
 {
+  setData(0,Qt::DisplayRole,QVariant(theName));
+  setData(1,Qt::DisplayRole,QVariant(theValue));
   init();
   setEditable(theEditable);
 }
 
-
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-// Purpose  : constructor
-//================================================================
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, 
-                                  SalomeApp_ListViewItem* after, 
-                                  const QString&    theName,
-                                  const QString&    theValue,
-                                  const bool        theEditable) :
-QListViewItem(parent, after, theName, theValue)
+/*!
+  Destructor
+*/
+SalomeApp_ListViewItem::~SalomeApp_ListViewItem()
 {
-  init();
-  setEditable(theEditable);
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-// Purpose  : constructor
-//================================================================
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent, 
-                                  SalomeApp_ListViewItem* after, 
-                                  const QString&    theName,
-                                  const QString&    theValue,
-                                  const bool        theEditable) :
-QListViewItem(parent, after, theName, theValue)
-{
-  init();
-  setEditable(theEditable);
-}
-
-//================================================================
-// Function : SalomeApp_ListViewItem::~SalomeApp_ListViewItem
-// Purpose  : destructor
-//================================================================
-SalomeApp_ListViewItem::~SalomeApp_ListViewItem() 
-{
-}
-
-//================================================================
-// Function : SalomeApp_ListViewItem::init
-// Purpose  : initialization
-//================================================================
-void SalomeApp_ListViewItem::init() 
+/*!
+  Initialization
+*/
+void SalomeApp_ListViewItem::init()
 {
   myEditable    = false;
   myAccepted    = true;
@@ -589,57 +541,66 @@ void SalomeApp_ListViewItem::init()
   myUserType    = -1;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::getName
-// Purpose  : as default returns text in the first column
-//================================================================
-QString SalomeApp_ListViewItem::getName() const 
+/*!
+  Returns the depth of this item
+*/
+int SalomeApp_ListViewItem::depth() const
 {
-  return ( listView()->columns() > 0 ) ? text(0) : QString("");
+  int aDepth = 0;
+  QTreeWidgetItem* aParent = parent();
+  while ( aParent ) {
+    aParent = aParent->parent();
+    aDepth++;
+  }
+  return aDepth;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::setName
-// Purpose  : as default sets text in the first column
-//================================================================
-UpdateType SalomeApp_ListViewItem::setName(const QString& theName) 
+/*!
+  \return text in the first column
+*/
+QString SalomeApp_ListViewItem::getName() const
+{
+  return ( treeWidget()->columnCount() > 0 ) ? text(0) : QString("");
+}
+
+/*!
+  Sets text in the first column
+*/
+UpdateType SalomeApp_ListViewItem::setName(const QString& theName)
 {
   UpdateType aNeedsUpdate = utCancel;
-  if (listView()->columns() > 0) {
+  if (treeWidget()->columnCount() > 0) {
     setText(0, theName);
     aNeedsUpdate = utNone;
   }
   return aNeedsUpdate;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::getValue
-// Purpose  : as default returns text in the second column
-//================================================================
-QString SalomeApp_ListViewItem::getValue() const 
+/*!
+  \return text in the second column
+*/
+QString SalomeApp_ListViewItem::getValue() const
 {
-  return ( listView()->columns() > 1 ) ? text(1) : QString("");
+  return ( treeWidget()->columnCount() > 1 ) ? text(1) : QString("");
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::setValue
-// Purpose  : as default sets text in the second column
-//================================================================
-UpdateType SalomeApp_ListViewItem::setValue(const QString& theValue) 
+/*!
+  Sets text in the second column
+*/
+UpdateType SalomeApp_ListViewItem::setValue(const QString& theValue)
 {
   UpdateType aNeedsUpdate = utCancel;
-  if (listView()->columns() > 1) {
+  if (treeWidget()->columnCount() > 1) {
     setText(1, theValue);
     aNeedsUpdate = utNone;
   }
   return aNeedsUpdate;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::fullName
-// Purpose  : returns full path to the entity from the root
-//================================================================
-QString SalomeApp_ListViewItem::fullName() 
+/*!
+  \return full path to the entity from the root
+*/
+QString SalomeApp_ListViewItem::fullName()
 {
   QString aFullName = getName();
   SalomeApp_ListViewItem* aParent = (SalomeApp_ListViewItem*)parent();
@@ -650,163 +611,154 @@ QString SalomeApp_ListViewItem::fullName()
   return aFullName;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::openAllLevels
-// Purpose  : expands all entities beginning from this level
-//================================================================
-void SalomeApp_ListViewItem::openAllLevels() 
+/*!
+  expands all entities beginning from this level
+*/
+void SalomeApp_ListViewItem::openAllLevels()
 {
-  setOpen(true);
-  SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)firstChild();
+  setExpanded(true);
+  QTreeWidgetItemIterator it( this );
+  SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)(*it);
   while( aChild ) {
     aChild->openAllLevels();
-    aChild = (SalomeApp_ListViewItem*)(aChild->nextSibling());
+    ++it;
+    aChild = (SalomeApp_ListViewItem*)(*it);
   }
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::updateAllLevels
-// Purpose  : update all entites beginning from this level
-//================================================================
-void SalomeApp_ListViewItem::updateAllLevels() 
+/*!
+  update all entites beginning from this level
+*/
+void SalomeApp_ListViewItem::updateAllLevels()
 {
-  SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)firstChild();
+  QTreeWidgetItemIterator it( this );
+  SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)(*it);
   while( aChild ) {
     aChild->updateAllLevels();
-    aChild = (SalomeApp_ListViewItem*)(aChild->nextSibling());
+    ++it;
+    aChild = (SalomeApp_ListViewItem*)(*it);
   }
 }
 
-//================================================================
-// Function : SalomeApp_EditBox::isEditable
-// Purpose  : return true if entity is editable
-//================================================================
-bool SalomeApp_ListViewItem::isEditable() const 
+/*!
+  \return true if entity is editable
+*/
+bool SalomeApp_ListViewItem::isEditable() const
 {
   return myEditable;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::setEditable
-// Purpose  : sets editable flag fo the entity
-//================================================================
-void SalomeApp_ListViewItem::setEditable(bool theEditable) 
+/*!
+  Sets editable flag fo the entity
+*/
+void SalomeApp_ListViewItem::setEditable(bool theEditable)
 {
   myEditable = theEditable;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::isAccepted
-// Purpose  : returns true if entitiy is accepted after editing
-//================================================================
-bool SalomeApp_ListViewItem::isAccepted() const 
+/*!
+  \return true if entitiy is accepted after editing
+*/
+bool SalomeApp_ListViewItem::isAccepted() const
 {
   return myAccepted;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::setAccepted
-// Purpose  : set entitiy accepted or not after editing
-//================================================================
-void SalomeApp_ListViewItem::setAccepted(bool theAccepted) 
+/*!
+  Sets entitiy accepted or not after editing
+*/
+void SalomeApp_ListViewItem::setAccepted(bool theAccepted)
 {
   myAccepted = theAccepted;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::getEditingType
-// Purpose  : returns type of edit control (0 - edit box, 1 - combo box, 
-//            2 - editable combo box),  default is edit box
-//================================================================
-int SalomeApp_ListViewItem::getEditingType() 
+/*!
+ \retval type of edit control (default is edit box)
+      \li 0 - edit box
+      \li 1 - combo box
+      \li 2 - editable combo box
+*/
+int SalomeApp_ListViewItem::getEditingType()
 {
   return myEditingType;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::setEditingType
-// Purpose  : sets type of edit control (0 - edit box, 1 - combo box, 
-//            2 - editable combo box), negative value means none
-//================================================================
-void SalomeApp_ListViewItem::setEditingType(const int type) 
+/*!
+ \retval type of edit control (negative value means none)
+     \li 0 - edit box
+     \li 1 - combo box
+     \li 2 - editable combo box
+*/
+void SalomeApp_ListViewItem::setEditingType(const int type)
 {
   myEditingType = type;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::getEditedColumn
-// Purpose  : returns edited column, default is last column
-//            negative value means there are no editable columns
-//================================================================
-int SalomeApp_ListViewItem::getEditedColumn() 
+/*! \retval edited column, default is last column
+    negative value means there are no editable columns
+*/
+int SalomeApp_ListViewItem::getEditedColumn()
 {
-  return listView()->columns()-1;
+  return treeWidget()->columnCount()-1;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::getValueType
-// Purpose  : returns type of edited value (string, int, double)
-//            default is string
-//================================================================
-int SalomeApp_ListViewItem::getValueType() 
+/*!
+  \retval type of edited value (string, int, double)
+   default is string
+*/
+int SalomeApp_ListViewItem::getValueType()
 {
   return myValueType;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::setValueType
-// Purpose  : sets type of edited value
-//================================================================
-void SalomeApp_ListViewItem::setValueType(const int valueType) 
+/*!
+  Sets type of edited value
+*/
+void SalomeApp_ListViewItem::setValueType(const int valueType)
 {
   myValueType = valueType;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::getUserType
-// Purpose  : sets type of edited value
-//================================================================
-int SalomeApp_ListViewItem::getUserType() 
+/*!
+  Sets type of edited value
+*/
+int SalomeApp_ListViewItem::getUserType()
 {
   return myUserType;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::setUserType
-// Purpose  : sets type of edited value
-//================================================================
-void SalomeApp_ListViewItem::setUserType(const int userType) 
+/*!
+  Sets type of edited value
+*/
+void SalomeApp_ListViewItem::setUserType(const int userType)
 {
   myUserType = userType;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::getButtons
-// Purpose  : returns buttons for editing widget (Apply (V), Cancel (X))
-//            default is both buttons
-//================================================================
-int SalomeApp_ListViewItem::getButtons() 
+/*!
+  \return buttons for editing widget (Apply (V), Cancel (X))
+   default is both buttons
+*/
+int SalomeApp_ListViewItem::getButtons()
 {
   return myButtons;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::getButtons
-// Purpose  : sets buttons for editing widget (Apply (V), Cancel (X))
-//================================================================
-void SalomeApp_ListViewItem::setButtons(const int buttons) 
+/*!
+  Sets buttons for editing widget (Apply (V), Cancel (X))
+*/
+void SalomeApp_ListViewItem::setButtons(const int buttons)
 {
   myButtons = buttons;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::startEditing
-// Purpose  : creates control for editing and fills it with values
-//================================================================
-SalomeApp_EntityEdit* SalomeApp_ListViewItem::startEditing() 
+/*!
+  Creates control for editing and fills it with values
+*/
+SalomeApp_EntityEdit* SalomeApp_ListViewItem::startEditing()
 {
   SalomeApp_EntityEdit* aWidget = 0;
-  QListView* aListView = listView();
+  QTreeWidget* aListView = treeWidget();
   if (aListView) {
     if (!isEditable())
       return 0;
@@ -816,11 +768,11 @@ SalomeApp_EntityEdit* SalomeApp_ListViewItem::startEditing()
     int anEditColumn = getEditedColumn();
     if (anEditColumn < 0 || anEditType < 0)
       return 0;
-    aWidget = new SalomeApp_EntityEdit(aListView->viewport(), 
-                                 anEditType, 
-                                aValueType, 
-                                aButtons & SalomeApp_EntityEdit::btApply,
-                                aButtons & SalomeApp_EntityEdit::btCancel);
+    aWidget = new SalomeApp_EntityEdit(aListView->viewport(),
+                                 anEditType,
+                                 aValueType,
+                                 aButtons & SalomeApp_EntityEdit::btApply,
+                                 aButtons & SalomeApp_EntityEdit::btCancel);
     computeEditGeometry(this, aWidget);
 
     fillWidgetWithValues(aWidget);
@@ -828,22 +780,20 @@ SalomeApp_EntityEdit* SalomeApp_ListViewItem::startEditing()
   return aWidget;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::fillWidgetWithValues
-// Purpose  : fills widget with initial values (list or single value)
-//================================================================
-void SalomeApp_ListViewItem::fillWidgetWithValues(SalomeApp_EntityEdit* theWidget) 
+/*!
+  Fills widget with initial values (list or single value)
+*/
+void SalomeApp_ListViewItem::fillWidgetWithValues(SalomeApp_EntityEdit* theWidget)
 {
   int anEditColumn = getEditedColumn();
   if (theWidget && anEditColumn >= 0 && !text(anEditColumn).isEmpty())
     theWidget->insertItem(text(anEditColumn), true);
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::finishEditing
-// Purpose  : finishes editing of entity
-//================================================================
-UpdateType SalomeApp_ListViewItem::finishEditing(SalomeApp_EntityEdit* theWidget) 
+/*!
+  Finishes editing of entity
+*/
+UpdateType SalomeApp_ListViewItem::finishEditing(SalomeApp_EntityEdit* theWidget)
 {
   UpdateType aNeedsUpdate = utCancel;
   try {
@@ -856,10 +806,10 @@ UpdateType SalomeApp_ListViewItem::finishEditing(SalomeApp_EntityEdit* theWidget
       case 1:
         aNeedsUpdate = setValue(theWidget->getText());
         break;
-      default: 
+      default:
         break;
       }
-    } 
+    }
   }
   catch (...) {
     MESSAGE( "System error has been caught - SalomeApp_ListViewItem::finishEditing" )
@@ -867,36 +817,34 @@ UpdateType SalomeApp_ListViewItem::finishEditing(SalomeApp_EntityEdit* theWidget
   return aNeedsUpdate;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::tipRect
-// Purpose  : calculates rectangle which should contain item's tip
-//================================================================
-QRect SalomeApp_ListViewItem::tipRect() 
+/*!
+  Calculates rectangle which should contain item's tip
+*/
+QRect SalomeApp_ListViewItem::tipRect()
 {
   QRect aRect = QRect(-1, -1, -1, -1);
-  QRect aItemRect = listView()->itemRect(this);
+  QRect aItemRect = treeWidget()->visualItemRect(this);
   if ( !aItemRect.isValid() )
     return aItemRect;
 
   QString aTip = tipText();
   if (!aTip.isEmpty()) {
     QRect aRect0 = textRect(0);
-    QFont aFont(listView()->font());
+    QFont aFont(treeWidget()->font());
     QFontMetrics fm(aFont);
     int iw = fm.width(aTip);
-    aRect = QRect(QPoint(aRect0.x() < 0 ? 0 : aRect0.x(), 
-                         aRect0.y()), 
-                  QSize (iw,         
+    aRect = QRect(QPoint(aRect0.x() < 0 ? 0 : aRect0.x(),
+                         aRect0.y()),
+                  QSize (iw,
                          aRect0.height()));
   }
   return aRect;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::tipText
-// Purpose  : returns text for tooltip
-//================================================================
-QString SalomeApp_ListViewItem::tipText() 
+/*!
+  \return text for tooltip
+*/
+QString SalomeApp_ListViewItem::tipText()
 {
   QString aText = getName();
   if (!getValue().isEmpty())
@@ -904,164 +852,150 @@ QString SalomeApp_ListViewItem::tipText()
   return aText;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::textRect
-// Purpose  : calculates rect of item text in viewport coordinates
-//================================================================
+/*!
+  Calculates rect of item text in viewport coordinates
+*/
 QRect SalomeApp_ListViewItem::textRect(const int column) const
 {
-  QRect aItemRect = listView()->itemRect( this );
+  QRect aItemRect = treeWidget()->visualItemRect( this );
   if ( !aItemRect.isValid() )
     return aItemRect;
-  
-  QFont aFont(listView()->font());
+
+  QFont aFont(treeWidget()->font());
   QFontMetrics fm(aFont);
-  
-  int decorWidth  = ( listView()->rootIsDecorated() ) ? 
-                    ( listView()->treeStepSize() * (depth() + 1) ) :
-                    ( listView()->treeStepSize() *  depth() );
-  int pixmapWidth = ( pixmap(column) ) ? 
-                      pixmap(column)->width() +  listView()->itemMargin() * 2 : 
-                      listView()->itemMargin();
+
+  int decorWidth  = ( treeWidget()->rootIsDecorated() ) ?
+                    ( treeWidget()->indentation() * (depth() + 1) ) :
+                    ( treeWidget()->indentation() *  depth() );
+  int pixmapWidth = ( !icon(column).isNull() ) ?
+                      treeWidget()->iconSize().width() + 2 :
+                      1;
   int prevWidth = 0;
   for (int i = 0; i < column; i++)
-    prevWidth += listView()->header()->sectionSize(i);
+    prevWidth += treeWidget()->header()->sectionSize(i);
   int ix = prevWidth   +
-           pixmapWidth + 
+           pixmapWidth +
            ((column == 0) ? decorWidth : 0);
   int iy = aItemRect.y();
   int iw = fm.width(text(column));
   int ih = aItemRect.height();
-  if (pixmap(column)) {
-    iy += listView()->itemMargin();
-    ih -= listView()->itemMargin() * 2;
+  if (!icon(column).isNull()) {
+    iy += 1;
+    ih -= 2;
   }
-  ix -= listView()->contentsX();
+  ix -= treeWidget()->contentsRect().left();
 
   QRect theResult(QPoint(ix, iy), QSize(iw, ih));
   return theResult;
 }
 
-//================================================================
-// Function : SalomeApp_ListViewItem::itemRect
-// Purpose  : calculates rect of item data in viewport coordinates
-//================================================================
+/*!
+  Calculates rect of item data in viewport coordinates
+*/
 QRect SalomeApp_ListViewItem::itemRect(const int column) const
 {
-  QRect aItemRect = listView()->itemRect( this );
+  QRect aItemRect = treeWidget()->visualItemRect( this );
   if ( !aItemRect.isValid() )
     return aItemRect;
-  
-  QFont aFont(listView()->font());
+
+  QFont aFont(treeWidget()->font());
   QFontMetrics fm(aFont);
-  
-  int decorWidth  = ( listView()->rootIsDecorated() ) ? 
-                    ( listView()->treeStepSize() * (depth() + 1) ) :
-                    ( listView()->treeStepSize() *  depth() );
-  int pixmapWidth = ( pixmap(column) ) ? 
-                      pixmap(column)->width() +  listView()->itemMargin() * 2 : 
+
+  int decorWidth  = ( treeWidget()->rootIsDecorated() ) ?
+                    ( treeWidget()->indentation() * (depth() + 1) ) :
+                    ( treeWidget()->indentation() *  depth() );
+  int pixmapWidth = ( !icon(column).isNull() ) ?
+                      treeWidget()->iconSize().width() + 2 :
                       0;
   int prevWidth = 0;
   for (int i = 0; i < column; i++)
-    prevWidth += listView()->header()->sectionSize(i);
+    prevWidth += treeWidget()->header()->sectionSize(i);
   int ix = prevWidth;
   int iy = aItemRect.y();
-  int iw = pixmapWidth + 
-           listView()->itemMargin() * 2 + 
-           ((column == 0) ? decorWidth : 0) + 
+  int iw = pixmapWidth +
+           2 +
+           ((column == 0) ? decorWidth : 0) +
            fm.width(text(column));
   int ih = aItemRect.height();
-  ix -= listView()->contentsX();
+  ix -= treeWidget()->contentsRect().left();
 
   QRect theResult(QPoint(ix, iy), QSize(iw, ih));
   return theResult;
 }
 
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_EditBox class implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : SalomeApp_EditBox::SalomeApp_EditBox
-// Purpose  : constructor
-//================================================================
+/*!
+  Constructor
+*/
 SalomeApp_EditBox::SalomeApp_EditBox(QWidget* parent) :
-QLineEdit(parent) 
+QLineEdit(parent)
 {
 }
 
-//================================================================
-// Function : SalomeApp_EditBox::keyPressEvent
-// Purpose  : event filter for key pressing
-//================================================================
-void SalomeApp_EditBox::keyPressEvent( QKeyEvent *e ) 
+/*!
+  Event filter for key pressing
+*/
+void SalomeApp_EditBox::keyPressEvent( QKeyEvent *e )
 {
-  if ( e->key() == Key_Escape )
+  if ( e->key() == Qt::Key_Escape )
     emit escapePressed();
   else
     QLineEdit::keyPressEvent( e );
   e->accept();
 }
 
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_ComboBox class implementation
-//////////////////////////////////////////////////////////////////////
 
-//================================================================
-// Function : SalomeApp_ComboBox::SalomeApp_ComboBox
-// Purpose  : constructor
-//================================================================
+/*!
+  Constructor
+*/
 SalomeApp_ComboBox::SalomeApp_ComboBox(bool rw, QWidget* parent, const char* name) :
-QComboBox(rw, parent, name) 
+QComboBox(parent)
 {
+  setEditable( rw );
+  setObjectName( name );
 }
 
-//================================================================
-// Function : SalomeApp_ComboBox::findItem
-// Purpose  : searches item in list and returns its index
-//================================================================
-int SalomeApp_ComboBox::findItem(const QString& theText) 
+/*!
+  Searches item in list and returns its index
+*/
+int SalomeApp_ComboBox::findItem(const QString& theText)
 {
-  for (int i = 0; i < count(); i++) 
-    if (text(i) == theText)
+  for (int i = 0; i < count(); i++)
+    if (itemText(i) == theText)
       return i;
   return -1;
 }
 
-//================================================================
-// Function : SalomeApp_ComboBox::insertItem
-// Purpose  : adds item in combo box
-//================================================================
+/*!
+  Adds item in combo box
+*/
 void SalomeApp_ComboBox::insertItem(const QString& theValue,
-                             int            theIndex) 
+                                    int            theIndex)
 {
   if (duplicatesEnabled() || findItem(theValue) < 0)
-    QComboBox::insertItem(theValue, theIndex);
+    QComboBox::insertItem(theIndex, theValue);
 }
 
-//================================================================
-// Function : SalomeApp_ComboBox::insertList
-// Purpose  : adds list of items in combo box
-//================================================================
-void SalomeApp_ComboBox::insertList(const QStringList& theList) 
+/*!
+  Adds list of items in combo box
+*/
+void SalomeApp_ComboBox::insertList(const QStringList& theList)
 {
-  for (unsigned i = 0; i < theList.count(); i++)
+  for (int i = 0; i < theList.count(); i++)
     insertItem(theList[i]);
 }
 
-//================================================================
-// Function : SalomeApp_ComboBox::insertItem
-// Purpose  : adds item in combo box
-//================================================================
-void SalomeApp_ComboBox::insertItem(const int theValue) 
+/*!
+  Adds item in combo box
+*/
+void SalomeApp_ComboBox::insertItem(const int theValue)
 {
   int aNum;
   bool bOk;
   for (int i = 0; i < count(); i++) {
-    aNum = text(i).toInt(&bOk);
+    aNum = itemText(i).toInt(&bOk);
     if (bOk) {
       if (aNum > theValue || (aNum == theValue && duplicatesEnabled())) {
-        insertItem(QString::number(theValue), i);
+        insertItem(QString::number(theValue),i);
         return;
       }
     }
@@ -1069,26 +1003,24 @@ void SalomeApp_ComboBox::insertItem(const int theValue)
   insertItem(QString::number(theValue));
 }
 
-//================================================================
-// Function : SalomeApp_ComboBox::insertList
-// Purpose  : adds list of items in combo box
-//================================================================
-void SalomeApp_ComboBox::insertList(const TColStd_ListOfInteger& theList) 
+/*!
+  Adds list of items in combo box
+*/
+void SalomeApp_ComboBox::insertList(const TColStd_ListOfInteger& theList)
 {
   for (TColStd_ListIteratorOfListOfInteger aIter(theList); aIter.More(); aIter.Next())
     insertItem(aIter.Value());
 }
 
-//================================================================
-// Function : SalomeApp_ComboBox::insertItem
-// Purpose  : adds item in combo box
-//================================================================
-void SalomeApp_ComboBox::insertItem(const double theValue) 
+/*!
+  Adds item in combo box
+*/
+void SalomeApp_ComboBox::insertItem(const double theValue)
 {
   double aNum;
   bool bOk;
   for (int i = 0; i < count(); i++) {
-    aNum = text(i).toDouble(&bOk);
+    aNum = itemText(i).toDouble(&bOk);
     if (bOk) {
       if (aNum > theValue || (aNum == theValue && duplicatesEnabled())) {
         insertItem(QString::number(theValue), i);
@@ -1099,39 +1031,33 @@ void SalomeApp_ComboBox::insertItem(const double theValue)
   insertItem(QString::number(theValue));
 }
 
-//================================================================
-// Function : SalomeApp_ComboBox::insertList
-// Purpose  : adds list of items in combo box
-//================================================================
-void SalomeApp_ComboBox::insertList(const TColStd_ListOfReal& theList) 
+/*!
+  Adds list of items in combo box
+*/
+void SalomeApp_ComboBox::insertList(const TColStd_ListOfReal& theList)
 {
   for (TColStd_ListIteratorOfListOfReal aIter(theList); aIter.More(); aIter.Next())
     insertItem(aIter.Value());
 }
 
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_EntityEdit class implementation
-//////////////////////////////////////////////////////////////////////
-
 #include <qlayout.h>
 
 #define MIN_COMBO_WIDTH     1
 #define MIN_EDIT_WIDTH      1
 
-//================================================================
-// Function : SalomeApp_EntityEdit::SalomeApp_EntityEdit
-// Purpose  : constructor
-//================================================================
-SalomeApp_EntityEdit::SalomeApp_EntityEdit(QWidget* parent, 
-                              int      controlType,
-                              int      valueType,
-                              bool     butApply, 
-                              bool     butCancel) :
+/*!
+  Constructor
+*/
+SalomeApp_EntityEdit::SalomeApp_EntityEdit(QWidget* parent,
+                               int      controlType,
+                               int      valueType,
+                               bool     butApply,
+                               bool     butCancel) :
 QWidget(parent),
 myEdit(0),
 myCombo(0),
 myApplyBtn(0),
-myCancelBtn(0) 
+myCancelBtn(0)
 {
   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
   SUIT_ResourceMgr* mgr = app ? app->resourceMgr() : NULL;
@@ -1140,8 +1066,8 @@ myCancelBtn(0)
   aTopLayout->setAlignment( Qt::AlignTop );
   aTopLayout->setSpacing( 0 );
   aTopLayout->setMargin( 1 );
-  if (controlType != etLineEdit && 
-      controlType != etComboBox && 
+  if (controlType != etLineEdit &&
+      controlType != etComboBox &&
       controlType != etComboEdit)
     controlType = etLineEdit;
   if (controlType == etComboBox || controlType == etComboEdit) {
@@ -1151,7 +1077,7 @@ myCancelBtn(0)
     myCombo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
                                        QSizePolicy::Fixed));
     // no insertions
-    myCombo->setInsertionPolicy(QComboBox::NoInsertion);
+    myCombo->setInsertPolicy(QComboBox::NoInsert);
     // no duplicates enabled by default
     myCombo->setDuplicatesEnabled(false);
     aTopLayout->addWidget(myCombo);
@@ -1170,8 +1096,8 @@ myCancelBtn(0)
     connect(myEdit, SIGNAL(returnPressed()), this, SLOT(onApply()));
     connect(myEdit, SIGNAL(escapePressed()), this, SLOT(onCancel()));
   }
-  if (valueType != vtString && 
-      valueType != vtInteger && 
+  if (valueType != vtString &&
+      valueType != vtInteger &&
       valueType != vtDouble)
     valueType = vtString;
   if (valueType == vtInteger)
@@ -1181,12 +1107,12 @@ myCancelBtn(0)
   if (butApply) {
     // Apply button (V)
     myApplyBtn = new QToolButton(this);
-    
+
     QPixmap anIcon;
     if( mgr )
-      anIcon = mgr->loadPixmap( "STD", tr( "ICON_APPLY" ) );
+      anIcon = mgr->loadPixmap( "SalomeApp", tr( "ICON_APPLY" ), false );
 
-    myApplyBtn->setPixmap(anIcon);
+    myApplyBtn->setIcon(anIcon);
     myApplyBtn->setEnabled(false);
     myApplyBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
     myApplyBtn->setMinimumSize(16, 16);
@@ -1199,8 +1125,8 @@ myCancelBtn(0)
     myCancelBtn = new QToolButton(this);
     QPixmap anIcon;
     if( mgr )
-      anIcon = mgr->loadPixmap( "STD", tr( "ICON_CANCEL" ) );
-    myCancelBtn->setPixmap(anIcon);
+      anIcon = mgr->loadPixmap( "SalomeApp", tr( "ICON_CANCEL" ), false );
+    myCancelBtn->setIcon(anIcon);
     myCancelBtn->setEnabled(false);
     myCancelBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
     myCancelBtn->setMinimumSize(16, 16);
@@ -1210,19 +1136,17 @@ myCancelBtn(0)
   }
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::~SalomeApp_EntityEdit
-// Purpose  : destructor
-//================================================================
-SalomeApp_EntityEdit::~SalomeApp_EntityEdit() 
+/*!
+  Destructor
+*/
+SalomeApp_EntityEdit::~SalomeApp_EntityEdit()
 {
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::clear
-// Purpose  : clears edit/combo box
-//================================================================
-void SalomeApp_EntityEdit::clear() 
+/*!
+  Clears edit/combo box
+*/
+void SalomeApp_EntityEdit::clear()
 {
   if (myEdit)
     myEdit->clear();
@@ -1230,11 +1154,10 @@ void SalomeApp_EntityEdit::clear()
     myCombo->clear();
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::getText
-// Purpose  : returns current text in edit box or combo box
-//================================================================
-QString SalomeApp_EntityEdit::getText() 
+/*!
+  \return current text in edit box or combo box
+*/
+QString SalomeApp_EntityEdit::getText()
 {
   if (myEdit)
     return myEdit->text();
@@ -1244,11 +1167,10 @@ QString SalomeApp_EntityEdit::getText()
     return "";
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::setText
-// Purpose  : sets text
-//================================================================
-void SalomeApp_EntityEdit::setText(const QString& theText) 
+/*!
+  Sets text
+*/
+void SalomeApp_EntityEdit::setText(const QString& theText)
 {
   myString = theText;
   if (myEdit)
@@ -1256,44 +1178,40 @@ void SalomeApp_EntityEdit::setText(const QString& theText)
   if (myCombo) {
     int aFound = myCombo->findItem(theText);
     if (aFound >= 0) {
-      myCombo->setCurrentItem(aFound);
+      myCombo->setCurrentIndex(aFound);
       onTextChanged(theText);
     }
   }
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::insertItem
-// Purpose  : adds item in combo box, 
-//            sets it current if theSetCurrent is true
-//================================================================
-void SalomeApp_EntityEdit::insertItem(const QString& theValue, 
-                               bool           theSetCurrent,
-                               int            theOrder) 
+/*!
+  Adds item in combo box, sets it current if theSetCurrent is true
+*/
+void SalomeApp_EntityEdit::insertItem(const QString& theValue,
+                                bool           theSetCurrent,
+                                int            theOrder)
 {
   if (myCombo) {
     int aIndexAt = -1;
     if (theOrder == atTop)
       aIndexAt = 0;
     else if (theOrder == atBeforeCurrent && myCombo->count() > 0)
-      aIndexAt = myCombo->currentItem();
-    else if (theOrder == atAfterCurrent && 
-             myCombo->count() > 0 && 
-             myCombo->currentItem() < myCombo->count()-1)
-      aIndexAt = myCombo->currentItem() + 1;
+      aIndexAt = myCombo->currentIndex();
+    else if (theOrder == atAfterCurrent &&
+             myCombo->count() > 0 &&
+             myCombo->currentIndex() < myCombo->count()-1)
+      aIndexAt = myCombo->currentIndex() + 1;
     myCombo->insertItem(theValue, aIndexAt);
   }
   if (theSetCurrent)
     setText(theValue);
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::insertList
-// Purpose  : adds items in combo box, 
-//            sets item theCurrent as current
-//================================================================
-void SalomeApp_EntityEdit::insertList(const QStringList& theList, 
-                               const int          theCurrent) 
+/*!
+  Adds items in combo box, sets item theCurrent as current
+*/
+void SalomeApp_EntityEdit::insertList(const QStringList& theList,
+                                const int          theCurrent)
 {
   if (myCombo)
     myCombo->insertList(theList);
@@ -1301,13 +1219,11 @@ void SalomeApp_EntityEdit::insertList(const QStringList& theList,
     setText(theList[theCurrent]);
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::insertItem
-// Purpose  : adds item in combo box, 
-//            sets it current if theSetCurrent is true
-//================================================================
-void SalomeApp_EntityEdit::insertItem(const int theValue, 
-                               bool      theSetCurrent) 
+/*!
+  Adds item in combo box, sets it current if theSetCurrent is true
+*/
+void SalomeApp_EntityEdit::insertItem(const int theValue,
+                                bool      theSetCurrent)
 {
   if (myCombo) {
     myCombo->insertItem(theValue);
@@ -1316,33 +1232,29 @@ void SalomeApp_EntityEdit::insertItem(const int theValue,
     setText(QString::number(theValue));
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::insertList
-// Purpose  : adds items in combo box, 
-//            sets item theCurrent as current
-//================================================================
-void SalomeApp_EntityEdit::insertList(const TColStd_ListOfInteger& theList, 
-                               const int                    theCurrent) 
+/*!
+  Adds items in combo box, sets item theCurrent as current
+*/
+void SalomeApp_EntityEdit::insertList(const TColStd_ListOfInteger& theList,
+                                const int                    theCurrent)
 {
   if (myCombo)
     myCombo->insertList(theList);
 
   TColStd_ListIteratorOfListOfInteger aIter(theList);
   for (unsigned i = 0; aIter.More(); aIter.Next(), i++) {
-    if (theCurrent == i) {
+    if (theCurrent == (int)i) { //!< TODO: mismatch signed/unsigned
       setText(QString::number(aIter.Value()));
       break;
     }
   }
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::insertItem
-// Purpose  : adds item in combo box, 
-//            sets it current if theSetCurrent is true
-//================================================================
-void SalomeApp_EntityEdit::insertItem(const double theValue, 
-                               bool         theSetCurrent) 
+/*!
+  Adds item in combo box, sets it current if theSetCurrent is true
+*/
+void SalomeApp_EntityEdit::insertItem(const double theValue,
+                                bool         theSetCurrent)
 {
   if (myCombo) {
     myCombo->insertItem(theValue);
@@ -1351,31 +1263,28 @@ void SalomeApp_EntityEdit::insertItem(const double theValue,
     setText(QString::number(theValue));
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::insertList
-// Purpose  : adds items in combo box, 
-//            sets item theCurrent as current
-//================================================================
-void SalomeApp_EntityEdit::insertList(const TColStd_ListOfReal& theList, 
-                               const int                 theCurrent) 
+/*!
+  Adds items in combo box, sets item theCurrent as current
+*/
+void SalomeApp_EntityEdit::insertList(const TColStd_ListOfReal& theList,
+                                const int                 theCurrent)
 {
   if (myCombo)
     myCombo->insertList(theList);
-  
+
   TColStd_ListIteratorOfListOfReal aIter(theList);
   for (unsigned i = 0; aIter.More(); aIter.Next(), i++) {
-    if (theCurrent == i) {
+    if (theCurrent == (int)i) { //!< TODO: mismatch signed/unsigned
       setText(QString::number(aIter.Value()));
       break;
     }
   }
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::getControl
-// Purpose  : gets actual widget
-//================================================================
-QWidget* SalomeApp_EntityEdit::getControl() 
+/*! 
+  \return actual widget
+*/
+QWidget* SalomeApp_EntityEdit::getControl()
 {
   if (myEdit)
     return myEdit;
@@ -1385,27 +1294,25 @@ QWidget* SalomeApp_EntityEdit::getControl()
     return 0;
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::setFocus
-// Purpose  : redirect focus to corresponding widget
-//================================================================
-void SalomeApp_EntityEdit::setFocus() 
+/*!
+  redirect focus to corresponding widget
+*/
+void SalomeApp_EntityEdit::setFocus()
 {
   if (myEdit) {
     myEdit->setFocus();
     //myEdit->selectAll();
   }
-  else if (myCombo && myCombo->editable()) {
+  else if (myCombo && myCombo->isEditable()) {
     myCombo->setFocus();
     //myCombo->lineEdit()->selectAll();
   }
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::setValidator
-// Purpose  : sets validator for the control
-//================================================================
-void SalomeApp_EntityEdit::setValidator(const QValidator* theValidator) 
+/*!
+  Sets validator for the control
+*/
+void SalomeApp_EntityEdit::setValidator(const QValidator* theValidator)
 {
   if (myEdit)
     myEdit->setValidator(theValidator);
@@ -1413,33 +1320,30 @@ void SalomeApp_EntityEdit::setValidator(const QValidator* theValidator)
     myCombo->setValidator(theValidator);
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::keyPressEvent
-// Purpose  : event filter for KeyPress event
-//================================================================
-void SalomeApp_EntityEdit::keyPressEvent( QKeyEvent * e) 
+/*!
+  Event filter for KeyPress event
+*/
+void SalomeApp_EntityEdit::keyPressEvent( QKeyEvent * e)
 {
-  if ( (e->key() == Key_Enter ||
-        e->key() == Key_Return ) )
+  if ( (e->key() == Qt::Key_Enter ||
+        e->key() == Qt::Key_Return ) )
     onApply();
-  else if (e->key() == Key_Escape)
+  else if (e->key() == Qt::Key_Escape)
     onCancel();
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::onComboActivated
-// Purpose  : called when item activated in combo box
-//================================================================
-void SalomeApp_EntityEdit::onComboActivated(const QString& theText) 
+/*!
+  Called when item activated in combo box
+*/
+void SalomeApp_EntityEdit::onComboActivated(const QString& theText)
 {
   onTextChanged(theText);
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::onTextChanged
-// Purpose  : slot, called when text changed in line edit
-//================================================================
-void SalomeApp_EntityEdit::onTextChanged(const QString& theText) 
+/*!
+  Slot, called when text changed in line edit
+*/
+void SalomeApp_EntityEdit::onTextChanged(const QString& theText)
 {
   if (myApplyBtn)
     myApplyBtn->setEnabled(!(theText == myString));
@@ -1447,11 +1351,10 @@ void SalomeApp_EntityEdit::onTextChanged(const QString& theText)
     myCancelBtn->setEnabled(!(theText == myString));
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::onCancel
-// Purpose  : slot, called when user presses Cancel button
-//================================================================
-void SalomeApp_EntityEdit::onCancel() 
+/*!
+  Slot, called when user presses Cancel button
+*/
+void SalomeApp_EntityEdit::onCancel()
 {
   setText(myString);
   if (myApplyBtn)
@@ -1461,11 +1364,10 @@ void SalomeApp_EntityEdit::onCancel()
   emit escapePressed();
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::onApply
-// Purpose  : slot, called when user presses Apply button
-//================================================================
-void SalomeApp_EntityEdit::onApply() 
+/*!
+  Slot, called when user presses Apply button
+*/
+void SalomeApp_EntityEdit::onApply()
 {
   myString = getText();
   if (myApplyBtn)
@@ -1475,11 +1377,10 @@ void SalomeApp_EntityEdit::onApply()
   emit returnPressed();
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::showButtons
-// Purpose  : shows/hides buttons
-//================================================================
-void SalomeApp_EntityEdit::showButtons(bool show) 
+/*!
+  Shows/hides buttons
+*/
+void SalomeApp_EntityEdit::showButtons(bool show)
 {
   if (myApplyBtn)
     show ? myApplyBtn->show()  : myApplyBtn->hide();
@@ -1487,10 +1388,9 @@ void SalomeApp_EntityEdit::showButtons(bool show)
     show ? myCancelBtn->show() : myCancelBtn->hide();
 }
 
-//================================================================
-// Function : SalomeApp_EntityEdit::setDuplicatesEnabled
-// Purpose  : enables/disables data duplication (for combo box)
-//================================================================
+/*!
+  Enables/disables data duplication (for combo box)
+*/
 void SalomeApp_EntityEdit::setDuplicatesEnabled(bool enabled)
 {
   if (myCombo)