Commit 29b457d
committed
Put MediaPlayer's error handler back in Qt 5 spelling, and teach the generator the rename
The Android app has been coming up with an empty window since c3bd6e8, and not because of
anything to do with a bike. Home.qml assigns onErrorOccurred, which is Qt 6's name for
MediaPlayer's error signal. Qt 5.15 has no such property, and assigning to one that does
not exist is a load error rather than a warning - so Home.qml never instantiates,
StackView is left with no initialItem, and the window is blank while the app runs
perfectly well behind it. The device log says it in one line:
qrc:/main.qml:1420:9: QML StackView: initialItem: qrc:/Home.qml:625
Cannot assign to non-existent property "onErrorOccurred"
and then says it again in the consequences: rootItem undefined all over HomeForm.ui.qml,
and homeform's constructor connecting its QML signals to (nullptr) eight times over,
because rootObject->findChild("home") found nothing to connect to.
tools/qt6-qml-imports.py already carries the rule this broke, in its own docstring: the
sources are Qt 5, because Qt 5 is what Android and every other shipping target build, and
the Qt 6 variants are generated. Imports were the only difference it knew about. Renamed
signal handlers are a second, so it now rewrites those too - anchored to the start of a
line and matched with its colon, so the same word in a comment is left alone.
The body becomes a plain function expression rather than either version's parameter
syntax, because Qt 5 injects signal parameters and Qt 6 removed injection, and a function
is the one form both bind correctly.
videoOutput, which the same commit introduced, needs no such treatment: Qt 5.15's own type
registration lists it at revision 15, and the device log never complained about it. The
error was always just the one property.
Verified on Qt 5.15 by running the app: the load error is gone, and the eight
connect-to-nullptr failures are zero, which is the same thing said from the C++ side -
Home.qml loads and findChild("home") finds it. Checked the other direction too, by running
the generator over the fixed source and confirming the Qt 6 output carries
onErrorOccurred, so the Windows build keeps what c3bd6e8 gave it.
src/videoPlayback.qml carried the same two lines and gets the same change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019d4Hga7UGcxmcG88pwcSCV1 parent d749ca0 commit 29b457d
3 files changed
Lines changed: 35 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
619 | 627 | | |
620 | 628 | | |
621 | 629 | | |
622 | 630 | | |
623 | 631 | | |
624 | 632 | | |
625 | | - | |
| 633 | + | |
626 | 634 | | |
627 | 635 | | |
628 | 636 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
43 | 56 | | |
44 | 57 | | |
45 | 58 | | |
| |||
56 | 69 | | |
57 | 70 | | |
58 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
59 | 78 | | |
60 | 79 | | |
61 | 80 | | |
| |||
0 commit comments