If you need to create a new view, you have to create a new class that implements the View interface
View interface (in library/tulip-qt/include/tulip/View.h) can be split into 3 parts
Data part :
void setData(Graph *,DataSet);
// This function is called when we load a new graph or when we create a new one
// In the DataSet you can have nothing when you create a new graph or you can have old data when you load a tlp file
void getData(Graph **, DataSet *);
// This function is called when you save your graph
// You must store the graph and the view data
voif setGraph(graph *);
// This function is called when you change the visualized graph in hierarchical view (for example)
Graph *getGraph();
Interactors part :
std::list<QAction *> *getInteractorsActionList();
// Action of the list will be put in graphToolBar on top of Tulip window
void installInteractor(QAction *);
// The QAction passed to this function is one of the getInteractorActionList(), in this function you have to put interactor in your view
Display part :
void draw();
// Call when the graph is modified or by interactors
void redraw();
// Mainly call by Qt when a menu is open in front of the view
// Data is not modified so the view is unchanged
void init();
// Call when the graph is modified and when the view need to be completely init and draw
// For example this function is call when a layout algorithm is running, in NodeLinkDiagramComponent this function call centerView() and draw()
This is an example of a simple view. This view displays the number of nodes/edges on the graph

This example provides just a view without interactors
.h file
class TutoView : public tlp::View {
Q_OBJECT
public:
QWidget *construct(QWidget *parent) {
//Construct Qt part of the view
widget= new QWidget(parent);
widget->resize(230, 60);
QGridLayout *gridLayout = new QGridLayout(widget);
gridLayout->setSpacing(0);
gridLayout->setMargin(0);
nodeNumber = new QLineEdit(widget);
nodeNumber->setReadOnly(true);
gridLayout->addWidget(nodeNumber, 0, 0, 1, 1);
edgeNumber = new QLineEdit(widget);
edgeNumber->setReadOnly(true);
gridLayout->addWidget(edgeNumber, 1, 0, 1, 1);
return widget;
}
//In this example we don't read DataSet parameters because this view doesn't need to be saved
void setData(tlp::Graph *graph,tlp::DataSet dataSet) {
this->graph=graph;
draw();
}
void getData(tlp::Graph **graph,tlp::DataSet *dataSet) {
*graph=this->graph;
}
tlp::Graph *getGraph() {return graph;}
//In this example we have no interactor so we return empty list
std::list<QAction *> *getInteractorsActionList() {
return new std::list<QAction*>;
}
void installInteractor(QAction*) {}
protected :
tlp::Graph *graph;
QWidget *widget;
QLineEdit *nodeNumber;
QLineEdit *edgeNumber;
public slots :
//Display function, we get back nodes/edges number
void draw() {
nodeNumber->setText(QString("Number of nodes : ")+QString::number(graph->numberOfNodes()));
edgeNumber->setText(QString("Number of edges : ")+QString::number(graph->numberOfEdges()));
}
//refresh and init is automatically done by Qt
void refresh() {}
void init() {}
void setGraph(tlp::Graph *graph) {this->graph=graph;}
};
.cpp file
// This line is needed to register the plugin in Tulip
// Warning : last parameter(42) is the id of the plugin, it must be unique
VIEWPLUGIN(TutoView, "TutorielView", "Tulip Team", "21/11/2008", "Tutoriel view", "1.0", 42);