qdesigner_internal::FormWindowManager Class Reference

#include <formwindowmanager.h>

Inheritance diagram for qdesigner_internal::FormWindowManager:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 45 of file formwindowmanager.h.

Public Slots

void addFormWindow (QDesignerFormWindowInterface *formWindow)
void removeFormWindow (QDesignerFormWindowInterface *formWindow)
void setActiveFormWindow (QDesignerFormWindowInterface *formWindow)

Public Member Functions

 FormWindowManager (QDesignerFormEditorInterface *core, QObject *parent=0)
virtual ~FormWindowManager ()
virtual QDesignerFormEditorInterfacecore () const
QActionactionCut () const
QActionactionCopy () const
QActionactionPaste () const
QActionactionDelete () const
QActionactionSelectAll () const
QActionactionLower () const
QActionactionRaise () const
QActionactionUndo () const
QActionactionRedo () const
QActionactionHorizontalLayout () const
QActionactionVerticalLayout () const
QActionactionSplitHorizontal () const
QActionactionSplitVertical () const
QActionactionGridLayout () const
QActionactionBreakLayout () const
QActionactionAdjustSize () const
QDesignerFormWindowInterfaceactiveFormWindow () const
int formWindowCount () const
QDesignerFormWindowInterfaceformWindow (int index) const
QDesignerFormWindowInterfacecreateFormWindow (QWidget *parentWidget=0, Qt::WindowFlags flags=0)
bool eventFilter (QObject *o, QEvent *e)
void dragItems (const QList< QDesignerDnDItemInterface * > &item_list)
QUndoGroupundoGroup () const

Private Slots

void slotActionCutActivated ()
void slotActionCopyActivated ()
void slotActionPasteActivated ()
void slotActionDeleteActivated ()
void slotActionSelectAllActivated ()
void slotActionLowerActivated ()
void slotActionRaiseActivated ()
void slotActionHorizontalLayoutActivated ()
void slotActionVerticalLayoutActivated ()
void slotActionSplitHorizontalActivated ()
void slotActionSplitVerticalActivated ()
void slotActionGridLayoutActivated ()
void slotActionBreakLayoutActivated ()
void slotActionAdjustSizeActivated ()
void slotUpdateActions ()

Private Member Functions

void setupActions ()
FormWindowfindFormWindow (QWidget *w)
QWidgetfindManagedWidget (FormWindow *fw, QWidget *w)
void layoutContainerHorizontal ()
void layoutContainerVertical ()
void layoutContainerGrid ()
void setCurrentUndoStack (QUndoStack *stack)
void beginDrag (const QList< QDesignerDnDItemInterface * > &item_list, const QPoint &globalPos)
void endDrag (const QPoint &pos)
void setItemsPos (const QPoint &pos)
bool isDecoration (QWidget *widget) const

Private Attributes

QDesignerFormEditorInterfacem_core
FormWindowm_activeFormWindow
QList< FormWindow * > m_formWindows
bool m_layoutChilds
QActionm_actionCut
QActionm_actionCopy
QActionm_actionPaste
QActionm_actionSelectAll
QActionm_actionDelete
QActionm_actionLower
QActionm_actionRaise
QActionm_actionHorizontalLayout
QActionm_actionVerticalLayout
QActionm_actionSplitHorizontal
QActionm_actionSplitVertical
QActionm_actionGridLayout
QActionm_actionBreakLayout
QActionm_actionAdjustSize
QActionm_actionUndo
QActionm_actionRedo
QList< QDesignerDnDItemInterface * > m_drag_item_list
QWidgetm_last_widget_under_mouse
FormWindowm_last_form_under_mouse
QDesignerWidgetBoxInterfacem_widget_box_under_mouse
Qt::ContextMenuPolicy m_savedContextMenuPolicy
QUndoGroupm_undoGroup


Constructor & Destructor Documentation

FormWindowManager::FormWindowManager ( QDesignerFormEditorInterface core,
QObject parent = 0 
)

Definition at line 71 of file formwindowmanager.cpp.

References m_last_form_under_mouse, m_last_widget_under_mouse, m_layoutChilds, m_savedContextMenuPolicy, m_widget_box_under_mouse, Qt::NoContextMenu, qApp, and setupActions().

00072     : QDesignerFormWindowManagerInterface(parent),
00073       m_core(core),
00074       m_activeFormWindow(0)
00075 {
00076     m_layoutChilds = false;
00077     m_savedContextMenuPolicy = Qt::NoContextMenu;
00078 
00079     setupActions();
00080     qApp->installEventFilter(this);
00081 
00082     // DnD stuff
00083     m_last_widget_under_mouse = 0;
00084     m_last_form_under_mouse = 0;
00085     m_widget_box_under_mouse = 0;
00086 }

Here is the call graph for this function:

FormWindowManager::~FormWindowManager (  )  [virtual]

Definition at line 88 of file formwindowmanager.cpp.

References m_formWindows, and qDeleteAll().

00089 {
00090     qDeleteAll(m_formWindows);
00091 }

Here is the call graph for this function:


Member Function Documentation

QDesignerFormEditorInterface * FormWindowManager::core (  )  const [virtual]

Returns a pointer to 's current QDesignerFormEditorInterface object.

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 93 of file formwindowmanager.cpp.

References m_core.

Referenced by createFormWindow(), setItemsPos(), slotActionAdjustSizeActivated(), slotActionBreakLayoutActivated(), and slotUpdateActions().

00094 {
00095     return m_core;
00096 }

QAction* qdesigner_internal::FormWindowManager::actionCut (  )  const [inline, virtual]

Allows you to intervene and control 's "cut" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 54 of file formwindowmanager.h.

00054 { return m_actionCut; }

QAction* qdesigner_internal::FormWindowManager::actionCopy (  )  const [inline, virtual]

Allows you to intervene and control 's "copy" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 55 of file formwindowmanager.h.

00055 { return m_actionCopy; }

QAction* qdesigner_internal::FormWindowManager::actionPaste (  )  const [inline, virtual]

Allows you to intervene and control 's "paste" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 56 of file formwindowmanager.h.

00056 { return m_actionPaste; }

QAction* qdesigner_internal::FormWindowManager::actionDelete (  )  const [inline, virtual]

Allows you to intervene and control 's "delete" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 57 of file formwindowmanager.h.

00057 { return m_actionDelete; }

QAction* qdesigner_internal::FormWindowManager::actionSelectAll (  )  const [inline, virtual]

Allows you to intervene and control 's "select all" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 58 of file formwindowmanager.h.

00058 { return m_actionSelectAll; }

QAction* qdesigner_internal::FormWindowManager::actionLower (  )  const [inline, virtual]

Allows you to intervene and control the action of lowering a form window in 's workspace. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 59 of file formwindowmanager.h.

00059 { return m_actionLower; }

QAction* qdesigner_internal::FormWindowManager::actionRaise (  )  const [inline, virtual]

Allows you to intervene and control the action of raising of a form window in 's workspace. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 60 of file formwindowmanager.h.

00060 { return m_actionRaise; }

QAction * FormWindowManager::actionUndo (  )  const [virtual]

Allows you to intervene and control 's "undo" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 658 of file formwindowmanager.cpp.

References m_actionUndo.

00659 {
00660     return m_actionUndo;
00661 }

QAction * FormWindowManager::actionRedo (  )  const [virtual]

Allows you to intervene and control 's "redo" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 663 of file formwindowmanager.cpp.

References m_actionRedo.

00664 {
00665     return m_actionRedo;
00666 }

QAction* qdesigner_internal::FormWindowManager::actionHorizontalLayout (  )  const [inline, virtual]

Allows you to intervene and control a request for horizontal layout for a form window in 's workspace. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 64 of file formwindowmanager.h.

00064 { return m_actionHorizontalLayout; }

QAction* qdesigner_internal::FormWindowManager::actionVerticalLayout (  )  const [inline, virtual]

Allows you to intervene and control a request for vertical layout for a form window in 's workspace. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 65 of file formwindowmanager.h.

00065 { return m_actionVerticalLayout; }

QAction* qdesigner_internal::FormWindowManager::actionSplitHorizontal (  )  const [inline, virtual]

Allows you to intervene and control 's "split horizontal" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 66 of file formwindowmanager.h.

00066 { return m_actionSplitHorizontal; }

QAction* qdesigner_internal::FormWindowManager::actionSplitVertical (  )  const [inline, virtual]

Allows you to intervene and control 's "split vertical" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 67 of file formwindowmanager.h.

00067 { return m_actionSplitVertical; }

QAction* qdesigner_internal::FormWindowManager::actionGridLayout (  )  const [inline, virtual]

Allows you to intervene and control a request for grid layout for a form window in 's workspace. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 68 of file formwindowmanager.h.

00068 { return m_actionGridLayout; }

QAction* qdesigner_internal::FormWindowManager::actionBreakLayout (  )  const [inline, virtual]

Allows you to intervene and control 's "break layout" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 69 of file formwindowmanager.h.

00069 { return m_actionBreakLayout; }

QAction* qdesigner_internal::FormWindowManager::actionAdjustSize (  )  const [inline, virtual]

Allows you to intervene and control 's "adjust size" action. The function returns the original action.

See also:
QAction

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 70 of file formwindowmanager.h.

00070 { return m_actionAdjustSize; }

QDesignerFormWindowInterface * FormWindowManager::activeFormWindow (  )  const [virtual]

Returns the currently active form window in 's workspace.

See also:
setActiveFormWindow(), removeFormWindow()

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 98 of file formwindowmanager.cpp.

References m_activeFormWindow.

Referenced by eventFilter().

00099 {
00100     return m_activeFormWindow;
00101 }

int FormWindowManager::formWindowCount (  )  const [virtual]

Returns the number of form windows maintained by 's form window manager.

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 103 of file formwindowmanager.cpp.

References m_formWindows.

00104 {
00105     return m_formWindows.size();
00106 }

QDesignerFormWindowInterface * FormWindowManager::formWindow ( int  index  )  const [virtual]

Returns the form window at the given index.

See also:
setActiveFormWindow(), removeFormWindow()

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 108 of file formwindowmanager.cpp.

References m_formWindows.

Referenced by addFormWindow(), createFormWindow(), removeFormWindow(), and setActiveFormWindow().

00109 {
00110     return m_formWindows.at(index);
00111 }

QDesignerFormWindowInterface * FormWindowManager::createFormWindow ( QWidget parentWidget = 0,
Qt::WindowFlags  flags = 0 
) [virtual]

Creates a form window with the given parent and the given window flags.

See also:
addFormWindow()

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 651 of file formwindowmanager.cpp.

References addFormWindow(), core(), and formWindow().

00652 {
00653     FormWindow *formWindow = new FormWindow(qobject_cast<FormEditor*>(core()), parentWidget, flags);
00654     addFormWindow(formWindow);
00655     return formWindow;
00656 }

Here is the call graph for this function:

bool FormWindowManager::eventFilter ( QObject o,
QEvent e 
) [virtual]

Filters events if this object has been installed as an event filter for the watched object.

In your reimplementation of this function, if you want to filter the event out, i.e. stop it being handled further, return true; otherwise return false.

Example:

        class MainWindow : public QMainWindow
        {
        public:
            MainWindow();

        protected:
            bool eventFilter(QObject *obj, QEvent *ev);

        private:
            QTextEdit *textEdit;
        };

        MainWindow::MainWindow()
        {
            textEdit = new QTextEdit;
            setCentralWidget(textEdit);

            textEdit->installEventFilter(this);
        }

        bool MainWindow::eventFilter(QObject *obj, QEvent *event)
        {
            if (obj == textEdit) {
                if (event->type() == QEvent::KeyPress) {
                    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
                    qDebug() << "Ate key press" << keyEvent->key();
                    return true;
                } else {
                    return false;
                }
            } else {
                // pass the event on to the parent class
                return QMainWindow::eventFilter(obj, event);
            }
        }

Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.

Warning:
If you delete the receiver object in this function, be sure to return true. Otherwise, Qt will forward the event to the deleted object and the program might crash.
See also:
installEventFilter()

Reimplemented from QObject.

Definition at line 118 of file formwindowmanager.cpp.

References QEvent::accept(), activeFormWindow(), endDrag(), qdesigner_internal::FormWindow::findFormWindow(), findManagedWidget(), QMouseEvent::globalPos(), qdesigner_internal::FormWindow::handleEvent(), QEvent::Hide, qdesigner_internal::FormWindow::hideSelection(), QList< T >::isEmpty(), qdesigner_internal::FormWindow::isMainContainer(), isMouseMoveOrRelease(), qdesigner_internal::FormWindow::isWidgetSelected(), QWidget::isWindow(), QKeyEvent::key(), Qt::Key_Escape, QEvent::KeyPress, m_core, m_drag_item_list, QEvent::MouseButtonRelease, o, QWidget::parentWidget(), qdesigner_internal::FormWindow::repaintSelection(), setActiveFormWindow(), setItemsPos(), QEvent::ShortcutOverride, QDesignerFormEditorInterface::topLevel(), QEvent::type(), QEvent::WindowActivate, and QEvent::WindowDeactivate.

00119 {
00120     bool inDragMode =
00121 #ifdef Q_WS_X11
00122         o == m_core->topLevel() &&
00123 #endif
00124         ! m_drag_item_list.isEmpty();
00125 
00126 
00127     if (inDragMode && e->type() == QEvent::ShortcutOverride) {
00128         e->accept();
00129         endDrag(QPoint());
00130         return true;
00131     }
00132 
00133     else if (inDragMode && isMouseMoveOrRelease(e)) {
00134         // We're dragging
00135         QMouseEvent *me = static_cast<QMouseEvent*>(e);
00136         me->accept();
00137 
00138         if (me->type() == QEvent::MouseButtonRelease)
00139             endDrag(me->globalPos());
00140         else
00141             setItemsPos(me->globalPos());
00142         return true;
00143     }
00144 
00145     if (!o->isWidgetType())
00146         return false;
00147 
00148     QWidget *widget = static_cast<QWidget*>(o);
00149 
00150     if (qobject_cast<WidgetHandle*>(widget)) { // ### remove me
00151         return false;
00152     }
00153 
00154     FormWindow *fw = FormWindow::findFormWindow(widget);
00155     if (fw == 0) {
00156         return false;
00157     }
00158 
00159     if (QWidget *managedWidget = findManagedWidget(fw, widget)) {
00160        switch (e->type()) {
00161         case QEvent::Hide: {
00162             if (widget == managedWidget && fw->isWidgetSelected(managedWidget))
00163                 fw->hideSelection(widget);
00164         } break;
00165 
00166         case QEvent::WindowActivate: {
00167             if (fw->parentWidget()->isWindow() && fw->isMainContainer(managedWidget) && activeFormWindow() != fw) {
00168                 setActiveFormWindow(fw);
00169             }
00170         } break;
00171 
00172         case QEvent::WindowDeactivate: {
00173             if (o == fw && o == activeFormWindow())
00174                 fw->repaintSelection();
00175         } break;
00176 
00177         case QEvent::KeyPress: {
00178             QKeyEvent *ke = static_cast<QKeyEvent*>(e);
00179             if (ke->key() == Qt::Key_Escape) {
00180                 ke->accept();
00181                 return true;
00182             }
00183         }
00184         // don't break...
00185 
00186         default: {
00187             if (fw->handleEvent(widget, managedWidget, e)) {
00188                 return true;
00189             }
00190         } break;
00191 
00192         } // end switch
00193     }
00194 
00195     return false;
00196 }

Here is the call graph for this function:

void FormWindowManager::dragItems ( const QList< QDesignerDnDItemInterface * > &  item_list  )  [virtual]

Implements QDesignerFormWindowManagerInterface.

Definition at line 670 of file formwindowmanager.cpp.

References beginDrag(), QList< T >::isEmpty(), m_drag_item_list, QCursor::pos(), and qWarning().

00671 {
00672     if (!m_drag_item_list.isEmpty()) {
00673         qWarning("FormWindowManager::dragItem(): called while already dragging");
00674         return;
00675     }
00676 
00677     beginDrag(item_list, QCursor::pos());
00678 }

Here is the call graph for this function:

QUndoGroup * FormWindowManager::undoGroup (  )  const

Definition at line 825 of file formwindowmanager.cpp.

References m_undoGroup.

00826 {
00827     return m_undoGroup;
00828 }

void FormWindowManager::addFormWindow ( QDesignerFormWindowInterface formWindow  )  [virtual, slot]

Adds the given formWindow to the collection of windows that 's form window manager maintains.

See also:
formWindowAdded()

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 198 of file formwindowmanager.cpp.

References QObject::connect(), emit, formWindow(), QDesignerFormWindowManagerInterface::formWindowAdded(), m_formWindows, SIGNAL, SLOT, slotUpdateActions(), and w.

Referenced by createFormWindow().

00199 {
00200     FormWindow *formWindow = qobject_cast<FormWindow*>(w);
00201     if (!formWindow || m_formWindows.contains(formWindow))
00202         return;
00203 
00204     connect(formWindow, SIGNAL(selectionChanged()), this, SLOT(slotUpdateActions()));
00205     connect(formWindow->commandHistory(), SIGNAL(indexChanged(int)), this, SLOT(slotUpdateActions()));
00206     connect(formWindow, SIGNAL(toolChanged(int)), this, SLOT(slotUpdateActions()));
00207 
00208     m_formWindows.append(formWindow);
00209     emit formWindowAdded(formWindow);
00210 }

void FormWindowManager::removeFormWindow ( QDesignerFormWindowInterface formWindow  )  [virtual, slot]

Removes the given formWindow from the collection of windows that 's form window manager maintains.

See also:
formWindow(), formWindowRemoved()

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 212 of file formwindowmanager.cpp.

References QObject::disconnect(), emit, formWindow(), QDesignerFormWindowManagerInterface::formWindowRemoved(), m_activeFormWindow, m_formWindows, setActiveFormWindow(), and w.

00213 {
00214     FormWindow *formWindow = qobject_cast<FormWindow*>(w);
00215 
00216     int idx = m_formWindows.indexOf(formWindow);
00217     if (!formWindow || idx == -1)
00218         return;
00219 
00220     formWindow->disconnect(this);
00221     m_formWindows.removeAt(idx);
00222     emit formWindowRemoved(formWindow);
00223 
00224     if (formWindow == m_activeFormWindow)
00225         setActiveFormWindow(0);
00226 }

void FormWindowManager::setActiveFormWindow ( QDesignerFormWindowInterface formWindow  )  [virtual, slot]

Sets the given formWindow to be the currently active form window in 's workspace.

See also:
activeFormWindow(), activeFormWindowChanged()

Reimplemented from QDesignerFormWindowManagerInterface.

Definition at line 228 of file formwindowmanager.cpp.

References QDesignerFormWindowManagerInterface::activeFormWindowChanged(), qdesigner_internal::FormWindow::commandHistory(), emit, qdesigner_internal::FormWindow::emitSelectionChanged(), formWindow(), m_activeFormWindow, QObject::parent(), QWidget::parentWidget(), qdesigner_internal::FormWindow::repaintSelection(), QUndoStack::setActive(), QWorkspace::setActiveWindow(), slotUpdateActions(), and w.

Referenced by eventFilter(), and removeFormWindow().

00229 {
00230     FormWindow *formWindow = qobject_cast<FormWindow*>(w);
00231 
00232     if (formWindow == m_activeFormWindow)
00233         return;
00234 
00235     FormWindow *old = m_activeFormWindow;
00236 
00237     m_activeFormWindow = formWindow;
00238 
00239     slotUpdateActions();
00240 
00241     if (m_activeFormWindow) {
00242         m_activeFormWindow->repaintSelection();
00243         if (old)
00244             old->repaintSelection();
00245     }
00246 
00247     emit activeFormWindowChanged(m_activeFormWindow);
00248 
00249     if (m_activeFormWindow) {
00250         m_activeFormWindow->emitSelectionChanged();
00251         m_activeFormWindow->commandHistory()->setActive();
00252 
00253         QWidget *parent = m_activeFormWindow->parentWidget();
00254         QWorkspace *workspace = 0;
00255         while (parent != 0) {
00256             if ((workspace = qobject_cast<QWorkspace*>(parent)))
00257                 break;
00258             parent = parent->parentWidget();
00259         }
00260         if (workspace != 0)
00261             workspace->setActiveWindow(m_activeFormWindow->parentWidget());
00262     }
00263 }

void FormWindowManager::slotActionCutActivated (  )  [private, slot]

Definition at line 390 of file formwindowmanager.cpp.

References qdesigner_internal::FormWindow::cut(), and m_activeFormWindow.

Referenced by setupActions().

00391 {
00392     m_activeFormWindow->cut();
00393 }

void FormWindowManager::slotActionCopyActivated (  )  [private, slot]

Definition at line 395 of file formwindowmanager.cpp.

References qdesigner_internal::FormWindow::copy(), m_activeFormWindow, and slotUpdateActions().

Referenced by setupActions().

00396 {
00397     m_activeFormWindow->copy();
00398     slotUpdateActions();
00399 }

void FormWindowManager::slotActionPasteActivated (  )  [private, slot]

Definition at line 401 of file formwindowmanager.cpp.

References m_activeFormWindow, and qdesigner_internal::FormWindow::paste().

Referenced by setupActions().

00402 {
00403     m_activeFormWindow->paste();
00404 }

void FormWindowManager::slotActionDeleteActivated (  )  [private, slot]

Definition at line 406 of file formwindowmanager.cpp.

References qdesigner_internal::FormWindow::deleteWidgets(), and m_activeFormWindow.

Referenced by setupActions().

00407 {
00408     m_activeFormWindow->deleteWidgets();
00409 }

void FormWindowManager::slotActionSelectAllActivated (  )  [private, slot]

Definition at line 528 of file formwindowmanager.cpp.

References m_activeFormWindow, and qdesigner_internal::FormWindow::selectAll().

Referenced by setupActions().

00529 {
00530     m_activeFormWindow->selectAll();
00531 }

void FormWindowManager::slotActionLowerActivated (  )  [private, slot]

Definition at line 411 of file formwindowmanager.cpp.

References qdesigner_internal::FormWindow::lowerWidgets(), and m_activeFormWindow.

Referenced by setupActions().

00412 {
00413     m_activeFormWindow->lowerWidgets();
00414 }

void FormWindowManager::slotActionRaiseActivated (  )  [private, slot]

Definition at line 416 of file formwindowmanager.cpp.

References m_activeFormWindow, and qdesigner_internal::FormWindow::raiseWidgets().

Referenced by setupActions().

00417 {
00418     m_activeFormWindow->raiseWidgets();
00419 }

void FormWindowManager::slotActionHorizontalLayoutActivated (  )  [private, slot]

Definition at line 421 of file formwindowmanager.cpp.

References layoutContainerHorizontal(), qdesigner_internal::FormWindow::layoutHorizontal(), m_activeFormWindow, and m_layoutChilds.

Referenced by setupActions().

00422 {
00423     if (m_layoutChilds)
00424         layoutContainerHorizontal();
00425     else
00426         m_activeFormWindow->layoutHorizontal();
00427 }

void FormWindowManager::slotActionVerticalLayoutActivated (  )  [private, slot]

Definition at line 429 of file formwindowmanager.cpp.

References layoutContainerVertical(), qdesigner_internal::FormWindow::layoutVertical(), m_activeFormWindow, and m_layoutChilds.

Referenced by setupActions().

00430 {
00431     if (m_layoutChilds)
00432         layoutContainerVertical();
00433     else
00434         m_activeFormWindow->layoutVertical();
00435 }

void FormWindowManager::slotActionSplitHorizontalActivated (  )  [private, slot]

Definition at line 445 of file formwindowmanager.cpp.

References qdesigner_internal::FormWindow::layoutHorizontalSplit(), m_activeFormWindow, and m_layoutChilds.

Referenced by setupActions().

00446 {
00447     if (m_layoutChilds)
00448         ; // no way to do that
00449     else
00450         m_activeFormWindow->layoutHorizontalSplit();
00451 }

void FormWindowManager::slotActionSplitVerticalActivated (  )  [private, slot]

Definition at line 453 of file formwindowmanager.cpp.

References qdesigner_internal::FormWindow::layoutVerticalSplit(), m_activeFormWindow, and m_layoutChilds.

Referenced by setupActions().

00454 {
00455     if (m_layoutChilds)
00456         ; // no way to do that
00457     else
00458         m_activeFormWindow->layoutVerticalSplit();
00459 }

void FormWindowManager::slotActionGridLayoutActivated (  )  [private, slot]

Definition at line 437 of file formwindowmanager.cpp.

References layoutContainerGrid(), qdesigner_internal::FormWindow::layoutGrid(), m_activeFormWindow, and m_layoutChilds.

Referenced by setupActions().

00438 {
00439     if (m_layoutChilds)
00440         layoutContainerGrid();
00441     else
00442         m_activeFormWindow->layoutGrid();
00443 }

void FormWindowManager::slotActionBreakLayoutActivated (  )  [private, slot]

Definition at line 461 of file formwindowmanager.cpp.

References QList< T >::append(), qdesigner_internal::FormWindow::beginCommand(), qdesigner_internal::FormWindow::breakLayout(), QDesignerWidgetFactoryInterface::containerOfWidget(), QList< T >::contains(), core(), qdesigner_internal::FormWindow::endCommand(), QList< T >::isEmpty(), layout, m_activeFormWindow, qdesigner_internal::FormWindow::mainContainer(), qdesigner_internal::LayoutInfo::managedLayout(), QWidget::parentWidget(), QList< T >::prepend(), qdesigner_internal::FormWindow::selectedWidgets(), qdesigner_internal::FormWindow::simplifySelection(), and QDesignerFormEditorInterface::widgetFactory().

Referenced by setupActions().

00462 {
00463     QList<QWidget*> widgets = m_activeFormWindow->selectedWidgets();
00464 
00465     if (widgets.isEmpty())
00466         widgets.append(m_activeFormWindow->mainContainer());
00467 
00468     m_activeFormWindow->simplifySelection(&widgets);
00469 
00470     QList<QWidget*> layoutBaseList;
00471 
00472     foreach (QWidget *widget, widgets) {
00473         QWidget *currentWidget = core()->widgetFactory()->containerOfWidget(widget);
00474 
00475         while (currentWidget && currentWidget != m_activeFormWindow) {
00476             if (QLayout *layout = LayoutInfo::managedLayout(core(), currentWidget)) {
00477                 // ### generalize (put in function)
00478                 QLayoutWidget* layoutWidget = qobject_cast<QLayoutWidget*>(widget);
00479                 if (((layoutWidget ? !layout->isEmpty() : layout != 0) || qobject_cast<QSplitter*>(currentWidget)) 
00480                     && !layoutBaseList.contains(layout->parentWidget())) {
00481                     layoutBaseList.prepend(layout->parentWidget());
00482                 }
00483             }
00484             currentWidget = currentWidget->parentWidget();
00485         }
00486     }
00487 
00488     if (layoutBaseList.isEmpty()) {
00489         // nothing to do
00490         return;
00491     }
00492 
00493     m_activeFormWindow->beginCommand(tr("Break Layout"));
00494     foreach (QWidget *layoutBase, layoutBaseList) {
00495         m_activeFormWindow->breakLayout(layoutBase);
00496     }
00497     m_activeFormWindow->endCommand();
00498 }

void FormWindowManager::slotActionAdjustSizeActivated (  )  [private, slot]

Definition at line 500 of file formwindowmanager.cpp.

References QList< T >::append(), qdesigner_internal::FormWindow::beginCommand(), qdesigner_internal::FormWindow::commandHistory(), core(), qdesigner_internal::FormWindow::endCommand(), qdesigner_internal::AdjustWidgetSizeCommand::init(), QList< T >::isEmpty(), qdesigner_internal::FormWindow::isMainContainer(), qdesigner_internal::isMainContainer(), qdesigner_internal::LayoutInfo::layoutType(), m_activeFormWindow, qdesigner_internal::FormWindow::mainContainer(), qdesigner_internal::LayoutInfo::NoLayout, QWidget::parentWidget(), QUndoStack::push(), qdesigner_internal::FormWindow::selectedWidgets(), and qdesigner_internal::FormWindow::simplifySelection().

Referenced by setupActions().

00501 {
00502     Q_ASSERT(m_activeFormWindow != 0);
00503 
00504     m_activeFormWindow->beginCommand(tr("Adjust Size"));
00505 
00506     QList<QWidget*> selectedWidgets = m_activeFormWindow->selectedWidgets();
00507     m_activeFormWindow->simplifySelection(&selectedWidgets);
00508 
00509     if (selectedWidgets.isEmpty()) {
00510         Q_ASSERT(m_activeFormWindow->mainContainer() != 0);
00511         selectedWidgets.append(m_activeFormWindow->mainContainer());
00512     }
00513 
00514     foreach (QWidget *widget, selectedWidgets) {
00515         bool unlaidout = LayoutInfo::layoutType(core(), widget->parentWidget()) == LayoutInfo::NoLayout;
00516         bool isMainContainer = m_activeFormWindow->isMainContainer(widget);
00517 
00518         if (unlaidout || isMainContainer) {
00519             AdjustWidgetSizeCommand *cmd = new AdjustWidgetSizeCommand(m_activeFormWindow);
00520             cmd->init(widget);
00521             m_activeFormWindow->commandHistory()->push(cmd);
00522         }
00523     }
00524 
00525     m_activeFormWindow->endCommand();
00526 }

void FormWindowManager::slotUpdateActions (  )  [private, slot]

Definition at line 533 of file formwindowmanager.cpp.

References QDesignerWidgetFactoryInterface::containerOfWidget(), core(), QList< T >::count(), qdesigner_internal::FormWindow::currentTool(), qdesigner_internal::FormWindow::hasInsertedChildren(), QDesignerWidgetDataBaseInterface::indexOfObject(), qdesigner_internal::FormWindow::isMainContainer(), qdesigner_internal::LayoutInfo::isWidgetLaidout(), QDesignerWidgetDataBaseInterface::item(), layout, m_actionAdjustSize, m_actionBreakLayout, m_actionCopy, m_actionCut, m_actionDelete, m_actionGridLayout, m_actionHorizontalLayout, m_actionLower, m_actionPaste, m_actionRaise, m_actionSelectAll, m_actionSplitHorizontal, m_actionSplitVertical, m_actionVerticalLayout, m_activeFormWindow, m_core, m_layoutChilds, qdesigner_internal::FormWindow::mainContainer(), qdesigner_internal::LayoutInfo::managedLayout(), qApp, qdesigner_internal::FormWindow::selectedWidgets(), QAction::setEnabled(), qdesigner_internal::FormWindow::simplifySelection(), QDesignerFormEditorInterface::widgetDataBase(), and QDesignerFormEditorInterface::widgetFactory().

Referenced by addFormWindow(), setActiveFormWindow(), and slotActionCopyActivated().

00534 {
00535     m_layoutChilds = false;
00536 
00537     int selectedWidgetCount = 0;
00538     int laidoutWidgetCount = 0;
00539     int unlaidoutWidgetCount = 0;
00540     bool pasteAvailable = false;
00541     bool layoutAvailable = false;
00542     bool breakAvailable = false;
00543     bool layoutContainer = false;
00544 
00545     if (m_activeFormWindow != 0 && m_activeFormWindow->currentTool() == 0) {
00546         QList<QWidget*> simplifiedSelection = m_activeFormWindow->selectedWidgets();
00547         selectedWidgetCount = simplifiedSelection.count();
00548         pasteAvailable = qApp->clipboard()->mimeData() && qApp->clipboard()->mimeData()->hasText();
00549 
00550         m_activeFormWindow->simplifySelection(&simplifiedSelection);
00551         if (simplifiedSelection.isEmpty() && m_activeFormWindow->mainContainer())
00552             simplifiedSelection.append(m_activeFormWindow->mainContainer());
00553 
00554         foreach (QWidget *widget, simplifiedSelection) {
00555             if (LayoutInfo::isWidgetLaidout(m_core, widget))
00556                 ++laidoutWidgetCount;
00557             else
00558                 ++unlaidoutWidgetCount;
00559         }
00560 
00561         if (simplifiedSelection.count() == 1) {
00562             m_layoutChilds = false;
00563 
00564             QWidget *widget = core()->widgetFactory()->containerOfWidget(simplifiedSelection.first());
00565             QDesignerWidgetDataBaseInterface *db = m_core->widgetDataBase();
00566             if (QDesignerWidgetDataBaseItemInterface *item = db->item(db->indexOfObject(widget))) {
00567                 QLayout *layout = LayoutInfo::managedLayout(m_core, widget);
00568                 layoutContainer = (item->isContainer() || m_activeFormWindow->isMainContainer(widget));
00569 
00570                 layoutAvailable = layoutContainer
00571                                     && m_activeFormWindow->hasInsertedChildren(widget)
00572                                     && layout == 0;
00573 
00574                 m_layoutChilds = layoutAvailable;
00575 
00576                 breakAvailable = LayoutInfo::isWidgetLaidout(m_core, widget);
00577 
00578                 if (!breakAvailable && layout != 0) {
00579                     if(qobject_cast<QLayoutWidget*>(widget))
00580                         breakAvailable = !layout->isEmpty();
00581                     else
00582                         breakAvailable = true;  // we have a *hidden* layout
00583                 }
00584 
00585                 if (!breakAvailable && qobject_cast<QSplitter*>(widget))
00586                     breakAvailable = qobject_cast<QSplitter*>(widget)->count() != 0;
00587             }
00588         } else {
00589             layoutAvailable = unlaidoutWidgetCount > 1;
00590             breakAvailable = false;
00591         }
00592     }
00593 
00594     m_actionCut->setEnabled(selectedWidgetCount > 0);
00595     m_actionCopy->setEnabled(selectedWidgetCount > 0);
00596     m_actionDelete->setEnabled(selectedWidgetCount > 0);
00597     m_actionLower->setEnabled(selectedWidgetCount > 0);
00598     m_actionRaise->setEnabled(selectedWidgetCount > 0);
00599 
00600     m_actionPaste->setEnabled(pasteAvailable);
00601 
00602     m_actionSelectAll->setEnabled(m_activeFormWindow != 0);
00603 
00604     m_actionAdjustSize->setEnabled(unlaidoutWidgetCount > 0);
00605 
00606     m_actionHorizontalLayout->setEnabled(layoutAvailable);
00607     m_actionVerticalLayout->setEnabled(layoutAvailable);
00608     m_actionSplitHorizontal->setEnabled(layoutAvailable && !layoutContainer);
00609     m_actionSplitVertical->setEnabled(layoutAvailable && !layoutContainer);
00610     m_actionGridLayout->setEnabled(layoutAvailable);
00611 
00612     m_actionBreakLayout->setEnabled(breakAvailable);
00613 }

void FormWindowManager::setupActions (  )  [private]

Definition at line 280 of file formwindowmanager.cpp.

References QObject::connect(), qdesigner_internal::createIconSet(), QUndoGroup::createRedoAction(), QUndoGroup::createUndoAction(), Qt::CTRL, Qt::Key_0, Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5, Qt::Key_A, Qt::Key_C, Qt::Key_J, Qt::Key_K, Qt::Key_L, Qt::Key_V, Qt::Key_X, m_actionAdjustSize, m_actionBreakLayout, m_actionCopy, m_actionCut, m_actionDelete, m_actionGridLayout, m_actionHorizontalLayout, m_actionLower, m_actionPaste, m_actionRaise, m_actionRedo, m_actionSelectAll, m_actionSplitHorizontal, m_actionSplitVertical, m_actionUndo, m_actionVerticalLayout, m_undoGroup, QAction::setEnabled(), QAction::setShortcut(), QAction::setStatusTip(), QAction::setWhatsThis(), SIGNAL, SLOT, slotActionAdjustSizeActivated(), slotActionBreakLayoutActivated(), slotActionCopyActivated(), slotActionCutActivated(), slotActionDeleteActivated(), slotActionGridLayoutActivated(), slotActionHorizontalLayoutActivated(), slotActionLowerActivated(), slotActionPasteActivated(), slotActionRaiseActivated(), slotActionSelectAllActivated(), slotActionSplitHorizontalActivated(), slotActionSplitVerticalActivated(), slotActionVerticalLayoutActivated(), and whatsThisFrom().

Referenced by FormWindowManager().

00281 {
00282     m_actionCut = new QAction(createIconSet(QLatin1String("editcut.png")), tr("Cu&t"), this);
00283     m_actionCut->setShortcut(Qt::CTRL + Qt::Key_X);
00284     m_actionCut->setStatusTip(tr("Cuts the selected widgets and puts them on the clipboard"));
00285     m_actionCut->setWhatsThis(whatsThisFrom(QLatin1String("Edit|Cut")));
00286     connect(m_actionCut, SIGNAL(triggered()), this, SLOT(slotActionCutActivated()));
00287     m_actionCut->setEnabled(false);
00288 
00289     m_actionCopy = new QAction(createIconSet(QLatin1String("editcopy.png")), tr("&Copy"), this);
00290     m_actionCopy->setShortcut(Qt::CTRL + Qt::Key_C);
00291     m_actionCopy->setStatusTip(tr("Copies the selected widgets to the clipboard"));
00292     m_actionCopy->setWhatsThis(whatsThisFrom(QLatin1String("Edit|Copy")));
00293     connect(m_actionCopy, SIGNAL(triggered()), this, SLOT(slotActionCopyActivated()));
00294     m_actionCopy->setEnabled(false);
00295 
00296     m_actionPaste = new QAction(createIconSet(QLatin1String("editpaste.png")), tr("&Paste"), this);
00297     m_actionPaste->setShortcut(Qt::CTRL + Qt::Key_V);
00298     m_actionPaste->setStatusTip(tr("Pastes the clipboard's contents"));
00299     m_actionPaste->setWhatsThis(whatsThisFrom(QLatin1String("Edit|Paste")));
00300     connect(m_actionPaste, SIGNAL(triggered()), this, SLOT(slotActionPasteActivated()));
00301     m_actionPaste->setEnabled(false);
00302 
00303     m_actionDelete = new QAction(tr("&Delete"), this);
00304     m_actionDelete->setStatusTip(tr("Deletes the selected widgets"));
00305     m_actionDelete->setWhatsThis(whatsThisFrom(QLatin1String("Edit|Delete")));
00306     connect(m_actionDelete, SIGNAL(triggered()), this, SLOT(slotActionDeleteActivated()));
00307     m_actionDelete->setEnabled(false);
00308 
00309     m_actionSelectAll = new QAction(tr("Select &All"), this);
00310     m_actionSelectAll->setShortcut(Qt::CTRL + Qt::Key_A);
00311     m_actionSelectAll->setStatusTip(tr("Selects all widgets"));
00312     m_actionSelectAll->setWhatsThis(whatsThisFrom(QLatin1String("Edit|Select All")));
00313     connect(m_actionSelectAll, SIGNAL(triggered()), this, SLOT(slotActionSelectAllActivated()));
00314     m_actionSelectAll->setEnabled(false);
00315 
00316     m_actionRaise = new QAction(createIconSet(QLatin1String("editraise.png")), tr("Bring to &Front"), this);
00317     m_actionRaise->setShortcut(Qt::CTRL + Qt::Key_L);
00318     m_actionRaise->setStatusTip(tr("Raises the selected widgets"));
00319     m_actionRaise->setWhatsThis(tr("Raises the selected widgets"));
00320     connect(m_actionRaise, SIGNAL(triggered()), this, SLOT(slotActionRaiseActivated()));
00321     m_actionRaise->setEnabled(false);
00322 
00323     m_actionLower = new QAction(createIconSet(QLatin1String("editlower.png")), tr("Send to &Back"), this);
00324     m_actionLower->setShortcut(Qt::CTRL + Qt::Key_K);
00325     m_actionLower->setStatusTip(tr("Lowers the selected widgets"));
00326     m_actionLower->setWhatsThis(tr("Lowers the selected widgets"));
00327     connect(m_actionLower, SIGNAL(triggered()), this, SLOT(slotActionLowerActivated()));
00328     m_actionLower->setEnabled(false);
00329 
00330 
00331     m_actionAdjustSize = new QAction(createIconSet(QLatin1String("adjustsize.png")), tr("Adjust &Size"), this);
00332     m_actionAdjustSize->setShortcut(Qt::CTRL + Qt::Key_J);
00333     m_actionAdjustSize->setStatusTip(tr("Adjusts the size of the selected widget"));
00334     m_actionAdjustSize->setWhatsThis(whatsThisFrom(QLatin1String("Layout|Adjust Size")));
00335     connect(m_actionAdjustSize, SIGNAL(triggered()), this, SLOT(slotActionAdjustSizeActivated()));
00336     m_actionAdjustSize->setEnabled(false);
00337 
00338     m_actionHorizontalLayout = new QAction(createIconSet(QLatin1String("edithlayout.png")), tr("Lay Out &Horizontally"), this);
00339     m_actionHorizontalLayout->setShortcut(Qt::CTRL + Qt::Key_1);
00340     m_actionHorizontalLayout->setStatusTip(tr("Lays out the selected widgets horizontally"));
00341     m_actionHorizontalLayout->setWhatsThis(whatsThisFrom(QLatin1String("Layout|Lay Out Horizontally")));
00342     connect(m_actionHorizontalLayout, SIGNAL(triggered()), this, SLOT(slotActionHorizontalLayoutActivated()));
00343     m_actionHorizontalLayout->setEnabled(false);
00344 
00345     m_actionVerticalLayout = new QAction(createIconSet(QLatin1String("editvlayout.png")), tr("Lay Out &Vertically"), this);
00346     m_actionVerticalLayout->setShortcut(Qt::CTRL + Qt::Key_2);
00347     m_actionVerticalLayout->setStatusTip(tr("Lays out the selected widgets vertically"));
00348     m_actionVerticalLayout->setWhatsThis(whatsThisFrom(QLatin1String("Layout|Lay Out Vertically")));
00349     connect(m_actionVerticalLayout, SIGNAL(triggered()), this, SLOT(slotActionVerticalLayoutActivated()));
00350     m_actionVerticalLayout->setEnabled(false);
00351 
00352     m_actionGridLayout = new QAction(createIconSet(QLatin1String("editgrid.png")), tr("Lay Out in a &Grid"), this);
00353     m_actionGridLayout->setShortcut(Qt::CTRL + Qt::Key_5);
00354     m_actionGridLayout->setStatusTip(tr("Lays out the selected widgets in a grid"));
00355     m_actionGridLayout->setWhatsThis(whatsThisFrom(QLatin1String("Layout|Lay Out in a Grid")));
00356     connect(m_actionGridLayout, SIGNAL(triggered()), this, SLOT(slotActionGridLayoutActivated()));
00357     m_actionGridLayout->setEnabled(false);
00358 
00359     m_actionSplitHorizontal = new QAction(createIconSet(QLatin1String("editvlayoutsplit.png")),
00360                                           tr("Lay Out Horizontally in S&plitter"), this);
00361     m_actionSplitHorizontal->setShortcut(Qt::CTRL + Qt::Key_3);
00362     m_actionSplitHorizontal->setStatusTip(tr("Lays out the selected widgets horizontally in a splitter"));
00363     m_actionSplitHorizontal->setWhatsThis(whatsThisFrom(QLatin1String("Layout|Lay Out Horizontally in Splitter")));
00364     connect(m_actionSplitHorizontal, SIGNAL(triggered()), this, SLOT(slotActionSplitHorizontalActivated()));
00365     m_actionSplitHorizontal->setEnabled(false);
00366 
00367     m_actionSplitVertical = new QAction(createIconSet(QLatin1String("edithlayoutsplit.png")),
00368                                         tr("Lay Out Vertically in Sp&litter"), this);
00369     m_actionSplitVertical->setShortcut(Qt::CTRL + Qt::Key_4);
00370     m_actionSplitVertical->setStatusTip(tr("Lays out the selected widgets vertically in a splitter"));
00371     m_actionSplitVertical->setWhatsThis(whatsThisFrom(QLatin1String("Layout|Lay Out Vertically in Splitter")));
00372     connect(m_actionSplitVertical, SIGNAL(triggered()), this, SLOT(slotActionSplitVerticalActivated()));
00373     m_actionSplitVertical->setEnabled(false);
00374 
00375     m_actionBreakLayout = new QAction(createIconSet(QLatin1String("editbreaklayout.png")), tr("&Break Layout"), this);
00376     m_actionBreakLayout->setShortcut(Qt::CTRL + Qt::Key_0);
00377     m_actionBreakLayout->setStatusTip(tr("Breaks the selected layout"));
00378     m_actionBreakLayout->setWhatsThis(whatsThisFrom(QLatin1String("Layout|Break Layout")));
00379     connect(m_actionBreakLayout, SIGNAL(triggered()), this, SLOT(slotActionBreakLayoutActivated()));
00380     m_actionBreakLayout->setEnabled(false);
00381 
00382     m_undoGroup = new QUndoGroup(this);
00383 
00384     m_actionUndo = m_undoGroup->createUndoAction(this);
00385     m_actionUndo->setEnabled(false);
00386     m_actionRedo = m_undoGroup->createRedoAction(this);
00387     m_actionRedo->setEnabled(false);
00388 }

Here is the call graph for this function:

FormWindow* qdesigner_internal::FormWindowManager::findFormWindow ( QWidget w  )  [private]

QWidget * FormWindowManager::findManagedWidget ( FormWindow fw,
QWidget w 
) [private]

Definition at line 265 of file formwindowmanager.cpp.

References qdesigner_internal::FormWindow::isManaged(), QObject::parent(), QWidget::parentWidget(), and w.

Referenced by eventFilter().

00266 {
00267     while (w && w != fw) {
00268         if (fw->isManaged(w))
00269             break;
00270         w = w->parentWidget();
00271     }
00272 
00273     QWidget *parent = w->parentWidget();
00274     if (parent != 0 && qobject_cast<QDesignerPromotedWidget*>(parent) != 0)
00275         w = parent;
00276 
00277     return w;
00278 }

Here is the call graph for this function:

void FormWindowManager::layoutContainerHorizontal (  )  [private]

Definition at line 615 of file formwindowmanager.cpp.

References l, qdesigner_internal::FormWindow::layoutHorizontalContainer(), m_activeFormWindow, qdesigner_internal::FormWindow::mainContainer(), qdesigner_internal::FormWindow::selectedWidgets(), qdesigner_internal::FormWindow::simplifySelection(), and w.

Referenced by slotActionHorizontalLayoutActivated().

00616 {
00617     QWidget *w = m_activeFormWindow->mainContainer();
00618     QList<QWidget*> l(m_activeFormWindow->selectedWidgets());
00619     m_activeFormWindow->simplifySelection(&l);
00620     if (l.count() > 0)
00621         w = l.first();
00622 
00623     if (w != 0)
00624         m_activeFormWindow->layoutHorizontalContainer(w);
00625 }

Here is the call graph for this function:

void FormWindowManager::layoutContainerVertical (  )  [private]

Definition at line 627 of file formwindowmanager.cpp.

References l, qdesigner_internal::FormWindow::layoutVerticalContainer(), m_activeFormWindow, qdesigner_internal::FormWindow::mainContainer(), qdesigner_internal::FormWindow::selectedWidgets(), qdesigner_internal::FormWindow::simplifySelection(), and w.

Referenced by slotActionVerticalLayoutActivated().

00628 {
00629     QWidget *w = m_activeFormWindow->mainContainer();
00630     QList<QWidget*> l(m_activeFormWindow->selectedWidgets());
00631     m_activeFormWindow->simplifySelection(&l);
00632     if (l.count() > 0)
00633         w = l.first();
00634 
00635     if (w)
00636         m_activeFormWindow->layoutVerticalContainer(w);
00637 }

Here is the call graph for this function:

void FormWindowManager::layoutContainerGrid (  )  [private]

Definition at line 639 of file formwindowmanager.cpp.

References l, qdesigner_internal::FormWindow::layoutGridContainer(), m_activeFormWindow, qdesigner_internal::FormWindow::mainContainer(), qdesigner_internal::FormWindow::selectedWidgets(), qdesigner_internal::FormWindow::simplifySelection(), and w.

Referenced by slotActionGridLayoutActivated().

00640 {
00641     QWidget *w = m_activeFormWindow->mainContainer();
00642     QList<QWidget*> l(m_activeFormWindow->selectedWidgets());
00643     m_activeFormWindow->simplifySelection(&l);
00644     if (l.count() > 0)
00645         w = l.first();
00646 
00647     if (w)
00648         m_activeFormWindow->layoutGridContainer(w);
00649 }

Here is the call graph for this function:

void qdesigner_internal::FormWindowManager::setCurrentUndoStack ( QUndoStack stack  )  [private]

void FormWindowManager::beginDrag ( const QList< QDesignerDnDItemInterface * > &  item_list,
const QPoint globalPos 
) [private]

Definition at line 680 of file formwindowmanager.cpp.

References QRect::bottom(), QWidget::contextMenuPolicy(), QDesignerDnDItemInterface::decoration(), QWidget::grabMouse(), QList< T >::isEmpty(), QRect::left(), m_core, m_drag_item_list, m_savedContextMenuPolicy, QWidget::move(), Qt::NoContextMenu, QWidget::pos(), qApp, qMax(), qMin(), QRect::right(), QWidget::setAttribute(), QWidget::setContextMenuPolicy(), setItemsPos(), QWidget::setWindowOpacity(), QWidget::show(), QRect::top(), QDesignerFormEditorInterface::topLevel(), Qt::WA_TransparentForMouseEvents, QPoint::x(), and QPoint::y().

Referenced by dragItems().

00681 {
00682     Q_ASSERT(m_drag_item_list.isEmpty());
00683 
00684     m_drag_item_list = item_list;
00685 
00686     setItemsPos(globalPos);
00687 
00688     foreach(QDesignerDnDItemInterface *item, m_drag_item_list) {
00689         QWidget *deco = item->decoration();
00690         deco->setAttribute(Qt::WA_TransparentForMouseEvents);
00691         QPoint pos = deco->pos();
00692         QRect ag = qApp->desktop()->availableGeometry(deco);
00693         deco->move(qMin(qMax(pos.x(), ag.left()), ag.right()), qMin(qMax(pos.y(), ag.top()), ag.bottom()));
00694         deco->move(pos);
00695         deco->show();
00696         deco->setWindowOpacity(0.8);
00697     }
00698 
00699 #ifdef Q_WS_X11
00700     m_core->topLevel()->grabMouse();
00701     m_savedContextMenuPolicy = m_core->topLevel()->contextMenuPolicy();
00702     m_core->topLevel()->setContextMenuPolicy(Qt::NoContextMenu);
00703 #endif
00704 }

Here is the call graph for this function:

void FormWindowManager::endDrag ( const QPoint pos  )  [private]

Definition at line 770 of file formwindowmanager.cpp.

References QList< T >::clear(), QDesignerDnDItemInterface::CopyDrop, QDesignerDnDItemInterface::decoration(), qdesigner_internal::FormWindow::deleteWidgets(), qdesigner_internal::FormWindow::dropWidgets(), QDesignerWidgetBoxInterface::dropWidgets(), QDesignerFormWindowInterface::EditFeature, qdesigner_internal::FormWindow::hasFeature(), QWidget::hide(), QList< T >::isEmpty(), m_core, m_drag_item_list, m_last_form_under_mouse, m_last_widget_under_mouse, m_savedContextMenuPolicy, m_widget_box_under_mouse, QWidget::releaseMouse(), QWidget::setContextMenuPolicy(), QWidget::show(), QDesignerDnDItemInterface::source(), QDesignerFormEditorInterface::topLevel(), QDesignerDnDItemInterface::type(), and QDesignerDnDItemInterface::widget().

Referenced by eventFilter().

00771 {
00772 #ifdef Q_WS_X11
00773     m_core->topLevel()->releaseMouse();
00774     m_core->topLevel()->setContextMenuPolicy(m_savedContextMenuPolicy);
00775 #endif
00776 
00777     Q_ASSERT(!m_drag_item_list.isEmpty());
00778 
00779     foreach (QDesignerDnDItemInterface *item, m_drag_item_list)
00780         item->decoration()->hide();
00781 
00782     // ugly, but you can't qobject_cast from interfaces
00783     if (m_last_form_under_mouse != 0 &&
00784             m_last_form_under_mouse->hasFeature(QDesignerFormWindowInterface::EditFeature)) {
00785         m_last_form_under_mouse->dropWidgets(m_drag_item_list, m_last_widget_under_mouse, pos);
00786     } else if (m_widget_box_under_mouse != 0) {
00787         m_widget_box_under_mouse->dropWidgets(m_drag_item_list, pos);
00788         foreach (QDesignerDnDItemInterface *item, m_drag_item_list) {
00789             if (item->type() == QDesignerDnDItemInterface::CopyDrop)
00790                 continue;
00791             FormWindow *source = qobject_cast<FormWindow*>(item->source());
00792             if (source == 0)
00793                 continue;
00794             QWidget *widget = item->widget();
00795             if (widget == 0)
00796                 continue;
00797             source->deleteWidgets(QList<QWidget*>() << widget);
00798         }
00799     } else {
00800         foreach (QDesignerDnDItemInterface *item, m_drag_item_list) {
00801             if (item->widget() != 0)
00802                 item->widget()->show();
00803         }
00804     }
00805 
00806     foreach (QDesignerDnDItemInterface *item, m_drag_item_list)
00807         delete item;
00808 
00809     m_drag_item_list.clear();
00810     m_last_widget_under_mouse = 0;
00811     m_last_form_under_mouse = 0;
00812     m_widget_box_under_mouse = 0;
00813 }

Here is the call graph for this function:

void FormWindowManager::setItemsPos ( const QPoint pos  )  [private]

Definition at line 718 of file formwindowmanager.cpp.

References c, core(), QDesignerDnDItemInterface::decoration(), QDesignerFormWindowInterface::EditFeature, qdesigner_internal::FormWindow::findContainer(), QDesignerFormWindowInterface::findFormWindow(), QList< T >::first(), qdesigner_internal::FormWindow::hasFeature(), qdesigner_internal::FormWindow::Highlight, qdesigner_internal::FormWindow::highlightWidget(), QDesignerDnDItemInterface::hotSpot(), isDecoration(), m_drag_item_list, m_last_form_under_mouse, m_last_widget_under_mouse, m_widget_box_under_mouse, qdesigner_internal::FormWindow::mainContainer(), QWidget::mapFromGlobal(), QWidget::move(), QWidget::pos(), qApp, qdesigner_internal::FormWindow::Restore, QDesignerDnDItemInterface::source(), qdesigner_internal::FormWindow::widgetAt(), and widgetBoxAt().

Referenced by beginDrag(), and eventFilter().

00719 {
00720     foreach(QDesignerDnDItemInterface *item, m_drag_item_list)
00721         item->decoration()->move(globalPos - item->hotSpot());
00722 
00723     QWidget *widget_under_mouse = qApp->widgetAt(globalPos);
00724     int max_try = 3;
00725     while (max_try && widget_under_mouse && isDecoration(widget_under_mouse)) {
00726         --max_try;
00727         widget_under_mouse = qApp->widgetAt(widget_under_mouse->pos() - QPoint(1,1));
00728         Q_ASSERT(!qobject_cast<ConnectionEdit*>(widget_under_mouse));
00729     }
00730 
00731     FormWindow *form_under_mouse
00732             = qobject_cast<FormWindow*>(QDesignerFormWindowInterface::findFormWindow(widget_under_mouse));
00733     if (form_under_mouse != 0 && !form_under_mouse->hasFeature(QDesignerFormWindowInterface::EditFeature))
00734         form_under_mouse = 0;
00735     if (form_under_mouse != 0) {
00736         // widget_under_mouse might be some temporary thing like the dropLine. We need
00737         // the actual widget that's part of the edited GUI.
00738         widget_under_mouse
00739             = form_under_mouse->widgetAt(form_under_mouse->mapFromGlobal(globalPos));
00740 
00741         if (QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), form_under_mouse->findContainer(widget_under_mouse, false))) {
00742             widget_under_mouse = c->widget(c->currentIndex());
00743         }
00744         Q_ASSERT(!qobject_cast<ConnectionEdit*>(widget_under_mouse));
00745     }
00746 
00747     if (m_last_form_under_mouse != 0 && widget_under_mouse != m_last_widget_under_mouse) {
00748         m_last_form_under_mouse->highlightWidget(m_last_widget_under_mouse,
00749                                     m_last_widget_under_mouse->mapFromGlobal(globalPos),
00750                                     FormWindow::Restore);
00751     }
00752 
00753     FormWindow *source_form = qobject_cast<FormWindow*>(m_drag_item_list.first()->source());
00754     if (form_under_mouse != 0
00755         && (source_form == 0 || widget_under_mouse != source_form->mainContainer())) {
00756 
00757         form_under_mouse->highlightWidget(widget_under_mouse,
00758                                     widget_under_mouse->mapFromGlobal(globalPos),
00759                                     FormWindow::Highlight);
00760     }
00761 
00762     m_last_widget_under_mouse = widget_under_mouse;
00763     m_last_form_under_mouse = form_under_mouse;
00764     if (m_last_form_under_mouse == 0)
00765         m_widget_box_under_mouse = widgetBoxAt(globalPos);
00766     else
00767         m_widget_box_under_mouse = 0;
00768 }

Here is the call graph for this function:

bool FormWindowManager::isDecoration ( QWidget widget  )  const [private]

Definition at line 815 of file formwindowmanager.cpp.

References QDesignerDnDItemInterface::decoration(), and m_drag_item_list.

Referenced by setItemsPos().

00816 {
00817     foreach (QDesignerDnDItemInterface *item, m_drag_item_list) {
00818         if (item->decoration() == widget)
00819             return true;
00820     }
00821 
00822     return false;
00823 }

Here is the call graph for this function:


Member Data Documentation

QDesignerFormEditorInterface* qdesigner_internal::FormWindowManager::m_core [private]

Definition at line 120 of file formwindowmanager.h.

Referenced by beginDrag(), core(), endDrag(), eventFilter(), and slotUpdateActions().

FormWindow* qdesigner_internal::FormWindowManager::m_activeFormWindow [private]

Definition at line 121 of file formwindowmanager.h.

Referenced by activeFormWindow(), layoutContainerGrid(), layoutContainerHorizontal(), layoutContainerVertical(), removeFormWindow(), setActiveFormWindow(), slotActionAdjustSizeActivated(), slotActionBreakLayoutActivated(), slotActionCopyActivated(), slotActionCutActivated(), slotActionDeleteActivated(), slotActionGridLayoutActivated(), slotActionHorizontalLayoutActivated(), slotActionLowerActivated(), slotActionPasteActivated(), slotActionRaiseActivated(), slotActionSelectAllActivated(), slotActionSplitHorizontalActivated(), slotActionSplitVerticalActivated(), slotActionVerticalLayoutActivated(), and slotUpdateActions().

QList<FormWindow*> qdesigner_internal::FormWindowManager::m_formWindows [private]

Definition at line 122 of file formwindowmanager.h.

Referenced by addFormWindow(), formWindow(), formWindowCount(), removeFormWindow(), and ~FormWindowManager().

bool qdesigner_internal::FormWindowManager::m_layoutChilds [private]

Definition at line 124 of file formwindowmanager.h.

Referenced by FormWindowManager(), slotActionGridLayoutActivated(), slotActionHorizontalLayoutActivated(), slotActionSplitHorizontalActivated(), slotActionSplitVerticalActivated(), slotActionVerticalLayoutActivated(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionCut [private]

Definition at line 127 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionCopy [private]

Definition at line 128 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionPaste [private]

Definition at line 129 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionSelectAll [private]

Definition at line 130 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionDelete [private]

Definition at line 131 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionLower [private]

Definition at line 132 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionRaise [private]

Definition at line 133 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionHorizontalLayout [private]

Definition at line 135 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionVerticalLayout [private]

Definition at line 136 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionSplitHorizontal [private]

Definition at line 137 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionSplitVertical [private]

Definition at line 138 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionGridLayout [private]

Definition at line 139 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionBreakLayout [private]

Definition at line 140 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionAdjustSize [private]

Definition at line 141 of file formwindowmanager.h.

Referenced by setupActions(), and slotUpdateActions().

QAction* qdesigner_internal::FormWindowManager::m_actionUndo [private]

Definition at line 143 of file formwindowmanager.h.

Referenced by actionUndo(), and setupActions().

QAction* qdesigner_internal::FormWindowManager::m_actionRedo [private]

Definition at line 144 of file formwindowmanager.h.

Referenced by actionRedo(), and setupActions().

QList<QDesignerDnDItemInterface*> qdesigner_internal::FormWindowManager::m_drag_item_list [private]

Definition at line 151 of file formwindowmanager.h.

Referenced by beginDrag(), dragItems(), endDrag(), eventFilter(), isDecoration(), and setItemsPos().

QWidget* qdesigner_internal::FormWindowManager::m_last_widget_under_mouse [private]

Definition at line 152 of file formwindowmanager.h.

Referenced by endDrag(), FormWindowManager(), and setItemsPos().

FormWindow* qdesigner_internal::FormWindowManager::m_last_form_under_mouse [private]

Definition at line 153 of file formwindowmanager.h.

Referenced by endDrag(), FormWindowManager(), and setItemsPos().

QDesignerWidgetBoxInterface* qdesigner_internal::FormWindowManager::m_widget_box_under_mouse [private]

Definition at line 154 of file formwindowmanager.h.

Referenced by endDrag(), FormWindowManager(), and setItemsPos().

Qt::ContextMenuPolicy qdesigner_internal::FormWindowManager::m_savedContextMenuPolicy [private]

Definition at line 155 of file formwindowmanager.h.

Referenced by beginDrag(), endDrag(), and FormWindowManager().

QUndoGroup* qdesigner_internal::FormWindowManager::m_undoGroup [private]

Definition at line 156 of file formwindowmanager.h.

Referenced by setupActions(), and undoGroup().


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