[Solved] Warning: Class implements the interface QGraphicsItem but does not list it in Q_INTERFACES



  • Currently I am studying some code that I didn't write and when I compile it I got the warning message of the subject.
    I was checking some documents about plugins but I couldn't find nothing conclusive about it.
    I'm just curious what that means? How can I avoid it?

    Thanks for any hint.



  • You can check how its used in Qt sources or you could also lookup Q_INTERFACES in the Qt Assistant which says,

    bq.
    @
    class BasicToolsPlugin : public QObject,
    public BrushInterface,
    public ShapeInterface,
    public FilterInterface
    {
    Q_OBJECT
    Q_INTERFACES(BrushInterface ShapeInterface FilterInterface)

    public:
    ...
    };
    @



  • Finally I figured out what is going on here. It seems that this Warning shows up when a class inherits from both QObject AND QGraphicsItem, like this:

    @
    class KControlNode : public QObject, public QGraphicsItem
    @

    I think so, because when I changed it for:

    @
    class KControlNode : public QGraphicsItem
    @

    and compile the source code again, the Warning disappears :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.