Commit f95c5e23 authored by Nicolas Fella's avatar Nicolas Fella

Avoid manual casting of signals/slots

In one case by renaming a slot so it isn't overloaded any more.
In other cases by using QOverload
parent db25e5d3
......@@ -121,8 +121,8 @@ SettingsDialog::SettingsDialog(TopLevel *toplevel, const QList<Tea> &teas)
connect(ui->downButton, &QToolButton::clicked, this, &SettingsDialog::downButtonClicked);
connect(ui->teaNameEdit, &QLineEdit::textChanged, this, &SettingsDialog::nameValueChanged);
connect(ui->minutesSpin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &SettingsDialog::timeValueChanged);
connect(ui->secondsSpin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &SettingsDialog::timeValueChanged);
connect(ui->minutesSpin, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsDialog::timeValueChanged);
connect(ui->secondsSpin, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsDialog::timeValueChanged);
}
SettingsDialog::~SettingsDialog()
......
......@@ -82,8 +82,8 @@ TimeEditDialog::TimeEditDialog(TopLevel *toplevel)
x = qMin( qMax( 0, y ), desktopSize.height() - height() );
move( QPoint( x, y ) );
connect(ui->minutes, static_cast<void (KPluralHandlingSpinBox::*)(int)>(&KPluralHandlingSpinBox::valueChanged), this, &TimeEditDialog::checkOkButtonState);
connect(ui->seconds, static_cast<void (KPluralHandlingSpinBox::*)(int)>(&KPluralHandlingSpinBox::valueChanged), this, &TimeEditDialog::checkOkButtonState);
connect(ui->minutes, QOverload<int>::of(&KPluralHandlingSpinBox::valueChanged), this, &TimeEditDialog::checkOkButtonState);
connect(ui->seconds, QOverload<int>::of(&KPluralHandlingSpinBox::valueChanged), this, &TimeEditDialog::checkOkButtonState);
connect(buttonBox, &QDialogButtonBox::accepted, this, &TimeEditDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &TimeEditDialog::reject);
......
......@@ -131,7 +131,7 @@ TopLevel::TopLevel(const KAboutData *aboutData, const QString &icon, QWidget *pa
m_timer = new QTimer( this );
connect(m_timer, &QTimer::timeout, this, &TopLevel::teaTimeEvent);
connect(contextMenu(), static_cast<void (QMenu::*)(QAction*)>(&QMenu::triggered), this, static_cast<void (TopLevel::*)(QAction*)>(&TopLevel::runTea));
connect(contextMenu(), &QMenu::triggered, this, &TopLevel::slotRunTea);
connect(this, &TopLevel::activated, this, &TopLevel::showPopup);
loadConfig();
......@@ -205,7 +205,7 @@ void TopLevel::setTeaList(const QList<Tea> &tealist) {
contextMenu()->addSeparator();
contextMenu()->addAction( m_actionCollection->action(QLatin1String(KStandardAction::name(KStandardAction::Quit))) );
connect(contextMenu(), static_cast<void (QMenu::*)(QAction*)>(&QMenu::triggered), this, static_cast<void (TopLevel::*)(QAction*)>(&TopLevel::runTea));
connect(contextMenu(), &QMenu::triggered, this, &TopLevel::slotRunTea);
loadConfig();
}
......@@ -238,7 +238,7 @@ void TopLevel::showTimeEditDialog()
}
void TopLevel::runTea(QAction *a)
void TopLevel::slotRunTea(QAction *a)
{
int index = a->data().toInt();
if( index <= 0 ) {
......
......@@ -47,7 +47,7 @@ class TopLevel : public QSystemTrayIcon
void runTea(const Tea &tea);
private:
void runTea(QAction *a);
void slotRunTea(QAction *a);
void showSettingsDialog();
void showTimeEditDialog();
void teaTimeEvent();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment