Introduce PlaceholderMessage component
ClosedPublic

Authored by ngraham on Apr 21 2020, 2:59 PM.

Details

Summary

This patch creates the PlaceholderMessage, a re-usable component that can be used
to create all kinds of placeholder messages with a standardized appearance. It can be a
loading screen, an "there's no content in this view" message, an error message, and more.

Test Plan

In Discover, with D29059:


In Plasma-Thunderbolt, with D29060:

More will be ported if and when this patch lands.

Diff Detail

Repository
R169 Kirigami
Branch
placeholder-message (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 25611
Build 25629: arc lint + arc unit
ngraham created this revision.Apr 21 2020, 2:59 PM
Restricted Application added a project: Kirigami. · View Herald TranscriptApr 21 2020, 2:59 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
ngraham requested review of this revision.Apr 21 2020, 2:59 PM
ngraham edited the test plan for this revision. (Show Details)Apr 21 2020, 3:01 PM
cblack added inline comments.Apr 21 2020, 3:10 PM
src/controls/PlaceholderMessage.qml
20

@code{.qml}

40

Split into own codeblock

67

Ditto

100

This is a QVariant, not a string.

104

@see Icon::source

107

You probably want to add a property for the fallback icon as well

110

Not sure this will link properly.

141

Use source instead of an alias to it for better readability

mart requested changes to this revision.Apr 21 2020, 3:37 PM
mart added inline comments.
src/controls/PlaceholderMessage.qml
10

as convention (sadly not used everywhere in the sources but at least in the "newer" files) use a namespace
import org.kde.kirigami 2.12 as Kirigami

107

for consistency with qqc2 icons it should be ActionIconGroup

130

remove this property.
then if a Kirigami.Action is used, that visible property can be used

This revision now requires changes to proceed.Apr 21 2020, 3:37 PM
broulik added inline comments.
src/controls/PlaceholderMessage.qml
118

You can probably just make an alias to the button's action property. It got added in Qt 5.10, then it should take on the icon, text, visibility, trigger, etc of that action automatically.

(helperAction sounds as if it were an implementation detail somehow)

141

Probably just want to bind valid

148

Layout.fillWidth: true instead, so it'll wrap properly?

ngraham updated this revision to Diff 80782.Apr 21 2020, 4:19 PM
ngraham marked 13 inline comments as done.

Address review comments

abetts added a subscriber: abetts.Apr 21 2020, 4:29 PM

Look cool!

ngraham updated this revision to Diff 80825.Apr 22 2020, 1:22 AM

Add margins to examples

leinir added a subscriber: leinir.Apr 22 2020, 8:25 AM

Nice! Got a few places where this could be very handy :)

ngraham updated this revision to Diff 80892.Apr 22 2020, 2:16 PM

Add another code example showing now you could use it as a loading indicator

mart accepted this revision.Apr 22 2020, 7:06 PM
This revision is now accepted and ready to land.Apr 22 2020, 7:06 PM
This revision was automatically updated to reflect the committed changes.
nicolasfella added inline comments.
src/controls/PlaceholderMessage.qml
27

This needs to be 2.12