Trusted Software Excellence across Desktop and Embedded
Take a glance at the areas of expertise where KDAB excels ranging from swift troubleshooting, ongoing consulting and training to multi-year, large-scale software development projects.
Find out why customers from innovative industries rely on our extensive expertise, including Medical, Biotech, Science, Renewable Energy, Transportation, Mobility, Aviation, Automation, Electronics, Agriculture and Defense.
High-quality Embedded Engineering across the Stack
To successfully develop an embedded device that meets your expectations regarding quality, budget and time to market, all parts of the project need to fit perfectly together.
Learn more about KDAB's expertise in embedded software development.
Where the capabilities of modern mobile devices or web browsers fall short, KDAB engineers help you expertly architect and build high-functioning desktop and workstation applications.
Extensible, Safety-compliant Software for the Medical Sector
Create intelligent, patient-focused medical software and devices and stay ahead with technology that adapts to your needs.
KDAB offers you expertise in developing a broad spectrum of clinical and home-healthcare devices, including but not limited to, internal imaging systems, robotic surgery devices, ventilators and non-invasive monitoring systems.
Building digital dashboards and cockpits with fluid animations and gesture-controlled touchscreens is a big challenge.
In over two decades of developing intricate UI solutions for cars, trucks, tractors, scooters, ships, airplanes and more, the KDAB team has gained market leading expertise in this realm.
Build on Advanced Expertise when creating Modern UIs
KDAB assists you in the creation of user-friendly interfaces designed specifically for industrial process control, manufacturing, and fabrication.
Our specialties encompass the custom design and development of HMIs, enabling product accessibility from embedded systems, remote desktops, and mobile devices on the move.
Legacy software is a growing but often ignored problem across all industries. KDAB helps you elevate your aging code base to meet the dynamic needs of the future.
Whether you want to migrate from an old to a modern GUI toolkit, update to a more recent version, or modernize your code base, you can rely on over 25 years of modernization experience.
KDAB offers a wide range of services to address your software needs including consulting, development, workshops and training tailored to your requirements.
Our expertise spans cross-platform desktop, embedded and 3D application development, using the proven technologies for the job.
When working with KDAB, the first-ever Qt consultancy, you benefit from a deep understanding of Qt internals, that allows us to provide effective solutions, irrespective of the depth or scale of your Qt project.
Qt Services include developing applications, building runtimes, mixing native and web technologies, solving performance issues, and porting problems.
KDAB helps create commercial, scientific or industrial desktop applications from scratch, or update its code or framework to benefit from modern features.
Discover clean, efficient solutions that precisely meet your requirements.
Boost your team's programming skills with in-depth, constantly updated, hands-on training courses delivered by active software engineers who love to teach and share their knowledge.
Our courses cover Modern C++, Qt/QML, Rust, 3D programming, Debugging, Profiling and more.
The collective expertise of KDAB's engineering team is at your disposal to help you choose the software stack for your project or master domain-specific challenges.
Our particular focus is on software technologies you use for cross-platform applications or for embedded devices.
Since 1999, KDAB has been the largest independent Qt consultancy worldwide and today is a Qt Platinum partner. Our experts can help you with any aspect of software development with Qt and QML.
KDAB specializes in Modern C++ development, with a focus on desktop applications, GUI, embedded software, and operating systems.
Our experts are industry-recognized contributors and trainers, leveraging C++'s power and relevance across these domains to deliver high-quality software solutions.
KDAB can guide you incorporating Rust into your project, from as overlapping element to your existing C++ codebase to a complete replacement of your legacy code.
Unique Expertise for Desktop and Embedded Platforms
Whether you are using Linux, Windows, MacOS, Android, iOS or real-time OS, KDAB helps you create performance optimized applications on your preferred platform.
If you are planning to create projects with Slint, a lightweight alternative to standard GUI frameworks especially on low-end hardware, you can rely on the expertise of KDAB being one of the earliest adopters and official service partner of Slint.
KDAB has deep expertise in embedded systems, which coupled with Flutter proficiency, allows us to provide comprehensive support throughout the software development lifecycle.
Our engineers are constantly contributing to the Flutter ecosystem, for example by developing flutter-pi, one of the most used embedders.
KDAB invests significant time in exploring new software technologies to maintain its position as software authority. Benefit from this research and incorporate it eventually into your own project.
Start here to browse infos on the KDAB website(s) and take advantage of useful developer resources like blogs, publications and videos about Qt, C++, Rust, 3D technologies like OpenGL and Vulkan, the KDAB developer tools and more.
The KDAB Youtube channel has become a go-to source for developers looking for high-quality tutorial and information material around software development with Qt/QML, C++, Rust and other technologies.
Click to navigate the all KDAB videos directly on this website.
In over 25 years KDAB has served hundreds of customers from various industries, many of them having become long-term customers who value our unique expertise and dedication.
Learn more about KDAB as a company, understand why we are considered a trusted partner by many and explore project examples in which we have proven to be the right supplier.
The KDAB Group is a globally recognized provider for software consulting, development and training, specializing in embedded devices and complex cross-platform desktop applications.
Read more about the history, the values, the team and the founder of the company.
When working with KDAB you can expect quality software and the desired business outcomes thanks to decades of experience gathered in hundreds of projects of different sizes in various industries.
Have a look at selected examples where KDAB has helped customers to succeed with their projects.
KDAB is committed to developing high-quality and high-performance software, and helping other developers deliver to the same high standards.
We create software with pride to improve your engineering and your business, making your products more resilient and maintainable with better performance.
KDAB has been the first certified Qt consulting and software development company in the world, and continues to deliver quality processes that meet or exceed the highest expectations.
In KDAB we value practical software development experience and skills higher than academic degrees. We strive to ensure equal treatment of all our employees regardless of age, ethnicity, gender, sexual orientation, nationality.
Interested? Read more about working at KDAB and how to apply for a job in software engineering or business administration.
All Qt developers should know about signals, slots, and properties. Those of you who have used QML will know that property bindings are super useful and cool. Bindings allow us to write more reactive and declarative style code. However, they are only available within QML, which means there are no compile time errors when you do something wrong.
Wouldn't it be nice if we could have the sunlit uplands of Brexit -- erm, I mean bindings -- from the comfort and speed of C++? Wouldn't it be nice if you could use this with or without Qt? Wouldn't it be nice if this was just plain C++ with no moc required? Wouldn't it be nice if you could avoid executing a binding many times when you update each dependent property (lazy/deferred evaluation)? Wouldn't it be nice if you could have this right now?
Well, you can! Read on to find out more details. For those of you who can't wait, you can grab the code and start using it right now from GitHub.
How C++ Bindings Look in Use
Here is a simple but complete example to give you a taste of what using properties and bindings in C++ looks like:
#include"kdbindings/binding.h"#include"kdbindings/property.h"#include"kdbindings/signal.h"#include<iostream>usingnamespace KDBindings;classImage{public:constint bytesPerPixel =4; Property<int> width {800}; Property<int> height {600};const Property<int> byteSize =makeBoundProperty(bytesPerPixel * width * height);};intmain(){Image img; std::cout <<"The initial size of the image = "<< img.byteSize.get()<<" bytes"<< std::endl; img.byteSize.valueChanged().connect([](constint&newValue){ std::cout <<"The new size of the image = "<< newValue <<" bytes"<< std::endl;}); img.width =1920; img.height =1080;return0;}
The Image class declares 3 properties, all containing an integer. The first two, width and height, are simply initialized to values. The third property, byteSize, is initialized to whatever is returned from the makeBoundProperty() function. We will go into this in full and gory detail later. This, however, is how we create an immediate-mode property binding -- that is, a binding that gets evaluated immediately when any of it's dependent properties change. In this case, that means if width or height changes, then byteSize will get a new value. Pretty easy and natural, isn't it? And we don't have to worry about the mechanics of connecting to changed signals; that is all taken care of for us.
The main function simply instantiates an Image object and prints out the initial value of the byteSize property. We use the get() function to extract the contained value here but we do provide an overloaded stream operator to do this for us too.
On line 24, we create a lambda "slot" and connect it to the valueChanged() signal of the byteSize property so that we print out the new image size whenever it changes. This syntax, although slightly different from Qt's, should be familiar enough to pick up and use. The reason we can do this here is because in this implementation a signal is itself an object rather than just a function on a QObject.
Lines 28 and 29 both alter the other properties of the image. Each of these causes the binding expression to be re-evaluated. We will show later how to avoid this and have the bindings evaluated lazily. The complete output from running this simple example is:
The initial size of the image = 1920000 bytes
The new size of the image = 4608000 bytes
The new size of the image = 8294400 bytes
Lazy Property Bindings
One of the issues with property bindings in Qt5/QML is that they are evaluated as soon as any of the properties on which they depend are changed. If you are updating a lot of properties, this can lead to a huge amount of wasted CPU time spent evaluating a binding that will be invalidated the next time you change a dependent property. Well, we can avoid this completely by introducing the concept of a BindingEvaluator.
To make use of lazily evaluated property bindings, all you need to do is to pass in a BindingEvaluator as the first argument to the makeBinding() function:
With the binding associated to an evaluator, it is now lazily evaluated. No matter how many dependent input properties you change, the binding is only evaluated when you request it:
img.width =1920;// Does not trigger an evaluation of the bindingimg.height =1080;// Nor does thisevaluator.evaluateAll();// This does!
With the above changes to our example, the output now becomes:
The initial size of the image = 1920000 bytes
The new size of the image = 8294400 bytes
And you can see we have saved the pointless evaluation of the binding when we change the image width knowing that we will then immediately change the image height, too.
This gives us a lot more control over bindings than is possible in QML and allows us to save precious CPU time/battery power!
It gets better, though. With the evaluator concept, we can go even further:
You could group bindings into logical sets based upon their purpose, e.g., all the bindings from subsystem A use this evaluator and all the bindings from subsystem B use a different evaluator. Triggering evaluator A before B means you can be sure that all the state in subsystem A is consistent before you move on to subsystem B's bindings.
Building upon the first point, we can also control the frequency at which we update property bindings. For example, we may want all the bindings in the back-end data layer to be updated at full frequency (once per simulation loop). However, if you want to attach to your simulation a GUI that is not an unreadable strobe of flashing numbers, you could elect to update the bindings related to GUI code only once every 0.5s, say.
The choice is yours. This library only provides the facility; what you choose to do with this lazy evaluation is entirely up to you!
Actually, the immediate mode bindings also use an evaluator behind-the-scenes. It's just a dummy one, though, and we ignore it. We just kick off an evaluation as soon as we see the expression is dirty, via a signal.
What We Can Do in a Property Binding
Thus far, we have only seen a trivial example of a property binding. This sufficed to show how to use bindings, but it's not particularly compelling if all we can use is a multiply operation. So what else can we put into property bindings? Well, pretty much anything is the answer.
The usual unary operators (+, -, !, ~)
Binary operators (+, -, *, /, %, etc)
Normal values
Property values
Functions
This means you can do more interesting things inside your property bindings, such as:
BindingEvaluator evaluator;Property<int> a {2};Property<int> b {7};Property<int> c {3};Property<int> d {4};auto e =makeBoundProperty(evaluator,(a + b)*(c + d));// e is a Property<int> too.Property<float> x {-7.5f};Property<float> y {2.35f};auto z =makeBoundProperty(evaluator, y +abs(sin(x)));
"That's cool, uh-huh. But I've got this other custom function I want to use in a binding..." No problem! It's easy to expose your own functions for use with bindings. Here's how:
structnode_paraboloid{template<typenameT>autooperator()(T&& x, T&& y)const// Use as many arguments as you like{// Do something useful or call a library function...return x * x + y * y;}};KDBINDINGS_DECLARE_FUNCTION(paraboloid, node_paraboloid {})auto evaluator = BindingEvaluator{};Property<int> x {-2};Property<int> y {3};auto z =makeBoundProperty(evaluator,paraboloid(x, y));
Pretty neat, eh? And as the comments say, we can use any number of function arguments, thanks to the wonders of variadic templates. This means that we can put pretty much anything into a binding expression. It's quite neat how this works behind-the-scenes with compile time building of the dependency tree -- but I'll save that for a deep-dive in a follow-up post.
Broken Bindings
Anyone who has used property bindings in QML will know just how much of a pain in the posterior broken bindings can be. Easy to do by mistake and can be annoyingly difficult to track down! Never fear! Thanks to C++ and a bit of design work, we can help eliminate the curse of broken bindings!
Compile-time Prevention
Just mark the property with a binding as const and this will stop you from assigning another binding or value to it at compile time.
Property<int> a {10};Property<int> b {14};const Property<int> x =makeBoundProperty(defaultEvaluator(),2*(a + b));...x =35;// Compile-time error!
Run-time prevention
If for whatever reason you can't mark your property as const, e.g., if you want to switch it between two different bindings depending upon a mode, then you can still prevent accidentally assigning a value to the property:
Property<int> a {10};Property<int> b {14};Property<int> x =makeBoundProperty(defaultEvaluator(),2*(a + b));...x =35;// Throws a ReadOnlyProperty exception
The KDBindings project allows us to have:
Signals and slots with support for missing/default arguments.
Properties templated on the contained type.
Use of signals and properties anywhere. No need for QObject or moc.
Property bindings allowing reactive code to be written without having to do all the low-level, error-prone plumbing by hand.
Plain C++! Yay for compile time errors, const correctness, more efficiency, debugging!
Lazy evaluation of property bindings!
No more broken bindings (hopefully)!
A totally stand-alone "header-only" library.
Compatibility with any C++17 compiler.
The option of use with Qt, if you so wish.
Available now and MIT licensed!
In a follow-up post, we will take a look at some of the interesting inner workings of KDBindings.
Please feel free to take it for a test-drive and let us know what you think.
About KDAB
Trusted software excellence across embedded and desktop platforms
The KDAB Group is a globally recognized provider for software consulting, development and training, specializing in embedded devices and complex cross-platform desktop applications. In addition to being leading experts in Qt, C++ and 3D technologies for over two decades, KDAB provides deep expertise across the stack, including Linux, Rust and modern UI frameworks. With 100+ employees from 20 countries and offices in Sweden, Germany, USA, France and UK, we serve clients around the world.
Will take a while to put into production as it's quite a paradigm shift, but big thanks for making this available.
13 - Jan - 2022
Sean Harmer
Thank you. If you have used QML property bindings, this feels fairly similar but in the comfort of C++. We've been nicely surprised by how much boilerplate code you can eliminate in some situations.
10 - Jan - 2022
Foster Brereton
Very cool work!
For that last example, it would be great to be able to set the size of the image, and have the earliest-changed value between width or height update to keep the system valid. What's being described between width, height, and the size of the image is a relationship between all three. Thus it would be exceedingly useful to be able to modify any of those parameters, and the system tweak the other parameters as necessary to keep the relationship valid. It's already working for mutating the width and height - now, how hard would it be to have all three mutable? For example, you could imagine an "image size" dialog box where you give the user the ability to change any of these parameters to fit their requirements (e.g., I want the image to be these dimensions, or I need a smaller image that can be no more than X bytes in size so I can e.g., send it over a network faster/preview/etc.)
13 - Jan - 2022
Sean Harmer
Thank you. As mentioned on reddit, this would need n-way tracking of the relationships. It may be possible to do something nice around this idea though. We will have a think about it.
26 - Mar - 2024
FeRDNYC (Frank Dana)
(Two years later...) I'm not sure bindings are the appropriate method of expressing such behavior. It would nearly always require some constraint logic that's too complex to express via bindings.
For example, say you want to adjust the bytesize and have the width and height automatically updated. Well, how do you compute width and height from bytesize? Any bytesize you set, there are dozens of different width/height combinations that will produce that value. A naïve implementation can simply reduce width and height proportionally (preserving aspect ratio), but that's rarely satisfactory. In typical situations, there will be additional constraints, like requiring width and/or height to be multiples of some base value (2, 4, 8, 16...). Even if you'll accept any integer, there are questions like "how should the values be rounded?" that require code to answer them.
n-ways also complicate the update logic. If I have bytesize dependent on width and height, and width and height dependent on bytesize, then what should happen when I change the height? Should it update the bytesize, or adjust the width to keep the bytesize constant?
That kind of constraint and update logic requires code to implement it. To do it all with bindings, you'd also have to solve the circular-reference problem (like in Excel spreadsheets), where cascading updates turn into infinite loops. (QObject provides .blockSignals() specifically to prevent those cascades, when code is updating a value based on the value of other connected objects.)
15 - May - 2024
Sean Harmer
That's correct. An n-way solution is not easily possible without knowing more about specific constraints. In such cases you can use the signals to call your own functions to do as you wish. Bindings are not a perfect one-stop solution but they can be a nice syntactic sugar in many common situations. They are just another tool in your toolbox.
Sean Harmer
Managing Director KDAB UK
Dr Sean Harmer is a senior software engineer at KDAB where he heads up our UK office and also leads the 3D R&D team. He has been developing with C++ and Qt since 1998 and is Qt 3D Maintainer and lead developer in the Qt Project. Sean has broad experience and a keen interest in scientific visualization and animation in OpenGL and Qt. He holds a PhD in Astrophysics along with a Masters in Mathematics and Astrophysics.
Our hands-on Modern C++ training courses are designed to quickly familiarize newcomers with the language. They also update professional C++ developers on the latest changes in the language and standard library introduced in recent C++ editions.
6 Comments
8 - Jan - 2022
Vadim Peretokin
This is pretty fantastic, thanks!
Will take a while to put into production as it's quite a paradigm shift, but big thanks for making this available.
13 - Jan - 2022
Sean Harmer
Thank you. If you have used QML property bindings, this feels fairly similar but in the comfort of C++. We've been nicely surprised by how much boilerplate code you can eliminate in some situations.
10 - Jan - 2022
Foster Brereton
Very cool work!
For that last example, it would be great to be able to set the size of the image, and have the earliest-changed value between width or height update to keep the system valid. What's being described between width, height, and the size of the image is a relationship between all three. Thus it would be exceedingly useful to be able to modify any of those parameters, and the system tweak the other parameters as necessary to keep the relationship valid. It's already working for mutating the width and height - now, how hard would it be to have all three mutable? For example, you could imagine an "image size" dialog box where you give the user the ability to change any of these parameters to fit their requirements (e.g., I want the image to be these dimensions, or I need a smaller image that can be no more than X bytes in size so I can e.g., send it over a network faster/preview/etc.)
13 - Jan - 2022
Sean Harmer
Thank you. As mentioned on reddit, this would need n-way tracking of the relationships. It may be possible to do something nice around this idea though. We will have a think about it.
26 - Mar - 2024
FeRDNYC (Frank Dana)
(Two years later...) I'm not sure bindings are the appropriate method of expressing such behavior. It would nearly always require some constraint logic that's too complex to express via bindings.
For example, say you want to adjust the bytesize and have the width and height automatically updated. Well, how do you compute width and height from bytesize? Any bytesize you set, there are dozens of different width/height combinations that will produce that value. A naïve implementation can simply reduce width and height proportionally (preserving aspect ratio), but that's rarely satisfactory. In typical situations, there will be additional constraints, like requiring width and/or height to be multiples of some base value (2, 4, 8, 16...). Even if you'll accept any integer, there are questions like "how should the values be rounded?" that require code to answer them.
n-ways also complicate the update logic. If I have bytesize dependent on width and height, and width and height dependent on bytesize, then what should happen when I change the height? Should it update the bytesize, or adjust the width to keep the bytesize constant?
That kind of constraint and update logic requires code to implement it. To do it all with bindings, you'd also have to solve the circular-reference problem (like in Excel spreadsheets), where cascading updates turn into infinite loops. (QObject provides .blockSignals() specifically to prevent those cascades, when code is updating a value based on the value of other connected objects.)
15 - May - 2024
Sean Harmer
That's correct. An n-way solution is not easily possible without knowing more about specific constraints. In such cases you can use the signals to call your own functions to do as you wish. Bindings are not a perfect one-stop solution but they can be a nice syntactic sugar in many common situations. They are just another tool in your toolbox.