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

List:       kde-devel
Subject:    Re: Programming question
From:       Phlip <pplumlee () omnigon ! com>
Date:       2001-01-25 19:52:32
[Download RAW message or body]

Proclaimed Michael Jarrett from the mountaintops:

> This probably sounds really silly, and I could be missing something
> really obvious here.
>
> I want to make a class inherit both KTMainWindow and a class derived
> from QObject or QWidget (needs signals).

Why do you need to inherit? You should only do that if you expect your 
object to perform according to the LSP...

	http://c2.com/cgi/wiki?LiskovSubstitutionPrinciple

This implies, per /Effective C++/ that you intend to override a virtual 
function from both parents in your new child.

> Of course this breaks any attempt to connect() the object because
> QObject becomes ambiguous between the two parent classes.
>
> Is there any way to force KTMainWindow to dominate? Or will I have to
> make the other object a member?

Make your classes inherit QObject virtually. I'm unsure if the Spirit of 
KDE would take lightly to you changing the system headers, but you could 
author a MyMainWindow class. You ought to at least also ask this question 
on a Qt list too.

-- 
  Phlip                          phlip_cpp@my-deja.com
============ http://c2.com/cgi/wiki?PhlIp ============
  --  Shock Value Added  --
 
>> 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