Somehow can not make this work:
Code:
QPluginLoader loader();
QObject* object = loader.instance ();
kindleScreenInterface = qobject_cast<KindleScreenInterface*> (object);
/*if(kindleScreenInterface!=0)*/
kindleScreenInterface->fullBlit();
In the plugin I have defined an empty function fullBlit() for testing, but it's crashing

. I have declared KindleScreenInterface as pure virtual and used Q_DECLARE_INTERFACE macro, also in the definition of KindleScreen I used:
Code:
Q_OBJECT
Q_INTERFACES(KindleScreenInterface)
Looks like kindleScreenInterface is not getting the right pointer. I am not sure how to find the screen plugin that is automatically preloaded by QWS (I think). I could not find a global pointer to the screen plugin. I have tried to cast QScreen::instance(), but it did not work either:
Code:
QObject* object = (QObject*)QScreen::instance();
kindleScreenInterface = qobject_cast<KindleScreenInterface*> (object);
//if(kindleScreenInterface!=0)
kindleScreenInterface->fullBlit();
Completely confused now. Need to look into how Qt loads the screen plugin.
Edit: a thought about the order of initialization in multiple inheritance: QObject should be initialized first! So this will not work:
Code:
class KindleScreen : public KindleScreeIniterface, QLinuxFbScreen, QObject {
Q_OBJECT
...
}
... but this should work :
Code:
class KindleScreen : public QObject, KindleScreeIniterface, QLinuxFbScreen{
Q_OBJECT
...
}
I will try this in the evening.
Edit: it did not help at all. Thoughts:
* QScreen is not inherited from QObject, so qobject_cast will not work
* I need to cast the QObject related to the new interface
* plugin exposes the ScreenPlugin class by Q_EXPORT_PLUGIN2(KindleFb, ScreenPlugin) and retuns the KindleScreen object (as QScreen) from create(), does it mean that KindleScreeIniterface could not be located?