diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-03-21 08:22:36 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-03-21 08:22:36 +0100 |
commit | ca847749c03b88d8e482396a9c4311ef02b054b9 (patch) | |
tree | c8237b2d8385f922acdb5563e417737feba3adfb /options/connector.cpp | |
parent | fd0305aeecfad05f855b7d0e09a1eb9a70f4b2e5 (diff) |
options/{bundle,connector,value}: allow setting to default values
This is complicated by Qt's rejection of template classes.
Also move some stuff to slots where makes sense.
Diffstat (limited to 'options/connector.cpp')
-rw-r--r-- | options/connector.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/options/connector.cpp b/options/connector.cpp index 242c07da..63d70ca7 100644 --- a/options/connector.cpp +++ b/options/connector.cpp @@ -34,7 +34,7 @@ bool connector::is_equal(const QString& name, const QVariant& val1, const QVaria return generic_is_equal(val1, val2); } -bool connector::on_value_destructed_impl(const QString& name, const base_value* val) +bool connector::on_value_destructed_impl(const QString& name, value_type val) { QMutexLocker l(get_mtx()); @@ -43,7 +43,7 @@ bool connector::on_value_destructed_impl(const QString& name, const base_value* if (it != connected_values.end()) { - std::vector<const base_value*>& values = std::get<0>((*it).second); + std::vector<value_type>& values = std::get<0>((*it).second); for (auto it = values.begin(); it != values.end(); it++) { if (*it == val) @@ -61,7 +61,7 @@ bool connector::on_value_destructed_impl(const QString& name, const base_value* -void connector::on_value_destructed(const QString& name, const base_value* val) +void connector::on_value_destructed(const QString& name, value_type val) { if (!name.size()) return; @@ -76,7 +76,7 @@ void connector::on_value_destructed(const QString& name, const base_value* val) << "value-ptr" << quintptr(val); } -void connector::on_value_created(const QString& name, const base_value* val) +void connector::on_value_created(const QString& name, value_type val) { if (!name.size()) return; @@ -98,7 +98,7 @@ void connector::on_value_created(const QString& name, const base_value* val) { tt& tmp = (*it).second; std::type_index& typeidx = std::get<2>(tmp); - std::vector<const base_value*>& values = std::get<0>(tmp); + std::vector<value_type>& values = std::get<0>(tmp); if (typeidx != val->type_index) std::get<1>((*it).second) = generic_is_equal; @@ -106,7 +106,7 @@ void connector::on_value_created(const QString& name, const base_value* val) } else { - std::vector<const base_value*> vec; + std::vector<value_type> vec; vec.push_back(val); connected_values.emplace(name, tt(vec, val->cmp, val->type_index)); } @@ -117,7 +117,7 @@ void connector::notify_values(const QString& name) const auto it = connected_values.find(name); if (it != connected_values.cend()) { - for (const base_value* val : std::get<0>((*it).second)) + for (value_type val : std::get<0>((*it).second)) { val->bundle_value_changed(); } @@ -127,7 +127,7 @@ void connector::notify_values(const QString& name) const void connector::notify_all_values() const { for (auto& pair : connected_values) - for (const base_value* val : std::get<0>(pair.second)) + for (value_type val : std::get<0>(pair.second)) val->bundle_value_changed(); } |