Tulip
4.6.0
Better Visualization Through Research
|
#include <ViewWidget.h>
Public Slots | |
virtual void | draw () |
virtual void | setupUi () |
Public Member Functions | |
virtual QGraphicsView * | graphicsView () const |
Protected Slots | |
virtual void | currentInteractorChanged (tlp::Interactor *) |
virtual void | graphDeleted (Graph *parentGraph) |
Protected Member Functions | |
void | addToScene (QGraphicsItem *item) |
virtual QGraphicsItem * | centralItem () const |
void | removeFromScene (QGraphicsItem *item) |
void | setCentralWidget (QWidget *, bool deleteOldCentralWidget=true) |
virtual void | setupWidget ()=0 |
QPixmap | snapshot (const QSize &outputSize=QSize()) const |
ViewWidget provides convenience functions to allow the user to build a view plugin that displays a QWidget as its main element.
The ViewWidget class will build a QGraphicsView that sets a widget as the background of the whole panel. Sublassing ViewWidget means that you'll have to provide a centralWidget (see ViewWidget::setCentralWidget) that will take up the whole panel and be drawn in the background. You can use the addToScene() and removeFromScene() methods to edit the QGraphicsItems that will drawn over the widget.
By default, when an interactor gets active on a ViewWidget, it gets installed on the centralWidget (see Interactor::install)
Definition at line 43 of file ViewWidget.h.
void tlp::ViewWidget::addToScene | ( | QGraphicsItem * | item | ) | [protected] |
Adds an item to the graphicsView that will be drawn on top of the widget This is a convenience function for the user to avoid taking care of item parenthood.
virtual QGraphicsItem* tlp::ViewWidget::centralItem | ( | ) | const [protected, virtual] |
Reimplemented from tlp::View.
virtual void tlp::ViewWidget::currentInteractorChanged | ( | tlp::Interactor * | ) | [protected, virtual, slot] |
By default, the current interactor gets installed over the central widget.
Reimplemented from tlp::View.
virtual void tlp::ViewWidget::draw | ( | ) | [inline, virtual, slot] |
Reimplemented from View::draw() By default, this method does nothing. We assume the widget is automatically repainted by Qt's windowing manager.
Implements tlp::View.
Reimplemented in tlp::GlMainView.
Definition at line 74 of file ViewWidget.h.
virtual void tlp::ViewWidget::graphDeleted | ( | Graph * | parentGraph | ) | [protected, virtual, slot] |
Called when the graph associated to the view gets deleted. This method should call setGraph to input a new graph pointer (NULL or valid)
parentGraph | The parent of the graph that was just deleted. If there is no parent available (eg. the graph was root), parentGraph is NULL |
Implements tlp::View.
virtual QGraphicsView* tlp::ViewWidget::graphicsView | ( | ) | const [virtual] |
Implements tlp::View.
void tlp::ViewWidget::removeFromScene | ( | QGraphicsItem * | item | ) | [protected] |
Removes a graphics item from the view. This is a convenience function for the user to avoid taking care of item parenthood.
void tlp::ViewWidget::setCentralWidget | ( | QWidget * | , |
bool | deleteOldCentralWidget = true |
||
) | [protected] |
Sets the widget to be drawn as the view's background. This method may be called several times. Parenthood between the widget and items added using addToScene will be automatically updated.
virtual void tlp::ViewWidget::setupUi | ( | ) | [virtual, slot] |
Implements tlp::View.
virtual void tlp::ViewWidget::setupWidget | ( | ) | [protected, pure virtual] |
Sets up the central widget. This is similar to View::setupUi in the sense that the purpose of setupWidget is to construct the GUI element.
Implemented in tlp::GlMainView.
QPixmap tlp::ViewWidget::snapshot | ( | const QSize & | outputSize = QSize() | ) | const [protected, virtual] |
Takes a snapshot of the view's screen and saves it into the given pixmap. The snapshot is scaled to outputSize. If a null size is given, the snapshot is to be on a 1:1 ratio.
Implements tlp::View.
Reimplemented in tlp::GlMainView.