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. Undefined interface Q_INTERFACES(QGraphicsItem)
QtWS25 Last Chance

Undefined interface Q_INTERFACES(QGraphicsItem)

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 4.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.
  • MassiM Offline
    MassiM Offline
    Massi
    wrote on last edited by
    #1

    Hello Qt forum

    I have created a vs2012 dll project which uses Qt library on windows platform. I have a QgraphicView that hold elements (widgets) and perform some animation with them. However I want to use Q_INTERFACES macro in on of my classes that inherits from QgraphicsItem but I get the following error:

    error : Undefined interface
    

    How can I define this macro and where to define it in my project?

    Thanks in advance!

    Massi

    Software Design Engineer at Ford - Canada

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Can you provide some more info, preferably some code sample?

      Some general info is in the docs: link and link.

      (Z(:^

      1 Reply Last reply
      1
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        QGraphicsItem is not interface. I'm assuming that you are developing a plugin. You can look at the Qt Assistant for "How to create Qt plugin". You can look for topics "The Low-Level API: Extending Qt Applications". It start with defining your own interface and implementing this interface.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        1
        • MassiM Offline
          MassiM Offline
          Massi
          wrote on last edited by Massi
          #4

          Many thanks for your quick reply!

          Well, I'm refactoring a Qt mingw code to Qt visual studio 2012. I have a C++.net dll project and I'm using Qt to display graphics widget. I'm not familiar with Q_INTERFACES macro and I'm not creating a Qt plugin either. Basically, I just have a class that inherit from QGraphicItems and QObject class. Since I'm using vs2012 and I had to handle moc file manually, I'm wondering if it might be the source cause of my issue?

          class SupperClass : public QObject, public QGraphicsItem
          {
                 Q_OBJECT
                 Q_INTERFACES(QGraphicsItem)
          public:
            	// Animation function (from graphics item)
          	void advance(int p_step);
          private:
                  // members
          }
          class GraphicsView : public QGraphicsView
          {
                Q_OBJECT
          public:
                GraphicsView() {
                   m_timer = new QTimer(this);
          	 connect(m_timer, SIGNAL(timeout()), m_scene, SLOT(advance()));
                 }
          private:
                QTimer * m_timer;
          }
          

          Again thanks for your time and help!!

          Massi

          Software Design Engineer at Ford - Canada

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            There's no need for that combo, Qt provides QGraphicsObject. And like @dheerendra wrote already, Q_INTERFACES only makes sense in a plugin project.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            MassiM 1 Reply Last reply
            1
            • SGaistS SGaist

              Hi,

              There's no need for that combo, Qt provides QGraphicsObject. And like @dheerendra wrote already, Q_INTERFACES only makes sense in a plugin project.

              MassiM Offline
              MassiM Offline
              Massi
              wrote on last edited by
              #6

              @SGaist Many thanks for the info!!!

              Software Design Engineer at Ford - Canada

              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