[Qt-interest] QML: MouseArea and Row/Column

sarvesh saran aquarian.thunder at gmail.com
Sun Mar 13 10:19:06 CET 2011


Hi,

try using a repeater with a model and a delegate...let the delegate have a
mouse area.


   1. Repeater {
   2. model: dummyModel
   3. delegate: myDelegate
   4. }
   5.
   6. Component {
   7. id: myDelegate
   8. Rectangle {
   9. x: 10
   10. y: index*35+10
   11. width: 200
   12. height: 30
   13. color: "yellow"
   14. TextEdit {
   15. text: title
   16. font.pointSize: 18
   17. }
   18. MouseArea {
   19. anchors.fill: parent
   20. onClicked: {
   21. console.log("Clicked index:",index);
   22. title="test"
   23. }
   24. }
   25. }


thanks,
Sarvesh


On Sat, Mar 12, 2011 at 6:51 PM, Christian Rüb <christian.rueb at gmx.net>wrote:

> Hi,
>
> experimenting with QML I came across the follwing:
>
> Defining a MouseArea for an element within a Row results in a warning:
> "QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn
> anchors for items inside Row"
>
> How should it be done else? I want all items in the Row to react on the
> click...
>
> code snippet:
>
> Row {
> ...
>        MouseArea {
>                anchors.fill: parent
>                onClicked: {
> ...
>
> Also, is this the right place to ask about QML questions? I have some more
> ;-)
>
> Cheers,
>  Christian
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110313/2c717aef/attachment.html 


More information about the Qt-interest-old mailing list