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. The best way to create a composite QGraphicsItem
Forum Updated to NodeBB v4.3 + New Features

The best way to create a composite QGraphicsItem

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 647 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.
  • V Offline
    V Offline
    van9petryk
    wrote on last edited by
    #1

    I'm trying to write a schematic editor, and I need a wire element that will connect the circuit elements. Wire is a few lines connected together. The number of lines will depend on the path's curvature. How should I proceed? Create a class inherited from QGraphicsItem which will store all of these lines or their points and draw them as a single element. Or to create a class inherited from QGraphicsItem, which by itself does not render anything, but is the parent for the lines (QGraphicsLineItem) that define a put from one element to another? If possible, suggest something else.
    What I want? I want to have access to separate wire lines to change their position.

    1 Reply Last reply
    0
    • Chris HennesC Offline
      Chris HennesC Offline
      Chris Hennes
      wrote on last edited by
      #2

      I'm not sure it's possible to give you a "best" option here, it depends too much on the details of your program. In general, however, your second suggestion is a small change to QGraphicsItemGroup, so you may be able to subclass that instead and save yourself some trouble by letting it provide the bulk of the necessary functionality.

      Chris Hennes, Pioneer Library System

      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