From a67e8630caf20e7f48151024e9e68dd9271d75c7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 1 Jul 2022 18:07:03 +0200 Subject: options/value: add `QObject::connect` wrapper This is useful not just to save on complexity in call sites, but also because I plan on using the Verdigris library to remove needless `valueChanged()` and `setValue()` overloads from each `value` instance. Also fix a bug in `options/tie.hpp` where `QComboBox::setCurrentIndex` was erroneously called as `Qt::DirectConnection`. --- tracker-easy/tracker-easy.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tracker-easy') diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp index 7046a918..a4b7ca4c 100644 --- a/tracker-easy/tracker-easy.cpp +++ b/tracker-easy/tracker-easy.cpp @@ -59,31 +59,31 @@ namespace EasyTracker connect(&*iSettings.b, &bundle_::saving, this, &Tracker::CheckCamera, Qt::DirectConnection); connect(&*iSettings.b, &bundle_::reloading, this, &Tracker::CheckCamera, Qt::DirectConnection); - connect(&iSettings.fov, value_::value_changed(), this, &Tracker::set_fov, Qt::DirectConnection); + iSettings.fov.connect_to(this, &Tracker::set_fov, Qt::DirectConnection); set_fov(iSettings.fov); // We could not get this working, nevermind //connect(&iSettings.cam_fps, value_::value_changed(), this, &Tracker::SetFps, Qt::DirectConnection); // Make sure deadzones are updated whenever the settings are changed - connect(&iSettings.DeadzoneRectHalfEdgeSize, value_::value_changed(), this, &Tracker::UpdateSettings, Qt::DirectConnection); + iSettings.DeadzoneRectHalfEdgeSize.connect_to(this, &Tracker::UpdateSettings, Qt::DirectConnection); // Update point extractor whenever some of the settings it needs are changed - connect(&iSettings.iMinBlobSize, value_::value_changed(), this, &Tracker::UpdateSettings, Qt::DirectConnection); - connect(&iSettings.iMaxBlobSize, value_::value_changed(), this, &Tracker::UpdateSettings, Qt::DirectConnection); + iSettings.iMinBlobSize.connect_to(this, &Tracker::UpdateSettings, Qt::DirectConnection); + iSettings.iMaxBlobSize.connect_to(this, &Tracker::UpdateSettings, Qt::DirectConnection); // Make sure solver is updated whenever the settings are changed - connect(&iSettings.PnpSolver, value_::value_changed(), this, &Tracker::UpdateSettings, Qt::DirectConnection); + iSettings.PnpSolver.connect_to(this, &Tracker::UpdateSettings, Qt::DirectConnection); // Debug - connect(&iSettings.debug, value_::value_changed(), this, &Tracker::UpdateSettings, Qt::DirectConnection); + iSettings.debug.connect_to(this, &Tracker::UpdateSettings, Qt::DirectConnection); // Make sure model is updated whenever it is changed - connect(&iSettings.iCustomModelThree, value_::value_changed(), this, &Tracker::UpdateModel, Qt::DirectConnection); - connect(&iSettings.iCustomModelFour, value_::value_changed(), this, &Tracker::UpdateModel, Qt::DirectConnection); - connect(&iSettings.iCustomModelFive, value_::value_changed(), this, &Tracker::UpdateModel, Qt::DirectConnection); + iSettings.iCustomModelThree.connect_to(this, &Tracker::UpdateModel, Qt::DirectConnection); + iSettings.iCustomModelFour .connect_to(this, &Tracker::UpdateModel, Qt::DirectConnection); + iSettings.iCustomModelFive .connect_to(this, &Tracker::UpdateModel, Qt::DirectConnection); // Update model logic - #define UM(v) connect(&iSettings.v, value_::value_changed(), this, &Tracker::UpdateModel, Qt::DirectConnection) + #define UM(v) iSettings.v.connect_to(this, &Tracker::UpdateModel, Qt::DirectConnection) UM(iVertexTopX); UM(iVertexTopY); UM(iVertexTopZ); UM(iVertexTopRightX); UM(iVertexTopRightY); UM(iVertexTopRightZ); UM(iVertexTopLeftX); UM(iVertexTopLeftY); UM(iVertexTopLeftZ); -- cgit v1.2.3