From 8707a1bc86212f8982b20234bab0ff1462e62d25 Mon Sep 17 00:00:00 2001 From: thalieht Date: Tue, 8 May 2018 16:13:17 +0300 Subject: [PATCH] Move some connect() from propertieswidget to their corresponding widget --- src/gui/properties/peerlistwidget.cpp | 3 +++ src/gui/properties/propertieswidget.cpp | 6 ------ src/gui/properties/trackerlist.cpp | 5 ++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/properties/peerlistwidget.cpp b/src/gui/properties/peerlistwidget.cpp index 916ede450..67cbb9e6a 100644 --- a/src/gui/properties/peerlistwidget.cpp +++ b/src/gui/properties/peerlistwidget.cpp @@ -130,6 +130,9 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent) header()->setContextMenuPolicy(Qt::CustomContextMenu); connect(header(), &QWidget::customContextMenuRequested, this, &PeerListWidget::displayToggleColumnsMenu); connect(header(), &QHeaderView::sectionClicked, this, &PeerListWidget::handleSortColumnChanged); + connect(header(), &QHeaderView::sectionMoved, this, &PeerListWidget::saveSettings); + connect(header(), &QHeaderView::sectionResized, this, &PeerListWidget::saveSettings); + connect(header(), &QHeaderView::sortIndicatorChanged, this, &PeerListWidget::saveSettings); handleSortColumnChanged(header()->sortIndicatorSection()); m_copyHotkey = new QShortcut(QKeySequence::Copy, this, nullptr, nullptr, Qt::WidgetShortcut); connect(m_copyHotkey, &QShortcut::activated, this, &PeerListWidget::copySelectedPeers); diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index 74c5f4665..df49c23e6 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -140,15 +140,9 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow *mainWindow, Tran connect(m_ui->trackerUpButton, &QPushButton::clicked, m_trackerList, &TrackerList::moveSelectionUp); connect(m_ui->trackerDownButton, &QPushButton::clicked, m_trackerList, &TrackerList::moveSelectionDown); m_ui->horizontalLayout_trackers->insertWidget(0, m_trackerList); - connect(m_trackerList->header(), SIGNAL(sectionMoved(int,int,int)), m_trackerList, SLOT(saveSettings())); - connect(m_trackerList->header(), SIGNAL(sectionResized(int,int,int)), m_trackerList, SLOT(saveSettings())); - connect(m_trackerList->header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), m_trackerList, SLOT(saveSettings())); // Peers list m_peerList = new PeerListWidget(this); m_ui->peerpage_layout->addWidget(m_peerList); - connect(m_peerList->header(), SIGNAL(sectionMoved(int,int,int)), m_peerList, SLOT(saveSettings())); - connect(m_peerList->header(), SIGNAL(sectionResized(int,int,int)), m_peerList, SLOT(saveSettings())); - connect(m_peerList->header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), m_peerList, SLOT(saveSettings())); // Speed widget m_speedWidget = new SpeedWidget(this); m_ui->speedLayout->addWidget(m_speedWidget); diff --git a/src/gui/properties/trackerlist.cpp b/src/gui/properties/trackerlist.cpp index b9c13bb34..8d66d4b62 100644 --- a/src/gui/properties/trackerlist.cpp +++ b/src/gui/properties/trackerlist.cpp @@ -79,9 +79,12 @@ TrackerList::TrackerList(PropertiesWidget *properties) // Context menu setContextMenuPolicy(Qt::CustomContextMenu); connect(this, &QWidget::customContextMenuRequested, this, &TrackerList::showTrackerListMenu); - // Header context menu + // Header header()->setContextMenuPolicy(Qt::CustomContextMenu); connect(header(), &QWidget::customContextMenuRequested, this, &TrackerList::displayToggleColumnsMenu); + connect(header(), &QHeaderView::sectionMoved, this, &TrackerList::saveSettings); + connect(header(), &QHeaderView::sectionResized, this, &TrackerList::saveSettings); + connect(header(), &QHeaderView::sortIndicatorChanged, this, &TrackerList::saveSettings); // Set DHT, PeX, LSD items m_DHTItem = new QTreeWidgetItem({ "", "** [DHT] **", "", "0", "", "", "0" }); insertTopLevelItem(0, m_DHTItem);