From 461d0396c0f94295f31f1dbd6253a6fbdc66101e Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Fri, 12 Jan 2024 08:48:13 +0100 Subject: [PATCH] replace 'm_listView' by 'm_list_view' --- GUI/View/JobControl/JobListing.cpp | 44 +++++++++++++++--------------- GUI/View/JobControl/JobListing.h | 4 +-- GUI/View/Setup/MaskPanel.cpp | 26 +++++++++--------- GUI/View/Setup/MaskPanel.h | 2 +- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/GUI/View/JobControl/JobListing.cpp b/GUI/View/JobControl/JobListing.cpp index dae63d3513d..4d93a8d6e06 100644 --- a/GUI/View/JobControl/JobListing.cpp +++ b/GUI/View/JobControl/JobListing.cpp @@ -47,8 +47,8 @@ bool row_ascending(const QModelIndex& idx1, const QModelIndex& idx2) JobListing::JobListing(JobModel* jobs, QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f) - , m_listView(new QListView(this)) - , m_listViewDelegate(new JobListingDelegate(this)) + , m_list_view(new QListView(this)) + , m_list_viewDelegate(new JobListingDelegate(this)) , m_model(new JobListModel(jobs, this)) { auto* layout = new QVBoxLayout(this); @@ -83,20 +83,20 @@ JobListing::JobListing(JobModel* jobs, QWidget* parent, Qt::WindowFlags f) layout->addWidget(toolbar); - m_listView->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_list_view->setSelectionMode(QAbstractItemView::ExtendedSelection); - connect(m_listViewDelegate, &JobListingDelegate::cancelButtonClicked, this, + connect(m_list_viewDelegate, &JobListingDelegate::cancelButtonClicked, this, &JobListing::onCancel); - m_listView->setItemDelegate(m_listViewDelegate); - layout->addWidget(m_listView); + m_list_view->setItemDelegate(m_list_viewDelegate); + layout->addWidget(m_list_view); - m_listView->setModel(m_model); + m_list_view->setModel(m_model); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, &QWidget::customContextMenuRequested, this, &JobListing::showContextMenu); - connect(m_listView->selectionModel(), &QItemSelectionModel::selectionChanged, this, + connect(m_list_view->selectionModel(), &QItemSelectionModel::selectionChanged, this, &JobListing::onItemSelectionChanged); connect(m_model, &QAbstractListModel::dataChanged, this, &JobListing::onJobListModelDataChanged); @@ -110,7 +110,7 @@ JobListing::JobListing(JobModel* jobs, QWidget* parent, Qt::WindowFlags f) QVector<JobItem*> JobListing::selectedJobItems() const { QVector<JobItem*> jobs; - for (const QModelIndex& index : m_listView->selectionModel()->selectedIndexes()) + for (const QModelIndex& index : m_list_view->selectionModel()->selectedIndexes()) 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_listView->selectionModel()->selectedIndexes(); + QModelIndexList selected = m_list_view->selectionModel()->selectedIndexes(); // 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 @@ -128,7 +128,7 @@ void JobListing::selectJob(JobItem* job) return; } - m_listView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect); + m_list_view->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect); } //-------------------------------------------------------------------------------------------------- @@ -138,7 +138,7 @@ void JobListing::onItemSelectionChanged() { updateActions(); - QModelIndexList selected = m_listView->selectionModel()->selectedIndexes(); + QModelIndexList selected = m_list_view->selectionModel()->selectedIndexes(); if (selected.size() == 1) gDoc->jobModel()->setSelectedIndex(selected.first().row()); @@ -151,27 +151,27 @@ void JobListing::onJobListModelDataChanged(const QModelIndex& topLeft, // currently only single items change, not ranges; thus ranges are not supported ASSERT(topLeft == bottomRight); - if (m_listView->selectionModel()->isSelected(topLeft)) + if (m_list_view->selectionModel()->isSelected(topLeft)) updateActions(); } void JobListing::onRun() { - for (const QModelIndex& index : m_listView->selectionModel()->selectedIndexes()) + for (const QModelIndex& index : m_list_view->selectionModel()->selectedIndexes()) m_model->runJob(index); gDoc->setModified(); } void JobListing::onCancel() { - for (const QModelIndex& index : m_listView->selectionModel()->selectedIndexes()) + for (const QModelIndex& index : m_list_view->selectionModel()->selectedIndexes()) m_model->cancelJob(index); gDoc->setModified(); } void JobListing::onRemove() { - QModelIndexList indexes = m_listView->selectionModel()->selectedIndexes(); + QModelIndexList indexes = m_list_view->selectionModel()->selectedIndexes(); 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_listView->selectionModel()->selectedIndexes(); + QModelIndexList indexes = m_list_view->selectionModel()->selectedIndexes(); Data2DItem* srcData = srcJob->data2DItem(); if (!srcData) @@ -213,7 +213,7 @@ void JobListing::showContextMenu(const QPoint&) menu.addSeparator(); m_equalizeMenu->clear(); - QModelIndexList indexes = m_listView->selectionModel()->selectedIndexes(); + QModelIndexList indexes = m_list_view->selectionModel()->selectedIndexes(); if (indexes.size() > 1) { std::sort(indexes.begin(), indexes.end(), row_ascending); for (const QModelIndex& index : indexes) { @@ -234,7 +234,7 @@ void JobListing::showContextMenu(const QPoint&) void JobListing::updateActions() { - QModelIndexList indexes = m_listView->selectionModel()->selectedIndexes(); + QModelIndexList indexes = m_list_view->selectionModel()->selectedIndexes(); struct IsRunningOrFitting { JobListModel* m_model; @@ -260,11 +260,11 @@ void JobListing::updateActions() void JobListing::ensureItemSelected(int lastSelectedRow) { - if (!m_listView->selectionModel()->hasSelection() && m_model->rowCount()) { + if (!m_list_view->selectionModel()->hasSelection() && m_model->rowCount()) { QModelIndex last = m_model->index(m_model->rowCount() - 1, 0, QModelIndex()); if (lastSelectedRow >= 0 && lastSelectedRow < m_model->rowCount()) last = m_model->index(lastSelectedRow, 0, QModelIndex()); - m_listView->selectionModel()->select(last, QItemSelectionModel::ClearAndSelect); + m_list_view->selectionModel()->select(last, QItemSelectionModel::ClearAndSelect); } } @@ -273,7 +273,7 @@ void JobListing::restoreSelection() int lastUsed = gDoc->jobModel()->selectedIndex(); if (lastUsed >= 0 && lastUsed < m_model->rowCount()) { QModelIndex lastUsedIndex = m_model->index(lastUsed, 0, QModelIndex()); - m_listView->selectionModel()->select(lastUsedIndex, QItemSelectionModel::ClearAndSelect); + m_list_view->selectionModel()->select(lastUsedIndex, QItemSelectionModel::ClearAndSelect); } else ensureItemSelected(); } diff --git a/GUI/View/JobControl/JobListing.h b/GUI/View/JobControl/JobListing.h index 1b42d93d4b3..05501987a37 100644 --- a/GUI/View/JobControl/JobListing.h +++ b/GUI/View/JobControl/JobListing.h @@ -53,8 +53,8 @@ private: void restoreSelection(); private: - QListView* m_listView; - JobListingDelegate* m_listViewDelegate; + QListView* m_list_view; + JobListingDelegate* m_list_viewDelegate; JobListModel* m_model; QAction* m_runAction; QAction* m_cancelAction; diff --git a/GUI/View/Setup/MaskPanel.cpp b/GUI/View/Setup/MaskPanel.cpp index 2e722d7f0d3..77501fd70fe 100644 --- a/GUI/View/Setup/MaskPanel.cpp +++ b/GUI/View/Setup/MaskPanel.cpp @@ -43,15 +43,15 @@ void addSpinBox(MaskItem* mask, QFormLayout* layout, DoubleProperty& property) MaskPanel::MaskPanel() - : m_listView(new QListView) + : m_list_view(new QListView) , m_mask_list_model(nullptr) , m_currentMaskItem(nullptr) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); setObjectName(QLatin1String("MaskEditorToolPanel")); - m_listView->setContextMenuPolicy(Qt::CustomContextMenu); - connect(m_listView, &QListView::customContextMenuRequested, this, + m_list_view->setContextMenuPolicy(Qt::CustomContextMenu); + connect(m_list_view, &QListView::customContextMenuRequested, this, &MaskPanel::onCustomContextMenuRequested); auto* layout = new QVBoxLayout(this); @@ -63,8 +63,8 @@ MaskPanel::MaskPanel() layout->addWidget(g2); auto* l2 = new QVBoxLayout(g2->body()); l2->setContentsMargins(0, 0, 0, 0); - m_listView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); - l2->addWidget(m_listView); + m_list_view->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); + l2->addWidget(m_list_view); // -- mask properties auto* g3 = new StaticGroupBox("Selected mask", this); @@ -89,25 +89,25 @@ void MaskPanel::updateMaskPanel(MaskeditorListmodel* mask_list_model) { m_mask_list_model = mask_list_model; - m_listView->setModel(m_mask_list_model); - m_listView->setSelectionMode(QAbstractItemView::ExtendedSelection); - m_listView->setRootIndex(m_mask_list_model->maskContItem()->rootIndex); + m_list_view->setModel(m_mask_list_model); + m_list_view->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_list_view->setRootIndex(m_mask_list_model->maskContItem()->rootIndex); - connect(m_listView->selectionModel(), &QItemSelectionModel::selectionChanged, this, + connect(m_list_view->selectionModel(), &QItemSelectionModel::selectionChanged, this, &MaskPanel::onSelectionChanged); } void MaskPanel::resetMaskPanel() { m_mask_list_model = nullptr; - m_listView->setModel(nullptr); + m_list_view->setModel(nullptr); setCurrentMaskItem(nullptr); } QItemSelectionModel* MaskPanel::selectionModel() { - ASSERT(m_listView); - return m_listView->selectionModel(); + ASSERT(m_list_view); + return m_list_view->selectionModel(); } //! Show/Hide panel. When panel is hidden, all property editors are disabled. @@ -137,7 +137,7 @@ void MaskPanel::onSelectionChanged(const QItemSelection& selected, const QItemSe void MaskPanel::onCustomContextMenuRequested(const QPoint& point) { - emit itemContextMenuRequest(m_listView->mapToGlobal(point)); + emit itemContextMenuRequest(m_list_view->mapToGlobal(point)); } //! Private function, called by different functions. diff --git a/GUI/View/Setup/MaskPanel.h b/GUI/View/Setup/MaskPanel.h index 83af012709c..181827f2d65 100644 --- a/GUI/View/Setup/MaskPanel.h +++ b/GUI/View/Setup/MaskPanel.h @@ -58,7 +58,7 @@ private: void addMaskCheckBox(const QString& title, std::function<bool()> getter, std::function<void(bool)> setter); - QListView* m_listView; + QListView* m_list_view; MaskeditorListmodel* m_mask_list_model; QFormLayout* m_editor_layout; MaskItem* m_currentMaskItem; //!< the mask item whose properties shall be edited -- GitLab