Re: [Qt-qml] How to ignore MouseArea signals

2010-12-09 Thread jerome.pasion
Hello,

Is there a reason why accepted isn't handled in the other mouse events? 

Cheers,
Jerome P.

From: qt-qml-boun...@trolltech.com [qt-qml-boun...@trolltech.com] On Behalf Of 
ext Halton Huo [halton@intel.com]
Sent: Wednesday, December 08, 2010 4:40 AM
To: Jones Martin (Nokia-MS-Qt/Brisbane)
Cc: qt-qml@trolltech.com
Subject: Re: [Qt-qml] How to ignore MouseArea signals

Thanks, http://bugreports.qt.nokia.com/browse/QTBUG-15929 is filed.

On Wed, 2010-12-08 at 10:41 +0800, martin.jo...@nokia.com wrote:
> Log a bug.  It would be good if you could suggest where the docs are lacking 
> - i.e. where you started looking when this didn't work as expected.  The 
> "accepted" behavior is documented in the MouseArea signal documentation.
>
> BR,
> Martin.
>
> > -Original Message-
> > From: ext Halton Huo [mailto:halton@intel.com]
> > Sent: Wednesday, 8 December 2010 11:56 AM
> > To: Jones Martin (Nokia-MS-Qt/Brisbane)
> > Cc: adriano.reze...@openbossa.org; qt-qml@trolltech.com
> > Subject: RE: [Qt-qml] How to ignore MouseArea signals
> >
> > Woo, OnPressed works, thanks very much.
> >
> > The document need to be improved. Any process to do that?
> >
> > Cheers,
> > Halton.
> > On Wed, 2010-12-08 at 09:46 +0800, martin.jo...@nokia.com wrote:
> > > You need to accept in onPressed.  accepted is ignored for any other event.
> > >
> > > BR,
> > > Martin.
> > >
> > >
> > > > -Original Message-
> > > > From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com]
> > On
> > > > Behalf Of ext Halton Huo
> > > > Sent: Wednesday, 8 December 2010 11:42 AM
> > > > To: Adriano Rezende
> > > > Cc: qt-qml@trolltech.com
> > > > Subject: Re: [Qt-qml] How to ignore MouseArea signals
> > > >
> > > > "enabled" does not match my case.
> > > >
> > > > I need receive the MouseArea signals but as well as those below the top
> > > > item can receive the signals also.
> > > >
> > > > Refer to MouseEvent element document, seems accepted can do that.
> > > > -
> > > > accepted : bool
> > > >
> > > > Setting accepted to true prevents the mouse event from being propagated
> > > > to items below this item.
> > > >
> > > > Generally, if the item acts on the mouse event then it should be
> > > > accepted so that items lower in the stacking order do not also respond
> > > > to the same event.
> > > >
> > > >
> > > > But following code does not work as I wish
> > > > MouseArea {
> > > > anchors.fill: parent
> > > > onClicked: {
> > > > console.log("mouse.accepted="+mouse.accepted)
> > > > mouse.accepted = false
> > > > console.log("mouse.accepted="+mouse.accepted)
> > > > }
> > > > }
> > > >
> > > > Thanks,
> > > > Halton.
> > > >
> > > > On Wed, 2010-12-08 at 02:55 +0800, Adriano Rezende wrote:
> > > > > On Tue, Dec 7, 2010 at 4:31 AM, Halton Huo  
> > > > > wrote:
> > > > > > So my questions how to ignore the received signals to let other 
> > > > > > items to
> > > > > > continue deal with those signals?
> > > > >
> > > > > You can set enabled property to false or ignore the event on mouse 
> > > > > press.
> > > > >
> > > > > MouseArea {
> > > > > anchors.fill: parent
> > > > > onClicked: console.log("background clicked");
> > > > > }
> > > > >
> > > > > MouseArea {
> > > > > anchors.fill: parent
> > > > > enabled: false
> > > > > //onPressed: mouse.accepted = false;
> > > > > onClicked: console.log("foreground clicked");
> > > > > }
> > > > >
> > > > > Br,
> > > > > Adriano
> > > >
> > > >
> > > > ___
> > > > 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] How QML file is parsed and linked and executed?

2010-11-23 Thread jerome.pasion
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"?

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] Using enums in QML signal handlers

2010-11-19 Thread jerome.pasion
Hello,

There is a similar bug that was already fixed: 
http://bugreports.qt.nokia.com/browse/QTBUG-11313

How do you register the enum in the Qt Declarative module?
Did you use qmlRegisterUncreatableType?
http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeengine.html#qmlRegisterUncreatableType

Thanks,
Jerome P.

From: qt-qml-boun...@trolltech.com [qt-qml-boun...@trolltech.com] On Behalf Of 
Brasser Michael (Nokia-MS-Qt/Brisbane)
Sent: Wednesday, November 03, 2010 6:26 AM
To: Olli Salonen (EXT-Futurice/Berlin)
Cc: qt-qml@trolltech.com
Subject: Re: [Qt-qml] Using enums in QML signal handlers

Hi Olli,

This sounds like a bug -- could you please create a report at 
bugreports.qt.nokia.com?

Thanks,
Michael

On 02/11/2010, at 11:06 PM, ext 
ext-salonen.o...@nokia.com wrote:

Hi,

I have declared an enum in a class and use it as an argument in a signal. I can 
use the enum in QML, but I cannot read the parameter in the signal handler. Is 
it supposed to work somehow?

Example:

class MyObject {
  Q_OBJECT
  Q_ENUMS(MyEnum)
  Q_PROPERTY(MyEnum value READ value NOTIFY valueChanged)
public:
  enum MyEnum { Value1, Value2};
signals:
  void valueChanged(MyEnum value);
}

Qml file
--
MyObject {
  onValueChanged: console.debug(“Value is “ + value)
}

This fails with the following output:
QMetaProperty::read: Unable to handle unregistered datatype 'MyEnum' for 
property 'QDeclarativeBoundSignalParameters::value'

I also tried to rename the signal parameter type to MyObject::MyEnum, but this 
did not work either. I can use the value correctly if I access it as a 
property, or if I assign enum values such as “property int myvalue: 
MyObject.Value1”.

Thanks,
Olli



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


[Qt-qml] Exporting enums to QML

2010-11-19 Thread jerome.pasion
Hello,

I know there is no enum reserved keyword in JavaScript, but what is the 
preferred way to expose Q_ENUMS to QML?

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


[Qt-qml] ListView footer positioning

2010-11-17 Thread jerome.pasion
Hello all,

One of our developers encountered an error where a footer's center is below the 
header's bottom, causing an overlap between the two elements (footer's top half 
is in front of the header). The model is loading elements from a source and 
this behaviour occurs during loading or when the list is empty.

I can't recreate the problem using simple headers and footers. Is there a way 
to position the footer?

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


[Qt-qml] ListView's childrenRect

2010-11-16 Thread jerome.pasion
Hello all,

Someone sent me his problem with ListView's childrenRect. Essentially, binding 
the ListView's height to the childrenRect.height when using a regular ListModel 
(with strings) will only show the first element while using the XmlListModel 
will fit all the model's items.

Here is his code snippet:
ListView {
id: list

interactive: false
//height: contentHeight //If bound to contentHeight warning is given 
that there is a binding loop!
height: childrenRect.height //If bound to childrenRect.height then only 
one item is shown (unless you use an XMLListModel!)
//contentHeight: childrenRect.height //Not really necessary
width: parent.width
model: listModel
//model: xmlListModel //If the XMLListModel is used, then the 
childrenrect binding is fine
delegate: listItem
}
}

What would be the best way of fitting the contents of any/all types of models?

Cheers,
Jerome P.

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


[Qt-qml] QML file size and performance

2010-11-15 Thread jerome.pasion
Hello,

A question I received was about QML file sizes and performance on mobile 
devices.
Would there be huge performance benefits by stripping the comments or white 
space from QML files? (Other than the obvious file size reduction.)

Cheers,
Jerome P.

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


Re: [Qt-qml] FocusScope and Positioning

2010-11-10 Thread jerome.pasion
Hello,

Thanks for your reply.
I will add this information as usage guideline in the focus document. 
Currently, there isn't any content regarding how to use the FocusScope element.

Thanks,
Jerome P.

From: Brasser Michael (Nokia-MS-Qt/Brisbane)
Sent: Wednesday, November 10, 2010 3:46 AM
To: Pasion Jerome (Nokia-MS-Qt/Oslo)
Cc: qt-qml@trolltech.com
Subject: Re: [Qt-qml] FocusScope and Positioning

Hi Jerome,

FocusScope is considered a visual element (like Item, it is a visual element 
that doesn't actually draw anything) with a geometry, so it needs an explicit 
size (e.g. binding its size to its children's size) to work properly within a 
layout. It certainly wouldn't hurt to make that more explicit in the docs -- is 
that something you are happy to do along with your other revisions in this area?

Regards,
Michael

On 09/11/2010, at 6:28 PM, ext jerome.pas...@nokia.com wrote:

> Hello,
>
> I am revising the focus document and I noticed something unexpected.
> Here is a sample code:
>
> import QtQuick 1.0
>
> Rectangle {
>width: 200; height: 200
>
>Column {
>FocusScope {
>Rectangle {width: 50; height: 50; color: "blue"}
>}
>
>FocusScope {
>Rectangle {width: 50; height: 50; color: "red"}
>   }
>}
> }
>
> What I would like is to place these two FocusScope on top of each other, 
> instead the rectangles will be in front of each other.
> Removing the FocusScope element will do what I intended, but the addition of 
> a FocusScope doesn't behave as (I, at least) expected.
>
> This issue might come up when people start wrapping their components in 
> FocusScopes and the element which imports these components may
> not be aware of these FocusScope behaviors.
>
> Any workarounds?
>
> Cheers,
> Jerome P.
> ___
> 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] FocusScope and Positioning

2010-11-09 Thread jerome.pasion
Hello,

I am revising the focus document and I noticed something unexpected.
Here is a sample code:

import QtQuick 1.0

Rectangle {
width: 200; height: 200

Column {
FocusScope {
Rectangle {width: 50; height: 50; color: "blue"}
}

FocusScope {
Rectangle {width: 50; height: 50; color: "red"}
   }
}
}

What I would like is to place these two FocusScope on top of each other, 
instead the rectangles will be in front of each other.
Removing the FocusScope element will do what I intended, but the addition of a 
FocusScope doesn't behave as (I, at least) expected.

This issue might come up when people start wrapping their components in 
FocusScopes and the element which imports these components may
not be aware of these FocusScope behaviors.

Any workarounds?

Cheers,
Jerome P.
___
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 jerome.pasion
Hello,

You would need to use QDeclarativeListProperty aka "list properties". 
We have several documents on this already: 
1)http://doc.qt.nokia.com/4.7-snapshot/gettingstartedqml.html#creating-qml-properties-in-a-c-class
2)http://doc.qt.nokia.com/4.7-snapshot/declarative-tutorials-extending-chapter5-listproperties.html

To summarize:
1)Your list item must inherit from a QObject, so don't use QString.
2)You MUST create functions to append to your list. size(), at(), clear() 
functions aren't necessary.
3) Register the type into qml using qmlRegisterType() in C++.

Cheers,
Jerome P.

From: qt-qml-boun...@trolltech.com [qt-qml-boun...@trolltech.com] On Behalf Of 
ext Toni Leppänen [toni.leppa...@gmail.com]
Sent: Thursday, September 30, 2010 12:01 PM
To: qt-qml@trolltech.com
Subject: [Qt-qml] Getting a list of strings from plugin

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