mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-04 14:42:29 -06:00
Replace deprecated QSignalMapper class
This commit is contained in:
@@ -32,7 +32,6 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QSignalMapper>
|
||||
#include <QTimer>
|
||||
|
||||
#include <libtorrent/session_status.hpp>
|
||||
@@ -89,18 +88,13 @@ SpeedWidget::SpeedWidget(PropertiesWidget *parent)
|
||||
m_graphsMenu->addAction(tr("Tracker Download"));
|
||||
|
||||
m_graphsMenuActions = m_graphsMenu->actions();
|
||||
m_graphsSignalMapper = new QSignalMapper(this);
|
||||
|
||||
for (int id = SpeedPlotView::UP; id < SpeedPlotView::NB_GRAPHS; ++id) {
|
||||
QAction *action = m_graphsMenuActions.at(id);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(true);
|
||||
connect(action, &QAction::changed, m_graphsSignalMapper
|
||||
, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
||||
m_graphsSignalMapper->setMapping(action, id);
|
||||
connect(action, &QAction::changed, this, [this, id]() { onGraphChange(id); });
|
||||
}
|
||||
connect(m_graphsSignalMapper, static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped)
|
||||
, this, &SpeedWidget::onGraphChange);
|
||||
|
||||
m_graphsButton = new ComboBoxMenuButton(this, m_graphsMenu);
|
||||
m_graphsButton->addItem(tr("Select Graphs"));
|
||||
|
||||
@@ -38,7 +38,6 @@ class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QMenu;
|
||||
class QSignalMapper;
|
||||
class PropertiesWidget;
|
||||
|
||||
class ComboBoxMenuButton : public QComboBox
|
||||
@@ -80,7 +79,6 @@ private:
|
||||
ComboBoxMenuButton *m_graphsButton;
|
||||
QMenu *m_graphsMenu;
|
||||
QList<QAction *> m_graphsMenuActions;
|
||||
QSignalMapper *m_graphsSignalMapper;
|
||||
};
|
||||
|
||||
#endif // SPEEDWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user