kexi

KFormDesigner::FormManager Class Reference

#include <formmanager.h>

Inheritance diagram for KFormDesigner::FormManager:

KexiFormManager List of all members.

Detailed Description

This is Form Designer's main class, which is used by external APIs to access FormDesigner.

This is the class you have to use to integrate FormDesigner into another program. It deals with creating, saving and loading Form, as well as widget insertion and copying. It also ensures all the components (ObjectTreeView, Form and PropertyEditor) are synced, and link them. It holds the WidgetLibrary, the WidgetPropertySet, links to ObjectTreeView and PropertyEditor, as well as the copied widget and the insert state.

Definition at line 72 of file formmanager.h.


Public Types

enum  Options { HideEventsInPopupMenu = 1, SkipFileActions = 2, HideSignalSlotConnections = 4 }

Public Slots

void deleteWidget ()
void copyWidget ()
void cutWidget ()
void pasteWidget ()
void selectAll ()
void clearWidgetContent ()
void undo ()
void redo ()
void editTabOrder ()
void adjustWidgetSize ()
void editFormPixmapCollection ()
void editConnections ()
void layoutHBox ()
void layoutVBox ()
void layoutGrid ()
void layoutHSplitter ()
void layoutVSplitter ()
void layoutHFlow ()
void layoutVFlow ()
void breakLayout ()
void alignWidgetsToLeft ()
void alignWidgetsToRight ()
void alignWidgetsToTop ()
void alignWidgetsToBottom ()
void alignWidgetsToGrid ()
void adjustSizeToGrid ()
void adjustWidthToSmall ()
void adjustWidthToBig ()
void adjustHeightToSmall ()
void adjustHeightToBig ()
void bringWidgetToFront ()
void sendWidgetToBack ()
void insertWidget (const QCString &classname)
void stopInsert ()
void slotPointerClicked ()
void startCreatingConnection ()
void stopCreatingConnection ()
void windowChanged (QWidget *w)
void deleteWidgetLater (QWidget *w)
void showFormUICode ()
void changeFont ()

Signals

void propertySetSwitched (KoProperty::Set *list, bool forceReload=false)
void dirty (KFormDesigner::Form *form, bool isDirty=true)
void widgetSelected (KFormDesigner::Form *form, bool multiple)
void formWidgetSelected (KFormDesigner::Form *form)
void noFormSelected ()
void undoEnabled (bool enabled, const QString &text=QString::null)
void redoEnabled (bool enabled, const QString &text=QString::null)
void createFormSlot (KFormDesigner::Form *form, const QString &widget, const QString &signal)
void connectionCreated (KFormDesigner::Form *form, KFormDesigner::Connection &connection)
void connectionAborted (KFormDesigner::Form *form)
void autoTabStopsSet (KFormDesigner::Form *form, bool set)
void aboutToDeleteForm (KFormDesigner::Form *form)
void formCreated (KFormDesigner::Form *form)

Public Member Functions

 FormManager (QObject *parent=0, int options=0, const char *name=0)
virtual ~FormManager ()
ActionList createActions (WidgetLibrary *lib, KActionCollection *parent)
virtual void enableAction (const char *name, bool enable)=0
virtual KAction * action (const char *name)=0
bool isPasteEnabled ()
WidgetPropertySetpropertySet () const
bool isInserting () const
QCString selectedClass () const
void setInsertPoint (const QPoint &p)
bool isCreatingConnection ()
ConnectioncreatedConnection ()
void resetCreatedConnection ()
void createSignalMenu (QWidget *w)
void createSlotMenu (QWidget *w)
void emitCreateSlot (const QString &widget, const QString &value)
FormactiveForm () const
FormformForWidget (QWidget *w)
bool isTopLevel (QWidget *w)
KoProperty::Editor * propertyEditor () const
virtual void showPropertySet (WidgetPropertySet *list, bool forceReload=false)
void blockPropertyEditorUpdating (void *blockingObject)
void unblockPropertyEditorUpdating (void *blockingObject, WidgetPropertySet *propSet)
void setEditor (KoProperty::Editor *editor)
void setObjectTreeView (ObjectTreeView *treeview)
void previewForm (Form *form, QWidget *w, Form *toForm=0)
void importForm (Form *form=0, bool preview=false)
void deleteForm (Form *form)
void createContextMenu (QWidget *w, Container *container, bool popupAtCursor=true)
bool snapWidgetsToGrid ()
int contextMenuKey () const
void emitWidgetSelected (KFormDesigner::Form *form, bool multiple)
void emitFormWidgetSelected (KFormDesigner::Form *form)
void emitNoFormSelected ()
bool isRedoing () const

Static Public Member Functions

static WidgetLibrarycreateWidgetLibrary (FormManager *m, const QStringList &supportedFactoryGroups)
static FormManagerself ()

Protected Slots

void deleteWidgetLaterTimeout ()
void buddyChoosed (int id)
void menuSignalChoosed (int id)
void slotStyle ()
void slotConnectionCreated (KFormDesigner::Form *, KFormDesigner::Connection &)
void slotSettingsChanged (int category)

Protected Member Functions

void initForm (Form *form)
void createLayout (int layoutType)
void alignWidgets (int type)
void enableFormActions ()
void disableWidgetActions ()
void emitUndoEnabled (bool enabled, const QString &text)
void emitRedoEnabled (bool enabled, const QString &text)

Friends

class PropertyCommand
class GeometryPropertyCommand
class CutWidgetCommand
class Form

Member Enumeration Documentation

enum KFormDesigner::FormManager::Options
 

Options for creating FormManager objects. These are really bit-flags and may be or-ed together.

Definition at line 94 of file formmanager.h.


Constructor & Destructor Documentation

FormManager::FormManager QObject *  parent = 0,
int  options = 0,
const char *  name = 0
 

Constructs FormManager object. Using options you can control manager's behaviour, see Options.

Definition at line 108 of file formmanager.cpp.


Member Function Documentation

void KFormDesigner::FormManager::aboutToDeleteForm KFormDesigner::Form form  )  [signal]
 

Signal emitted before the form gets finally deleted. form is still a valid pointer, but the widgets inside the form are in unknown state.

virtual KAction* KFormDesigner::FormManager::action const char *  name  )  [pure virtual]
 

Returns:
action for name.
See also:
enableAction()

Implemented in KexiFormManager.

Form * FormManager::activeForm  )  const
 

Returns:
The Form actually active and focused.

Definition at line 574 of file formmanager.cpp.

void FormManager::adjustHeightToBig  )  [slot]
 

Resize all selected widgets to the height of the tallest widget.

Definition at line 1338 of file formmanager.cpp.

void FormManager::adjustHeightToSmall  )  [slot]
 

Resize all selected widgets to the height of the shortest widget.

Definition at line 1328 of file formmanager.cpp.

void FormManager::adjustWidgetSize  )  [slot]
 

Adjusts the size of the selected widget, ie resize it to its size hint.

Definition at line 1278 of file formmanager.cpp.

void FormManager::adjustWidthToBig  )  [slot]
 

Resize all selected widgets to the width of the widest widget.

Definition at line 1318 of file formmanager.cpp.

void FormManager::adjustWidthToSmall  )  [slot]
 

Resize all selected widgets to the width of the narrowest widget.

Definition at line 1308 of file formmanager.cpp.

void FormManager::alignWidgets int  type  )  [protected]
 

Function called by all other AlignWidgets*() function. Calls AlignWidgetsCommand.

Definition at line 1233 of file formmanager.cpp.

void KFormDesigner::FormManager::autoTabStopsSet KFormDesigner::Form form,
bool  set
[signal]
 

Signal emitted when "autoTabStops" is changed.

void FormManager::breakLayout  )  [slot]
 

Breaks selected layout(calls BreakLayoutCommand).

Definition at line 1125 of file formmanager.cpp.

void FormManager::buddyChoosed int  id  )  [protected, slot]
 

Slot called when a buddy is choosed in the buddy list. Sets the label buddy.

Definition at line 992 of file formmanager.cpp.

void FormManager::changeFont  )  [slot]
 

Executes font dialog and changes it for currently selected widget(s).

Definition at line 1645 of file formmanager.cpp.

void FormManager::clearWidgetContent  )  [slot]
 

Clears the contents of the selected widget(s) (eg for a line edit or a listview).

Definition at line 1379 of file formmanager.cpp.

void KFormDesigner::FormManager::connectionAborted KFormDesigner::Form form  )  [signal]
 

Signal emitted when the Connection creation by drag-and-drop is aborted by user.

void KFormDesigner::FormManager::connectionCreated KFormDesigner::Form form,
KFormDesigner::Connection connection
[signal]
 

Signal emitted when the Connection creation by drag-and-drop ends. connection is the created Connection. You should copy it, because it is deleted just after the signal is emitted.

void FormManager::copyWidget  )  [slot]
 

Copies the slected widget and all its children of the active Form using an XML representation.

Definition at line 719 of file formmanager.cpp.

ActionList FormManager::createActions WidgetLibrary lib,
KActionCollection *  parent
 

Creates all the KAction related to widget insertion, and plug them into the KActionCollection parent. These actions are automatically connected to insertWidget() slot.

Returns:
a QPtrList of the created actions.

Definition at line 195 of file formmanager.cpp.

void FormManager::createContextMenu QWidget *  w,
Container container,
bool  popupAtCursor = true
 

This function creates and displays the context menu corresponding to the widget w. The menu item are disabled if necessary, and the widget specific part is added (menu from the factory and buddy selection).

Definition at line 835 of file formmanager.cpp.

Connection* KFormDesigner::FormManager::createdConnection  )  [inline]
 

Returns:
the Connection being created.

Definition at line 135 of file formmanager.h.

void KFormDesigner::FormManager::createFormSlot KFormDesigner::Form form,
const QString &  widget,
const QString &  signal
[signal]
 

Signal emitted when the user choose a signal in 'Events' menu in context menu, or in 'Events' in property editor. The code editor should then create the slot connected to this signal.

void FormManager::createLayout int  layoutType  )  [protected]
 

Function called by the "Lay out in..." menu items. It creates a layout from the currently selected widgets (that must have the same parent). Calls CreateLayoutCommand.

Definition at line 1090 of file formmanager.cpp.

void FormManager::createSignalMenu QWidget *  w  ) 
 

Creates and display a menu with all the signals of widget w.

Definition at line 783 of file formmanager.cpp.

void FormManager::createSlotMenu QWidget *  w  ) 
 

Creates and display a menu with all the slots of widget w.

Definition at line 804 of file formmanager.cpp.

WidgetLibrary * FormManager::createWidgetLibrary FormManager m,
const QStringList &  supportedFactoryGroups
[static]
 

Creates widget library for supportedFactoryGroups and initializes FormManager singleton.

m should be always the same for every call.

Definition at line 169 of file formmanager.cpp.

void FormManager::cutWidget  )  [slot]
 

Cuts (ie Copies and deletes) the selected widget and all its children of the active Form using an XML representation.

Definition at line 751 of file formmanager.cpp.

void FormManager::deleteForm Form form  ) 
 

Deletes the Form form and removes it from our list.

Definition at line 591 of file formmanager.cpp.

void FormManager::deleteWidget  )  [slot]
 

Deletes the selected widget in active Form and all of its children.

Definition at line 700 of file formmanager.cpp.

void FormManager::deleteWidgetLater QWidget *  w  )  [slot]
 

Used to delayed widgets' deletion (in Container::deleteItem()).

Definition at line 1389 of file formmanager.cpp.

void KFormDesigner::FormManager::dirty KFormDesigner::Form form,
bool  isDirty = true
[signal]
 

This signal is emitted when any change is made to the Form form, so it will need to be saved.

void FormManager::editConnections  )  [slot]
 

Creates a dialog to edit the Connection of activeForm().

Definition at line 1221 of file formmanager.cpp.

void FormManager::editFormPixmapCollection  )  [slot]
 

Creates a dialog to edit the activeForm() PixmapCollection.

Definition at line 1211 of file formmanager.cpp.

void FormManager::editTabOrder  )  [slot]
 

Displays a dialog where the user can modify the tab order of the active Form, by drag-n-drop or using up/down buttons.

Definition at line 1178 of file formmanager.cpp.

void KFormDesigner::FormManager::emitCreateSlot const QString &  widget,
const QString &  value
[inline]
 

Emits the signal createFormSlot(). Used by WidgetPropertySet.

Definition at line 149 of file formmanager.h.

virtual void KFormDesigner::FormManager::enableAction const char *  name,
bool  enable
[pure virtual]
 

Enables or disables actions name. KFD uses KPart's, action collection here. Kexi implements this to get (shared) actions defined elsewhere.

Implemented in KexiFormManager.

void KFormDesigner::FormManager::formCreated KFormDesigner::Form form  )  [signal]
 

Signal emitted when new form gets created.

Form * FormManager::formForWidget QWidget *  w  ) 
 

Returns:
the Form whose toplevel widget is w, or 0 if there is not or the Form is in preview mode.

Definition at line 580 of file formmanager.cpp.

void KFormDesigner::FormManager::formWidgetSelected KFormDesigner::Form form  )  [signal]
 

Signal emitted when the form widget is selected inside form. Use this to update actions state.

void FormManager::importForm Form form = 0,
bool  preview = false
 

Adds a existing form w and changes it to a container

Definition at line 607 of file formmanager.cpp.

void FormManager::initForm Form form  )  [protected]
 

Inits the Form, adds it to m_forms, and conects slots.

Definition at line 619 of file formmanager.cpp.

void FormManager::insertWidget const QCString &  classname  )  [slot]
 

This slot is called when the user presses a "Widget" toolbar button or a "Widget" menu item. Prepares all Forms for creation of a new widget (ie changes cursor ...).

Definition at line 278 of file formmanager.cpp.

bool KFormDesigner::FormManager::isCreatingConnection  )  [inline]
 

Returns:
If we are creating a Connection by drag-and-drop or not.

Definition at line 132 of file formmanager.h.

bool KFormDesigner::FormManager::isInserting  )  const [inline]
 

Returns:
true if one of the insert buttons was pressed and the forms are ready to create a widget.

Definition at line 122 of file formmanager.h.

bool FormManager::isTopLevel QWidget *  w  ) 
 

Returns:
true if w is a toplevel widget, ie. it is the main widget of a Form (so it should have a caption , an icon ...)

Definition at line 684 of file formmanager.cpp.

void FormManager::layoutGrid  )  [slot]
 

Lay out selected widgets using Grid layout.

Definition at line 1060 of file formmanager.cpp.

void FormManager::layoutHBox  )  [slot]
 

Lay out selected widgets using HBox layout (calls CreateLayoutCommand).

Definition at line 1048 of file formmanager.cpp.

void FormManager::layoutHFlow  )  [slot]
 

Lay out selected widgets using HFlow layout.

Definition at line 1078 of file formmanager.cpp.

void FormManager::layoutHSplitter  )  [slot]
 

Lay out selected widgets in an horizontal splitter.

Definition at line 1066 of file formmanager.cpp.

void FormManager::layoutVBox  )  [slot]
 

Lay out selected widgets using VBox layout.

Definition at line 1054 of file formmanager.cpp.

void FormManager::layoutVFlow  )  [slot]
 

Lay out selected widgets using VFlow layout.

Definition at line 1084 of file formmanager.cpp.

void FormManager::layoutVSplitter  )  [slot]
 

Lay out selected widgets in a verticak splitter.

Definition at line 1072 of file formmanager.cpp.

void FormManager::menuSignalChoosed int  id  )  [protected, slot]
 

Slot called when the user chooses an item in signal (or slot) menu. The createdConnection() is updated, and the connection created (for the signal menu).

Definition at line 1011 of file formmanager.cpp.

void KFormDesigner::FormManager::noFormSelected  )  [signal]
 

Signal emitted when no form (or a preview form) is selected. Use this to update actions state.

void FormManager::pasteWidget  )  [slot]
 

Pastes the XML representation of the copied or cut widget. The widget is pasted when the user clicks the Form to indicate the new position of the widget, or at the position of the contextual menu if there is one.

Definition at line 765 of file formmanager.cpp.

void FormManager::previewForm Form form,
QWidget *  w,
Form toForm = 0
 

Previews the Form form using the widget w as toplevel container for this Form.

Definition at line 643 of file formmanager.cpp.

KoProperty::Editor* KFormDesigner::FormManager::propertyEditor  )  const [inline]
 

Returns:
A pointer to the KoProperty::Editor we use.

Definition at line 166 of file formmanager.h.

WidgetPropertySet* KFormDesigner::FormManager::propertySet  )  const [inline]
 

Returns:
A pointer to the WidgetPropertySet owned by this Manager.

Definition at line 118 of file formmanager.h.

void KFormDesigner::FormManager::propertySetSwitched KoProperty::Set *  list,
bool  forceReload = false
[signal]
 

This signal is emited as the property buffer switched. If forceReload is true, the buffer needs to be reloaded even if it's the same as previous one.

void KFormDesigner::FormManager::redoEnabled bool  enabled,
const QString &  text = QString::null
[signal]
 

Signal emitted when redo action activation changes. text is the full text of the action (including command name).

void FormManager::resetCreatedConnection  ) 
 

Resets the Connection being created. We stay in Connection creation mode, but we start a new connection (when the user clicks outside of signals/slots menu).

Definition at line 397 of file formmanager.cpp.

void FormManager::selectAll  )  [slot]
 

Selects all toplevel widgets in trhe current form.

Definition at line 1368 of file formmanager.cpp.

QCString KFormDesigner::FormManager::selectedClass  )  const [inline]
 

Returns:
The name of the class being inserted, corresponding to the menu item or the toolbar button clicked.

Definition at line 126 of file formmanager.h.

FormManager * FormManager::self  )  [static]
 

Access to FormManager singleton.

Definition at line 163 of file formmanager.cpp.

void FormManager::setEditor KoProperty::Editor *  editor  ) 
 

Sets the external property editor pane used by FormDesigner (it may be docked).

Definition at line 177 of file formmanager.cpp.

void FormManager::setInsertPoint const QPoint &  p  ) 
 

Sets the point where the pasted widget should be moved to.

Definition at line 777 of file formmanager.cpp.

void FormManager::setObjectTreeView ObjectTreeView treeview  ) 
 

Sets the external object tree view used by FormDesigner (it may be docked). This function also connects appropriate signals and slots to ensure sync with the current Form.

Definition at line 186 of file formmanager.cpp.

void FormManager::showFormUICode  )  [slot]
 

For debugging purposes only: shows a text window containing contents of .ui XML definition of the current form.

Definition at line 1404 of file formmanager.cpp.

void FormManager::showPropertySet WidgetPropertySet list,
bool  forceReload = false
[virtual]
 

Shows a propertybuffer buff in a Property Editor. If buff is 0, Property Editor will be cleared. If forceReload is true, the buffer needs to be reloaded even if it's the same as previous one.

Definition at line 1148 of file formmanager.cpp.

void FormManager::slotPointerClicked  )  [slot]
 

Slot called when the user presses 'Pointer' icon. Switch to Default mode.

Definition at line 345 of file formmanager.cpp.

void FormManager::slotStyle  )  [protected, slot]
 

Slot called when the user changes current style using combbox in toolbar or menu.

Definition at line 1195 of file formmanager.cpp.

bool FormManager::snapWidgetsToGrid  ) 
 

Returns:
If we align widgets to grid or not.

Definition at line 460 of file formmanager.cpp.

void FormManager::startCreatingConnection  )  [slot]
 

Enter the Connection creation mode.

Definition at line 354 of file formmanager.cpp.

void FormManager::stopCreatingConnection  )  [slot]
 

Leave the Connection creation mode.

Definition at line 417 of file formmanager.cpp.

void FormManager::stopInsert  )  [slot]
 

Stops the current widget insertion (ie unset the cursor ...).

Definition at line 310 of file formmanager.cpp.

void KFormDesigner::FormManager::undoEnabled bool  enabled,
const QString &  text = QString::null
[signal]
 

Signal emitted when undo action activation changes. text is the full text of the action (including command name).

void KFormDesigner::FormManager::widgetSelected KFormDesigner::Form form,
bool  multiple
[signal]
 

Signal emitted when a normal widget is selected inside form (ie not form widget). If multiple is true, then more than one widget is selected. Use this to update actions state.

void FormManager::windowChanged QWidget *  w  )  [slot]
 

Calls this slot when the window activated changes (eg connect to QWorkspace::windowActivated(QWidget*)). You need to connect to this slot, it will crash otherwise.

Definition at line 466 of file formmanager.cpp.


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