Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blurred Qt Quick Text

This is an example from Qt Quick examples inside Qt Creator, when I run the project all texts lost their quality and blurred, the attached picture describes clearly the problem.

Qt Version: 5.4.1

Platform: Windows 7

enter image description here

like image 730
Reza Ebrahimi Avatar asked Apr 19 '15 18:04

Reza Ebrahimi


2 Answers

It is an old bug that may be reproduced on some hardware when Qt uses system OpenGL capabilities "[QTBUG-31983] Font rendering on Windows XP shows artifacts with QML Text element"

Before Qt version 5.5 there are two types of Qt releases for Windows: ANGLE and OpenGL. They can be distinguished by the suffix "opengl" in the installer file name, for example:

qt-opensource-windows-x86-msvc2013_opengl-5.4.1.exe
qt-opensource-windows-x86-msvc2013-5.4.1.exe

See "Qt 5 on Windows ANGLE and OpenGL" for the explanation.

The ANGLE build does not have such defect. Only OpenGL build is affected. OpenGL is poorly supported by default on many Windows installations. In some cases it can just crash during QML window initialization. The manual video driver installation was required. However, for some old hardware it is a problem to find such good video card driver that have enough support for OpenGL.

Possible solutions:

  • Use ANGLE Qt build
  • It is possible to subclass the standard QML Text control with default render type Text.NativeRendering:
Text { renderType: Text.NativeRendering; }

ANGLE Qt build could be a good solution if Windows XP should not be supported.

If no intensive graphics usage is required the better solution is to use software OpenGL rendering. Before Qt 5.4 it is was possible to use MSYS Mesa library opengl32.dll (only some specific version should be used). If such library is placed in the executable folder of Qt application built with OpenGL Qt version, that library is automatically used for software rendering instead of default hardware rendering. Starting from Qt 5.4 such library is provided by Qt: opengl32sw.dll (http://doc.qt.io/qt-5/windows-requirements.html).

The software OpenGL emulation works perfectly on all types of hardware and it does not require any special video card driver.

Starting from Qt 5.4 there is the application attribute Qt::AA_UseSoftwareOpenGL:

Forces the usage of a software based OpenGL implementation on platforms that use dynamic loading of the OpenGL implementation. This will typically be a patched build of Mesa llvmpipe, providing OpenGL 2.1. The value may have no effect if no such OpenGL implementation is available. The default name of this library is opengl32sw.dll and can be overridden by setting the environment variable QT_OPENGL_DLL. See the platform-specific pages, for instance Qt for Windows, for more information. This value has been added in Qt 5.4.

like image 109
Orest Hera Avatar answered Nov 17 '22 21:11

Orest Hera


This happened to my QT 5.4.2 MinGW project as well. Using Text.NativeRendering solved the blurry text in my case.

like image 1
Amy Serwinowski Avatar answered Nov 17 '22 22:11

Amy Serwinowski