Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Help to creat a broken lines editor with the Graphics View Framework
Forum Updated to NodeBB v4.3 + New Features

Help to creat a broken lines editor with the Graphics View Framework

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.4k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    flexy4
    wrote on last edited by
    #1

    Hello,

    I would like to create a QGraphicsView to display broken lines which might be editable by drag and drop on the breakpoints (which have the role of key).

    How should I organize the Items of the QGraphicsScene?
    I thought creat a class to contain a QList<QGraphicsLineItem>. But I'm asking how to organize the QGraphicsLineItem of the same broken line relative to each others.
    Should the first QGraphicsLineItem be the parent of the others?
    How to do if I want that the differents QGraphicsLineItem of my broken line stay together after (or even during) a drag.

    In fact, I'm frightened by begin in a difficult way beacause I didn't realize there is a simpler way, I don't know very well the Graphics and Drag and Drop Features of Qt.

    Thanks.
    (Sorry for my English mistakes)

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kenchan
      wrote on last edited by
      #2

      did you try to use the QGraphicsItemGroup?

      1 Reply Last reply
      0
      • F Offline
        F Offline
        flexy4
        wrote on last edited by
        #3

        Yout think I should use a QGraphicsItemGroup to contains my QGraphicsLineItem?
        What should I pass as parent to my QGraphicsLineItem? Do you think it is better to give the previous QGraphicsLineItem as parent or to give 0?

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kenchan
          wrote on last edited by
          #4

          Please do look at the documentation and understand it for yourself, but
          just adding them to the group allows you to treat them as a single item when you need to do that.

          The group becomes the parent of the item when you add them. You can keep the pointers to the line items in your list so that you can access easily them individually when you need to.

          I use the group items this way all the time.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            flexy4
            wrote on last edited by
            #5

            Thanks a lot, I think it is a good to implement what I want. I spent my last day reading the documentation but it is still a little unclear in my mind. So I will examine a last example before to begin (Diagram scene example).
            Thanks for all.

            1 Reply Last reply
            0

            • Login

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