kexi

KFormDesigner::FormIO Class Reference

#include <formIO.h>

Inherits QObject.

List of all members.


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 Qt Designer). A class to save/load forms from .ui files

Definition at line 74 of file formIO.h.


Static Public Member Functions

static bool saveFormToDom (Form *form, QDomDocument &domDoc)
static bool saveFormToFile (Form *form, const QString &filename=QString::null)
static bool saveFormToString (Form *form, QString &dest, int indent=0)
static bool saveFormToByteArray (Form *form, QByteArray &dest)
static bool loadFormFromDom (Form *form, QWidget *container, QDomDocument &domDoc)
static bool loadFormFromByteArray (Form *form, QWidget *container, QByteArray &src, bool preview=false)
static bool loadFormFromString (Form *form, QWidget *container, QString &src, bool preview=false)
static bool loadFormFromFile (Form *form, QWidget *container, const QString &filename=QString::null)
static void saveWidget (ObjectTreeItem *item, QDomElement &parent, QDomDocument &domDoc, bool insideGridLayout=false)
static void cleanClipboard (QDomElement &uiElement)
static void loadWidget (Container *container, const QDomElement &el, QWidget *parent=0)
static void savePropertyElement (QDomElement &parentNode, QDomDocument &domDoc, const QString &tagName, const QString &property, const QVariant &value)
static QVariant readPropertyValue (QDomNode node, QObject *obj, const QString &name)
static void savePropertyValue (QDomElement &parentNode, QDomDocument &parent, const char *name, const QVariant &value, QWidget *w, WidgetLibrary *lib=0)

Static Protected Member Functions

static void writeVariant (QDomDocument &parent, QDomElement &parentNode, QVariant value)
static void createToplevelWidget (Form *form, QWidget *container, QDomElement &element)
static QString saveImage (QDomDocument &domDoc, const QPixmap &pixmap)
static QPixmap loadImage (QDomDocument domDoc, const QString &name)
static void readChildNodes (ObjectTreeItem *tree, Container *container, const QDomElement &el, QWidget *w)
static void addIncludeFileName (const QString &include, QDomDocument &domDoc)

Member Function Documentation

bool FormIO::saveFormToDom ( Form form,
QDomDocument &  domDoc 
) [static]

Save the Form in the domDoc QDomDocument. 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.

bool FormIO::saveFormToFile ( Form form,
const QString &  filename = QString::null 
) [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.

bool FormIO::saveFormToString ( Form form,
QString &  dest,
int  indent = 0 
) [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.

bool FormIO::saveFormToByteArray ( Form form,
QByteArray &  dest 
) [static]

Saves the form inside the dest QByteArray.

Returns:
true if saving succeeded.
See also:
saveFormToDom(), saveForm()

Definition at line 134 of file formIO.cpp.

bool FormIO::loadFormFromDom ( Form form,
QWidget *  container,
QDomDocument &  domDoc 
) [static]

Loads a form from the domDoc QDomDocument. 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.

bool FormIO::loadFormFromByteArray ( Form form,
QWidget *  container,
QByteArray &  src,
bool  preview = false 
) [static]

Loads a form from the src QByteArray.

See also:
loadFormFromDom(), loadForm().
Returns:
true if loading succeeded.

Definition at line 220 of file formIO.cpp.

bool FormIO::loadFormFromFile ( Form form,
QWidget *  container,
const QString &  filename = QString::null 
) [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.

void FormIO::saveWidget ( ObjectTreeItem item,
QDomElement &  parent,
QDomDocument &  domDoc,
bool  insideGridLayout = false 
) [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.

void FormIO::cleanClipboard ( QDomElement &  uiElement  )  [static]

Cleans the "UI" QDomElement 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.

void FormIO::loadWidget ( Container container,
const QDomElement &  el,
QWidget *  parent = 0 
) [static]

Loads the widget associated to the QDomElement 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.

void FormIO::savePropertyElement ( QDomElement &  parentNode,
QDomDocument &  domDoc,
const QString &  tagName,
const QString &  property,
const QVariant &  value 
) [static]

Save an element in the domDoc as child of parentNode. The element will be saved like this :

 <$(tagName) name = "$(property)">< value_as_XML ><$(tagName)/>

Definition at line 728 of file formIO.cpp.

QVariant FormIO::readPropertyValue ( QDomNode  node,
QObject *  obj,
const QString &  name 
) [static]

Read an object property in the DOM doc.

Parameters:
node the QDomNode 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.

void FormIO::savePropertyValue ( QDomElement &  parentNode,
QDomDocument &  parent,
const char *  name,
const QVariant &  value,
QWidget *  w,
WidgetLibrary lib = 0 
) [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.

void FormIO::writeVariant ( QDomDocument &  parent,
QDomElement &  parentNode,
QVariant  value 
) [static, protected]

Saves the QVariant value as text to be included in an xml file, with parentNode.

Definition at line 477 of file formIO.cpp.

void FormIO::createToplevelWidget ( Form form,
QWidget *  container,
QDomElement &  element 
) [static, protected]

Creates a toplevel widget from the QDomElement element in the Form form, with parent as parent widget. It calls readPropertyValue() and loadWidget() to load child widgets.

Definition at line 1274 of file formIO.cpp.

QString FormIO::saveImage ( QDomDocument &  domDoc,
const QPixmap &  pixmap 
) [static, protected]

Returns:
the name of the pixmap saved, to use to access it This function save the QPixmap pixmap into the DOM document domDoc. The pixmap is converted to XPM and compressed for compatibility with Qt Designer. Encoding code is taken from Designer.

Definition at line 1511 of file formIO.cpp.

QPixmap FormIO::loadImage ( QDomDocument  domDoc,
const QString &  name 
) [static, protected]

Returns:
the loaded pixmap This function loads the pixmap named name in the DOM document domDoc. Decoding code is taken from QT Designer.

Definition at line 1563 of file formIO.cpp.

void FormIO::readChildNodes ( ObjectTreeItem tree,
Container container,
const QDomElement &  el,
QWidget *  w 
) [static, protected]

Reads the child nodes of a "widget" element.

Definition at line 1322 of file formIO.cpp.

void FormIO::addIncludeFileName ( const QString &  include,
QDomDocument &  domDoc 
) [static, protected]

Adds an include file name to be saved in the "includehints" part of .ui file, which is needed by uic.

Definition at line 1480 of file formIO.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys