Salome HOME
Transaction mechanism for operations corrected.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ZLevelsModel.cxx
index f4ac8eae6e33ce2c3f188b4fa7f498ee79425a32..320ea9631cf4c51f14a2ea6f8594ec447e0f82fd 100644 (file)
@@ -50,7 +50,7 @@ QVariant HYDROGUI_ZLevelsModel::data( const QModelIndex &theIndex, int theRole )
   case Qt::DisplayRole:
     {
       if( aColumn==0 && aRow >=0 && aRow < myObjects.count() )
-        return myObjects.at( aRow ).first;
+        return myObjects.at( aRow ).first->GetName();
       else
         return QVariant();
     }
@@ -60,7 +60,7 @@ QVariant HYDROGUI_ZLevelsModel::data( const QModelIndex &theIndex, int theRole )
     {
       if( aColumn==0 && aRow >=0 && aRow < myObjects.count() )
       {
-        bool isVisible = IsObjectVisible( aRow );
+        bool isVisible = isObjectVisible( aRow );
         if( isVisible )
           return myEye;
         else
@@ -72,7 +72,7 @@ QVariant HYDROGUI_ZLevelsModel::data( const QModelIndex &theIndex, int theRole )
 
   case HYDROGUI_VisibleRole:
     {
-      bool isVisible = IsObjectVisible( aRow );
+      bool isVisible = isObjectVisible( aRow );
       return QVariant( isVisible ).toString();
     }
     break;
@@ -86,14 +86,25 @@ int HYDROGUI_ZLevelsModel::rowCount( const QModelIndex &theParent ) const
   return myObjects.count();
 }
 
-void HYDROGUI_ZLevelsModel::setObjects( const QList<QPair<QString, bool>>& theObjects )
+void HYDROGUI_ZLevelsModel::setObjects( const Object2VisibleList& theObjects )
 {
   myObjects = theObjects;
 
   reset();
 }
 
-bool HYDROGUI_ZLevelsModel::IsObjectVisible( int theIndex ) const
+HYDROGUI_ZLevelsModel::ObjectList HYDROGUI_ZLevelsModel::getObjects() const
+{
+  ObjectList anObjects;
+
+  foreach( const Object2Visible& anItem, myObjects ) {
+    anObjects << anItem.first;
+  }
+
+  return anObjects;
+}
+
+bool HYDROGUI_ZLevelsModel::isObjectVisible( int theIndex ) const
 {
   bool isVisible = false;
 
@@ -212,7 +223,7 @@ bool HYDROGUI_ZLevelsModel::move( const int theItem, const OpType theType,
       if ( theItem > 0 ) {
         aDestinationIndex = theItem - 1;
         if ( theIsVisibleOnly ) {
-          while ( aDestinationIndex >= 0 && !IsObjectVisible( aDestinationIndex ) ) {
+          while ( aDestinationIndex >= 0 && !isObjectVisible( aDestinationIndex ) ) {
             aDestinationIndex--;
           }
         }
@@ -222,7 +233,7 @@ bool HYDROGUI_ZLevelsModel::move( const int theItem, const OpType theType,
       if ( theItem < myObjects.count() - 1 ) {
         aDestinationIndex = theItem + 1;
         if ( theIsVisibleOnly ) {
-          while ( aDestinationIndex < myObjects.count() && !IsObjectVisible( aDestinationIndex ) ) {
+          while ( aDestinationIndex < myObjects.count() && !isObjectVisible( aDestinationIndex ) ) {
             aDestinationIndex++;
           }
         }