libyui-qt-graph  2.44.6
YQGraph.h
1 /*
2  * Copyright (C) 2009-2012 Novell, Inc
3  * This library is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as
5  * published by the Free Software Foundation; either version 2.1 of the
6  * License, or (at your option) version 3.0 of the License. This library
7  * is distributed in the hope that it will be useful, but WITHOUT ANY
8  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  * License for more details. You should have received a copy of the GNU
11  * Lesser General Public License along with this library; if not, write
12  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  * Floor, Boston, MA 02110-1301 USA
14  */
15 
16 /*
17  * File: YQGraph.h
18  * Author: Arvin Schnell <aschnell@suse.de>
19  */
20 
21 
22 #ifndef YQGraph_h
23 #define YQGraph_h
24 
25 #include <YGraph.h>
26 
27 #include "QY2Graph.h"
28 
29 
30 class YQGraph : public QY2Graph, public YGraph
31 {
32  Q_OBJECT
33 
34 public:
35 
36  YQGraph(YWidget* parent, const std::string& filename, const std::string& layoutAlgorithm);
37 
38  YQGraph(YWidget* parent, /* graph_t */ void* graph);
39 
40  virtual ~YQGraph();
41 
42  /**
43  * Preferred width of the widget.
44  *
45  * Reimplemented from YWidget.
46  **/
47  virtual int preferredWidth();
48 
49  /**
50  * Preferred height of the widget.
51  *
52  * Reimplemented from YWidget.
53  **/
54  virtual int preferredHeight();
55 
56  /**
57  * Set the new size of the widget.
58  *
59  * Reimplemented from YWidget.
60  **/
61  virtual void setSize(int newWidth, int newHeight);
62 
63  void renderGraph(const std::string& filename, const std::string& layoutAlgorithm);
64 
65  void renderGraph(/* graph_t */ void* graph);
66 
67  std::string activatedNode() const { return lastActivatedNode; }
68 
69 private slots:
70 
71  void backgroundContextMenu(QContextMenuEvent* event);
72  void nodeContextMenu(QContextMenuEvent* event, const QString& name);
73  void nodeDoubleClick(QMouseEvent* event, const QString& name);
74 
75 private:
76 
77  void init();
78 
79  std::string lastActivatedNode;
80 
81 };
82 
83 
84 #endif // YQGraph_h
virtual int preferredWidth()
Preferred width of the widget.
Definition: YQGraph.cc:89
The QY2Graph widget shows a graph layouted by graphviz in a QGraphicsView/QGraphicsScene.
Definition: QY2Graph.h:40
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
Definition: YQGraph.cc:103
virtual int preferredHeight()
Preferred height of the widget.
Definition: YQGraph.cc:96