Tulip  5.2.1
Large graphs analysis and drawing
tlp::ViewWidget Class Referenceabstract

#include <ViewWidget.h>

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

Public Slots

void draw () override
 
void setupUi () override
 
- Public Slots inherited from tlp::View
void addRedrawTrigger (tlp::Observable *)
 
virtual void applySettings ()
 
virtual void centerView (bool graphChanged=false)
 
virtual bool checkOnClose ()
 
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)
 
virtual 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)
 
void treatEvent (const Event &) override
 
virtual void undoCallback ()
 

Public Member Functions

QGraphicsView * graphicsView () const override
 
void resetGraphicsScene () override
 
- Public Member Functions inherited from tlp::View
 View ()
 
 ~View () override
 
std::string category () const override
 
virtual QList< QWidget * > configurationWidgets () const
 
virtual QString configurationWidgetsStyleSheet () const
 
tlp::InteractorcurrentInteractor () const
 
tlp::Graphgraph () const
 
std::string icon () const override
 
QList< tlp::Interactor * > interactors () const
 
virtual tlp::DataSet state () const =0
 
void treatEvents (const std::vector< Event > &events) override
 
QSet< tlp::Observable * > triggers () const
 
- Public Member Functions inherited from tlp::Plugin
virtual std::string author () const =0
 
virtual std::string date () const =0
 
void declareDeprecatedName (const std::string &oldName)
 
std::string deprecatedName ()
 
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, const std::string &valuesDescription=std::string())
 
template<typename T >
void addInParameter (const std::string &name, const std::string &help, const std::string &defaultValue, bool isMandatory=true, const std::string &valuesDescription=std::string())
 
template<typename T >
void addOutParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true, const std::string &valuesDescription=std::string())
 
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::ParameterDescriptionListgetParameters () 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

void currentInteractorChanged (tlp::Interactor *) override
 
void graphDeleted (Graph *parentGraph) override
 
- 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)
 
QGraphicsItem * centralItem () const override
 
void removeFromScene (QGraphicsItem *item)
 
void setCentralWidget (QWidget *, bool deleteOldCentralWidget=true)
 
virtual void setupWidget ()=0
 
QPixmap snapshot (const QSize &outputSize=QSize()) const override
 
- Protected Member Functions inherited from tlp::Observable
 Observable (const Observable &)
 
bool hasOnlookers () const
 
void observableDeleted ()
 
Observableoperator= (const Observable &)
 
void sendEvent (const Event &message)
 
virtual void treatEvent (const Event &message)
 

Additional Inherited Members

- Signals inherited from tlp::View
void drawNeeded ()
 
void graphSet (tlp::Graph *)
 
void interactorsChanged ()
 
- Static Public Member Functions inherited from tlp::Observable
static void disableEventNotification ()
 
static void enableEventNotification ()
 
static tlp::node getNode (const tlp::Observable *obs)
 
static ObservablegetObject (tlp::node n)
 
static const tlp::VectorGraph & getObservableGraph ()
 
static unsigned int getScheduled (tlp::node n)
 
static void holdObservers ()
 
static bool isAlive (tlp::node n)
 
static unsigned int observersHoldCounter ()
 
static void unholdObservers ()
 
- Protected Attributes inherited from tlp::Plugin
std::string oldName
 
- 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 49 of file ViewWidget.h.

Member Function Documentation

◆ addToScene()

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.

◆ centralItem()

QGraphicsItem* tlp::ViewWidget::centralItem ( ) const
overrideprotectedvirtual
Returns
The graphics item associated to the central widget
See also
setCentralWidget

Reimplemented from tlp::View.

◆ currentInteractorChanged

void tlp::ViewWidget::currentInteractorChanged ( tlp::Interactor )
overrideprotectedslot

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

See also
View::currentInteractorChanged()

◆ draw

void tlp::ViewWidget::draw ( )
inlineoverrideslot

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 84 of file ViewWidget.h.

◆ graphicsView()

QGraphicsView* tlp::ViewWidget::graphicsView ( ) const
overridevirtual
See also
View::graphicsView()
Note
This method should not be reimplemented as a subclass of ViewWidget

Implements tlp::View.

◆ removeFromScene()

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.

◆ setCentralWidget()

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.

◆ setupUi

void tlp::ViewWidget::setupUi ( )
overrideslot
See also
View::setupUi
Note
This method should not be reimplemented as a subclass of ViewWidget

◆ setupWidget()

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.

◆ snapshot()

QPixmap tlp::ViewWidget::snapshot ( const QSize &  outputSize = QSize()) const
overrideprotectedvirtual

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.