mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
Replace deprecated QSignalMapper class
This commit is contained in:
parent
c6ae1aa9d9
commit
3dd969df64
@ -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
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include <QProcess>
|
||||
#include <QRegularExpression>
|
||||
#include <QShortcut>
|
||||
#include <QSignalMapper>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTextStream>
|
||||
@ -91,7 +90,6 @@ namespace
|
||||
SearchWidget::SearchWidget(MainWindow *mainWindow)
|
||||
: QWidget(mainWindow)
|
||||
, m_ui(new Ui::SearchWidget())
|
||||
, m_tabStatusChangedMapper(new QSignalMapper(this))
|
||||
, m_mainWindow(mainWindow)
|
||||
, m_isNewQueryString(false)
|
||||
{
|
||||
@ -131,9 +129,6 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
|
||||
connect(m_ui->tabWidget, &QTabWidget::tabCloseRequested, this, &SearchWidget::closeTab);
|
||||
connect(m_ui->tabWidget, &QTabWidget::currentChanged, this, &SearchWidget::tabChanged);
|
||||
|
||||
connect(m_tabStatusChangedMapper, static_cast<void (QSignalMapper::*)(QWidget *)>(&QSignalMapper::mapped)
|
||||
, this, &SearchWidget::tabStatusChanged);
|
||||
|
||||
const auto *searchManager = SearchPluginManager::instance();
|
||||
const auto onPluginChanged = [this]()
|
||||
{
|
||||
@ -342,9 +337,7 @@ void SearchWidget::on_searchButton_clicked()
|
||||
m_ui->tabWidget->setCurrentWidget(newTab);
|
||||
|
||||
connect(newTab, &SearchJobWidget::resultsCountUpdated, this, &SearchWidget::resultsCountUpdated);
|
||||
connect(newTab, &SearchJobWidget::statusChanged
|
||||
, m_tabStatusChangedMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
||||
m_tabStatusChangedMapper->setMapping(newTab, newTab);
|
||||
connect(newTab, &SearchJobWidget::statusChanged, this, [this, &newTab]() { tabStatusChanged(newTab); });
|
||||
|
||||
m_ui->searchButton->setText(tr("Stop"));
|
||||
m_activeSearchTab = newTab;
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <QWidget>
|
||||
|
||||
class QShortcut;
|
||||
class QSignalMapper;
|
||||
class QTabWidget;
|
||||
|
||||
class MainWindow;
|
||||
@ -81,7 +80,6 @@ private:
|
||||
QString selectedPlugin() const;
|
||||
|
||||
Ui::SearchWidget *m_ui;
|
||||
QSignalMapper *m_tabStatusChangedMapper;
|
||||
QPointer<SearchJobWidget> m_currentSearchTab; // Selected tab
|
||||
QPointer<SearchJobWidget> m_activeSearchTab; // Tab with running search
|
||||
QList<SearchJobWidget *> m_allTabs; // To store all tabs
|
||||
|
Loading…
Reference in New Issue
Block a user