Tulip  4.2.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
tlp::ViewWidget Class Referenceabstract

#include <ViewWidget.h>

Inherits tlp::View.

Inherited by tlp::GlMainView.

Public Slots

virtual void draw ()
 
virtual void setupUi ()
 
- Public Slots inherited from tlp::View
void addRedrawTrigger (tlp::Observable *)
 
virtual void applySettings ()
 
virtual void centerView (bool graphChanged=false)
 
void clearRedrawTriggers ()
 
virtual void draw ()=0
 
void emitDrawNeededSignal ()
 
virtual void refresh ()
 
void removeRedrawTrigger (tlp::Observable *)
 
void setCurrentInteractor (tlp::Interactor *currentInteractor)
 
void setGraph (tlp::Graph *graph)
 
void setInteractors (const QList< tlp::Interactor * > &)
 
virtual void setState (const tlp::DataSet &)=0
 
virtual void setupUi ()=0
 
void showContextMenu (const QPoint &point, const QPointF &scenePoint)
 
virtual void treatEvent (const Event &)
 
virtual void undoCallback ()
 

Public Member Functions

virtual QGraphicsView * graphicsView () const
 
- Public Member Functions inherited from tlp::View
 View ()
 
virtual ~View ()
 
virtual std::string category () const
 
virtual QList< QWidget * > configurationWidgets () const
 
tlp::InteractorcurrentInteractor () const
 
tlp::Graphgraph () const
 
std::string icon () const
 
QList< tlp::Interactor * > interactors () const
 
virtual tlp::DataSet state () const =0
 
void treatEvents (const std::vector< Event > &events)
 
QSet< tlp::Observable * > triggers () const
 
- Public Member Functions inherited from tlp::Plugin
virtual std::string author () const =0
 
virtual std::string date () const =0
 
virtual std::string group () const =0
 
virtual int id () const
 
virtual std::string info () const =0
 
virtual std::string major () const
 
virtual std::string minor () const
 
virtual std::string name () const =0
 
virtual std::string programmingLanguage () const
 
virtual std::string release () const =0
 
virtual std::string tulipMajor () const
 
virtual std::string tulipMinor () const
 
virtual std::string tulipRelease () const =0
 
- Public Member Functions inherited from tlp::WithParameter
template<typename T >
void addInOutParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
 
template<typename T >
void addInParameter (const std::string &name, const std::string &help, const std::string &defaultValue, bool isMandatory=true)
 
template<typename T >
void addOutParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
 
template<typename T >
void addParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
 
const
tlp::ParameterDescriptionList
getParameters () const
 
bool inputRequired () const
 
- Public Member Functions inherited from tlp::WithDependency
void addDependency (const char *name, const char *release)
 
const std::list< Dependency > & dependencies () const
 
- Public Member Functions inherited from tlp::Observable
void addListener (Observable *const listener) const
 
void addObserver (Observable *const observer) const
 
unsigned int countListeners () const
 
unsigned int countObservers () const
 
unsigned int getReceived () const
 
unsigned int getSent () const
 
void removeListener (Observable *const listener) const
 
void removeObserver (Observable *const observerver) const
 

Protected Slots

virtual void currentInteractorChanged (tlp::Interactor *)
 
virtual void graphDeleted (Graph *parentGraph)
 
- Protected Slots inherited from tlp::View
virtual void currentInteractorChanged (tlp::Interactor *)
 
virtual void fillContextMenu (QMenu *, const QPointF &)
 
virtual void graphChanged (tlp::Graph *)=0
 
virtual void graphDeleted (tlp::Graph *parentGraph)=0
 
virtual void interactorsInstalled (const QList< tlp::Interactor * > &interactors)
 

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
 

Additional Inherited Members

- Signals inherited from tlp::View
void drawNeeded ()
 
void graphSet (tlp::Graph *)
 
- Static Public Member Functions inherited from tlp::Observable
static ObservablegetObject (tlp::node n)
 
static const tlp::VectorGraph & getObservableGraph ()
 
static void holdObservers ()
 
static bool isAlive (tlp::node n)
 
static unsigned int observersHoldCounter ()
 
static void unholdObservers ()
 
- Protected Attributes inherited from tlp::WithParameter
ParameterDescriptionList parameters
 
- Protected Attributes inherited from tlp::WithDependency
std::list< Dependency_dependencies
 

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
protectedvirtual
Returns
The graphics item associated to the central widget
See Also
setCentralWidget

Reimplemented from tlp::View.

virtual void tlp::ViewWidget::currentInteractorChanged ( tlp::Interactor )
protectedvirtualslot

By default, the current interactor gets installed over the central widget.

See Also
View::currentInteractorChanged()
virtual void tlp::ViewWidget::draw ( )
inlinevirtualslot

Reimplemented from View::draw() By default, this method does nothing. We assume the widget is automatically repainted by Qt's windowing manager.

Definition at line 74 of file ViewWidget.h.

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 ( )
virtualslot
See Also
View::setupUi
Note
This method should not be reimplemented as a subclass of ViewWidget
virtual void tlp::ViewWidget::setupWidget ( )
protectedpure 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
protectedvirtual

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.