Fix "Type error" when creating a TextField with focus: true
ClosedPublic

Authored by dfaure on May 31 2019, 8:13 PM.

Details

Summary

Added simple example "line-edit with clear button" written by Laurent,
to demonstrate the issue.

This leads to a "Type error" warning in MobileTextActionsToolBar.qml
or more precisely with my qtdeclarative fix
https://codereview.qt-project.org/c/qt/qtdeclarative/+/263542
it says:
MobileTextActionsToolBar.qml:47: TypeError: Cannot read property 'height' of null

which means controlRoot.Window.contentItem is null.

I'm not 100% confident with this fix, because it feels like stuff
won't be updated when contentItem is non-null later... But I can't
see a bug, I guess it would only happen on mobile?

Test Plan

qmlscene tests/LineEditWithClearButton.qml

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.
dfaure requested review of this revision.May 31 2019, 8:13 PM
dfaure created this revision.
dfaure edited the test plan for this revision. (Show Details)May 31 2019, 8:14 PM
apol accepted this revision.Jun 2 2019, 10:25 PM

Thanks!

This revision is now accepted and ready to land.Jun 2 2019, 10:25 PM

So isn't there a risk that controlRoot is never set because contentItem is set too late?

Maybe someone should test this on mobile to make sure the testcase doesn't lead to the "Mobile Text Actions Toolbar" being broken?

broulik requested changes to this revision.Jul 20 2019, 11:29 AM
broulik added a subscriber: broulik.

I think MobileTextActionsToolBar.qml should be fixed to check for that

This revision now requires changes to proceed.Jul 20 2019, 11:29 AM
dfaure updated this revision to Diff 62107.Jul 20 2019, 11:49 AM
dfaure edited the test plan for this revision. (Show Details)

Better fix

apol accepted this revision.Jul 20 2019, 12:40 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jul 20 2019, 12:52 PM
This revision was automatically updated to reflect the committed changes.
Restricted Application added a project: Plasma. · View Herald TranscriptJul 20 2019, 12:52 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript