| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 3 | |
Good day I want to write a plugin (extended QHttp class) which should provide some sort of additional SIGNALS. How to declare interface for that? or any link to how-to. Best regards, Ilya Dyoshin -- [ signature omitted ]
On Thu, Jan 24, 2008 at 11:36:29AM +0200, Ilya Dyoshin wrote:
> Good day
>
> I want to write a plugin (extended QHttp class) which should provide
> some sort of additional SIGNALS.
>
> How to declare interface for that? or any link to how-to.
As far as I understand, you will have a few (more than one) plugin that
will provide classes, that extends QHttp and QHttp will be something like
"interface" class.
I think that correct way to do this is to declare something like object
factory interface. You can use followed code as reference:
class FooFactoryInterface
{
public:
virtual ~FooFactoryInterface() { }
...
virtual QHttp* getObject() const = 0;
...
};
Q_DECLARE_INTERFACE(FooFactoryInterface, "myapp.FooFactoryInterface/1.0")
So interface class has nothing more than destructor and pure virtual
functions.
and sample implementation:
class Foo: public QHttp
{
...
signals:
...
void someSignal();
...
}
class FooFactory: public QObject, public FooFactoryInterface {
Q_OBJECT
Q_INTERFACES(FooFactoryInterface)
public:
QHttp* getObject() const { return new Foo(); }
...
};
--
[ signature omitted ]
Attachment:
signature.asc
Description: Digital signature