Hi,
i have a custom type, QDeclarativeItem subclass called polygon.
I override shape, boundingRect and paint functions in it.
I can see the polygons that i describe in the below QML code:

Code:

import MyTypes 1.0
import QtQuick 1.0
import Qt 4.7

Item {
    id: container
    width: 350; height: 250

     Polygon {
         id: aPolygon
         x:0;y:0
         width: 20; height: 20
         name: "A simple polygon"
         color: "blue"
         vertices:[

         Point{x:20.0; y:80.0},
         Point{x:20.0; y:20.0},
         Point{x:80.0; y:80.0}
         ]

         MouseArea{
             anchors.fill: parent
             drag.target: aPolygon
             drag.axis: Drag.XandYAxis
             drag.minimumX: 0
             drag.maximumX: container.width - parent.width
             drag.minimumY: 0
             drag.maximumY: container.height - parent.width
             onPressed:console.log("==============   ==onPressed")

         }


     }

}

The problem is that MouseArea cares the x, y, width and height
properties of my polygon items, not the shape of my polygons.


For example for first polygon onPressed work for the rectangle
x:0;y:0;width:20;height:20


How can i make MouseArea work for the polygon that vertices define.


I have overrided shape function, does not affect the result, what
should i do else?


Thanks
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to