Move signal/slot connections out of .ui files

This unify the place (.cpp file) where we handle signal/slot connections.
This commit is contained in:
Chocobo1
2023-07-12 05:08:36 +08:00
parent 20f4d0c4e3
commit b17307f283
36 changed files with 115 additions and 768 deletions

View File

@@ -40,7 +40,9 @@ PeersAdditionDialog::PeersAdditionDialog(QWidget *parent)
, m_ui(new Ui::PeersAdditionDialog())
{
m_ui->setupUi(this);
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PeersAdditionDialog::validateInput);
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
}
PeersAdditionDialog::~PeersAdditionDialog()

View File

@@ -47,22 +47,5 @@
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PeersAdditionDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>183</x>
<y>251</y>
</hint>
<hint type="destinationlabel">
<x>183</x>
<y>136</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>

View File

@@ -53,10 +53,13 @@ TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::Torr
{
m_ui->setupUi(this);
m_ui->downloadButton->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_s, u"download"_s));
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Add"));
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
m_ui->downloadButton->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_s, u"download"_s));
connect(m_ui->downloadButton, &QAbstractButton::clicked, this, &TrackersAdditionDialog::onDownloadButtonClicked);
connect(this, &QDialog::accepted, this, &TrackersAdditionDialog::onAccepted);
loadSettings();

View File

@@ -65,38 +65,5 @@
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>TrackersAdditionDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>TrackersAdditionDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>