Hi
I get the following error in regard to the interface below:
In file included from ../tmp/../source/IView.h:24,
from ../tmp/moc_IView.cpp:10:
../tmp/../source/IContext.h:42: error: expected identifier before string constant
In file included from ../tmp/../source/IView.h:24,
from ../tmp/moc_IView.cpp:10:
../tmp/../source/IContext.h:42: error: expected identifier before string constant
To copy to clipboard, switch view to plain text mode
This is my class:
#ifndef ICONTEXT_H
#define ICONTEXT_H
#include "ObjManagement_global.h"
#include <QString>
namespace Qtilities {
namespace ObjManagement {
namespace Interfaces {
class OBJMANAGEMENT_SHARED_EXPORT IContext {
public:
virtual QString context
() const = 0;
};
}
}
}
Q_DECLARE_INTERFACE(Qtilities::ObjManagement::Interfaces::IContext,"com.Qtilities.ObjManagement.IContext/1.0")
#endif // ICONTEXT_H
#ifndef ICONTEXT_H
#define ICONTEXT_H
#include "ObjManagement_global.h"
#include <QString>
namespace Qtilities {
namespace ObjManagement {
namespace Interfaces {
class OBJMANAGEMENT_SHARED_EXPORT IContext {
public:
virtual QString context() const = 0;
virtual QString contextHelpId() const { return QString(); }
};
}
}
}
Q_DECLARE_INTERFACE(Qtilities::ObjManagement::Interfaces::IContext,"com.Qtilities.ObjManagement.IContext/1.0")
#endif // ICONTEXT_H
To copy to clipboard, switch view to plain text mode
The interface is used in another interface, which class can inherit from and then implement IContext. This class is shown below:
#ifndef IVIEW_H
#define IVIEW_H
#include "ObjManagement_global.h"
#include "IContext.h"
#include <QWidget>
namespace Qtilities {
namespace ObjManagement {
namespace Interfaces {
class OBJMANAGEMENT_SHARED_EXPORT IView
: public QWidget,
virtual public IContext
{
Q_OBJECT
Q_INTERFACES(Qtilities::ObjManagement::Interfaces::IContext)
public:
IView
(QWidget * parent
= 0, Qt
::WindowFlags f
= 0) : QWidget(parent,f
) {} virtual ~IView() {}
signals:
void appendContext(const QString& context);
void removeContext(const QString& context);
};
}
}
}
#endif // IVIEW_H
#ifndef IVIEW_H
#define IVIEW_H
#include "ObjManagement_global.h"
#include "IContext.h"
#include <QWidget>
namespace Qtilities {
namespace ObjManagement {
namespace Interfaces {
class OBJMANAGEMENT_SHARED_EXPORT IView : public QWidget, virtual public IContext
{
Q_OBJECT
Q_INTERFACES(Qtilities::ObjManagement::Interfaces::IContext)
public:
IView(QWidget * parent = 0, Qt::WindowFlags f = 0) : QWidget(parent,f) {}
virtual ~IView() {}
signals:
void appendContext(const QString& context);
void removeContext(const QString& context);
};
}
}
}
#endif // IVIEW_H
To copy to clipboard, switch view to plain text mode
I suspect it has something to do with the namespaces? It has worked before but stopped working now and I can't figure out what changed.
Any inputs will be appreciated.
Thanks.
Jaco
Bookmarks