diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-04-04 22:00:38 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-11 11:17:56 +0300 |
commit | 0eb00ed700c472f005de35d96c72a9b54cd4c2c2 (patch) | |
tree | e6095bc29bf000d5e7c6202ee2142e7310c834fa /desktop-widgets/filterwidget2.cpp | |
parent | b0e1d8863457441c05f092a39669cf9d64cb6507 (diff) | |
download | subsurface-0eb00ed700c472f005de35d96c72a9b54cd4c2c2.tar.gz |
Cleanup: provide our own qOverload<> implementation.
This is only in Qt 5.7 and therefore can't be used in Qt 5.5 and 5.6
builds. Moreover, we can't simply reuse Qt's version owing to
licensing concerns.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/filterwidget2.cpp')
-rw-r--r-- | desktop-widgets/filterwidget2.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/desktop-widgets/filterwidget2.cpp b/desktop-widgets/filterwidget2.cpp index 17e43f941..f106c354e 100644 --- a/desktop-widgets/filterwidget2.cpp +++ b/desktop-widgets/filterwidget2.cpp @@ -52,21 +52,16 @@ FilterWidget2::FilterWidget2(QWidget* parent) : connect(ui.minVisibility, &StarWidget::valueChanged, this, &FilterWidget2::updateFilter); - // We need these insane casts because Qt decided to function-overload some of their signals(!). - // QDoubleSpinBox::valueChanged() sends double and QString using the same signal name. - // QComboBox::currentIndexChanged() sends int and QString using the same signal name. - // Qt 5.7 provides a "convenient" helper that hides this, but only if compiling in C++14 - // or higher. One can then write: "QOverload<double>(&QDoubleSpinBox::valueChanged)", etc. - connect(ui.maxAirTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), + connect(ui.maxAirTemp, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &FilterWidget2::updateFilter); - connect(ui.minAirTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), + connect(ui.minAirTemp, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &FilterWidget2::updateFilter); - connect(ui.maxWaterTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), + connect(ui.maxWaterTemp, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &FilterWidget2::updateFilter); - connect(ui.minWaterTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), + connect(ui.minWaterTemp, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &FilterWidget2::updateFilter); connect(ui.fromDate, &QDateTimeEdit::dateChanged, @@ -84,25 +79,25 @@ FilterWidget2::FilterWidget2(QWidget* parent) : connect(ui.tags, &QLineEdit::textChanged, this, &FilterWidget2::updateFilter); - connect(ui.tagsMode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + connect(ui.tagsMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FilterWidget2::updateFilter); connect(ui.people, &QLineEdit::textChanged, this, &FilterWidget2::updateFilter); - connect(ui.peopleMode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + connect(ui.peopleMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FilterWidget2::updateFilter); connect(ui.location, &QLineEdit::textChanged, this, &FilterWidget2::updateFilter); - connect(ui.locationMode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + connect(ui.locationMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FilterWidget2::updateFilter); connect(ui.suit, &QLineEdit::textChanged, this, &FilterWidget2::updateFilter); - connect(ui.suitMode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + connect(ui.suitMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FilterWidget2::updateFilter); connect(ui.dnotes, &QLineEdit::textChanged, |