How to dynamically create Rectangles ?
-
wrote on 26 Feb 2012, 18:01 last edited by
Hello.
I want to read information from a file in which is written in each line 4 points (x1,x2,y1,y2).
Now, I want to create a rectangle with this coordinates, but not in the design mode because the coordinates are not known before and they can always change.
Thank You.
-
wrote on 26 Feb 2012, 18:40 last edited by
Hello,
QML can't read files. You need to write a C++ plugin for that. "Tutorial: Writing QML Extensions with C++":http://doc.qt.nokia.com/4.7-snapshot/qml-extending-tutorial-index.html
For example, you can write a model that provides coordinates and than use "Repeater":http://doc.qt.nokia.com/4.7-snapshot/qml-repeater.html to create rectangles.
Or you can create rectangle dynamicly from C++. It's up to you.
-
wrote on 26 Feb 2012, 20:31 last edited by
Can I also load the file into a string(list) and then operating with the string / the stringlist ?
Then, I dont need to write an algorithm to open the file ?!
1/3