kexi

KFormDesigner::Form Class Reference

#include <form.h>

List of all members.


Detailed Description

A simple class representing a form.

This class represents one form and holds the corresponding ObjectTree and Containers. It takes care of widget selection and pasting widgets.

Definition at line 135 of file form.h.


Public Slots

void changeName (const QCString &oldname, const QCString &newname)
void setSelectedWidget (QWidget *selected, bool add=false, bool dontRaise=false)
void unSelectWidget (QWidget *w)
void selectFormWidget ()
void clearSelection ()

Signals

void selectionChanged (QWidget *w, bool add)
void childAdded (ObjectTreeItem *it)
void childRemoved (ObjectTreeItem *it)
void destroying ()

Public Member Functions

 Form (WidgetLibrary *library, const char *name=0, bool designMode=true)
 ~Form ()
WidgetLibrarylibrary () const
void createToplevel (QWidget *container, FormWidget *formWidget=0, const QCString &classname="QWidget")
ContainertoplevelContainer () const
FormWidgetformWidget () const
ObjectTreeobjectTree () const
QWidget * widget () const
ContaineractiveContainer ()
ContainerparentContainer (QWidget *w=0)
ObjectTreeItemcommonParentContainer (WidgetList *wlist)
WidgetListselectedWidgets () const
QWidget * selectedWidget () const
void emitActionSignals (bool withUndoAction=true)
void emitSelectionSignals ()
void setInteractiveMode (bool interactive)
bool interactiveMode () const
void setDesignMode (bool design)
bool designMode () const
bool isModified ()
int gridSize ()
int defaultMargin ()
int defaultSpacing ()
void emitChildAdded (ObjectTreeItem *item)
void emitChildRemoved (ObjectTreeItem *item)
QString filename () const
void setFilename (const QString &file)
KCommandHistory * commandHistory () const
ConnectionBufferconnectionBuffer () const
PixmapCollectionpixmapCollection () const
void addCommand (KCommand *command, bool execute)
void clearCommandHistory ()
ObjectTreeListtabStops () const
ObjectTreeListIterator tabStopsIterator () const
void updateTabStopsOrder ()
void addWidgetToTabStops (ObjectTreeItem *c)
bool autoTabStops () const
void setAutoTabStops (bool autoTab)
void autoAssignTabStops ()
ResizeHandleSetresizeHandlesForWidget (QWidget *w)
QMap< QCString, QString > * headerProperties () const
uint formatVersion () const
void setFormatVersion (uint ver)
uint originalFormatVersion () const
void setOriginalFormatVersion (uint ver)

Protected Slots

void formDeleted ()
void emitUndoEnabled ()
void emitRedoEnabled ()
void slotCommandExecuted ()
void slotFormRestored ()

Protected Member Functions

void setConnectionBuffer (ConnectionBuffer *b)
void setFormWidget (FormWidget *w)

Friends

class FormManager
class FormWidget
class ConnectionDialog

Constructor & Destructor Documentation

Form::Form ( WidgetLibrary library,
const char *  name = 0,
bool  designMode = true 
)

Creates a simple Form, child of the FormManager manager.

Definition at line 90 of file form.cpp.


Member Function Documentation

Container * Form::activeContainer (  ) 

Returns:
A pointer to the currently active Container, ie the parent Container for a simple widget, and the widget's Container if it is itself a container.

Definition at line 150 of file form.cpp.

void Form::addCommand ( KCommand *  command,
bool  execute 
)

Adds a widget in the form's command history. Please use it instead of calling directly actionCollection()->addCommand().

Definition at line 400 of file form.cpp.

void Form::addWidgetToTabStops ( ObjectTreeItem c  ) 

Adds the widget at the end of tabstops list. Called on widget creation.

Definition at line 454 of file form.cpp.

void Form::autoAssignTabStops (  ) 

Tells the Form to reassign the tab stops because the widget layout has changed (called for example before saving or displaying the tab order dialog)

We automatically sort widget from the top-left to bottom-right corner

Todo:
Handle RTL layout (ie form top-right to bottom-left)

Definition at line 496 of file form.cpp.

bool KFormDesigner::Form::autoTabStops (  )  const [inline]

Returns:
True if the Form automatically handles tab stops.

Definition at line 278 of file form.h.

void Form::changeName ( const QCString &  oldname,
const QCString &  newname 
) [slot]

This slot is called when the name of a widget was changed in Property Editor. It renames the ObjectTreeItem associated to this widget.

Definition at line 360 of file form.cpp.

void KFormDesigner::Form::childAdded ( ObjectTreeItem it  )  [signal]

This signal is emitted when a new widget is created, to update ObjectTreeView. it is the ObjectTreeItem representing this new widget.

void KFormDesigner::Form::childRemoved ( ObjectTreeItem it  )  [signal]

This signal is emitted when a widget is deleted, to update ObjectTreeView. it is the ObjectTreeItem representing this deleted widget.

void Form::clearCommandHistory (  ) 

Clears form's command history.

Definition at line 410 of file form.cpp.

ObjectTreeItem * Form::commonParentContainer ( WidgetList wlist  ) 

Returns:
The Container which is a parent of all widgets in wlist. Used by activeContainer(), and to find where to paste widgets when multiple widgets are selected.

Definition at line 170 of file form.cpp.

void Form::createToplevel ( QWidget *  container,
FormWidget formWidget = 0,
const QCString &  classname = "QWidget" 
)

Creates a toplevel widget out of another widget. container will become the Form toplevel widget, will be associated to an ObjectTree and so on.

 QWidget *toplevel = new QWidget(this);
         form->createToplevel(toplevel); 

todo: copy caption in Kexi from object's caption

Definition at line 126 of file form.cpp.

int KFormDesigner::Form::defaultMargin (  )  [inline]

Returns:
the default margin for all the layout inside this Form.

Definition at line 234 of file form.h.

int KFormDesigner::Form::defaultSpacing (  )  [inline]

Returns:
the default spacing for all the layout inside this Form.

Definition at line 237 of file form.h.

bool KFormDesigner::Form::designMode (  )  const [inline]

Returns:
The actual mode of the Form.

Definition at line 225 of file form.h.

void KFormDesigner::Form::destroying (  )  [signal]

This signal emitted when Form is about to be destroyed.

void Form::emitActionSignals ( bool  withUndoAction = true  ) 

Emits the action signals, and optionaly the undo/redo related signals if withUndoAction == true. See FormManager for signals description.

Definition at line 310 of file form.cpp.

void Form::emitChildAdded ( ObjectTreeItem item  ) 

This function is used by ObjectTree to emit childAdded() signal (as it is not a QObject).

Definition at line 384 of file form.cpp.

void Form::emitChildRemoved ( ObjectTreeItem item  ) 

This function is used by ObjectTree to emit childRemoved() signal (as it is not a QObject).

Definition at line 391 of file form.cpp.

void Form::emitSelectionSignals (  ) 

Emits again all signal related to selection (ie Form::selectionChanged()). Called eg when the user has the focus again.

Definition at line 333 of file form.cpp.

QString KFormDesigner::Form::filename (  )  const [inline]

Returns:
The filename of the UI file this Form was saved to, or QString::null if the Form hasn't be saved yet.

Definition at line 247 of file form.h.

uint Form::formatVersion (  )  const

Returns:
format version number for this form. For new forms it is equal to KFormDesigner::version().

Definition at line 537 of file form.cpp.

void Form::formDeleted (  )  [protected, slot]

This slot is called when the toplevel widget of this Form is deleted (ie the window closed) so that the Form gets deleted at the same time.

Definition at line 344 of file form.cpp.

FormWidget* KFormDesigner::Form::formWidget (  )  const [inline]

Returns:
the FormWidget that holds this Form

Definition at line 163 of file form.h.

int KFormDesigner::Form::gridSize (  )  [inline]

Returns:
the distance between two dots in the form background.
Todo:
make gridSize configurable at global level

Definition at line 231 of file form.h.

QMap<QCString,QString>* KFormDesigner::Form::headerProperties (  )  const [inline]

A set of value/key pairs provided to be stored as attributes in <kfd:customHeader/> XML element (saved as a first child of <UI> element).

Definition at line 305 of file form.h.

bool KFormDesigner::Form::interactiveMode (  )  const [inline]

Returns:
true if the Form is being updated by the user, ie the created widget were drawn on the Form.

false if the Form is being updated by the program, ie the widget are created by FormIO, and so composed widgets should not be populated automatically (such as QTabWidget).

Definition at line 217 of file form.h.

WidgetLibrary* KFormDesigner::Form::library (  )  const [inline]

Returns:
A pointer to the WidgetLibrary supporting this form.

Definition at line 146 of file form.h.

ObjectTree* KFormDesigner::Form::objectTree (  )  const [inline]

Returns:
a pointer to this form's ObjectTree.

Definition at line 166 of file form.h.

uint Form::originalFormatVersion (  )  const

Returns:
original format version number for this form (as loaded from .ui XML string) For new forms it is equal to KFormDesigner::version().

Definition at line 546 of file form.cpp.

Container * Form::parentContainer ( QWidget *  w = 0  ) 

Returns:
A pointer to the parent Container of the currently selected widget. It is the same as activeContainer() for a simple widget, but unlike this function it will also return the parent Container if the widget itself is a Container.

Definition at line 195 of file form.cpp.

ResizeHandleSet * Form::resizeHandlesForWidget ( QWidget *  w  ) 

Internal: called by ResizeHandle when mouse move event causes first resize handle's dragging. As a result, current widget's editing (if any) is finished - see WidgetFactory::resetEditor().

Definition at line 282 of file form.cpp.

QWidget* KFormDesigner::Form::selectedWidget (  )  const [inline]

Returns:
currently selected widget in this form, or 0 if there is no widget selected or more than one widget selected.
See also:
selectedWidgets()

Definition at line 196 of file form.h.

WidgetList* KFormDesigner::Form::selectedWidgets (  )  const [inline]

Returns:
the list of currently selected widgets in this form

Definition at line 191 of file form.h.

void Form::selectFormWidget (  )  [slot]

Sets the form widget (it will be uniquely selected widget).

Definition at line 295 of file form.cpp.

void KFormDesigner::Form::selectionChanged ( QWidget *  w,
bool  add 
) [signal]

This signal is emitted when user selects a new widget, to update both Property Editor and ObjectTreeView. w is the newly selected widget.

void KFormDesigner::Form::setAutoTabStops ( bool  autoTab  )  [inline]

If autoTab is true, then the Form will automatically handle tab stops, and the "Edit Tab Order" dialog will be disabled. The tab widget will be set from the top-left to the bottom-right corner.
If \ autoTab is false, then it's up to the user to change tab stops (which are by default in order of creation).

Definition at line 285 of file form.h.

void Form::setDesignMode ( bool  design  ) 

If design is true, the Form is in Design Mode (by default). If design is false, then the Form is in Preview Mode, so the ObjectTree and the Containers are removed.

Definition at line 213 of file form.cpp.

void KFormDesigner::Form::setFilename ( const QString &  file  )  [inline]

Sets the filename of this Form to filename.

Definition at line 250 of file form.h.

void KFormDesigner::Form::setInteractiveMode ( bool  interactive  )  [inline]

Sets the Form interactivity mode. Form is not interactive when pasting widgets, or loading a Form.

Definition at line 209 of file form.h.

void Form::setSelectedWidget ( QWidget *  selected,
bool  add = false,
bool  dontRaise = false 
) [slot]

Sets selected to be the selected widget of this Form. If add is true, the formerly selected widget is still selected, and the new one is just added. If false, selected replace the actually selected widget. The form widget is always selected alone.

Definition at line 236 of file form.cpp.

void Form::slotCommandExecuted (  )  [protected, slot]

This slot is called when a command is executed. The undo/redo signals are emitted to update actions.

Definition at line 418 of file form.cpp.

void Form::slotFormRestored (  )  [protected, slot]

This slot is called when form is restored, ie when the user has undone all actions. The form modified flag is updated, and FormManager::dirty() is called.

Definition at line 444 of file form.cpp.

ObjectTreeList* KFormDesigner::Form::tabStops (  )  const [inline]

Returns:
A pointer to this Form tabstops list : it contains all the widget that can have focus ( ie no labels, etc) in the order of the tabs.

Definition at line 266 of file form.h.

Container* KFormDesigner::Form::toplevelContainer (  )  const [inline]

Returns:
the toplevel Container or 0 if this is a preview Form or createToplevel() has not been called yet.

Definition at line 160 of file form.h.

void Form::unSelectWidget ( QWidget *  w  )  [slot]

Unselects the widget w. Te widget is removed from the Cntainer 's list and its resizeHandle is removed.

Definition at line 288 of file form.cpp.

void Form::updateTabStopsOrder (  ) 

Called (e.g. by KexiDBForm) when certain widgets can have updated focusPolicy properties these having no TabFocus flags set are removed from tabStops() list.

Definition at line 483 of file form.cpp.

QWidget * Form::widget (  )  const

Returns:
the form's toplevel widget, or 0 if designMode() == false.

Definition at line 113 of file form.cpp.


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