Fix implicit lambda captures of this by [=]

Those implicit captures were deprecated in C++20
This commit is contained in:
Dalton Messmer
2024-10-21 21:00:02 -04:00
parent 9d2f99ea33
commit 027042a568
8 changed files with 19 additions and 19 deletions

View File

@@ -341,7 +341,6 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
m_waterfall = new SaWaterfallView(controls, processor, this);
display_splitter->addWidget(m_waterfall);
m_waterfall->setVisible(m_controls->m_waterfallModel.value());
connect(&controls->m_waterfallModel, &BoolModel::dataChanged, [=] {m_waterfall->updateVisibility();});
}

View File

@@ -54,6 +54,7 @@ SaWaterfallView::SaWaterfallView(SaControls *controls, SaProcessor *processor, Q
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
connect(getGUI()->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(periodicUpdate()));
connect(&controls->m_waterfallModel, &BoolModel::dataChanged, this, &SaWaterfallView::updateVisibility);
m_displayTop = 1;
m_displayBottom = height() -2;

View File

@@ -47,7 +47,7 @@ NineButtonSelector::NineButtonSelector(std::array<QPixmap, 18> onOffIcons, int d
m_buttons[i]->setActiveGraphic(onOffIcons[i * 2]);
m_buttons[i]->setInactiveGraphic(onOffIcons[(i * 2) + 1]);
m_buttons[i]->setChecked(false);
connect(m_buttons[i].get(), &PixmapButton::clicked, this, [=](){ this->buttonClicked(i); });
connect(m_buttons[i].get(), &PixmapButton::clicked, this, [=, this](){ buttonClicked(i); });
}
m_lastBtn = m_buttons[defaultButton].get();

View File

@@ -635,7 +635,7 @@ void FileBrowserTreeWidget::contextMenuEvent(QContextMenuEvent * e )
contextMenu.addAction(
tr( "Send to active instrument-track" ),
[=]{ sendToActiveInstrumentTrack(file); }
[=, this]{ sendToActiveInstrumentTrack(file); }
);
contextMenu.addSeparator();
@@ -643,7 +643,7 @@ void FileBrowserTreeWidget::contextMenuEvent(QContextMenuEvent * e )
contextMenu.addAction(
QIcon(embed::getIconPixmap("folder")),
tr("Open containing folder"),
[=]{ openContainingFolder(file); }
[=, this]{ openContainingFolder(file); }
);
auto songEditorHeader = new QAction(tr("Song Editor"), nullptr);
@@ -676,14 +676,14 @@ QList<QAction*> FileBrowserTreeWidget::getContextActions(FileItem* file, bool so
auto toInstrument = new QAction(instrumentAction + tr(" (%2Enter)").arg(shortcutMod), nullptr);
connect(toInstrument, &QAction::triggered,
[=]{ openInNewInstrumentTrack(file, songEditor); });
[=, this]{ openInNewInstrumentTrack(file, songEditor); });
result.append(toInstrument);
if (songEditor && fileIsSample)
{
auto toSampleTrack = new QAction(tr("Send to new sample track (Shift + Enter)"), nullptr);
connect(toSampleTrack, &QAction::triggered,
[=]{ openInNewSampleTrack(file); });
[=, this]{ openInNewSampleTrack(file); });
result.append(toSampleTrack);
}

View File

@@ -94,7 +94,7 @@ MicrotunerConfig::MicrotunerConfig() :
auto scaleCombo = new ComboBox();
scaleCombo->setModel(&m_scaleComboModel);
microtunerLayout->addWidget(scaleCombo, 1, 0, 1, 2);
connect(&m_scaleComboModel, &ComboBoxModel::dataChanged, [=] {updateScaleForm();});
connect(&m_scaleComboModel, &ComboBoxModel::dataChanged, this, &MicrotunerConfig::updateScaleForm);
m_scaleNameEdit = new QLineEdit("12-TET");
m_scaleNameEdit->setToolTip(tr("Scale description. Cannot start with \"!\" and cannot contain a newline character."));
@@ -106,8 +106,8 @@ MicrotunerConfig::MicrotunerConfig() :
saveScaleButton->setToolTip(tr("Save scale definition to a file."));
microtunerLayout->addWidget(loadScaleButton, 3, 0, 1, 1);
microtunerLayout->addWidget(saveScaleButton, 3, 1, 1, 1);
connect(loadScaleButton, &QPushButton::clicked, [=] {loadScaleFromFile();});
connect(saveScaleButton, &QPushButton::clicked, [=] {saveScaleToFile();});
connect(loadScaleButton, &QPushButton::clicked, this, &MicrotunerConfig::loadScaleFromFile);
connect(saveScaleButton, &QPushButton::clicked, this, &MicrotunerConfig::saveScaleToFile);
m_scaleTextEdit = new QPlainTextEdit();
m_scaleTextEdit->setPlainText("100.0\n200.0\n300.0\n400.0\n500.0\n600.0\n700.0\n800.0\n900.0\n1000.0\n1100.0\n1200.0");
@@ -117,7 +117,7 @@ MicrotunerConfig::MicrotunerConfig() :
auto applyScaleButton = new QPushButton(tr("Apply scale changes"));
applyScaleButton->setToolTip(tr("Verify and apply changes made to the selected scale. To use the scale, select it in the settings of a supported instrument."));
microtunerLayout->addWidget(applyScaleButton, 6, 0, 1, 2);
connect(applyScaleButton, &QPushButton::clicked, [=] {applyScale();});
connect(applyScaleButton, &QPushButton::clicked, this, &MicrotunerConfig::applyScale);
// ----------------------------------
// Mapping sub-column
@@ -132,7 +132,7 @@ MicrotunerConfig::MicrotunerConfig() :
auto keymapCombo = new ComboBox();
keymapCombo->setModel(&m_keymapComboModel);
microtunerLayout->addWidget(keymapCombo, 1, 2, 1, 2);
connect(&m_keymapComboModel, &ComboBoxModel::dataChanged, [=] {updateKeymapForm();});
connect(&m_keymapComboModel, &ComboBoxModel::dataChanged, this, &MicrotunerConfig::updateKeymapForm);
m_keymapNameEdit = new QLineEdit("default");
m_keymapNameEdit->setToolTip(tr("Keymap description. Cannot start with \"!\" and cannot contain a newline character."));
@@ -144,8 +144,8 @@ MicrotunerConfig::MicrotunerConfig() :
saveKeymapButton->setToolTip(tr("Save key mapping definition to a file."));
microtunerLayout->addWidget(loadKeymapButton, 3, 2, 1, 1);
microtunerLayout->addWidget(saveKeymapButton, 3, 3, 1, 1);
connect(loadKeymapButton, &QPushButton::clicked, [=] {loadKeymapFromFile();});
connect(saveKeymapButton, &QPushButton::clicked, [=] {saveKeymapToFile();});
connect(loadKeymapButton, &QPushButton::clicked, this, &MicrotunerConfig::loadKeymapFromFile);
connect(saveKeymapButton, &QPushButton::clicked, this, &MicrotunerConfig::saveKeymapToFile);
m_keymapTextEdit = new QPlainTextEdit();
m_keymapTextEdit->setPlainText("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11");
@@ -189,7 +189,7 @@ MicrotunerConfig::MicrotunerConfig() :
auto applyKeymapButton = new QPushButton(tr("Apply keymap changes"));
applyKeymapButton->setToolTip(tr("Verify and apply changes made to the selected key mapping. To use the mapping, select it in the settings of a supported instrument."));
microtunerLayout->addWidget(applyKeymapButton, 6, 2, 1, 2);
connect(applyKeymapButton, &QPushButton::clicked, [=] {applyKeymap();});
connect(applyKeymapButton, &QPushButton::clicked, this, &MicrotunerConfig::applyKeymap);
updateScaleForm();
updateKeymapForm();
@@ -325,7 +325,7 @@ void MicrotunerConfig::updateKeymapForm()
*/
bool MicrotunerConfig::validateScaleForm()
{
auto fail = [=](QString message) {QMessageBox::critical(this, tr("Scale parsing error"), message);};
auto fail = [this](const QString& message){ QMessageBox::critical(this, tr("Scale parsing error"), message); };
// check name
QString name = m_scaleNameEdit->text();
@@ -373,7 +373,7 @@ bool MicrotunerConfig::validateScaleForm()
*/
bool MicrotunerConfig::validateKeymapForm()
{
auto fail = [=](QString message) {QMessageBox::critical(this, tr("Keymap parsing error"), message);};
auto fail = [this](const QString& message){ QMessageBox::critical(this, tr("Keymap parsing error"), message); };
// check name
QString name = m_keymapNameEdit->text();

View File

@@ -297,7 +297,7 @@ void PluginDescWidget::contextMenuEvent(QContextMenuEvent* e)
QMenu contextMenu(this);
contextMenu.addAction(
tr("Send to new instrument track"),
[=]{ openInNewInstrumentTrack(m_pluginKey.desc->name); }
[=, this]{ openInNewInstrumentTrack(m_pluginKey.desc->name); }
);
contextMenu.exec(e->globalPos());
}

View File

@@ -50,7 +50,7 @@ SideBarWidget::SideBarWidget( const QString & _title, const QPixmap & _icon,
m_closeBtn->resize(m_buttonSize);
m_closeBtn->setToolTip(tr("Close"));
connect(m_closeBtn, &QPushButton::clicked,
[=]() { this->closeButtonClicked(); });
[this]() { this->closeButtonClicked(); });
}

View File

@@ -3098,7 +3098,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe )
// allow quantization grid up to 1/32 for normal notes
else if (q < 6) { q = 6; }
}
auto xCoordOfTick = [=](int tick) {
auto xCoordOfTick = [this](int tick) {
return m_whiteKeyWidth + (
(tick - m_currentPosition) * m_ppb / TimePos::ticksPerBar()
);