Qml controls for kcm creation
ClosedPublic

Authored by mart on Nov 24 2017, 10:34 AM.

Details

Summary

the base C++ class for qml-based kcms is already there,
KQuickAddons::ConfigModule, so this is the right place
for the module. the import existed already: org.kde.kcm
the qml files gets added in the version 1.1 of the import

Test Plan

ported the mouse cursors kcm to this

Diff Detail

Repository
R296 KDeclarative
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mart created this revision.Nov 24 2017, 10:34 AM
Restricted Application added projects: Plasma, Frameworks. · View Herald TranscriptNov 24 2017, 10:34 AM
Restricted Application added subscribers: Frameworks, plasma-devel. · View Herald Transcript
mart added a reviewer: hein.Nov 24 2017, 10:50 AM
mart updated this revision to Diff 22885.Nov 24 2017, 10:58 AM
  • include SimpleKCM
hein added inline comments.Nov 24 2017, 11:07 AM
src/qmlcontrols/kcmcontrols/qml/GridDelegate.qml
131

Do these numbers align with anything? Then a comment pointing at where else we use them would be good.

Or maybe use multiples of long/short duration? Or makes no sense?

Same question about the other site in the code.

src/qmlcontrols/kcmcontrols/qml/GridView.qml
31

Is this still the best we can do? The FV code uses some old QQC1 private APIs to get scrollbar width. I thought in QQC2 we have proper ways to do it by accessing the SB instance?

src/qmlcontrols/kcmcontrols/qml/GridViewKCM.qml
30

When I wrote my launch feedback port I had some trouble with sizing in kcmshell5. The window came up too small to fit the FormLayout, but the scrollbar was also assuming a content size far larger than the FormLayout - I had to make the window pretty big for the vertical scrollbar to disappear. So it was broken in two ways.

How does this compare? I noticed the hard-coded values here instead of really working with the content.

src/qmlcontrols/kcmcontrols/qml/SimpleKCM.qml
28

Same wonderings @ sizing.

mart added inline comments.Nov 24 2017, 11:15 AM
src/qmlcontrols/kcmcontrols/qml/GridDelegate.qml
131

ah, no there isn't anywhere anything configured for duration for tooltips. in upstream qqc2 is also one second hardcoded

src/qmlcontrols/kcmcontrols/qml/GridView.qml
31

qqc2 scrollview is almost api-less but maybe i can access somehow the scrollbar with an attached property now that i think about, i'll give a try

src/qmlcontrols/kcmcontrols/qml/GridViewKCM.qml
30

this one is a big scrollview of thumbnails and nothing else...
at most i guess we could make it that we want it big as 3x3 cells or something like that but the contents don't really have an implicit size per se

src/qmlcontrols/kcmcontrols/qml/SimpleKCM.qml
28

for this i think we could try to get an implicit size of the layout inside the main scrollview, but then limiting it to some hardcoded value anyways.
for instance if started with kcmshell i think it's better if it puts a scrollbar in it rather than making a very narrow and tall window that takes all the vertical space

mart updated this revision to Diff 22897.Nov 24 2017, 2:25 PM
  • use the actual scrollbar width
  • more sophisticated implicit size for kcms
  • size hints for the simple kcm
davidedmundson requested changes to this revision.Nov 24 2017, 2:48 PM
davidedmundson added a subscriber: davidedmundson.

I like the GridView

Note that we'll want to use that from the WallpaperDialog in Plasma, which isn't a KCM. I don't think it will be a problem though ?

We are missing docs everywhere. Every public type and property should have some.
Also please check the years in your copyright.

src/qmlcontrols/kcmcontrols/qml/GridView.qml
25

How do you use this and set the model & delegate?

src/qmlcontrols/kcmcontrols/qml/SimpleKCM.qml
24

System settings adds it too for the KCM
KCMMultiPageDialog (kcmshell5) adds a scroll area for the KCM

So isn't this adding a QtQuick scrollarea within a parent widget scrollarea?

This revision now requires changes to proceed.Nov 24 2017, 2:48 PM
mart added a comment.Nov 27 2017, 10:08 AM

I like the GridView

Note that we'll want to use that from the WallpaperDialog in Plasma, which isn't a KCM. I don't think it will be a problem though ?

yes, those components should be usable from anywhere, so should be fine for the wallpaper dialog.
the only caveat is the dependency, (plasma-desktop already depends from kdeclarative so is fine)

src/qmlcontrols/kcmcontrols/qml/GridView.qml
25

GridView {

view.model: foo
view.Delegate: Delegate {...}

}

src/qmlcontrols/kcmcontrols/qml/SimpleKCM.qml
24

yeah, it does that..
it keeps the qquickwidget small enough so the qwidget scrollbar won't be there.
which isn't optimal, but i think the scrolling should be handed by the qml part.

src/qmlcontrols/kcmcontrols/qml/SimpleKCM.qml
24

but i think the scrolling should be handed by the qml part.

Why?

mart updated this revision to Diff 22996.Nov 27 2017, 11:00 AM
  • documentation
mart marked 10 inline comments as done.Nov 27 2017, 11:02 AM
mart added inline comments.Nov 27 2017, 11:11 AM
src/qmlcontrols/kcmcontrols/qml/SimpleKCM.qml
24

3 reasons:

  1. because the long term goal is to get rid of the qwidget version, so even if it's long down the road things should be designed according to that from now.

the design for a pure qml version would be kcms to be kirigami Pages, which get directly inserted in a kirigami PageRow, so they manage their own scrolling

  1. also makes it easier for more complicated designs where is not the whole ui scrolling but there is a scrollview and a form layout in the same module, as some mockups have.
  1. if we relied on the scrolling by the kcmshell scrollarea, the QQuickWidget height should resize itself based on the contents size, but the contents width should depend from the qquickwidget width, making it a weird hybrid between the two ResizeMode, which from Plasma::Dialog know how much complicated and painful it becomes
This revision was automatically updated to reflect the committed changes.