qdesigner_internal::LayoutInfo Class Reference

#include <layoutinfo_p.h>

List of all members.


Detailed Description

Definition at line 48 of file layoutinfo_p.h.

Public Types

enum  Type
typedef QList< IntervalIntervalList

Static Public Member Functions

static void deleteLayout (QDesignerFormEditorInterface *core, QWidget *widget)
static Type layoutType (QDesignerFormEditorInterface *core, QWidget *w, QLayout *&layout)
static Type layoutType (QDesignerFormEditorInterface *core, QLayout *layout)
static Type layoutType (QDesignerFormEditorInterface *core, QWidget *w)
static QWidgetlayoutParent (QDesignerFormEditorInterface *core, QLayout *layout)
static bool isWidgetLaidout (QDesignerFormEditorInterface *core, QWidget *widget)
static QLayoutmanagedLayout (QDesignerFormEditorInterface *core, QWidget *widget)
static void cells (QLayout *layout, IntervalList *rows, IntervalList *columns)

Classes

class  Interval


Member Typedef Documentation

typedef QList<Interval> qdesigner_internal::LayoutInfo::IntervalList

Definition at line 78 of file layoutinfo_p.h.


Member Enumeration Documentation

enum qdesigner_internal::LayoutInfo::Type

Definition at line 51 of file layoutinfo_p.h.

00052     {
00053         HBox,
00054         VBox,
00055         Grid,
00056         Stacked,
00057         NoLayout
00058     };


Member Function Documentation

void qdesigner_internal::LayoutInfo::deleteLayout ( QDesignerFormEditorInterface core,
QWidget widget 
) [static]

Definition at line 101 of file layoutinfo.cpp.

References QDesignerFormEditorInterface::extensionManager(), QDesignerMetaDataBaseInterface::item(), layout, managedLayout(), QDesignerFormEditorInterface::metaDataBase(), and qWarning().

Referenced by qdesigner_internal::Layout::breakLayout(), qdesigner_internal::Layout::prepareLayout(), and qdesigner_internal::Layout::undoLayout().

00102 {
00103     if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), widget))
00104         widget = container->widget(container->currentIndex());
00105 
00106     Q_ASSERT(widget != 0);
00107 
00108     QLayout *layout = managedLayout(core, widget);
00109 
00110     if (layout == 0 || core->metaDataBase()->item(layout) != 0) {
00111         delete layout;
00112         return;
00113     }
00114 
00115     qWarning() << "trying to delete an unmanaged layout:" << "widget:" << widget << "layout:" << layout;
00116 }

Here is the call graph for this function:

LayoutInfo::Type qdesigner_internal::LayoutInfo::layoutType ( QDesignerFormEditorInterface core,
QWidget w,
QLayout *&  layout 
) [static]

Definition at line 36 of file layoutinfo.cpp.

References QDesignerFormEditorInterface::extensionManager(), HBox, Qt::Horizontal, QDesignerMetaDataBaseInterface::item(), layout, QDesignerFormEditorInterface::metaDataBase(), NoLayout, VBox, and w.

Referenced by qdesigner_internal::FormWindow::breakLayout(), qdesigner_internal::FormWindow::checkSelectionNow(), qdesigner_internal::FormWindow::findTargetContainer(), qdesigner_internal::Layout::finishLayout(), qdesigner_internal::QDesignerFormWindowCommand::hasLayout(), qdesigner_internal::DeleteWidgetCommand::init(), qdesigner_internal::BreakLayoutCommand::init(), layoutType(), qdesigner_internal::WidgetHandle::mouseMoveEvent(), qdesigner_internal::WidgetHandle::mouseReleaseEvent(), qdesigner_internal::FormWindow::paste(), qdesigner_internal::InsertWidgetCommand::redo(), qdesigner_internal::replace_widget_item(), qdesigner_internal::Layout::setup(), and qdesigner_internal::FormWindowManager::slotActionAdjustSizeActivated().

00037 {
00038     layout = 0;
00039 
00040     if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), w))
00041         w = container->widget(container->currentIndex());
00042 
00043     if (qobject_cast<QSplitter*>(w))
00044         return static_cast<QSplitter*>(w)->orientation() == Qt::Horizontal ? HBox : VBox;
00045 
00046     if (!w || !w->layout())
00047         return NoLayout;
00048 
00049     QLayout *lay = w->layout();
00050 
00051     if (lay && core->metaDataBase()->item(lay) == 0) {
00052         lay = qFindChild<QLayout*>(lay);
00053     }
00054     layout = lay;
00055 
00056 #ifdef QD_DEBUG
00057     Q_ASSERT (lay == 0 || core->metaDataBase()->item(lay) != 0);
00058 #endif
00059 
00060     return layoutType(core, lay);
00061 }

Here is the call graph for this function:

LayoutInfo::Type qdesigner_internal::LayoutInfo::layoutType ( QDesignerFormEditorInterface core,
QLayout layout 
) [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 66 of file layoutinfo.cpp.

References HBox, layout, NoLayout, and VBox.

00067 {
00068     Q_UNUSED(core)
00069 
00070     if (qobject_cast<QHBoxLayout*>(layout))
00071         return HBox;
00072     else if (qobject_cast<QVBoxLayout*>(layout))
00073         return VBox;
00074     else if (qobject_cast<QGridLayout*>(layout))
00075         return Grid;
00076     return NoLayout;
00077 }

LayoutInfo::Type qdesigner_internal::LayoutInfo::layoutType ( QDesignerFormEditorInterface core,
QWidget w 
) [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 82 of file layoutinfo.cpp.

References layoutType(), and w.

00083 {
00084     return layoutType(core, w->layout());
00085 }

Here is the call graph for this function:

QWidget * qdesigner_internal::LayoutInfo::layoutParent ( QDesignerFormEditorInterface core,
QLayout layout 
) [static]

Definition at line 87 of file layoutinfo.cpp.

References layout, o, and qobject_cast< QWidget * >().

00088 {
00089     Q_UNUSED(core)
00090 
00091     QObject *o = layout;
00092     while (o) {
00093         if (QWidget *widget = qobject_cast<QWidget*>(o))
00094             return widget;
00095 
00096         o = o->parent();
00097     }
00098     return 0;
00099 }

Here is the call graph for this function:

bool qdesigner_internal::LayoutInfo::isWidgetLaidout ( QDesignerFormEditorInterface core,
QWidget widget 
) [static]

Definition at line 139 of file layoutinfo.cpp.

References QLayout::indexOf(), and QWidget::parentWidget().

Referenced by qdesigner_internal::QDesignerResource::checkProperty(), qdesigner_internal::Layout::finishLayout(), qdesigner_internal::FormWindow::handleArrowKeyEvent(), qdesigner_internal::FormWindow::handleMouseMoveEvent(), qdesigner_internal::FormWindow::handleMousePressEvent(), qdesigner_internal::FormWindow::hasInsertedChildren(), qdesigner_internal::WidgetSelection::setWidget(), and qdesigner_internal::FormWindowManager::slotUpdateActions().

00140 {
00141     Q_UNUSED(core);
00142 
00143     QWidget *parent = widget->parentWidget();
00144 
00145     if (qobject_cast<QSplitter*>(parent)) { // ### generalize
00146         return true;
00147     }
00148 
00149     if (parent && parent->layout()) {
00150         if (parent->layout()->indexOf(widget) != -1)
00151             return true;
00152 
00153         QList<QLayout*> childLayouts = qFindChildren<QLayout*>(parent->layout());
00154         foreach (QLayout *childLayout, childLayouts) {
00155             if (childLayout->indexOf(widget) != -1)
00156                 return true;
00157         }
00158     }
00159 
00160     return false;
00161 }

Here is the call graph for this function:

QLayout * qdesigner_internal::LayoutInfo::managedLayout ( QDesignerFormEditorInterface core,
QWidget widget 
) [static]

Definition at line 163 of file layoutinfo.cpp.

References QDesignerMetaDataBaseInterface::item(), layout, QWidget::layout(), and QDesignerFormEditorInterface::metaDataBase().

Referenced by qdesigner_internal::ChangeLayoutItemGeometry::changeItemPosition(), deleteLayout(), qdesigner_internal::ChangeLayoutItemGeometry::init(), qdesigner_internal::replace_widget_item(), qdesigner_internal::WidgetSelection::setWidget(), qdesigner_internal::FormWindowManager::slotActionBreakLayoutActivated(), and qdesigner_internal::FormWindowManager::slotUpdateActions().

00164 {
00165     if (widget == 0)
00166         return 0;
00167 
00168     QLayout *layout = widget->layout();
00169     QDesignerMetaDataBaseItemInterface *item = core->metaDataBase()->item(layout);
00170     if (layout != 0 && item == 0) {
00171         layout = qFindChild<QLayout*>(layout);
00172         item = core->metaDataBase()->item(layout);
00173     }
00174 
00175     return item != 0 ? layout : 0;
00176 }

Here is the call graph for this function:

void qdesigner_internal::LayoutInfo::cells ( QLayout layout,
IntervalList rows,
IntervalList columns 
) [static]

Definition at line 118 of file layoutinfo.cpp.

References g, i, QMap< Key, T >::insert(), QMap< Key, T >::keys(), and layout.

00119 {
00120     QMap<Interval, int> rowDict;
00121     QMap<Interval, int> columnDict;
00122 
00123     int i = 0;
00124     while (QLayoutItem *item = layout->itemAt(i)) {
00125         ++i;
00126 
00127         QRect g = item->geometry();
00128         columnDict.insert(Interval(g.left(), g.right()), 1);
00129         rowDict.insert(Interval(g.top(), g.bottom()), 1);
00130     }
00131 
00132     if (columns)
00133         *columns = columnDict.keys();
00134 
00135     if (rows)
00136         *rows = rowDict.keys();
00137 }

Here is the call graph for this function:


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