[kgraphviewer-devel] [KGraphViewer/libkgraphviz] 4d5c955: Fix pimpl declarations wrt inheritance

Kevin Funk krf at electrostorm.net
Mon Dec 20 16:32:26 CET 2010


commit 4d5c955a7b6cb902f557b33004f2f00763a47c08
branch libkgraphviz
Author: Kevin Funk <krf at electrostorm.net>
Date:   Mon Dec 20 16:30:37 2010 +0100

    Fix pimpl declarations wrt inheritance
    
    * Make d_ptr declarations protected
    * Make q_ptr declarations public

diff --git a/src/kgraphviz/canvasedge.h b/src/kgraphviz/canvasedge.h
index a715b14..170d36f 100644
--- a/src/kgraphviz/canvasedge.h
+++ b/src/kgraphviz/canvasedge.h
@@ -67,9 +67,11 @@ public:
 
   GraphEdge* edge() const;
 
+protected:
+  CanvasEdgePrivate* const d_ptr;
+
 private:
   Q_DECLARE_PRIVATE(CanvasEdge);
-  CanvasEdgePrivate* const d_ptr;
 };
 
 }
diff --git a/src/kgraphviz/canvaselement.h b/src/kgraphviz/canvaselement.h
index 63fecf9..8d10dbb 100644
--- a/src/kgraphviz/canvaselement.h
+++ b/src/kgraphviz/canvaselement.h
@@ -82,9 +82,10 @@ protected:
 
   void setBoundingRect(const QRectF& rect);
 
+  CanvasElementPrivate* const d_ptr;
+
 private:
   Q_DECLARE_PRIVATE(CanvasElement)
-  CanvasElementPrivate* const d_ptr;
 };
 
 }
diff --git a/src/kgraphviz/dotgraph.h b/src/kgraphviz/dotgraph.h
index 5169841..0b139d5 100644
--- a/src/kgraphviz/dotgraph.h
+++ b/src/kgraphviz/dotgraph.h
@@ -126,9 +126,11 @@ public:
 Q_SIGNALS:
   void readyToDisplay();
 
+protected:
+  DotGraphPrivate* const d_ptr;
+
 private:
   Q_DECLARE_PRIVATE(DotGraph);
-  DotGraphPrivate* d_ptr;
 };
 
 }
diff --git a/src/kgraphviz/dotgraph_p.h b/src/kgraphviz/dotgraph_p.h
index 509798a..cb01e2e 100644
--- a/src/kgraphviz/dotgraph_p.h
+++ b/src/kgraphviz/dotgraph_p.h
@@ -25,8 +25,6 @@
 namespace KGraphViz
 {
 
-class DotGraph;
-
 class DotGraphPrivate
 {
 public:
@@ -38,6 +36,9 @@ public:
   unsigned int cellNumber(int x, int y) const;
   void computeCells();
 
+  Q_DECLARE_PUBLIC(DotGraph);
+  DotGraph* q_ptr;
+
   GraphIO m_graphIO;
 
   QString m_fileName;
@@ -60,10 +61,6 @@ public:
   bool m_useLibrary;
 
   bool m_readWrite;
-
-private:
-  Q_DECLARE_PUBLIC(DotGraph);
-  DotGraph* q_ptr;
 };
 
 }
diff --git a/src/kgraphviz/dotgraphview.cpp b/src/kgraphviz/dotgraphview.cpp
index fe77613..58f3e96 100644
--- a/src/kgraphviz/dotgraphview.cpp
+++ b/src/kgraphviz/dotgraphview.cpp
@@ -84,6 +84,7 @@
 using namespace KGraphViz;
 
 DotGraphViewPrivate::DotGraphViewPrivate(KActionCollection* actions, DotGraphView* parent) :
+  q_ptr( parent ),
   m_labelViews(),
   m_popup(0),
   m_zoom(1),
@@ -105,8 +106,7 @@ DotGraphViewPrivate::DotGraphViewPrivate(KActionCollection* actions, DotGraphVie
   m_highlighting(false),
   m_loadThread(),
   m_layoutThread(),
-  m_backgroundColor(QColor("white")),
-  q_ptr( parent )
+  m_backgroundColor(QColor("white"))
 {
 }
 
diff --git a/src/kgraphviz/dotgraphview.h b/src/kgraphviz/dotgraphview.h
index 7ade222..8e769ad 100644
--- a/src/kgraphviz/dotgraphview.h
+++ b/src/kgraphviz/dotgraphview.h
@@ -191,14 +191,15 @@ protected:
   void timerEvent ( QTimerEvent * event );
   void leaveEvent ( QEvent * event );
   void enterEvent ( QEvent * event );
-  
+
+  DotGraphViewPrivate * const d_ptr;
+
 private Q_SLOTS:
   void slotAGraphReadFinished();
   void slotAGraphLayoutFinished();
 
 private:
   Q_DECLARE_PRIVATE(DotGraphView);
-  DotGraphViewPrivate * const d_ptr;
 };
 
 }
diff --git a/src/kgraphviz/dotgraphview_p.h b/src/kgraphviz/dotgraphview_p.h
index 7a72f18..5f53f70 100644
--- a/src/kgraphviz/dotgraphview_p.h
+++ b/src/kgraphviz/dotgraphview_p.h
@@ -54,6 +54,9 @@ public:
   KActionCollection* actionCollection() {return m_actions;}
   int displaySubgraph(GraphSubgraph* gsubgraph, int zValue, CanvasElement* parent = 0);
 
+  DotGraphView * const q_ptr;
+  Q_DECLARE_PUBLIC(DotGraphView);
+
   QSet<QGraphicsSimpleTextItem*> m_labelViews;
   QGraphicsScene* m_canvas;
   QMenu* m_popup;
@@ -114,10 +117,6 @@ public:
 
   /// The graph background color
   QColor m_backgroundColor;
-
-private:
-  DotGraphView * const q_ptr;
-  Q_DECLARE_PUBLIC(DotGraphView);
 };
 
 }


More information about the kgraphviewer-devel mailing list