March 13, 2012

Harry443 Harry443
Lab Rat
24 posts

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:)

3 replies

March 13, 2012

task_struct task_struct
Hobby Entomologist
344 posts

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 [doc.qt.nokia.com]

Also note that Box2D does not provide visual items.

 Signature 

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.”
- Linus Torvalds

March 13, 2012

Harry443 Harry443
Lab Rat
24 posts

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??

March 13, 2012

mlong mlong
Mad Scientist
1517 posts

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 [developer.nokia.com] which shows how you can create a Line. You can apply the same principles to drawing your own custom object.

 Signature 

Senior Software Engineer
AccuWeather Enterprise Solutions
/* My views and opinions do not necessarily reflect those of my employer.  Void where prohibited. */

 
  ‹‹ Problems on how to use 3D noise or texture in ShaderEffect      set Item size based on childrens bounding box ››

You must log in to post a reply. Not a member yet? Register here!