All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Signals | Public Member Functions
Qtilities::CoreGui::SideViewerWidgetFactory Class Reference

The SideViewerWidgetFactory class is intended to act as a factory for side viewer widgets. More...

#include <SideViewerWidgetFactory.h>

Inheritance diagram for Qtilities::CoreGui::SideViewerWidgetFactory:
Inheritance graph
[legend]

List of all members.

Signals

void newWidgetCreated (QWidget *widget, const QString &widget_label)
 Signal which is emitted when a new widget was manufactured.

Public Member Functions

IActionProvideractionProvider () const
 Provides an action provider interface to provide actions to be shown in the SideWidgetWrapper class.
QList< int > destinationModes () const
 Indication of the modes (which have dynamic side viewer widgets) in which the side viewer may appear.
bool isExclusive () const
 Indicates if the widget is exclusive.
bool manageWidgets () const
 When true, the dynamic side viewer widget will manage the lifetime of widgets returned through produceWidget().
QObject * objectBase ()
 Returns the QObject* base of the interface.
const QObject * objectBase () const
 Returns a const QObject* base of the interface.
QWidget * produceWidget ()
 Function which returns the side viewer widget.
 SideViewerWidgetFactory (FactoryInterface< QWidget > *factory_interface, const QString &widget_id, QList< int > modes, QList< int > startup_modes, bool is_exclusive=false)
 Constructs a side viewer widget helper.
QList< int > startupModes () const
 Indicates if the widget should be shown on startup.
QString widgetLabel () const
 The text used to represent the widget.

Detailed Description

The SideViewerWidgetFactory class is intended to act as a factory for side viewer widgets.

The SideViewerWidgetFactory class allows you to add any widget which implements Qtilities::Core::Interfaces::IFactoryInterface to a Qtilities::CoreGui::DynamicSideWidgetViewer without needing to implement Qtilities::Core::ISideViewerWidget yourself.

Every time the dyanmic side widget viewer request a new widget of your type, the factory will produce such a widget and manage its lifetime for you. For example:

DynamicSideWidgetViewer* sideWidget = new DynamicSideWidgetViewer(101);
SideViewerWidgetFactory* fac1 = new SideViewerWidgetFactory(&SideWidgetFileSystem::factory, "File System", QList<int>()<<101, QList<int>()<<101);
SideViewerWidgetFactory* fac2 = new SideViewerWidgetFactory(&ObjectScopeWidget::factory, "Object Scope", QList<int>()<<101, QList<int>()<<101);
QMap<QString, ISideViewerWidget*> map;
map[fac1->widgetLabel()] = fac1;
map[fac2->widgetLabel()] = fac2;
sideWidget->setIFaceMap(map, true);

Constructor & Destructor Documentation

Qtilities::CoreGui::SideViewerWidgetFactory::SideViewerWidgetFactory ( FactoryInterface< QWidget > *  factory_interface,
const QString &  widget_id,
QList< int >  modes,
QList< int >  startup_modes,
bool  is_exclusive = false 
)

Constructs a side viewer widget helper.

Parameters:
interfaceThe factory interface to the widget which must be produced.
widget_idThe string used to represent the widget.
modesThe modes in which this widget must be present.
startup_modesThe modes in which this widget must be visible when the application starts.

Member Function Documentation

bool Qtilities::CoreGui::SideViewerWidgetFactory::isExclusive ( ) const
virtual

Indicates if the widget is exclusive.

When true, this widget can only appear once inside a dynamic side widget viewer.

Note:
When true this side viewer widget can only be used with a Qtilities::CoreGui::DynamicSideWidgetViewer which is set to be exclusive. When the mode(s) specified in destinationModes() is not for an exclusive viewer widget, an error message will be printed.

Implements Qtilities::CoreGui::Interfaces::ISideViewerWidget.

const QObject* Qtilities::CoreGui::SideViewerWidgetFactory::objectBase ( ) const
inlinevirtual

Returns a const QObject* base of the interface.

This function can be used in const methods, but make sure that you don't modify things that should stay const. An example where this is used is when we want to get a property on an object in a const method. This is a const operation.

Implements Qtilities::Core::Interfaces::IObjectBase.

QWidget * Qtilities::CoreGui::SideViewerWidgetFactory::produceWidget ( )
virtual

Function which returns the side viewer widget.

Widget() must be able to produce a new widget every time it is called. The Qtilities::CoreGui::SideViewerWidgetFactory class was designed to help with this process.

The dynamic side viewer widget will manage the lifetime of widgets returned.

Implements Qtilities::CoreGui::Interfaces::ISideViewerWidget.



Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé