Re: [Qt-qml] How to simulate mouse event

2010-12-13 Thread martin.jones
We handle mouse release in our tests without any problem.  Are you able to 
provide a runable example?

BR,
Martin.

From: Wangbing Kevin (Nokia-MS/Beijing)
Sent: Tuesday, 14 December 2010 2:19 PM
To: Jones Martin (Nokia-MS-Qt/Brisbane); qt-qml@trolltech.com
Subject: RE: How to simulate mouse event

Hi Martin,

Thanks for your great suggestion!
The most mouse events can be simulated successfully except 
GraphicsSceneMouseRelease event.
The onReleased handler still cannot be triggered.

What's the matter?
Hope you or others can help me again, thank you!

BR,
Kevin Wang

From: Jones Martin (Nokia-MS-Qt/Brisbane)
Sent: Tuesday, December 14, 2010 7:58 AM
To: Wangbing Kevin (Nokia-MS/Beijing); qt-qml@trolltech.com
Subject: RE: How to simulate mouse event

We do this in the MouseArea autotests:

QGraphicsScene *scene = canvas-scene();
QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress);
pressEvent.setScenePos(QPointF(100, 100));
pressEvent.setButton(Qt::LeftButton);
pressEvent.setButtons(Qt::LeftButton);
QApplication::sendEvent(scene, pressEvent);

Keep in mind that the position set above is in scene coordinates.

BR,
Martin.


From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On 
Behalf Of Wangbing Kevin (Nokia-MS/Beijing)
Sent: Monday, 13 December 2010 7:46 PM
To: qt-qml@trolltech.com
Subject: [Qt-qml] How to simulate mouse event

Hi,

I'm a freshman on qml plug-in development.
I want to simulate key and mouse events for testing my qml script automatically.
Now, I can simulate the key event successfully by 
item-scene()-sendEvent(item, keyEvent);

But it cannot work when I call item-scene()-sendEvent(item, mouseEvent); 
to simulate mouse event.
I've tried another way QApplication::sendEvent(view, mouseEvent);, but it 
still cannot work.
The return value is always false.

My qml script is follow, it can output log when I click actual mouse key.
Rectangle {
   id: container
..

MouseArea {

   id: mouseArea

   anchors.fill: parent

   onClicked: {

   mouse.accepted  = true;

   console.log(Mouse Clicked! key:  + mouse.button +  | keys:  + 
mouse.buttons);

   }
}

Do you have any suggestion?

Best Regards,

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


Re: [Qt-qml] How to simulate mouse event

2010-12-13 Thread martin.jones
Yes, that makes sense.  QGraphicsView uses the press event to determine which 
item will get subsequent mouse events.

BR,
Martin.

From: Wangbing Kevin (Nokia-MS/Beijing)
Sent: Tuesday, 14 December 2010 4:52 PM
To: Jones Martin (Nokia-MS-Qt/Brisbane); qt-qml@trolltech.com
Subject: RE: How to simulate mouse event

Hi Martin,

I've done some tests for the mouse event simulation and found a rule:
The mouse release event cannot be sent singly, it must be paired with a mouse 
press event and a mouse click event will be send by system automatically.
So I cannot send a single mouse release event to any object, it's right?

BR,
Kevin Wang

From: Jones Martin (Nokia-MS-Qt/Brisbane)
Sent: Tuesday, December 14, 2010 1:26 PM
To: Wangbing Kevin (Nokia-MS/Beijing); qt-qml@trolltech.com
Subject: RE: How to simulate mouse event

We handle mouse release in our tests without any problem.  Are you able to 
provide a runable example?

BR,
Martin.

From: Wangbing Kevin (Nokia-MS/Beijing)
Sent: Tuesday, 14 December 2010 2:19 PM
To: Jones Martin (Nokia-MS-Qt/Brisbane); qt-qml@trolltech.com
Subject: RE: How to simulate mouse event

Hi Martin,

Thanks for your great suggestion!
The most mouse events can be simulated successfully except 
GraphicsSceneMouseRelease event.
The onReleased handler still cannot be triggered.

What's the matter?
Hope you or others can help me again, thank you!

BR,
Kevin Wang

From: Jones Martin (Nokia-MS-Qt/Brisbane)
Sent: Tuesday, December 14, 2010 7:58 AM
To: Wangbing Kevin (Nokia-MS/Beijing); qt-qml@trolltech.com
Subject: RE: How to simulate mouse event

We do this in the MouseArea autotests:

QGraphicsScene *scene = canvas-scene();
QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress);
pressEvent.setScenePos(QPointF(100, 100));
pressEvent.setButton(Qt::LeftButton);
pressEvent.setButtons(Qt::LeftButton);
QApplication::sendEvent(scene, pressEvent);

Keep in mind that the position set above is in scene coordinates.

BR,
Martin.


From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On 
Behalf Of Wangbing Kevin (Nokia-MS/Beijing)
Sent: Monday, 13 December 2010 7:46 PM
To: qt-qml@trolltech.com
Subject: [Qt-qml] How to simulate mouse event

Hi,

I'm a freshman on qml plug-in development.
I want to simulate key and mouse events for testing my qml script automatically.
Now, I can simulate the key event successfully by 
item-scene()-sendEvent(item, keyEvent);

But it cannot work when I call item-scene()-sendEvent(item, mouseEvent); 
to simulate mouse event.
I've tried another way QApplication::sendEvent(view, mouseEvent);, but it 
still cannot work.
The return value is always false.

My qml script is follow, it can output log when I click actual mouse key.
Rectangle {
   id: container
..

MouseArea {

   id: mouseArea

   anchors.fill: parent

   onClicked: {

   mouse.accepted  = true;

   console.log(Mouse Clicked! key:  + mouse.button +  | keys:  + 
mouse.buttons);

   }
}

Do you have any suggestion?

Best Regards,

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


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

2010-12-09 Thread martin.jones
This behavior is inherited from QGraphicsView.  I don't know why it is this 
way.  Perhaps the QGraphicsView documentation has some hints.

BR,
Martin.

 -Original Message-
 From: ext Adriano Rezende [mailto:adriano.reze...@openbossa.org]
 Sent: Friday, 10 December 2010 12:02 AM
 To: Pasion Jerome (Nokia-MS-Qt/Oslo)
 Cc: halton@intel.com; Jones Martin (Nokia-MS-Qt/Brisbane); qt-
 q...@trolltech.com
 Subject: Re: [Qt-qml] How to ignore MouseArea signals
 
 On Thu, Dec 9, 2010 at 10:36 AM,  jerome.pas...@nokia.com wrote:
  Hello,
 
  Is there a reason why accepted isn't handled in the other mouse events?
 
 I believe the reason is that after accepting mouse press event that
 item becomes the mouse grabber and mouse move/released events will be
 delivered directly to it. The grabber condition can be removed calling
 ungrabMouse() manually.
 
 Br,
 Adriano

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


Re: [Qt-qml] PathView Delegates Not Always Displaying

2010-12-09 Thread martin.jones
This one I can reproduce.  I've reopened the bug. 
http://bugreports.qt.nokia.com/browse/QTBUG-15926

Thanks,
Martin.


 -Original Message-
 From: ext Michael Dippold [mailto:m...@dippold.com]
 Sent: Friday, 10 December 2010 2:30 AM
 To: Jones Martin (Nokia-MS-Qt/Brisbane)
 Cc: qt-qml@trolltech.com
 Subject: Re: [Qt-qml] PathView Delegates Not Always Displaying
 
 Sorry, I guess I had to upgrade my glib libraries to build the latest.
  I have now built the latest and it seems to fix part of my issue but I am 
 still having
 some trouble.
 
 With the following example, line 19:
 carousel.currentIndex = 0;
 
 Does not appear to cause the path to redraw the delegates.
 
 Steps:
 1) After loading click  once
 (7 should now be in the center box.)
 2) Click Home which should reload the model which will trigger the 
 currentIndex
 to be set at 0.
 
 You should see that nothing happens when Home is clicked.  The currentItem is
 currently set to 0 but the path is currently displaying
 a different state.   If you click  again nothing will happen (now
 the path is in the state it should be in).  Click  again and the path 
 will start to
 move.
 
 At line 17 if I set highlightMoveDuration to 10 (maybe anything other than 0) 
 the
 problem is not visible.
 
 Thanks,
 Mike
 
 
 On 12/7/10, martin.jo...@nokia.com martin.jo...@nokia.com wrote:
  This is not reproducible using the current Qt 4.7 branch.  The 4.7
  branch from http://qt.gitorious.org/qt should always build and run.
 
  BR,
  Martin.
 
  -Original Message-
  From: ext Michael Dippold [mailto:m...@dippold.com]
  Sent: Wednesday, 8 December 2010 2:55 AM
  To: Jones Martin (Nokia-MS-Qt/Brisbane)
  Cc: qt-qml@trolltech.com
  Subject: Re: [Qt-qml] PathView Delegates Not Always Displaying
 
  I am using Qt 4.7.1, I just tried compiling from the latest from Git
  but could not get it to run.  I was able to create a simple example
  on how to duplicate it and created a bug (QTBUG-15926).  Hopefully it
  is reproducible on other systems.
 
  Thanks,
  Mike
 
 
  On Mon, Dec 6, 2010 at 10:20 PM,  martin.jo...@nokia.com wrote:
   Which version of Qt are you using?  There have been some fixes in
   PathView
  which your bug may be related to.  I suggest trying the latest qt/4.7
  from git. If you still see the problem then file a bug with an
  example that can be used to reproduce it (an unreliable example is
  better than none).
  
   BR,
   Martin.
  
   -Original Message-
   From: qt-qml-boun...@trolltech.com
   [mailto:qt-qml-boun...@trolltech.com]
  On
   Behalf Of ext Michael Dippold
   Sent: Tuesday, 7 December 2010 10:52 AM
   To: qt-qml@trolltech.com
   Subject: [Qt-qml] PathView Delegates Not Always Displaying
  
   I currently have a PathView that is binded to a XmlListModel.  I
   animate the entire path and move it off of the screen, change the
   query of the XmlListModel to get new data, and then animate the
   entire path back onto the screen once the XmlListModel status is
   set to READY.
  
   I am having a problem where randomly the PathView will come back
   into the main window with missing delegates.  If I use the mouse
   to barely move the PathView the delegates immediately get displayed.
  
   I have not yet found a way to reliably reproduce the issue.
   ___
   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 ignore MouseArea signals

2010-12-07 Thread martin.jones
Log a bug.  It would be good if you could suggest where the docs are lacking - 
i.e. where you started looking when this didn't work as expected.  The 
accepted behavior is documented in the MouseArea signal documentation.

BR,
Martin.

 -Original Message-
 From: ext Halton Huo [mailto:halton@intel.com]
 Sent: Wednesday, 8 December 2010 11:56 AM
 To: Jones Martin (Nokia-MS-Qt/Brisbane)
 Cc: adriano.reze...@openbossa.org; qt-qml@trolltech.com
 Subject: RE: [Qt-qml] How to ignore MouseArea signals
 
 Woo, OnPressed works, thanks very much.
 
 The document need to be improved. Any process to do that?
 
 Cheers,
 Halton.
 On Wed, 2010-12-08 at 09:46 +0800, martin.jo...@nokia.com wrote:
  You need to accept in onPressed.  accepted is ignored for any other event.
 
  BR,
  Martin.
 
 
   -Original Message-
   From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com]
 On
   Behalf Of ext Halton Huo
   Sent: Wednesday, 8 December 2010 11:42 AM
   To: Adriano Rezende
   Cc: qt-qml@trolltech.com
   Subject: Re: [Qt-qml] How to ignore MouseArea signals
  
   enabled does not match my case.
  
   I need receive the MouseArea signals but as well as those below the top
   item can receive the signals also.
  
   Refer to MouseEvent element document, seems accepted can do that.
   -
   accepted : bool
  
   Setting accepted to true prevents the mouse event from being propagated
   to items below this item.
  
   Generally, if the item acts on the mouse event then it should be
   accepted so that items lower in the stacking order do not also respond
   to the same event.
  
  
   But following code does not work as I wish
   MouseArea {
   anchors.fill: parent
   onClicked: {
   console.log(mouse.accepted=+mouse.accepted)
   mouse.accepted = false
   console.log(mouse.accepted=+mouse.accepted)
   }
   }
  
   Thanks,
   Halton.
  
   On Wed, 2010-12-08 at 02:55 +0800, Adriano Rezende wrote:
On Tue, Dec 7, 2010 at 4:31 AM, Halton Huo halton@intel.com wrote:
 So my questions how to ignore the received signals to let other items 
 to
 continue deal with those signals?
   
You can set enabled property to false or ignore the event on mouse 
press.
   
MouseArea {
anchors.fill: parent
onClicked: console.log(background clicked);
}
   
MouseArea {
anchors.fill: parent
enabled: false
//onPressed: mouse.accepted = false;
onClicked: console.log(foreground clicked);
}
   
Br,
Adriano
  
  
   ___
   Qt-qml mailing list
   Qt-qml@trolltech.com
   http://lists.trolltech.com/mailman/listinfo/qt-qml
 


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


Re: [Qt-qml] PathView Delegates Not Always Displaying

2010-12-06 Thread martin.jones
Which version of Qt are you using?  There have been some fixes in PathView 
which your bug may be related to.  I suggest trying the latest qt/4.7 from git. 
If you still see the problem then file a bug with an example that can be used 
to reproduce it (an unreliable example is better than none).

BR,
Martin.

 -Original Message-
 From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On
 Behalf Of ext Michael Dippold
 Sent: Tuesday, 7 December 2010 10:52 AM
 To: qt-qml@trolltech.com
 Subject: [Qt-qml] PathView Delegates Not Always Displaying
 
 I currently have a PathView that is binded to a XmlListModel.  I
 animate the entire path and move it off of the screen, change the
 query of the XmlListModel to get new data, and then animate the entire
 path back onto the screen once the XmlListModel status is set to
 READY.
 
 I am having a problem where randomly the PathView will come back into
 the main window with missing delegates.  If I use the mouse to barely
 move the PathView the delegates immediately get displayed.
 
 I have not yet found a way to reliably reproduce the issue.
 ___
 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 expose widget to QML

2010-11-30 Thread martin.jones
You may be able to do this via QGraphicsProxyWidget, but as the documentation 
states: This class is provided for convenience when bridging QWidgets and 
QGraphicsItems, it should not be used for high-performance scenarios.  If you 
are able then it is better to port the widget's functionality to 
QDeclarativeItem.

BR,
Martin.

From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On 
Behalf Of ext vuleetu
Sent: Wednesday, 1 December 2010 2:03 PM
To: qt-qml@trolltech.com
Subject: [Qt-qml] How to expose widget to QML

Hi,
  I can create custom extension which inherit QDeclarativeItem and it works. 
But i want to using existing widget like QLabel in Qt exposed to qml? Does 
anyone know how to do this?

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


Re: [Qt-qml] Accessing a QAbstractItemModel in QML outside a view

2010-11-30 Thread martin.jones
Right now if you want to access data in your model in script, you will need to 
add methods to your model to allow that.

For the specific case of showing data from the currentItem, you can expose the 
model data, e.g.

ListView {
Id: list
delegate: Text {
property variant data: model
text: name
}
}
Text { text: list.currentItem.data.name }

BR,
Martin.

 -Original Message-
 From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On
 Behalf Of ext Jan Ekholm
 Sent: Wednesday, 1 December 2010 4:55 PM
 To: qt-qml@trolltech.com
 Subject: [Qt-qml] Accessing a QAbstractItemModel in QML outside a view
 
 
 Hi,
 
 The subject says it all, apart from the context. Accessing a QAIM in a view 
 (such
 as
 a ListView) is all nicely documented and works as expected. However, how can I
 access
 the same exposed C++ model outside a view? In my case I want to show a list of
 data and
 next to the list have some Text/Image items with more information about the
 selected item
 in the view. Totally normal stuff.
 
 Getting the index of the selected row is easy, the view gives me that. 
 Getting the
 model
 instance is also easy, it's in the root context. However, getting data out of 
 the
 model seems
 to be impossible. I've tried all kinds of ways to access the data but none 
 works.
 However, if
 I look here:
 
 http://doc.trolltech.com/4.7/qdeclarativemodels.html#accessing-views-and-models-
 from-delegates
 
 it's seems that delegates can even write data to a model. This gives a 
 somewhat
 perverse
 situation where you can inside delegates read and write to models but outside 
 a
 delegate
 you can't even read data.
 
 So, this can't possibly be the case and there's something my thick brain just 
 does
 not grok?
 I mean, models are one of the few ways you can get real data into a QML
 document, and not
 being able to actually access it makes it all feel somewhat silly. I can make 
 extra
 methods
 on my subclassed QAIM on the C++ side to get data, but the point is that I 
 should
 not have
 to do that, it ought to just work.
 
 Someone please give me some RTFM resource.
 
 Best regards,
 Jan Ekholm
 
 --
 Jan Ekholm
 jan.ekh...@smultron.net
 
 
 
 
 ___
 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] work with folder property on FolderListModel

2010-11-28 Thread martin.jones
The documentation should be sufficient. If it is not then that is a bug.

BR,
Martin

From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On 
Behalf Of ext Thomas PABST
Sent: Friday, 26 November 2010 1:05 AM
To: qt-qml@trolltech.com
Subject: Re: [Qt-qml] work with folder property on FolderListModel

Thanks, that is a good way.

Is there a easy way to know all property available with an qml element ? I 
looked the documentation on 
http://doc.qt.nokia.com/4.7-snapshot/qml-folderlistmodel.html but it seems not 
up to date ! The parentFolder property does not appeared on the list.

-
Thomas PABST
thomas.pa...@gmail.commailto:thomas.pa...@gmail.com

2010/11/25 martin.jo...@nokia.commailto:martin.jo...@nokia.com
The parent folder is easy to get, since there is a parentFolder property.  
There is no way to get a directory in the current folder, short of using the 
model in a repeater, for example.  FolderListModel is quite simple and really 
only designed to allow selecting a file from a list.  You could add a 
suggestion for a more fully featured filesystem model, but for now you will 
have to extend FolderListModel to suit your needs.

Martin.


From: qt-qml-boun...@trolltech.commailto:qt-qml-boun...@trolltech.com 
[mailto:qt-qml-boun...@trolltech.commailto:qt-qml-boun...@trolltech.com] On 
Behalf Of ext Thomas PABST
Sent: Thursday, 25 November 2010 1:31 AM
To: qt-qml@trolltech.commailto:qt-qml@trolltech.com
Subject: [Qt-qml] work with folder property on FolderListModel

Hi,

I looking for a way to work with the folder property on a FolderListModel. The 
folder property is a string oriented in the path management. Is there an easy 
way to get the parent folder, or get a directory contained in this one ?

I saw QUrl Class Reference, but that's only work with C++ !

Thanks
-
Thomas PABST
thomas.pa...@gmail.commailto:thomas.pa...@gmail.com

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


Re: [Qt-qml] Flickable visibleArea.widthRatio behavior change?

2010-11-28 Thread martin.jones
There was no deliberate change and the 
examples/declarative/ui-components/scrollbar example appears to behave 
correctly.  Can you provide an example of the problem?

BR,
Martin.


 -Original Message-
 From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On
 Behalf Of Dietrich-De Gabriel (Nokia-MS/Oslo)
 Sent: Saturday, 27 November 2010 1:28 AM
 To: qt-qml@trolltech.com
 Subject: [Qt-qml] Flickable visibleArea.widthRatio behavior change?
 
 Hi,
 
 I have just noticed that for any Flickable 'visibleArea.widthRatio' only 
 changes
 when 'width' or 'contentWidth' change. I mean that it remains constant even 
 if the
 actual contents' visible area is smaller than the viewport area (like when 
 flicking
 past the boundaries). I seem to remember this what not the case a couple of
 months ago, but I may be wrong, (Same behavior for 'heightRatio', of course).
 
 Can anyone confirm or infirm? Thanks in advance.
 
 Best regards,
 
 Gabriel de Dietrich
 
 ___
 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 dynamic loading a memory string?

2010-11-24 Thread martin.jones
Unfortunately there is no easy way to add setData() to QDeclarativeView.  
You'll probably have to make your own QGraphicsView subclass, since 
QDeclarativeViewPrivate is not exported.

You can create an object from a QML string using Qt.createQmlObject(string qml, 
object parent, string filepath)
http://doc.qt.nokia.com/4.7-snapshot/qml-qt.html#dynamic-object-creation

Martin.

 -Original Message-
 From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On
 Behalf Of ext Nathan
 Sent: Wednesday, 24 November 2010 12:59 AM
 To: qt-qml@trolltech.com
 Subject: [Qt-qml] QML dynamic loading a memory string?
 
 
 I'm very new to QT  QML, so I'm looking for some guidance...
 
 After hunting around; I figured out that you can use 
 QDeclarativeComponent,
 setData to dynamically load a string qml data...
 
 So the first question -- Any way to make the QDeclarativeView use setData?   
 The
 only way I can think of off the top of my head is to somehow make a decendant
 class of both he QDeclarativeView and the QDeclarativeViewPrivate somehow?
 
 In QML is there a way to use the loader or some other component or method 
 to
 talk to the QDeclarativeComponent to be able to use setData?   Or do I need to
 somehow add setData to the loader class, and if so how?
 
 Nathan
 
 
 
 
 ___
 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] work with folder property on FolderListModel

2010-11-24 Thread martin.jones
The parent folder is easy to get, since there is a parentFolder property.  
There is no way to get a directory in the current folder, short of using the 
model in a repeater, for example.  FolderListModel is quite simple and really 
only designed to allow selecting a file from a list.  You could add a 
suggestion for a more fully featured filesystem model, but for now you will 
have to extend FolderListModel to suit your needs.

Martin.


From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On 
Behalf Of ext Thomas PABST
Sent: Thursday, 25 November 2010 1:31 AM
To: qt-qml@trolltech.com
Subject: [Qt-qml] work with folder property on FolderListModel

Hi,

I looking for a way to work with the folder property on a FolderListModel. The 
folder property is a string oriented in the path management. Is there an easy 
way to get the parent folder, or get a directory contained in this one ?

I saw QUrl Class Reference, but that's only work with C++ !

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


Re: [Qt-qml] FolderListModel

2010-11-22 Thread martin.jones
The ListView has no height so only one delegate is created.  Add anchors.fill: 
parent to the ListView.

BR,
Martin.

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

Hi,

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

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



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


Re: [Qt-qml] C++ MyClass to detect child added/removed from QML

2010-11-22 Thread martin.jones
QGraphicsItem::itemChange() may do what you want:

http://doc.qt.nokia.com/4.7-snapshot/qgraphicsitem.html#itemChange

Martin.

From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On 
Behalf Of ext Charley Bay
Sent: Tuesday, 23 November 2010 12:51 PM
To: qt-qml@trolltech.com
Subject: [Qt-qml] C++ MyClass to detect child added/removed from QML

I'm sure the answer is simple, but I can't find it:  I want my C++ implemented 
QML object to be notified when children are added:

//FILE: MyFile.qml
import Qt 4.7
import MyCppClass 1.0

Rectangle {
  MyCppClass {
id: myCppClass
Text { text: some text }   // CHILD NOT DETECTED AS ADDED
  }

  Text {
text: some other text
parent:  myCppClass  // CHILD NOT DETECTED AS ADDED
  }
}

In both the cases above, I'm unable to find a slot/notification/virtual 
function in the C++ implementation of MyCppClass that I can use to detect these 
children that are added.

Since MyCppClass derives from QDeclarativeItem, I see that it is a 
QGraphicsObject, mulitply-derived from from both QObject and QGraphicsItem.  I 
stumbled onto virtual QObject::childEvent(QChildEvent*) which looked ideal 
(since QChildEvent has child add/remove info), but it's not called in either of 
the cases above.

Then, digging into the Qt docs, I see that QGraphicsObject users should *NOT* 
look to QObject for parent/children relationships, but rather, should look only 
to QGraphicsItem.  Seems reasonable.  Unfortunately, I could not find anything 
in QGraphicsItem that looked like a slot or virtual function I could override 
to receive add/remove child notification events (I need both).

I'm sure this is a simple answer -- what notification does QML trigger that I 
can catch on the C++ side for (re-)parenting?

Thanks!

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


Re: [Qt-qml] ListView's childrenRect

2010-11-17 Thread martin.jones
This will not work, or worse, has undefined behavior.  ListView does not 
instantiate all of its elements - only those that are needed to fill the 
visible area of the view.  If you define the view's height to be the height of 
its children, but the number of children needed depends upon the height of the 
view, you're unlikely to get what you want.  Why does it seem to work for 
XmlListModel?  Beats me.

I'd suggest doing something like:

ListView {
  height: count * 50
}

If you don't want to scroll and you don't need e.g. the currentIndex 
functionality of the ListView then I'd suggest using a Column with a Repeater.  
This is more efficient than a ListView and automatically sizes to its content 
size.

Martin.

 -Original Message-
 From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On
 Behalf Of Pasion Jerome (Nokia-MS-Qt/Oslo)
 Sent: Wednesday, 17 November 2010 8:13 AM
 To: qt-qml@trolltech.com
 Subject: [Qt-qml] ListView's childrenRect
 
 Hello all,
 
 Someone sent me his problem with ListView's childrenRect. Essentially, binding
 the ListView's height to the childrenRect.height when using a regular 
 ListModel
 (with strings) will only show the first element while using the XmlListModel 
 will fit all
 the model's items.
 
 Here is his code snippet:
 ListView {
 id: list
 
 interactive: false
 //height: contentHeight //If bound to contentHeight warning is given 
 that there
 is a binding loop!
 height: childrenRect.height //If bound to childrenRect.height then 
 only one
 item is shown (unless you use an XMLListModel!)
 //contentHeight: childrenRect.height //Not really necessary
 width: parent.width
 model: listModel
 //model: xmlListModel //If the XMLListModel is used, then the 
 childrenrect
 binding is fine
 delegate: listItem
 }
 }
 
 What would be the best way of fitting the contents of any/all types of models?
 
 Cheers,
 Jerome P.
 
 ___
 Qt-qml mailing list
 Qt-qml@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-qml

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


Re: [Qt-qml] ListView header and footer behavior

2010-11-11 Thread martin.jones
Definitely a bug.  Please report at http://bugreports.qt.nokia.com

Martin.

 -Original Message-
 From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On
 Behalf Of ext Johannes P
 Sent: Thursday, 11 November 2010 11:18 PM
 To: qt-qml@trolltech.com
 Subject: [Qt-qml] ListView header and footer behavior
 
 Hi,
 
 I'm trying to build a listView with header and footer. When I enable
 SnapToItem, the header is not shown anymore. It is there, but because the list
 snaps to the first Item below the header, one can only flick downwards to see
 the header. This is probably not the correct behavior, since a non-visible
 header doesnt make much sense. When snapping is turned off, it works as
 expected. Also, the behavior is correct with the footer. It snaps correctly,
 regardless of SnapToItem.
 
 The following example reproduces the behavior.
 
 Thanks for any ideas or comments,
 Johannes
 
 //## Start Example ###
 import Qt 4.7
 
 // In the following example, the header is not shown, i.e. is not in the view.
 // The view doesnt snap to the header. If snapping is switched of it works.
 
 Rectangle {
 width: 200
 height: 200
 ListView {
 clip: true; spacing: 1
 width: parent.width
 height: parent.height
 // It works without Snapping
 snapMode: ListView.SnapToItem
 model: listModel
 delegate: listDelegate
 footer: footerAndHeader
 header: footerAndHeader
 }
 
 ListModel {
 id: listModel
 ListElement {name: Dogs}
 ListElement {name: Cats}
 ListElement {name: Birds}
 ListElement {name: Snails}
 ListElement {name: Horses}
 ListElement {name: Bugs?}
 }
 Component {
 id: listDelegate
 Rectangle {
 width:  parent.width
 height: 60
 gradient: Gradient {
 GradientStop {
 position: 0.00;
 color: #f9f9f9;
 }
 GradientStop {
 position: 1.00;
 color: #c4c4c4;
 }
 }
 Text {
 anchors.centerIn: parent
 text: name
 }
 }
 }
 Component {
 id: footerAndHeader
 Rectangle {
 width:  parent.width
 height: 40
 gradient: Gradient {
 GradientStop {
 position: 0.00;
 color: #6d6d6d;
 }
 GradientStop {
 position: 1.00;
 color: #22;
 }
 }
 }
 }
 
 }
 //## End Example##
 ___
 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] MapPolyline

2010-11-10 Thread martin.jones
Hi Sampo,

This sounds like a bug to me, so I suggest logging a bug on 
http://bugreports.qt.nokia.com

You may get more help on the qt-mobility-feedb...@trolltech.com mailing list.

Martin.

 -Original Message-
 From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On
 Behalf Of ext Sampo Juhani Savola
 Sent: Wednesday, 10 November 2010 11:33 PM
 To: qt-qml@trolltech.com
 Subject: [Qt-qml] MapPolyline
 
 
 Hello
 
 I would like to draw a route on the Map with QML by using MapPolyline
 in Qt Mobility 1.1.
 
 Should this MapPolyline work with this release? I can use the Map
 object fine but when i try to add MapPolyline the code stops working
 and i get error: MapPolyline is not a type
 
 
 Thanx
 
 Sampo
 
 
 
 ___
 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] Change property of dynamically created component

2010-11-08 Thread martin.jones
There's nothing wrong with this in concept.  Could you provide a small 
self-contained example of what you've tried?

Martin.

 -Original Message-
 From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On
 Behalf Of Ji Shiping (Nokia-MS/Espoo)
 Sent: Tuesday, 9 November 2010 4:15 AM
 To: qt-qml@trolltech.com
 Subject: [Qt-qml] Change property of dynamically created component
 
 Hi,
 
 We have a QML with two states and one loader component. In state2, a new
 component yellowRectComponent is created by the loader. In state3, we'd 
 like
 to modify this newly created component's properties, but it doesn't seem to 
 work
 (the new component creation is successful though).
 
 Do you know whether this is supported scenario or there is alternative way of
 achieving this?
 
 Thanks.
 
 BR,
 Shiping
 
 ___
 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] emit data on a QAbstracListModel does not update the QML ListView.

2010-09-18 Thread martin.jones
It may be a combination of this change and others.  There have been a number of 
changes to this code since the rc was released.

If you still see QTBUG-13628 I'd suggest getting the qt 4.7 branch from 
gitorious.  If you have problems after that let me know and I'll reopen it.  

Martin.

From: ext Bartosh Wroblevksy [bart...@live.com]
Sent: Saturday, 18 September 2010 3:57 PM
To: Jones Martin (Nokia-MS-Qt/Brisbane); qt-qml@trolltech.com
Cc: Stephen Kelly
Subject: RE: [Qt-qml] emit data on a QAbstracListModel does not update the QML 
ListView.

Hi Guys,

I applied the patch to Qt 4.7.0 RC1 here on my computer and it does fix
http://bugreports.qt.nokia.com/browse/QTBUG-13664 but it does not seem to fix 
the other bug that was closed namely 
http://bugreports.qt.nokia.com/browse/QTBUG-13628. I'll check again to make 
sure.

Thanks,
Bartosh





 From: martin.jo...@nokia.com
 To: qt-qml@trolltech.com
 Date: Thu, 16 Sep 2010 11:21:20 +1000
 CC: steve...@gmail.com
 Subject: Re: [Qt-qml] emit data on a QAbstracListModel does not update the 
 QML ListView.

 On Wed, 15 Sep 2010 04:32:37 am ext Stephen Kelly wrote:
  Bartosh Wroblevksy wrote:
   Hello Steve,
   Thank you for filing the BR. I have a few questions.
  
   1) What's the number of the bug?
 
  http://bugreports.qt.nokia.com/browse/QTBUG-13628

 This turned out to be another manifestation of the dataChanged() bug also:

 http://bugreports.qt.nokia.com/browse/QTBUG-13664

 Martin.



   2) I have trouble seeing how in this case, moving rows and changing data
   is not equivalent. In fact,unless my morning coffee was not caffeinated.
   If I write
  
   m_elements[1] =x; emit dataChanged(index(1,0), index(1,0));
  
   Should I not expect to see the QML listview change?
 
  Yes, you are right. Indeed that is another bug. What you are doing
  WorksFromMe, but I don't have a plugin for the model like you do, but I
  create the QDeclarativeMainView in an application and use
  setContextProperty(myModel). Maybe if loaded through a plugin qml doesn't
  handle that signal somehow?
 
  It's worth another bug report.
 
   3) beginResetModel() and endResetModel() is clearly not what I want. My
   application flickers horribly. In fact I hadinitially tried an emit
   modelReset() which also made my application flick horribly. I was hoping
   to avoid the flickerwith an emit dataChanged. Until this bug gets fixed,
   is there any better alternative?
 
  I don't think so, sorry.
 
   4) You mention *plus* updating
   persistent indexes in between.Sorry, can you elaborate on this?
 
  doMove()
  {
  layoutAboutToBeChanged();
  // do the move
  m_items.move(0, 1);
 
  QModelIndexList pers = persistentIndexList();
  foreach(const QModelIndex idx, pers) {
  if ( idx.row() == 0 ) {
  const QModelIndex newIdx = createIndex(1, 0);
  changePersistentIndex(idx, newIdx);
  }
  if ( idx.row() == 1 ) {
  const QModelIndex newIdx = createIndex(0, 0);
  changePersistentIndex(idx, newIdx);
  }
  }
  layoutChanged();
  }
 
  I hardcoded the 0 and 1 for clarity, but you can imagine that if you're
  moving an arbitrary range of items an arbitrary distance the implementation
  gets difficult. Avoid doing it yourself where possible and use
  beginMoveRows etc instead.
 
  If you want to see an implementation implementing a move in a tree using
  just the layout change stuff see
  ModelMoveLayoutChangeCommand::emitPreSignal and
  ModelMoveLayoutChangeCommand::emitPostSignal here:
 
  http://websvn.kde.org/trunk/KDE/kdelibs/kdeui/tests/proxymodeltestsuite/dyn
  amictreemodel.cpp?view=markup
 
  Compare to ModelMoveCommand::emitPreSignal and
  ModelMoveCommand::emitPostSignal
 
  Updating those is needed for selections, tree expansion proxy models etc to
  work properly and not crash.
 
   5) You
   wrote
  
   + beginMoveRows(QModelIndex(), 0, 0, QModelIndex(), 2);
   m_elements.move(0,1); + endMoveRows();
  
   Since the destination child is 1, I would have expected to write
  
   + beginMoveRows(QModelIndex(), 0, 0, QModelIndex(), 1);
   m_elements.move(0,1); + endMoveRows();
  
   but then again, my coffee may be decaffeinated.
 
  It's common for people to think that. I improved the docs with diagrams for
  4.7:
 
  http://doc.trolltech.com/main-snapshot/qabstractitemmodel.html#beginMoveRow
  s
 
  It's consistent with other model api where you identify the 'gap' you want
  to move the item to. Item at position 0 can't be moved to gap 0 or 1
  because it is already in between them. It can be moved to position 2
  though. Unfortunately the QList::move API is not the same. It's also
  easier to implement dropMimeData like this.
 
  All the best,
 
  Steve.
  ___
  Qt-qml mailing list
  Qt-qml@trolltech.com
  http://lists.trolltech.com/mailman/listinfo/qt-qml

 --
 Martin
 ___
 Qt-qml mailing list
 Qt-qml@trolltech.com
 

Re: [Qt-qml] Avoid binding warnings on object creation

2010-09-03 Thread martin.jones
I'm planning to push it to 4.7 on Monday.

Martin.


From: qt-qml-boun...@trolltech.com [qt-qml-boun...@trolltech.com] On Behalf Of 
Cunha Leo (Nokia-MS-Qt/Oslo)
Sent: Friday, 3 September 2010 8:13 PM
To: qt-qml@trolltech.com
Subject: Re: [Qt-qml] Avoid binding warnings on object creation

Any plans for when this fix will reach Qt? Any chance for 4.7.1?

In qt-components, we currently have 3 of those warnings and we are doing
workarounds to avoid getting more of them :-(

br,
// leo

 -Original Message-
 From: Jones Martin (Nokia-MS-Qt/Brisbane)
 [mailto:martin.jo...@nokia.com]
 Sent: Friday, September 03, 2010 12:14 AM
 To: ext Adriano Rezende; Cunha Leo (Nokia-MS-Qt/Oslo)
 Cc: qt-qml@trolltech.com
 Subject: RE: [Qt-qml] Avoid binding warnings on object creation

 This is a bug.  The attached patch fixes it.

 BR,
 Martin.

 -Original Message-
 From: qt-qml-boun...@trolltech.com [mailto:qt-qml-
 boun...@trolltech.com] On Behalf Of ext Adriano Rezende
 Sent: Friday, 3 September 2010 3:01 AM
 To: Cunha Leo (Nokia-MS-Qt/Oslo)
 Cc: qt-qml@trolltech.com
 Subject: Re: [Qt-qml] Avoid binding warnings on object creation

  I am using the Component::createObject(parent) and inside the
  component I have bindings to its parent, like:
  Item {
 id: page
 // FIXME: the line below creates warnings when the page component
  is instantiated
 width: parent.width
  }
 
  I get these warnings when instantiating the page: Unable to assign
  undefined value
 
  Is there any workaround for avoiding these binding's warnings when
  instantiating a dynamic object?

 I think this is the same problem I was facing.

 I created a suggestion in JIRA related to this behavior:
 http://bugreports.qt.nokia.com/browse/QTBUG-13170

 The problem is that when creating an object dynamically, the parent is
 set after all properties have been initialized. So, the parent itself
 does not exist at the initialization time.

 Br,
 Adriano

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


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

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


Re: [Qt-qml] Antialiasing

2010-08-04 Thread martin.jones
smooth: true

Martin.

From: qt-qml-boun...@trolltech.com [qt-qml-boun...@trolltech.com] On Behalf Of 
ext Shady Zayat [sh...@zoogylabs.com]
Sent: Wednesday, 4 August 2010 7:23 PM
To: qt-qml@trolltech.com
Subject: [Qt-qml] Antialiasing

Is there a was to enable antialiasing. Text is barely readable when rotated. 
This is on Mac and Linux, I haven't tried Windows yet.
--
Shady Zayat

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