Is it possible to draw polygons with QML?
-
wrote on 13 Oct 2012, 02:44 last edited by
For example, can I draw a triangle with QML then rotate it using QML features like Transition and State, etc?
-
wrote on 13 Oct 2012, 06:11 last edited by
There is QML open-source APIs called "qmlcanvas":http://qt.gitorious.org/qt-labs/qmlcanvas that might be useful if you insist on drawing with QML. For more info check the "other articles about it at Qt Developer Network":http://qt-project.org/search/tag/qmlcanvas.
-
wrote on 13 Oct 2012, 06:12 last edited by
For sure.
Either create your own QDeclarativeItem / QQuickItem in C++, use the Canvas element in QML (QtQuick 2) or pre-create your polygon in SVG.
-
wrote on 13 Oct 2012, 10:57 last edited by
Or in QtQuick2 you can also create your own custom item by inheriting from QQuickItem (draw using OpenGL) or QQuickPaintedItem (draw using QPainter).
-
wrote on 25 Nov 2012, 23:36 last edited by
Thanks guys. I'm talking about doing it explicitly in QML so I'll definitely check out Canvas. Is it possible to embed Qt Declarative items inside QML Components (a rectangle)?
-
wrote on 26 Nov 2012, 09:07 last edited by
Yes, just make your custom item in C++, register the new type with QML and then instantiate it as a child of a rectangle in your .qml file.
-
wrote on 26 Nov 2012, 09:34 last edited by
Wow, cool. Qt is powerful. Can't wait to have a break from school to have some extensive sessions with Qt...