Cross-platform software libraries and APIs
Qt Creator IDE and productivity tools
UI Design tool for UI composition
for Qt projects
Digital advertising for UI apps
Usage intelligence for embedded devices
GUI test automation
Code coverage analysis
Test results management and analysis
Software static code analysis
Software architecture verification
The latest version of Qt.
Make the most of Qt tools, with options for commercial licensing, subscriptions, or open-source.
Explore Qt features, the Framework essentials, modules, tools & add-ons.
The project offers PySide6 - the official Python bindings that enhance Python applications.
Qt empowers productivity across the entire product development lifecycle, from UI design and software development to quality assurance and deployment. Find the solution that best suits your needs.
Insight into the evolution and importance of user-centric trends and strategies.
Learn how to shorten development times, improve user experience, and deploy anywhere.
Tips on efficient development, software architecture, and boosting team happiness.
Get the latest resources, check out upcoming events, and see who’s innovating with Qt.
A wealth of Qt knowledge at your fingertips—discover your ideal learning resource or engage with the community.
Whether you're a beginner or a seasoned Qt pro, we have all the help and support you need to succeed.
January 27, 2017 by Laszlo Agocs | Comments
As many of you may know, QPainter has a multi-backend architecture and has two main paint engine implementations under the hood in Qt 5: the raster paint engine and the OpenGL2 paint engine, designed for OpenGL ES 2.0.
While in many ways the raster paint engine can be considered one of Qt's crown jewels, let's now talk about the other half: the GL paint engine that is used when opening a QPainter on
What about modern OpenGL, though?
That is where the problems started appearing: around Qt 5.0 those who were in need of a core profile context due to doing custom OpenGL rendering that needed this ended up running into roadblocks quite often. Components like Qt Quick were initially unable to function with such contexts due to relying on deprecated/removed functionality (for example, client-side pointers), lacking a vertex array object, and supplying GLSL shaders of a version the support for which is not mandated in such contexts.
In some cases opting for a compatibility profile was a viable workaround. However, Mac OS X / macOS famously lacks support for this: there the choice has been either OpenGL 2.1 or a 3.2+ core profile context. Attempts to work this around by for instance rendering into textures in one context and then using the texture in another context via resource sharing were often futile too, since some platforms tend to reject resource sharing between contexts of different version/profile.
Fortunately, during the lifetime of Qt 5 things have improved a lot: first Qt Quick, and then other, less user-facing GL-based components got fixed up to be able to function both with core and compatibility contexts.
As of Qt 5.8 there is one big exception: the GL paint engine for QPainter.
The good news is, this will soon no longer be the case. Thanks to a contribution started by Krita, see here for some interesting background information, QPainter is becoming able to function in core profile contexts as well. Functionality-wise this will not bring any changes, rendering still happens using the same techniques like before.
In addition to fixing up the original patch, we also integrated it with our internal QPainter regression testing system called Lancelot. This means that in addition to raster (with various QImage formats) and OpenGL 2, there will also be a run with a core profile context from now on, to ensure the output from QPainter does not regress between Qt releases.
All in all this means that a snippet like the following is now going to function as expected.
class Window : public QOpenGLWindow {
void initializeGL() override {
QSurfaceFormat fmt;
fmt.setVersion(4, 5); // or anything >= 3.2
fmt.setProfile(QSurfaceFormat::CoreProfile);
setFormat(fmt);
}
void paintGL() override {
QPainter p(this);
p.fillRect(10, 10, 50, 50, Qt::red);
...
}
...
};
Qt 5.9.
The patch has now been merged to qtbase in the 'dev' branch. This will soon branch out to '5.9', which, as the name suggests, will provide the content for Qt 5.9. Those who are in urgent need of this can most likely apply the patch (see QTBUG-33535) on top of an earlier version - the number of conflicts are expected to be low (or even zero).
That's all for now, have fun with QPainter in core profile contexts!
Download the latest release here: www.qt.io/download.
Qt 6.7 focuses on the expansion of supported platforms and industry standards. This makes code written with Qt more sustainable and brings more value in Qt as a long-term investment.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Aug 30, 2024
Qt/.NET is a proposed toolkit for interoperability between C++ and .NET,..
Aug 28, 2024
Qt for MCUs 2.5.4 LTS (Long-Term Support) has been released and is..
Aug 19, 2024
As the Qt 6.8 Beta 3 was released last week, it is a good time to start..
Qt Group includes The Qt Company Oy and its global subsidiaries and affiliates.