#include <formIO.h>
Static Public Member Functions | |
| static bool | saveFormToDom (Form *form, TQDomDocument &domDoc) |
| static bool | saveFormToFile (Form *form, const TQString &filename=TQString()) |
| static bool | saveFormToString (Form *form, TQString &dest, int indent=0) |
| static bool | saveFormToByteArray (Form *form, TQByteArray &dest) |
| static bool | loadFormFromDom (Form *form, TQWidget *container, TQDomDocument &domDoc) |
| static bool | loadFormFromByteArray (Form *form, TQWidget *container, TQByteArray &src, bool preview=false) |
| static bool | loadFormFromString (Form *form, TQWidget *container, TQString &src, bool preview=false) |
| static bool | loadFormFromFile (Form *form, TQWidget *container, const TQString &filename=TQString()) |
| static void | saveWidget (ObjectTreeItem *item, TQDomElement &parent, TQDomDocument &domDoc, bool insideGridLayout=false) |
| static void | cleanClipboard (TQDomElement &uiElement) |
| static void | loadWidget (Container *container, const TQDomElement &el, TQWidget *parent=0) |
| static void | savePropertyElement (TQDomElement &parentNode, TQDomDocument &domDoc, const TQString &tagName, const TQString &property, const TQVariant &value) |
| static TQVariant | readPropertyValue (TQDomNode node, TQObject *obj, const TQString &name) |
| static void | savePropertyValue (TQDomElement &parentNode, TQDomDocument &parent, const char *name, const TQVariant &value, TQWidget *w, WidgetLibrary *lib=0) |
Static Protected Member Functions | |
| static void | writeVariant (TQDomDocument &parent, TQDomElement &parentNode, TQVariant value) |
| static void | createToplevelWidget (Form *form, TQWidget *container, TQDomElement &element) |
| static TQString | saveImage (TQDomDocument &domDoc, const TQPixmap &pixmap) |
| static TQPixmap | loadImage (TQDomDocument domDoc, const TQString &name) |
| static void | readChildNodes (ObjectTreeItem *tree, Container *container, const TQDomElement &el, TQWidget *w) |
| static void | addIncludeFileName (const TQString &include, TQDomDocument &domDoc) |
Detailed Description
This class act as a namespace for all .ui files related functions, ie saving/loading .ui files.
You don't need to create a FormIO object, as all methods are static.
This class is able to read and write Forms to .ui files, and to save each type of properties, including set and enum properties, and pixmaps(pixmap-related code was taken from TQt Designer). A class to save/load forms from .ui files
Constructor & Destructor Documentation
◆ FormIO()
| FormIO::FormIO | ( | ) |
Definition at line 93 of file formIO.cpp.
◆ ~FormIO()
| FormIO::~FormIO | ( | ) |
Definition at line 97 of file formIO.cpp.
Member Function Documentation
◆ addIncludeFileName()
|
staticprotected |
Adds an include file name to be saved in the "includes" part of .ui file, which is needed by uic.
Definition at line 1478 of file formIO.cpp.
◆ cleanClipboard()
|
static |
Cleans the "UI" TQDomElement after saving widget. It deletes the "includes" element not needed when pasting, and make sure all the "widget" elements are at the beginning. Call this after copying a widget, before pasting.
Definition at line 1106 of file formIO.cpp.
◆ createToplevelWidget()
|
staticprotected |
Creates a toplevel widget from the TQDomElement element in the Form form, with parent as parent widget. It calls readPropertyValue() and loadWidget() to load child widgets.
Definition at line 1272 of file formIO.cpp.
◆ loadFormFromByteArray()
|
static |
Loads a form from the src TQByteArray.
- See also
- loadFormFromDom(), loadForm().
- Returns
- true if loading succeeded.
Definition at line 220 of file formIO.cpp.
◆ loadFormFromDom()
|
static |
Loads a form from the domDoc TQDomDocument. Called by loadForm() and loadFormData().
- Returns
- true if loading succeeded.
- Todo
- We can either 1) convert from old format and later save in a new one or 2) keep old format. To do this we may need to look at the original format version number.
- Todo
- display information about too new format and that "some information will not be available".
Definition at line 311 of file formIO.cpp.
◆ loadFormFromFile()
|
static |
Loads the .ui file filename in the Form form. If filename is null or not given, a Open File dialog will be shown to select the file to open. createToplevelWidget() is used to load the Form's toplevel widget.
- Returns
- true if loading succeeded.
- Todo
- Add errors code and error dialog
Definition at line 272 of file formIO.cpp.
◆ loadFormFromString()
|
static |
Definition at line 244 of file formIO.cpp.
◆ loadImage()
|
staticprotected |
- Returns
- the loaded pixmap This function loads the pixmap named name in the DOM document domDoc. Decoding code is taken from TQt Designer.
Definition at line 1563 of file formIO.cpp.
◆ loadWidget()
|
static |
Loads the widget associated to the TQDomElement el into the Container container, with parent as parent widget. If parent = 0, the Container::widget() is used as parent widget. This is used to copy/paste widgets.
- Todo
- allow setting this for data view mode as well
Definition at line 1119 of file formIO.cpp.
◆ readChildNodes()
|
staticprotected |
Reads the child nodes of a "widget" element.
Definition at line 1320 of file formIO.cpp.
◆ readPropertyValue()
|
static |
Read an object property in the DOM doc.
- Parameters
-
node the TQDomNode of the property obj the widget whose property is being read name the name of the property being read
Definition at line 737 of file formIO.cpp.
◆ saveFormToByteArray()
|
static |
Saves the form inside the dest TQByteArray.
- Returns
- true if saving succeeded.
- See also
- saveFormToDom(), saveForm()
Definition at line 134 of file formIO.cpp.
◆ saveFormToDom()
|
static |
Save the Form in the domDoc TQDomDocument. Called by saveForm().
- Returns
- true if saving succeeded.
- See also
- saveForm()
We save the savePixmapsInline property in the Form
Save tab Stops
Definition at line 154 of file formIO.cpp.
◆ saveFormToFile()
|
static |
Save the Form form to the file filename. If filename is null or not given, a Save File dialog will be shown to choose dest file.
- Returns
- true if saving succeeded.
- Todo
- Add errors code and error dialog
Definition at line 102 of file formIO.cpp.
◆ saveFormToString()
|
static |
Saves the Form to the dest string. indent can be specified to apply indentation.
- Returns
- true if saving succeeded.
- See also
- saveForm()
Definition at line 144 of file formIO.cpp.
◆ saveImage()
|
staticprotected |
- Returns
- the name of the pixmap saved, to use to access it This function save the TQPixmap pixmap into the DOM document domDoc. The pixmap is converted to XPM and compressed for compatibility with TQt Designer. Encoding code is taken from Designer.
Definition at line 1511 of file formIO.cpp.
◆ savePropertyElement()
|
static |
Save an element in the domDoc as child of parentNode. The element will be saved like this :
Definition at line 728 of file formIO.cpp.
◆ savePropertyValue()
|
static |
Write an object property in the DOM doc.
- Parameters
-
parentNode the DOM document to write to name the name of the property being saved value the value of this property w the widget whose property is being saved lib the widget library for which the property is being saved
Properties of subwidget are saved with subwidget="true" arribute added to 'property' XML element.
Definition at line 401 of file formIO.cpp.
◆ saveWidget()
|
static |
Saves the widget associated to the ObjectTreeItem item into DOM document domDoc, with parent as parent node. It calls readPropertyValue() for each object property, readAttribute() for each attribute and itself to save child widgets.
- Returns
- true if saving succeeded. This is used to copy/paste widgets.
- Todo
- more properties like "dataSource" may needed here...
Definition at line 912 of file formIO.cpp.
◆ writeVariant()
|
staticprotected |
Saves the TQVariant value as text to be included in an xml file, with parentNode.
Definition at line 477 of file formIO.cpp.
The documentation for this class was generated from the following files:
