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

List:       kde-devel
Subject:    Re: QCanvasItem inheritance
From:       Simon Hausmann <shaus () helios ! med ! Uni-Magdeburg ! DE>
Date:       2000-06-19 8:13:22
[Download RAW message or body]



On Mon, 19 Jun 2000 martin@heni-online.de wrote:

> Hi,
> I have a small question concerning the kde-qt-addon class
> QCanvasItem (in qcanvas.cpp/h).  I noticed that it inherits
> class Qt but not Class QObject, which does not allow one
> to use signal/slot handling. I suppose using multiple inheritance 
> like
> class myclass: public QCanvasItem, publicQObject 
> this could be solved but I wonder why the class does not directly
> inherit from QObject. 
> Can anyone explain this to me? And would the above mentioned
> method be correct to get the signal/slot thingy?

I guess the reason is overhead. Think of a huge canvas with thousands of
items (who knows :) . You don't want each of these object to be a
full-fledged QObject. :)

Why not inherit from QCanvasItem and QCanvas and call something like
myCanvas->emitBlahSignal( argument ) from within your inheritted
QCanvasItem class. Just make sure emitBlahSignal() emits the real signal
then.

Bye,
 Simon

 
>> Visit http://master.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