WidgetPool Class Reference

This Widget pool manages instances of widgets Widgets can be added to this pool by simply passing the classname and the amount of available instances. This class is coupled to the WidgetRegistry . More...

#include <widget_pool.hh>

Inherits PyQt4::QtCore::QObject.

Public Member Functions

 WidgetPool (QObject *parent=NULL)
void Add (const QString &name, int limit=-1)
bool IsAvailable (const QString &name)
WidgetCreate (const QString &name)
bool Take (const QString &name)
bool Give (const QString &name)
QList< QString > GetAvailableWidgets ()

Detailed Description

This Widget pool manages instances of widgets Widgets can be added to this pool by simply passing the classname and the amount of available instances. This class is coupled to the WidgetRegistry .

Definition at line 45 of file widget_pool.hh.


Constructor & Destructor Documentation

WidgetPool ( QObject *  parent = NULL  ) 

Member Function Documentation

void Add ( const QString &  name,
int  limit = -1 
)

add a Widget to the WidgetPool This method adds a class to this widget pool. It does NOT add the given class to the WidgetRegistry. You should first add the class to the WidgetRegistry use the WidgetRegistry::RegisterWidgetFactory(WidgetFactory* factory) for this.

Parameters:
name full qualified class name. Is used to identify the class.
limit amount of available instances of the class in the WidgetRegistry. If unlimited then this can be set to -1.
Widget* Create ( const QString &  name  ) 

returns a instance of the given class name It does not WidgetPool::Take(const QString& name) a instance out of the pool. The user of this class is responsible to call the take method before calling this method.

Parameters:
name Full qualified class of the class of which you would like to have an instance.
Returns:
Returns a instance of the desired class. Returns NULL if all instances are used or class is not in widget registry.
QList<QString> GetAvailableWidgets (  ) 

Get a List with all available Widgets.

Returns:
The returned list contains all widgets which have available instances in the pool. Instances which have no available instances won't be in this list.
bool Give ( const QString &  name  ) 

Returns a instance of a class into the pool This method returns one instance back into the pool. If there is an unlimited amount of instances of this class, nothing will be changed inside the pool.

Parameters:
name full qualified class of the class of which you give back an instance.
Returns:
returns false if class is not known. Otherwise true will be returned.
bool IsAvailable ( const QString &  name  ) 

returns whether this class has available instances or not

Parameters:
name Full qualified class of the class you would like to check
Returns:
returns true if there are available instances. False if all instances are used or class is not in widget registry.
bool Take ( const QString &  name  ) 

Takes a instance of a class out of the pool This method takes one available instances out of the pool. If there are no available instances or unlimited amount of instances, nothing will be changed. Call this method always before creating an instance. If false is returned do not call WidgetPool::Create(const QString& name) !

Parameters:
name full qualified class of the class of which you would like to take an instance.
Returns:
returns false if no instance is available or class is not known. Otherwise true will be returned.

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 10 Nov 2016 for OpenStructure by  doxygen 1.6.1