[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: Accessing a C++ dataengine from a QML plasmoid
From:       Guillaume DE BURE <guillaume.debure () gmail ! com>
Date:       2013-02-04 21:42:09
Message-ID: 56669009.G1oiljXIgz () localhost
[Download RAW message or body]

Le lundi 4 février 2013 21:58:31 vous avez écrit :
> Le lundi 4 février 2013 15:56:00 Michail Vourlakos a écrit :
> > Στις 30/01/2013 11:38 μμ, ο/η Guillaume DE BURE έγραψε:
> > > Le mercredi 30 janvier 2013 22:20:13 Marco Martin a Γ crit :
> > > > On Wednesday 30 January 2013, Guillaume DE BURE wrote:
> > > > > However, I am not completely clear how to access it in QML. Userbase seems
> > > > > to say it should be possible:
> > > > > http://techbase.kde.org/Development/Tutorials/Plasma/QML/API#DataModel
> > > > > 
> > > > > So I made an attempt that looks like this, but that does not work:
> > > > > https://projects.kde.org/projects/extragear/office/skrooge/repository/revis
> > > > > ions/plasma-dashboard/entry/plugins/applet/account-qml/contents/ui/main.qml
> > > > > 
> > > > > Can anybody help me ? Thanks in advance :)
> > > > banksSource.data["Accounts"] is directly the data
> > > > 
> > > > for the model:
> > > > 
> > > > PlasmaCore.DataModel {
> > > > dataSource: banksSource
> > > > sourceFilter: "Accounts"
> > > > }
> > > > 
> > > > 
> > > Thanks Marco... However, not sure I fully understood you. Did you mean I should \
> > > write it like this :
> > I think you should change it to:
> > 
> > Item {
> > id: mainWidget
> > 
> > // Connect to our dataengine
> > PlasmaCore.DataSource {
> > id: banksSource
> > engine: "skgdataengine"
> > interval: 0
> > connectedSources: ["Accounts"]
> > }
> > 
> > // Use a modelProxy for easy filtering / sorting
> > PlasmaCore.SortFilterModel {
> > id: banksModel
> > sourceModel: PlasmaCore.DataModel {
> > dataSource: banksSource
> > /// sourceFilter: "Accounts" // I think this is not needed because you use only \
> > one source }
> > }
> > 
> > // Put all accounts in a Column
> > ListView {
> > anchors.fill: parent
> > model: banksModel
> > 
> > delegate: Text {
> > text: model["type"]
> > }
> > }
> > }
> 
> Thanks for the suggestion, Michail, but it doesn't change anything... I'm starting \
> to think QML doesn't like me ;( 
> Or maybe the fact that all this is running contained in Skrooge breaks the whole \
> dataengine / plasmoid magic in QML ? 
> 

Marco saved me on IRC, I was missing the keyRoleFilter: ".*" in the DataModel. I \
somehow assumed that leaving it empty was equivalent to this, but it was not the \
case.

Thanks :)

-- 
Skrooge, a free, Open Source, personal finances software for linux, Mac OS, Windows
http://skrooge.org
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic