Detect QQC2 version at build time with actual detection.
ClosedPublic

Authored by xuetianweng on Apr 15 2020, 7:35 PM.

Details

Summary

Whenever qqc release a new version the version need to be updated.
Otherwise the feature is not available to user. This change tries
to use real qml code to detect the version by creating object until
success, force to use a minimal qpa platform when running it.

Test Plan

Run the cmake under a env without display server and version is detected
correctly.

Diff Detail

Repository
R858 Qt Quick Controls 2: Desktop Style
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
xuetianweng created this revision.Apr 15 2020, 7:35 PM
Restricted Application added a subscriber: plasma-devel. · View Herald TranscriptApr 15 2020, 7:35 PM
xuetianweng requested review of this revision.Apr 15 2020, 7:35 PM

I don't understand.

We're still running this at compile time, so what's the practical difference?

I don't understand.

We're still running this at compile time, so what's the practical difference?

The old implement hard-codes it to (minor_version - 7), which is the old contract.

This commit message says it will ties the version with minor version. (I don't think this will change anymore, because patch version will not introduce new API anyway).
https://github.com/qt/qtquickcontrols2/commit/3c7bfc156797b2f3ef08a8cf620b79da80e4b061

In order to cover both cases, this code is doing the check simply checking minor , minor - 1.... until it finds the highest available version.

So the problem we're solving is that we want to go

Qt5.12 - QQC2.5
Qt5.13 - QQC2.6
Qt5.14 - QQC2.7
Qt5.15 - QQC2.15

correct?

We now know all Qt5 versions, and we know that Qt6 won't have versions.

I don't see why need this complicated thing instead of an "if" statement on Qt5QuickControls2_VERSION_MINOR

Just fix the version by if-else check.

So the problem we're solving is that we want to go

Qt5.12 - QQC2.5
Qt5.13 - QQC2.6
Qt5.14 - QQC2.7
Qt5.15 - QQC2.15

correct?

We now know all Qt5 versions, and we know that Qt6 won't have versions.

I don't see why need this complicated thing instead of an "if" statement on Qt5QuickControls2_VERSION_MINOR

Just to correct it, the change is since 5.12.
5.11 -> 5.4
5.12 -> 5.12

davidedmundson accepted this revision.Apr 20 2020, 1:45 PM
This revision is now accepted and ready to land.Apr 20 2020, 1:45 PM
This revision was automatically updated to reflect the committed changes.