basysKom Toolbox

01 – Avoid deprecated Qt

Avoid deprecated Qt

Goals

Avoid deprecated Qt

Description

A defining quality of Qt is that it provides long-term API stability within a major release (e.g. Qt 5) which historically translates to
roughly 7-8 years. To communicate up-front which APIs (or parts of an
API) might be affected by a change in the next major release, deprecation warnings are added to the headers of Qt as a continuous process. Make sure to enable these deprecation warnings to stay up-to-date how your application might be affected by Qt API changes and to ease the transition to new Qt versions over time.

Environment

Qt/C++

Platform

All

Implementation effort

Very minimal

Applicability

New projects, new modules within existing projects. As a preparation for a porting effort.

Caveats

  • Might conflict with -Werror.
  • Doesn’t help to catch the usage of deprecated QML modules.

See also

Implementation hints

Variant1: my.pro

QMAKE_CXXFLAGS += -Wdeprecated
DEFINES += QT_DEPRECATED_WARNINGS

Generates one warning for each use of a Qt method marked as deprecated.
Very coarse grained. No specific Qt version can be selected.

Variant2: my.pro

DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050200

Removes everything that has deprecated since Qt 5.2 from the Qt headers (causing the build to fail of deprecated code is used).

About the Toolbox

The basysKom Toolbox is a state-of-the-art collection of best practices in agile management and software development and a valuable tool for every kickoff meeting.

These cards can be used during a project kickoff in order to select best fitting good practices from the very start of your project, but also as a reminder during the course of a project implementation. Every card holds a QR code with additional information related to the specific tool, the tools’ applicability, known constraints and additional tips on how to implement it in a project setup.

You can provide us feedback on GitHub.

Toolbox

basysKom Newsletter

We collect only the data you enter in this form (no IP address or information that can be derived from it). The collected data is only used in order to send you our regular newsletters, from which you can unsubscribe at any point using the link at the bottom of each newsletter. We will retain this information until you ask us to delete it permanently. For more information about our privacy policy, read Privacy Policy