OGS
Utils Namespace Reference

Functions

std::vector< std::string > getSelectedObjects (QStringList const &list)
void moveSelectedItems (QListView *sourceView, QStringListModel &sourceModel, QStringListModel &targetModel)

Function Documentation

◆ getSelectedObjects()

std::vector< std::string > Utils::getSelectedObjects ( QStringList const & list)

Definition at line 8 of file Applications/DataExplorer/Base/Utils.cpp.

9{
10 std::vector<std::string> indexList;
11 std::transform(list.begin(), list.end(), std::back_inserter(indexList),
12 [](auto const& index) { return index.toStdString(); });
13 return indexList;
14}

Referenced by AddFaultsToVoxelGridDialog::accept(), GMSHPrefsDialog::accept(), Layers2GridDialog::accept(), TranslateDataDialog::accept(), and Layers2GridDialog::updateExpectedVoxel().

◆ moveSelectedItems()

void Utils::moveSelectedItems ( QListView * sourceView,
QStringListModel & sourceModel,
QStringListModel & targetModel )

Definition at line 16 of file Applications/DataExplorer/Base/Utils.cpp.

19{
20 QModelIndexList selected = sourceView->selectionModel()->selectedIndexes();
21 QStringList targetList = targetModel.stringList();
22
23 for (const auto& index : selected)
24 {
25 targetList.append(index.data().toString());
26 sourceModel.removeRow(index.row());
27 }
28
29 targetModel.setStringList(targetList);
30}

Referenced by AddFaultsToVoxelGridDialog::on_deselectDataButton_pressed(), TranslateDataDialog::on_deselectDataButton_pressed(), AddFaultsToVoxelGridDialog::on_selectDataButton_pressed(), and TranslateDataDialog::on_selectDataButton_pressed().