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.
Previously on this blog, we featured a series of articles about our QML-based presentation tool, SlideViewer. To quickly recap: SlideViewer is a presentation program that allows writing slides entirely in QML.
There are situations in which the slide deck needs to be available in PDF format in addition to the QML source:
For our KDAB trainings, the students get a printed handout. The print shops printing the material require a PDF.
For conferences such as Qt DevDays, conference organizers usually require speakers to send in their slide deck as PDF to make them available as download for everyone
Sometimes the presentation is done on a machine without SlideViewer installed. In this case a PDF version is needed as a PDF viewer is usually available everywhere.
Had we used QtQuick 1, the task of creating a PDF from our QML-based slides would have been easy: QtQuick 1 uses raster-based painting via QPainter. With QPainter, it is simple to redirect rendering to QPrinter, which is able to use a PDF file as its output format.
QtQuick 2 uses an OpenGL scenegraph for rendering, and hence does not use QPainter and therefore does not offer a direct way to render the current scene to PDF.
So how did we solve the challenge of getting SlideViewer, which uses QtQuick 2, to generate a PDF file?
First Approach: Taking Screenshots
Even though one can not access the rendering of QtQuick 2 via QPainter redirection, there is a way to get the final rendered image of a slide: Taking a screenshot of a slide with QQuickWindow::grabWindow(). With that, the algorithm for creating a PDF is trivial:
This approach however has a literally huge drawback: The file size of the PDF will be gigantic, as one big image per slide is stored in the PDF, instead of a few bytes for the text strings. A PDF of our training material with all optional topics contains much more than 1000 slides, and a PDF with screenshots of that weights several hundred megabytes. This size is obviously too impractical to handle. Furthermore the text in the PDF is not searchable and selectable.
Using screenshots for creating PDFs did not work, but is there another way?
Second Approach: Manual Painting
A Typical Slide
Looking more closely at a typical slide, it mainly consists of text and images - that is, the QtQuick Text and Image elements. There are a few non-visual elements as well, for example a Repeater for code snippets - which in the end only creates more Text elements though.
With the insight that a slide contains only 2 or 3 different QtQuick types, it should be possible to paint each item on a slide ourselves, with QPainter. How hard could that possibly be? We can simply iterate over the complete object tree of a slide, call QPainter::drawImage() when we encounter an Image, QPainter::drawText() when we encounter a Text and so on.
A (very simplified) version of our code that does exactly this looks like:
One can see that besides simply painting each element, one needs to take care of per-item properties like position and clipping. For the former we used private API, QQuickItemPrivate::itemToParentTransform(). Not shown in the simplified version is that child items with negative z values need to be painted before their parent item.
Painting the elements
Now, painting an image is just a QPainter::drawImage() call, right?
Turns out it is a bit more complicated than that, as the various different fill modes require a bit of math. That math already exists in QQuickImage::updatePaintNode(), but since we're rolling our own rendering code, we need to duplicate everything that the QtQuick rendering code does. It turns out that the rendering code actually does a lot, and duplicating everything on our own would be quite a bit of effort. Because of that, we didn't implement all features of QtQuick and left out, for example, the various tiling modes - we were not using them, and they are much harder to implement in QPainter than in OpenGL.
The Text and Rectangle elements are handled in a similar way.
In the above code snippet, I cheated a bit for simplicity's sake: There is no QQuickImage::fillMode() method. This can however easily be replaced by calling QObject::property("fillMode"). For generating the PDF, using private API or even finding workarounds for missing private API is something we had to do a lot - QtQuick items aren't meant to be accessed from the C++ side after all.
Screenshots
What if the slide contains QtQuick elements that are not text, images or rectangles? We do actually have some examples of that, one case is that we display a QtQuick Controls Slider in our QtQuick Controls introduction section. In cases like these, we make an exception and grab a screenshot of just that element, and use QPainter::drawImage() to add the screenshot to the PDF. We only have a handful of such cases, using a screenshot as a fallback in these cases is a reasonable compromise.
Conclusion
The above approach of manually rendering text, images and rectangles with QPainter to generate a PDF works surprisingly well, for our use-case, as it handles thousands of slides without problems.
There are several drawbacks that makes this approach a bit less than perfect for being a generic QPainter-based renderer for QtQuick 2 applications:
It uses private API of QtQuick
All of the scenegraph rendering code has to be duplicated into QPainter rendering code
It only works for a fixed subset of QtQuick types, other types will not be supported
It still relies on QQuickWindow, especially to do the polishing of items, for taking screenshots of unsupported types and of course for event handling
So this approach might not be the perfect approach for making QtQuick 2 run on systems without OpenGL, or would at least require some additional effort like duplicating most of the QQuickWindow code.
However, for our use-case of creating PDFs from slides, the above solution works just fine and creates nice small and searchable PDFs.
Hmmm, that gets me thinking about how to abstract the QPdfEngine code so it's directly usable from QML... Which paired with the future PDF/XPS based print work-flow would give us QML printing as well.
3 - Oct - 2014
Beemaneni
can i have the source code of the above "Creating a PDF from a QtQuick 2 scene in SlideViewer"
How did you use QQuickImage? Is it not a private class? Can u brief me abit of how to use that?
5 - Oct - 2014
Thomas McGuire
Indeed, QQuickImage is a class that is not exported.
However, its base class, QQuickImageBase, is exported and can be used when using "QT += quick-private" in the .pro file and including "private/qquickimagebase_p.h". QQuickImageBase contains most of the useful methods, for example source().
Still, some methods are only present in QQuickImage. One example is the "fillMode" property. Although there is no way to access the non-exported method "fillMode()", it is possible to use QObject::property() to access the fillMode, e.g. "property("fillMode").toInt()".
Same situation with QQuickRectangle.
7 - Oct - 2014
Beemaneni
Hi ,
i get the following error when i compile it.Can you help me to sort this.
error: incomplete type 'QObjectPrivate' used in nested name specifier
auto priv = static_cast(QObjectPrivate::get(item));
^
Thanks in advance
Bala Beemaneni
7 - Oct - 2014
Thomas McGuire
The compiler is telling you that it doesn't know what "QObjectPrivate" is. That is a private class which can be found in the header "private/qobject_p.h", so include that header first.
8 - Oct - 2014
Beemaneni
hi,
Thanks for the help.That worked out.But following that ,now i get the type casting error as below
invalid static_cast from type 'QObjectPrivate' to type 'QQuickItemPrivate'
9 - Oct - 2014
Thomas McGuire
That error probably is because you need to include private/qquickitem_p.h as well.
13 - Oct - 2014
Beemaneni
Hi,
i did add that header file.but it still shows the same error.
13 - Oct - 2014
Thomas McGuire
Interesting, it works for me here.
From just the one line of code and the error message, I can not remotely diagnose your problem. Please try digging into the cause of the error yourself.
13 - Oct - 2014
Beemaneni
Thanks Thomas
Your guidance was helpful.I would try myself to clear the error messages.
Thomas McGuire
Former KDAB employee
Thomas McGuire is a former KDAB employee
Jesper K. Pedersen
HR Director / COO
Jesper K. Pedersen – COO/HR director at KDAB. Jesper has actively developed with Qt since 1998 and, despite his fancy title, still does so.
He has held almost 100 training classes in Qt since 2000. Today, his greatest claim to fame is the QML youtube series and more recently his youtube series called Qt Widgets and More.
12 Comments
18 - Aug - 2014
John Layt
Hmmm, that gets me thinking about how to abstract the QPdfEngine code so it's directly usable from QML... Which paired with the future PDF/XPS based print work-flow would give us QML printing as well.
3 - Oct - 2014
Beemaneni
can i have the source code of the above "Creating a PDF from a QtQuick 2 scene in SlideViewer"
5 - Oct - 2014
Thomas McGuire
See Jesper's comment an another blog post here: http://www.kdab.com/development-slideviewer-qml-based-presentation-program/#comment-3631
3 - Oct - 2014
Beemaneni
How did you use QQuickImage? Is it not a private class? Can u brief me abit of how to use that?
5 - Oct - 2014
Thomas McGuire
Indeed, QQuickImage is a class that is not exported.
However, its base class, QQuickImageBase, is exported and can be used when using "QT += quick-private" in the .pro file and including "private/qquickimagebase_p.h". QQuickImageBase contains most of the useful methods, for example source().
Still, some methods are only present in QQuickImage. One example is the "fillMode" property. Although there is no way to access the non-exported method "fillMode()", it is possible to use QObject::property() to access the fillMode, e.g. "property("fillMode").toInt()".
Same situation with QQuickRectangle.
7 - Oct - 2014
Beemaneni
Hi , i get the following error when i compile it.Can you help me to sort this. error: incomplete type 'QObjectPrivate' used in nested name specifier auto priv = static_cast(QObjectPrivate::get(item)); ^
Thanks in advance Bala Beemaneni
7 - Oct - 2014
Thomas McGuire
The compiler is telling you that it doesn't know what "QObjectPrivate" is. That is a private class which can be found in the header "private/qobject_p.h", so include that header first.
8 - Oct - 2014
Beemaneni
hi, Thanks for the help.That worked out.But following that ,now i get the type casting error as below
invalid static_cast from type 'QObjectPrivate' to type 'QQuickItemPrivate'
9 - Oct - 2014
Thomas McGuire
That error probably is because you need to include private/qquickitem_p.h as well.
13 - Oct - 2014
Beemaneni
Hi, i did add that header file.but it still shows the same error.
13 - Oct - 2014
Thomas McGuire
Interesting, it works for me here.
From just the one line of code and the error message, I can not remotely diagnose your problem. Please try digging into the cause of the error yourself.
13 - Oct - 2014
Beemaneni
Thanks Thomas Your guidance was helpful.I would try myself to clear the error messages.