KProcess compile fix for obsolete QProcess members in 5.13
AbandonedPublic

Authored by marten on Feb 26 2019, 12:39 PM.

Details

Reviewers
None
Group Reviewers
Frameworks
Summary

The functions QProcess::setReadChannelMode() and QProcess::readChannelMode() are obsolete, but were not specially treated in any way in earlier Qt versions. In 5.13 they are actually disabled in the header files, using QT_DEPRECATED_SINCE(5, 13). KDE PIM optimistically sets QT_DISABLE_DEPRECATED_BEFORE=0x060000 (since May 2017), so the build fails because these functions are no longer available:

/usr/include/KF5/KCoreAddons/kprocess.h:332: error: no members matching 'QProcess::setReadChannelMode' in 'class QProcess'
/usr/include/KF5/KCoreAddons/kprocess.h:333: error: no members matching 'QProcess::readChannelMode' in 'class QProcess'

This does not affect the remainder of Frameworks or Plasma (yet), because they do not use this QT_DISABLE_DEPRECATED_BEFORE setting.

This change makes the use of these two members conditional on the Qt version (5.12 or earlier).

Test Plan

Built kcoreaddons with this change, checked that applications using this header build correctly without the above errors.

Diff Detail

Repository
R244 KCoreAddons
Lint
Lint Skipped
Unit
Unit Tests Skipped
marten created this revision.Feb 26 2019, 12:39 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 26 2019, 12:39 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
marten requested review of this revision.Feb 26 2019, 12:39 PM
apol added a subscriber: apol.Feb 26 2019, 2:58 PM
apol added inline comments.
src/lib/io/kprocess.h
332

Also should check for QT_DISABLE_DEPRECATED_BEFORE no?

marten added inline comments.Feb 26 2019, 3:39 PM
src/lib/io/kprocess.h
332

Do you mean conditionalise instead on #if !QT_DEPRECATED_SINCE(5, 13), so that if the functions are not disabled in Qt then they are hidden here? That would work, although QT_DEPRECATED_SINCE is not public API or defined in the Qt documentation.

marten updated this revision to Diff 52898.Mar 1 2019, 1:02 PM

Use the same condition as the Qt header uses