From kde-panel-devel Mon Jan 23 00:27:12 2012 From: Eric Mesa Date: Mon, 23 Jan 2012 00:27:12 +0000 To: kde-panel-devel Subject: Re: Just a little more help needed with QML and Data Engine Message-Id: X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=132727861729856 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0404056795481467239==" --===============0404056795481467239== Content-Type: multipart/alternative; boundary=e89a8ffba0c37a4c6804b7271760 --e89a8ffba0c37a4c6804b7271760 Content-Type: text/plain; charset=ISO-8859-1 Ran things through the QT Creator debugger. Looks like it wasn't connecting to my flickrviewsengine because the isvalid variable was false. So I changed things up a bit. Decided to use the Time engine because that's the one always used in examples. Still got the same error. Here's my current code: import Qt 4.7 import "content" import QtWebKit 1.0 import org.kde.plasma.core 0.1 as PlasmaCore Rectangle { id: window width: 360 height: 360 PlasmaCore.DataSource { id: viewsSource engine: "flickrviewsengine" //connectedSources: ["75"] //may end up removing this line and leaving in Component.....line interval: 0 Component.onCompleted: connectedSources = sources onSourceAdded: connectSource(source) } PlasmaCore.DataSource { id: timer engine: "time" interval: 0 Component.onCompleted: connectedSources = sources onSourceAdded: connectSource(source) } property string currentGroup: timer.data["Local"]["Timezone"] ///home/ermesa/bin/qml/plasmoids/flickrviews/testgrouprss" viewsSource.data["75"]["Group 75"] property bool loading: feedModel.status == XmlListModel.Loading XmlListModel{ id:feedModel source: window.currentGroup //viewsSource.data["75"]["Group 75"] query: "/rsp/photos/photo" XmlRole { name: "title"; query: "@title/string()"} } Row { width: 360 height: 43 Rectangle{ width: window.width; height: window.height color: "blue" Text { id: testtext text: qsTr("buttons will go here!") } } } Row { x: 0 y: 43 width: 370 height: 317 Rectangle { width: window.width/3+10; height: window.height color: "#efefef" ListView { id: list width: window.width/3; height: window.height model: feedModel delegate: ItemDelegate {} highlight: Rectangle { color: "lightgray" } highlightMoveSpeed: 9999999 } } Rectangle { width: window.width/3*2 height: window.height } } } And here's the error: KGlobal::locale::Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work TypeError: Result of expression 'timer.data["Local"]' [undefined] is not an object. So I figure I need to solve the problem with the known working time engine before I tackle what's wrong with mine. (I think it's because I added the engine as root - it doesn't so up in my user's engine explorer - only in root's) -- Eric Mesa http://www.ericsbinaryworld.com --e89a8ffba0c37a4c6804b7271760 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Ran things through the QT Creator debugger. =A0Looks like it wasn't con= necting to my flickrviewsengine because the isvalid variable was false. =A0= So I changed things up a bit. =A0Decided to use the Time engine because tha= t's the one always used in examples. =A0Still got the same error. =A0He= re's my current code:

import Qt 4.7
import "content"
import QtWebKit 1.0
import org.kde.plasma.core 0.1 as Pla=
smaCore

Rectangle {
    id: window
    width: 360
    height: 360

    PlasmaCore.DataSource {=
         id: viewsSource
         engine: "flickrviewse=
ngine"
         //connectedSources:=
 ["=
75"]  //may end up removing <=
span style=3D"color:#008000">this line =
and leaving in Component.....line<=
/pre>

         interval: 0
         Component.onCompleted: connectedSources =3D sources
         onSourceAdded: connectSource(source)
     }

    PlasmaCore.DataSource {=
         id: timer
         engine: "time"
         interval: 0
         Component.onCompleted: connectedSources =3D sources
         onSourceAdded: connectSource(source)
     }

    property string currentGroup: timer.data["Local"]["Timezone"] ///home/ermesa/bin/qml/plasm=
oids/flickrviews/testgrouprss" viewsSource.data["75"]["G=
roup 75"]
    property bool loading: fe=
edModel.status =3D=3D XmlListModel.Loading

    XmlListModel{
            id:feedModel
            source: window.currentGroup //viewsSource.data["75"]=
["Group 75"]
            query: "/rsp/photos=
/photo"
            XmlRole { name: "title"; query: "@title/string()&q=
uot;}

        }

    Row {
        width: 360
        height: 43
        Rectangle{
            width: window.width; height: window.height
            color: "blue"<=
/span>

            Text {
                id: testtext
                text: qsTr("but=
tons will go here!")
            }
        }
    }

    Row {
        x: 0
        y: 43
        width: 370
        height: 317
            Rectangle {
                width: window.width/3+10; height: window.height
                color: "#efefef=
"

                ListView {
                    id: list
                    width: window.width/3; height: window.height
                    model: feedModel
                    delegate=
: ItemDe=
legate {}

                    highlight: Recta=
ngle { color: "lightgray" }
                    highlightMoveSp=
eed: 9999999
                }

            }

            Rectangle {
                width: window.width/3*2
                height: window.height
            }
    }
}


And here's the error:

KGlobal::locale::Warning your global KLocale is being recreated with a= valid main component instead of a fake component, this usually means you t= ried to call i18n related functions before your main component was created.= You should not do that since it most likely will not work=A0

TypeError: Result of expression 'timer.data["Local"]'= ; [undefined] is not an object.


So I figure I need to solve the problem with the known working time engine= before I tackle what's wrong with mine. =A0(I think it's because I= added the engine as root - it doesn't so up in my user's engine ex= plorer - only in root's)

--
Eric Mesa
http://www.e= ricsbinaryworld.com
--e89a8ffba0c37a4c6804b7271760-- --===============0404056795481467239== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --===============0404056795481467239==--