Re: [Qt-qml] QML memory usage with "import QtWebKit"

2010-12-13 Thread Gregory Schlomoff
Hi Michael,

Sorry, I didn't understand from your email if you think it's normal that
memory usage goes up 10 Mb by just importing WebKit without using it ?

What I mean is: does it look like an issue that should be investigated, or
should we just shrug and move on?

:)

Thanks

Greg

On Tue, Dec 14, 2010 at 12:52 PM,  wrote:

> Hi Greg,
>
> On 10/12/2010, at 4:52 PM, ext Gregory Schlomoff wrote:
>
> Hi Michael,
>
> Somme additional figures:
>
> 1. Empty Rectangle, not importing QtWebkit: ~ 3MB
> 2. Empty Rectangle, importing QtWebkit: ~ 13MB
> 3. Rectangle with an empty WebView: ~ 14 MB
> 4. Setting url: "about:blank" in the WebView: ~15 MB
> 5. Setting url: "http://www.google.com/": ~19 MB (and a repaint bug:
> webview displays a checkered background, and I have to resize the window a
> little bit to make it actually paint the page.)
>
>
> Okay, thanks for sharing these. They are in the ballpark of what I would
> have expected based on prior observation, though I am definitely not a
> webkit expert. If you want to dig more, you could try comparing with
> QWebView or QGraphicsWebView (QML WebView memory usage should be identical
> to QGraphicsWebView with QWebSettings::TiledBackingStoreEnabled set (which
> does increase memory usage because of the pixmap caching)). Maybe someone
> familiar with QtWebKit can provide more information, or say whether there
> are any ways to tweak the memory usage?
>
> You can track the repaint bug (I think they are the same) at
> https://bugs.webkit.org/show_bug.cgi?id=50222.
>
> Regards,
> Michael
>
> All tests on windows 7 64-bits, running qmlviewer.exe built from the 4.7.0
> branch on Oct, 6.
>
> Thanks,
>
> Greg
>
> On Fri, Dec 10, 2010 at 12:12 PM,  wrote:
>
>> Hi Greg,
>>
>> From what I remember 10MB for the "base" usage of webkit sounds about
>> right, though I didn't realize that just an import statement would add this
>> cost. Did you try any other configurations? e.g. did adding an empty WebView
>> cause the memory to go up or was it still around 13MB?
>>
>> Regards,
>> Michael
>>
>> On 30/11/2010, at 6:48 PM, ext Gregory Schlomoff wrote:
>>
>> > Hello,
>> >
>> > One simple observation. Launching the following code in qmlviewer.exe,
>> > I get a memory usage of aroung 3 megabytes:
>> > ---
>> > import QtQuick 1.0
>> >
>> > Rectangle {
>> >   width: 200
>> >   height: 200
>> > }
>> > 
>> >
>> > Now, with the following code, memory usage jumps to 13 megabytes. I'm
>> > not instantiating any WebView element, just importing QtWebkit.
>> > ---
>> > import QtQuick 1.0
>> > import QtWebKit 1.0
>> >
>> > Rectangle {
>> >   width: 200
>> >   height: 200
>> > }
>> > 
>> >
>> > Is that normal? Would someone care to explain what the import
>> > statement is doing that is adding 10 mb of memory consumption?
>> >
>> > 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] QML memory usage with "import QtWebKit"

2010-12-09 Thread Gregory Schlomoff
Hi Michael,

Somme additional figures:

1. Empty Rectangle, not importing QtWebkit: ~ 3MB
2. Empty Rectangle, importing QtWebkit: ~ 13MB
3. Rectangle with an empty WebView: ~ 14 MB
4. Setting url: "about:blank" in the WebView: ~15 MB
5. Setting url: "http://www.google.com/": ~19 MB (and a repaint bug: webview
displays a checkered background, and I have to resize the window a little
bit to make it actually paint the page.)

All tests on windows 7 64-bits, running qmlviewer.exe built from the 4.7.0
branch on Oct, 6.

Thanks,

Greg

On Fri, Dec 10, 2010 at 12:12 PM,  wrote:

> Hi Greg,
>
> From what I remember 10MB for the "base" usage of webkit sounds about
> right, though I didn't realize that just an import statement would add this
> cost. Did you try any other configurations? e.g. did adding an empty WebView
> cause the memory to go up or was it still around 13MB?
>
> Regards,
> Michael
>
> On 30/11/2010, at 6:48 PM, ext Gregory Schlomoff wrote:
>
> > Hello,
> >
> > One simple observation. Launching the following code in qmlviewer.exe,
> > I get a memory usage of aroung 3 megabytes:
> > ---
> > import QtQuick 1.0
> >
> > Rectangle {
> >   width: 200
> >   height: 200
> > }
> > 
> >
> > Now, with the following code, memory usage jumps to 13 megabytes. I'm
> > not instantiating any WebView element, just importing QtWebkit.
> > ---
> > import QtQuick 1.0
> > import QtWebKit 1.0
> >
> > Rectangle {
> >   width: 200
> >   height: 200
> > }
> > 
> >
> > Is that normal? Would someone care to explain what the import
> > statement is doing that is adding 10 mb of memory consumption?
> >
> > 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


[Qt-qml] QML memory usage with "import QtWebKit"

2010-11-30 Thread Gregory Schlomoff
Hello,

One simple observation. Launching the following code in qmlviewer.exe,
I get a memory usage of aroung 3 megabytes:
---
import QtQuick 1.0

Rectangle {
width: 200
height: 200
}


Now, with the following code, memory usage jumps to 13 megabytes. I'm
not instantiating any WebView element, just importing QtWebkit.
---
import QtQuick 1.0
import QtWebKit 1.0

Rectangle {
width: 200
height: 200
}


Is that normal? Would someone care to explain what the import
statement is doing that is adding 10 mb of memory consumption?

Thanks

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


Re: [Qt-qml] Static analysis for QML

2010-11-24 Thread Gregory Schlomoff
> In fact, for types defined in a QML plugin, Creator will often already be able
> to offer code completion and error reporting. What the static analysis can't 
> do
> yet is get the types right when you embed QML in a C++ application and expose
> some random objects (say using setContextProperty).
>
> It's under investigation though.
>

That's good news! Hope to see that soon in Qt Creator.

For the record, I'm creating a custom QML type (ie: a QDeclarativeItem
subclass), exposed through:

 qmlRegisterType("MyCustomClasses", 1, 0, "MyClass");

So this seems an intermediary case between QML plugins and random
qobjects exposed through context properties.

But Qt Creator really isn't happy with that, to the point that it will
underline in red the:

import MyCustomClasses 1.0

statement at the top of my qml files. And of course I won't get any
form of completion or code assistance for those custom types. I hope
that this issue is also being considered by the Qt Creator team,
because it doesn't seem very far from qml plugins.

Thanks

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


[Qt-qml] Static analysis for QML

2010-11-24 Thread Gregory Schlomoff
Hello,

One of the main problems that I have with QML, and that actually is
directly linked to what makes it awesome, is the fact that you won't
have any compile-time error when you change property names / slots /
etc... in C++.

So I was wondering, would it be possible, from a technical point of
view (not a product manager / roadmap POV), to have some kind of
static analysis tool that could tell at compile time that some signal
/ slots names have changed ?

Could be something like: for each element declared in QML, find it's
type (so need to parse import directives), then check that all signals
/ slots / properties being used in QML are correctly defined...

I've already noticed that there is some kind of static analysis
running, since I get compile errors for some javascript errors, like
missing braces, this kind of thing.

Just wondering... :)

Thanks for this amazing piece of technology, by the way!
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Mouse wheel events in QML

2010-11-21 Thread Gregory Schlomoff
You have to make your own  component in C++ to catch them.


On Sun, Nov 21, 2010 at 1:29 AM, Girish Ramakrishnan
 wrote:
> See http://bugreports.qt.nokia.com/browse/QTBUG-7369. In short,
> Flickable supports it but not MouseArea.
>
> Girish
>
> On Sat, Nov 20, 2010 at 9:17 PM, Jerzy Chalupski
>  wrote:
>> I can't find any mouse wheel events handler. Am I selectively blind or
>> are mouse wheel events not supported by 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 mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] QML Component Snapshot / Cover-Flow (PathView) implementation suggestions

2010-11-17 Thread Gregory Schlomoff
> There's no built-in QML-based way to take snapshots -- you'd need a custom
> C++ component to do something like this (it does seem to be a frequent
> request; has anyone else made a component for this already?).

Yes, we did that in our custom drag&drop component.

Here's the relevant snippet from
http://bitbucket.org/gregschlom/qml-drag-drop/src/e5dbe26c3073/DeclarativeDragArea.cpp

==
QDeclarativeItem* item // This is the item whose snapshot you want to take

QGraphicsScene scene;
scene.addItem(item);

QPixmap pixmap(scene.sceneRect().width(), scene.sceneRect().height());
pixmap.fill(Qt::transparent);

QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Antialiasing);
scene.render(&painter);

// And now, enjoy your pixmap with the freshly painted item
=

Cheers,

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


Re: [Qt-qml] Executable code in a model?

2010-11-16 Thread Gregory Schlomoff
Ah, sorry, If I understand well, you actually want to do that with
standard ListModel / ListElement? This is not possible with
ListElement, but could probably be done with VisualItemModel

My example was assuming two custom QML components (Menu and MenuItem),
and not the standard QML model items.

Short answer: you have to try out for yourself, but you will certainly
come up with a solution.


2010/11/16 Pertti Kellomäki :
> On 11/16/2010 03:00 PM, ext Gregory Schlomoff wrote:
>>
>> Easy, just bind your javascript code to a signal or a property.
>>
>> QML version of your pseudo-code :
>>
>> Menu {
>>   MenuItem {
>>     title: "save"
>>     onActivated: {
>>         var file = 
>>         file.save();
>>     }
>> }
>>
>
> Thanks, I was hoping it would be this easy. Presumably I can then access the
> onActivated handler in the delegate via the view's currentItem property?
> --
> Pertti
>
>

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


Re: [Qt-qml] Executable code in a model?

2010-11-16 Thread Gregory Schlomoff
Easy, just bind your javascript code to a signal or a property.

QML version of your pseudo-code :

Menu {
  MenuItem {
title: "save"
onActivated: {
var file = 
file.save();
}
}


2010/11/16 Pertti Kellomäki :
> Is it possible to have executable code as part of a model element? In a
> hypothetical Scheme based QML I could create a list model that contains
>  pairs, and then in a list view a delegate could
> simply call the procedure:
>
> (define file-menu
>   (list
>       (list "Save"
>              (lambda () (save-file)))  ; executable code
>       (list "Quit"
>              (lambda () (quit
>
> Does QML allow something like this, or is there some other convenient
> way to glue together e.g. labels and actions?
> --
> 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] How to handle binary data in qml

2010-11-13 Thread Gregory Schlomoff
I don't know how your API work, but you'll probably need to encode the
binary data into a format more suitable for transfer, like Base 64, or
something. So my advice would be to expose the binary data as a string
(encoded as needed).


On Sat, Nov 13, 2010 at 4:00 PM, vuleetu  wrote:
> Hi,
>   I am working on a twitter-like client which use qml. There is a feature
> which allow user post picture and twitter at the same time. What i want to
> do is to use XMLHTTPRequest to post this picture. How do i get binary data
> from cpp and how to use this binary in javascript? Thanks
> ___
> 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 change mouseGrabber in Qml?

2010-10-27 Thread Gregory Schlomoff
Drag and drop is still something that is not really implemented in QML.

>From our experience, the best way to achieve it is to create a custom
QML component in C++ that will in turn call the standard Qt API to
handle drag&drop with QGraphicItem

You can see an example implementation that we did here :
http://bitbucket.org/gregschlom/qml-drag-drop

(Be aware though that this code is missing some of the new features we
added afterwards. But it will give you a good starting point)

Cheers,

Greg


On Thu, Oct 28, 2010 at 12:52 PM,   wrote:
> Hi,
> I need to select an item from a GridView by long tapping it and drag and
> drop it to other place.
> If I dynamically create a new item onPressAndHold event handler in a
> GridView delegate, how can I make new item a “mouse grabber” and continue
> with dragging?
> Any ideas to accomplish this task are more than welcome.
>
> Cheers,
> Antti
>
>
>
> ___
> 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] Getting a list of strings from plugin

2010-09-30 Thread Gregory Schlomoff
you probably want to use QDeclarativeListProperty
cheers

greg

On Thu, Sep 30, 2010 at 5:01 PM, 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


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

2010-09-29 Thread Gregory Schlomoff
Hi Steve,

Yes, those are indeed anonymous functions, also called lambda
expressions (http://en.wikipedia.org/wiki/Anonymous_function)

They are quite easy to read once you know the syntax:

1. function() is the part that tells javascript you're creating an
anonymous function. You can also define parameters here
2. Then comes the body of your function, between curly braces, as
usual. You can do whatever you want here.

So you've defined an anonymous function that does something with some
arguments and return a value. Now you need to call it, specifying the
value of the arguments. That's what the last pair of () does. Here, it
calls the function without any arguments.

>why is it such a common construct when using javascript?

Well, because once you get used to it, you can't live without it.
That's why they are part of C++0x, and that's why a guy even did a
tricky implementation of then in pure C++:
http://matt.might.net/articles/lambda-style-anonymous-functions-from-c++-templates/

But the real reason in this case is that without them, every single
QML expression would need to have it's own named function to evaluate
it.

For instance, you wouldn't be able to write:

Rectangle {
  height: width * 2
}

 But you would instead need to write:

Rectangle {
  height: calcRectHeight(width)
  function calcRectHeight(w) {
return w * 2;
  }
}

Hope this helps you! (also, hope this is correct, I'm not a qml
engineer, so those are just my guess, and may very well be incorrect
:)

On Wed, Sep 29, 2010 at 5:50 PM, Stephen Kelly  wrote:
> Sorry for dragging this up again. I forgot to reply at the time.
>
> Pertti Kellomäki wrote:
>
>> On 09/16/2010 03:37 AM, Kennedy Aaron (Nokia-MS-Qt/Brisbane) wrote:
>>> Internally
>>> the above is actually evaluated like this:
>>>
>>> Text {
>>>      text: (function() { if (condition) { return "A"; } return "B"; })()
>>> }
>>>
>> This would actually be a good way to document it, at least to a former
>> Lisp-head like myself ;-)
>
>
> As a C++ head I rarely see syntax like the above and I find it quite
> difficult to parse. I've seen stuff like that when reading jQuery.js and
> code that uses it, but what is actually happening and why is it such a
> common construct when using javascript? Got links?
>
> It looks like a unnamed function is defined 'inline' inside some (), like a
> python lambda function or so, and then called immediately. Is that what's
> happening?
>
> All the best,
>
> Steve.
> ___
> 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] Sleeping in javascript

2010-09-27 Thread Gregory Schlomoff
> I know javascript doesn't have a sleep() per se, but I've tried using
> the setTimeout() function, which I thought was standard,

Technically setTimeout is a member of the window object (you should
write window.setTimeout, but the window object is implicit)

That's why setTimeout doesn't work in QML. There is no windows object.
Same thing for alert(), for example.

Not that this helps solving your problem, but at least I hope it helps
you understand why you can't do some things in QML as you do in JS.

Cheers

On Tue, Sep 28, 2010 at 5:28 AM, Mateu Batle
 wrote:
>  Hi Alex,
>
> one way could be to create a dynamic QML Timer object and customize it
>
> http://doc.qt.nokia.com/4.7-snapshot/qml-timer.html
>
> But maybe there is another solution depending on the specific usage,
> what do you need the timeout for ?
>
> cheers
>  Mat
>
>
> On 09/27/2010 02:59 PM, Alex wrote:
>> Hi,
>>
>> I know javascript doesn't have a sleep() per se, but I've tried using
>> the setTimeout() function, which I thought was standard, like so:
>>
>>         setTimeout("console.log(\"foo\")", 1000)
>>
>> This is the result:
>>
>>         ReferenceError: Can't find variable: setTimeout
>>
>> What is the recommended way to pause/sleep within a javascript block?
>>
>> Thanks,
>> Alex
>> ___
>> Qt-qml mailing list
>> Qt-qml@trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-qml
>
>
> --
> Mateu Batle
> Software Engineer
> Collabora Ltd.
>
> ___
> 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] Getting the size of a QList in QML

2010-09-20 Thread Gregory Schlomoff
I've replied previously that .length works very well for me. Did you
try it again? This is the correct property to get the size of the
list.

On Mon, Sep 20, 2010 at 8:27 PM, Cornelius Hald  wrote:
> On Fri, 2010-09-17 at 14:59 +0200, Cornelius Hald wrote:
>> I'm exposing an object with a QList property to QML. How can
>> I read out the size of that list in QML? I tried .size, .length
>> and .count. Non of them seem to work.
>>
>> Am I missing something? Is it possible at all?
>
> I still didn't find a solution. Could someone please give me a hint?
>
> 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] Semantics of 'return' in a JavaScript block in QML

2010-09-17 Thread Gregory Schlomoff
>
> > 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?
>
>
Sorry, I have checked, and everything is ok with switch. It must have been
either an error on my side, or an unnoticed bug that got fixed by himself.

Most probably the former :)
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Getting the size of a QList in QML

2010-09-17 Thread Gregory Schlomoff
Hi,

I'm using length, no problems at all.


On Fri, Sep 17, 2010 at 7:59 PM, Cornelius Hald  wrote:

> Hi,
>
> I'm exposing an object with a QList property to QML. How can
> I read out the size of that list in QML? I tried .size, .length
> and .count. Non of them seem to work.
>
> Am I missing something? Is it possible at all?
>
> 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] textInput.text not updated instantly

2010-09-17 Thread Gregory Schlomoff
Hi,

Maybe you should use onTextChanged, instead?

Cheers,

Greg

On Fri, Sep 17, 2010 at 5:11 PM, rijubrata bhaumik wrote:

> Hi,
>
> i am using a TextInput element and printing the character thats was
> pressed
> when i press a character, the TextInput.text is updated only in the next
> iteration. I mean console log(event.key) is showing the key that is pressed,
> but it is not updated in the TextInput.text
>
> any suggestions ? i need to send the query.text to process something ..
>
>TextInput {
>
> id: query
>
> text: ""
>
> width: parent.width -10
>
> height: 40
>
>  color: "gray";
>
> font.pointSize:15
>
> font.weight : Font.DemiBold
>
> focus: true
>
> anchors.centerIn:parent
>
>  Keys.onPressed: {
>
> console.log("KEY PRESSED: " + event.key )
>
> //callMe();
>
> console.log("search term: " + query.text);
>
> }
>
>  }
>
>
> regards,
> - Riju
>
> ___
> 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] Semantics of 'return' in a JavaScript block in QML

2010-09-15 Thread Gregory Schlomoff
I'd be definetely in understanding qml "from the grounds up"

Things such as prototype, and how the specifities of qml are implemented
(like the example you gave above), are of huge interest.

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.

Cheers,

Greg

On Sep 16, 2010 7:38 AM,  wrote:

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-compone...
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://li...
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Global mouse coordinates

2010-09-15 Thread Gregory Schlomoff
Ok.

I'm don't know if that's possible in pure QML, but if it's really not
possible, you should be able to do it with a custom QML element.

For example, you could make your own TitleBar class in C++, and use it like
this:

import TitleBar 1.0

Item {
  TitleBar {
width: parent.width
height: 20
  }
}

etc...

 On Wed, Sep 15, 2010 at 11:13 PM, Surik Sayadyan  wrote:

> No. I don't want move item. I want to move application window. I want
> to show QDeclarativeView with Qt::FramelessWindowHint flag and create
> my own title bar on QML.
>
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Global mouse coordinates

2010-09-15 Thread Gregory Schlomoff
Maybe using drag.target ?

On Wed, Sep 15, 2010 at 11:02 PM, Surik Sayadyan  wrote:

> Item::mapToItem(null,mouseX,mouseY) return the same coordinates as in
> mouseX and mouseY.
> Does anyone know how moving the widget on the screen by mouse?
> ___
> 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] Semantics of 'return' in a JavaScript block in QML

2010-09-15 Thread Gregory Schlomoff
>
> where the last evaluated statement is used as return value. This is
> specially useful for one-liners like the one below.


> Text {

  text: condition ? "A" : "B"

}


While we are on this topic, you may want to check out this article.

http://javascriptweblog.wordpress.com/2010/07/26/no-more-ifs-alternatives-to-statement-branching-in-javascript/

It gives an idea of some really cool tricks that you can do in JS


2010/9/15 Eduardo Fleury 

> Hi Pertti.
>
>
> 2010/9/15 Pertti Kellomäki 
>
>> Text {
>>text: { if (condition) {
>>  return "A";
>>   }
>>   return "B";
>> }
>> }
>>
>> (...) 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?
>>
>
> My understanding is that in QML script blocks are implicit functions, and
> the above should be simply a more concise version of:
>
> Text {
> function foobar() {
>
> if (condition)
> return "A";
> return "B";
> }
>
> text: foobar()
> }
>
> Note that there's also a third valid version:
>
> Text {
> text: {
> if (condition)
>  "A"
> else
>  "B"
>  }
> }
>
> where the last evaluated statement is used as return value. This is
> specially useful for one-liners like the one below.
>
> Text {
>   text: condition ? "A" : "B"
> }
>
> Cheers,
> Eduardo
>
> --
> Eduardo M. Fleury
> OpenBossa - INdT
> http://eduardofleury.com/
> http://www.openbossa.org/
>
> ___
> 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] Reordering children

2010-09-11 Thread Gregory Schlomoff
It depends of what you mean by order.

Usually, the order of the children just determine their stacking position
(ie: the second child will stack over the first, the third will be over the
second, etc...). In this case, you can change the stacking order with the z
property.

In your case, the order of the Rectangles determine how the Column will
position them, so what you really have  is a position problem, not an order
problem. And if I recall correctly, the doc for Column states that you can't
dynamically change the position of the items managed by the column.

So what would probably work in your case would be to anchor the rectangles
to each other, and to dynamically change the anchors.

Cheers,

greg

On Sun, Sep 12, 2010 at 9:02 AM, Alex

> wrote:

> Hi all,
>
> Is there a way to dynamically change the child order of a particular
> Item?  For example, suppose I have two Rectangles in a Column, and I
> sometimes need to reverse their order.
>
> Cheers,
> Alex
> ___
> 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] import QtQuick 1.0

2010-09-09 Thread Gregory Schlomoff
I feel this is an excellent move.

I was getting concerned by the fact that once Qt 4.7 will be officially out,
we were going to have to wait a lot until new features were added to QML.

Greg


On Fri, Sep 10, 2010 at 11:48 AM,  wrote:

>  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
>
>
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] partial MouseArea

2010-08-23 Thread Gregory Schlomoff
I would add that from our experience, it should be quite trivial to make
your own C++ component that support complex shapes.


On Tue, Aug 24, 2010 at 8:39 AM,  wrote:

> On 23/08/2010, at 10:36 AM, ext Bartosh Wroblevksy wrote:
>
>  I would like to set a partial MouseArea determine by real coordinates on
> an image. Is this possible in QML?
>
>
> Hi,
>
> Only Rectangular MouseAreas are supported for 4.7.
> http://bugreports.qt.nokia.com/browse/QTBUG-6862 is the suggestion
> currently in the system for supporting more complex shapes -- feel free to
> vote and/or add comments if you have other ideas for 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] What´s the correct QML type for arrays ?

2010-08-19 Thread Gregory Schlomoff
Thanks for sharing. I was wondering for a long time how to use the qml list
type. The documentation gives absolutely no clue that you must use the
bracket syntax, like in C++. I never thought that it was possible to do that
in javascript.


On Thu, Aug 19, 2010 at 8:31 PM, Cornelius Hald  wrote:

> Am 19.08.2010 14:54, schrieb Cornelius Hald:
> > // SlideShow.qml
> > Item {
> >   property string title
> >   property variant slides
> > }
>
> Changing 'variant' to 'list' solved my problem. The correct code
> now looks like this:
>
> Item {
> property string title
> property list slides
> }
>
> Cheers,
> 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] Section header 'always on top'

2010-08-13 Thread Gregory Schlomoff
Hehehe, that's so funny. We made a component that does the exact same thing,
except that we would keep all section headers visible on screen, stacked
either on top or bottom of the ListView, so that you could click on a
section header to jump to this section.

But that's definetely a proof that this is a much needed feature.

And yes, ListView.previousSection / nextSection are much needed!

On Fri, Aug 13, 2010 at 3:10 PM,  wrote:

> Hi,
>
> Wanted to share one exciting (at least IMO) piece of code.
>
> Some existing devices have this fancy visual feature that when scrolling
> a list the section header stays on top and only when the next section
> header scrolls in it 'pushes' the old one away. (See the attached picture)
> Unfortunately QML in Qt 4.7 does not support that kind of property for
> ListView. Section headers always scroll along with the list items. But
> no worries, as the following example (extended from the ListView
> documentation example) does the trick. Hopefully the comments in line
> the code are enough for documentation. Post any comments or questions to
> this list.
>
> As continuation, I am planning to create a couple of JIRA items:
> * To have a section.alwaysOnTop -property (or something similar) for
> ListView (the below trick wouldn't be needed at all)
> * To have a 'ListView.previousSection et al' attached properties
> available also to the section delegate (currently only available for
> item delegate). These would make these kind of things easier to do. Now
> the code has to refer to list & model through their id:s
>
> First a component to draw the section header:
>
>  Code snippet starts  
>
> import Qt 4.7
>
> Rectangle {
> color: "lightsteelblue"
> height: childrenRect.height
> property alias text: hdrText.text
> opacity:  0.85
>
> Text {
> id: hdrText
> font.bold: true
> font.pixelSize:26
> }
> }
>
>  Code snippet ends  
>
> and then the main qml file:
>
> --- Code snippet starts  
>
> import Qt 4.7
>
> Rectangle {
>  id: container
>  width: 200
>  height: 250
>  gradient: Gradient {
>  GradientStop { position:  0.0; color: "#55" }
>  GradientStop { position:  1.0; color: "#ee" }
>  }
>  Rectangle {
>  x: 180
>  width: 20
>  height: parent.height
>  gradient: Gradient {
>  GradientStop { position:  0.0; color: "#ee" }
>  GradientStop { position:  1.0; color: "#55" }
>  }
>  }
>
>  ListModel {
>  id: animalsModel
>  ListElement { name: "Parrot"; size: "Small" }
>  ListElement { name: "Guinea pig"; size: "Small" }
>  ListElement { name: "Mouse"; size: "Small" }
>  ListElement { name: "Sparrow"; size: "Small" }
>  ListElement { name: "Dog"; size: "Medium" }
>  ListElement { name: "Cat"; size: "Medium" }
>  ListElement { name: "Dolphin"; size: "Medium" }
>  ListElement { name: "Seal"; size: "Medium" }
>  ListElement { name: "Elephant"; size: "Large" }
>  ListElement { name: "Blue whale"; size: "Large" }
>  ListElement { name: "Rhino"; size: "Large" }
>  ListElement { name: "Ostrich"; size: "Large" }
>  ListElement { name: "Sperm whale"; size: "Large" }
>  ListElement { name: "Giraffe"; size: "Large" }
>  }
>
>  // The section header delegate
>  Component {
>  id: sectionDelegate
>  Item {
>  id: sectionItem
>  height:  childrenRect.height
>  property real myPos: y - animalsList.contentY
>
>  // For some reason, this does not work
>  //visible: myPos >= 0
>
>  // The visible -property setting(s) below are needed only,
> if SectionHeader has transparency (opacity < 1.0)
>  onMyPosChanged: {
>  if (animalsList.contentY >= 0) {
>  if (myPos < height*2 && myPos > -height*2) {
>  // In the 'hot' area
>
>  // Set the correct text.
>  if (myPos < 0) {
>  sectionHeader.text = section
>  visible = false
>  }
>  else {
>  // Oooh, would it be nice to have
> 'previousSection' property
>
>  // One can do this, if there is a
> cacheBuffer for the list, if not I sometimes get undefined from get() as
>  // the listitem above the section header
> is already deleted
>  //sectionHeader.text = y >= 1 ?
> animalsModel.get(animalsList.indexAt(0, y-1)).size :
> animalsModel.get(0).size
>
>  // Safer version that does not require
> cacheBuffer for the animalsList
>  var nextIndex = animalsList.indexAt(0,
> y+

Re: [Qt-qml] Replacing a C++ listview with QML listview

2010-08-13 Thread Gregory Schlomoff
I agree that developer.qt.nokia.com would be the right place for this, and
give it some real credibility.

I just don't see how to make this out of a wiki... To me, the key points are
screenshots + comments + ratings. I've learned that after using extensively
CakePHP's bakery. And the later two don't seem to accomodate a wiki very
well. But I admit that I have strictly no experience with wikis.

On Fri, Aug 13, 2010 at 2:19 PM,  wrote:

>  And once again, my support for this idea. Greg’s idea would work but the
> whole might benefit from some exposure and credibility if we could find a
> way to put it up on developer.qt.nokia.com. Perhaps we could start with
> the wiki (short on features but at least located in the right place) and
> work from that once there’s a little content there?
>
>
>
> Simon.
>
>
>
> *From:* qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com]
> *On Behalf Of *ext Gregory Schlomoff
> *Sent:* 13 August 2010 07:56
> *To:* Westbrook Alan (Nokia-MS/MtView)
> *Cc:* qt-qml@trolltech.com
> *Subject:* Re: [Qt-qml] Replacing a C++ listview with QML listview
>
>
>
> Hello Alan,
>
>
>
> Thanks for the tip. I'll follow your suggestion and rename the 'attachTo'
> property to target.
>
> >So .. Who's going to make a web 2.0 site for sharing QML bits?
>
>
>
> I was meaning to do so as a week-end project, (even purchased a domain
> name) but as I end up working for my main project on the week-ends as
> well... You know how it is. :)
>
>
>
> But now that I see that there is definetely a need here, I'll try to come
> up with something. I was thinking of something similar to CakePHP's
> "Bakery", for those familiar with this framework (
> http://bakery.cakephp.org/categories/view/7)
>
>
>
> Basically, a gallery of components with a brief explanation, a link to a
> repository, comments, ratings, tags, etc... Something simple and functional.
>
>
>
>
>
> On Fri, Aug 13, 2010 at 1:06 PM,  wrote:
>
> Hey Greg,
>
>
>
> Thanks for sharing the scrollbar, just a suggestion, as the rest of the QML
> API seems to use 'target' for components that affect other components,
> perhaps you should change the 'attachTo' to 'target'
>
>
>
> So .. Who's going to make a web 2.0 site for sharing QML bits?
>
>
>
> =)
>
>
>
> Alan
>
>
>
> On Aug 12, 2010, at 8:18 PM, ext Gregory Schlomoff wrote:
>
>
>
>  Hi guys,
>
>
>
> Since there were a few people asking for our Scrollbar component, I just
> published it in a public Mercurial repository. It lives here:
>
>
>
> https://bitbucket.org/gregschlom/qmlscrollbar
>
>
>
> If you're not using mercurial, there's a "get sources" link on the right
> that allows you to download a zip file.
>
>
>
> I've included a sample qml file demonstrating the usage, as well as the
> images and the photoshop file for the Scrollbar. Obvioously, you'll want to
> change that to use yours.
>
>
>
> The code is released under the MIT license. It may have bugs, and it
> probabably can be enhanced (adding support for horizontal scrolling, for
> example). If you make any changes that make this code better, please feel
> free to submit patches / merge requests.
>
>
>
> Cheers,
>
>
>
> Greg
>
>
>
>
>
>
>
> On Thu, Aug 12, 2010 at 8:40 PM, Gregory Schlomoff <
> gregory.schlom...@gmail.com> wrote:
>
> We are using QML ListViews in our desktop app. It works well... Now that a
> lot of bugs have been fixed, and that we really understand how ListView
> works :)
>
>
>
> As for the scrollbar, we made a quick Scrollbar component that works very
> well. The code looks like this:
>
>
>
> ListView {
>
>   id: myList
>
> ...
>
> }
>
> ScrollBar {
>
>   attachTo: myList
>
> }
>
>
>
> The scrollbar can be attached to any Flickable (so that includes ListView).
> But it only works for vertical scrolling, as of now. We may share the code
> for this component, if it's of any interest to you. Just drop me a mail.
>
>
>
> (By the way, that raises again the question of a public place to share qml
> componentns :) )
>
>
>
> Cheers
>
>
>
> greg
>
>
>
>
>
> On Thu, Aug 12, 2010 at 8:31 PM, Riaan Kruger  wrote:
>
>  I am playing with QML and is considering replacing a listview in a C++
> (desktop) application with a QML based listview using qdeclarativeview.
>
> I want to do this to demonstrate the capabilities of QML and because I find
> customizing list/tree views in Qt C++ hard.
>
>
>
> Is this a good idea, or am I in for some hurt?
>
> What is the best strategy for handling scrolling; scrollbars are normally
> preferred on the desktop
>
>
>
>
>
> Riaan
>
>
>
> ___
> 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] Replacing a C++ listview with QML listview

2010-08-12 Thread Gregory Schlomoff
Hello Alan,

Thanks for the tip. I'll follow your suggestion and rename the 'attachTo'
property to target.

>So .. Who's going to make a web 2.0 site for sharing QML bits?

I was meaning to do so as a week-end project, (even purchased a domain name)
but as I end up working for my main project on the week-ends as well... You
know how it is. :)

But now that I see that there is definetely a need here, I'll try to come up
with something. I was thinking of something similar to CakePHP's "Bakery",
for those familiar with this framework (
http://bakery.cakephp.org/categories/view/7)

Basically, a gallery of components with a brief explanation, a link to a
repository, comments, ratings, tags, etc... Something simple and functional.


On Fri, Aug 13, 2010 at 1:06 PM,  wrote:

> Hey Greg,
>
> Thanks for sharing the scrollbar, just a suggestion, as the rest of the QML
> API seems to use 'target' for components that affect other components,
> perhaps you should change the 'attachTo' to 'target'
>
> So .. Who's going to make a web 2.0 site for sharing QML bits?
>
> =)
>
> Alan
>
> On Aug 12, 2010, at 8:18 PM, ext Gregory Schlomoff wrote:
>
> Hi guys,
>
> Since there were a few people asking for our Scrollbar component, I just
> published it in a public Mercurial repository. It lives here:
>
> https://bitbucket.org/gregschlom/qmlscrollbar
>
> <https://bitbucket.org/gregschlom/qmlscrollbar>If you're not using
> mercurial, there's a "get sources" link on the right that allows you to
> download a zip file.
>
> I've included a sample qml file demonstrating the usage, as well as the
> images and the photoshop file for the Scrollbar. Obvioously, you'll want to
> change that to use yours.
>
> The code is released under the MIT license. It may have bugs, and it
> probabably can be enhanced (adding support for horizontal scrolling, for
> example). If you make any changes that make this code better, please feel
> free to submit patches / merge requests.
>
> Cheers,
>
> Greg
>
>
>
> On Thu, Aug 12, 2010 at 8:40 PM, Gregory Schlomoff <
> gregory.schlom...@gmail.com> wrote:
>
>> We are using QML ListViews in our desktop app. It works well... Now that a
>> lot of bugs have been fixed, and that we really understand how ListView
>> works :)
>>
>> As for the scrollbar, we made a quick Scrollbar component that works very
>> well. The code looks like this:
>>
>> ListView {
>>   id: myList
>> ...
>> }
>> ScrollBar {
>>   attachTo: myList
>> }
>>
>> The scrollbar can be attached to any Flickable (so that includes
>> ListView). But it only works for vertical scrolling, as of now. We may share
>> the code for this component, if it's of any interest to you. Just drop me a
>> mail.
>>
>> (By the way, that raises again the question of a public place to share qml
>> componentns :) )
>>
>> Cheers
>>
>> greg
>>
>>
>>  On Thu, Aug 12, 2010 at 8:31 PM, Riaan Kruger  wrote:
>>
>>>  I am playing with QML and is considering replacing a listview in a C++
>>> (desktop) application with a QML based listview using qdeclarativeview.
>>> I want to do this to demonstrate the capabilities of QML and because I
>>> find customizing list/tree views in Qt C++ hard.
>>>
>>> Is this a good idea, or am I in for some hurt?
>>> What is the best strategy for handling scrolling; scrollbars are normally
>>> preferred on the desktop
>>>
>>>
>>> Riaan
>>>
>>> ___
>>> 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] Replacing a C++ listview with QML listview

2010-08-12 Thread Gregory Schlomoff
Hi guys,

Since there were a few people asking for our Scrollbar component, I just
published it in a public Mercurial repository. It lives here:

https://bitbucket.org/gregschlom/qmlscrollbar

<https://bitbucket.org/gregschlom/qmlscrollbar>If you're not using
mercurial, there's a "get sources" link on the right that allows you to
download a zip file.

I've included a sample qml file demonstrating the usage, as well as the
images and the photoshop file for the Scrollbar. Obvioously, you'll want to
change that to use yours.

The code is released under the MIT license. It may have bugs, and it
probabably can be enhanced (adding support for horizontal scrolling, for
example). If you make any changes that make this code better, please feel
free to submit patches / merge requests.

Cheers,

Greg



On Thu, Aug 12, 2010 at 8:40 PM, Gregory Schlomoff <
gregory.schlom...@gmail.com> wrote:

> We are using QML ListViews in our desktop app. It works well... Now that a
> lot of bugs have been fixed, and that we really understand how ListView
> works :)
>
> As for the scrollbar, we made a quick Scrollbar component that works very
> well. The code looks like this:
>
> ListView {
>   id: myList
> ...
> }
> ScrollBar {
>   attachTo: myList
> }
>
> The scrollbar can be attached to any Flickable (so that includes ListView).
> But it only works for vertical scrolling, as of now. We may share the code
> for this component, if it's of any interest to you. Just drop me a mail.
>
> (By the way, that raises again the question of a public place to share qml
> componentns :) )
>
> Cheers
>
> greg
>
>
>  On Thu, Aug 12, 2010 at 8:31 PM, Riaan Kruger  wrote:
>
>>  I am playing with QML and is considering replacing a listview in a C++
>> (desktop) application with a QML based listview using qdeclarativeview.
>> I want to do this to demonstrate the capabilities of QML and because I
>> find customizing list/tree views in Qt C++ hard.
>>
>> Is this a good idea, or am I in for some hurt?
>> What is the best strategy for handling scrolling; scrollbars are normally
>> preferred on the desktop
>>
>>
>> Riaan
>>
>> ___
>> 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] Replacing a C++ listview with QML listview

2010-08-12 Thread Gregory Schlomoff
We are using QML ListViews in our desktop app. It works well... Now that a
lot of bugs have been fixed, and that we really understand how ListView
works :)

As for the scrollbar, we made a quick Scrollbar component that works very
well. The code looks like this:

ListView {
  id: myList
...
}
ScrollBar {
  attachTo: myList
}

The scrollbar can be attached to any Flickable (so that includes ListView).
But it only works for vertical scrolling, as of now. We may share the code
for this component, if it's of any interest to you. Just drop me a mail.

(By the way, that raises again the question of a public place to share qml
componentns :) )

Cheers

greg


On Thu, Aug 12, 2010 at 8:31 PM, Riaan Kruger  wrote:

> I am playing with QML and is considering replacing a listview in a C++
> (desktop) application with a QML based listview using qdeclarativeview.
> I want to do this to demonstrate the capabilities of QML and because I find
> customizing list/tree views in Qt C++ hard.
>
> Is this a good idea, or am I in for some hurt?
> What is the best strategy for handling scrolling; scrollbars are normally
> preferred on the desktop
>
>
> Riaan
>
> ___
> 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] Why the need for QDeclarativeListProperty?

2010-08-10 Thread Gregory Schlomoff
Hello,

As we dive more and more into the QML world, we started making C++ code that
needed to define QDeclarativeListProperties.

At first, QDLP can be quite intimidating: you don't really know what to make
of those static functions, then you feel relieved when you see that there is
a constructor that takes a QList, just to discover moments later that the
doc strongly advises against using it, "as a writable QList violates QML's
memory management rules".

So in the end, you end up writing the needed static functions, that interact
with your own QList, but you don't really know why/if this is any better
than using the QDLP constructor with a QList. And actually you don't really
understand the need for the QDLP in the first place...

That's why I'm writing here to see if someone could explain:

1. Why QDeclarativeListProperty is needed, why a QList wouldn't do the job?

2. What's wrong with the constructor that takes a QList? what does it mean
that "a writable QList violates QML's memory management rules"?

3. What's the right way to make a QDLP out of a QList?

4. And finally, why QDLP had to be implemented this way, with those static
functions?

Also, please note that there is no ranting here. I just want to get a better
understanding of the motivations and the needs behind the QDLP so that I
understand what I'm doing.

Thanks in advance to anyone who is willing to take some time to clarify
this!

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


Re: [Qt-qml] enumerations in QML

2010-08-04 Thread Gregory Schlomoff
Thanks Bea, that's exactly what I needed!

Yes, should be nice to see that in the reference documentation

geg

On Thu, Aug 5, 2010 at 12:03 PM,   wrote:
>
> On 05/08/2010, at 2:45 PM, ext Gregory Schlomoff wrote:
>
>> Isn't there a way to expose an enum to QML with qRegisterType or something?
>>
>
> If an enum is exposed to Qt's Meta Object system using Q_ENUMS, the enum is 
> automatically available to QML.
>
> This is mentioned in 
> http://doc.qt.nokia.com/4.7-snapshot/declarative-tutorials-extending-chapter4-custompropertytypes.html
>  (but probably should be moved to some other reference documentation).
>
>
> regards,
>
> Bea
>
>
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] enumerations in QML

2010-08-04 Thread Gregory Schlomoff
Edit: a work around that I just found:

=== MyScrollbar.qml ==

Rectangle {
  property int orientation: undefined
  property alias scrollbar: scrollbar

QtObject {  // this is my "enum" :)
  id: scrollbar
  property int vertical: 1
  property int horizontal: 2
}

[...]
}

=== app.qml ===

MyScrollbar {
  orientation: scrollbar.vertical
}



On Thu, Aug 5, 2010 at 11:45 AM, Gregory Schlomoff
 wrote:
> Isn't there a way to expose an enum to QML with qRegisterType or something?
>
> How do you guys expose enumerations to QML?
>
> While I understand that Javascript is weakly typed and hasn't such
> concept as constants, when you are developing generic components, it's
> very scary to do stuff like that:
>
> MyScrollbar {
>  orientation: "vertical"
> }
>
> You just know that one day someone is going to mispell "vertical" or
> "horizontal", and the guy is going to have a hard time debugging the
> issue.
>
> In this case, I worked around the problem by reusing a Qt global enum,
> but that doesn't always work:
>
> MyScrollbar {
>  orientation: Qt.Vertical  //much better :)
> }
>
>
>
> On Thu, Aug 5, 2010 at 11:11 AM, Alan Alpert  wrote:
>> On Thu, 5 Aug 2010 10:36:29 ext Alex wrote:
>>> Is there any way to declare enumerations in QML?  For example, assume I
>>> have a custom element called "MyText" that has a property called
>>> sizeType, for which the possible values are: "small", "medium", or
>>> "big."
>>>
>>> The implementation of MyText will set the correct point or pixel size
>>> based on the value of sizeType.  Is there a way to expose the possible
>>> values using an enum (e.g., MyText::SizeBig) rather than something
>>> more primitive like int or string?
>>
>> Not from QML. From what I understand, since Javascript is a weakly typed
>> language anyways, the appropriate Javascript way is to just use a string
>> (which has valid values of "small", "medium" and "large", and a specified
>> behavior for invalid values).
>>
>>> Similarly, what is the best way to declare constants?
>>
>> Again my understanding of Javascript suggests that you create constants by
>> having variables that you ask people not to set. Same for when using
>> Javascript in QML.
>>
>> These concepts make more sense in a statically typed language like C++ than 
>> in
>> a dynamically typed language like Javascript. So, while it's acceptable to 
>> let
>> the terms leak in from C++ due to the tight C++ integration in QML, I don't
>> think you should worry about them too much when writing pure QML. If you want
>> very concrete elements, perhaps you should write them in C++.
>>
>> --
>> 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] enumerations in QML

2010-08-04 Thread Gregory Schlomoff
Isn't there a way to expose an enum to QML with qRegisterType or something?

How do you guys expose enumerations to QML?

While I understand that Javascript is weakly typed and hasn't such
concept as constants, when you are developing generic components, it's
very scary to do stuff like that:

MyScrollbar {
  orientation: "vertical"
}

You just know that one day someone is going to mispell "vertical" or
"horizontal", and the guy is going to have a hard time debugging the
issue.

In this case, I worked around the problem by reusing a Qt global enum,
but that doesn't always work:

MyScrollbar {
  orientation: Qt.Vertical  //much better :)
}



On Thu, Aug 5, 2010 at 11:11 AM, Alan Alpert  wrote:
> On Thu, 5 Aug 2010 10:36:29 ext Alex wrote:
>> Is there any way to declare enumerations in QML?  For example, assume I
>> have a custom element called "MyText" that has a property called
>> sizeType, for which the possible values are: "small", "medium", or
>> "big."
>>
>> The implementation of MyText will set the correct point or pixel size
>> based on the value of sizeType.  Is there a way to expose the possible
>> values using an enum (e.g., MyText::SizeBig) rather than something
>> more primitive like int or string?
>
> Not from QML. From what I understand, since Javascript is a weakly typed
> language anyways, the appropriate Javascript way is to just use a string
> (which has valid values of "small", "medium" and "large", and a specified
> behavior for invalid values).
>
>> Similarly, what is the best way to declare constants?
>
> Again my understanding of Javascript suggests that you create constants by
> having variables that you ask people not to set. Same for when using
> Javascript in QML.
>
> These concepts make more sense in a statically typed language like C++ than in
> a dynamically typed language like Javascript. So, while it's acceptable to let
> the terms leak in from C++ due to the tight C++ integration in QML, I don't
> think you should worry about them too much when writing pure QML. If you want
> very concrete elements, perhaps you should write them in C++.
>
> --
> 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] enumerations in QML

2010-08-04 Thread Gregory Schlomoff
+1, same question here


On Thu, Aug 5, 2010 at 7:36 AM, Alex  wrote:
> [ Sorry, I'll stop flooding the mailing list in a minute :-)  ]
>
> Is there any way to declare enumerations in QML?  For example, assume I
> have a custom element called "MyText" that has a property called
> sizeType, for which the possible values are: "small", "medium", or
> "big."
>
> The implementation of MyText will set the correct point or pixel size
> based on the value of sizeType.  Is there a way to expose the possible
> values using an enum (e.g., MyText::SizeBig) rather than something
> more primitive like int or string?
>
> Similarly, what is the best way to declare constants?
>
> Thanks,
> Alex
> ___
> 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 Gregory Schlomoff
Further investigation made clear that onFocusChange is not being
emitted when the item is inside a FocusScope. I filed a bug for that:
http://bugreports.qt.nokia.com/browse/QTBUG-12649

Thanks.

Greg


On Wed, Aug 4, 2010 at 7:02 PM,   wrote:
> 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


[Qt-qml] Why FocusChange is never emitted?

2010-08-04 Thread Gregory Schlomoff
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


Re: [Qt-qml] QDeclarativeItem subclasses and mouse events

2010-08-04 Thread Gregory Schlomoff
This gets me thinking: it would be really nice if there were more
information on what exactly QML is doing behind the scene. What
impacts performance, and what doesn't.

What costs the most, in QML? Bindings? Javascript evaluation? Memory
allocation for items? And why? Yes, I'm aware that some of those
questions have an answer on
http://doc.qt.nokia.com/main-snapshot/qdeclarativeperformance.html but
they only give the do's and dont's here, not the why.


On Wed, Aug 4, 2010 at 5:17 PM, Jan Ekholm  wrote:
> On Wednesday 04 August 2010 05:53:13 michael.bras...@nokia.com wrote:
>> Hi,
>>
>> On 03/08/2010, at 4:55 AM, ext Jan Ekholm wrote:
>> > I was recommended to make a C++ QDeclarativeItem subclass for my game map
>> > tiles to get better performance. This worked well
>>
>> Given the simplicity of the QML tile (from http://gitorious.org/tactics),
>> I'm a bit surprised that using a C++ item made a difference in
>> performance. What sort of performance issues were you seeing, and on what
>> platform(s)?
>
> The most noticeable difference is when creating the scene, i.e. when the QML
> file is loaded. A base based on the old Image item that I used instead of a
> C++ Hex took a lot longer to set up. I tried to get rid of the slow sounding
> Repeater too, but that can not be done with QML just yet. But that simple
> change made scenes much faster to load and the panning is a bit smoother too.
>
> I never really had any panning issues, not even on an N900, but setup time was
> not exactly fast. As there is a fair deal of QML used the time just seemed to
> get longer and longer. On a fast desktop PC it took 3-10 to load the initial
> game QML file that also sets up the map. Now it's much faster.
>
> --
>           "Right, you bastards, you're... you're geography"
>                                         -- Terry Pratchett, Guards! Guards!
>
> ___
> 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] QDeclarativeItem subclasses and mouse events

2010-08-02 Thread Gregory Schlomoff
Hello !

You may want to have a look at our code for drag and drop, it's working well:

http://bitbucket.org/gregschlom/qml-drag-drop

(and more specifically
http://bitbucket.org/gregschlom/qml-drag-drop/src/tip/DeclarativeDragArea.cpp
)

On Tue, Aug 3, 2010 at 3:13 AM, Jan Ekholm  wrote:
> On Monday 02 August 2010 22:22:25 alexis.men...@nokia.com wrote:
>> Hello,
>>
>> QDeclarativeItemPrivate constructor does this :
>>
>> QGraphicsItemPrivate::acceptedMouseButtons = 0;
>>
>> which means that no mousePress/mouseMove/mouseRelease will be delivered.
>>
>> You need to call setAcceptedMouseButtons in your C++ item with the buttons
>> you want.
>
> ...
>
>> I think either we should document that the default values are different
>> than QGraphicsItem or we should bind Item{} to something else, otherwise
>> we will get lot of mails/bug reports like this, just because the default
>> values of QDeclarativeItem are different than the one in QGraphicsItem.
>
> Ok, I read the docs for QGraphicsItem and saw this property mentioned. I was
> about to test setting it, but as the docs says:
>
> "Mouse press events are only delivered to items that accept the mouse button
> that is pressed. By default, an item accepts all mouse buttons, but you can
> change this by calling setAcceptedMouseButtons()."
>
> I didn't test it. However, adding in my constructor:
>
>    setAcceptedMouseButtons( Qt::LeftButton );
>
> makes no difference, I still see no events. Makes me suspect something else.
> The C++ item itself has been used extensively as a plain QGraphicsItem before
> in a QGraphicsView based system, and should be just fine. I more or less only
> changed it to subclass QDeclarativeItem.
>
> I need to debug deeper, it seems.
>
> --
>
>  He says gods like to see an atheist around. Gives them something to aim at.
>                                            -- Terry Pratchett, Small Gods
> ___
> 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 Gregory Schlomoff
>> Also while trying to debug I attempted to set a break point.  Are
>> break points possible in QML?

There is some early support for breakpoints and debugging javascript
in QML with the latest version of Qt Creator, but it's still
experimental, and it works only for pure qml apps (you can't debug QML
code inside a C++ app)

If you want to give it a try, you just have to clone the qt-creator
repository and build it.

greg

On Thu, Jul 29, 2010 at 2:10 PM,   wrote:
> 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
>
>
> ___
> 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] Repeater inside delegate ?

2010-07-28 Thread Gregory Schlomoff
I guess you may do that by nesting a new ListModel inside each
ListElement, but that's not really practical

On Wed, Jul 28, 2010 at 5:34 PM, Stephen Collyer
 wrote:
> Given a model like so:
>
>     ListModel
>     {
>     id: people_model
>
>     ListElement
>     {
>     name: "John Smith"
>     role: "manager"
>     age: 36
>     }
>  ...
>     }
>
> I'd like to have a delegate with a Repeater that accesses the various
> properties of the model in some order:
>
>     Component
>     {
>     id: people_delegate
>     Item
>     {
>     Row
>     {
>     Repeater
>     {
>     Rectangle
>     {
>     width: parent.width/3
>     Text
>     {
>     text: 
>     color: "white"
>     }
>     }
>     }
>
> It's not clear to me if I can access named properties of the model
> inside a Repeater, however. Is this possible ?
>
> Given that the Repeater doesn't know which model it's working on,
> I can't see how this could be done at present, but it strikes me
> as potentially useful.
>
> --
> Stephen Collyer
>
> ___
> 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] Loading external QML files

2010-07-27 Thread Gregory Schlomoff
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. ...@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
>
>

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


Re: [Qt-qml] Where do the bug fixes go?

2010-07-23 Thread Gregory Schlomoff
Nevermind, I just found it :
http://qt.gitorious.org/+qt-developers/qt/staging/commits/qml/4.7

greg

On Fri, Jul 23, 2010 at 6:25 PM, Gregory Schlomoff <
gregory.schlom...@gmail.com> wrote:

> Can someone be kind enough to provide us with a link?
>
> I can't see any qt-qml branch under
> http://qt.gitorious.org/+qt-developers/qt/staging/
>
> Or maybe it is still too early, and the branch will appear later?
>
> <http://qt.gitorious.org/+qt-developers/qt/staging/>Thanks!
>
> greg
>
>
> On Fri, Jul 23, 2010 at 9:51 AM,  wrote:
>
>> It is now being mirrored (thanks Warwick and Rohan).
>>
>> Michael
>>
>> On 23/07/2010, at 2:47 AM, ext Olivier Goffart wrote:
>>
>> > Hi,
>> >
>> > You are right,  It seems that the qt-qml branches are not mirrored in
>> the
>> > public qt-staging repository.
>> >
>> > Rohan, maybe you can fix this?
>> >
>> >
>> > On Thursday, 22. July 2010 18:30:16 ext Stephen Kelly wrote:
>> >> I can't seem to get it from there:
>> >>
>> >> kde-de...@chimera:~/kde/src/qt(4.7)$ git show
>> >> 64833c0a648211f3fe7547436f022edc0ceb51ac
>> >> fatal: bad object 64833c0a648211f3fe7547436f022edc0ceb51ac
>> >>
>> >>
>> >> kde-de...@chimera:~/kde/src/qt(4.7)$ git fetch staging
>> >> remote: Counting objects: 559, done.
>> >> remote: Compressing objects: 100% (250/250), done.
>> >> remote: Total 251 (delta 212), reused 0 (delta 0)
>> >> Receiving objects: 100% (251/251), 274.86 KiB | 366 KiB/s, done.
>> >> Resolving deltas: 100% (212/212), completed with 125 local objects.
>> >> From git://gitorious.org/+qt-developers/qt/staging
>> >>   a1a3535..4981895  multimedia/4.6 -> staging/multimedia/4.6
>> >>   3a7b706..07f1319  multimedia/4.7 -> staging/multimedia/4.7
>> >>   8669542..6b6778c  oslo-1/4.6 -> staging/oslo-1/4.6
>> >>   3fad4bd..62b2022  oslo-1/4.7 -> staging/oslo-1/4.7
>> >>   a1a3535..4981895  oslo-2/4.6 -> staging/oslo-2/4.6
>> >>   22e0ebd..c4bea74  oslo-2/4.7 -> staging/oslo-2/4.7
>> >>   df6549d..c8bb76e  oslo-2/master -> staging/oslo-2/master
>> >>   a1a3535..4981895  s60/4.6-> staging/s60/4.6
>> >>   ebe6a52..4280c4c  s60/4.7-> staging/s60/4.7
>> >> kde-de...@chimera:~/kde/src/qt(4.7)$ git show
>> >> 64833c0a648211f3fe7547436f022edc0ceb51ac
>> >> fatal: bad object 64833c0a648211f3fe7547436f022edc0ceb51ac
>> >> kde-de...@chimera:~/kde/src/qt(4.7)$ git remote show staging
>> >> * remote staging
>> >>  Fetch URL: git://gitorious.org/+qt-developers/qt/staging.git
>> >>  Push  URL: git://gitorious.org/+qt-developers/qt/staging.git
>> >>  HEAD branch (remote HEAD is ambiguous, may be one of the following):
>> >>multimedia/master
>> >>oslo-1/master
>> >>s60/master
>> >>  Remote branches:
>> >>berlin-1/4.6-continuous-integration tracked
>> >>berlin-1/fake-mastertracked
>> >>doc-1/4.5   tracked
>> >>doc-1/4.6   tracked
>> >>doc-1/4.6-stabletracked
>> >>doc-1/mastertracked
>> >>doc-1/master-stable tracked
>> >>multimedia/4.5  tracked
>> >>multimedia/4.6  tracked
>> >>multimedia/4.6-stable   tracked
>> >>multimedia/4.7  tracked
>> >>multimedia/master   tracked
>> >>multimedia/master-stabletracked
>> >>oslo-1/4.6  tracked
>> >>oslo-1/4.6-continuous-integration   tracked
>> >>oslo-1/4.6-stable   tracked
>> >>oslo-1/4.7  tracked
>> >>oslo-1/4.7-cutoff   tracked
>> >>oslo-1/master   tracked
>> >>oslo-1/master-stabletracked
>> >>oslo-1/os1-4.7  tracked
>> >>oslo-2/4.6  tracked
>> >>oslo-2/4.6-continuous-integration   tracked
>> >>oslo-2/4.6-stable   tracked
>> >>oslo-2/4.7  tracked
>> >>oslo-2/master   tracked
>>

Re: [Qt-qml] Where do the bug fixes go?

2010-07-23 Thread Gregory Schlomoff
Can someone be kind enough to provide us with a link?

I can't see any qt-qml branch under
http://qt.gitorious.org/+qt-developers/qt/staging/

Or maybe it is still too early, and the branch will appear later?

Thanks!

greg

On Fri, Jul 23, 2010 at 9:51 AM,  wrote:

> It is now being mirrored (thanks Warwick and Rohan).
>
> Michael
>
> On 23/07/2010, at 2:47 AM, ext Olivier Goffart wrote:
>
> > Hi,
> >
> > You are right,  It seems that the qt-qml branches are not mirrored in the
> > public qt-staging repository.
> >
> > Rohan, maybe you can fix this?
> >
> >
> > On Thursday, 22. July 2010 18:30:16 ext Stephen Kelly wrote:
> >> I can't seem to get it from there:
> >>
> >> kde-de...@chimera:~/kde/src/qt(4.7)$ git show
> >> 64833c0a648211f3fe7547436f022edc0ceb51ac
> >> fatal: bad object 64833c0a648211f3fe7547436f022edc0ceb51ac
> >>
> >>
> >> kde-de...@chimera:~/kde/src/qt(4.7)$ git fetch staging
> >> remote: Counting objects: 559, done.
> >> remote: Compressing objects: 100% (250/250), done.
> >> remote: Total 251 (delta 212), reused 0 (delta 0)
> >> Receiving objects: 100% (251/251), 274.86 KiB | 366 KiB/s, done.
> >> Resolving deltas: 100% (212/212), completed with 125 local objects.
> >> From git://gitorious.org/+qt-developers/qt/staging
> >>   a1a3535..4981895  multimedia/4.6 -> staging/multimedia/4.6
> >>   3a7b706..07f1319  multimedia/4.7 -> staging/multimedia/4.7
> >>   8669542..6b6778c  oslo-1/4.6 -> staging/oslo-1/4.6
> >>   3fad4bd..62b2022  oslo-1/4.7 -> staging/oslo-1/4.7
> >>   a1a3535..4981895  oslo-2/4.6 -> staging/oslo-2/4.6
> >>   22e0ebd..c4bea74  oslo-2/4.7 -> staging/oslo-2/4.7
> >>   df6549d..c8bb76e  oslo-2/master -> staging/oslo-2/master
> >>   a1a3535..4981895  s60/4.6-> staging/s60/4.6
> >>   ebe6a52..4280c4c  s60/4.7-> staging/s60/4.7
> >> kde-de...@chimera:~/kde/src/qt(4.7)$ git show
> >> 64833c0a648211f3fe7547436f022edc0ceb51ac
> >> fatal: bad object 64833c0a648211f3fe7547436f022edc0ceb51ac
> >> kde-de...@chimera:~/kde/src/qt(4.7)$ git remote show staging
> >> * remote staging
> >>  Fetch URL: git://gitorious.org/+qt-developers/qt/staging.git
> >>  Push  URL: git://gitorious.org/+qt-developers/qt/staging.git
> >>  HEAD branch (remote HEAD is ambiguous, may be one of the following):
> >>multimedia/master
> >>oslo-1/master
> >>s60/master
> >>  Remote branches:
> >>berlin-1/4.6-continuous-integration tracked
> >>berlin-1/fake-mastertracked
> >>doc-1/4.5   tracked
> >>doc-1/4.6   tracked
> >>doc-1/4.6-stabletracked
> >>doc-1/mastertracked
> >>doc-1/master-stable tracked
> >>multimedia/4.5  tracked
> >>multimedia/4.6  tracked
> >>multimedia/4.6-stable   tracked
> >>multimedia/4.7  tracked
> >>multimedia/master   tracked
> >>multimedia/master-stabletracked
> >>oslo-1/4.6  tracked
> >>oslo-1/4.6-continuous-integration   tracked
> >>oslo-1/4.6-stable   tracked
> >>oslo-1/4.7  tracked
> >>oslo-1/4.7-cutoff   tracked
> >>oslo-1/master   tracked
> >>oslo-1/master-stabletracked
> >>oslo-1/os1-4.7  tracked
> >>oslo-2/4.6  tracked
> >>oslo-2/4.6-continuous-integration   tracked
> >>oslo-2/4.6-stable   tracked
> >>oslo-2/4.7  tracked
> >>oslo-2/master   tracked
> >>s60/4.6 tracked
> >>s60/4.6-continuous-integration  tracked
> >>s60/4.7 tracked
> >>s60/4.8 tracked
> >>s60/ConnectivityCamptracked
> >>s60/DocUpdatesForSymbiantracked
> >>s60/NetworkCleanup  tracked
> >>s60/SymbianFilePerf tracked
> >>s60/armv6-atomics   tracked
> >>s60/gcce-fixes  tracked
> >>s60/linkingFixestracked
> >>s60/master  tracked
> >>s60/mmfphonon   tracked
> >>s60/multimedia-audiotracked
> >>s60/native-fileengine   tracked
> >>s60/nativeresolver  tracked
> >>s60/new-symbian-allocator   tracked
> >>s60/no-tmp-dirs tracked
> >>s60/s60-mkspec-docs tracked
> >>s60/s60-webkit-stufftracked
> >>s60/s60_webkit_experimental tracked
> >>s60/static-linkage  tracked
> >>s60/translucent-overlay tracked
> >>s60/windowGroupstracked
> >

[Qt-qml] GridView with variable row height?

2010-07-23 Thread Gregory Schlomoff
Hi guys,

As far as I can see, GridView only supports cells that all have the same
height and width. But what if you need to display data in a table, pretty
much like an HTML table, that requires row of variable height to adapt to
the content height?

So far, we can see several options :

1. Use a Repeater to instantiate all our cells, then use JS + anchoring to
anchor the cells to each other. Put the whole thing inside a Flickable, and
you're done. But it is cumbersome.

2. Make our own TableView element in C++, possibly by ripping some code off
GridView. But it seems difficult (qdeclarativegridview.cpp is 2600 lines of
code). And it is even harder as we have no easy access to other QDeclarative
classes, like QDeclarativeFlickable

3. Post to this mailing-list and hope that someone will find a solution, or
even better, some troll will say "sure, let's just create a TableView
element" :)

What are your thoughts on this?

Thanks a lot!

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


Re: [Qt-qml] Component element: what is it for ?

2010-07-22 Thread Gregory Schlomoff
To add my thoughts here :

Conceptually, I think that Component are exactly like external QML
files. I think of components as a way to put in the same file the code
that you would otherwise have written in a separate file.

> Though I do not understand the difference between Loader.onLoaded() and
> Component.onComplete()

I'm am using Component.onCompleted: {}  a lot, throughout my code, to
add JS code that should run at initialization. My understanding is
that every QML file is a component, and has the onCompleted event
available.

Thus you can write :

== SomeFile.qml ==
import Qt 4.7
Rectangle {
  ...
  Component.onLoaded: {console.log("hello")}
}

Loader.onLoaded, on the other hand, is only available for loader items, I guess.


On Fri, Jul 23, 2010 at 12:50 AM, Jason H  wrote:
> I believe that components can be instantiated but take some time to load. So
> they support a completed notification. So that once they are done loading
> you can show something atomically, and not as parts come in.
>
> Though I do not understand the difference between Loader.onLoaded() and
> Component.onComplete()
>
> I don't understand the use of Component.url. It is read-only, but this seems
> like it should be settable to resolve to remote components?
>
>
>
> 
> From: Stephen Collyer 
> Cc: qt-qml@trolltech.com
> Sent: Thu, July 22, 2010 11:57:35 AM
> Subject: Re: [Qt-qml] Component element: what is it for ?
>
> On 22 July 2010 16:44, Sacha Zyto  wrote:
>>
>> Hi Stephen,
>>
>> My understanding is that an Item placed inside a widget will be included
>> in the UI tree at that place, and hence displayed, which you don't want,
>> say, if you've designed  your component to be used as a "template" or
>> a"lens" in order to be used by a View to render Items that are inside a
>> Model.
>
>
> Right. Assuming that your explanation is correct, that makes sense.
> In that case, a Component is essentially the QML equivalent of a
> class, defining an object template but not instantiating it. I'll have to
> play
> around with this to see exactly how it works.
>
> Does an Item, conversely, both define an object template and
> instantiate it, so that an Item can be used anywhere a Component
> can be used ?
>
> --
> Stephen Collyer
>
>
> ___
> 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] Is there a way to randomize the display of items in views

2010-07-22 Thread Gregory Schlomoff
There is a Math.random() function under javascript. One solution would be to
use it with ListModel.move() to shuffle the ListModel after it has been
created.

Another solution would be to have the data come from a C++ model, like a
QList, and to the shuffling from C++.


On Thu, Jul 22, 2010 at 4:24 PM, Shady Zayat  wrote:

> I am using a Row and a Repeater to display data from a ListModel. Is there
> a way to randomize the order of the displayed elements? I'm implementing
> radio group behavior for multiple-choice questions for a learning
> application ( "Choice" is a kind of a radio button  ). I need the choices to
> be displayed in a random order.
>
>   Row {
>
> id: choicesRow
>
> spacing: 10
>
> Repeater {
>
> model: elementChoices
>
> Choice {
>
> id: choice
>
> text: choiceText
>
> onButtonChecked: root.uncheckOthers(choice)
>
> }
>
> }
>
> }
>
> --
> Shady Zayat
>
>
> ___
> 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] Firebug equivalent tool for QML ?

2010-07-19 Thread Gregory Schlomoff
Hi guys,

I remember how my DOM / Javascript / CSS skills dramatically improved
when I discovered the existence of Firebug in Firefox. I was wondering
if there would be any chance to see a similar tool for QML.

Basically, something that would enable you to right-click anywere in
qmlviewer.exe, and see the underlaying document object model, and then
interactively explore the items and see their properties.

This would greatly simplify the debugging of qml, as well as help
developers discover new properties, or understand "what's going on".

What do you think? Good idea? Feasible? Maybe later?

cheers,

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


[Qt-qml] QML vs Photoshop point unit

2010-07-18 Thread Gregory Schlomoff
Hi guys,

I just noticed that there is a difference between point sizes in
Photoshop and QML by a factor of 1.32.
For example, if I set a text to a pointSize of 50 in QML, I must set
the text to 50 * 1.32 = 66 points in Photoshop to get the same size.

While there is nothing wrong with that, I was wondering if there was
some explanation for this difference, as points theoretically are a
standardized unit (1pt = 1/72 of an inch)

(Please, note that I haven't measured the actual size of the items on
my screen, so I'm not telling that Photoshop's point size is the right
one and that the QML engine is innacurate. Just trying to understand
the reasons that account for the difference)

Warm regards

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


Re: [Qt-qml] Fw: Why can't I stylesheet a font?

2010-07-13 Thread Gregory Schlomoff
Can we please stop trolling on this ?

It's pretty evident by now that everyone has his position and won't
move a single inch.

My inbox thanks you :)

Greg



On Wed, Jul 14, 2010 at 9:39 AM,   wrote:
> On 14/07/2010, at 10:42 AM, ext Jason H wrote:
>> But the ability to define and apply arbitrary property groups - be they be 
>> for
>> themes or something else - has a good bit of support and application. Can we 
>> get
>> the feature? Please?
>
> >From my perspective, the main requirement is "make it easy for designers to 
> >change the visual aspects of a large QML project". The below approaches help 
> >to achieve that, and are available for use right now. For future releases 
> >(the feature set of 4.7 is essentially frozen), we should certainly look at 
> >how well this approach has served, and how we can better meet this goal. 
> >Something like PropertyGroups should be part of the research (we'll need to 
> >answer questions like how it fits in with states, or bindings (we often have 
> >things like color: focus ? "green" : "red"; how would that work?), what the 
> >performance implications are, and how much improvement it gives us for the 
> >costs). If you'd like to help, trying the techniques below in your project 
> >for a couple months, and providing feedback on what worked and what didn't 
> >as opposed to another system like CSS that you are familiar with, would be 
> >invaluable.
>
> Current Approach 1
> --
> If you've got a single, unique set of properties to apply, Alan's first 
> suggestion of custom components works really well.
>
> //BigText.qml
> Text {
>    font.family: "Arial"
>    font.pointSize: 30
>    color: "red"
> }
>
> //everywhere else
> BigText { test: "Hello" }
>
> In my mind, this is essentially identical (at least in expressiveness) to:
>
> Text {
>    text:"Hello"
>    properties: [bigText]
> }
> (i.e. when one PropertyGroup is applied.) One difference is that the BigText 
> approach would lead to a directory full of these small files, while the 
> PropertyGroup approach would lead to a file full of small snippets. In both 
> cases the potential navigation problems (lots of files or really large file) 
> should be solvable by good tooling.
>
> Current Approach 2
> --
> Alan's second suggestion regarded a master theme file:
>
> //the theme definition
> QtObject {
>    id: bigText
>    property string family: "Arial"
>    property real pointSize: 30
>    property color color: "red"
> }
>
> QtObject {
>    id: anotherSetOfProperties
>    property color color: "purple"
> }
>
> //everywhere else
> Text {
>    text: "Hello"
>    font.family: bigText.family
>    font.pointSize: bigText.fontSize
>    color: bigText.color
>    styleColor: anotherSetOfProperties.color
> }
>
> Like the PropertyGroup approach below, this allows applying global properties 
> that are defined in a single file.
>
> Text {
>    text:"Hello"
>    properties: [bigText, anotherSetOfProperties]
> }
>
> Unlike the PropertyGroup approach, it is "fixed" what properties from what 
> groups apply. This has both pros (e.g. less possibility of unintended 
> side-effects) and cons (e.g. more work when adding a new property to a 
> "style"). It also requires more typing initially.
>
> Hybrid Approach
> ---
> You can also combine approach 1 and 2, e.g.
>
> //BigText.qml
> Text {
>    font.family: bigText.family
>    font.pointSize: bigText.fontSize
>    color: bigText.color
>    styleColor: anotherSetOfProperties.color
> }
>
> 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


[Qt-qml] Is it possible to subclass a QDeclarative class ?

2010-07-13 Thread Gregory Schlomoff
Hi guys,

Anyone knows if it's possible to subclass a QDeclarative class? The
headers are private, and we get a lot of linker errors if we try to
include them.

Why we want to do that: we are working on a qml implementation of drag
& drop. Our first approach consisted of two custom items, DragArea and
DropArea, and it worked well, but then we found that it was
incompatible with MouseArea: we couldn't use MouseArea and our
DragArea at the same time on the same item, because either DragArea or
MouseArea would grab the mouse and the other won't get any event.

Now we are trying another approach, which is to make DragArea a
subclass of MouseArea. Thus, we could implement our drag and drop
functionnality, and still deliver all the regular mouse events to QML.

Any help with that would be highly appreciated.

Thanks

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


Re: [Qt-qml] QML Application Wrapper anyone?

2010-07-13 Thread Gregory Schlomoff
Someone asked this question a few weeks ago in this mailing list, and
some troll answered that there were plans to include this exact
functionality as a wizard in QtCreator.

I don't remember if he/she specified if it was going to be in the next
official release of QtCretator, though. (v2.1)

On Tue, Jul 13, 2010 at 7:54 PM, Ivan De Marino
 wrote:
> Hello.
> With QML evolving at every commit into a very organic and rich
> sub-framework, I start to wonder if, for some apps, the use of Qt C++ should
> completely be substituted by Javascript inside QML.
> In some cases, for apps without CPU-bound code, this makes a lot of sense in
> my opinion.
> But there is a problem: QML, at the end of the day, is just a script. It
> needs a player. And the use of "qmlviewer" for an app that goes in the hands
> of users is not acceptable.
> I'm wondering if the Trolls were thinking to integrate a sort of
> "Application Wrapper" for QML Apps.
> The scenario is simple: the developer does all its work, having a
> "start.qml" (or something like that) that works as the "int main(int argc,
> char** argv)" of the app.
> Then with a wizard wraps all his/her code into a final app. A binary
> executable or a package (depending on the target platform).
> At the end of the day, what's needed is an app that launches a QML Viewer
> and that loads the "start.qml".
> What do you think guys?
> Anyone has a better idea?
> I know I know: we can all make it ourself. But I'm starting to spread the
> "seed" of QML into my office, and I can see that those scenarios are going
> to arise very soon.
>
> --
>  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
>
>

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


Re: [Qt-qml] Why can't I stylesheet a font?

2010-07-12 Thread Gregory Schlomoff
I don't want to toot my own horn, but we were discussing that with
another developer a while ago on the chat, and it would definitely be
very helpful to have a simple and flexible way to assign properties in
batches.

The "subclassing" method (making a separate component) is not flexible
enough when you have multiple combinations of styles, and can quickly
lead to a nightmare of files.

> This approach has the advantage of being linked to the type. This means that
> you only use the properties relevant for that type

When you create a PropertyChanges element, you also lose type
information, so it doesn't seem to be that much of an issue.

So yes, this is probably not something that is going to be introduced
in 4.7, but my guess is that as the usage of QML increases, the need
for something like property groups will really become obvious.

Cheers,

greg

On Tue, Jul 13, 2010 at 11:37 AM, Jason H  wrote:
> Actually I like Gregory's better still. While I'd likely put the "style sheet"
> stuff in a separate file, your implementation implies that I'd have to have a
> file for every item of every style. HTML CSS's files can be one per site, and
> that's a huge feature.
>
> And the fact that I can specify font and color (which isn't a part of font!?)
> at the same time is really handy.
>
>
> Still, good to know...
>
>
> - Original Message 
> From: Alan Alpert 
> To: qt-qml@trolltech.com
> Sent: Tue, July 13, 2010 12:30:37 AM
> Subject: Re: [Qt-qml] Why can't I stylesheet a font?
>
> On Tue, 13 Jul 2010 10:48:46 ext Gregory Schlomoff wrote:
>> I second that. Would be very useful to be able to create a predefined
>> group of properties, and then assign the group as a whole to any
>> object.
>>
>> Something like this:
>>
>> PropertyGroup {
>>   id:bigText
>>   font.face = "Arial"
>>   font.pointSize: 30
>>   color: "red"
>> }
>>
>> Text {
>>   text:"Hello"
>>   properties: [bigText, anotherSetOfProperties]
>> }
>
> Something also like that, but that you can do in QML today, is:
>
> MyText.qml
> Text{
>    font.face: "Arial"
>    font.pointSize: 20
>    color: "red"
> }
> main.qml
>
> MyText{
>    text: "Hello"
> }
>
> This approach has the advantage of being linked to the type. This means that
> you only use the properties relevant for that type. Also the precedence is
> clear, so if you want to set a different color but keep the other properties,
> that's easy and should be unambiguous.
>
> The downside of this approach is that you need an extra file, but presumably 
> if
> these properties are worthwhile separating out you may want to use them in
> multiple files anyways.
>
> --
> 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
>

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


Re: [Qt-qml] QML: DataModel

2010-07-12 Thread Gregory Schlomoff
You should probably create some slots on C++ that interact with your
QAbstractItemModel, then call those slots from QML.

The rule is that QML can only call slots or Q_INVOKABLE, and not normal methods.

On Tue, Jul 13, 2010 at 4:40 AM, Almo Nito  wrote:
> Hello There,
>
>
>
>
>
> I played around with QML today and ended in trying on of the examples in the
> docs that actually tried to use the QAbstractItemModel as a file browser.
>
>
>
> So I copy-pasted the source and tried out their example with the result that
> the root directory is showing up (the “/”) and the onClick handler is
> working as well,
>
>
>
> The only problem is that it don’t seems possible to brows the File system,
> any ideas on that one?
>
>
>
>
>
>
>
> QML:
>
>
>
>
>
> import Qt 4.7
>
> import "ressource" as Ressources
>
>
>
> Rectangle {
>
>     id: background
>
>     width: 770;
>
>     height: 480;
>
>     color: "lightgray"
>
>
>
>     ListView {
>
>     id: view
>
>     width: 300
>
>     height: 400
>
>
>
>
>
>     model: VisualDataModel {
>
>
>
>     model: myModel
>
>
>
>     delegate: Rectangle {
>
>     width: 200; height: 25
>
>     Text { text: filePath }
>
>
>
>     MouseArea {
>
>     anchors.fill: parent
>
>     onClicked: {
>
>
>
>
>
>     if (view.model.hasModelChildren) {
>
>     console.log("childs")
>
>     view.model.rootIndex = model.modelIndex(index)
>
>     }
>
>     else {
>
>     console.log("NoChilds")
>
>
>
>     }
>
>
>
>     }
>
>     }
>
>     }
>
>
>
>     }
>
>
>
>     }
>
> }
>
>
>
>
>
>
>
>
>
> C++:
>
>
>
>
>
> QDeclarativeView *view = new QDeclarativeView(this);
>
>
>
>
>
>     QFileSystemModel *modelDir = new QFileSystemModel;
>
>     modelDir->setRootPath("/home");
>
>
>
>
>
>     ui->treeView->setModel(modelDir);
>
>
>
>
>
>
>
>     QDeclarativeContext *ctxt = view->rootContext();
>
>     ctxt->setContextProperty("myModel",modelDir);
>
>
>
>
>
>     QUrl url = QUrl::fromLocalFile(“browsertest.qml");
>
>     view->setSource(url);
>
>
>
>
>
>     view->show();
>
>
>
>
>
>
>
>
>
>
>
>
>
> Further in the C++ I have anoter issue, if I set the RootDir as in
> modelDir->setRootPath("/home"); it seems not to do any changes at all.
>
>
>
> Any Ideas?
>
> Thanks!
>
> Almo
>
>
>
> ___
> 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 can't I stylesheet a font?

2010-07-12 Thread Gregory Schlomoff
I second that. Would be very useful to be able to create a predefined
group of properties, and then assign the group as a whole to any
object.

Something like this:

PropertyGroup {
  id:bigText
  font.face = "Arial"
  font.pointSize: 30
  color: "red"
}

Text {
  text:"Hello"
  properties: [bigText, anotherSetOfProperties]
}

On Tue, Jul 13, 2010 at 6:20 AM, Jason H  wrote:
> I'd like to be able to do this:
>
> Font{id:third;face:"NiteClub";pointSize:30;color:"White"}
>
> Rectangle {
>    Text{text:"";font:third;anchors.top:parent.anchors.Top}
> }
>
> But I get the message "Element is not creatable".  I'd like to be able to
> specify this as a font class like a style sheet so that I can theme things, 
> like
> with a style sheet
>
>
> The whole nomenclature of font.property, I'd expect the whole font.property to
> be short hand?
>
>
>
>
> ___
> 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] Announcing unofficial drag and drop support to QML

2010-07-11 Thread Gregory Schlomoff
Hello everyone,

We are very pleased to announce that we quickly baked some drag and
drop support to qml last week, and we are making the code available as
open-source for everyone.

The code quality isn't close to what the trolls do, documentation is
still a stub, and there are some things missings here and there (look
for //TODO's inside the code)

Still, it works, and should provide a good starting point for people
looking for drag and drop in qml.

Some features :

- built as a wrapper around Qt's drag and drop classes (QDrag,
QMimeData, and QGraphicsSceneDragDropEvent)

- Provides support for inter-application drag and drop.

- Easy to use. See the qml file for an example usage.

Expect the quality of the code to improve during the next weeks, as we
make more usage of it internally, and start adding the missing things.
In the meantime, any feedback that you may want to provide will be
highly appreciated.

And of course, if we can see an official implementation from Qt, it
will be way better :)

The code is available as a Mercurial repository here:
http://bitbucket.org/gregschlom/qml-drag-drop

(sorry, git users, we'll make a git clone if there is some demand, in
the meantime, you can download a zip with the sources)

Disclaimer: we are in no way associated with Nokia or Qt. We are just
an independant start-up using Qt and QML to build a great desktop app.

Cheers,

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


Re: [Qt-qml] "QML supports network transparency by using URLs"

2010-07-11 Thread Gregory Schlomoff
Hello everybody,

Just a small comment: last week, we built our first QML component in
C++, and it was way more easier than we would have thought.

All of a sudden, we discovered that extending QML from C++ either by
subclassing existing items or by creating new ones from scratch was
*really* easy, and that for all the things that we are missing in the
official QML API, we could built it ourselves (like changing the mouse
cursor shape, or adding support for drag and drop functionnality - two
points that I previously asked this mailing-list about).

I'm telling this story because I realiized that although the docs are
great from a technical point of view (everything is clear and easy to
understand), maybe the examples could have better choosen to
illustrate more real-life cases. I'm thinking of the Person and the
Musician examples here. They are easy to understand, but when you see
them, you don't think: "I could use this to create a subclass of the
Text component that would allow me to specify text by an URL."

That's my 2 cents to the doc team. And Jason, if you're at least
somewhat comfortable with C++, you may want to try implement your
suggestio, it's really easier than it sounds.

Kind regards,

Greg

On Sun, Jul 11, 2010 at 11:55 AM, Jason H  wrote:
> Text {
>  source: "http://iscaliforniaonfire.com";
> }
>
> Does not work.
> Before you tell me to use a model, let me point this out. I was trying to 
> make a
> crawler/ticker, like on the news stations.
> When I tried to use a model, they were uniformly spaced, and that's not
> acceptable.
>
>
> It would be cool if I could specify source for any string, that could ever be
> used (performance implications are left to the coder) as well as specify a 
> XPath
> query It might be cool also specify an XPath query too, sot that
>
> Text {
>  source: "http://iscaliforniaonfire.com";
>  sourceQuery: "/body/H1/text()"
> }
>
> It may be good to make a Document element type:
> Document {
>     id: californiaFireStatus
>     source: "http://iscaliforniaonfire.com";
>     query{
>         id:yesno; query: "/body/H1/text()"
>     }
>     query{
>         id:title; query: "/head/title"
>     }
>
> }
>
> Text {
>        source: californiaFireStatus.yesno
>
> }
>
> Or something like that. I think my only option now is to fetch it into a model
> and then glue it together?
>
>
>
>
> ___
> 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] Drag and drop status in QML?

2010-07-06 Thread Gregory Schlomoff
Hi guys,

What is the status of drag and drop support in QML?

Basically, I would like to be able, for any Item, to declare it as a
drop target (maybe by setting a property like acceptDrops to true),
and then, have slots like onDragEnter and onDrop that I could use to
make my Item react to drag and drop.

This seems extremely important, especially for desktop applications.
Is something like that going to be released in 4.7? If so, when will
it be available in the latest snapshot for beta testing?

If there are no plans to support drag and drop officially (yet), what
would you recommend as alternative ways to implement it?

Thanks,

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


[Qt-qml] How-to re-order Items inside a ListView with drag and drop ?

2010-07-05 Thread Gregory Schlomoff
Hi guys,

I'm trying to create a ListView where items can be re-ordered with
drag and drop. Basically, the QML equivalent of this javascript / css
demo : http://www.wil-linssen.com/demo/jquery-sortable-ajax/

What are your thoughts on this?

1. Is it feasible in pure QML? It seems that ListView doesn't like
draggable items: as soon as one tries to drag an item, it jumps to the
top of the list.

2. Should this behavior of draggable items jumping to the top of the
ListView when one tries to drag them be considered a bug ?

3. Should I subclass the QDeclarativeListVIew and make my own ListVIew
with drag and drop support?

4. Can the ability to reorder items with drag and drop inside a
ListView (or a GridView, for that matter) be considered a feature
request for QML ?

Thanks

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


[Qt-qml] Public place to share QML components?

2010-06-29 Thread Gregory Schlomoff
Hi guys,

As the philosophy of QML is to provide only the building blocks and to
let the developers create their own components, I often find myself
writing a lot of reusable components. Stuff to add scrollbars to
Flickable, or to make TextInputs appear like regular Text elements
that become editable on double click, for example.

I think it would be nice to have some place where people could share
their components, like a public library of components.

What do you think? Is there any plans to do something like that? Maybe
on the Qt developer network, for example?

I'd love to hear your feedback on this idea

Cheers

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


[Qt-qml] TextInput I-beam mouse cursor?

2010-06-04 Thread Gregory Schlomoff
Hi guys,

Does anyone know if there are plans to make TextInput elements show a
standard I-beam cursor, instead of the regular mouse pointer? This is very
important as currently the user has no way to know which text elements are
editable without trying to click them.

Actually, I think this is related to a more broad issue of being able to
specifiy cursor shapes for elements. I've reported it as a bug a while ago:
http://bugreports.qt.nokia.com/browse/QTBUG-10642

I'd really appreciate if some trolls could tell me what they think about
that, and if there is any chances to see this in the 4.7 release, or if I
should go through the path of subclassing / reimplementing TextInput myself.

Thanks!

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


Re: [Qt-qml] Send qml signals to cpp

2010-05-31 Thread Gregory Schlomoff
Hello,

I'm looking for the same thing. You may want to have a look at this example
app, it might be of some help :

http://zchydem.enume.net/2010/04/08/my-first-qt-quick-app-quickflickr/

(I haven't tried myself yet to send signals from my QML frontend, but I will
need to do so in a while)


Regards

Greg

2010/5/31 Juan Felipe Mogollón Rodríguez 

> Hi to everyone,
>
> I am trying to develop an application that uses qml as frontend.
>
> I am trying to emit signals from qml to be managed with the cpp code,
> I haven't found any tutorial or example that works.
>
> Could anybody tell me a good tutorial or example?
>
> Thanks in advance.
>
> Regards.
>
> Felipe
> ___
> 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] Anchoring of elements in Row or Column

2010-05-18 Thread Gregory Schlomoff
Try something along the lines of secondElement.x = firstElement.x +
firstElement.width

Using left and right as you suggested would definitely look more elegant,
but it doesn't work, don't ask me why.

On May 18, 2010 8:32 AM,  wrote:

 forgot to mention i am using "Repeater" in Row .,

-rakesh

 --
*From:* qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] *On
Behalf Of *rakesh.muthar...@tieto.com
*Sent:* Tuesday, May 18, 2010 9:29 AM
*To:* qt-qml@trolltech.com
*Subject:* [Qt-qml] Anchoring of elements in Row or Column

  Hello,  Is there a possibility to anchors elements in Row or
Column? Well, I am trying...

___
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