summaryrefslogtreecommitdiffstats
path: root/examples/widgets/tools
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2016-12-20 21:37:37 +0300
committerAlexander Volkov <a.volkov@rusbitech.ru>2016-12-22 14:54:55 +0000
commitfb7bfbf18d91d0bd0f1c88ee6043e3dfa7ae9b9e (patch)
tree4afb53415fdd372095f3e9abcb7e9f332d01be40 /examples/widgets/tools
parent63e7ff97e960987080e6bda668ba960650dca87f (diff)
examples: Use QOverload to select overloaded signals and slots
We can use QOverload since Qt 5.7 (it depends on Q_COMPILER_VARIADIC_TEMPLATES which is required since Qt 5.7). Use it in the examples to show the best practice. qOverload currently can't be used because it requires c++14. Change-Id: I94a3c0db9d551fe169fa3d19c07ec0b329d5946c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'examples/widgets/tools')
-rw-r--r--examples/widgets/tools/codecs/previewform.cpp3
-rw-r--r--examples/widgets/tools/regularexpression/regularexpressiondialog.cpp4
-rw-r--r--examples/widgets/tools/settingseditor/locationdialog.cpp7
3 files changed, 6 insertions, 8 deletions
diff --git a/examples/widgets/tools/codecs/previewform.cpp b/examples/widgets/tools/codecs/previewform.cpp
index e5ca13f011..d19b9c0833 100644
--- a/examples/widgets/tools/codecs/previewform.cpp
+++ b/examples/widgets/tools/codecs/previewform.cpp
@@ -159,8 +159,7 @@ PreviewForm::PreviewForm(QWidget *parent)
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
okButton = buttonBox->button(QDialogButtonBox::Ok);
- typedef void(QComboBox::*ComboBoxIntSignal)(int);
- connect(encodingComboBox, static_cast<ComboBoxIntSignal>(&QComboBox::activated),
+ connect(encodingComboBox, QOverload<int>::of(&QComboBox::activated),
this, &PreviewForm::updateTextEdit);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
diff --git a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp
index f13240d06f..7a67c763d8 100644
--- a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp
+++ b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp
@@ -94,10 +94,10 @@ RegularExpressionDialog::RegularExpressionDialog(QWidget *parent)
connect(optimizeOnFirstUsageOptionCheckBox, &QCheckBox::toggled, this, &RegularExpressionDialog::refresh);
connect(dontAutomaticallyOptimizeOptionCheckBox, &QCheckBox::toggled, this, &RegularExpressionDialog::refresh);
- connect(offsetSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
+ connect(offsetSpinBox, QOverload<int>::of(&QSpinBox::valueChanged),
this, &RegularExpressionDialog::refresh);
- connect(matchTypeComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
+ connect(matchTypeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &RegularExpressionDialog::refresh);
connect(anchoredMatchOptionCheckBox, &QCheckBox::toggled, this, &RegularExpressionDialog::refresh);
diff --git a/examples/widgets/tools/settingseditor/locationdialog.cpp b/examples/widgets/tools/settingseditor/locationdialog.cpp
index 4aa1e6073f..5b6e2652bb 100644
--- a/examples/widgets/tools/settingseditor/locationdialog.cpp
+++ b/examples/widgets/tools/settingseditor/locationdialog.cpp
@@ -106,10 +106,9 @@ LocationDialog::LocationDialog(QWidget *parent)
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
- typedef void (QComboBox::*QComboIntSignal)(int);
- connect(formatComboBox, static_cast<QComboIntSignal>(&QComboBox::activated),
+ connect(formatComboBox, QOverload<int>::of(&QComboBox::activated),
this, &LocationDialog::updateLocationsTable);
- connect(scopeComboBox, static_cast<QComboIntSignal>(&QComboBox::activated),
+ connect(scopeComboBox, QOverload<int>::of(&QComboBox::activated),
this, &LocationDialog::updateLocationsTable);
connect(organizationComboBox->lineEdit(),
&QLineEdit::editingFinished,
@@ -117,7 +116,7 @@ LocationDialog::LocationDialog(QWidget *parent)
connect(applicationComboBox->lineEdit(),
&QLineEdit::editingFinished,
this, &LocationDialog::updateLocationsTable);
- connect(applicationComboBox, static_cast<QComboIntSignal>(&QComboBox::activated),
+ connect(applicationComboBox, QOverload<int>::of(&QComboBox::activated),
this, &LocationDialog::updateLocationsTable);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);