Hi, this is my first post here 
I'm trying to realize an embedded application framework based on Qt 4.5 (Qt Embedded for Linux) similar to Qtopia/QtExtended.
I want to implement a dynamic loader for third-party applications, so I'm using the Qt plugin system. I have my application interface class:
class pkApplication
{
public:
enum { InvalidId = 0 };
public:
virtual ~pkApplication() {};
virtual unsigned int id() const = 0;
virtual bool startUp
(QWidget *parent
= 0) = 0;
};
Q_DECLARE_INTERFACE(pkApplication, "it.card-tech.pk.pkApplication/1.0");
class pkApplication
{
public:
enum { InvalidId = 0 };
public:
virtual ~pkApplication() {};
virtual unsigned int id() const = 0;
virtual bool startUp(QWidget *parent = 0) = 0;
};
Q_DECLARE_INTERFACE(pkApplication, "it.card-tech.pk.pkApplication/1.0");
To copy to clipboard, switch view to plain text mode
Then, my base application mixin class (it implements application low-level logic and it inherits from QObject):
class pkApplicationBase
: public QObject,
public pkApplication
{
Q_OBJECT
private:
static unsigned int s_idCounter;
static QList<unsigned int> s_freeIds;
unsigned int m_id;
public:
pkApplicationBase();
virtual ~pkApplicationBase();
unsigned int id() const;
private:
unsigned int nextFreeId();
};
class pkApplicationBase : public QObject, public pkApplication
{
Q_OBJECT
private:
static unsigned int s_idCounter;
static QList<unsigned int> s_freeIds;
unsigned int m_id;
public:
pkApplicationBase();
virtual ~pkApplicationBase();
unsigned int id() const;
private:
unsigned int nextFreeId();
};
To copy to clipboard, switch view to plain text mode
And, at the end, my concrete example application:
class ExampleApp : public pkApplicationBase
{
Q_OBJECT
Q_INTERFACES(pkApplication)
public:
ExampleApp();
};
class ExampleApp : public pkApplicationBase
{
Q_OBJECT
Q_INTERFACES(pkApplication)
public:
ExampleApp();
bool startUp(QWidget* parent);
QDialog* w;
};
To copy to clipboard, switch view to plain text mode
(with Q_EXPORT_PLUGIN2(exampleapp, ExampleApp) line in the source file).
This configuration doesn't work even if it respects pure interface and no-qobject-inheritance (on pkApplication) rules.
If I inherit ExampleApp directly from pkApplication everything works (obviously with some changes here and there).
Could you help me to find a solution for this problem, please?
Bookmarks