Remove remaining usages of QSignalMapper

This commit is contained in:
Lukas W
2019-08-27 15:19:42 +02:00
parent 2c5bf2b9dd
commit d9f1383ca9
4 changed files with 10 additions and 14 deletions

View File

@@ -46,7 +46,6 @@ class QPixmap;
class QScrollBar;
class QString;
class QMenu;
class QSignalMapper;
class ComboBox;
class NotePlayHandle;

View File

@@ -29,7 +29,6 @@
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QWidget>
#include <QSignalMapper>
#include <QColor>
#include <QMimeData>

View File

@@ -1239,6 +1239,7 @@ void InstrumentTrackView::muteChanged()
//FIXME: This is identical to SampleTrackView::createFxMenu
QMenu * InstrumentTrackView::createFxMenu(QString title, QString newFxLabel)
{
int channelIndex = model()->effectChannelModel()->value();
@@ -1253,8 +1254,6 @@ QMenu * InstrumentTrackView::createFxMenu(QString title, QString newFxLabel)
QMenu *fxMenu = new QMenu( title );
QSignalMapper * fxMenuSignalMapper = new QSignalMapper(fxMenu);
fxMenu->addAction( newFxLabel, this, SLOT( createFxLine() ) );
fxMenu->addSeparator();
@@ -1264,14 +1263,14 @@ QMenu * InstrumentTrackView::createFxMenu(QString title, QString newFxLabel)
if ( currentChannel != fxChannel )
{
auto index = currentChannel->m_channelIndex;
QString label = tr( "FX %1: %2" ).arg( currentChannel->m_channelIndex ).arg( currentChannel->m_name );
QAction * action = fxMenu->addAction( label, fxMenuSignalMapper, SLOT( map() ) );
fxMenuSignalMapper->setMapping(action, currentChannel->m_channelIndex);
fxMenu->addAction(label, [this, index](){
assignFxLine(index);
});
}
}
connect(fxMenuSignalMapper, SIGNAL(mapped(int)), this, SLOT(assignFxLine(int)));
return fxMenu;
}

View File

@@ -847,6 +847,7 @@ SampleTrackView::~SampleTrackView()
//FIXME: This is identical to InstrumentTrackView::createFxMenu
QMenu * SampleTrackView::createFxMenu(QString title, QString newFxLabel)
{
int channelIndex = model()->effectChannelModel()->value();
@@ -861,8 +862,6 @@ QMenu * SampleTrackView::createFxMenu(QString title, QString newFxLabel)
QMenu *fxMenu = new QMenu(title);
QSignalMapper * fxMenuSignalMapper = new QSignalMapper(fxMenu);
fxMenu->addAction(newFxLabel, this, SLOT(createFxLine()));
fxMenu->addSeparator();
@@ -872,14 +871,14 @@ QMenu * SampleTrackView::createFxMenu(QString title, QString newFxLabel)
if (currentChannel != fxChannel)
{
const auto index = currentChannel->m_channelIndex;
QString label = tr("FX %1: %2").arg(currentChannel->m_channelIndex).arg(currentChannel->m_name);
QAction * action = fxMenu->addAction(label, fxMenuSignalMapper, SLOT(map()));
fxMenuSignalMapper->setMapping(action, currentChannel->m_channelIndex);
fxMenu->addAction(label, [this, index](){
assignFxLine(index);
});
}
}
connect(fxMenuSignalMapper, SIGNAL(mapped(int)), this, SLOT(assignFxLine(int)));
return fxMenu;
}