Bug 425899

Summary: ItemViewHeader not working inside KCMs not in an application window
Product: [Frameworks and Libraries] frameworks-kirigami Reporter: Harald Sitter <sitter>
Component: generalAssignee: Marco Martin <notmart>
Status: CONFIRMED ---    
Severity: normal CC: nate, nicolas.fella
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: Not decided   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: main.qml (minimal example)
shot of the screen

Description Harald Sitter 2020-08-28 13:10:45 UTC
Created attachment 131240 [details]
main.qml (minimal example)

inside a qml KCM put a Kirigami.ItemViewHeader and it gets grumpy:

> kinfocenter(273011)/(default) unknown: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/AbstractItemViewHeader.qml:33: ReferenceError: applicationWindow is not defined
> kinfocenter(273011)/(default) unknown: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/ItemViewHeader.qml:28: ReferenceError: applicationWindow is not defined
> kinfocenter(273011)/(default) unknown: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/AbstractApplicationItem.qml:311:9: QML Binding: Not restoring previous value because restoreMode has not been set.
> This behavior is deprecated.
> You have to import QtQml 2.14 after any QtQuick imports and set
> the restoreMode of the binding to fix this warning.
> In Qt < 6.0 the default is Binding.RestoreBinding.
> In Qt >= 6.0 the default is Binding.RestoreBindingOrValue.
> 
> kinfocenter(273011)/(default) unknown: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/AbstractItemViewHeader.qml:33: ReferenceError: applicationWindow is not defined
> kinfocenter(273011)/(default) unknown: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/ItemViewHeader.qml:28: ReferenceError: applicationWindow is not defined


I'm attaching a sample file, easiest to drop it in an existing KCM to see the problem.
Comment 1 Harald Sitter 2020-08-28 13:11:11 UTC
Created attachment 131241 [details]
shot of the screen
Comment 2 Nicolas Fella 2020-08-29 10:23:20 UTC
I suppose the problem is that it assumes the presence of applicationWindow()
Comment 3 Harald Sitter 2020-08-31 10:46:07 UTC
Yep. Probably needs some if-elseing.