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. For custom path, derive from QGraphicsObject or QGraphicsPathItem ?
Forum Updated to NodeBB v4.3 + New Features

For custom path, derive from QGraphicsObject or QGraphicsPathItem ?

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

    In a QGraphicsScene, I would like to have my own custom object that essentially draws a QGraphicsPathItem. It should store additional information, however.

    I now am unsure how to proceed:

    Should I derive from QGraphicsObject, and then insert the QGraphicsPathItem as a child?

    Or should I derive from QGraphicsPathItem?

    JonBJ 1 Reply Last reply
    0
    • Q QtUser467

      In a QGraphicsScene, I would like to have my own custom object that essentially draws a QGraphicsPathItem. It should store additional information, however.

      I now am unsure how to proceed:

      Should I derive from QGraphicsObject, and then insert the QGraphicsPathItem as a child?

      Or should I derive from QGraphicsPathItem?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @QtUser467
      You don't want to encapsulate, and add a child. Not that I have ever used it, but use QGraphicsPathItem. Subclass that for your additional information.

      That will a QGraphicsItem. QGraphicsObject is a QGraphicsItem plus a QObject, usually so you can use signals/slots or maybe properties. You can also provide much the same if you need it by multiple-inheriting from a QGraphicsItem class and a QObject. Don't do so unless you need it.

      1 Reply Last reply
      1

      • Login

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