Plasma controls based on QtQuickControls2
ClosedPublic

Authored by mart on Feb 8 2017, 5:31 PM.

Details

Summary

This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well

Test Plan

tried with minimal QML files, a more comprehensive gallery may be needed.

pending considerations:

  • some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
  • it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
  • probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead

Diff Detail

Repository
R242 Plasma Framework (Library)
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mart updated this revision to Diff 11076.Feb 8 2017, 5:31 PM
mart retitled this revision from to [WIP] Plasma controls based on QtQuickControls2.
mart updated this object.
mart edited the test plan for this revision. (Show Details)
mart added a reviewer: Plasma.
Restricted Application added projects: Plasma, Frameworks. · View Herald TranscriptFeb 8 2017, 5:31 PM
Restricted Application added subscribers: Frameworks, plasma-devel. · View Herald Transcript
broulik added a subscriber: broulik.Feb 8 2017, 5:54 PM

Skimmed through it until ItemDelegate.qml, few nitpicks for that below

src/declarativeimports/plasmacomponents3/BusyIndicator.qml
29

Apparently in Qt 5.8 the implicit sizes now take into account padding but since we want to support 5.7 (?) makes sense.

Mentioned in the changelog: https://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/dist/changes-5.8.0

42

You sure this doesn't break anything if you mess with anchors and sizes and don't have a wrapper Item around it?

45

I think with QtQuick 2 smooth doesn't matter anymore, other than making it look worse.

From docs

In Qt Quick 2.0, this property has minimal impact on performance.

src/declarativeimports/plasmacomponents3/Button.qml
38

Docs say

You can also enable or disable hover effects for all Qt Quick Controls 2 applications by setting the QT_QUICK_CONTROLS_HOVER_ENABLED environment variable.

40

What Label is this? I don't see any import/namespace that would provide this here

42

QQC2 Label supposedly supports font (and probably other) inheritance

src/declarativeimports/plasmacomponents3/CheckIndicator.qml
64

Now that we have activeFocusReason we could potentially behave differently whether it was user-focused or tab-focused (not now but keeping that in mind for the future)

src/declarativeimports/plasmacomponents3/ComboBox.qml
97

in-window Popup makes me sad :(

src/declarativeimports/plasmacomponents3/DialogButtonBox.qml
42

Do we really want a ListView here?

Also, how does it work with e.g. HelpRole and things that would go on the left rather than the right? Dunno if it supports that though

src/declarativeimports/plasmacomponents3/Drawer.qml
36

Math.round(units.devicePixelRatio) instead of 1?

src/declarativeimports/plasmacomponents3/Frame.qml
35

Hardcoded number

mart updated this revision to Diff 11077.Feb 8 2017, 5:57 PM
  • separately install as style and import
This revision was automatically updated to reflect the committed changes.
mart reopened this revision.Feb 8 2017, 6:20 PM
mart added inline comments.
src/declarativeimports/plasmacomponents3/BusyIndicator.qml
29

would it break with an update to Qt 5.8?

src/declarativeimports/plasmacomponents3/Button.qml
38

would this have evvect even if hoverEnabled: true is hardcoded that way?
in that case we have a soluton for plasma mobile

40

ourselves.. it's in this patch

42

yes, in order to apply the font at the qqc2 label subclass we are using there if the user specified a custom font for this button

mart updated this revision to Diff 11082.Feb 8 2017, 6:21 PM
  • start a Plasma qqc2 style
  • add labels and button
  • add ToolButton
  • add checkboxes and check delegates
  • warnings--
  • add ComboBox
  • add Container and Control
  • add Dialog, Popup
  • add Drawer
  • add Frame
  • iadd GroupBox
  • add RadioButton and RadioDelegate
  • add a progressbar
  • Menu and MenuItem
  • add TabBar andTabButton
  • animate transition
  • layout fixes
  • New controls
  • add BusyIndicator
  • Merge branch 'master' into mart/qqc2style
  • install the components as a separate import
  • separately install as style and import
  • remove smooth property
  • adapt to final api
  • proper sizehints for the busy widget
  • hardcoded numbers --
  • use devicepixelratios

I want to do another full review next week when I'm home; but I'd be happy with doing that after we merge it, as it'll only be small things, and nothing which will affect API.

In general it all looks very good, I like that you split out ButtonShadow and all the rest seems neat. Good stuff.

src/declarativeimports/plasmacomponents3/Button.qml
29

I don't get why we check background here and in other places. It would only be null if a user subclassed this and then overwrote the property to undefined, at which point they deserve errors.

52

we do someting differently for widths and heights which isn't ideal, can we move the units.gridUnit * 1.6 into here as an implicitHeight?

src/declarativeimports/plasmacomponents3/CheckIndicator.qml
32

why?

src/declarativeimports/plasmacomponents3/GroupBox.qml
34

booo!

src/declarativeimports/plasmacomponents3/Label.qml
27

Now we have an API break, lets fix this.

As soon as you put this in a layout it won't do anything, so it's quite inconsistent.
If anything it should be an implicitHeight, or just set the lineHeight?

But I'd rather we didn't have it at all, we have to work round it in lots of places.

If we want a padded Label, we can make a new subclass in the import with all the other headings.

31

Bhushan did a patch for P-F that changed this on the current label if we're on mobile, is that still possible?

src/declarativeimports/plasmacomponents3/TextField.qml
60

can we kill an item here?

background: FrameSvgItem {

TextFiledFocus {
    anchors.fill:parent
 }

}

src/declarativeimports/plasmacomponents3/qmldir
40

maybe we don't want:

ToolTip, Popup, Dialog, DialogButtonBox here and only in the style?

Also which is the "correct" ItemDelegate we have one of them in PlasmaExtras

mart retitled this revision from [WIP] Plasma controls based on QtQuickControls2 to Plasma controls based on QtQuickControls2.Feb 22 2017, 3:50 PM
mart updated this revision to Diff 11630.Feb 22 2017, 3:53 PM
mart marked 2 inline comments as done.

updated with D4522

Generally good to go. Just one major gripe about Label, and making sure our installed items and qmldir are in sync.

src/declarativeimports/CMakeLists.txt
11

typo

42

It's easier to add something later than to remove it.

I'd go with not installing for now, then revisit it. Maybe same for Menus.

src/declarativeimports/plasmacomponents3/Label.qml
27

I still want this changed.

src/declarativeimports/plasmacomponents3/qmldir
12

Dialog and DialogButtonBox are listed here but aren't installed. I think that will cause an error.

And do we need CheckIndicator here?

mart updated this revision to Diff 11948.Feb 28 2017, 12:33 PM
mart marked 2 inline comments as done.
  • don't install files that shouldn't
src/declarativeimports/CMakeLists.txt
42

ok. what about the combobox?

src/declarativeimports/plasmacomponents3/Button.qml
29

good point

src/declarativeimports/plasmacomponents3/Label.qml
27

the reason for the padding is that it makes it correctly vertically aligned with other widgets both in a Row and a RowLayout.
without this default height, every label should be manually vertically centered in layouts, and people will simply not do that, mostly because most people simply won't see the incorrect alignment, not even when explicitly pointed to them.

src/declarativeimports/plasmacomponents3/qmldir
12

removed.
no, all CheckIndicator,radioindicator and switchindicator are private, used by both the checkbox and checkdelegate, but not intended to be usable publicly

davidedmundson added inline comments.Feb 28 2017, 1:25 PM
src/declarativeimports/plasmacomponents3/Label.qml
27

It probably made sense when it was written, but your comments about layouts is outdated.

No manual changes are needed.

try:
https://paste.kde.org/pgi2ui6e3

If it was a problem we'd be seeing it all the time in the config modules.

It is true for manual positioning and anchors, but I think the vast majority of the time where we'd want to be aligned to a button we'd be in a layout with that button.

I'm sure there will be some changes needed, but it'll be few. (if I remove the line in my QQC1 label locally, I can't see any)

In constrast run this on your workspace folder:
find -name '*.qml' | xargs grep 'height:' | grep paintedHeight

and you'll see the number of times we have to reverse this logic.

mart added inline comments.Feb 28 2017, 3:51 PM
src/declarativeimports/plasmacomponents3/Label.qml
27

so, GridLayout and RowLayout align correctly, while Row still doesn't.

so, ok for me to remove it, and require *layouts are used instead of simple positioners everywhere

mart updated this revision to Diff 11960.Feb 28 2017, 3:52 PM
  • remove custom height
davidedmundson accepted this revision.Feb 28 2017, 4:22 PM
This revision is now accepted and ready to land.Feb 28 2017, 4:22 PM
mart added a comment.Mar 1 2017, 1:37 PM

I would push it right after this frameworks release, ok?

This revision was automatically updated to reflect the committed changes.