PDA

View Full Version : circle in QML



jeff28
24th August 2012, 13:33
Hi,
I have a text object in my QML file. What I am trying to do is that I want this text file to appear with a circle shape on my simulator. Any ideas how? beacuse I tried rotating it using path object but I couldn't make it

spirit
24th August 2012, 15:21
Play with the Rectangle's radius property.

jeff28
27th August 2012, 13:11
I tried that great idea. But my text does not take the shape of the circle. I put my Text in my Rectangle too. If I am not clear please try to think that I would like to make my border from a text object

spirit
27th August 2012, 13:25
I see. I doubt that there is an "easy" way to do this. I can suggest two options:
1. You can look at ShaderEffectItem (http://qt-project.org/doc/qt-4.8/qml-shadereffectitem.html)
2. or you can dynamically create Text element for a single character and place it into correct place (that all characters will produce a circle). See Dynamic Object Management in QML (http://qt-project.org/doc/qt-4.8/qdeclarativedynamicobjects.html).

jeff28
27th August 2012, 14:22
Thank you I am looking to these things right away :)

Added after 46 minutes:

You are right those are not easy. Is it possible if I could use my .qml in a .cpp file and use QPainter to handle this problem?

spirit
27th August 2012, 14:25
Sure, you can create your own QML components. See Extending QML Functionalities using C++ (http://qt-project.org/doc/qt-4.8/qml-extending.html).


...
For visual element types, this will usually mean a subclass of QDeclarativeItem.
...