Bug 470729

Summary: KF6-based QML apps throw MobileCursor errors
Product: [Frameworks and Libraries] frameworks-qqc2-desktop-style Reporter: Nate Graham <nate>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahiemstra, kde, me, nicolas.fella, noahadvs, notmart
Priority: NOR Keywords: qt6
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Nate Graham 2023-06-07 04:48:07 UTC
On Qt6, QML apps with editable text fields output these errors on the console:

file:///home/nate/kde/usr6/lib64/qml/org/kde/desktop/private/MobileCursor.qml:33:13: Unable to assign [undefined] to bool
file:///home/nate/kde/usr6/lib64/qml/org/kde/desktop/private/MobileCursor.qml:33:13: Unable to assign [undefined] to bool
file:///home/nate/kde/usr6/lib64/qml/org/kde/desktop/private/MobileCursor.qml:33:13: Unable to assign [undefined] to bool
file:///home/nate/kde/usr6/lib64/qml/org/kde/desktop/private/MobileCursor.qml:33:13: Unable to assign [undefined] to bool
file:///home/nate/kde/usr6/lib64/qml/org/kde/desktop/private/MobileCursor.qml:33:13: Unable to assign [undefined] to bool

The issue is trivially reproducible by launching `elisa`, or `plasma-discover` in a terminal window and focusing a text field.

The problem is here:
https://invent.kde.org/frameworks/qqc2-desktop-style/-/blob/master/org.kde.desktop/private/MobileCursor.qml#L33

            visible: MobileTextActionsToolBar.shouldBeVisible

MobileTextActionsToolBar is a singleton accessed from the same directory, hence this file has no import line. And that shouldn't be required, right? And yet it can't find the singleton, and then visible: falls back to true, and then you see the mobile text toolbar too.
Comment 2 Nate Graham 2023-06-07 13:24:47 UTC
Thanks!
Comment 3 Joshua Goins 2023-06-13 22:09:52 UTC
Git commit 7e1df8f248ee565b9c7d421dbf591660fcbb95cc by Joshua Goins.
Committed on 13/06/2023 at 22:09.
Pushed by redstrate into branch 'master'.

ECMQmlModule: Add support for singleton types, support paths

Fixes needed for qqc2-desktop-style to work (see: https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/254). There are two problems here:
* Our auto-generated qmldir has no way to specify which components are singletons.
* Our auto-generated qmldir does not set the filepaths properly. qqc2-desktop-style installs files under private/ but the qmldir still refers to qml files as if they are in the root directory.

The way to mark qml components as singletons is shamelessly stolen from the new Qt6 CMake API - by using set_source_file_properties and QT_QML_SINGLETON_TYPE.

M  +13   -6    modules/ECMQmlModule.cmake

https://invent.kde.org/frameworks/extra-cmake-modules/-/commit/7e1df8f248ee565b9c7d421dbf591660fcbb95cc
Comment 4 Joshua Goins 2023-06-13 22:20:51 UTC
Git commit 2ea5c6602d97a088b95f00970cb9ad55479fb197 by Joshua Goins.
Committed on 13/06/2023 at 22:10.
Pushed by redstrate into branch 'master'.

Set MobileTextActionsToolBar as singleton type

M  +1    -0    CMakeLists.txt

https://invent.kde.org/frameworks/qqc2-desktop-style/-/commit/2ea5c6602d97a088b95f00970cb9ad55479fb197