Re: [Qt-qml] About possibilities of sharing common parts between the applications

2010-12-10 Thread aaron.kennedy
Hi,

On 10/12/2010, at 1:47 AM, ext 
iiro.ka...@nokia.com wrote:

Hi,

We have been analyzing what is going on with the QML application launches on 
Symbian side. One thing we have been thinking about was, that perhaps it would 
be beneficial to share some things between applications. Now, for example,  in 
every application start we're registering all the internal Qml elements one by 
one. Could this kind of common structures be shared on some global shareable 
memory chunk, which could then be shared between applications?

This kind of sharing would probably help on both Symbian and Meego –platforms 
(perhaps a bit overkill on desktop though).

Has there been any discussion related to this?

Yes, there have been many discussions related to it :)  There is no reason it 
can't be done, but it is a non-trivial amount of work.  We shall start 
investigating options shortly.

Cheers,

Aaron
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] QDeclarativeView::setObjectOwnership

2010-11-29 Thread aaron.kennedy
Hi,

Sounds like a bug to me - please file a bug report.

Cheers,

Aaron

On 29/11/2010, at 7:39 PM, "ext Girish Ramakrishnan"  
wrote:

> Hi,
> QDeclarativeView::setObjectOwnership doesn't seem to be working as I
> would expect. Maybe I am reading the documentation wrong.
> 
> In essence, I have a
> Q_INVOKABLE QObject *create() {
>Object *o = new Object;
>o->setObjectName("object x");
>QDeclarativeEngine::setObjectOwnership(o, 
> QDeclarativeEngine::CppOwnership);
>return o;
> }
> 
> I call the above function from QML and despite the ownership being set
> to CppOwnership, the above objects gets deleted anyway.
> 
> If you want full compilable code, it's here -
> http://pastebin.com/ffqmxHy6. Keep clicking on the rectangle to create
> new objects. Then close the app, all the created objects gets deleted
> (I thought setting CppOwnership will make qml not delete the objects).
> 
> Girish
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Problems with signals and signal handlers

2010-11-25 Thread aaron.kennedy
Hi,

On 26/11/2010, at 3:52 AM, ext Thorbjørn Lindeijer wrote:

> (sending again and now to the list since no proper Reply-to was provided...)
> 
> On 11/25/2010 11:49 AM, Bergman Simo (Nokia-MS/Espoo) wrote:
>> And somehow there is no logic, how my signal handlers are called with
>> this code. E.g. when I move my mouse out from the rectangle, I get
>> onExit to the MouseArea, but focusGained signal handler is called. I
>> would of course expect onFocusRemoved to be called.
> 
> I'm seeing the same strange behaviour with qmlviewer from Qt 4.7.0,
> however not when I use the qmlviewer from Qt 4.7.1. So I guess this bug
> was already fixed.

This is quite likely - there were a number of bugs fixed after 4.7.0 involving 
alias's interacting poorly with other features.  I'm just glad this didn't turn 
out to be *another* broken case ;)

Cheers,

Aaron


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] How QML file is parsed and linked and executed?

2010-11-24 Thread aaron.kennedy
Hi,

On 24/11/2010, at 7:17 PM, "ext Matti Mäki"  wrote:

> With this kind of dynamic programming environment it might be a fragile 
> development practice to rely on the assumption that the framework will 
> load elements in the same order all the way now and in the future.

This is some sagely advice.  

When I say the order is undefined, that's what I mean ;) It is not that we feel 
that this is a sensible order for some reason that we're keeping a secret, it's 
just the order that the current implementation happens to run them.  This might 
change at any moment.

What are you doing in your app that requires such strict ordering?  Perhaps we 
can suggest a more robust alternative.

Cheers,

Aaron

> 24.11.2010 10:47, ext-ivailo.il...@nokia.com kirjoitti:
>> Hello,
>> 
>> as I got this is how it works now. The first one is the parent onCompleted 
>> and then we have all the child events poped up from the tail somehow.
>> 
>> though it looks strange - in the "normal" HTML / Js or WEB in general you 
>> shall expect them to be fom top-to-bottom, or in a complete mess. So this 
>> queue pop-up behaviour is a little strange.
>> 
>> But if this is how it should be it's ok for me at least - if I know how it 
>> should work I could structure my stuff for it.
>> 
>> But if it's still in progress of development and if you could think of 
>> another approach I think many people will like to see the other behaviour - 
>> form top to bottom. So to make it more clear the "better" result from this 
>> example for us will be:
>> 
>> one
>> two
>> three
>> screen
>> 
>> I know that this is structurally incorrect for you, as you cannot start 
>> invoking events before you have full initialization, but if you can reverse 
>> the stack with events and call them in this way it will be great :-P
>> 
>> best regards,
>> Ivo
>> 
>> From: Pasion Jerome (Nokia-MS-Qt/Oslo)
>> Sent: Tuesday, November 23, 2010 9:29 PM
>> To: Iliev Ivailo (EXT-ProData/Berlin); Kennedy Aaron (Nokia-MS-Qt/Brisbane)
>> Cc: qt-qml@trolltech.com
>> Subject: RE: [Qt-qml] How QML file is parsed and linked and executed?
>> 
>> Hello,
>> 
>> Example:
>> 
>> import QtQuick 1.0
>> 
>> Rectangle {
>> 
>> id:screen; width: 100; height: 100
>> 
>> Rectangle {
>> id: one; width: 10; height: 10
>> Component.onCompleted: console.log("one")
>> }
>> Rectangle {
>> id: two; width: 10; height: 10
>> Component.onCompleted: console.log("two")
>> }
>> Rectangle {
>> id: three; width: 10; height: 10
>> Component.onCompleted: console.log("three")
>> }
>> 
>> Component.onCompleted: console.log("screen")
>> }
>> =
>> output:
>> screen
>> three
>> two
>> one
>> 
>> The top level's handler is first, then the children.
>> Is this a reasonable generalization to make?
>> 
>> Cheers,
>> Jerome P.
>> 
>> From: qt-qml-boun...@trolltech.com [qt-qml-boun...@trolltech.com] On Behalf 
>> Of Iliev Ivailo (EXT-ProData/Berlin)
>> Sent: Tuesday, November 23, 2010 9:23 AM
>> To: Kennedy Aaron (Nokia-MS-Qt/Brisbane)
>> Cc: qt-qml@trolltech.com
>> Subject: Re: [Qt-qml] How QML file is parsed and linked and executed?
>> 
>> Hi,
>> 
>> ok, thanks :)
>> 
>> best regards,
>> Ivo
>> 
>> 
>> From: Kennedy Aaron (Nokia-MS-Qt/Brisbane)
>> Sent: Tuesday, November 23, 2010 3:03 AM
>> To: Iliev Ivailo (EXT-ProData/Berlin)
>> Cc:
>> Subject: Re: [Qt-qml] How QML file is parsed and linked and executed?
>> 
>> Hi,
>> 
>> As it says in the documentation, the order Component.onCompleted handlers 
>> are executed is not defined.
>> 
>> Roughly speaking (as there are exceptions), elements are instantiated from 
>> top to bottom, and the onCompleted signals are executed in reverse order of 
>> instantiation.  But don't rely on that behaviour.
>> 
>> Cheers,
>> 
>> Aaron
>> 
>> 
>> On 22/11/2010, at 6:49 PM, ext 
>> ext-ivailo.il...@nokia.com  wrote:
>> 
>> Hi,
>> 
>> as you all know HTML and JavaScript are executed / or evaluated / form the 
>> TOP to BOTTOM. So if you have a source of 100 lines it will start from line 
>> 1 and will finish with the last one. When you know this you can somehow 
>> figure our some tricks you want to make and know what to expect.
>> 
>> I have a QML file that I want to trace how it's reacting.
>> 
>> Rectangle {onCompleted: {console.col("m1")}}
>> Rectangle {onCompleted: {console.col("m2")}}
>> 
>> and in the console output I have m2, m1.
>> 
>> so does it mean that in QML we have stack popup priority of structure 
>> handling - you parse it from top to bottom and execute it form bottom to 
>> top? does it mean that my "later" element will always have 
>> Component.onCompleted "before"? Or this reverse order is just temporary or 
>> coincidence on my machine or we shall not  expect any order of loading - 
>> "everything will come when it comes"?
>> 
>> Bes

Re: [Qt-qml] How QML file is parsed and linked and executed?

2010-11-22 Thread aaron.kennedy
Hi,

As it says in the documentation, the order Component.onCompleted handlers are 
executed is not defined.

Roughly speaking (as there are exceptions), elements are instantiated from top 
to bottom, and the onCompleted signals are executed in reverse order of 
instantiation.  But don't rely on that behaviour.

Cheers,

Aaron


On 22/11/2010, at 6:49 PM, ext 
ext-ivailo.il...@nokia.com wrote:

Hi,

as you all know HTML and JavaScript are executed / or evaluated / form the TOP 
to BOTTOM. So if you have a source of 100 lines it will start from line 1 and 
will finish with the last one. When you know this you can somehow figure our 
some tricks you want to make and know what to expect.

I have a QML file that I want to trace how it's reacting.

Rectangle {onCompleted: {console.col("m1")}}
Rectangle {onCompleted: {console.col("m2")}}

and in the console output I have m2, m1.

so does it mean that in QML we have stack popup priority of structure handling 
- you parse it from top to bottom and execute it form bottom to top? does it 
mean that my "later" element will always have Component.onCompleted "before"? 
Or this reverse order is just temporary or coincidence on my machine or we 
shall not  expect any order of loading - "everything will come when it comes"?

Best Regards,
Ivo
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] FolderListModel

2010-11-22 Thread aaron.kennedy
Hi,

On 23/11/2010, at 9:31 AM, "Jones Martin (Nokia-MS-Qt/Brisbane)" 
mailto:martin.jo...@nokia.com>> wrote:
The ListView has no height so only one delegate is created.
Algorithmically I understand why this happens, but it does cause a lot of 
confusion.  What is the downside to having a 0 height (or width in the 
horizontal case) list create *no* elements?

Cheers,

Aaron

BR,
Martin.

From: qt-qml-boun...@trolltech.com 
[mailto:qt-qml-boun...@trolltech.com] On Behalf Of ext Thomas PABST
Sent: Tuesday, 23 November 2010 1:19 AM
To:  
qt-qml@trolltech.com
Subject: [Qt-qml] FolderListModel

Hi,

I'm currently developing a file manager with the new FolderListModel appeared 
on Qt 4.7.1.
import QtQuick 1.0
import Qt.labs.folderlistmodel 1.0

Rectangle {
width: 300;
height: 400;
 ListView {
 FolderListModel {
 id: foldermodel
 nameFilters: ["*"]
 }
 Component {
 id: filedelegate
 Text { text: fileName }
 }
 model: foldermodel
 delegate: filedelegate
 }
However, this example show us only one file. I'm looking for the better way to 
show all files.
How can we define the number of the file automatically. Can we do that only 
with Qml or we should use both qml/c++ ?
I'm thinking about the Repeater element, ListView element or grid element, but 
we must define the number of case each time !



-
Thomas PABST
thomas.pa...@gmail.com
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] JavaScript QML object properties

2010-11-22 Thread aaron.kennedy
Hi,

This is not expected behavior.  Please create a bug report (with an example).

Cheers,

Aaron

On 22/11/2010, at 7:09 PM, "Iliev Ivailo (EXT-ProData/Berlin)" 
mailto:ext-ivailo.il...@nokia.com>> wrote:

 Hi,

I want to play with QML object from within JavaScript. Everything is ok until 
you try to change property of QML object that is not explicitly set in the QML 
file. Then you have error:

example

Rectangle {
id: test

}

and then in the JS file you have test.visibile = false

So you have error that visible is not accessible.

BUT if you put:

Rectangle {
id:test
visible:true
}

then you can change visible to false from the JS

So my question is: is it required to set all properties once with QML so you 
can modify them later with JS or it's a problem temporary and will change. Or 
maybe there is something wrong in my environment - maybe I'm using old version 
or something else in the QML file causes this problem?

Best Regards,
Ivo
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] JavaScript with .pragma library cannot see Component object

2010-11-21 Thread aaron.kennedy
Hi,

On 20/11/2010, at 2:41 AM, ext ext-ivailo.il...@nokia.com wrote:

> Yes I've read that, but the strange thing is that Component is just global 
> object for the JS - just like Qt. Why I can access Qt and cannot Components?

The name "Component" is bound by the presence of an import statement, whereas 
the "Qt" global object is always available.  Currently ".pragma library" JS 
files don't have access to any import statements (and consequently the name 
bindings that go along with them).  We'll fix this in the future.

For now you'll have to use hardcoded integers :(

Cheers,

Aaron


> In general the concept is great - I just would like to know what I can and 
> what I cannot do and access from within it. I think that sharing a static 
> constant inside a library will not break the library concept, right? - this 
> is just integer 1
> 
> Best Regards,
> Ivo
> 
> From: Hansen Rene.1 (EXT-ProDataConsult/Berlin)
> Sent: Friday, November 19, 2010 5:40 PM
> To: Iliev Ivailo (EXT-ProData/Berlin)
> Cc: qt-qml@trolltech.com
> Subject: Re: [Qt-qml] JavaScript with .pragma library cannot see Component 
> object
> 
> This is because when you include .pragma, you are really indicating that
> you want to create a stateless library. Here's an excerpt from the Docs
> about integrating Javascript:
> 
 
> Stateless JavaScript libraries
> Some JavaScript files act more like libraries - they provide a set of
> stateless helper functions that take input and compute output, but never
> manipulate QML component instances directly.
> 
> As it would be wasteful for each QML component instance to have a unique
> copy of these libraries, the JavaScript programmer can indicate a
> particular file is a stateless library through the use of a pragma, as
> shown in the following example.
> 
> // factorial.js
> .pragma library
> 
> function factorial(a) {
> a = parseInt(a);
> if (a <= 0)
> return 1;
> else
> return a * factorial(a - 1);
> }
> 
> The pragma declaration must appear before any JavaScript code excluding
> comments.
> 
> As they are shared, stateless library files cannot access QML component
> instance objects or properties directly, although QML values can be
> passed as function parameters.
> <<<
> 
> Hope this helps.
> 
> /René
> 
> On Fri, 2010-11-19 at 16:17 +, ext ext-ivailo.il...@nokia.com wrote:
>> Hi,
>> 
>> I'm trying to create JS library with QML. As written in the documentation I 
>> write in the beginning of the JS file .pragra library
>> everything is ok - now my library is not stuck to one QML file and I can 
>> everything is ok
>> 
>> the problem is that I cannot see Component.Ready and Component - it's not 
>> null, but I have error directly when I want to access it :
>> ReferenceError: Can't find variable: Component.
>> 
>> if I remove the .pragma library then everything is ok - I can see Component 
>> and Comonent.Ready
>> 
>> My question is:
>> 
>> Is it done on purpose? Is there any reason why I cannot use / and see / 
>> those objects in the library is "object". Just a quick tip - Qt object is 
>> there - I can see it with or without marking my JS as library.
>> 
>> For now I can just "wrap" the error - as Component.Ready is 1 - I will just 
>> replace it with 1, but it will be nice if I know what else I can and cannot 
>> do with libraries and not.
>> 
>> Best Regards,
>> Ivo
>> ___
>> Qt-qml mailing list
>> Qt-qml@trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-qml
> 
> 
> 
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Aliasing handler properties

2010-11-21 Thread aaron.kennedy
Hi,

On 19/11/2010, at 10:42 PM, ext 
simon.tur...@nokia.com wrote:

Why does this not work?

property alias onClicked: myEmbeddedMouseArea.onClicked

It’s just a property after all. Just one that’s just a function assigned to it.

When written like that it sounds trivial :)  In reality they're not "just" 
properties and they're not "just" assigned a function.  Of course, it is not an 
unreasonable thing to want to do, so if you create a bug we can look into it 
for a future release.

Cheers,

Aaron
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Recommended way to parametrize QML items?

2010-11-17 Thread aaron.kennedy
Hi,

Another alternative is to use property aliasing:

import QtQuick 1.0

Rectangle {
property alias bar: content.children
Row {
id: content
anchors.fill: parent
}
}

Any item assigned to "bar" will be added as a child of (and thus positioned by) 
the Row.

Cheers,

Aaron

On 18/11/2010, at 2:05 AM, ext Tomas Junnonen wrote:

> On 11/17/2010 04:40 PM, Kellomaki Pertti (Nokia-MS/Tampere) wrote:
>> On 11/17/2010 03:59 PM, Junnonen Tomas (Nokia-MS/Helsinki) wrote:
>>> The parametrized bar item doesn't have to be a direct child of Foo
>>> either. Another way is to use the onBarChanged signal to Do What You
>>> Want(tm), for example if you need to anchor the item.
>>> 
>> Thanks, that clarified things. How do I access bar's anchors within the
>> signal handler though? I tried various permutations but did not quite
>> figure it out yet.
> 
> "bar.anchors.top = top" for instance should just work.
> 
>> Could you modify the example so that Foo has a single Text element
>> saying "This is bar", positioned just below whatever bar happens to be?
> 
> Simple but naive way:
> 
> Foo.qml:
> import QtQuick 1.0
> 
> Rectangle {
> property Item bar
> 
> Text {
> id: label
> text: "This is bar"
> }
> 
> onBarChanged: {
> children = [bar, label]
> label.anchors.top = bar.bottom
> }
> }
> 
> Because QML doesn't support in-place list manipulations, this isn't a 
> very good solution as it restricts you from directly adding items to Foo 
> by essentially hardcoding Foo's children.
> 
> A better way might be to use a placeholder item, a bit like in the 
> original SpinBox implementation you mentioned:
> 
> Foo.qml:
> import QtQuick 1.0
> 
> Rectangle {
> property Item bar
> 
> Item {
> id: barPlaceHolder
> height: children[0] ? children[0].height : 0
> width: children[0] ? children[0].width : 0
> }
> 
> Text {
> id: label
> text: "This is bar"
> anchors.top: barPlaceHolder.bottom
> }
> 
> onBarChanged: {
> bar.parent = barPlaceHolder
> }
> }
> 
> Regards,
> Tomas
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] How to add/remove/count items in a list property from within javascript?

2010-10-26 Thread aaron.kennedy
Hi,

By default, yes.  If you want the js file to be shared, include the line 
".pragma library" at the top.

Cheers,

Aaron

On 27/10/2010, at 12:05 AM, "ext Bart Kelsey" 
mailto:elba...@gmail.com>> wrote:

Thanks for the reply!

Another question, then: If I have several instances of the same component, do 
they each have their own copy of the global variables declared in the external 
javascript file?

Bart


On Mon, Oct 25, 2010 at 9:05 PM, 
<michael.bras...@nokia.com>
 wrote:
On 26/10/2010, at 6:04 AM, ext Bart Kelsey wrote:

> Greets!
>
> I'm trying to create a list of Items, and it's not clear to me, from within 
> JavaScript, how to add, remove, and count those items.  The function below 
> doesn't seem to work (textArray is declared as "property list 
> textArray").  Note that my startUp function is being correctly called, and I 
> can verify that the TalkBoxTextComponent.createObject method is working.  
> I've tried using .push(), .append(), length, etc, and I'm having no luck so 
> far.
>
> **
>
> var TalkBoxTextComponent;
>
> function startUp() {
>   TalkBoxTextComponent = Qt.createComponent("TalkBoxText.qml");
> }
>
> function appendText(string) {
>   var object = TalkBoxTextComponent.createObject(talkbox);
>   object.text = string;
>   talkbox.textArray[0] = object;
>   talkbox.textArray[1] = object;
> }

Manipulating QML list properties from javascript is not well documented at the 
moment 
(http://bugreports.qt.nokia.com/browse/QTBUG-14645),
 and as they behave differently from javascript Arrays, it can sometimes get a 
bit confusing.

The best way I know how to explain the current list property support is to say 
that writing to a list _property_ is supported, but writing to the list itself 
is not. To give examples:

(1) textArray = [object, object]//supported, writes a new array of two 
items to the property textArray
(2) textArray = []//supported, writes an empty array to the property 
textArray (i.e. clears the textArray property)

(3) textArray[1] = object//not supported, tries to modify the list itself
(4) textArray.push(object)//not supported, tries to modify the list itself

There are challenges with supporting (3) and (4) and having bindings involving 
textArray update correctly, which is why they are not yet supported. It's a 
limitation we don't like, and want to fix in a future release (probably by 
having lists support some form change notifications, much like list models do). 
The workaround for now, if you need a writable list, is to use a javascript 
Array (the samegame demo shows an example of this).

Regards,
Michael



--
--

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Set custom property in onChildrenChanged?

2010-10-26 Thread aaron.kennedy
Hi,

Shouldn't the access line read

myParent.children[i].myDouble = 1.0

?

Cheers,

Aaron

From: qt-qml-boun...@trolltech.com [qt-qml-boun...@trolltech.com] on behalf of 
ext Charley Bay [charleyb...@gmail.com]
Sent: Tuesday, October 26, 2010 10:49 PM
To: qt-qml@trolltech.com
Subject: [Qt-qml] Set custom property in onChildrenChanged?

Curious problem, this should work, right?

//FILE: MyRect.qml
Rectangle {
  property double myDouble: 0
}

//FILE: MyParent.qml
Item {
  id: myParent
  onChildrenChanged: {
for(var i = 0; i < myParent.children.length; ++i) {
  // Error:  Cannot assign to non-existent property "myDouble"
  myParent.children.[i].myDouble = 1.0
}
  }
}

MyRect {
  parent: myParent
}

Everything instantiates properly, and "MyRect" is properly
being parented under "MyParent", with "onChildrenChanged"
being called.

Can I not access the custom property?  Do I need to cast
to a "MyRect" inside "onChildrenChanged"?

In this case, I *always* know it is a "MyRect", but I thought
the dynamic typing would have found the "myDouble"
property.

Should this code work?  (Or what should I do instead?)

Thanks!

--charley
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] [Qt-interest] Data type that is serializable _and_ QML friendly?

2010-10-22 Thread aaron.kennedy
Hi,

Can you define exactly what you mean by "QML friendly"?  That is, what features 
of the QML language do you want to work on your type?

Cheers,

Aaron

On 21/10/2010, at 7:59 AM, "ext Akos Polster"  wrote:

> (Re-posting from Qt-Interest)
> 
> Hi,
> 
> we have an API that delivers data to clients using signals. The signal 
> payload is a custom type declared with Q_DECLARE_METATYPE. It does not 
> inherit from QObject - but then how to make this data QML friendly.
> 
> Should we re-wrap, or change our design, or...?
> 
> ~ Akos.
> 
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] FontLoader memory consumption

2010-10-22 Thread aaron.kennedy
Hi,

It is possible that this is happening.  Can you please file a bug?

In the mean time, it is possible to work around this just by putting your 
FontLoader in the root of your qml project instead of one in each PrimaryText 
element.

Cheers,

Aaron

On 22/10/2010, at 7:44 PM, ext Cornelius Hald wrote:

> Hi,
> 
> I want to include custom fonts within my QML application. Currently I'm
> doing it like this:
> 
> # PrimaryText.qml
> Text {
>FontLoader { id: myfont; source: "../fonts/myfont.ttf"}
>font.family: myfont.name
>font.pixelSize: 26
> }
> 
> Everywhere I need this font, I'm using 'PrimaryText' instead of 'Text'.
> 
> The problem with this approach seems to be that the font is loaded into
> memory for each use of the 'PrimaryText' component.
> 
> Is this my design? Is there a better way to solve this use-case?
> 
> Thanks!
> Conny
> 
> 
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] prepend import paths in qmlviewer

2010-10-12 Thread aaron.kennedy
Hi,

On 11/10/2010, at 6:42 PM, ext denis.dzyube...@nokia.com wrote:

> Hi
> 
> Who would be the right person to review the following patch to qmlviewer?
> 
> I would like to change the behavior of the -I option to _prepend_ instead of 
> appending a directory to the imports directory search list.

Are you sure this patch is even doing what you want it to?  All this patch does 
in change the precedence different "-I" command line options to the viewer are 
given - it doesn't affect the order of the internal search paths in QML.

Even if this *is* what you want, I don't think we should do it as it is 
different from the way compilers normally interpret "-I" which is "highest 
priority first".

Cheers,

Aaron
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] interfaces for QML Python Bindings

2010-09-30 Thread aaron.kennedy
Hi,

On 24/09/2010, at 3:19 AM, ext Kristian Mueller wrote:

> Hi QML Developers,
> 
> we've been developing a Python <-> QML interface. It's already working
> fine for us and we plan to release it soon.
> 
> Unfortunately we need two hooks in the Declarative source code. First we
> need access to the QDeclarativeEngines QScriptEngine. This access is
> necessary to create QScriptValues via QScripEngine::newFunction. We use
> this to make it possible to call Python methods and functions from QML /
> ECMA-Script (via a C++-wrapper function). 
> Second, we need access to the QDeclarativeOpenMetaObject to build a
> dynamic ProxyObject, which represents Python objects in QML.  
> 
> Our current solution is to add a proxy-object implementation and a
> header-file (files are attached) to the declarative source and build our
> "own" version off Qt-Declarative. Of course, we would be very happy if
> we could skip this workaround. Is there any chance that:
> 1. QDeclarativeEngine allows access to its QScriptEngine
> 2. QDeclarativeOpenMetaObject will become part of the Public API
> in the near future? 

Both of these APIs are internal because there are still some outstanding issues 
we have to resolve.  If we just exposed the QScriptEngine directly it is 
currently way too easy for people to shoot themselves in the foot.  We hope to 
resolve these problems and expose the QScriptEngine in the future - in my 
estimation we'll do this by 4.8 at the latest.

QDeclarativeOpenMetaObject has a horrible API.  We would like to clean it up 
and expose that functionality, too.  I'm not sure of your exact requirements, 
but could QDeclarativePropertyMap be used to accomplish what you want?

Cheers,

Aaron


> It's unfortunate that we've missed the 4.7 release with that, but it
> would be nice if we could integrate those hooks.
> 
> What do you think? 
> 
> 
> Greetings from Berlin
> Georg & Kristian
> -- 
> mixd.tv - mix your own tv
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] QMLviewer silently fails to import plugin when shared library not found

2010-09-30 Thread aaron.kennedy
Hi,

On 01/10/2010, at 5:13 AM, ext Tico Ballagas wrote:

> I was having issues debugging an import problem for a custom 
> QDeclarativeExtensionPlugin.
> 
> The ultimate problem was that I forgot to install a required shared library 
> used by my plugin.  However, qmlviewer reported the problem as follows:
> 
> # QML_IMPORT_TRACE=1 qmlviewer gesture.qml 
> QDeclarativeImportDatabase::addImportPath "/usr/lib/qt4/imports" 
> QDeclarativeImportDatabase::addImportPath "/usr/bin" 
> QDeclarativeImportDatabase::addToImport 0x24d37c "." -1.-1 File as ""
> QDeclarativeImportDatabase::add: loaded "/home/user/gestureEngineTest/qmldir" 
> QDeclarativeImportDatabase::importPlugin ".home.user.gestureEngineTest" from 
> "/home/user/gestureEngineTest/lib/libgestureengine.so" 
> QDeclarativeImportDatabase::addToImport 0x24d37c "Qt" 4.7 Library as ""
> file:///home/user/gestureEngineTest/gesture.qml:3:1: GestureEngine is not a 
> type 
> GestureEngine { 
> 
> where GestureEngine is defined in libgestureengine.so, but it doesn't convey 
> that the plugin import failed.  In fact, the trace leads you believe the 
> plugin was successfully loaded.
> 
> It would be nice if qmlviewer displayed an error like the following:
> error while loading shared libraries: libqt_gesture_lib.so.1: cannot open 
> shared object file: No such file or directory

A brief test on my build indicates that if the plugin fails to load, you do get 
a descriptive error message:

file:///Users/aakenned/Qt/qt-qml/test.qml:2:1: module "Qt.labs.gestures" 
plugin "qmlgesturesplugin" not found 
 import Qt.labs.gestures 1.0 

What I suspect is happening to you is that the plugin is loading successfully, 
but it doesn't contain a GestureEngine element.  Can you provide more details?

Cheers,

Aaron


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Getting a list of strings from plugin

2010-09-30 Thread aaron.kennedy
Hi,

Does QStringList work?

Cheers,

Aaron

On 30/09/2010, at 8:04 PM, "ext Toni Leppänen"  wrote:

> I'm trying to return a list of strings from a plugin. I'm getting an
> error when trying to access the list:
> foo.qml:13: TypeError: Result of expression 'list' [undefined] is not an 
> object.
> 
> Can someone help me how to do this? Here's a simplified example what I've 
> tried:
> 
> foo.h
> -
> #include 
> #include 
> #include 
> 
> class Foo : public QObject
> {
>  Q_OBJECT
> 
>  public:
>Foo(QObject * parent = 0);
>~Foo();
> 
>Q_INVOKABLE QList getList();
> };
> 
> 
> foo.cpp
> ---
> #include "foo.h"
> 
> Foo::Foo(QObject * parent) : QObject(parent) {}
> 
> Foo::~Foo() {}
> 
> QList Foo::getList()
> {
>QList list;
>list << "aa" << "bb";
> 
>return list;
> }
> 
> 
> foo.qml
> ---
> import Foo 1.0
> import Qt 4.7
> 
> Item {
>property variant list: []
> 
>Foo {
>id: plugin
>}
> 
>Component.onCompleted: {
>list = plugin.getList();
>console.debug(list[0]);
>console.debug(list[1]);
>}
> }
> 
> Cheers,
> Toni
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


[Qt-qml] import QtQuick 1.0

2010-09-28 Thread aaron.kennedy
Hi,

As discussed previously, Qt 4.7.1 now supports "import QtQuick 1.0".  Importing 
QtQuick 1.0 is equivalent to importing Qt 4.7.

All instances of "import Qt 4.7" in your QML code should be replaced by "import 
QtQuick 1.0".  For compatibility reasons "import Qt 4.7" continues to work 
exactly as it always has, but we would still prefer that you modify your app 
and pretend that it never existed.

All of the code in the Qt repository has been updated appropriately, and there 
is also an autotest to prevent you from accidentally adding new instances of 
"import Qt 4.7" to Qt.

Cheers,

Aaron
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] property initialization defect

2010-09-17 Thread aaron.kennedy
Hi,

Thats a bug - please file a bug report.

Cheers,

Aaron

On 17/09/2010, at 8:45 PM, "Jokela Pekka.E (Nokia-MS/Tampere)" 
mailto:pekka.e.jok...@nokia.com>> wrote:


Hi,
I have a problem of overriding the initial value of a property. Let’s assume we 
want to use the Button component in an application as:

Button.qml:
Item {
property string text: “A”

Component.onCompleted: {
console.log( "Button::onCompleted " + text )
}
}

MyApp.qml:
Window {
Button {
text: “B”
}
}

This prints out “B” as expected. But when I change the property initialization 
in button.qml to
property string text: {“A”} // or
property string text: getInitialValue() // which returns “A”

The output is “A”. Is a defect or a “feature”?

Thanks,
-Pekka


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Accessing dynamic properties

2010-09-16 Thread aaron.kennedy
Hi,

On 16/09/2010, at 7:59 PM, "Dzyubenko Denis (Nokia-MS-Qt/Oslo)" 
 wrote:

> Hi,
> 
>> No it doesn't work, and no its not supposed to work.  Qt's dynamic
>> properties do not fit the QML model very well which relies on knowing the
>> complete static type of an object prior to instantiation, and we'd prefer
>> not to support them.
> 
> it sounds a bit strange to me, but if it is a conscious decision they I can 
> live with that.
> 
> Though it would be convenient to get access to dynamic properties if the user 
> explicitly asks for them in QML - for example it would be convenient to have 
> something like that in QML;
> 
> MyQMLItem {
>  Item {
>width: parent.dynamicProperty("my_dynamic_property") // mark explicitly 
> that we want a dynamic property
>  } 
> }

We could add that, but it seems a little clunky.  

>> Perhaps if you give more details about the actual problem you are trying to
>> solve we can think of an alternative way.
> 
> It is mostly for prototyping in the QML Gestures project - we would want to 
> expose new properties for QML on objects inside QtGui but we are not sure if 
> we want to have them in the final version. Of course we could use 
> Q_PRIVATE_PROPERTY, but for that we need to modify Qt gui itself. Right now 
> our research code is in the qml import module - so it would be much more 
> convenient if we could set some properties on objects in Qt from inside the 
> qml plugin, and them access them from the qml document without creating 
> wrappers in the qml module.

An extension object could be used for exactly this purpose.  
http://doc.trolltech.org/4.7-snapshot/qml-extending.html#extension-objects

Cheers,

Aaron

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Semantics of 'return' in a JavaScript block in QML

2010-09-15 Thread aaron.kennedy
Hi,

On 16/09/10 10:46 AM, "ext Gregory Schlomoff" 
wrote:

> Besides, IIRC, qml has a non-standard syntax for switch blocks, requiring each
> case to be enclosed within curly braces for the break statement to work. Why
> this happens (if it still happens - haven't tested now) would be interesting
> to know.

I would also be interested in knowing :)  Has this been discussed before,
and is there a bug for it?

Cheers,

Aaron


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Semantics of 'return' in a JavaScript block in QML

2010-09-15 Thread aaron.kennedy
Hi,

On 15/09/10 10:15 PM, "Kellomaki Pertti (Nokia-MS/Tampere)"
 wrote:

> This caught my eye when looking at examples in the qt-components project
> [1]. It looks like 'return' can be used to return a value from a script
> block:
> 
> Text {
> text: { if (condition) {
>   return "A";
>}
>return "B";
>  }
> }
> 
> My JavaScript knowledge is pretty much nonexistent, but cursory googling
> would suggest that in JavaScript, a return statement can only be used
> inside functions. Is the above syntax an extension of JavaScript, and if
> so, is it documented somewhere?

All of QML is an extension to JavaScript :)  As another replier identified,
bindings in QML can be though of as a convenient function call.  Internally
the above is actually evaluated like this:

Text {
text: (function() { if (condition) { return "A"; } return "B"; })()
}

We do this to allow you to write complex bindings without actually having to
go to the trouble of splitting it out into a single-use function call.

We should definitely document these things better.  There is a balancing act
between filling the documentation with descriptions of technical edge cases
that will confuse most people, but are helpful for some that want to
understand things from "the ground up".

Cheers,

Aaron


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Fwd: QtMobility declarative examples

2010-09-15 Thread aaron.kennedy
Hi,

What does “installed qtmobility in /opt/qt4-maemo5” equate to in real terms?  
Is there an /opt/qt4-maemo5/imports/QtMobility/location directory that contains 
a shared library?  If not, please attach a directory tree listing of the 
/opt/qt4-maemo5 directory.

Cheers,

Aaron


On 16/09/10 4:24 AM, "ext Tico Ballagas"  wrote:

I didn't get any bites on the mobility list, can anyone here help me with 
importing QtMobility 1.1?  How do I get qmlviewer to find the installed 
libraries?

Best
-Tico

Begin forwarded message:

From: Tico Ballagas 
Date: September 14, 2010 12:33:34 AM PDT
To: qt-mobility-feedb...@trolltech.com
Subject: QtMobility declarative examples

Hi-

I finally got QtMobility 1.1 to build for my N900.  However, now I'm having 
problems running the declarative examples.

I get the following running QML_IMPORT_TRACE=1 /opt/qt4-maemo5/bin/qmlviewer:
QDeclarativeImportDatabase::addImportPath "/opt/qt4-maemo5/imports"
QDeclarativeImportDatabase::addImportPath "/opt/qt4-maemo5/bin"
QDeclarativeImportDatabase::addToImport 0x2d83c4 "." -1.-1 File as ""
QDeclarativeImportDatabase::addToImport 0x2d83c4 "Qt" 4.7 Library as ""
QDeclarativeImportDatabase::addToImport 0x2d83c4 "QtMobility.location" 1.1 
Library as ""
file:///home/user/test.qml:2:1: module "QtMobility.location" is not installed
 import QtMobility.location 1.1

I've installed qtmobility in /opt/qt4-maemo5/

How do I set my environment appropriately for qmlviewer to see the qtmobility 
libraries?  Do I need to create a qmldir file for this that explicitly lists 
all of the library files?

Best
-Tico


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Accessing dynamic properties

2010-09-14 Thread aaron.kennedy
Hi,

No it doesn't work, and no its not supposed to work.  Qt's dynamic
properties do not fit the QML model very well which relies on knowing the
complete static type of an object prior to instantiation, and we'd prefer
not to support them.

Perhaps if you give more details about the actual problem you are trying to
solve we can think of an alternative way.

Cheers,

Aaron


On 15/09/10 2:58 AM, "Dzyubenko Denis (Nokia-MS-Qt/Oslo)"
 wrote:

> 
> On 14. sep. 2010, at 18.20, Hicks Jamey (Nokia-NRC/Cambridge) wrote:
> 
>> How did you pass in the object? If you pass it as a QVariant you need to cast
>> it to QObject * first to make its slots and properties available.
> 
> I've created a test app that shows the problem. Maybe someone can tell me if
> this is supposed to work at all:
> 
> #include 
> #include 
> 
> class MyItem: public QDeclarativeItem
> {
> Q_OBJECT
> Q_PROPERTY(int bar READ bar WRITE setBar)
> 
> public:
> MyItem()
> : m_bar(69)
> {
> setProperty("foo", QVariant::fromValue(42));
> setProperty("bar", QVariant::fromValue(43));
> }
> 
> int m_bar;
> int bar() const  { return m_bar; }
> void setBar(int value) { m_bar = value; }
> };
> QML_DECLARE_TYPE(MyItem);
> 
> int main(int argc, char **argv)
> {
> QApplication app(argc, argv);
> qmlRegisterType("org.foobar.foo", 1, 0, "MyItem");
> QDeclarativeView view;
> 
> view.setSource(QUrl::fromLocalFile("foo.qml"));
> 
> view.show();
> return app.exec();
> }
> 
> #include "main.moc"
> 
> 
> 
> and the foo.qml:
> 
> import Qt 4.7
> import org.foobar.foo 1.0
> 
> MyItem {
> width: 100
> height: 100
> 
> MouseArea {
> anchors.fill: parent
> onClicked: { console.log("foo =", parent.foo, "; bar =", parent.bar);
> }
> }
> }
> 
> 
> I get the following output:
> 
> foo = undefined ; bar = 43
> 
> Denis.
> 
> 
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] repeat: true syntax error rc1 SDK

2010-09-09 Thread aaron.kennedy
Hi,

Where in the docs does it say "repeat"?  The docs I have say "loops:
Animation.Infinite".

Cheers,

Aaron


On 10/09/10 3:10 PM, "ext Jason H"  wrote:

> I get an error on the repeat:true line. Why? Docs say 'repeat' belongs to
> Animation.
> Thanks!
> 
> importQt4.7 
> Rectangle {
> width: 860
> height: 540
> gradient: Gradient {
> GradientStop { position: 1; color:"blue"}
> GradientStop { position: 0; color: "midnightblue"}
> }
> Image {
> anchors.centerIn: parent
> source: "23.jpg";
> opacity: 0.75
> smooth: true
> SequentialAnimation on scale {
> repeat: true
> PropertyAnimation {
> from: 2
> to: 2.5
> duration: 3000
> }
> PropertyAnimation{
> from: 2.5
> to: 2
> duration: 3000
> }
> }
> }
> }
> 
> 
>   
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


[Qt-qml] import QtQuick 1.0

2010-09-09 Thread aaron.kennedy
Hi,

Currently all the core QML elements are in the “Qt” namespace, and the 
namespace’s version is coupled to the Qt version (eg. 4.7).  In retrospect we 
think this was a mistake.  And by “retrospect”, I mean “we always knew this was 
a mistake but we never got around to fixing it”.

For Qt 4.7.1, we are considering introducing a new namespace - “QtQuick 1.0”.  
Although this breaks with Qt’s traditional definition of patch releases, it has 
the benefit of essentially decoupling the QML and Qt release cycles, which is 
especially important when you consider Qt’s recent glacial release pace.  Doing 
this means that we have the option of introducing new QML elements or 
properties in patch releases of Qt, rather than being forced to wait until a 
minor release to fix omissions or errors.  For example, Qt 4.7.2 might include 
“QtQuick 1.1” that could contain GestureArea.  If we think the Qt 4.7 series is 
going to be around for a long time, I think that the ability to do this is 
essential.  QML is quite tightly dependent on the rest of Qt, so an alternative 
strategy like we are using for webkit (ie. literally decoupling the releases) 
wouldn’t work.

It is important to highlight that this wouldn’t break any existing QML 
applications that were written against Qt 4.7.0.  “import Qt 4.7” would 
continue to work exactly as it always has.  Of course, a QML application 
written against Qt 4.7.1 might not work against Qt 4.7.0.  I think this is a 
“sacrifice” worth making.

If we made this change, we would obvious add an explanatory note to our 
documentation for those who have started with Qt 4.7.0, but we would remove all 
other mentions to the fact that “import Qt 4.7” ever worked – all the 
documentation, examples and demos would be updated to use “import QtQuick 1.0”.

Does anyone feel strongly about this issue?

Cheers,

Aaron
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] ListModel and WorkerScript limitations

2010-09-07 Thread aaron.kennedy
Hi,

On 7/09/10 10:20 PM, "Koivisto Ari (Nokia-MS/Helsinki)"
 wrote:
> I¹ve been using QML for a small personal utility program which uses a service
> that replies in XML. Parsing the XML via XmlListModel didn¹t work due to its
> limitations ­ mainly due to nested data and that I need the strict ordering of
> child nodes, hopefully some help will come via:
> http://bugreports.qt.nokia.com/browse/QTBUG-12953 .
>  
> As a workaround I wrote a separate XML parser using XMLHttpRequest and
> traversed the response XML document via the means available through the
> reduced DOM API. This populates a ListModel that can be shown to the end user
> via ListView. This is working fine, but I¹m facing additional hurdles:
>  
> (0.   The DOM API could be more complete, now the JS I wrote is not exactly
> pretty)

Yes, the DOM API is quite a minimal subset of the full W3C spec.  Your best
bet is to file bugs against the parts that you want, or, better yet, submit
some patches!  We'd love to see contributions in this area.

In the future we are looking at sharing the webkit implementations of these
constructs, which obviously support the entire spec, but that is not
scheduled for any particular release.

> 1.  In my case the server response document can take a while to process ­
> few seconds on embedded devices -> I¹d like to use WorkerScript to prevent the
> UI getting stuck, but I can¹t: ³If a list model is to be accessed from a
> WorkerScript, it cannot contain list data.² Well, that is exactly the case I
> have and I can¹t modify the ListModel to work without list data

That is a limitation of the current implementation that is non-trivial to
fix.  Future releases of QML will included better model data support that
will hopefully help with this problem.

> 2.  While looking at WorkerScript I noticed that I couldn¹t pass the
> responseXML to the WorkerScript via SendMessage. WorkerScript gets stuck when
> trying to access the object - e.g. ³response.childNodes.length². Moving the
> whole XMLHttpRequest to WorkerScript doesn¹t work either (³TypeError: Result
> of expression 'doc.responseXML' [null] is not an object.²)

I can't reproduce this.  The attached example uses XMLHttpRequest from a
worker script and it seems to be able to access responseXML without issue.
Can you provide more details about your problem - like the specific release
of Qt you are using and, ideally, a self contained example of the problem?

Cheers,

Aaron



workerscript_example.tar.gz
Description: workerscript_example.tar.gz
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Multiple qml files in one .cpp

2010-08-29 Thread aaron.kennedy
Hi,

We cannot reproduce this problem.  Please file a bug with the complete C++ and 
QML source you are using, the sha1 (or package name) of the Qt  you are using 
and the OS you are on.

Cheers,

Aaron


On 27/08/10 10:33 PM, "ext Sulamita Garcia"  wrote:



On Fri, Aug 27, 2010 at 12:39 PM, Kai Koehne  wrote:

Are you sure that you're running it really from within
'/home/sulamita/src/samegame' ?

I know, it's hard to believe, isn't?

[sulam...@atomina samegame]$ pwd
/home/sulamita/src/samegame
[sulam...@atomina samegame]$ ls *.qml
Block.qml  Button.qml  samegame.qml
[sulam...@atomina samegame]$ ./samegame
file:samegame.qml:29:3: Button is not a type
Button {
^

Maybe I should do a printscreen, everybody asks the the same question...

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] running script at item load

2010-08-12 Thread aaron.kennedy
Hi,

http://doc.trolltech.com/4.7-snapshot/qml-component.html#onCompleted-signal

Cheers,

Aaron

On 13/08/2010, at 11:02 AM, "ext Robison, Clayne B" 
 wrote:

> Hello,
> 
> I need to run a script when a QML Item loads and is done initializing. 
> Launching a script in the default state doesn't seem to work, and there 
> doesn't seem to be an "onLoad" event that gets fired by Items when they are 
> done initializing. How does one accomplish this?
> 
> Thanks.
>  
> Clayne Robison
> Application Engineer
> Intel Corporation
> Phoenix, AZ
> 480.552.5309
>  
> "Perhaps travel cannot prevent bigotry, but by demonstrating that all peoples 
> cry, laugh, eat, worry, and die, it can introduce the idea that if we try and 
> understand each other, we may even become friends."Maya Angelou
> 
> 
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Why FocusChange is never emitted?

2010-08-04 Thread aaron.kennedy
Hi,

Sounds broken - please file a bug.

Cheers,

Aaron

On 04/08/2010, at 9:52 PM, ext Gregory Schlomoff  
wrote:

> Hello everyone,
> 
> We are using the latest version of Qt 4.7 from the repository, and the
> focus works very well, in a very intuitive way, much better than with
> the old "wantsFocus".
> 
> Except for one thing: onFocusChanged never gets called.
> 
> Sure, we could use onActiveFocusChanged instead, and indeed, in most
> cases, that's what we need. But there are some edge cases when you
> actually want onFocusChanged.
> 
> Example: we have an app with a left panel and a right panel. Each
> panel is inside a FocusScope. We use focus to track wich item should
> be highlighted in the left panel.  To do that, we simply have a
> "highlighted" State on each item that is activated when they get the
> focus. It should work, but it doesn't, because focusChanged is not
> emitted, so the states don't get updated. If instead whe bind our
> State to activeFocus, it works, but the highlight will disappear as
> soon as an item from the right side gets active focus.
> 
> Example:
> 
> Rectangle {
> color: "grey"
> State {name: "highlighted; when: activeFocus  // works, but will lose
> the highlight
>   PropertyChange [...]
> }
> 
> Rectangle {
> color: "grey"
> State {name: "highlighted; when: focus  // is what we need, but
> doesn't gets notified of changes
>   PropertyChange [...]
> }
> 
> 
> What are your thoughts on this? Is there a reason
> for focusChanged not to be emitted?
> 
> Thanks!
> 
> Greg
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Key event capturing

2010-07-29 Thread aaron.kennedy
Hi,

On 29/07/10 6:44 AM, "ext Ben Marinic"  wrote:
> I'm having an issue with Key events.  The following works in my child
> QML file if I debug it directly:
> 
> Keys.onPressed: {
>  console.log(event.key)
> }
> But if the child QML file is loaded in by another QML file (using a
> Loader) then the Key event doesn't seem to be captured (nothing traces
> out).  I have tried various "focus: true/false" combinations in both
> the parent and the child QMLs.

The attached example demonstrates the use of focus inside a Loader.

> Also while trying to debug I attempted to set a break point.  Are
> break points possible in QML?  I can't set any in Qt Creator 2.1.0 and
> the docs don't mention them for QML:
> http://doc.trolltech.com/qtcreator-snapshot/creator-debugging-qml.html

Right now there is no support.  Future versions of Creator will include
better support for QML debugging.

Cheers,

Aaron



test.tar.gz
Description: test.tar.gz
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Dynamically created items and properties

2010-07-27 Thread aaron.kennedy
Hi,

On 27/07/10 7:19 PM, "ext Jan Ekholm"  wrote:

> On Tuesday 27 July 2010 01:42:36 Martin Jones wrote:
>> The above is not a binding.  It is an assignment.  Bindings are created
>> using the colon syntax.
> 
> Ah, great! I hoped there was something that I just didn't grok. I've never
> noticed the difference before.
>  
>> One solution is to provide the Unit to the QML item and let it setup the
>> bindings:
>> 
>> Unit.qml:
>> 
>> Image {
>> property variant unit
>> x: unit.x * 48 + ( unit.y % 2 ) * 24
>> y: unit.y*36
>> source: unit.icon
>> unit_id: unit.id
>> }
>> 
>> Then you just need to assign the unit to the QML item and it will take care
>> of its bindings.
> 
> Looks elegant and works perfectly! Thank you Martin!
> 
> However, I don't understand why this works at all without warnings or errors.
> Initially when the Image is created the "unit" is undefined and the initial
> property binding is using that undefined unit. Or is there some magic that
> checks for the undefinedness and avoids errors? And then when the property is
> actually set to a valid object all other "bound properties" are also set? In
> other cases when something has been undefined there has been lots of warnings
> about using [undefined] properties.

To avoid displaying errors for transient states, QML buffers errors until
all bindings have been evaluated and settled into a steady state.  If at
this point "unit" is still unset, it will print the error.

Cheers,

Aaron


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Dynamically created items and properties

2010-07-27 Thread aaron.kennedy



On 27/07/10 11:00 PM, "ext Jason H"  wrote:

> I was told time time ago that y: parent.height/3 would be cintonually
> evaluated. 
> At which point I realized I didn't know enough. I've searched the docs and I
> don't think anything has been added yet.

http://doc.trolltech.com/4.7-snapshot/propertybinding.html

Cheers,

Aaron


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Loading external QML files

2010-07-27 Thread aaron.kennedy
Hi,

QML does not currently expose any “event” like concept.  It might in the future.

For now, you can call methods in the parent QML file directly if you want, 
although that does restrict the contexts within which the sub-file can 
reasonably be used.

Cheers,

Aaron


On 28/07/10 2:13 AM, "ext Ben Marinic"  wrote:

Thank you Gregory.  My newbie questions continue.  Where in the docs should I 
look regarding custom events?  Can I add a listener to the loader instance 
which is listening for a custom event triggered by the child QML file?  In my 
example a mouse event from the child QML file needs to bubble up to the parent 
QML file which will handle the event.  In the event I would like to have a few 
custom properties.

Thanks
Ben


On 27 Jul 2010, at 11:59, Gregory Schlomoff wrote:

You're looking for the Loader element :)
Have a look at the doc:
http://doc.trolltech.com/main-snapshot/qdeclarativeelements.html


On Tue, Jul 27, 2010 at 5:53 PM, Ben Marinic  
wrote:
Hi

I'm new to QML - having used Flex for many years. Is there a way for a QML
file to load another QML file on demand? Something like the way an image can
be loaded - passing in the image location into the source property. I looked
at the File class but can't quite figure out how to implement it for my
situation. I have button and need to load a particular QML file.  I guess
this would be the equivalent of a Flash SWF loading another SWF (if you are
familiar with Flash).

Thanks for your help.
Ben
Ben Marinic
Combination Studios Ltd
e. b...@combinationstudios.com
t. +44 (0)20 7193 2000
m. +44 (0)7813 147 159





___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml




Ben Marinic
Combination Studios Ltd
e. b...@combinationstudios.com
t. +44 (0)20 7193 2000
m. +44 (0)7813 147 159







___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Image { pixmap } is gone :( Can't use QIcons anymore

2010-07-23 Thread aaron.kennedy
Hi,

On 23/07/10 9:28 PM, "ext Stephen Kelly"  wrote:

> Also, please send an email to this list about the coming of API
> removals or changes after some point in the release cycle (after the
> first beta, second beta - whatever). Having advanced notice of this
> stuff would make it far less surprising and annoying when I git pull
> and the app does not start anymore.

Your advice is sagely, which is why there was a mail sent by Bea about this
exactly two weeks ago on 9/7.  The change is also noted in the
src/declarative/QmlChanges.txt file.

Cheers,

Aaron



___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Activate state onload

2010-07-23 Thread aaron.kennedy
Hi,

Try adding

Component.onCompleted: rootItem.state = "enter"

Obviously replacing rootItem appropriately.

Cheers,

Aaron

On 23/07/2010, at 8:40 PM, "ext Gurmukh Panesar" 
mailto:gurmukh.pane...@teleca.com>> wrote:

Hi there

I have been using QML for the past few weeks and find it very useful!

Currently, I am trying to fix a certain problem I’m having but not getting 
anywhere. Hopefully somebody on this mailing list would be able to help?


The problem is getting a transition to execute in QML once the page has been 
loaded.

It’s very simple, just a bit of text that comes from the right and to the left 
when the app is launched.

I am able to do this by a mouseEvent trigger but not something like an 
"onload()".

Does anyone know of a way in which I can change the state of a component on 
load?

Code:
states : State {
name: "enter"
//when: mouse.pressed == true // Works fine
when: window.onload() // Doesn't seem to work
PropertyChanges { target: allText; x: 100 }
}

Thanks!




Gurmukh Panesar

Team Lead Espoo, Senior Mobile Web Developer



Teleca

Tekniikantie 12, 02150 Espoo, Finland

Phone: +358401819406, Fax: +358934872768

gurmukh.pane...@teleca.com

www.teleca.com



Follow what's going on at Teleca's blog on 
 
www.whatsyourideaoftomorrow.blogspot.com.



The information contained in this message is confidential and is intended for 
the addressee(s) only. If you have received this message in error please notify 
the sender immediately. The unauthorized use, disclosure, copying or alteration 
of this message is strictly prohibited.




___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] QML Slot

2010-07-16 Thread aaron.kennedy
Hi,

Perhaps there was a bug in earlier releases, but it seems to be working now 
(see attached example).

Cheers,

Aaron


On 16/07/10 9:58 PM, "ext Ivan De Marino"  wrote:

I do use that.
I'm talking about the scenario that Almo (was Almo?) described: u make ur 
object, u expose it as a property in the Context, try to connect to it's 
"onWhateverHappened" and you don't get the signal in QML.


On 16 July 2010 12:55,   wrote:
Hi,

You've never used onClicked?

All signals automatically become "on" where the first letter in 
the signal is uppercased.  Likewise, all property change notifiers 
automatically become "onChanged" where the first letter in the 
property is uppercased.  To avoid conflicts, properties and signals that start 
with an uppercase letter are ignored.

Anything else is a bug.

Cheers,

Aaron

On 16/07/2010, at 9:37 PM, "ext Ivan De Marino"  
wrote:

(trying to bring back the main topic of this thread)

I think you can't connect to signals like that if you DON'T use a Q_PROPERTY() 
macro.

At least in my experience, I never managed to connect to a signal into QML, if 
not the ones that are related to Q_PROPERTY-ies.

If anyone finds a solution to this, I'm interested as well.

On 14 July 2010 09:48, Almo  Nito <  almon...@gmx.de> 
wrote:
I tryed that with the following Result:

Cannot assign to non-existent property "onChangedDir"


signals: void ChangedDir();
The Object is Registered using ctxt->setContextProperty("CommObject",_COMM);

i can access  the functions from QML and access its properties but i can NOT 
connect to a signal

Any Ideas?



 Original-Nachricht 
> Datum: Wed, 14 Jul 2010 01:37:11 +0200
> Von:   michael.bras...@nokia.com
> An:   almon...@gmx.de
> CC:   qt-qml@trolltech.com
> Betreff: Re: [Qt-qml] QML Slot

> Hi Almo,
>
> On 14/07/2010, at 6:30 AM, ext Almo Nito wrote:
> I would like to know how i can connect to a Signal in QML if the object
> was not instanced from QML:
>
> Im having an Object _COMM;
>
> That was registered using:
> ctxt->setContextProperty("CommObject",_COMM);
>
> I can actually use CommObject.doMyInvolkeMethod() in QML
>
> But how do I connect to a signal that gets emmited that instace of _COMM
> in QML?
>
> You should be able to use the Connections element for this
> (  
> http://doc.qt.nokia.com/4.7-snapshot/qml-connections.html):
>
> Connections {
> target: CommObject
> onMySignal: console.log("here I am!")
> }
>
> Regards,
> Michael
>

--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter   
http://portal.gmx.net/de/go/maxdome01
___
Qt-qml mailing list
  Qt-qml@trolltech.com
  
http://lists.trolltech.com/mailman/listinfo/qt-qml




signal.tar.gz
Description: signal.tar.gz
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] QML Slot

2010-07-16 Thread aaron.kennedy
Hi,

You've never used onClicked?

All signals automatically become "on" where the first letter in 
the signal is uppercased.  Likewise, all property change notifiers 
automatically become "onChanged" where the first letter in the 
property is uppercased.  To avoid conflicts, properties and signals that start 
with an uppercase letter are ignored.

Anything else is a bug.

Cheers,

Aaron

On 16/07/2010, at 9:37 PM, "ext Ivan De Marino" 
mailto:ivan.de.mar...@gmail.com>> wrote:

(trying to bring back the main topic of this thread)

I think you can't connect to signals like that if you DON'T use a Q_PROPERTY() 
macro.

At least in my experience, I never managed to connect to a signal into QML, if 
not the ones that are related to Q_PROPERTY-ies.

If anyone finds a solution to this, I'm interested as well.

On 14 July 2010 09:48, Almo Nito 
<almon...@gmx.de> wrote:
I tryed that with the following Result:

Cannot assign to non-existent property "onChangedDir"


signals: void ChangedDir();
The Object is Registered using ctxt->setContextProperty("CommObject",_COMM);

i can access  the functions from QML and access its properties but i can NOT 
connect to a signal

Any Ideas?



 Original-Nachricht 
> Datum: Wed, 14 Jul 2010 01:37:11 +0200
> Von:  
> michael.bras...@nokia.com
> An:  almon...@gmx.de
> CC:  
> qt-qml@trolltech.com
> Betreff: Re: [Qt-qml] QML Slot

> Hi Almo,
>
> On 14/07/2010, at 6:30 AM, ext Almo Nito wrote:
> I would like to know how i can connect to a Signal in QML if the object
> was not instanced from QML:
>
> Im having an Object _COMM;
>
> That was registered using:
> ctxt->setContextProperty("CommObject",_COMM);
>
> I can actually use CommObject.doMyInvolkeMethod() in QML
>
> But how do I connect to a signal that gets emmited that instace of _COMM
> in QML?
>
> You should be able to use the Connections element for this
> (http://doc.qt.nokia.com/4.7-snapshot/qml-connections.html):
>
> Connections {
> target: CommObject
> onMySignal: console.log("here I am!")
> }
>
> Regards,
> Michael
>

--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter  
http://portal.gmx.net/de/go/maxdome01
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml



--
 Ivan De Marino | Software Engineer | France Telecom R&D UK - Orange Labs
 w. +44 20 8849 5806 | m. +44 7515 955 861 | m. +44 7974 156 216
 
ivan[dot]demarino[at]orange-ftgroup.com
 | ivan[dot]de[dot]marino[at]gmail[dot]com
  
www.detronizator.org | 
 
www.linkedin.com/in/ivandemarino

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Calling slots with binding

2010-06-30 Thread aaron.kennedy
Hi,

Bindings are intentionally unidirectional.  As a binding can be a complex 
expression there is no way for us to automatically reverse it.

In the specific case you describe you could us a property alias.  

Rectangle {
property alias title: myChild.title
Child {
id: myChild
}
}

Aliases are not bindings.  Instead reading and writing to the title property of 
the rectangle is internally translated into reading and writing the title 
property of the Child.

Cheers,

Aaron 

On 30/06/2010, at 11:01 PM, "ext Cristian Daniel Stamateanu" 
 wrote:

> Ok, here is what I found, it seems that using bindings in QML, values 
> are transfered to child components but when changed inside child the 
> value is not sent back to the parent:
> 
> //Parent.qml
> Rectangle{
>   property string title: "initial value"
>   id: root
> 
>   Child{
>   title: root.title
>   }
> }
> 
> //Child.qml
> Rectangle{
>   property string title
>   id:child
>   ...
>   //JS script
>   {
>   child.title = "Child modified value";
>   // I expected this to reflect back in parent or 
>   // whatever component was bound to it
>   }
>   ...
>   
> }
> 
> Is this normal? Is there a workaround
> 
> Regards,
> Cristi
> 
> Cristian Daniel Stamateanu wrote:
>> Thanks Kent, You were right on both counts. I don't need a QScriptValue 
>> and the value is not sent from qml for some reason. I will investigate 
>> further.
>> 
>> BR.
>> Cristian Stamateanu
>> 
>> On Tue, 29 Jun 2010 18:39:36 +0300, Kent Hansen  
>> wrote:
>> 
>>> Hi,
>>> 
>>> On 29. juni 2010 16:58, ext Cristian Daniel Stamateanu wrote:
 Hello,
 
 I have the following problem : I have a class declaring the following 
 slot:
 
 void RssFeedManager::addFeedEx(const QScriptValue&  name,const
 QScriptValue&  address )
 {
  bool nameIsString = name.isVariant();
  QString str = name.toString();
 ...
 }
 
 and I am calling this slot from QML
 
 This works ok:
 feedManager.addFeedEx( "whatever", addFeedView.address );
 
 while using a binding to a property declared in addFeedView like
 property string name;
 
 feedManager.addFeedEx( addFeedView.name, addFeedView.address );
 
 is not working.
 In the c++ side I am getting a string only it is an empty one.
 
 Any thoughts?
 
>>> 
>>> Have you checked that the name is indeed non-empty on the JS side?
>>> Does it work if you declare the slot as taking a QString argument (why
>>> do want to receive it as a QScriptValue)?
>>> What type is the script value, is it an object? If so, does
>>> QScriptValue::toVariant() return anything? QML has a special "hook" to
>>> allow converting a script value to a variant, but no hook for the
>>> toString case AFAICT.
>>> 
>>> Regards,
>>> Kent
>>> ___
>>> Qt-qml mailing list
>>> Qt-qml@trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-qml
>> 
>> 
> 
> ___
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Temporary QML Objects

2010-05-26 Thread aaron.kennedy
Hi,

Objects returned to C++ like this are marked as "indestructible" to prevent 
them being destroyed under the nose of your C++ application.  You can change 
this by adding

QDeclarativeEngine::setObjectOwnership(myObject, 
QDeclarativeEngine::JavaScriptOwnership)

after your create() line if you like.

Cheers,

Aaron


On 27/05/10 10:01 AM, "ext Colin Kern"  wrote:

Hi all,

I want to dynamically create QML objects in my application to serve as
visual effects.  They're pretty basic QML components that I just want
to appear, animate, and then be destroyed.  I'm not sure about the
best way to do this.  My program is hybrid C++/QML, so I have a
QDeclarativeView which is the root context and engine for all the QML
of my program.  I create the view and then use setSource to set the
QML that makes up my main UI.  Now later as the program is running, I
want to start dynamically creating some objects.  This is what I tried
just as a proof of concept:

Effect.qml:
import Qt 4.6
Rectangle {
id: rect
width: 100
height: 20
color: "red"
x: 200
NumberAnimation on y { from: 300; to: 100; duration: 1000 }
Component.onCompleted: rect.destroy(1000)
}

and then in a slot in my C++:
QDeclarativeComponent component(view->engine(), QUrl("Effect.qml"));
QObject *myObject = component.create();

this probably isn't the right way to go about this, but I'm not sure
what is.  When I run this code, I don't see the Effect elements, but I
do get debug messages saying "Effect.qml:10: Error: Invalid attempt
to destroy() an indestructible object".

Thanks for your help,
Colin
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] documenting the Qml grammar

2010-05-18 Thread aaron.kennedy
Hi,


On 18/05/10 11:02 PM, "Kamm Christian.D (Nokia-D/Berlin)"
 wrote:
> I think it'd be good to have an annotated grammar of the Qml language in the
> documentation. The current way of teaching by example is great for new users.
> It isn't very good as a quick reference, a reliable way to resolve corner
> cases or to figure out whether something is valid Qml.

Great!  I've started on this a number of times, but never really got
anywhere before being distracted.  Perhaps someone with more discipline will
have more luck.

> QmlProgram:
> QmlImport* QmlObjectDefinition
> 
> QmlImport:
> 'import' QmlImportId QmlImportVersion ('as' QmlIdentifier)?
> 'import' StringLiteral QmlImportVersion? ('as' QmlIdentifier)?
> 
> QmlImportId:
> IdentifierName ('.' IdentifierName)*
> 
> The implemented grammar just says "QmlImportId: MemberExpression" and has an
> extra check to verify it's either a string literal or a series of
> FieldMemberExpressions in the parsing code. I think this should be explicit in
> the documentation. It may also be worthwhile to change the grammar like this
> to allow using reserved words for qualified imports.

Agreed.

> QmlImportVersion:
> DecimalIntegerLiteral '.' DecimalDigits
> 
> The implemented grammar uses NumericLiteral here. Being more explicit shows
> that 1.5e9 is not a valid import version more clearly.

Sure, if you're happy to type "import Qt 4.15" in another 149993
releases of Qt :)  Ok, DecimalDigits makes more sense.

> QmlObjectMember:
> QmlPropertyDeclaration
> QmlPropertyBinding
> QmlObjectDefinition
> QmlSignalDeclaration
> FunctionDeclaration
> 
> Omitted VarDeclaration.

Do you mean the "UiObjectMember: VariableStatement" clause?  I think that
should be removed.  Roberto?

> QmlPropertyDeclaration:
> 'property' QmlPropertyType QmlIdentifier (':' QmlPropertyRhs)?
> 'property' 'list' '<' QmlQualifiedId '>' (':' '[' QmlArrayMemberList?
> ']')?
> 'default' 'property' 'alias' QmlIdentifier ':' QmlPropertyRhs
> 
> This is different from the implemented grammar in several ways.
> 
> 1. It allows any right-hand side that's valid in a property binding as the
> initializer of a declaration. While separating the two may make sense to
> programmers, what's the harm in making
> 
>   property int foo : 3*width
> 
> be equivalent to the following:
> 
>   property int foo
>   foo: 3*width

It *should* be the same.  I thought this had been fixed, but I guess not :(

> 2. I changed the list type from list to list to
> allow lists of types that have been imported into a namespace. This seems to
> be an oversight in the current implementation.

Yep

> 3. is there any use for 'default' properties that don't have 'alias' type? I
> couldn't think of any and altered the grammar accordingly.

Object and list properties can be default.  "default property Object blah"
for example.

> QmlPropertyType:
> QmlIdentifier
> 
> I dropped ReservedWord and 'var'. The latter is deprecated and no Qml types
> seem to be reserved words.

Ok.

> I'll open tickets for these bugs/suggestions in a few days, depending on the
> feedback.

Please do.

Cheers,

Aaron


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Some feedback from users.

2010-05-11 Thread aaron.kennedy
Hi,


On 12/05/10 2:56 AM, "ext Stephen Kelly"  wrote:

> So much for model/view separation :)
> 
> I'm not really trying to get the "context properties internal to the
> delegate", I'm trying to get "context properties internal to the model".
> 
> To do that it looks like I need to make sure the delegate has aliases for
> any custom role I might want to use to retrieve data.
> 
> What if I want to get the data in the n-th row of a c++ model, not just the
> "current item"? Will that ever be possible?

It might be possible in the future.  There are some memory management issues
that would need to be worked out, but it could be done.  If you feel
strongly about this, please create a "suggestion" in the bug system.

For now, the best you can do is hacks :(

Cheers,

Aaron


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Changing gradient in PropertyChanges

2010-05-10 Thread aaron.kennedy
Hi,

Hopefully we'll support the syntax you tried in the future, but for now you've 
got to do it as a bit of a hack - you have to give the GradientStop's ids and 
then modify them individually.

For example, this

Rectangle {
 gradient:  Gradient {
GradientStop { id: stop1; position: 0.0; color: 'blue' }
GradientStop { id: stop2; position: 1.0; color: 'lightblue' }
}
}

can then be modified by

PropertyChanges { target: stop1; color: 'gray' }
PropertyChanges { target: stop2; color: 'lightgray' }


Cheers,

Aaron

On 10/05/10 5:54 PM, "Kellomaki Pertti (Nokia-D/Tampere)" 
 wrote:

Is it possible to change the gradient of an element in PropertyChanges?
I tried making a fancy button with in QML, but when I try to  change the
gradient I get the error message
"PropertyChanges does not support creating state-specific objects."
Here's the relevant snippet:

 State {
 name: 'pressed'
 PropertyChanges {
 target: self
 gradient:  Gradient {
 GradientStop { position: 0.0; color: 'gray' }
 GradientStop { position: 1.0; color: 'lightgray' }
 }
 }
 }

--
Pertti

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] [coding niceness][low priority] Usage of "createComponent()"

2010-04-22 Thread aaron.kennedy
Hi,


On 23/04/10 2:10 AM, "ext Ivan De Marino"  wrote:

> Hello.
> This is a message purely about code "niceness". Answer only when u are done
> with your daily job, and the thing in your non-mouse-holding hand is a Pina
> Colada. :)
> 
> Scenario: I have 2 .qml
> - Main.qml
> - common/SupaDupaComponent.qml
> 
> In main.qml I do something like:
> 
>> import "common"
>> ...
>> var component = createComponent("common/SupaDupaComponent.qml");
>> var obj = component.createObject();
>> obj.parent = aProperParent;
>> ...
> 
> This works and the world has a blue sky.
> But I don't like it 100%: given that I have imported the component already (at
> the first line), why do I have to search the component "by file"?
> For me, something like:
> 
>> var obj = SupaDupaComponent.createObject();
>> ...
> 
> Should be the proper thing to have.
> I know, is one line, but WHY it doesn't work if I do like that?
> Isn't an included component equivalent to a "Component"?
> What am I missing from the way QML handles Component's creation?

Nothing.  It would be nice if QML handled dynamic component creation like
this, but it doesn't.  The implementation reason, if you're interested, is
that the JavaScript is not fully aware of all the types in scope.  In future
releases we might support something closer to your proposed syntax.

Cheers,

Aaron


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Repeater element missing the border between the items

2010-04-20 Thread aaron.kennedy
Hi,

Like Alan this works fine for me - the border is definitely visible.  Perhaps 
you are using an older version that might have a bug?

Cheers,

Aaron


On 20/04/10 6:22 PM, ""Alpert (Nokia-D-Qt/Brisbane)""  
wrote:



 Tirsdag 20. april 2010 18:08:06 skrev ext rakesh.muthar...@tieto.com :
> Hi,
>
> I have a similar type of list content, instead of rewriting them
> for n-number of times I used Repeater element, I noticed that the border
> or seperator between the items is lost.
>
> For eg.,
>
> Rectangle {
> id: myitemrect1
> x: 0
> y: 536
> width: parent.width
> height: 70
> color: "#babec1"
> border.color: "#7e7e7e"
> anchors.top: parent.top
> anchors.topMargin: 0
> Text {
> id: text13
> x: 46
> y: 20
> width: 255
> height: 40
> text: "item1"
> verticalAlignment: "AlignVCenter"
> anchors.top: parent.top
> anchors.topMargin: 15
> anchors.left: parent.left
> anchors.leftMargin: 50
> font.pointSize: 20
> font.bold: false
> font.family: "FreeSans"
> }
> }
> Rectangle {
> id: myitemrect2
> x: 0
> y: 591
> width: parent.width
> height: 70
> color: "#babec1"
> anchors.top: myitemrect1.bottom
> anchors.topMargin: 0
> border.color: "#7e7e7e"
> Text {
> id: text14
> x: 48
> y: 600
> width: 255
> height: 40
> text: "item2"
> anchors.top: parent.top
> anchors.topMargin: 15
> font.bold: false
> font.family: "FreeSans"
> font.pointSize: 20
> anchors.leftMargin: 50
> verticalAlignment: "AlignVCenter"
> anchors.left: parent.left
> }
> }
> ..
>
> Above, code shows the border and works as expected. I replaced the above
> code with Repeater element like.,
>
> Column {
> Repeater {
> model:8
> Rectangle {
> id: myitem
> x: 0
> y: 536
> width: parent.width
> height: 70
> color: "#babec1"
> border.color: "#7e7e7e"
> border.width: 5  --->> I tried
> increasing the width, even then border is not visible. Text {
> id: text13
> x: 46
> y: 20
> width: 255
> height: 38
> text: "item"+index
> verticalAlignment: "AlignVCenter"
> anchors.left: parent.left
> anchors.leftMargin: 50
> font.pointSize: 20
> font.bold: false
> font.family: "FreeSans"
> }
> }
> }
> }
>
> Now, the border between the items is lost. Is there possibility to show the
> border if I use Repeater element? Thanks and Regards,
> Rakesh

I don't see anything wrong with the result of that code. Keep in mind that the
border width is not added to the Rectangle's width. This means that since you
don't specify any spacing on the Column, the rectangles will be drawn
overlapping. Adding spacing equal to the border width would allow the full
borders to be shown.

--
Alan Alpert
Software Engineer
Nokia, Qt Development Frameworks
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] can Anchor-based layout be conditional?

2010-04-19 Thread aaron.kennedy
Hi,

On 19/04/10 5:55 PM, "rakesh.muthar...@tieto.com"
 wrote:
  
> states: [
> State {
> name: "landscape"
> 
> ParentChange {
> target: rectangle15
> parent: homebar
> }
> PropertyChanges {
> target: rectangle15
> x: 410
> y: 30
> width: 320
> height: parent.height
> }
> AnchorChanges {
> target: rectangle15
> bottom: undefined
> left: image4.left --- cannot assign to non-existent
> property "left"
> top:homebar.top
> }
> }
> ]
>  
> could you help me with this? and how can i redefine the Margins w.r.t new
> view?

The docs are out of date.  If you check out the example, you'll see it
should be:

AnchorChanges {
target: rectangle15
anchors.bottom: undefined
anchors.left: image4.left
anchors.top:homebar.top
}

The margins can be changed using the PropertyChanges{} element.

Cheers,

Aaron

>  
> Br,
> Rakesh.M
> 
> From: aaron.kenn...@nokia.com [mailto:aaron.kenn...@nokia.com]
> Sent: Monday, April 19, 2010 10:29 AM
> To: Mutharaju Rakesh; qt-qml@trolltech.com
> Subject: Re: [Qt-qml] can Anchor-based layout be conditional?
> 
> Hi,
> 
> You can use the AnchorChanges element
> (http://doc.trolltech.com/4.7-snapshot/qml-anchorchanges.html) within a state
> change to modify anchors.  Unfortunately we don¹t have any examples showing
> this, but there is an illustrative test under
> tests/auto/declarative/qmlvisual/animation/reanchor/reanchor.qml
> 
> We¹ll make sure we have updated the docs and examples by 4.7.
> 
> Cheers,
> 
> Aaron
> 
> 
> On 19/04/10 5:22 PM, "rakesh.muthar...@tieto.com" 
> wrote:
> 
>> Hello,
>>  
>>  I  am quite new to Qt-Quick. Well, i am trying to use the same view
>> for landscape  and potrait modes of screen orientation.
>>  
>> If i have anchored  Rectangle to the view something like
>> Rectangle{
>> anchors.bottom:  parent.bottom
>> anchors.bottomMargin: 5
>> }
>>  
>> And if I change the  screen orientation I would like to have the same
>> rectangle  at
>>  
>> Rectange{
>> anchors.top:parent.top
>> anchors.topMargin:  5
>> anchors.left:parent.left
>> anchors.leftMargin: 10
>> }
>>  
>> I  guess this requires some sort of logic to reset the anchors on change of
>> orientation and then have a new set of achors w.r.t to new view.I can write a
>> new state and map it to screen orientation.But, how can I change the
>> anchors?
>>  
>> Could someone tell me how to reset the anchors on  orientation changes? Or
>> the other alternative seems to have the anchors based  on conditions.
>>  
>> Thanks and Regards,
>> Rakesh  
>> 
>> 
> 


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] can Anchor-based layout be conditional?

2010-04-19 Thread aaron.kennedy
Hi,

You can use the AnchorChanges element 
(http://doc.trolltech.com/4.7-snapshot/qml-anchorchanges.html) within a state 
change to modify anchors.  Unfortunately we don't have any examples showing 
this, but there is an illustrative test under 
tests/auto/declarative/qmlvisual/animation/reanchor/reanchor.qml

We'll make sure we have updated the docs and examples by 4.7.

Cheers,

Aaron


On 19/04/10 5:22 PM, "rakesh.muthar...@tieto.com"  
wrote:

Hello,

 I am quite new to Qt-Quick. Well, i am trying to use the same view for 
landscape and potrait modes of screen orientation.

If i have anchored Rectangle to the view something like
Rectangle{
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
}

And if I change the screen orientation I would like to have the same rectangle 
at

Rectange{
anchors.top:parent.top
anchors.topMargin: 5
anchors.left:parent.left
anchors.leftMargin: 10
}

I guess this requires some sort of logic to reset the anchors on change of 
orientation and then have a new set of achors w.r.t to new view.I can write a 
new state and map it to screen orientation.But, how can I change the anchors?

Could someone tell me how to reset the anchors on orientation changes? Or the 
other alternative seems to have the anchors based on conditions.

Thanks and Regards,
Rakesh


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Best way to update QML display based on external input via TCP socket?

2010-04-15 Thread aaron.kennedy
Hi,

Yes, the QObject documentation is out of date.  I've fixed it, but it will take 
a while to make its way to the public website.

Cheers,

Aaron


On 16/04/10 6:58 AM, "ext John Vilburn"  wrote:

My mistake. NOTIFY is listed in the Q_PROPERTY documentation in 4.6, but not 
consistently.

In the QObject Class Reference, Q_PROPERTY is listed like this:

Q_PROPERTY(type name
READ getFunction
[WRITE setFunction]
[RESET resetFunction]
[DESIGNABLE bool]
[SCRIPTABLE bool]
[STORED bool]
[USER bool])
But on the Qt's Property System page it is listed like this:

Q_PROPERTY(type name
READ getFunction
[WRITE setFunction]
[RESET resetFunction]
[NOTIFY notifySignal]
[DESIGNABLE bool]
[SCRIPTABLE bool]
[STORED bool]
[USER bool]
[CONSTANT]
[FINAL])
Is this just a case of the QObject Class Reference being out of date, or is 
there another reason for the discrepancy?

Thank you,
John

On Apr 15, 2010, at 10:48 AM, John Vilburn wrote:

Matthias,

The documentation for Qt 4.6.2 does not mention a NOTIFY section for 
Q_PROPERTY. Is this new to 4.7?

Thanks,
John

On Apr 15, 2010, at 10:37 AM,  
 wrote:


The dynamic parts of the UI should be build entirely based  on properties 
provided by the CodeBehind. If those properties are notifyable (i.e. the 
Q_PROPERTY macro contains a NOTIFY section), then the UI will update itself.

A less pretty and less declarative way would be to emit a signal from 
CodeBehind, and then have a signal handler in QML react to it imperatively. But 
that would be old school. QML's property bindings are way more elegant.

Matthias

From: qt-qml-boun...@trolltech.com [qt-qml-boun...@trolltech.com] On Behalf Of 
ext Peter Matuchniak [pmatuchn...@imsco-us.com]
Sent: Thursday, April 15, 2010 8:37 PM
To: qt-qml@trolltech.com
Subject: [Qt-qml] Best way to update QML display based on external input via 
TCP socket?

Hello

I have a Qt main application that does the following (with my descriptions in 
parentheses):

-  Displays a QML user interface (the "UI")

-  Handles user events in a C++ class (the "CodeBehind")

-  Listens on a TCP socket for external input (the "Listener")

Here's my question:

-  What is the best way for the Listener to cause some update in the UI 
to occur when the Listener receives some external command via TCP

Note:

-  I already have the Listener functioning and receiving commands

-  I already have the CodeBehind acting upon input from the UI

-  What I need is to have a way to affect the UI from the Listener

Kind regards
Peter



__

This email and any files transmitted with it are confidential & proprietary to 
Systems and
Software Enterprises, Inc. (dba IMS). This information is intended solely for 
the use of
the individual or entity to which it is addressed. Access or transmittal of the 
information
contained in this e-mail, in full or in part, to any other organization or 
persons is not
authorized.

__






___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


[Qt-qml] QObject::destroyed() signal now block

2010-04-15 Thread aaron.kennedy
Hi,

QML now prohibits you from assigning to the ³onDestroyed² property of
objects.  Code like this is now banned:

Item {
onDestroyed: print(³Goodbye cruel world!²)
}

Those of you familiar with C++ will know that QML inherits this property
because QObject happens to have a destroyed() signal.  This signal only ever
partially worked in QML, so it is best that it is disabled entirely.

If you want to know when your component is about to be destroyed, you can
use the new ³Component.onDestruction² attached property like this:

Item {
Component.onDestruction: print(³Goodbye cruel world!²)
}

This signal is emitted before the destruction actually begins, so most of
the component and the application¹s state is still valid.

In all real-world cases that I am aware of the two methods are functionally
identical, but there is a subtle semantic difference.  The
³Component.onDestruction² signal is triggered when the component is being
destroyed, not the specific object to which it is applied.  There is no way
in QML to monitor an individual object for destruction ­ although thankfully
there is no need to either :)

The change is making its way through our CI system, and will appear in the
master branch shortly.

Cheers,

Aaron


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Unable to use external JS file with QML

2010-04-14 Thread aaron.kennedy
Hi,

If Script { source: "a.js" } works for you without any warnings it is because 
you are using an old build.

In the latest code, available from http://qt.gitorious.org, we support the 
import "a.js" as A syntax.  For the time being we are also still supporting the 
Script{} tag to give people time to port their code.  The latest builds of QML 
will output a warning if you use the Script{} tag instructing you to update 
your files.

The final 4.7 release will only support the import syntax.

Cheers,

Aaron


On 14/04/10 6:19 PM, "ext Jack Wootton"  wrote:

Script { source: "a.js" }

works for me.  Is this because of the "overlap" that's been mentioned or is it 
because i'm using a version of Qt that doesn't implement the "import" method?

I'm using 4.7.0 snapshot built form source, downloaded from 
http://qt.nokia.com/developer/qt-qtcreator-prerelease#download

On Wed, Apr 14, 2010 at 6:13 AM,   wrote:
> Did the older versions of QML support importing of js files that way
> (import "a.js" as Misc)?  I know the old { Script: a.js } way of
> including js files doesn't work anymore, was that replaced with the
> new way, or were both always an option?

The import way replaced the Script{} way, with some overlap.

--
Warwick

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] WebView and input methods

2010-04-11 Thread aaron.kennedy
Hi,

Segfaults are always bugs :)  Your other issues also deserve investigation.
Please create appropriate bug reports!

Cheers,

Aaron


On 10/04/10 12:47 AM, "ext Ivan De Marino"  wrote:

> Hello fellow QtQuickers ;)
> What a "bad" nick name. Better "fellow QMLers". ;)
> 
> Simple question: is just my app or the WebView has big troubles with input
> methods and ui elements like Select?
> 
> 1) No cursor showed within an '' element
> 2) If I click on a '...' my app explodes
> 3) '...' elements in general are not looking good at all
> 
> I tested this stuff on Linux, Windows, Mac and Maemo 5.
> 
> I tested also the "demos/declarative/webbrowser", and a couple of clicks on a
> "select" and boom: "Seg-fault".
> 
> My suspect is that this stuff is left for later on.
> I didn't check the source code though, so it might be implemented and faulty.
> 
> Any info from the Trolls?
> It's not like that I need "now", and it's ok to wait for release, but if this
> is a bug, than I'll file it.
> 
> Let me know.
> 
> Ciao ciao
> 
> PS @Moderator Again, I posted without checking through which address I was
> sending. Damn me. Sorry.


___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


[Qt-qml] "property var" becomes "property variant"

2010-04-08 Thread aaron.kennedy
Hi,

QML supports declaring object properties with a type "var".  Behind the scenes 
this actually creates a QVariant property, which behave similarly but not 
identically to a JavaScript "var".  To reduce confusion, the QML type has been 
renamed to "variant".  Code that wrote:

Item {
property var a
}

should now read:

Item {
property variant a
}

Once this change makes it into the master branch there will be a grace period 
where both are supported (the "var" case will print a distracting warning of 
course) of around a week.

Cheers,

Aaron
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml