]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Disable sorting in shapes and materials list view to prevent material indices mess. BR_DEBUG_3_2_0b1
authorjfa <jfa@opencascade.com>
Thu, 1 Jun 2006 10:43:42 +0000 (10:43 +0000)
committerjfa <jfa@opencascade.com>
Thu, 1 Jun 2006 10:43:42 +0000 (10:43 +0000)
src/OperationGUI/OperationGUI_MaterialDlg.cxx

index 87492c692130e8d224f07850f48bbbcb2db87c43..5f0c9a25e4266da978109a54a94632679b020eaf 100644 (file)
@@ -72,6 +72,7 @@ OperationGUI_MaterialDlg::OperationGUI_MaterialDlg (GeometryGUI* theGeometryGUI,
   myShapeCol = GroupPoints->ListView1->addColumn(tr("GEOM_MATERIAL_SHAPE"));
   myMaterCol = GroupPoints->ListView1->addColumn(tr("GEOM_MATERIAL_MATERIAL"));
   GroupPoints->ListView1->setSelectionMode(QListView::Extended);
+  GroupPoints->ListView1->setSorting(-1);
 
   GroupPoints->TextLabel1->setText(tr("GEOM_MATERIAL_ID"));
   GroupPoints->PushButton1->setText(tr("GEOM_MATERIAL_SET"));
@@ -104,10 +105,11 @@ void OperationGUI_MaterialDlg::Init()
     dynamic_cast<OperationGUI_PartitionDlg*>(myParentDlg);
   if (aParentDlg)
     myListMaterials = aParentDlg->GetListMaterials();
-  
+
   /* list filling */
   MESSAGE("Filling list with " << myListShapes.length() << " objects");
   QString aMaterialId;
+  QListViewItem *anItem = NULL;
   for (int ind = 0; ind < myListShapes.length(); ind++) {
     GEOM::GEOM_Object_var anObject = myListShapes[ind];
     if (!anObject->_is_nil()) {
@@ -116,8 +118,14 @@ void OperationGUI_MaterialDlg::Init()
        aMaterialId = QString::number(myListMaterials[ind]);
       else 
        aMaterialId = "0";
-      QListViewItem* aItem =
-        new QListViewItem(GroupPoints->ListView1, GEOMBase::GetName( anObject ), aMaterialId);
+      if (anItem)
+        // insert after aPrevItem
+        anItem = new QListViewItem(GroupPoints->ListView1, anItem,
+                                   GEOMBase::GetName( anObject ), aMaterialId);
+      else
+        // the first item creation
+        anItem = new QListViewItem(GroupPoints->ListView1,
+                                   GEOMBase::GetName( anObject ), aMaterialId);
     }
   }
   MESSAGE("Filled");