[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: KParts question
From:       "Ami Chayun" <kdedevel () aftershock ! co ! il>
Date:       2007-11-25 17:59:47
Message-ID: 20071125175913.M3007 () aftershock ! co ! il
[Download RAW message or body]

On Sat, 24 Nov 2007 19:41:18 +0100, Andreas Pakulat wrote
> On 24.11.07 20:27:40, Ami Chayun wrote:
> > The question is what is the proper way to access custom methods in a part?
> 
> An interface.
> 
> > I have two ideas, but both seems imperfect:
> > 1. Statically link my main GUI with libpartwhatever.la and then static_cast
> > the loaded part to my class.
> > 2. Create a proxy library that is known to both the main GUI and the class,
> > and communicate via it.
> 
> Use 3:
> 
> Create a header with an abstract base class that has the functions 
> you need. Then let your KPart subclass inherit from that base class. 
> Your main gui code can the #include<> the header and use a 
> qobject_cast<AbstractClass*>(kpart_instance) to retrieve a pointer 
> to the interface of you kpart. Then you can call any method that is 
> provided in the abstract base class.
> 
> For an example have a look at
> kdelibs/interfaces/terminal/kde_terminal_interface.h, the implementation
> for that is in kdebase/apps/konsole/src/Part* (talking kde4 here, though
> I think its similar in kde3 - maybe different places)
> 
> Andreas
> 

Thanks Andreas, that gave me the proper direction.
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic