From: fps Date: Fri, 15 Nov 2013 16:43:23 +0000 (+0000) Subject: add check box to selection list X-Git-Tag: BR_hydro_v_0_3_1~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2d26dbb649256287d6a7c75cc5a981514fa3e43e;p=modules%2Fgeom.git add check box to selection list --- diff --git a/src/ImportExportGUI/ImportExportGUI_ExportXAODlg.cxx b/src/ImportExportGUI/ImportExportGUI_ExportXAODlg.cxx index 1f232009d..27ae892d0 100644 --- a/src/ImportExportGUI/ImportExportGUI_ExportXAODlg.cxx +++ b/src/ImportExportGUI/ImportExportGUI_ExportXAODlg.cxx @@ -135,9 +135,9 @@ ImportExportGUI_ExportXAODlg::ImportExportGUI_ExportXAODlg(GeometryGUI* geometry // Line 1 lstGroups = new QListWidget(gbxFilter); - lstGroups->setSelectionMode(QAbstractItemView::ExtendedSelection); + lstGroups->setSelectionMode(QAbstractItemView::NoSelection); lstFields = new QListWidget(gbxFilter); - lstFields->setSelectionMode(QAbstractItemView::ExtendedSelection); + lstFields->setSelectionMode(QAbstractItemView::NoSelection); line++; col = 0; gridLayoutFilter->addWidget(lstGroups, line, col++, 1, 1); @@ -215,8 +215,9 @@ void ImportExportGUI_ExportXAODlg::processObject() QListWidgetItem* item = new QListWidgetItem(); item->setData(Qt::UserRole, QVariant(i)); item->setText(GEOMBase::GetName(groups[i])); + item->setFlags(item->flags() | Qt::ItemIsUserCheckable); + item->setCheckState(Qt::Checked); lstGroups->addItem(item); - item->setSelected(true); m_groups.append(GEOM::GeomObjPtr(groups[i].in())); } lstGroups->sortItems(Qt::AscendingOrder); @@ -230,8 +231,9 @@ void ImportExportGUI_ExportXAODlg::processObject() QListWidgetItem* item = new QListWidgetItem(); item->setData(Qt::UserRole, QVariant(i)); item->setText(fields[i]->GetName()); + item->setFlags(item->flags() | Qt::ItemIsUserCheckable); + item->setCheckState(Qt::Checked); lstFields->addItem(item); - item->setSelected(true); m_fields.append(GEOM::GeomFieldPtr(fields[i].in())); } lstFields->sortItems(Qt::AscendingOrder); @@ -274,7 +276,7 @@ bool ImportExportGUI_ExportXAODlg::ClickOnApply() try { if (openCommand()) - if (!execute(/*isApplyAndClose()*/)) + if (!execute()) { abortCommand(); showError(); @@ -407,7 +409,13 @@ bool ImportExportGUI_ExportXAODlg::execute() QString fileName = ledFileName->text(); // get selected groups - QList selGroups = lstGroups->selectedItems(); + QList selGroups; + for (int j = 0; j < lstGroups->count(); ++j) + { + if (lstGroups->item(j)->checkState() == Qt::Checked) + selGroups.append(lstGroups->item(j)); + } + GEOM::ListOfGO_var groups = new GEOM::ListOfGO(); groups->length(selGroups.count()); int i = 0; @@ -419,9 +427,15 @@ bool ImportExportGUI_ExportXAODlg::execute() } // get selected fields - QList selFields = lstFields->selectedItems(); + QList selFields; + for (int j = 0; j < lstFields->count(); ++j) + { + if (lstFields->item(j)->checkState() == Qt::Checked) + selFields.append(lstFields->item(j)); + } + GEOM::ListOfFields_var fields = new GEOM::ListOfFields(); - fields->length(m_fields.count()); + fields->length(selFields.count()); i = 0; for (QList::iterator it = selFields.begin(); it != selFields.end(); ++it) {