#include <widget_pool.hh>
Inherits QObject.
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.
◆ WidgetPool()
◆ Add()
void Add |
( |
const QString & |
name, |
|
|
int |
limit = -1 |
|
) |
| |
◆ Create()
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.
◆ GetAvailableWidgets()
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.
◆ Give()
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.
◆ IsAvailable()
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.
◆ Take()
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: