qdesigner_internal::InsertActionIntoCommand Class Reference

#include <qdesigner_command_p.h>

Inheritance diagram for qdesigner_internal::InsertActionIntoCommand:

Inheritance graph
[legend]
Collaboration diagram for qdesigner_internal::InsertActionIntoCommand:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 1004 of file qdesigner_command_p.h.

Public Member Functions

 InsertActionIntoCommand (QDesignerFormWindowInterface *formWindow)
void init (QWidget *parentWidget, QAction *action, QAction *beforeAction, bool update=true)
virtual void redo ()
virtual void undo ()

Private Attributes

QWidgetm_parentWidget
QActionm_action
QActionm_beforeAction
bool m_update


Constructor & Destructor Documentation

qdesigner_internal::InsertActionIntoCommand::InsertActionIntoCommand ( QDesignerFormWindowInterface formWindow  ) 

Definition at line 2660 of file qdesigner_command.cpp.

Referenced by QDesignerMenuBar::dropEvent(), QDesignerMenuBar::leaveEditMode(), QDesignerMenuBar::startDrag(), and QDesignerMenuBar::swap().

02661     : QDesignerFormWindowCommand(QApplication::translate("Command", "Add action"), formWindow),
02662     m_parentWidget(0), m_action(0), m_beforeAction(0)
02663 {
02664 }


Member Function Documentation

void qdesigner_internal::InsertActionIntoCommand::init ( QWidget parentWidget,
QAction action,
QAction beforeAction,
bool  update = true 
)

Definition at line 2666 of file qdesigner_command.cpp.

References m_action, m_beforeAction, m_parentWidget, and m_update.

Referenced by QDesignerToolBar::dropEvent(), QDesignerMenu::dropEvent(), QDesignerMenuBar::dropEvent(), QDesignerMenu::enterEditMode(), QDesignerMenuBar::leaveEditMode(), QDesignerMenu::leaveEditMode(), QDesignerToolBar::slotInsertSeparator(), QDesignerMenu::startDrag(), QDesignerToolBar::startDrag(), QDesignerMenu::swap(), and QDesignerMenuBar::swap().

02668 {
02669     Q_ASSERT(m_parentWidget == 0);
02670     Q_ASSERT(m_action == 0);
02671 
02672     m_parentWidget = parentWidget;
02673     m_action = action;
02674     m_beforeAction = beforeAction;
02675     m_update = update;
02676 }

void qdesigner_internal::InsertActionIntoCommand::redo (  )  [virtual]

Applies a change to the document. This function must be implemented in the derived class. Calling QUndoStack::push(), QUndoStack::undo() or QUndoStack::redo() from this funciton leads to undefined beahavior.

The default implementation calls redo() on all child commands.

See also:
undo()

Reimplemented from qdesigner_internal::QDesignerFormWindowCommand.

Definition at line 2678 of file qdesigner_command.cpp.

References qdesigner_internal::QDesignerFormWindowCommand::cheapUpdate(), qdesigner_internal::QDesignerFormWindowCommand::core(), QWidget::insertAction(), m_action, m_beforeAction, m_parentWidget, m_update, QDesignerFormEditorInterface::propertyEditor(), and QDesignerPropertyEditorInterface::setObject().

02679 {
02680     Q_ASSERT(m_action != 0);
02681     Q_ASSERT(m_parentWidget != 0);
02682 
02683     m_parentWidget->insertAction(m_beforeAction, m_action);
02684 
02685     if (m_update) {
02686         core()->propertyEditor()->setObject(m_action);
02687         cheapUpdate();
02688     }
02689 }

Here is the call graph for this function:

void qdesigner_internal::InsertActionIntoCommand::undo (  )  [virtual]

Reverts a change to the document. After undo() is called, the state of the document should be the same as before redo() was called. This function must be implemented in the derived class. Calling QUndoStack::push(), QUndoStack::undo() or QUndoStack::redo() from this funciton leads to undefined beahavior.

The default implementation calls undo() on all child commands in reverse order.

See also:
redo()

Reimplemented from qdesigner_internal::QDesignerFormWindowCommand.

Definition at line 2691 of file qdesigner_command.cpp.

References qdesigner_internal::QDesignerFormWindowCommand::cheapUpdate(), qdesigner_internal::QDesignerFormWindowCommand::core(), m_action, m_parentWidget, m_update, QDesignerFormEditorInterface::propertyEditor(), and QDesignerPropertyEditorInterface::setObject().

02692 {
02693     Q_ASSERT(m_action != 0);
02694     Q_ASSERT(m_parentWidget != 0);
02695 
02696     if (QDesignerMenu *menu = qobject_cast<QDesignerMenu*>(m_parentWidget))
02697         menu->hideSubMenu();
02698 
02699     m_parentWidget->removeAction(m_action);
02700 
02701     if (m_update) {
02702         core()->propertyEditor()->setObject(m_parentWidget);
02703         cheapUpdate();
02704     }
02705 }

Here is the call graph for this function:


Member Data Documentation

QWidget* qdesigner_internal::InsertActionIntoCommand::m_parentWidget [private]

Definition at line 1015 of file qdesigner_command_p.h.

Referenced by init(), redo(), and undo().

QAction* qdesigner_internal::InsertActionIntoCommand::m_action [private]

Definition at line 1016 of file qdesigner_command_p.h.

Referenced by init(), redo(), and undo().

QAction* qdesigner_internal::InsertActionIntoCommand::m_beforeAction [private]

Definition at line 1017 of file qdesigner_command_p.h.

Referenced by init(), and redo().

bool qdesigner_internal::InsertActionIntoCommand::m_update [private]

Definition at line 1018 of file qdesigner_command_p.h.

Referenced by init(), redo(), and undo().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 20:46:45 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1