[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: Just a little more help needed with QML and Data Engine
From: Eric Mesa <ericsbinaryworld () gmail ! com>
Date: 2012-01-23 0:27:12
Message-ID: CAKYHq8LNuf0SYV=MiLnEMMU6xPrHR4z779xXEwQ+j6iCt47ORw () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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
[Attachment #5 (text/html)]
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:<div> \
<br></div><div> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#808000">import</span><span style="color:#c0c0c0"> </span><span \
style="color:#800080">Qt</span><span style="color:#c0c0c0"> </span>4.7</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span \
style="color:#808000">import</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">"content"</span></pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span \
style="color:#808000">import</span><span style="color:#c0c0c0"> </span><span \
style="color:#800080">QtWebKit</span><span style="color:#c0c0c0"> </span>1.0</pre> \
<pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#808000">import</span><span style="color:#c0c0c0"> \
</span>org.kde.plasma.core<span style="color:#c0c0c0"> </span>0.1<span \
style="color:#c0c0c0"> </span>as<span style="color:#c0c0c0"> </span><span \
style="color:#800080">PlasmaCore</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#800080">Rectangle</span><span style="color:#c0c0c0"> </span>{</pre> \
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">id</span>:<span style="color:#c0c0c0"> \
</span>window</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span style="color:#800000">width</span>:<span \
style="color:#c0c0c0"> </span>360</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span \
style="color:#800000">height</span>:<span style="color:#c0c0c0"> </span>360</pre> \
<pre style="margin-top:0px;margin-bottom:0px"><br></pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span \
style="color:#800080">PlasmaCore</span>.<span \
style="color:#800080">DataSource</span><span style="color:#c0c0c0"> </span>{</pre> \
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">id</span>:<span style="color:#c0c0c0"> \
</span>viewsSource</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span style="color:#800000">engine</span>:<span \
style="color:#c0c0c0"> </span><span \
style="color:#008000">"flickrviewsengine"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#008000">//connectedSources:</span><span \
style="color:#c0c0c0"> </span><span \
style="color:#008000">["75"]</span><span style="color:#c0c0c0"> \
</span><span style="color:#008000">//may</span><span style="color:#c0c0c0"> \
</span><span style="color:#008000">end</span><span style="color:#c0c0c0"> \
</span><span style="color:#008000">up</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">removing</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">this</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">line</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">and</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">leaving</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">in</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">Component.....line</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">interval</span>:<span style="color:#c0c0c0"> \
</span>0</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span \
style="color:#800080">Component</span>.<span \
style="color:#800000">onCompleted</span>:<span style="color:#c0c0c0"> \
</span>connectedSources<span style="color:#c0c0c0"> </span>=<span \
style="color:#c0c0c0"> </span>sources</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">onSourceAdded</span>:<span style="color:#c0c0c0"> \
</span>connectSource(source)</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span>}</pre> <pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800080">PlasmaCore</span>.<span \
style="color:#800080">DataSource</span><span style="color:#c0c0c0"> </span>{</pre> \
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">id</span>:<span style="color:#c0c0c0"> \
</span>timer</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span style="color:#800000">engine</span>:<span \
style="color:#c0c0c0"> </span><span \
style="color:#008000">"time"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">interval</span>:<span style="color:#c0c0c0"> \
</span>0</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span \
style="color:#800080">Component</span>.<span \
style="color:#800000">onCompleted</span>:<span style="color:#c0c0c0"> \
</span>connectedSources<span style="color:#c0c0c0"> </span>=<span \
style="color:#c0c0c0"> </span>sources</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">onSourceAdded</span>:<span style="color:#c0c0c0"> \
</span>connectSource(source)</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span>}</pre> <pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#808000">property</span><span style="color:#c0c0c0"> \
</span><span style="color:#808000">string</span><span style="color:#c0c0c0"> \
</span>currentGroup:<span style="color:#c0c0c0"> </span>timer.data[<span \
style="color:#008000">"Local"</span>][<span \
style="color:#008000">"Timezone"</span>]<span style="color:#c0c0c0"> \
</span><span style="color:#008000">///home/ermesa/bin/qml/plasmoids/flickrviews/testgrouprss"</span><span \
style="color:#c0c0c0"> </span><span \
style="color:#008000">viewsSource.data["75"]["Group</span><span \
style="color:#c0c0c0"> </span><span style="color:#008000">75"]</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#808000">property</span><span style="color:#c0c0c0"> \
</span><span style="color:#808000">bool</span><span style="color:#c0c0c0"> \
</span>loading:<span style="color:#c0c0c0"> </span>feedModel.status<span \
style="color:#c0c0c0"> </span>==<span style="color:#c0c0c0"> </span><span \
style="color:#800080">XmlListModel</span>.<span \
style="color:#800080">Loading</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800080">XmlListModel</span>{</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">id</span>:feedModel</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">source</span>:<span style="color:#c0c0c0"> \
</span>window.currentGroup<span style="color:#c0c0c0"> </span><span \
style="color:#008000">//viewsSource.data["75"]["Group</span><span \
style="color:#c0c0c0"> </span><span style="color:#008000">75"]</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">query</span>:<span style="color:#c0c0c0"> \
</span><span style="color:#008000">"/rsp/photos/photo"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800080">XmlRole</span><span style="color:#c0c0c0"> \
</span>{<span style="color:#c0c0c0"> </span><span \
style="color:#800000">name</span>:<span style="color:#c0c0c0"> </span><span \
style="color:#008000">"title"</span>;<span style="color:#c0c0c0"> \
</span><span style="color:#800000">query</span>:<span style="color:#c0c0c0"> \
</span><span style="color:#008000">"@title/string()"</span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span>}</pre> <pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800080">Row</span><span style="color:#c0c0c0"> \
</span>{</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span style="color:#800000">width</span>:<span \
style="color:#c0c0c0"> </span>360</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">height</span>:<span style="color:#c0c0c0"> \
</span>43</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span \
style="color:#800080">Rectangle</span>{</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">width</span>:<span style="color:#c0c0c0"> \
</span>window.width;<span style="color:#c0c0c0"> </span><span \
style="color:#800000">height</span>:<span style="color:#c0c0c0"> \
</span>window.height</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">color</span>:<span style="color:#c0c0c0"> \
</span><span style="color:#008000">"blue"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800080">Text</span><span style="color:#c0c0c0"> \
</span>{</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span \
style="color:#800000">id</span>:<span style="color:#c0c0c0"> </span>testtext</pre> \
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">text</span>:<span style="color:#c0c0c0"> \
</span>qsTr(<span style="color:#008000">"buttons</span><span \
style="color:#c0c0c0"> </span><span style="color:#008000">will</span><span \
style="color:#c0c0c0"> </span><span style="color:#008000">go</span><span \
style="color:#c0c0c0"> </span><span style="color:#008000">here!"</span>)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span>}</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span>}</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span>}</pre> <pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800080">Row</span><span style="color:#c0c0c0"> \
</span>{</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span style="color:#800000">x</span>:<span \
style="color:#c0c0c0"> </span>0</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">y</span>:<span style="color:#c0c0c0"> \
</span>43</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span style="color:#800000">width</span>:<span \
style="color:#c0c0c0"> </span>370</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">height</span>:<span style="color:#c0c0c0"> \
</span>317</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span \
style="color:#800080">Rectangle</span><span style="color:#c0c0c0"> </span>{</pre> \
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">width</span>:<span style="color:#c0c0c0"> \
</span>window.width/3+10;<span style="color:#c0c0c0"> </span><span \
style="color:#800000">height</span>:<span style="color:#c0c0c0"> \
</span>window.height</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">color</span>:<span style="color:#c0c0c0"> \
</span><span style="color:#008000">"#efefef"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800080">ListView</span><span style="color:#c0c0c0"> \
</span>{</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span \
style="color:#800000">id</span>:<span style="color:#c0c0c0"> </span>list</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">width</span>:<span style="color:#c0c0c0"> \
</span>window.width/3;<span style="color:#c0c0c0"> </span><span \
style="color:#800000">height</span>:<span style="color:#c0c0c0"> \
</span>window.height</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">model</span>:<span style="color:#c0c0c0"> \
</span>feedModel</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span \
style="color:#800000">delegate</span>:<span style="color:#c0c0c0"> </span><span \
style="color:#800080">ItemDelegate</span><span style="color:#c0c0c0"> </span>{}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">highlight</span>:<span style="color:#c0c0c0"> \
</span><span style="color:#800080">Rectangle</span><span style="color:#c0c0c0"> \
</span>{<span style="color:#c0c0c0"> </span><span \
style="color:#800000">color</span>:<span style="color:#c0c0c0"> </span><span \
style="color:#008000">"lightgray"</span><span style="color:#c0c0c0"> \
</span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800000">highlightMoveSpeed</span>:<span \
style="color:#c0c0c0"> </span>9999999</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span>}</pre> <pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span>}</pre> <pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span><span style="color:#800080">Rectangle</span><span style="color:#c0c0c0"> \
</span>{</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span \
style="color:#800000">width</span>:<span style="color:#c0c0c0"> \
</span>window.width/3*2</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span><span \
style="color:#800000">height</span>:<span style="color:#c0c0c0"> \
</span>window.height</pre> <pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0"> </span>}</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span>}</pre> <pre style="margin-top:0px;margin-bottom:0px">}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre></div><div><br></div><div>And \
here's the error:</div><div> <p \
style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px"><span \
style="font-family:'Monospace';font-size:9pt;color:#1f1c1b">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 \
</span></p> </div><div>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px"><span \
style="font-family:'Monospace';font-size:9pt;color:#1f1c1b">TypeError: Result \
of expression 'timer.data["Local"]' [undefined] is not an \
object.</span></p> <p \
style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px"><span \
style="font-family:'Monospace';font-size:9pt;color:#1f1c1b"><br></span></p><p \
style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px"> <span \
style="font-family:'Monospace';font-size:9pt;color:#1f1c1b">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)</span></p>
--<br>Eric Mesa<br><a \
href="http://www.ericsbinaryworld.com">http://www.ericsbinaryworld.com</a><br> </div>
_______________________________________________
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