Kexi API Documentation (2.0 alpha)

KFormDesigner::Container Class Reference

#include <container.h>

List of all members.


Detailed Description

A class to make a container from any widget.

You can then create child widgets, and the background is dotted.

Definition at line 72 of file container.h.

Public Types

enum  LayoutType {
  NoLayout = 0, HBox, VBox, Grid,
  HFlow, VFlow, HSplitter, VSplitter
}

Public Slots

void setSelectedWidget (QWidget *selected, bool add, bool dontRaise=false, bool moreWillBeSelected=false)
void unSelectWidget (QWidget *w)
void deleteWidget (QWidget *w)
void reloadLayout ()

Public Member Functions

 Container (Container *toplevel, QWidget *container, QObject *parent=0, const char *name=0)
 Creates a Container from the widget container, which have toplevel as parent Container.
virtual ~Container ()
Containertoplevel ()
Formform () const
QWidgetwidget () const
ObjectTreeItemobjectTree () const
void setForm (Form *form)
 Sets the Form which this Container belongs to.
void setObjectTree (ObjectTreeItem *t)
QLayoutlayout () const
LayoutType layoutType () const
int layoutMargin ()
int layoutSpacing ()
void setLayout (LayoutType type)
 Layout functions.
void setLayoutSpacing (int spacing)
 Sets the spacing of this Container.
void setLayoutMargin (int margin)
 Sets the margin of this Container.
void stopInlineEditing ()
virtual bool eventFilter (QObject *o, QEvent *e)

Static Public Member Functions

static QString layoutTypeToString (int type)
static LayoutType stringToLayoutType (const QString &name)

Protected Slots

void widgetDeleted ()

Protected Member Functions

void createBoxLayout (WidgetList *list)
void createFlowLayout ()
void createGridLayout (bool testOnly=false)
void drawConnection (QMouseEvent *mev)
 Drawing functions used by eventFilter.
void drawSelectionRect (QMouseEvent *mev)
void drawInsertRect (QMouseEvent *mev, QObject *s)
void drawCopiedWidgetRect (QMouseEvent *mev)
void moveSelectedWidgetsBy (int realdx, int realdy, QMouseEvent *mev=0)
 Other functions used by eventFilter.

Friends

class InsertWidgetCommand
class PasteWidgetCommand
class DeleteWidgetCommand
class FormIO


Member Enumeration Documentation

enum KFormDesigner::Container::LayoutType
 

Enumeration values:
NoLayout 
HBox 
VBox 
Grid 
HFlow 
VFlow 
HSplitter 
VSplitter 

Definition at line 77 of file container.h.


Constructor & Destructor Documentation

Container::Container Container toplevel,
QWidget container,
QObject *  parent = 0,
const char *  name = 0
 

Creates a Container from the widget container, which have toplevel as parent Container.

Definition at line 91 of file container.cpp.

References form(), NoLayout, objectTree(), setObjectTree(), widget(), and widgetDeleted().

Container::~Container  )  [virtual]
 

Definition at line 136 of file container.cpp.


Member Function Documentation

void Container::createBoxLayout WidgetList list  )  [protected]
 

Internal function to create a HBoxLayout or VBoxLayout for this container. list is a subclass of QObjectList that can sort widgets following their position (such as HorWidgetList or VerWidgetList).

Definition at line 655 of file container.cpp.

References KFormDesigner::ObjectTreeItem::children(), layout(), and KFormDesigner::ObjectTreeItem::widget().

Referenced by setLayout().

void Container::createFlowLayout  )  [protected]
 

Internal function to create a KexiFlowLayout.

Definition at line 669 of file container.cpp.

References KFormDesigner::ObjectTreeItem::children(), KexiFlowLayout::orientation(), and KFormDesigner::ObjectTreeItem::widget().

Referenced by setLayout().

void Container::createGridLayout bool  testOnly = false  )  [protected]
 

Internal function to create a GridLayout. if testOnly is true, the layout is simulated, and only the widget's grid info aris filled.

Definition at line 733 of file container.cpp.

References KFormDesigner::ObjectTreeItem::children(), layout(), KFormDesigner::ObjectTreeItem::setGridPos(), and KFormDesigner::ObjectTreeItem::widget().

Referenced by setLayout().

void Container::deleteWidget QWidget w  )  [slot]
 

Deletes the widget w. Removes it from ObjectTree, and sets selection to Container's widget.

Definition at line 572 of file container.cpp.

References KFormDesigner::FormManager::self().

Referenced by KFormDesigner::DeleteWidgetCommand::execute(), KFormDesigner::PasteWidgetCommand::unexecute(), and KFormDesigner::InsertWidgetCommand::unexecute().

void Container::drawConnection QMouseEvent *  mev  )  [protected]
 

Drawing functions used by eventFilter.

Definition at line 944 of file container.cpp.

References KFormDesigner::FormManager::self().

Referenced by eventFilter().

void Container::drawCopiedWidgetRect QMouseEvent *  mev  )  [protected]
 

Definition at line 1066 of file container.cpp.

Referenced by eventFilter().

void Container::drawInsertRect QMouseEvent *  mev,
QObject *  s
[protected]
 

Definition at line 1020 of file container.cpp.

References KFormDesigner::FormManager::self().

Referenced by eventFilter().

void Container::drawSelectionRect QMouseEvent *  mev  )  [protected]
 

moreWillBeSelected

Definition at line 986 of file container.cpp.

References KFormDesigner::ObjectTreeItem::children(), setSelectedWidget(), and KFormDesigner::ObjectTreeItem::widget().

bool Container::eventFilter QObject *  o,
QEvent *  e
[virtual]
 

This is the main function of Container, which filters the event sent to the watched widget.
It takes care of drawing the background and the insert rect, of creating the new child widgets, of moving the widgets and pop up a menu when right-clicking.

Definition at line 150 of file container.cpp.

References drawConnection(), drawCopiedWidgetRect(), drawInsertRect(), form(), moveSelectedWidgetsBy(), KFormDesigner::ObjectTreeItem::parent(), KFormDesigner::FormManager::self(), setSelectedWidget(), unSelectWidget(), and KFormDesigner::ObjectTreeItem::widget().

Referenced by KFormDesigner::WidgetFactory::eventFilter().

Form* KFormDesigner::Container::form  )  const [inline]
 

Returns:
The form this Container belongs to.

Definition at line 89 of file container.h.

Referenced by KFormDesigner::BreakLayoutCommand::BreakLayoutCommand(), Container(), KFormDesigner::FormManager::createContextMenu(), KFormDesigner::WidgetFactory::createEditor(), KFormDesigner::WidgetPropertySet::createLayoutProperty(), ContainerFactory::createMenuActions(), StdWidgetFactory::createWidget(), KexiReportFactory::createWidget(), KexiDBFactory::createWidget(), ContainerFactory::createWidget(), KFormDesigner::WidgetFactory::disableFilter(), KexiReportFactory::editText(), eventFilter(), InsertPageCommand::execute(), KFormDesigner::PasteWidgetCommand::execute(), KFormDesigner::InsertWidgetCommand::execute(), InsertPageCommand::InsertPageCommand(), KFormDesigner::InsertWidgetCommand::InsertWidgetCommand(), KFormDesigner::FormIO::loadWidget(), KFormDesigner::PasteWidgetCommand::PasteWidgetCommand(), ContainerFactory::previewWidget(), KFormDesigner::FormIO::readChildNodes(), KexiDBFactory::startEditing(), KFormDesigner::PasteWidgetCommand::unexecute(), and KFormDesigner::LayoutPropertyCommand::unexecute().

QLayout* KFormDesigner::Container::layout  )  const [inline]
 

Returns:
a pointer to the QLayout of this Container, or 0 if there is not.

Definition at line 105 of file container.h.

Referenced by createBoxLayout(), createGridLayout(), KFormDesigner::FormIO::loadWidget(), and KFormDesigner::WidgetPropertySet::saveLayoutProperty().

int KFormDesigner::Container::layoutMargin  )  [inline]
 

Returns:
the margin of this Container.

Definition at line 111 of file container.h.

Referenced by KFormDesigner::WidgetPropertySet::createLayoutProperty().

int KFormDesigner::Container::layoutSpacing  )  [inline]
 

Returns:
the spacing of this Container.

Definition at line 114 of file container.h.

Referenced by KFormDesigner::WidgetPropertySet::createLayoutProperty().

LayoutType KFormDesigner::Container::layoutType  )  const [inline]
 

Returns:
the type of the layout associated to this Container's widget (see LayoutType enum).

Definition at line 108 of file container.h.

Referenced by KFormDesigner::BreakLayoutCommand::BreakLayoutCommand(), KFormDesigner::WidgetPropertySet::createLayoutProperty(), KFormDesigner::FormManager::emitWidgetSelected(), and KFormDesigner::FormIO::loadWidget().

QString Container::layoutTypeToString int  type  )  [static]
 

Returns:
the string representing the layoutType type.

Definition at line 918 of file container.cpp.

Referenced by KFormDesigner::FormManager::createLayout(), KFormDesigner::WidgetPropertySet::createLayoutProperty(), KFormDesigner::CreateLayoutCommand::execute(), and KFormDesigner::FormIO::saveWidget().

void Container::moveSelectedWidgetsBy int  realdx,
int  realdy,
QMouseEvent *  mev = 0
[protected]
 

Other functions used by eventFilter.

Definition at line 1099 of file container.cpp.

References KFormDesigner::FormManager::self().

Referenced by eventFilter().

ObjectTreeItem* KFormDesigner::Container::objectTree  )  const [inline]
 

Returns:
The ObjectTreeItem associated with this Container's widget.

Definition at line 95 of file container.h.

Referenced by KFormDesigner::BreakLayoutCommand::BreakLayoutCommand(), Container(), ContainerFactory::createWidget(), KFormDesigner::LayoutPropertyCommand::LayoutPropertyCommand(), and KFormDesigner::FormIO::loadWidget().

void Container::reloadLayout  )  [slot]
 

Recreates the Container layout. Calls this when a widget has been moved or added to update the layout.

Definition at line 647 of file container.cpp.

References NoLayout, and setLayout().

Referenced by KFormDesigner::InsertWidgetCommand::execute().

void Container::setForm Form form  ) 
 

Sets the Form which this Container belongs to.

Definition at line 142 of file container.cpp.

void Container::setLayout LayoutType  type  ) 
 

Layout functions.

Sets this Container to use type of layout. The widget are inserted automatically in the layout following their positions.

See also:
createBoxLayout(), createGridLayout()

Definition at line 592 of file container.cpp.

References createBoxLayout(), createFlowLayout(), createGridLayout(), NoLayout, and KexiFlowLayout::setOrientation().

Referenced by KFormDesigner::FormManager::breakLayout(), reloadLayout(), KFormDesigner::WidgetPropertySet::saveLayoutProperty(), and KFormDesigner::LayoutPropertyCommand::unexecute().

void KFormDesigner::Container::setLayoutMargin int  margin  )  [inline]
 

Sets the margin of this Container.

Definition at line 125 of file container.h.

Referenced by KFormDesigner::WidgetPropertySet::saveLayoutProperty().

void KFormDesigner::Container::setLayoutSpacing int  spacing  )  [inline]
 

Sets the spacing of this Container.

Definition at line 122 of file container.h.

Referenced by KFormDesigner::WidgetPropertySet::saveLayoutProperty().

void KFormDesigner::Container::setObjectTree ObjectTreeItem t  )  [inline]
 

Sets the ObjectTree of this Container.
NOTE: this is needed only if we are toplevel.

Definition at line 102 of file container.h.

Referenced by Container().

void Container::setSelectedWidget QWidget selected,
bool  add,
bool  dontRaise = false,
bool  moreWillBeSelected = false
[slot]
 

Sets selected to be the selected widget of this container (and so of the 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. If dontRaise is true, then the widget selected (and its parent) won't be raised (eg when you select widget in ObjectTreeView).

See also:
Form::setSelectedWidget()

Definition at line 539 of file container.cpp.

Referenced by drawSelectionRect(), eventFilter(), KFormDesigner::PasteWidgetCommand::execute(), KFormDesigner::CreateLayoutCommand::execute(), and KFormDesigner::InsertWidgetCommand::execute().

void KFormDesigner::Container::stopInlineEditing  )  [inline]
 

Stops the inline editing of the current widget (as when you click on another widget or press Esc).

Definition at line 135 of file container.h.

Container::LayoutType Container::stringToLayoutType const QString name  )  [static]
 

Returns:
the LayoutType (an int) for a given layout name.

Definition at line 932 of file container.cpp.

References NoLayout.

Referenced by KFormDesigner::WidgetPropertySet::saveLayoutProperty().

Container * Container::toplevel  ) 
 

Returns:
a pointer to the toplevel Container, or 0 if this Container is toplevel

Definition at line 563 of file container.cpp.

Referenced by KFormDesigner::BreakLayoutCommand::BreakLayoutCommand().

void Container::unSelectWidget QWidget w  )  [slot]
 

Unselects the widget w. The widget is removed from the Form's list and its resizeHandles are removed.

Definition at line 554 of file container.cpp.

Referenced by eventFilter().

QWidget* KFormDesigner::Container::widget  )  const [inline]
 

Returns:
The watched widget.

Definition at line 92 of file container.h.

Referenced by KFormDesigner::FormManager::breakLayout(), KFormDesigner::BreakLayoutCommand::BreakLayoutCommand(), Container(), KFormDesigner::FormManager::createContextMenu(), KFormDesigner::WidgetPropertySet::createLayoutProperty(), KFormDesigner::DeleteWidgetCommand::DeleteWidgetCommand(), KFormDesigner::CreateLayoutCommand::execute(), KFormDesigner::InsertWidgetCommand::execute(), InsertPageCommand::InsertPageCommand(), KFormDesigner::InsertWidgetCommand::InsertWidgetCommand(), KFormDesigner::FormIO::loadWidget(), KFormDesigner::PasteWidgetCommand::moveWidgetBy(), and KFormDesigner::PasteWidgetCommand::PasteWidgetCommand().

void Container::widgetDeleted  )  [protected, slot]
 

This slot is called when the watched widget is deleted. Deletes the Container too.

Definition at line 583 of file container.cpp.

Referenced by Container().


Friends And Related Function Documentation

friend class DeleteWidgetCommand [friend]
 

Definition at line 224 of file container.h.

friend class FormIO [friend]
 

Definition at line 225 of file container.h.

friend class InsertWidgetCommand [friend]
 

Definition at line 222 of file container.h.

friend class PasteWidgetCommand [friend]
 

Definition at line 223 of file container.h.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for Kexi 2.0 alpha.
Documentation copyright © 2002-2007 the Kexi Team.
Generated on Tue Apr 1 20:50:58 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003