woboq / property_bindings Goto Github PK
View Code? Open in Web Editor NEWhttp://woboq.com/blog/property-bindings-in-cpp.html
http://woboq.com/blog/property-bindings-in-cpp.html
Small property bindings prototype. See http://woboq.com/blog/property-bindings-in-cpp.html Browse The source using the code browser: http://woboq.com/blog/property-bindings-in-cpp/code/
property_bindings/src/property_qobject.h
Line 42 in 14c4f1a
Hi.
Can you please explain what's the motivation of this connection? Especially I have trouble to understand the destination method index "methodCount()". Does this suppress the signal (because it points to a not existing method)?
Thank you.
I noticed that dependent properties only seem to update when dependent on independent properties, or when queried. Unfortunately, that breaks hooks with grandparents.
Hooks need to be triggered regardless of whether the new value is queried or not. Typically they exist because we need to break out of the property system and indirectly trigger a query. e.g. GraphicsRectObject::color -> GraphicsRectObject::update -> GraphicsRectObject::paint.
Example:
#include <iostream>
#include "property.h"
struct Rectangle {
property<double> width;
property<double> height;
property<double> area {
[&](){ return width * height; }
};
};
void printA() { std::cout << "A"; }
void printB() { std::cout << "B"; }
int main() {
Rectangle r;
property_hook<double> hookA(
printA, [&]{ return r.width * r.height; });
property_hook<double> hookB(
printB, [&]{ return r.area; });
r.width = 5;
std::cout << std::endl;
}
Actual Output:
A
Expected Output:
AB
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.