From ef1bbe92962dd7b6e92012aaf0e16f4092eb425f Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 1 Jun 2006 10:43:42 +0000 Subject: [PATCH] Disable sorting in shapes and materials list view to prevent material indices mess. --- src/OperationGUI/OperationGUI_MaterialDlg.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/OperationGUI/OperationGUI_MaterialDlg.cxx b/src/OperationGUI/OperationGUI_MaterialDlg.cxx index 87492c692..5f0c9a25e 100644 --- a/src/OperationGUI/OperationGUI_MaterialDlg.cxx +++ b/src/OperationGUI/OperationGUI_MaterialDlg.cxx @@ -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(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"); -- 2.39.2