Plasma mobile HID question: popup on long press
Marco Martin
notmart at gmail.com
Fri Jan 8 21:18:31 UTC 2016
On Friday 08 January 2016 13:04:53 Dirk Hohndel wrote:
> >
> > To me, this sounds like a case for the "slide to reveal actions" pattern
> > (see [1]). Would that work in your case?
>
> Totally. I didn't know that was an available option with QML / Plasma
> mobile. Certainly much more elegant than a popup window (so 80s).
>
> Any pointers, suggestions how to implement this?
take a look at
https://quickgit.kde.org/?p=plasma-mobile.git&a=blob&h=495bf02a284c999b688a0d1f5ab2b4eadbf62ec5&hb=9da0a08af277c2d92e069b58571a648795cfc96e&f=components%2Fmobilecomponents%2Fexample%2Fcontents%2Fui%2FMainPage.qml
the part
delegate: MobileComponents.ListItemWithActions {
enabled: true
MobileComponents.Label {
enabled: true
text: model.text
}
property Item ownPage
onClicked: {
root.pageStack.pop(root.initialPage);
if (!model.component) {
return;
}
ownPage = root.pageStack.push(Qt.resolvedUrl("gallery/" +
model.component + "Gallery.qml"));
}
checked: root.pageStack.currentPage == ownPage
actions: [
Controls.Action {
iconName: "document-decrypt"
onTriggered: print("Action 1 clicked")
},
Controls.Action {
iconName: "mail-reply-sender"
}]
}
I'm still not 100% happy with it since the component is a tad complex, so for
a list with thousands elements can be noticed not that smpooth while
scrolling, but can be improved :)
(and a big stress test like that would be very useful)
--
Marco Martin
More information about the Plasma-devel
mailing list