Kexi API Documentation (2.0 alpha)

KFormDesigner::PasteWidgetCommand Class Reference

#include <commands.h>

Inheritance diagram for KFormDesigner::PasteWidgetCommand:

KFormDesigner::Command KCommand List of all members.

Detailed Description

This command is used when pasting widgets. You need to give the QDomDocument containing the widget(s) to paste, and optionnally the point where to paste widgets.

Definition at line 243 of file commands.h.

Public Member Functions

 PasteWidgetCommand (QDomDocument &domDoc, Container *container, const QPoint &p=QPoint())
virtual void execute ()
virtual void unexecute ()
virtual QString name () const
virtual void debug ()

Protected Member Functions

void changePos (QDomElement &widg, const QPoint &newpos)
void fixPos (QDomElement &el, Container *container)
void moveWidgetBy (QDomElement &el, Container *container, const QPoint &p)
void fixNames (QDomElement &el)

Protected Attributes

Formm_form
QCString m_data
QString m_containername
QPoint m_point
QStringList m_names


Constructor & Destructor Documentation

PasteWidgetCommand::PasteWidgetCommand QDomDocument &  domDoc,
Container container,
const QPoint &  p = QPoint()
 

Definition at line 1057 of file commands.cpp.

References KFormDesigner::Container::form(), m_containername, m_data, m_form, m_point, and KFormDesigner::Container::widget().


Member Function Documentation

void PasteWidgetCommand::changePos QDomElement &  widg,
const QPoint &  newpos
[protected]
 

Internal function used to change the coordinates of a widget to newpos before pasting it (to paste it at the position of the contextual menu). It modifies the "geometry" property of the QDomElement representing the widget.

Definition at line 1207 of file commands.cpp.

Referenced by execute(), and moveWidgetBy().

void PasteWidgetCommand::debug  )  [virtual]
 

Implements KFormDesigner::Command.

Definition at line 1365 of file commands.cpp.

References m_containername, m_data, m_form, m_names, m_point, and KFormDesigner::Form::widget().

void PasteWidgetCommand::execute  )  [virtual]
 

Definition at line 1098 of file commands.cpp.

References changePos(), KFormDesigner::ObjectTreeItem::container(), fixNames(), fixPos(), KFormDesigner::Container::form(), KFormDesigner::FormIO::loadWidget(), m_containername, m_data, m_form, m_names, m_point, moveWidgetBy(), KFormDesigner::Form::objectTree(), KFormDesigner::Form::setInteractiveMode(), KFormDesigner::Container::setSelectedWidget(), and KFormDesigner::ObjectTreeItem::widget().

void PasteWidgetCommand::fixNames QDomElement &  el  )  [protected]
 

Internal function used to fix the names of the widgets before pasting them. It prevents from pasting a widget with the same name as an actual widget. The child widgets are also fixed recursively.
If the name of the widget ends with a number (eg "QLineEdit1"), the new name is just incremented by one (eg becomes "QLineEdit2"). Otherwise, a "2" is just appended at the end of the name (eg "myWidget" becomes "myWidget2").

Definition at line 1329 of file commands.cpp.

References m_form, and KFormDesigner::Form::objectTree().

Referenced by execute().

void PasteWidgetCommand::fixPos QDomElement &  el,
Container container
[protected]
 

Internal function used to fix the coordinates of a widget before pasting it (to avoid having two widgets at the same position). It moves the widget by (10, 10) increment (several times if there are already pasted widgets at this position).

Definition at line 1232 of file commands.cpp.

References moveWidgetBy().

Referenced by execute().

void PasteWidgetCommand::moveWidgetBy QDomElement &  el,
Container container,
const QPoint &  p
[protected]
 

Definition at line 1282 of file commands.cpp.

References changePos(), m_form, KFormDesigner::Container::widget(), and KFormDesigner::Form::widget().

Referenced by execute(), and fixPos().

QString PasteWidgetCommand::name  )  const [virtual]
 

Definition at line 1200 of file commands.cpp.

void PasteWidgetCommand::unexecute  )  [virtual]
 

Definition at line 1181 of file commands.cpp.

References KFormDesigner::ObjectTreeItem::container(), KFormDesigner::Container::deleteWidget(), KFormDesigner::Container::form(), m_containername, m_form, m_names, KFormDesigner::Form::objectTree(), and KFormDesigner::ObjectTreeItem::widget().


Member Data Documentation

QString KFormDesigner::PasteWidgetCommand::m_containername [protected]
 

Definition at line 274 of file commands.h.

Referenced by debug(), execute(), PasteWidgetCommand(), and unexecute().

QCString KFormDesigner::PasteWidgetCommand::m_data [protected]
 

Definition at line 273 of file commands.h.

Referenced by debug(), execute(), and PasteWidgetCommand().

Form* KFormDesigner::PasteWidgetCommand::m_form [protected]
 

Definition at line 272 of file commands.h.

Referenced by debug(), execute(), fixNames(), moveWidgetBy(), PasteWidgetCommand(), and unexecute().

QStringList KFormDesigner::PasteWidgetCommand::m_names [protected]
 

Definition at line 276 of file commands.h.

Referenced by debug(), execute(), and unexecute().

QPoint KFormDesigner::PasteWidgetCommand::m_point [protected]
 

Definition at line 275 of file commands.h.

Referenced by debug(), execute(), and PasteWidgetCommand().


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:57 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003