roviz  0.7
Code Documentation of roviz
Public Member Functions | Protected Slots | Protected Member Functions | List of all members
AbstractWindowItem Class Referenceabstract

The AbstractWindowItem class provides basic standard functionality for a typical item that uses a window. More...

#include <abstract_window_item.h>

Inheritance diagram for AbstractWindowItem:
Inheritance graph
Collaboration diagram for AbstractWindowItem:
Collaboration graph

Public Member Functions

 AbstractWindowItem (QString const &typeName)
 Constructs a AbstractWindowItem with the given name. More...
 
- Public Member Functions inherited from AbstractItem
 AbstractItem (QString typeName)
 Constructs an AbstractItem with the name typeName. More...
 
QString typeName () const
 
QString name () const
 
QString description () const
 
void setName (QString name)
 Set this items name. More...
 
QRectF boundingRect () const override
 Returns the bounding box of the item. More...
 
QPainterPath shape () const override
 Returns the graphical shape of the item's image. More...
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) override
 Paints the contents of the item. More...
 
QList< ItemInput * > const inputs () const
 
QList< ItemOutput * > const outputs () const
 
QImage const image () const
 
int progress () const
 
virtual bool load (class QDomElement &element)
 Loads persistent settings for this item from given XML element. More...
 
virtual bool save (class QDomDocument &document, class QDomElement &element) const
 Saves persistent settings for this item into the given XML element. More...
 
SettingsScopesettingsScope () const
 Returns a pointer to the settings scope associated with this item. More...
 

Protected Slots

virtual void openWindow ()
 This is a default implementation of a slot which opens this items window, if any. If the item is not allocated yet, it uses allocateWindow to request one from the derived class. Override this function for custom behavior.
 

Protected Member Functions

virtual QMainWindow * allocateWindow ()=0
 This is a pure virtual function. The implementation has to construct and return a QMainWindow which this base class can then manage. More...
 
QMainWindow * window () const
 
void setWindow (QMainWindow *window)
 
void deleteWindow ()
 Deletes the window of this item. More...
 
void hideWindow ()
 Hides the window of this item. More...
 
void setOpenWindowContextActionEnabled (bool enabled) const
 This function allows the derived class to enable or disable the context menu option to open this items window for the current context menu. It is typically called in contextMenuPrepare, if needed. The value is reset to its default (true) whenever the user opens a new context menu. More...
 
QAction * addContextMenuEntry (QString const &text, std::function< void()> f=nullptr)
 This function adds a new context menu entry. More...
 
virtual void contextMenuPrepare (QMenu &menu) const
 This method is called with an empty QMenu whenever a contextmenu on the current item is requested. Add Actions to Display them in the Menu. More...
 
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 A simple default implementation of the mouseDoubleClickEvent. Override to do custom things (e.g. open window) More...
 
- Protected Member Functions inherited from AbstractItem
ItemInputaddInput (int transportType, QString const &description="")
 Adds an input to this item. More...
 
ItemOutputaddOutput (int transportType, QString const &description="")
 Adds an output to this item. More...
 
void remove (ItemInput *input)
 Removes an input from this item. More...
 
void remove (ItemOutput *output)
 Removes an output from this item. More...
 
void clearInputs ()
 Remove all the inputs from this item. More...
 
void clearOutputs ()
 Remove all the outputs from this item. More...
 
void setDescription (QString const &description)
 Set the description of the item. More...
 
void setImage (QImage const &image)
 Set the image displayed in the item. More...
 
void setOutputData (ItemOutput *output, QObject *data)
 Set the data of a given output. More...
 
void setProgress (int progress)
 Set the current progress of the item. More...
 
void setProgressAutohide (int ms)
 Sets the progress to -1 after a certain amount of time. More...
 
virtual void paintItemBox (QPainter *painter)
 This Method paints the Item Rectangle, the Icon and the progress bar of the item. Override for custom behavior. More...
 
void timerEvent (QTimerEvent *t) override
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 
void contextMenuEvent (QGraphicsSceneContextMenuEvent *event) override
 

Additional Inherited Members

- Public Slots inherited from AbstractItem
void disconnectConnections ()
 Disconnects all connections from/to the item.
 
- Signals inherited from AbstractItem
void changed ()
 This signal should be emitted by the derived class whenever the items state has changed and needs to be saved again.
 
void nameChanged ()
 This signal is emitted whenever the name has changed.
 
void descriptionChanged ()
 This signal is emitted whenever the description has changed.
 
void progressChanged ()
 This signal is emitted whenever the progress has changed.
 
- Static Public Member Functions inherited from AbstractItem
static int connectorHeight ()
 
static int connectorWidth ()
 
static bool registerConnectorStyle (QColor const &color, int transportType)
 Register a connector style for a transport type. More...
 
static QPen connectorStyle (int transportType)
 
- Properties inherited from AbstractItem
SettingsScope settingsScope
 

Detailed Description

The AbstractWindowItem class provides basic standard functionality for a typical item that uses a window.

It has a pure virtual function, allocateWindow. This function needs to be implemented by the derived class and is used by this base class to construct a window for this item.

See also
AbstractItem

Constructor & Destructor Documentation

◆ AbstractWindowItem()

AbstractWindowItem::AbstractWindowItem ( QString const &  typeName)
explicit

Constructs a AbstractWindowItem with the given name.

Parameters
typeNameThe name of the item to construct

Member Function Documentation

◆ addContextMenuEntry()

QAction * AbstractWindowItem::addContextMenuEntry ( QString const &  text,
std::function< void()>  f = nullptr 
)
protected

This function adds a new context menu entry.

Parameters
textThe text to display for the context menu entry
fThe function to call when the user clicks the context menu entry
Returns
A pointer to the newly created context menu action
See also
contextMenuPrepare

◆ allocateWindow()

virtual QMainWindow* AbstractWindowItem::allocateWindow ( )
protectedpure virtual

This is a pure virtual function. The implementation has to construct and return a QMainWindow which this base class can then manage.

Returns
The window that belongs to this item
Here is the caller graph for this function:

◆ contextMenuPrepare()

void AbstractWindowItem::contextMenuPrepare ( QMenu &  menu) const
protectedvirtual

This method is called with an empty QMenu whenever a contextmenu on the current item is requested. Add Actions to Display them in the Menu.

Parameters
menuThe menu to append your items to.

Reimplemented from AbstractItem.

Here is the call graph for this function:

◆ deleteWindow()

void AbstractWindowItem::deleteWindow ( )
protected

Deletes the window of this item.

See also
window
setWindow
hideWindow

◆ hideWindow()

void AbstractWindowItem::hideWindow ( )
protected

Hides the window of this item.

See also
window
setWindow
deleteWindow

◆ mouseDoubleClickEvent()

void AbstractWindowItem::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

A simple default implementation of the mouseDoubleClickEvent. Override to do custom things (e.g. open window)

Parameters
eventMouse event context information

Reimplemented from AbstractItem.

Here is the call graph for this function:

◆ setOpenWindowContextActionEnabled()

void AbstractWindowItem::setOpenWindowContextActionEnabled ( bool  enabled) const
protected

This function allows the derived class to enable or disable the context menu option to open this items window for the current context menu. It is typically called in contextMenuPrepare, if needed. The value is reset to its default (true) whenever the user opens a new context menu.

Parameters
enabledWhether or not to enable the context menu option to open the window
See also
contextMenuPrepare

◆ setWindow()

void AbstractWindowItem::setWindow ( QMainWindow *  window)
protected
Parameters
windowThe window to couple this item to
See also
window
deleteWindow
hideWindow
Here is the call graph for this function:

◆ window()

QMainWindow * AbstractWindowItem::window ( ) const
protected
Returns
The window of this item
See also
setWindow
deleteWindow
hideWindow
Here is the caller graph for this function:

The documentation for this class was generated from the following files: