CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
ctkLayoutViewFactory Class Reference

#include <Libs/Widgets/ctkLayoutViewFactory.h>

Inheritance diagram for ctkLayoutViewFactory:
Inheritance graph
[legend]
Collaboration diagram for ctkLayoutViewFactory:
Collaboration graph
[legend]

Public Member Functions

virtual void beginSetupLayout ()
 
 ctkLayoutViewFactory (QObject *parent=0)
 Constructor. More...
 
virtual void endSetupLayout ()
 
virtual bool isElementSupported (QDomElement layoutElement) const
 
QList< QWidget * > registeredViews () const
 
virtual void setupView (QDomElement layoutElement, QWidget *view)
 
void setUseCachedViews (bool cache)
 
virtual QStringList supportedElementNames () const
 
bool useCachedViews () const
 
virtual QWidget * viewFromXML (QDomElement layoutElement)
 
virtual QList< QWidget * > viewsFromXML (QDomElement layoutElement)
 
virtual ~ctkLayoutViewFactory ()
 Destructor. More...
 

Protected Member Functions

virtual QWidget * createViewFromXML (QDomElement layoutElement)
 
virtual QList< QWidget * > createViewsFromXML (QDomElement layoutElement)
 
QDomElement layoutElement (QWidget *view) const
 
QList< QWidget * > registeredViews (const QDomElement &layoutElement) const
 
virtual void registerView (QDomElement layoutElement, QWidget *view)
 
virtual void unregisterView (QDomElement layoutElement, QWidget *view)
 
virtual void unregisterView (QWidget *view)
 

Protected Attributes

QScopedPointer< ctkLayoutViewFactoryPrivate > d_ptr
 

Properties

bool useCachedViews
 

Detailed Description

ctkLayoutViewFactory is an abstract class that creates and setups widgets for a specific view XML element from ctkLayoutManager. See ctkTemplateLayoutViewFactory for a factory that can instantiate any Qt widget. This class is meant to be derived with at least the method createViewFromXML() being overwritten.

See also
ctkLayoutManager, ctkTemplateLayoutViewFactory, createViewFromXML()

Definition at line 42 of file ctkLayoutViewFactory.h.

Constructor & Destructor Documentation

◆ ctkLayoutViewFactory()

ctkLayoutViewFactory::ctkLayoutViewFactory ( QObject *  parent = 0)

Constructor.

◆ ~ctkLayoutViewFactory()

virtual ctkLayoutViewFactory::~ctkLayoutViewFactory ( )
virtual

Destructor.

Member Function Documentation

◆ beginSetupLayout()

virtual void ctkLayoutViewFactory::beginSetupLayout ( )
virtual

Called by the layout factory before a layout is setup.

See also
endSetupLayout()

◆ createViewFromXML()

virtual QWidget* ctkLayoutViewFactory::createViewFromXML ( QDomElement  layoutElement)
protectedvirtual

Create a new view from a layoutElement. Returns 0 by default

See also
viewFromXML

Reimplemented in ctkTemplateLayoutViewFactory< T >.

◆ createViewsFromXML()

virtual QList<QWidget*> ctkLayoutViewFactory::createViewsFromXML ( QDomElement  layoutElement)
protectedvirtual

Create new views from a layoutElement. Returns createViewFromXML() by default.

See also
viewsFromXML(), createViewFromXML()

◆ endSetupLayout()

virtual void ctkLayoutViewFactory::endSetupLayout ( )
virtual

Called by the layout factory after a layout is setup.

See also
beginSetupLayout()

◆ isElementSupported()

virtual bool ctkLayoutViewFactory::isElementSupported ( QDomElement  layoutElement) const
virtual

Returns true if the layout element can be created and setup by the factory. By default, returns true if the layout element name is contained in supportedElementNames().

See also
supportedElementNames()

◆ layoutElement()

QDomElement ctkLayoutViewFactory::layoutElement ( QWidget *  view) const
protected

Return the layout element registered with the view or a null element if the view is not registered.

See also
registerView(), unregisterView()

◆ registeredViews() [1/2]

QList<QWidget*> ctkLayoutViewFactory::registeredViews ( ) const

Return all the widgets that have been registered. Used internally for testing.

See also
registeredViews()

◆ registeredViews() [2/2]

QList<QWidget*> ctkLayoutViewFactory::registeredViews ( const QDomElement &  layoutElement) const
protected

Return the list of widgets that have already been created by view(s)FromXML().

See also
registerView(), unregisterView()

◆ registerView()

virtual void ctkLayoutViewFactory::registerView ( QDomElement  layoutElement,
QWidget *  view 
)
protectedvirtual

Save the view to reuse it later on (in view(s)FromXML() ).

See also
registerView(), registeredViews()

◆ setupView()

virtual void ctkLayoutViewFactory::setupView ( QDomElement  layoutElement,
QWidget *  view 
)
virtual

Method is called each time a view is made visible into a layout. This method can be reimplemented. Sets the widget visibility to true and register the view by default.

See also
viewsFromXML()

◆ setUseCachedViews()

void ctkLayoutViewFactory::setUseCachedViews ( bool  cache)

Set the useCachedViews property value.

See also
useCachedViews

◆ supportedElementNames()

virtual QStringList ctkLayoutViewFactory::supportedElementNames ( ) const
virtual

Returns the list of element names supported by the factory (e.g. "view", "myview"...). Returns ["view"] by default. Can be reimplemented to support other element names.

Warning
It is not possible to support the "layout" and "item" XML elements.
See also
isSupportedElement()

◆ unregisterView() [1/2]

virtual void ctkLayoutViewFactory::unregisterView ( QDomElement  layoutElement,
QWidget *  view 
)
protectedvirtual

Forget about the view. The view is not being deleted.

See also
registerView(), registeredViews()

◆ unregisterView() [2/2]

virtual void ctkLayoutViewFactory::unregisterView ( QWidget *  view)
protectedvirtual

Forget about the view. The view is not being deleted.

See also
registerView(), unregisterView()

◆ useCachedViews()

bool ctkLayoutViewFactory::useCachedViews ( ) const

Return the useCachedViews property value.

See also
useCachedViews

◆ viewFromXML()

virtual QWidget* ctkLayoutViewFactory::viewFromXML ( QDomElement  layoutElement)
virtual

Virtual method that returns a widget from a "view" layout element. You are ensured that the tagName of the element is one of the element from the supportedElementNames() list. The XML element can contain an arbitrary number of XML attributes. Returns previously registered or cached view if any, otherwise create a new view using createViewFromXML(). Must be reimplemented.

See also
viewsFromXML(), setupView(), registeredViews(), useCachedView, createViewFromXML()

◆ viewsFromXML()

virtual QList<QWidget*> ctkLayoutViewFactory::viewsFromXML ( QDomElement  layoutElement)
virtual

Virtual method that returns a list of widgets from a "view" layout element. If the parent "item" element has a "multiple=true" XML attribute, the "view" layout element can describe many widgets instead of just one widget. The returned widgets will automatically be layout into their parent layout (e.g. boxlayout). Returns previously registered or cached views if any, otherwise create new views using createViewsFromXML().

See also
viewFromXML(), registeredViews(),

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkLayoutViewFactoryPrivate> ctkLayoutViewFactory::d_ptr
protected

Definition at line 115 of file ctkLayoutViewFactory.h.

Property Documentation

◆ useCachedViews

bool ctkLayoutViewFactory::useCachedViews
readwrite

This property controls whether the views are cached and reused from a previous layout. True by default.

See also
useCachedViews(), setUseCachedViews()

Definition at line 1 of file ctkLayoutViewFactory.h.


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