Thanks, but I was hoping I can do something like this:
//Example Button ComponentItem {id: rootElementsignal clicked(MouseEvent
mouse)...MouseArea {anchors.fill: parentonClicked: {rootElement.clicked( mouse
);}}}
Thanks,Bartosh
> From: [email protected]
> To: [email protected]; [email protected]
> Date: Sun, 5 Dec 2010 14:30:23 +0100
> Subject: RE: [Qt-qml] why does signal clicked (MouseEvent mouse) not parse
>
> Hi Bartosh,
> Mouse events in QML should be handled using a MouseArea component, and then
> the signal should be passed to the parent component when necessary. I am
> assuming you are creating a custom UI component that needs to have a clicked
> signal, so here would be a typical example:
>
> //Example Button Component
> Item {
> id: rootElement
> signal clicked
>
> ...
>
> MouseArea {
> anchors.fill: parent
> onClicked: {
> rootElement.clicked();
> }
> }
> }
>
> Define the signal on the root element of the component and create a MouseArea
> where you want the clickable area, in this example I have ensured that it
> fills the boundaries of the control with anchors.fill. When the clicked event
> is detected on this MouseArea, it calls the clicked signal on the root
> element, and this can be handled in your application view in exactly the same
> way as shown in the MouseArea here.
>
> SomeCustomComponent {
> onClicked: {
> //execute some code here
> }
> }
>
> If you need control over what types of click you are handling (right mouse
> button, key mods etc) there is some good info in the QML elements docs:
> http://doc.qt.nokia.com/4.7.old/qml-mouseevent.html
>
> Cheers,
> David
> ________________________________________
> From: [email protected] [[email protected]] On Behalf
> Of ext Bartosh Wroblevksy [[email protected]]
> Sent: 05 December 2010 01:05
> To: [email protected]
> Subject: Re: [Qt-qml] why does signal clicked (MouseEvent mouse) not parse
>
> Hi,
>
> I am bit confused. why does this line not parse in QML, Qt 4.7.0
>
> signal clicked (MouseEvent mouse)
>
> I get this message:
>
> Expected parameter type signal clicked (MouseEvent mouse)
> ^
>
> How am I supposed to propagate a MouseEvent if I can't do this?
>
> Thanks
> Bartosh
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml