QDesignerToolWindow Class Reference

#include <qdesigner_toolwindow.h>

Inheritance diagram for QDesignerToolWindow:

Inheritance graph
[legend]
Collaboration diagram for QDesignerToolWindow:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 32 of file qdesigner_toolwindow.h.

Public Member Functions

 QDesignerToolWindow (QDesignerWorkbench *workbench, QWidget *parent=0, Qt::WindowFlags flags=Qt::Window)
virtual ~QDesignerToolWindow ()
QDesignerWorkbenchworkbench () const
QActionaction () const
void setSaveSettingsOnClose (bool save)
bool saveSettingsOnClose () const
virtual Qt::DockWidgetArea dockWidgetAreaHint () const
virtual QRect geometryHint () const

Protected Member Functions

virtual void showEvent (QShowEvent *e)
virtual void hideEvent (QHideEvent *e)
virtual void changeEvent (QEvent *e)
virtual void closeEvent (QCloseEvent *e)

Private Slots

void showMe (bool)

Private Attributes

QDesignerWorkbenchm_workbench
QActionm_action
bool m_saveSettings


Constructor & Destructor Documentation

QDesignerToolWindow::QDesignerToolWindow ( QDesignerWorkbench workbench,
QWidget parent = 0,
Qt::WindowFlags  flags = Qt::Window 
)

Definition at line 35 of file qdesigner_toolwindow.cpp.

References Qt::ApplicationShortcut, QObject::connect(), m_action, QAction::setCheckable(), QAction::setShortcutContext(), QAction::setText(), showMe(), SIGNAL, SLOT, QWidget::windowTitle(), and workbench().

00036     : QMainWindow(parent, flags),
00037       m_workbench(workbench),
00038       m_saveSettings(false)
00039 {
00040     Q_ASSERT(workbench != 0);
00041 
00042     m_action = new QAction(this);
00043     m_action->setShortcutContext(Qt::ApplicationShortcut);
00044     m_action->setText(windowTitle());
00045     m_action->setCheckable(true);
00046     connect(m_action, SIGNAL(triggered(bool)), this, SLOT(showMe(bool)));
00047 }

Here is the call graph for this function:

QDesignerToolWindow::~QDesignerToolWindow (  )  [virtual]

Definition at line 49 of file qdesigner_toolwindow.cpp.

References QDesignerWorkbench::removeToolWindow(), and workbench().

00050 {
00051     if (workbench())
00052         workbench()->removeToolWindow(this);
00053 }

Here is the call graph for this function:


Member Function Documentation

QDesignerWorkbench * QDesignerToolWindow::workbench (  )  const

Definition at line 103 of file qdesigner_toolwindow.cpp.

References m_workbench.

Referenced by closeEvent(), QDesignerResourceEditor::geometryHint(), QDesignerSignalSlotEditor::geometryHint(), QDesignerPropertyEditor::geometryHint(), QDesignerObjectInspector::geometryHint(), QDesignerWidgetBox::geometryHint(), QDesignerActionEditor::geometryHint(), QDesignerActionEditor::QDesignerActionEditor(), QDesignerObjectInspector::QDesignerObjectInspector(), QDesignerPropertyEditor::QDesignerPropertyEditor(), QDesignerResourceEditor::QDesignerResourceEditor(), QDesignerSignalSlotEditor::QDesignerSignalSlotEditor(), QDesignerToolWindow(), QDesignerWidgetBox::QDesignerWidgetBox(), QDesignerPropertyEditor::showEvent(), and ~QDesignerToolWindow().

00104 {
00105     return m_workbench;
00106 }

QAction * QDesignerToolWindow::action (  )  const

Definition at line 83 of file qdesigner_toolwindow.cpp.

References m_action.

Referenced by QDesignerWorkbench::addToolWindow(), QDesignerPropertyEditor::QDesignerPropertyEditor(), QDesignerWorkbench::removeToolWindow(), QDesignerWorkbench::switchToDockedMode(), and QDesignerWorkbench::switchToTopLevelMode().

00084 {
00085     return m_action;
00086 }

void QDesignerToolWindow::setSaveSettingsOnClose ( bool  save  ) 

Definition at line 129 of file qdesigner_toolwindow.cpp.

References m_saveSettings.

Referenced by QDesignerWorkbench::switchToDockedMode(), QDesignerWorkbench::switchToNeutralMode(), and QDesignerWorkbench::switchToTopLevelMode().

00130 {
00131     m_saveSettings = save;
00132 }

bool QDesignerToolWindow::saveSettingsOnClose (  )  const

Definition at line 124 of file qdesigner_toolwindow.cpp.

References m_saveSettings.

00125 {
00126     return m_saveSettings;
00127 }

Qt::DockWidgetArea QDesignerToolWindow::dockWidgetAreaHint (  )  const [virtual]

Definition at line 134 of file qdesigner_toolwindow.cpp.

References Qt::RightDockWidgetArea.

00135 {
00136     return Qt::RightDockWidgetArea;
00137 }

QRect QDesignerToolWindow::geometryHint (  )  const [virtual]

Definition at line 108 of file qdesigner_toolwindow.cpp.

Referenced by QDesignerWorkbench::switchToTopLevelMode().

00109 {
00110     return QRect();
00111 }

void QDesignerToolWindow::showMe ( bool   )  [private, slot]

Definition at line 55 of file qdesigner_toolwindow.cpp.

References QWidget::parentWidget(), QWidget::setVisible(), QWidget::setWindowState(), Qt::WindowMinimized, and QWidget::windowState().

Referenced by QDesignerToolWindow().

00056 {
00057     QWidget *target = parentWidget() == 0 ? this : parentWidget();
00058 
00059     if (v)
00060         target->setWindowState(target->windowState() & ~Qt::WindowMinimized);
00061 
00062     target->setVisible(v);
00063 }

void QDesignerToolWindow::showEvent ( QShowEvent e  )  [protected, virtual]

This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter.

Non-spontaneous show events are sent to widgets immediately before they are shown. The spontaneous show events of windows are delivered afterwards.

Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible().

See also:
visible, event(), QShowEvent

Reimplemented from QWidget.

Definition at line 65 of file qdesigner_toolwindow.cpp.

References QObject::blockSignals(), m_action, and QAction::setChecked().

Referenced by QDesignerPropertyEditor::showEvent().

00066 {
00067     Q_UNUSED(e);
00068 
00069     bool blocked = m_action->blockSignals(true);
00070     m_action->setChecked(true);
00071     m_action->blockSignals(blocked);
00072 }

Here is the call graph for this function:

void QDesignerToolWindow::hideEvent ( QHideEvent e  )  [protected, virtual]

This event handler can be reimplemented in a subclass to receive widget hide events. The event is passed in the event parameter.

Hide events are sent to widgets immediately after they have been hidden.

Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible().

See also:
visible, event(), QHideEvent

Reimplemented from QWidget.

Definition at line 74 of file qdesigner_toolwindow.cpp.

References QObject::blockSignals(), m_action, and QAction::setChecked().

00075 {
00076     Q_UNUSED(e);
00077 
00078     bool blocked = m_action->blockSignals(true);
00079     m_action->setChecked(false);
00080     m_action->blockSignals(blocked);
00081 }

Here is the call graph for this function:

void QDesignerToolWindow::changeEvent ( QEvent e  )  [protected, virtual]

This event handler can be reimplemented to handle state changes.

The state being changed in this event can be retrieved through event event.

Change events include: QEvent::ToolBarChange, QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, QEvent::StyleChange, QEvent::PaletteChange, QEvent::WindowTitleChange, QEvent::IconTextChange, QEcvent::ModifiedChange, QEvent::MouseTrackingChange, QEvent::ParentChange, QEvent::WindowStateChange, QEvent::LanguageChange, QEvent::LocaleChange, QEvent::LayoutDirectionChange.

Reimplemented from QWidget.

Definition at line 88 of file qdesigner_toolwindow.cpp.

References QWidget::changeEvent(), m_action, QAction::setIcon(), QAction::setText(), QEvent::type(), QWidget::windowIcon(), QEvent::WindowIconChange, QWidget::windowTitle(), and QEvent::WindowTitleChange.

00089 {
00090     switch (e->type()) {
00091         case QEvent::WindowTitleChange:
00092             m_action->setText(windowTitle());
00093             break;
00094         case QEvent::WindowIconChange:
00095             m_action->setIcon(windowIcon());
00096             break;
00097         default:
00098             break;
00099     }
00100     QMainWindow::changeEvent(e);
00101 }

Here is the call graph for this function:

void QDesignerToolWindow::closeEvent ( QCloseEvent e  )  [protected, virtual]

This event handler, for event event, can be reimplemented in a subclass to receive widget close events.

See also:
event(), hide(), close(), QCloseEvent, {Application Example}

Reimplemented from QWidget.

Definition at line 113 of file qdesigner_toolwindow.cpp.

References QWidget::closeEvent(), QMetaObject::invokeMethod(), QEvent::isAccepted(), m_saveSettings, qDesigner, Qt::QueuedConnection, QEvent::setAccepted(), and workbench().

00114 {
00115     if (m_saveSettings) {
00116         ev->setAccepted(workbench()->handleClose());
00117         if (ev->isAccepted() && qDesigner->mainWindow() == this)
00118             QMetaObject::invokeMethod(qDesigner, "quit", Qt::QueuedConnection);  // We're going down!
00119     } else {
00120         QMainWindow::closeEvent(ev);
00121     }
00122 }

Here is the call graph for this function:


Member Data Documentation

QDesignerWorkbench* QDesignerToolWindow::m_workbench [private]

Definition at line 58 of file qdesigner_toolwindow.h.

Referenced by workbench().

QAction* QDesignerToolWindow::m_action [private]

Definition at line 59 of file qdesigner_toolwindow.h.

Referenced by action(), changeEvent(), hideEvent(), QDesignerToolWindow(), and showEvent().

bool QDesignerToolWindow::m_saveSettings [private]

Definition at line 60 of file qdesigner_toolwindow.h.

Referenced by closeEvent(), saveSettingsOnClose(), and setSaveSettingsOnClose().


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