Use QQuickStyle to set the QQC2 style
ClosedPublic

Authored by arojas on Sep 23 2017, 2:11 PM.

Details

Summary

Use QQuickStyle::setStyle instead of an environment variable to set the QQC2 desktop style. This prevent the style from being inherited by plasmashell (or krunner) child processes, which makes QGuiApplications crash. The QQC1 style still needs to be set via an environment variable, so we explicitely unset it for non-QApplications to prevent them from crashing.

This adds a new QtQuickControls dependency, I hope it's OK at this stage (as it's already a dependency of other Plasma repos)

Test Plan

Run systemsettings5 -> it is correctly themed with the desktop style
Run QT_QUICK_CONTROLS_STYLE="Material" systemsetting5 -> it is correctly themed with the material style
Run minuet (pure QQC2) -> it doesn't crash
Run kalgebra-mobile (QQC1 + QQC2) -> it doesn't crash.

Diff Detail

Repository
R135 Integration for Qt applications in Plasma
Lint
Lint Skipped
Unit
Unit Tests Skipped
arojas created this revision.Sep 23 2017, 2:11 PM
Restricted Application added a project: Plasma. · View Herald TranscriptSep 23 2017, 2:11 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
arojas edited the test plan for this revision. (Show Details)Sep 23 2017, 2:15 PM
davidedmundson accepted this revision.Sep 25 2017, 6:58 AM

Soo much cleaner. Thanks for taking care of this

This revision is now accepted and ready to land.Sep 25 2017, 6:58 AM

so is this OK for 5.11?

We should definitely be strict about adding addititional dependencies after the freeze, but I think in this case it's safe and worth it.

I shall send an email to kde-distro-packagers to make sure everyone knows.

This revision was automatically updated to reflect the committed changes.
fvogt added a subscriber: fvogt.Sep 25 2017, 6:47 PM

This is not as clear as it could be. What about just not setting QT_QUICK_CONTROLS_1_STYLE in the first place?
QT_QUICK_CONTROLS_1_STYLE is only necessary because of QT_QUICK_CONTROLS_STYLE.

In D7953#148962, @fvogt wrote:

This is not as clear as it could be. What about just not setting QT_QUICK_CONTROLS_1_STYLE in the first place?
QT_QUICK_CONTROLS_1_STYLE is only necessary because of QT_QUICK_CONTROLS_STYLE.

If the only reason for settings QT_QUICK_CONTROLS_1_STYLE in startkde was fixing the warning when QT_QUICK_CONTROLS_STYLE was set, I guess you can stop setting it now. But as long as it's being set in startkde it needs to be unset here to stop crashes all over the place.

fvogt added a comment.Sep 25 2017, 7:51 PM

If the only reason for settings QT_QUICK_CONTROLS_1_STYLE in startkde was fixing the warning when QT_QUICK_CONTROLS_STYLE was set, I guess you can stop setting it now

Yes it is (as mentioned in the various reviews and IRC)

However, it's probably a good idea to have this safeguard here anyway. Why does it even crash, is that a Qt bug?