01 – Avoid deprecated Qt

Table of Contents

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).


Post history - Last 5 commits

17/02/2020 09:24:54 - A number of small improvements for "avoid deprecated Qt" (Frank Meerkötter)

14/02/2020 14:56:59 - remove dangling reference (Frank Meerkötter)

14/02/2020 14:08:33 - Give all tools a number prefix to allow for sorting The number prefix is the same as the card number. (Frank Meerkötter)

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on xing
Share on email
Share on stumbleupon
Share on whatsapp
Share on pocket