Tulip  4.6.0
Better Visualization Through Research
tlp::ViewWidget Class Reference

#include <ViewWidget.h>

+ Inheritance diagram for tlp::ViewWidget:
+ Collaboration diagram for tlp::ViewWidget:

List of all members.

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

Detailed Description

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)

Note:
When creating a ViewWidget, you should overload setupWidget instead of setupUi. If you still want to implement setupUi, you must call the ViewWidget::setupUi() method first.

Definition at line 43 of file ViewWidget.h.


Member Function Documentation

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]
Returns:
The graphics item associated to the central widget
See also:
setCentralWidget

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.

See also:
View::currentInteractorChanged()

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)

Parameters:
parentGraphThe 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]
See also:
View::graphicsView()
Note:
This method should not be reimplemented as a subclass of ViewWidget

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.

Note:
The ViewWidget takes ownership of the central widget. The previous central widget gets deleted in the process.
virtual void tlp::ViewWidget::setupUi ( ) [virtual, slot]
See also:
View::setupUi
Note:
This method should not be reimplemented as a subclass of ViewWidget

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.

Warning:
This method MUST call the setCentralWidget to provide the ViewWidget with a valid widget.

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.

Returns:
A non-null pixmap of the snapshot was correctly taken.

Implements tlp::View.

Reimplemented in tlp::GlMainView.

 All Classes Files Functions Variables Enumerations Enumerator Properties