diff --git a/GUI/Model/Device/InstrumentsSet.h b/GUI/Model/Device/InstrumentsSet.h index d517efdb12d070912e9c750d570edca6f1fbd223..cad9bbca1ad34f2d545284e75873f1492f26bbed 100644 --- a/GUI/Model/Device/InstrumentsSet.h +++ b/GUI/Model/Device/InstrumentsSet.h @@ -62,7 +62,7 @@ public: QString suggestInstrumentName(const QString& baseName) const; QStringList instrumentNames() const; - int selectedIndex() const { return m_current_index; } + int currentIndex() const { return m_current_index; } void setSelectedIndex(int newIndex) { m_current_index = newIndex; } //! Set an instrument's name and emit the respective signal. diff --git a/GUI/Model/Files/DatafilesSet.h b/GUI/Model/Files/DatafilesSet.h index 81ab0e823c72a16a5d31ad28e9e57097a734db0f..d1f83a4ae9440f82180bf50053ac7b234be53ef2 100644 --- a/GUI/Model/Files/DatafilesSet.h +++ b/GUI/Model/Files/DatafilesSet.h @@ -52,7 +52,7 @@ public: QStringList realItemNames() const; - int selectedIndex() const { return m_current_index; } + int currentIndex() const { return m_current_index; } void setSelectedIndex(int index) { m_current_index = index; } int selectedRank() const { return m_selected_rank; } diff --git a/GUI/Model/Job/ParameterTreeItems.h b/GUI/Model/Job/ParameterTreeItems.h index 009018a283fc3957ece8620f426ccb8d9098004f..6f027d3d756393ec1a4af02e4bdd5fc7cbc7b8fa 100644 --- a/GUI/Model/Job/ParameterTreeItems.h +++ b/GUI/Model/Job/ParameterTreeItems.h @@ -108,7 +108,7 @@ public: QObject* parameterTreeRoot(); - int selectedIndex() const { return m_current_index; } + int currentIndex() const { return m_current_index; } void setSelectedIndex(int i) { m_current_index = i; } private: diff --git a/GUI/Model/Mask/MasksQModel.cpp b/GUI/Model/Mask/MasksQModel.cpp index 85cea887c7549d381cf309d2b49cb2f88da6b8f9..1568f761c8dec620c097170d3af2a65ede847af6 100644 --- a/GUI/Model/Mask/MasksQModel.cpp +++ b/GUI/Model/Mask/MasksQModel.cpp @@ -117,7 +117,7 @@ const ProjectionList* MasksQModel::projnItem() const void MasksQModel::moveUp() { - for (const QModelIndex& itemIndex : m_selection_model->selectedIndexes()) { + for (const QModelIndex& itemIndex : m_selection_model->currentIndexes()) { int row = itemIndex.row(); int new_row = row - 1; if (new_row >= 0 && new_row < rowCount({})) @@ -127,7 +127,7 @@ void MasksQModel::moveUp() void MasksQModel::moveDown() { - for (const QModelIndex& itemIndex : m_selection_model->selectedIndexes()) { + for (const QModelIndex& itemIndex : m_selection_model->currentIndexes()) { int row = itemIndex.row(); int new_row = row + 1; if (new_row >= 0 && new_row < rowCount({})) @@ -140,7 +140,7 @@ void MasksQModel::moveDown() void MasksQModel::removeSelected() { while (true) { - QModelIndexList indexes = m_selection_model->selectedIndexes(); + QModelIndexList indexes = m_selection_model->currentIndexes(); if (indexes.empty()) break; removeMaskAt(indexes.back().row()); @@ -149,7 +149,7 @@ void MasksQModel::removeSelected() void MasksQModel::toggleMaskValue() { - for (auto itemIndex : maskSelectionModel()->selectedIndexes()) + for (auto itemIndex : maskSelectionModel()->currentIndexes()) if (MaskItem* item = itemForIndex(itemIndex)) item->setMaskValue(!item->maskValue()); } diff --git a/GUI/Model/Sample/SamplesSet.h b/GUI/Model/Sample/SamplesSet.h index aa5643cbeb56a83b3b79d674660491c18454b743..8ecb328f713f9613123f76a38b5d8ea0c8a819d5 100644 --- a/GUI/Model/Sample/SamplesSet.h +++ b/GUI/Model/Sample/SamplesSet.h @@ -38,7 +38,7 @@ public: void writeTo(QXmlStreamWriter* w) const; void readFrom(QXmlStreamReader* r); - int selectedIndex() const { return m_current_index; } + int currentIndex() const { return m_current_index; } void setSelectedIndex(int newIndex) { m_current_index = newIndex; } private: diff --git a/GUI/View/Data/DatafilesSelector.cpp b/GUI/View/Data/DatafilesSelector.cpp index 95d95c2a679f16ada87ea95be81b6c4505358b81..6293fd3a54ae570bd34cc27da35beaf79316f689 100644 --- a/GUI/View/Data/DatafilesSelector.cpp +++ b/GUI/View/Data/DatafilesSelector.cpp @@ -168,7 +168,7 @@ void DatafilesSelector::setCurrentDatafileItem(DatafileItem* item) void DatafilesSelector::restoreSelection() { - int lastIndex = gDoc->realModel()->selectedIndex(); + int lastIndex = gDoc->realModel()->currentIndex(); int lastRank = gDoc->realModel()->selectedRank(); QModelIndex lastUsedIndex = m_tree_model->index(lastIndex, 0, m_tree_model->indexOfHeadline(lastRank)); diff --git a/GUI/View/Instrument/InstrumentsQListView.cpp b/GUI/View/Instrument/InstrumentsQListView.cpp index 9db709702582b5bade0a7cc08ff85df6873995a9..deef94531b54cbd1b16d4ffb3eb86229c6153bf0 100644 --- a/GUI/View/Instrument/InstrumentsQListView.cpp +++ b/GUI/View/Instrument/InstrumentsQListView.cpp @@ -84,7 +84,7 @@ QSize InstrumentsQListView::minimumSizeHint() const InstrumentItem* InstrumentsQListView::currentInstrumentItem() const { - const QModelIndexList indexes = selectionModel()->selectedIndexes(); + const QModelIndexList indexes = selectionModel()->currentIndexes(); if (!indexes.empty()) return m_model->instrumentItemForIndex(indexes.front()); return nullptr; @@ -94,7 +94,7 @@ void InstrumentsQListView::onItemSelectionChanged() { updateActions(); - QModelIndexList indexes = selectionModel()->selectedIndexes(); + QModelIndexList indexes = selectionModel()->currentIndexes(); if (!indexes.empty()) { QModelIndex current = indexes.front(); gDoc->instrumentsSet()->setSelectedIndex(current.row()); @@ -130,7 +130,7 @@ void InstrumentsQListView::onNewDepthprobe() //! Removes currently selected instrument. void InstrumentsQListView::onRemove() { - QModelIndexList indexes = selectionModel()->selectedIndexes(); + QModelIndexList indexes = selectionModel()->currentIndexes(); if (!indexes.empty()) { m_model->removeInstrument(indexes.front()); @@ -141,7 +141,7 @@ void InstrumentsQListView::onRemove() //! Makes a copy of the currently selected instrument. void InstrumentsQListView::onCopy() { - QModelIndexList indexes = selectionModel()->selectedIndexes(); + QModelIndexList indexes = selectionModel()->currentIndexes(); if (!indexes.empty()) { QModelIndex idx = m_model->copyInstrument(indexes.front()); selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect); @@ -150,7 +150,7 @@ void InstrumentsQListView::onCopy() void InstrumentsQListView::onStoreInLibrary() const { - QModelIndex idx = selectionModel()->selectedIndexes().front(); + QModelIndex idx = selectionModel()->currentIndexes().front(); InstrumentItem* ii = m_model->instrumentItemForIndex(idx); if (!ii) return; @@ -206,7 +206,7 @@ void InstrumentsQListView::ensureItemSelected() void InstrumentsQListView::restoreSelection() { - int lastUsed = gDoc->instrumentsSet()->selectedIndex(); + int lastUsed = gDoc->instrumentsSet()->currentIndex(); if (lastUsed >= 0 && lastUsed < m_model->rowCount()) { QModelIndex lastUsedIndex = m_model->index(lastUsed, 0, QModelIndex()); selectionModel()->select(lastUsedIndex, QItemSelectionModel::ClearAndSelect); diff --git a/GUI/View/JobControl/JobListing.cpp b/GUI/View/JobControl/JobListing.cpp index 06f40cca7d280ac1e1d8d7804c3fa6a415a464ed..aa3f63cac16b5ce3d3a8fd0926353211ed2016f0 100644 --- a/GUI/View/JobControl/JobListing.cpp +++ b/GUI/View/JobControl/JobListing.cpp @@ -110,7 +110,7 @@ JobListing::JobListing(JobsSet* jobs, QWidget* parent, Qt::WindowFlags f) QVector<JobItem*> JobListing::selectedJobItems() const { QVector<JobItem*> jobs; - for (const QModelIndex& index : m_list_view->selectionModel()->selectedIndexes()) + for (const QModelIndex& index : m_list_view->selectionModel()->currentIndexes()) jobs.push_back(m_model->jobItemForIndex(index)); return jobs; } @@ -118,7 +118,7 @@ QVector<JobItem*> JobListing::selectedJobItems() const void JobListing::selectJob(JobItem* job) { QModelIndex idx = m_model->indexForJob(job); - QModelIndexList selected = m_list_view->selectionModel()->selectedIndexes(); + QModelIndexList selected = m_list_view->selectionModel()->currentIndexes(); // Already selected, but we still will emit the signal to notify widgets. // To handle the case, when the job was selected before it completed (and some stack widgets @@ -139,7 +139,7 @@ void JobListing::onItemSelectionChanged() { updateActions(); - QModelIndexList selected = m_list_view->selectionModel()->selectedIndexes(); + QModelIndexList selected = m_list_view->selectionModel()->currentIndexes(); if (selected.size() == 1) gDoc->jobsSet()->setJobIndex(selected.first().row()); @@ -157,21 +157,21 @@ void JobListing::onJobsQModelDataChanged(const QModelIndex& topLeft, const QMode void JobListing::onRun() { - for (const QModelIndex& index : m_list_view->selectionModel()->selectedIndexes()) + for (const QModelIndex& index : m_list_view->selectionModel()->currentIndexes()) m_model->launchJob(index); gDoc->setModified(); } void JobListing::onCancel() { - for (const QModelIndex& index : m_list_view->selectionModel()->selectedIndexes()) + for (const QModelIndex& index : m_list_view->selectionModel()->currentIndexes()) m_model->cancelJob(index); gDoc->setModified(); } void JobListing::onRemove() { - QModelIndexList indexes = m_list_view->selectionModel()->selectedIndexes(); + QModelIndexList indexes = m_list_view->selectionModel()->currentIndexes(); ASSERT(!indexes.isEmpty()); std::sort(indexes.begin(), indexes.end(), row_descending); for (const QModelIndex& index : indexes) @@ -185,7 +185,7 @@ void JobListing::onRemove() void JobListing::equalizeSelectedToJob(JobItem* srcJob) { - QModelIndexList indexes = m_list_view->selectionModel()->selectedIndexes(); + QModelIndexList indexes = m_list_view->selectionModel()->currentIndexes(); Data2DItem* srcData = srcJob->data2DItem(); if (!srcData) @@ -213,7 +213,7 @@ void JobListing::showContextMenu(const QPoint&) menu.addSeparator(); m_equalize_menu->clear(); - QModelIndexList indexes = m_list_view->selectionModel()->selectedIndexes(); + QModelIndexList indexes = m_list_view->selectionModel()->currentIndexes(); if (indexes.size() > 1) { std::sort(indexes.begin(), indexes.end(), row_ascending); for (const QModelIndex& index : indexes) { @@ -235,7 +235,7 @@ void JobListing::showContextMenu(const QPoint&) void JobListing::updateActions() { - QModelIndexList indexes = m_list_view->selectionModel()->selectedIndexes(); + QModelIndexList indexes = m_list_view->selectionModel()->currentIndexes(); struct IsRunningOrFitting { JobsQModel* m_model; diff --git a/GUI/View/Sample/SamplesQListView.cpp b/GUI/View/Sample/SamplesQListView.cpp index 0ad137214785f9da30199fe0aaf2456b241d4491..cc73f483dc98c99e78855cbe0947aa5a5e40dc74 100644 --- a/GUI/View/Sample/SamplesQListView.cpp +++ b/GUI/View/Sample/SamplesQListView.cpp @@ -198,13 +198,13 @@ void SamplesQListView::onCurrentChanged(const QModelIndex& index) void SamplesQListView::restoreSelection() { - int selected = gDoc->sampleModel()->selectedIndex(); + int selected = gDoc->sampleModel()->currentIndex(); if (selected < 0 || selected >= m_model->rowCount()) selected = m_model->rowCount() - 1; - QModelIndex selectedIndex = m_model->index(selected, 0, QModelIndex()); - if (selectedIndex.isValid()) { - selectionModel()->select(selectedIndex, QItemSelectionModel::ClearAndSelect); + QModelIndex currentIndex = m_model->index(selected, 0, QModelIndex()); + if (currentIndex.isValid()) { + selectionModel()->select(currentIndex, QItemSelectionModel::ClearAndSelect); setCurrentSample(gDoc->sampleModel()->sampleItems()[selected]); } } diff --git a/GUI/View/Tuning/FitParameterWidget.cpp b/GUI/View/Tuning/FitParameterWidget.cpp index 216e3f124397a9ea63f1fa261d40a302a8b60a14..ae0f5741830efb2d72d6a83cbf140718146346af 100644 --- a/GUI/View/Tuning/FitParameterWidget.cpp +++ b/GUI/View/Tuning/FitParameterWidget.cpp @@ -314,7 +314,7 @@ void FitParameterWidget::setActionsEnabled(bool value) QVector<FitParameterItem*> FitParameterWidget::selectedFitParameterItems() { QVector<FitParameterItem*> result; - QModelIndexList indexes = m_tree_view->selectionModel()->selectedIndexes(); + QModelIndexList indexes = m_tree_view->selectionModel()->currentIndexes(); for (auto index : indexes) { auto* item = static_cast<QObject*>(index.internalPointer()); if (auto* fitParItem = dynamic_cast<FitParameterItem*>(item)) @@ -340,7 +340,7 @@ QVector<FitParameterItem*> FitParameterWidget::emptyFitParameterItems() QStringList FitParameterWidget::selectedFitParameterLinks() { QStringList result; - QModelIndexList indexes = m_tree_view->selectionModel()->selectedIndexes(); + QModelIndexList indexes = m_tree_view->selectionModel()->currentIndexes(); for (QModelIndex index : indexes) { auto* item = static_cast<QObject*>(index.internalPointer()); if (auto* linkItem = dynamic_cast<LinkItem*>(item)) diff --git a/GUI/View/Tuning/ParameterBackupWidget.cpp b/GUI/View/Tuning/ParameterBackupWidget.cpp index 7d022dd57aa7114a9b42e20952cfe1bf1622ba22..9c611ccb7fcbe9fdacf47b3890c14cbfbc5d4092 100644 --- a/GUI/View/Tuning/ParameterBackupWidget.cpp +++ b/GUI/View/Tuning/ParameterBackupWidget.cpp @@ -133,7 +133,7 @@ void ParameterBackupWidget::fillCombo() { disconnect(m_combo, nullptr, nullptr, nullptr); - int index = m_container->selectedIndex(); + int index = m_container->currentIndex(); m_combo->clear(); m_combo->addItems(m_container->backupTitles()); if (index >= 0) { diff --git a/GUI/View/Tuning/ParameterTuningWidget.cpp b/GUI/View/Tuning/ParameterTuningWidget.cpp index 499575ad01ba3fe559b12eadbba24e768b643eb6..1082f0de07a9f967034e74d1cc059e7b378732d6 100644 --- a/GUI/View/Tuning/ParameterTuningWidget.cpp +++ b/GUI/View/Tuning/ParameterTuningWidget.cpp @@ -148,7 +148,7 @@ QItemSelectionModel* ParameterTuningWidget::selectionModel() QVector<ParameterItem*> ParameterTuningWidget::selectedParameterItems() { QVector<ParameterItem*> result; - for (auto index : selectionModel()->selectedIndexes()) + for (auto index : selectionModel()->currentIndexes()) if (ParameterItem* parItem = m_parameter_tuning_model->getParameterItem(index)) result.push_back(parItem);