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. How to write custom singnal and slots for custom QGraphicsPolygonItem?

How to write custom singnal and slots for custom QGraphicsPolygonItem?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 740 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.
  • O Offline
    O Offline
    opengpu
    wrote on last edited by
    #1

    how to write custom singnal and slots for custom QGraphicsPolygonItem?
    i found that QGraphicsPolygonItem is not inherited from QObejct...
    and i tried add Q_OBJECT for my class, and compiled wrong...

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jalomic
      wrote on last edited by
      #2

      You can inherit QGraphicsPolygonItem from QObject yourself

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andreyc
        wrote on last edited by
        #3

        As jalomic suggested inherit you custom QGraphicsPolygonItem from both classes QObject and QGraphicsPolygonItem

        Please note that QObject must be first in the inheritance chain. Otherwise moc will not recognize it.
        @
        class MyGPI : public QObject, public QGraphicsPolygonItem
        {
        Q_OBJECT
        public:
        ...
        }
        @

        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