Skip to content

Commit

Permalink
Merge pull request #4402 from Be-ing/std_next
Browse files Browse the repository at this point in the history
use std::next on iterators
  • Loading branch information
daschuer authored Oct 13, 2021
2 parents 9a446a0 + 5df3564 commit 905f962
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/preferences/broadcastsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void BroadcastSettings::onConnectionStatusChanged(int newStatus) {
}

BroadcastProfilePtr BroadcastSettings::profileAt(int index) {
auto it = m_profiles.begin() + index;
auto it = std::next(m_profiles.begin(), index);
return it != m_profiles.end() ? it.value() : BroadcastProfilePtr(nullptr);
}

Expand Down
4 changes: 2 additions & 2 deletions src/preferences/broadcastsettingsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ QVariant BroadcastSettingsModel::data(const QModelIndex& index, int role) const
return QVariant();
}

auto it = m_profiles.constBegin() + rowIndex;
auto it = std::next(m_profiles.constBegin(), rowIndex);
if (it != m_profiles.constEnd()) {
BroadcastProfilePtr profile = it.value();
int column = index.column();
Expand Down Expand Up @@ -165,7 +165,7 @@ Qt::ItemFlags BroadcastSettingsModel::flags(const QModelIndex& index) const {

bool BroadcastSettingsModel::setData(const QModelIndex& index, const QVariant& value, int role) {
if (index.isValid()) {
auto it = m_profiles.constBegin() + index.row();
auto it = std::next(m_profiles.constBegin(), index.row());
if (it != m_profiles.constEnd()) {
BroadcastProfilePtr profile = it.value();
if (index.column() == kColumnEnabled && role == Qt::CheckStateRole) {
Expand Down

0 comments on commit 905f962

Please sign in to comment.