[kgraphviewer-devel] Making kgraphviewer_part a full library

Gaël (aka Kleag) kleag at free.fr
Sat May 1 22:59:10 CEST 2010


On Friday 30 April 2010 21:40:25 Milian Wolff wrote:
> Gaël (aka Kleag), 30.04.2010:
> > Hello,
> > 
> > As said before, I'm working on making the kgraphviewer part a full
> > library. Thus, I created a namespace for it and make it use a d pointer.
> > 
> > Thus arises a problem for the kgrapheditor program. It was using an
> > inline method to access the internal graph (graph() defined as
> > m_widget->graph()). But now, m_widget is inside the private class and
> > cannot be accessed from the part header. And if not inline, the program
> > cannot link anymore as it is not linked with the part library.
> > 
> > Well, this was a hack and doing things cleanly make it not work anymore.
> > 
> > I see only one solution to this problem: creating a real library
> > containing the DotGraphView widget that would be used by programs like
> > kgrapheditor that must access the internals and a part used to display
> > the graphs in applications like kgraphviewer that don't use the
> > internals.
> 
> Maybe I don't get the question, but why not simply add a getter that
> returns what d_ptr->m_graph->graph() returns?
I was maybe unclear in explaining the problem. The fact is that to do that the 
implementation of the method must be in the cpp, but the the executable cannot 
link anymore, failing with an undefined reference to this method because it is 
not linked with the plugin (the part). Before, it was working because the 
access to the member was returning a pointer whose base type can be uncomplete 
at compile time, the liking being done when loading the plugin.

Gaël
-- 
KsirK - a world domination strategy game 
http://techbase.kde.org/Projects/Games/Tactic_and_Strategy/KsirK

KGraphViewer - a GraphViz dot graphs viewer and editor based on a reusable 
part
http://extragear.kde.org/apps/kgraphviewer




More information about the kgraphviewer-devel mailing list