POLYGONS in QML



  • Hello,

    Is it possible to create a trapezium in QML?
    Is it through Box 2D or is there any other way in creating the trapezium shape?
    Can anyone convey me the memory size of Box2D library?

    Thanks in advance:)



  • Hello,

    It depends on what you want to do. If you want one or a few trapeziums that do not interact with other objects, you can use Image. If you want trapezium that can change its color, width, height and so on you should subclass "QDeclarativeItem":http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeitem.html

    Also note that Box2D does not provide visual items.



  • Thanks,
    But is there any method to create a simple trapezium (as if like a Rectangle where it takes WIDTH and Height and can fill color dynamically based on a condition) by using only QML??


  • Moderators

    Not by only using QML. As task_struct mentioned above, if you'd like that functionality, you'll have to create a custom QDeclarativeItem in C++ to do it.

    There's an example "here":http://www.developer.nokia.com/Community/Wiki/CS001627_-_Creating_a_custom_QML_element_with_Qt which shows how you can create a Line. You can apply the same principles to drawing your own custom object.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.