![]() |
Home · All Classes · Main Classes · Grouped Classes · Modules · Functions | ![]() |
The QDesignerScriptExtension allows you to generate a per-widget Qt Script snippet to be executed while building the form. More...
#include <QDesignerScriptExtension>
This class was introduced in Qt 4.3.
The QDesignerScriptExtension allows you to generate a per-widget Qt Script snippet to be executed while building the form.
On saving the form, the extension is queried for a script snippet to be associated with the widget while saving the .ui file. This script is then run after creating the widget by uic or QUiLoader.
As opposed to QDesignerCustomWidgetInterface::codeTemplate(), it allows for applying an internal state of the widget that can be manipulated using Qt Designer.
Such a state might for example be the contents of a custom item view widget, for which an editor is provided by the QDesignerTaskMenuExtension.
While saving the form, the state is serialized as a QVariantMap of Qt Designer-supported properties, which is stored in the .ui file. This is handled by data() and setData().
For item view contents, there might be for example a key that determines the number of items and other keys that contain the actual items following a naming scheme (numItems, item1, item2, ...).
On saving, script() is invoked, which should return a script snippet that applies the state to the widget while building the form.
See also Creating Custom Widgets for Qt Designer and QtScript.
Destroys the extension.
Returns a map of variants describing the internal state to be stored in the .ui file.
See also setData().
Returns a script snippet to be associated with the widget.
Applies the internal state stored in data to the widget while loading a form.
See also data().
Copyright © 2007 Trolltech | Trademarks | Qt 4.3.0rc1 |