This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Coders, what's wrong with this plasmoid?

Tags: None
(comma "," separated)
cyrilbrosch
Registered Member
Posts
2
Karma
0
Hi, I'm not a coder at all, but direly missing the picture frame plasmoid in Plasma5. So I asked a friend with a bit coding experience to help me out.
He wrote a simple automatic slideshow to view the pictures of one folder (sufficient for me).
Unfortunately he doesn't have Plasma5 and could test it only with qmlviewer + Qt 4.7. It works with him, but when I convert it into a plasmoid, there is some formal misbehavior I can't understand (the underlying mechanisms works): After the first picture there appear two or even three at once (the slideshow goes from down to top, ignoring the borders of the plasmoid), see the screenshot:

Image

The code of main.qml is the following:

Code: Select all
import QtQuick 2.0
import Qt.labs.folderlistmodel 2.1

ListView {
id: list
width: 350; height: 400

FolderListModel {
id: folderModel
folder: "file:///path/to/directory"
nameFilters: ["*.png", ".jpg", "*.JPG", "*.jpeg"]
showDirs: false
}

Component {
id: fileDelegate

Image {
height: 400; width: 350
fillMode: Image.PreserveAspectFit
source: filePath
}
}

model: folderModel
delegate: fileDelegate

property int index: 0;
property alias count: folderModel.count;

Timer {
interval: 10000; running: true; repeat: true
onTriggered: {
index++;
if (index == count)
index = 0;
list.positionViewAtIndex(index, ListView.Visible)
}
}
}


How can I make the slideshow respect the plasmoid borders?

P.S.: I tried to put everything into
Code: Select all
Rectangle {
    width: list.width +20; height: list.height +20
}

but this produced an error (about a "type").
User avatar
mck182
KDE Developer
Posts
138
Karma
0
OS
Try setting "clip: true" to the ListView.

Also, there has been some work on porting the photo frame applet,
I don't know what's the current state, but I'll try asking around.


KDE Telepathy | Plasma | Plasma Mobile
cyrilbrosch
Registered Member
Posts
2
Karma
0
Thank you, this really banned the list into the plasmoid borders! :-)
For me this is now a sufficient replacement until the official picture frame will be back.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]