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

List:       kde-commits
Subject:    Re: koffice
From:       Thomas Zander <zander () kde ! org>
Date:       2008-07-08 14:35:15
Message-ID: 200807081635.16146.zander () kde ! org
[Download RAW message or body]


On Tuesday 8. July 2008 14:27:09 you wrote:
> On Tuesday 08 July 2008 13:45:29 Thomas Zander wrote:
> > SVN commit 829403 by zander:
> > 
> > Refactor to make this work propertly :)
> > 
> > The KoChartModel now is a QObject as qobject_cast is the only thing that
> > works in this case.  The problem  is that KoChartModel is not a class in
> > a shared-library, but a class compiled into each using-application. See
> > http://techbase.kde.org/Development/Tutorials/Common_Programming_Mistakes
> > #d ynamic_cast
> 
> Huh?! KoChartModel is located in the shared object "kochart" and "well-
> anchored". Is "kochart" now superfluous?

Here is what I learned from Josim before I committed this;

12:45 < TZander> josim: your new ChartModel doesn't inherit QObject, so how do you \
cast to it? 12:45 < josim> with dynamic_cast
12:46 < TZander> josim: does interfaces/KoChartModel.cpp get compiled into a library?
12:46 < josim> into the library that wants to use it, sure
12:47 < TZander> josim: so kexi and kchart and kspread each have their own version?  \
You can't use dynamic_cast then, can you?

12:47 < dfaure> the solution I recommended was to use a QObject as interface, and \
have a virtual QAbstractItemModel* model() = 0 in it. 12:50 < josim> dfaure: ok, that \
solution will obviously work as well 12:50 < josim> but right now, i can't think of a \
case where only a qobject_cast would work 12:51 < dfaure> dynamic_cast doesn't work \
across dlopen boundaries

So, irregardless of there being a kochart shared lib or not, we can now use 
qobject_cast and the memory-management features of qobjects.  Note that 
the only change in my commit would be the usage of dynamic cast and QObject,
the rest is still valid. ;)

Cheers!
-- 
Thomas Zander


["signature.asc" (application/pgp-signature)]

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

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