qdesigner_internal::AddToolBarCommand Class Reference

#include <qdesigner_command_p.h>

Inheritance diagram for qdesigner_internal::AddToolBarCommand:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 761 of file qdesigner_command_p.h.

Public Member Functions

 AddToolBarCommand (QDesignerFormWindowInterface *formWindow)
void init (QMainWindow *mainWindow)
virtual void undo ()
virtual void redo ()

Private Attributes

QPointer< QMainWindowm_mainWindow
QPointer< QToolBarm_toolBar


Constructor & Destructor Documentation

qdesigner_internal::AddToolBarCommand::AddToolBarCommand ( QDesignerFormWindowInterface formWindow  ) 

Definition at line 1861 of file qdesigner_command.cpp.

01862     : QDesignerFormWindowCommand(QApplication::translate("Command", "Add Tool Bar"), formWindow)
01863 {
01864 }


Member Function Documentation

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

Definition at line 1866 of file qdesigner_command.cpp.

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

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

01867 {
01868     m_mainWindow = mainWindow;
01869     QDesignerFormEditorInterface *core = formWindow()->core();
01870     m_toolBar = qobject_cast<QToolBar*>(core->widgetFactory()->createWidget("QToolBar", m_mainWindow));
01871     m_toolBar->hide();
01872 }

Here is the call graph for this function:

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

References c, QDesignerFormWindowInterface::core(), qdesigner_internal::QDesignerFormWindowCommand::core(), QDesignerFormWindowInterface::emitSelectionChanged(), QDesignerFormEditorInterface::extensionManager(), qdesigner_internal::QDesignerFormWindowCommand::formWindow(), i, m_mainWindow, m_toolBar, QDesignerFormEditorInterface::metaDataBase(), and QDesignerMetaDataBaseInterface::remove().

01889 {
01890     QDesignerFormEditorInterface *core = formWindow()->core();
01891     core->metaDataBase()->remove(m_toolBar);
01892     QDesignerContainerExtension *c;
01893     c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
01894     for (int i = 0; i < c->count(); ++i) {
01895         if (c->widget(i) == m_toolBar) {
01896             c->remove(i);
01897             break;
01898         }
01899     }
01900     formWindow()->emitSelectionChanged();
01901 }

Here is the call graph for this function:

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

References QDesignerMetaDataBaseInterface::add(), c, QDesignerFormWindowInterface::core(), qdesigner_internal::QDesignerFormWindowCommand::core(), QDesignerFormWindowInterface::emitSelectionChanged(), QDesignerFormWindowInterface::ensureUniqueObjectName(), QDesignerFormEditorInterface::extensionManager(), qdesigner_internal::QDesignerFormWindowCommand::formWindow(), m_mainWindow, m_toolBar, and QDesignerFormEditorInterface::metaDataBase().

01875 {
01876     QDesignerFormEditorInterface *core = formWindow()->core();
01877     core->metaDataBase()->add(m_toolBar);
01878 
01879     QDesignerContainerExtension *c;
01880     c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
01881     c->addWidget(m_toolBar);
01882 
01883     m_toolBar->setObjectName("toolBar");
01884     formWindow()->ensureUniqueObjectName(m_toolBar);
01885     formWindow()->emitSelectionChanged();
01886 }

Here is the call graph for this function:


Member Data Documentation

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

Definition at line 773 of file qdesigner_command_p.h.

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

QPointer<QToolBar> qdesigner_internal::AddToolBarCommand::m_toolBar [private]

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