Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to dynamically create Rectangles ?
Forum Update on Monday, May 27th 2025

How to dynamically create Rectangles ?

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pascal95abc
    wrote on 26 Feb 2012, 18:01 last edited by
    #1

    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.

    Qt 4.7.3
    Symbian OS v9.4 / Symbian^1, S60 5th Edition
    on N97

    1 Reply Last reply
    0
    • T Offline
      T Offline
      task_struct
      wrote on 26 Feb 2012, 18:40 last edited by
      #2

      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.

      "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."

      • Linu...
      1 Reply Last reply
      0
      • P Offline
        P Offline
        pascal95abc
        wrote on 26 Feb 2012, 20:31 last edited by
        #3

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

        Qt 4.7.3
        Symbian OS v9.4 / Symbian^1, S60 5th Edition
        on N97

        1 Reply Last reply
        0

        1/3

        26 Feb 2012, 18:01

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved