Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

WidgetFactory Class Reference
(QtUiTest::WidgetFactory)
[QtUiTestModule]

The WidgetFactory class provides a factory interface for QtUiTest widget wrapper classes. More...

This class is under development and is subject to change.

Public Functions


Detailed Description

The WidgetFactory class provides a factory interface for QtUiTest widget wrapper classes.

QtUiTest::WidgetFactory is an abstract base class which enables the creation of QtUiTest wrapper objects around Qt/Qt Extended widgets.

Customizing QtUiTest behaviour for particular widgets is achieved by implementing one or more test widget classes which inherit from one or more QtUiTest widget interfaces, subclassing QtUiTest::WidgetFactory, reimplementing the pure virtual keys() and create() functions to create instances of the custom test widget classes, and exporting the factory class using the Q_EXPORT_PLUGIN2() macro.


Member Function Documentation

QObject * WidgetFactory::create ( QObject * object )   [pure virtual]

Attempts to create a test widget to wrap object. Returns the created test widget. Returns 0 if this factory does not support wrapping object.

The returned object is suitable for use with qtuitest_cast.

This function will only be called for objects which inherit one of the classes returned by keys().

QObject * WidgetFactory::find ( QtUiTest::WidgetType type )   [virtual]

Returns a widget or test widget of type, or 0 if none can be found.

Reimplement this function to provide custom behaviour for QtUiTest::findWidget(). For example, if a custom soft menu widget is being used rather than the shipped ContextLabel class, this function must be reimplemented to return a pointer to the custom widget.

The base implementation always returns 0.

QStringList WidgetFactory::keys () const   [pure virtual]

Returns the list of C++ class names this factory can generate test widgets for.

Note that returning a class from this function does not guarantee that the factory will always be able to generate a test widget for that class.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3