qdesigner_internal::AddDockWidgetCommand Class Reference

#include <qdesigner_command_p.h>

Inheritance diagram for qdesigner_internal::AddDockWidgetCommand:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 822 of file qdesigner_command_p.h.

Public Member Functions

 AddDockWidgetCommand (QDesignerFormWindowInterface *formWindow)
void init (QMainWindow *mainWindow, QDockWidget *dockWidget)
void init (QMainWindow *mainWindow)
virtual void undo ()
virtual void redo ()

Private Attributes

QPointer< QMainWindowm_mainWindow
QPointer< QDockWidgetm_dockWidget


Constructor & Destructor Documentation

qdesigner_internal::AddDockWidgetCommand::AddDockWidgetCommand ( QDesignerFormWindowInterface formWindow  ) 

Definition at line 1944 of file qdesigner_command.cpp.

01945     : QDesignerFormWindowCommand(QApplication::translate("Command", "Add Dock Window"), formWindow)
01946 {
01947 }


Member Function Documentation

void qdesigner_internal::AddDockWidgetCommand::init ( QMainWindow mainWindow,
QDockWidget dockWidget 
)

Definition at line 1949 of file qdesigner_command.cpp.

References m_dockWidget, and m_mainWindow.

Referenced by qdesigner_internal::QDesignerTaskMenu::createDockWidget().

01950 {
01951     m_mainWindow = mainWindow;
01952     m_dockWidget = dockWidget;
01953 }

void qdesigner_internal::AddDockWidgetCommand::init ( QMainWindow mainWindow  ) 

Definition at line 1955 of file qdesigner_command.cpp.

References QDesignerFormWindowInterface::core(), qdesigner_internal::QDesignerFormWindowCommand::core(), QDesignerWidgetFactoryInterface::createWidget(), qdesigner_internal::QDesignerFormWindowCommand::formWindow(), m_dockWidget, m_mainWindow, and QDesignerFormEditorInterface::widgetFactory().

01956 {
01957     m_mainWindow = mainWindow;
01958     QDesignerFormEditorInterface *core = formWindow()->core();
01959     m_dockWidget = qobject_cast<QDockWidget*>(core->widgetFactory()->createWidget("QDockWidget", m_mainWindow));
01960 }

Here is the call graph for this function:

void qdesigner_internal::AddDockWidgetCommand::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 1975 of file qdesigner_command.cpp.

References c, QDesignerFormWindowInterface::core(), qdesigner_internal::QDesignerFormWindowCommand::core(), QDesignerFormWindowInterface::emitSelectionChanged(), QDesignerFormEditorInterface::extensionManager(), qdesigner_internal::QDesignerFormWindowCommand::formWindow(), i, m_dockWidget, m_mainWindow, and QDesignerFormWindowInterface::unmanageWidget().

01976 {
01977     QDesignerFormEditorInterface *core = formWindow()->core();
01978     QDesignerContainerExtension *c;
01979     c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
01980     for (int i = 0; i < c->count(); ++i) {
01981         if (c->widget(i) == m_dockWidget) {
01982             c->remove(i);
01983             break;
01984         }
01985     }
01986 
01987     formWindow()->unmanageWidget(m_dockWidget);
01988     formWindow()->emitSelectionChanged();
01989 }

Here is the call graph for this function:

void qdesigner_internal::AddDockWidgetCommand::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 1962 of file qdesigner_command.cpp.

References c, QDesignerFormWindowInterface::core(), qdesigner_internal::QDesignerFormWindowCommand::core(), QDesignerFormWindowInterface::emitSelectionChanged(), QDesignerFormWindowInterface::ensureUniqueObjectName(), QDesignerFormEditorInterface::extensionManager(), qdesigner_internal::QDesignerFormWindowCommand::formWindow(), m_dockWidget, m_mainWindow, and QDesignerFormWindowInterface::manageWidget().

01963 {
01964     QDesignerFormEditorInterface *core = formWindow()->core();
01965     QDesignerContainerExtension *c;
01966     c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
01967     c->addWidget(m_dockWidget);
01968 
01969     m_dockWidget->setObjectName("dockWidget");
01970     formWindow()->ensureUniqueObjectName(m_dockWidget);
01971     formWindow()->manageWidget(m_dockWidget);
01972     formWindow()->emitSelectionChanged();
01973 }

Here is the call graph for this function:


Member Data Documentation

QPointer<QMainWindow> qdesigner_internal::AddDockWidgetCommand::m_mainWindow [private]

Definition at line 835 of file qdesigner_command_p.h.

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

QPointer<QDockWidget> qdesigner_internal::AddDockWidgetCommand::m_dockWidget [private]

Definition at line 836 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:01 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1