QDockWidgetLayout Class Reference

#include <qdockwidgetlayout_p.h>

Collaboration diagram for QDockWidgetLayout:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 210 of file qdockwidgetlayout_p.h.

Public Types

enum  DockPos
enum  
enum  

Public Member Functions

 QDockWidgetLayout (QMainWindow *win)
bool isValid () const
void saveState (QDataStream &stream) const
bool restoreState (QDataStream &stream, const QList< QDockWidget * > &widgets)
QList< int > indexOf (QDockWidget *dockWidget, IndexOfFlag flag=IndexOfFindsVisible) const
QList< int > gapIndex (const QPoint &pos, bool nestingEnabled) const
QList< int > findSeparator (const QPoint &pos) const
QDockAreaLayoutItemitem (QList< int > path)
QDockAreaLayoutInfoinfo (QList< int > path)
QDockAreaLayoutInfoinfo (QWidget *widget)
QRect itemRect (QList< int > path) const
QRect separatorRect (int index) const
QRect separatorRect (QList< int > path) const
bool insertGap (QList< int > path, QWidgetItem *dockWidgetItem)
QWidgetItemconvertToGap (QList< int > path)
QRect convertToWidget (QList< int > path, QWidgetItem *dockWidgetItem)
void remove (QList< int > path)
void fitLayout ()
void clear ()
QSize sizeHint () const
QSize minimumSize () const
void addDockWidget (DockPos pos, QDockWidget *dockWidget, Qt::Orientation orientation)
void splitDockWidget (QDockWidget *after, QDockWidget *dockWidget, Qt::Orientation orientation)
void tabifyDockWidget (QDockWidget *first, QDockWidget *second)
void apply (bool animate)
void paintSeparators (QPainter *p, QWidget *widget, const QRegion &clip, const QPoint &mouse) const
QRegion separatorRegion () const
int separatorMove (QList< int > separator, const QPoint &origin, const QPoint &dest, QVector< QLayoutStruct > *cache)
QLayoutItemitemAt (int *x, int index) const
QLayoutItemtakeAt (int *x, int index)
void deleteAllLayoutItems ()
void getGrid (QVector< QLayoutStruct > *ver_struct_list, QVector< QLayoutStruct > *hor_struct_list)
void setGrid (QVector< QLayoutStruct > *ver_struct_list, QVector< QLayoutStruct > *hor_struct_list)
QRect gapRect (QList< int > path)
void keepSize (QDockWidget *w)
QSet< QTabBar * > usedTabBars () const

Public Attributes

Qt::DockWidgetArea corners [4]
QRect rect
QWidgetItemcentralWidgetItem
QMainWindowmainWindow
QRect centralWidgetRect
QDockAreaLayoutInfo docks [4]
int sep


Member Enumeration Documentation

enum QDockWidgetLayout::DockPos

Definition at line 213 of file qdockwidgetlayout_p.h.

00213                  {
00214         LeftPos,
00215         RightPos,
00216         TopPos,
00217         BottomPos,
00218         PosCount,
00219         CenterPos = PosCount
00220     };

anonymous enum

Definition at line 221 of file qdockwidgetlayout_p.h.

00221 { EmptyDropAreaSize = 80 }; // when a dock area is empty, how "wide" is it?

anonymous enum

Definition at line 234 of file qdockwidgetlayout_p.h.

00234 { DockWidgetStateMarker = 0xfd };


Constructor & Destructor Documentation

QDockWidgetLayout::QDockWidgetLayout ( QMainWindow win  ) 

Definition at line 1912 of file qdockwidgetlayout.cpp.

References Qt::BottomDockWidgetArea, Qt::BottomLeftCorner, BottomPos, Qt::BottomRightCorner, centralWidgetItem, centralWidgetRect, corners, docks, Qt::Horizontal, LeftPos, mainWindow, QStyle::pixelMetric(), QStyle::PM_DockWidgetSeparatorExtent, RightPos, QTabBar::RoundedSouth, sep, QWidget::style(), Qt::TopDockWidgetArea, Qt::TopLeftCorner, TopPos, Qt::TopRightCorner, and Qt::Vertical.

01913 {
01914     mainWindow = win;
01915     sep = win->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent);
01916 #ifndef QT_NO_TABBAR
01917     const int tabShape = QTabBar::RoundedSouth;
01918 #else
01919     const int tabShape = 0;
01920 #endif
01921     docks[LeftPos] = QDockAreaLayoutInfo(sep, Qt::Vertical, tabShape, win);
01922     docks[RightPos] = QDockAreaLayoutInfo(sep, Qt::Vertical, tabShape, win);
01923     docks[TopPos] = QDockAreaLayoutInfo(sep, Qt::Horizontal, tabShape, win);
01924     docks[BottomPos] = QDockAreaLayoutInfo(sep, Qt::Horizontal, tabShape, win);
01925     centralWidgetItem = 0;
01926     centralWidgetRect = QRect(0, 0, -1, -1);
01927 
01928     corners[Qt::TopLeftCorner] = Qt::TopDockWidgetArea;
01929     corners[Qt::TopRightCorner] = Qt::TopDockWidgetArea;
01930     corners[Qt::BottomLeftCorner] = Qt::BottomDockWidgetArea;
01931     corners[Qt::BottomRightCorner] = Qt::BottomDockWidgetArea;
01932 }

Here is the call graph for this function:


Member Function Documentation

bool QDockWidgetLayout::isValid (  )  const

Definition at line 1934 of file qdockwidgetlayout.cpp.

References QRect::isValid(), and rect.

Referenced by QMainWindowLayout::hover(), QMainWindowLayout::restore(), and QMainWindowLayout::setGeometry().

01935 {
01936     return rect.isValid();
01937 }

Here is the call graph for this function:

void QDockWidgetLayout::saveState ( QDataStream stream  )  const

Definition at line 1939 of file qdockwidgetlayout.cpp.

References centralWidgetRect, corners, docks, DockWidgetStateMarker, i, QDockAreaLayoutInfo::isEmpty(), PosCount, QDockAreaLayoutInfo::rect, QDockAreaLayoutInfo::saveState(), QRect::size(), and QTest::stream.

Referenced by QMainWindowLayout::saveState().

01940 {
01941     stream << (uchar) DockWidgetStateMarker;
01942     int cnt = 0;
01943     for (int i = 0; i < PosCount; ++i) {
01944         if (!docks[i].item_list.isEmpty())
01945             ++cnt;
01946     }
01947     stream << cnt;
01948     for (int i = 0; i < PosCount; ++i) {
01949         if (docks[i].item_list.isEmpty())
01950             continue;
01951         stream << i << docks[i].rect.size();
01952         docks[i].saveState(stream);
01953     }
01954 
01955     stream << centralWidgetRect.size();
01956 
01957     for (int i = 0; i < 4; ++i)
01958         stream << static_cast<int>(corners[i]);
01959 }

Here is the call graph for this function:

bool QDockWidgetLayout::restoreState ( QDataStream stream,
const QList< QDockWidget * > &  widgets 
)

Definition at line 1961 of file qdockwidgetlayout.cpp.

References centralWidgetRect, corners, docks, DockWidgetStateMarker, i, QDataStream::Ok, QDataStream::ReadCorruptData, QDockAreaLayoutInfo::rect, size, and QTest::stream.

Referenced by QMainWindowLayout::restoreState().

01962 {
01963     uchar dmarker;
01964     stream >> dmarker;
01965     if (dmarker != DockWidgetStateMarker)
01966         return false;
01967     int cnt;
01968     stream >> cnt;
01969     for (int i = 0; i < cnt; ++i) {
01970         int pos;
01971         stream >> pos;
01972         QSize size;
01973         stream >> size;
01974         docks[pos].rect = QRect(QPoint(0, 0), size);
01975         if (!docks[pos].restoreState(stream, dockwidgets)) {
01976             stream.setStatus(QDataStream::ReadCorruptData);
01977             return false;
01978         }
01979     }
01980 
01981     QSize size;
01982     stream >> size;
01983     centralWidgetRect = QRect(QPoint(0, 0), size);
01984 
01985     bool ok = stream.status() == QDataStream::Ok;
01986 
01987     if (ok) {
01988         int cornerData[4];
01989         for (int i = 0; i < 4; ++i)
01990             stream >> cornerData[i];
01991         if (stream.status() == QDataStream::Ok) {
01992             for (int i = 0; i < 4; ++i)
01993                 corners[i] = static_cast<Qt::DockWidgetArea>(cornerData[i]);
01994         }
01995     }
01996 
01997     return ok;
01998 }

QList< int > QDockWidgetLayout::indexOf ( QDockWidget dockWidget,
IndexOfFlag  flag = IndexOfFindsVisible 
) const

Definition at line 2000 of file qdockwidgetlayout.cpp.

References docks, i, PosCount, and QList< T >::prepend().

Referenced by QMainWindowLayout::contains(), QMainWindowLayout::dockWidgetArea(), keepSize(), QMainWindowLayout::plug(), QMainWindowLayout::restoreState(), splitDockWidget(), tabifyDockWidget(), and QMainWindowLayout::unplug().

02001 {
02002     for (int i = 0; i < PosCount; ++i) {
02003         QList<int> result = docks[i].indexOf(dockWidget, flag);
02004         if (!result.isEmpty()) {
02005             result.prepend(i);
02006             return result;
02007         }
02008     }
02009     return QList<int>();
02010 }

Here is the call graph for this function:

QList< int > QDockWidgetLayout::gapIndex ( const QPoint pos,
bool  nestingEnabled 
) const

Definition at line 2012 of file qdockwidgetlayout.cpp.

References QRect::bottom(), BottomPos, QRect::contains(), docks, EmptyDropAreaSize, QRect::height(), i, info(), QDockAreaLayoutInfo::isEmpty(), QRect::left(), LeftPos, PosCount, QList< T >::prepend(), QDockAreaLayoutInfo::rect, rect, QRect::right(), RightPos, QRect::top(), TopPos, and QRect::width().

Referenced by QMainWindowLayout::hover().

02013 {
02014     for (int i = 0; i < PosCount; ++i) {
02015         const QDockAreaLayoutInfo &info = docks[i];
02016 
02017         if (!info.isEmpty() && info.rect.contains(pos)) {
02018             QList<int> result = docks[i].gapIndex(pos, nestingEnabled);
02019             if (!result.isEmpty())
02020                 result.prepend(i);
02021             return result;
02022         }
02023     }
02024 
02025     for (int i = 0; i < PosCount; ++i) {
02026         const QDockAreaLayoutInfo &info = docks[i];
02027 
02028         if (info.isEmpty()) {
02029             QRect r;
02030             switch (i) {
02031                 case LeftPos:
02032                     r = QRect(rect.left(), rect.top(), EmptyDropAreaSize, rect.height());
02033                     break;
02034                 case RightPos:
02035                     r = QRect(rect.right() - EmptyDropAreaSize, rect.top(),
02036                                 EmptyDropAreaSize, rect.height());
02037                     break;
02038                 case TopPos:
02039                     r = QRect(rect.left(), rect.top(), rect.width(), EmptyDropAreaSize);
02040                     break;
02041                 case BottomPos:
02042                     r = QRect(rect.left(), rect.bottom() - EmptyDropAreaSize,
02043                                 rect.width(), EmptyDropAreaSize);
02044                     break;
02045             }
02046             if (r.contains(pos))
02047                 return QList<int>() << i << 0;
02048         }
02049     }
02050 
02051     return QList<int>();
02052 }

Here is the call graph for this function:

QList< int > QDockWidgetLayout::findSeparator ( const QPoint pos  )  const

Definition at line 2054 of file qdockwidgetlayout.cpp.

References QRect::contains(), docks, i, info(), QList< T >::isEmpty(), QDockAreaLayoutInfo::isEmpty(), PosCount, QList< T >::prepend(), QDockAreaLayoutInfo::rect, and separatorRect().

Referenced by QMainWindowPrivate::adjustCursor(), and QMainWindowLayout::startSeparatorMove().

02055 {
02056     QList<int> result;
02057     for (int i = 0; i < PosCount; ++i) {
02058         const QDockAreaLayoutInfo &info = docks[i];
02059         if (info.isEmpty())
02060             continue;
02061         if (separatorRect(i).contains(pos)) {
02062             result << i;
02063             break;
02064         } else if (info.rect.contains(pos)) {
02065             result = docks[i].findSeparator(pos);
02066             if (!result.isEmpty()) {
02067                 result.prepend(i);
02068                 break;
02069             }
02070         }
02071     }
02072 
02073     return result;
02074 }

Here is the call graph for this function:

QDockAreaLayoutItem & QDockWidgetLayout::item ( QList< int >  path  ) 

Definition at line 2098 of file qdockwidgetlayout.cpp.

References docks, index, QDockAreaLayoutInfo::item(), path, and PosCount.

Referenced by gapRect(), keepSize(), and QMainWindowLayout::unplug().

02099 {
02100     Q_ASSERT(!path.isEmpty());
02101     int index = path.takeFirst();
02102     Q_ASSERT(index >= 0 && index < PosCount);
02103     return docks[index].item(path);
02104 }

Here is the call graph for this function:

QDockAreaLayoutInfo * QDockWidgetLayout::info ( QList< int >  path  ) 

Definition at line 2086 of file qdockwidgetlayout.cpp.

References docks, index, QDockAreaLayoutInfo::info(), path, and PosCount.

Referenced by addDockWidget(), QMainWindowLayout::animationFinished(), findSeparator(), gapIndex(), gapRect(), info(), QMainWindowLayout::raise(), QMainWindowLayout::restoreState(), QMainWindowPrivate::separatorCursor(), separatorMove(), splitDockWidget(), QMainWindowLayout::tabChanged(), and tabifyDockWidget().

02087 {
02088     Q_ASSERT(!path.isEmpty());
02089     int index = path.takeFirst();
02090     Q_ASSERT(index >= 0 && index < PosCount);
02091 
02092     if (path.isEmpty())
02093         return &docks[index];
02094 
02095     return docks[index].info(path);
02096 }

Here is the call graph for this function:

QDockAreaLayoutInfo * QDockWidgetLayout::info ( QWidget widget  ) 

Definition at line 2076 of file qdockwidgetlayout.cpp.

References docks, i, info(), and PosCount.

02077 {
02078     for (int i = 0; i < PosCount; ++i) {
02079         if (QDockAreaLayoutInfo *result = docks[i].info(widget))
02080             return result;
02081     }
02082 
02083     return 0;
02084 }

Here is the call graph for this function:

QRect QDockWidgetLayout::itemRect ( QList< int >  path  )  const

Definition at line 2106 of file qdockwidgetlayout.cpp.

References docks, index, QDockAreaLayoutInfo::itemRect(), path, and PosCount.

Referenced by QMainWindowLayout::unplug().

02107 {
02108     Q_ASSERT(!path.isEmpty());
02109     int index = path.takeFirst();
02110     Q_ASSERT(index >= 0 && index < PosCount);
02111     return docks[index].itemRect(path);
02112 }

Here is the call graph for this function:

QRect QDockWidgetLayout::separatorRect ( int  index  )  const

Definition at line 2114 of file qdockwidgetlayout.cpp.

References QRect::bottom(), BottomPos, docks, QRect::height(), isEmpty(), QRect::left(), LeftPos, QDockAreaLayoutInfo::rect, QRect::right(), RightPos, sep, QRect::top(), TopPos, and QRect::width().

Referenced by QMainWindowPrivate::adjustCursor(), findSeparator(), paintSeparators(), separatorRect(), and separatorRegion().

02115 {
02116     if (docks[index].isEmpty())
02117         return QRect();
02118     QRect r = docks[index].rect;
02119     switch (index) {
02120         case LeftPos:
02121             return QRect(r.right() + 1, r.top(), sep, r.height());
02122         case RightPos:
02123             return QRect(r.left() - sep, r.top(), sep, r.height());
02124         case TopPos:
02125             return QRect(r.left(), r.bottom() + 1, r.width(), sep);
02126         case BottomPos:
02127             return QRect(r.left(), r.top() - sep, r.width(), sep);
02128         default:
02129             break;
02130     }
02131     return QRect();
02132 }

Here is the call graph for this function:

QRect QDockWidgetLayout::separatorRect ( QList< int >  path  )  const

Definition at line 2134 of file qdockwidgetlayout.cpp.

References docks, index, path, PosCount, QDockAreaLayoutInfo::separatorRect(), and separatorRect().

02135 {
02136     Q_ASSERT(!path.isEmpty());
02137 
02138     int index = path.takeFirst();
02139     Q_ASSERT(index >= 0 && index < PosCount);
02140 
02141     if (path.isEmpty())
02142         return separatorRect(index);
02143     else
02144         return docks[index].separatorRect(path);
02145 }

Here is the call graph for this function:

bool QDockWidgetLayout::insertGap ( QList< int >  path,
QWidgetItem dockWidgetItem 
)

Definition at line 2147 of file qdockwidgetlayout.cpp.

References docks, index, QDockAreaLayoutInfo::insertGap(), path, and PosCount.

02148 {
02149     Q_ASSERT(!path.isEmpty());
02150     int index = path.takeFirst();
02151     Q_ASSERT(index >= 0 && index < PosCount);
02152     return docks[index].insertGap(path, dockWidgetItem);
02153 }

Here is the call graph for this function:

QWidgetItem * QDockWidgetLayout::convertToGap ( QList< int >  path  ) 

Definition at line 2163 of file qdockwidgetlayout.cpp.

References QDockAreaLayoutInfo::convertToGap(), docks, index, path, and PosCount.

Referenced by QMainWindowLayout::unplug().

02164 {
02165     Q_ASSERT(!path.isEmpty());
02166     int index = path.takeFirst();
02167     Q_ASSERT(index >= 0 && index < PosCount);
02168     return docks[index].convertToGap(path);
02169 }

Here is the call graph for this function:

QRect QDockWidgetLayout::convertToWidget ( QList< int >  path,
QWidgetItem dockWidgetItem 
)

Definition at line 2155 of file qdockwidgetlayout.cpp.

References QDockAreaLayoutInfo::convertToWidget(), docks, index, path, and PosCount.

Referenced by QMainWindowLayout::plug().

02156 {
02157     Q_ASSERT(!path.isEmpty());
02158     int index = path.takeFirst();
02159     Q_ASSERT(index >= 0 && index < PosCount);
02160     return docks[index].convertToWidget(path, dockWidgetItem);
02161 }

Here is the call graph for this function:

void QDockWidgetLayout::remove ( QList< int >  path  ) 

Definition at line 2171 of file qdockwidgetlayout.cpp.

References docks, index, path, PosCount, and QDockAreaLayoutInfo::remove().

Referenced by QMainWindowLayout::plug().

02172 {
02173     Q_ASSERT(!path.isEmpty());
02174     int index = path.takeFirst();
02175     Q_ASSERT(index >= 0 && index < PosCount);
02176     docks[index].remove(path);
02177 }

Here is the call graph for this function:

void QDockWidgetLayout::fitLayout (  ) 

Definition at line 2452 of file qdockwidgetlayout.cpp.

References getGrid(), QRect::height(), QRect::left(), qGeomCalc(), rect, sep, setGrid(), QRect::top(), and QRect::width().

Referenced by QMainWindowLayout::unplug().

02453 {
02454     QVector<QLayoutStruct> ver_struct_list(3);
02455     QVector<QLayoutStruct> hor_struct_list(3);
02456     getGrid(&ver_struct_list, &hor_struct_list);
02457 
02458     qGeomCalc(ver_struct_list, 0, 3, rect.top(), rect.height(), sep);
02459     qGeomCalc(hor_struct_list, 0, 3, rect.left(), rect.width(), sep);
02460 
02461     setGrid(&ver_struct_list, &hor_struct_list);
02462 }

Here is the call graph for this function:

void QDockWidgetLayout::clear (  ) 

Definition at line 2464 of file qdockwidgetlayout.cpp.

References centralWidgetRect, docks, i, PosCount, and rect.

Referenced by QMainWindowLayout::animationFinished(), QMainWindowLayout::endSeparatorMove(), QMainWindowLayout::plug(), and QMainWindowLayout::restore().

02465 {
02466     for (int i = 0; i < PosCount; ++i)
02467         docks[i].clear();
02468 
02469     rect = QRect(0, 0, -1, -1);
02470     centralWidgetRect = QRect(0, 0, -1, -1);
02471 }

QSize QDockWidgetLayout::sizeHint (  )  const

Definition at line 2473 of file qdockwidgetlayout.cpp.

References Qt::BottomLeftCorner, BottomPos, Qt::BottomRightCorner, center(), centralWidgetItem, corners, docks, QSize::height(), QDockAreaLayoutInfo::isEmpty(), left(), Qt::LeftDockWidgetArea, LeftPos, qMax(), right(), Qt::RightDockWidgetArea, RightPos, sep, QDockAreaLayoutInfo::sizeHint(), QWidgetItem::sizeHint(), Qt::TopLeftCorner, TopPos, Qt::TopRightCorner, and QSize::width().

Referenced by getGrid(), and QMainWindowLayout::sizeHint().

02474 {
02475     int left_sep = docks[LeftPos].isEmpty() ? 0 : sep;
02476     int right_sep = docks[RightPos].isEmpty() ? 0 : sep;
02477     int top_sep = docks[TopPos].isEmpty() ? 0 : sep;
02478     int bottom_sep = docks[BottomPos].isEmpty() ? 0 : sep;
02479 
02480     QSize left = docks[LeftPos].sizeHint() + QSize(left_sep, 0);
02481     QSize right = docks[RightPos].sizeHint() + QSize(right_sep, 0);
02482     QSize top = docks[TopPos].sizeHint() + QSize(0, top_sep);
02483     QSize bottom = docks[BottomPos].sizeHint() + QSize(0, bottom_sep);
02484     QSize center = centralWidgetItem == 0 ? QSize(0, 0) : centralWidgetItem->sizeHint();
02485 
02486     int row1 = top.width();
02487     int row2 = left.width() + center.width() + right.width();
02488     int row3 = bottom.width();
02489     int col1 = left.height();
02490     int col2 = top.height() + center.height() + bottom.height();
02491     int col3 = right.height();
02492 
02493     if (corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea)
02494         row1 += left.width();
02495     else
02496         col1 += top.height();
02497 
02498     if (corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea)
02499         row1 += right.width();
02500     else
02501         col3 += top.height();
02502 
02503     if (corners[Qt::BottomLeftCorner] == Qt::LeftDockWidgetArea)
02504         row3 += left.width();
02505     else
02506         col1 += bottom.height();
02507 
02508     if (corners[Qt::BottomRightCorner] == Qt::RightDockWidgetArea)
02509         row3 += right.width();
02510     else
02511         col3 += bottom.height();
02512 
02513     return QSize(qMax(row1, row2, row3), qMax(col1, col2, col3));
02514 }

Here is the call graph for this function:

QSize QDockWidgetLayout::minimumSize (  )  const

Definition at line 2516 of file qdockwidgetlayout.cpp.

References Qt::BottomLeftCorner, BottomPos, Qt::BottomRightCorner, center(), centralWidgetItem, corners, docks, QSize::height(), QDockAreaLayoutInfo::isEmpty(), left(), Qt::LeftDockWidgetArea, LeftPos, QWidgetItem::minimumSize(), QDockAreaLayoutInfo::minimumSize(), qMax(), right(), Qt::RightDockWidgetArea, RightPos, sep, Qt::TopLeftCorner, TopPos, Qt::TopRightCorner, and QSize::width().

Referenced by getGrid(), and QMainWindowLayout::minimumSize().

02517 {
02518     int left_sep = docks[LeftPos].isEmpty() ? 0 : sep;
02519     int right_sep = docks[RightPos].isEmpty() ? 0 : sep;
02520     int top_sep = docks[TopPos].isEmpty() ? 0 : sep;
02521     int bottom_sep = docks[BottomPos].isEmpty() ? 0 : sep;
02522 
02523     QSize left = docks[LeftPos].minimumSize() + QSize(left_sep, 0);
02524     QSize right = docks[RightPos].minimumSize() + QSize(right_sep, 0);
02525     QSize top = docks[TopPos].minimumSize() + QSize(0, top_sep);
02526     QSize bottom = docks[BottomPos].minimumSize() + QSize(0, bottom_sep);
02527     QSize center = centralWidgetItem == 0 ? QSize(0, 0) : centralWidgetItem->minimumSize();
02528 
02529     int row1 = top.width();
02530     int row2 = left.width() + center.width() + right.width();
02531     int row3 = bottom.width();
02532     int col1 = left.height();
02533     int col2 = top.height() + center.height() + bottom.height();
02534     int col3 = right.height();
02535 
02536     if (corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea)
02537         row1 += left.width();
02538     else
02539         col1 += top.height();
02540 
02541     if (corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea)
02542         row1 += right.width();
02543     else
02544         col3 += top.height();
02545 
02546     if (corners[Qt::BottomLeftCorner] == Qt::LeftDockWidgetArea)
02547         row3 += left.width();
02548     else
02549         col1 += bottom.height();
02550 
02551     if (corners[Qt::BottomRightCorner] == Qt::RightDockWidgetArea)
02552         row3 += right.width();
02553     else
02554         col3 += bottom.height();
02555 
02556     return QSize(qMax(row1, row2, row3), qMax(col1, col2, col3));
02557 }

Here is the call graph for this function:

void QDockWidgetLayout::addDockWidget ( DockPos  pos,
QDockWidget dockWidget,
Qt::Orientation  orientation 
)

Definition at line 2559 of file qdockwidgetlayout.cpp.

References QList< T >::append(), BottomPos, docks, info(), QDockAreaLayoutInfo::isEmpty(), QDockAreaLayoutInfo::item_list, LeftPos, mainWindow, QDockAreaLayoutInfo::o, RightPos, QTabBar::RoundedEast, QTabBar::RoundedNorth, QTabBar::RoundedSouth, QTabBar::RoundedWest, sep, QDockAreaLayoutInfo::setCurrentTabId(), QDockAreaLayoutInfo::tabbed, tabId(), TopPos, and QDockAreaLayoutInfo::updateTabBar().

Referenced by QMainWindowLayout::addDockWidget().

02561 {
02562     QWidgetItem *dockWidgetItem = new QWidgetItem(dockWidget);
02563     QDockAreaLayoutInfo &info = docks[pos];
02564     if (orientation == info.o || info.isEmpty()) {
02565         QDockAreaLayoutItem new_item(dockWidgetItem);
02566         info.item_list.append(new_item);
02567 #ifndef QT_NO_TABBAR
02568         if (info.tabbed && !new_item.skip()) {
02569             info.updateTabBar();
02570             info.setCurrentTabId(tabId(new_item));
02571         }
02572 #endif
02573     } else {
02574 #ifndef QT_NO_TABBAR
02575         int tbshape = QTabBar::RoundedSouth;
02576         switch (pos) {
02577             case TopPos:
02578                 tbshape = QTabBar::RoundedNorth;
02579                 break;
02580             case BottomPos:
02581                 tbshape = QTabBar::RoundedSouth;
02582                 break;
02583             case RightPos:
02584                 tbshape = QTabBar::RoundedEast;
02585                 break;
02586             case LeftPos:
02587                 tbshape = QTabBar::RoundedWest;
02588                 break;
02589             default:
02590                 break;
02591         }
02592 #else
02593         int tbshape = 0;
02594 #endif
02595         QDockAreaLayoutInfo new_info(sep, orientation, tbshape, mainWindow);
02596         new_info.item_list.append(new QDockAreaLayoutInfo(info));
02597         new_info.item_list.append(dockWidgetItem);
02598         info = new_info;
02599     }
02600 }

Here is the call graph for this function:

void QDockWidgetLayout::splitDockWidget ( QDockWidget after,
QDockWidget dockWidget,
Qt::Orientation  orientation 
)

Definition at line 2613 of file qdockwidgetlayout.cpp.

References indexOf(), info(), path, and QDockAreaLayoutInfo::split().

Referenced by QMainWindowLayout::splitDockWidget().

02616 {
02617     QList<int> path = indexOf(after);
02618     if (path.isEmpty())
02619         return;
02620 
02621     QDockAreaLayoutInfo *info = this->info(path);
02622     Q_ASSERT(info != 0);
02623     info->split(path.last(), orientation, new QWidgetItem(dockWidget));
02624 }

Here is the call graph for this function:

void QDockWidgetLayout::tabifyDockWidget ( QDockWidget first,
QDockWidget second 
)

Definition at line 2602 of file qdockwidgetlayout.cpp.

References indexOf(), info(), path, and QDockAreaLayoutInfo::tab().

Referenced by QMainWindowLayout::tabifyDockWidget().

02603 {
02604     QList<int> path = indexOf(first);
02605     if (path.isEmpty())
02606         return;
02607 
02608     QDockAreaLayoutInfo *info = this->info(path);
02609     Q_ASSERT(info != 0);
02610     info->tab(path.last(), new QWidgetItem(second));
02611 }

Here is the call graph for this function:

void QDockWidgetLayout::apply ( bool  animate  ) 

Definition at line 2626 of file qdockwidgetlayout.cpp.

References QWidgetAnimator::animate(), centralWidgetItem, centralWidgetRect, docks, i, QWidgetItem::isEmpty(), QWidget::layout(), mainWindow, PosCount, and QWidgetItem::widget().

Referenced by QMainWindowLayout::applyDockWidgetLayout(), and separatorMove().

02627 {
02628     QWidgetAnimator *widgetAnimator
02629         = qobject_cast<QMainWindowLayout*>(mainWindow->layout())->widgetAnimator;
02630 
02631     for (int i = 0; i < PosCount; ++i)
02632         docks[i].apply(animate);
02633     if (centralWidgetItem != 0 && !centralWidgetItem->isEmpty()) {
02634         widgetAnimator->animate(centralWidgetItem->widget(), centralWidgetRect,
02635                                 animate);
02636     }
02637 }

Here is the call graph for this function:

void QDockWidgetLayout::paintSeparators ( QPainter p,
QWidget widget,
const QRegion clip,
const QPoint mouse 
) const

Definition at line 2639 of file qdockwidgetlayout.cpp.

References QRegion::contains(), QRect::contains(), docks, Qt::Horizontal, i, p, paintSep(), PosCount, separatorRect(), and Qt::Vertical.

02642 {
02643     for (int i = 0; i < PosCount; ++i) {
02644         const QDockAreaLayoutInfo &dock = docks[i];
02645         if (dock.isEmpty())
02646             continue;
02647         QRect r = separatorRect(i);
02648         if (clip.contains(r)) {
02649             Qt::Orientation opposite = dock.o == Qt::Horizontal
02650                                         ? Qt::Vertical : Qt::Horizontal;
02651             paintSep(p, widget, r, opposite, r.contains(mouse));
02652         }
02653         if (clip.contains(dock.rect))
02654             dock.paintSeparators(p, widget, clip, mouse);
02655     }
02656 }

Here is the call graph for this function:

QRegion QDockWidgetLayout::separatorRegion (  )  const

Definition at line 2658 of file qdockwidgetlayout.cpp.

References docks, i, PosCount, and separatorRect().

Referenced by QMainWindowLayout::allAnimationsFinished(), QMainWindowLayout::hover(), and QMainWindowLayout::plug().

02659 {
02660     QRegion result;
02661 
02662     for (int i = 0; i < PosCount; ++i) {
02663         const QDockAreaLayoutInfo &dock = docks[i];
02664         if (dock.isEmpty())
02665             continue;
02666         result |= separatorRect(i);
02667         result |= dock.separatorRegion();
02668     }
02669 
02670     return result;
02671 }

Here is the call graph for this function:

int QDockWidgetLayout::separatorMove ( QList< int >  separator,
const QPoint origin,
const QPoint dest,
QVector< QLayoutStruct > *  cache 
)

Definition at line 2673 of file qdockwidgetlayout.cpp.

References apply(), QDockAreaLayoutInfo::apply(), QList< T >::count(), getGrid(), Qt::Horizontal, index, info(), QDockAreaLayoutInfo::info(), QVector< T >::isEmpty(), QList< T >::last(), LeftPos, o, QDockAreaLayoutInfo::o, pick(), RightPos, sep, QDockAreaLayoutInfo::separatorMove(), setGrid(), TopPos, and Qt::Vertical.

Referenced by QMainWindowLayout::doSeparatorMove().

02676 {
02677     int delta = 0;
02678     int index = separator.last();
02679 
02680     if (separator.count() > 1) {
02681         QDockAreaLayoutInfo *info = this->info(separator);
02682         delta = pick(info->o, dest - origin);
02683         if (delta != 0)
02684             delta = info->separatorMove(index, delta, cache);
02685         info->apply(false);
02686         return delta;
02687     }
02688 
02689     if (cache->isEmpty()) {
02690         QVector<QLayoutStruct> &list = *cache;
02691 
02692         if (index == LeftPos || index == RightPos)
02693             getGrid(0, &list);
02694         else
02695             getGrid(&list, 0);
02696     }
02697 
02698     QVector<QLayoutStruct> list = *cache;
02699     int sep_index = index == LeftPos || index == TopPos
02700                         ? 0 : 1;
02701     Qt::Orientation o = index == LeftPos || index == RightPos
02702                         ? Qt::Horizontal
02703                         : Qt::Vertical;
02704 
02705     delta = pick(o, dest - origin);
02706     delta = ::separatorMove(list, sep_index, delta, sep);
02707 
02708     if (index == LeftPos || index == RightPos)
02709         setGrid(0, &list);
02710     else
02711         setGrid(&list, 0);
02712 
02713     apply(false);
02714 
02715     return delta;
02716 }

Here is the call graph for this function:

QLayoutItem * QDockWidgetLayout::itemAt ( int *  x,
int  index 
) const

Definition at line 2718 of file qdockwidgetlayout.cpp.

References centralWidgetItem, docks, i, and PosCount.

Referenced by QMainWindowLayout::itemAt().

02719 {
02720     Q_ASSERT(x != 0);
02721 
02722     for (int i = 0; i < PosCount; ++i) {
02723         const QDockAreaLayoutInfo &dock = docks[i];
02724         if (QLayoutItem *ret = dock.itemAt(x, index))
02725             return ret;
02726     }
02727 
02728     if (centralWidgetItem && (*x)++ == index)
02729         return centralWidgetItem;
02730 
02731     return 0;
02732 }

QLayoutItem * QDockWidgetLayout::takeAt ( int *  x,
int  index 
)

Definition at line 2734 of file qdockwidgetlayout.cpp.

References centralWidgetItem, docks, i, and PosCount.

Referenced by QMainWindowLayout::takeAt().

02735 {
02736     Q_ASSERT(x != 0);
02737 
02738     for (int i = 0; i < PosCount; ++i) {
02739         QDockAreaLayoutInfo &dock = docks[i];
02740         if (QLayoutItem *ret = dock.takeAt(x, index))
02741             return ret;
02742     }
02743 
02744     if (centralWidgetItem && (*x)++ == index) {
02745         QLayoutItem *ret = centralWidgetItem;
02746         centralWidgetItem = 0;
02747         return ret;
02748     }
02749 
02750     return 0;
02751 }

void QDockWidgetLayout::deleteAllLayoutItems (  ) 

Definition at line 2753 of file qdockwidgetlayout.cpp.

References docks, i, and PosCount.

Referenced by QMainWindowLayout::restoreState(), and QMainWindowLayout::~QMainWindowLayout().

02754 {
02755     for (int i = 0; i < PosCount; ++i)
02756         docks[i].deleteAllLayoutItems();
02757 }

void QDockWidgetLayout::getGrid ( QVector< QLayoutStruct > *  ver_struct_list,
QVector< QLayoutStruct > *  hor_struct_list 
)

Definition at line 2182 of file qdockwidgetlayout.cpp.

References QRect::bottom(), Qt::BottomDockWidgetArea, Qt::BottomLeftCorner, BottomPos, Qt::BottomRightCorner, centralWidgetItem, centralWidgetRect, corners, docks, QVector< T >::empty(), QRect::height(), QSize::height(), i, QDockAreaLayoutInfo::isEmpty(), QWidgetItem::isEmpty(), isEmpty(), QSize::isValid(), QRect::left(), left(), Qt::LeftDockWidgetArea, LeftPos, QDockAreaLayoutInfo::maximumSize(), QWidgetItem::minimumSize(), minimumSize(), QDockAreaLayoutInfo::minimumSize(), qMax(), QWIDGETSIZE_MAX, QDockAreaLayoutInfo::rect, rect, QVector< T >::resize(), right(), QRect::right(), Qt::RightDockWidgetArea, RightPos, sep, QRect::setBottom(), QRect::setLeft(), QRect::setRight(), QRect::setTop(), QDockAreaLayoutInfo::size(), QRect::size(), QVector< T >::size(), sizeHint(), QWidgetItem::sizeHint(), QRect::top(), Qt::TopDockWidgetArea, Qt::TopLeftCorner, TopPos, Qt::TopRightCorner, QRect::width(), and QSize::width().

Referenced by fitLayout(), and separatorMove().

02184 {
02185     QSize center_hint(0, 0);
02186     QSize center_min(0, 0);
02187     bool have_central = centralWidgetItem != 0 && !centralWidgetItem->isEmpty();
02188     if (have_central) {
02189         center_hint = centralWidgetRect.size();
02190         if (!center_hint.isValid())
02191             center_hint = centralWidgetItem->sizeHint();
02192         center_min = centralWidgetItem->minimumSize();
02193     }
02194 
02195     QRect center_rect = rect;
02196     if (!docks[LeftPos].isEmpty())
02197         center_rect.setLeft(rect.left() + docks[LeftPos].rect.width() + sep);
02198     if (!docks[TopPos].isEmpty())
02199         center_rect.setTop(rect.top() + docks[TopPos].rect.height() + sep);
02200     if (!docks[RightPos].isEmpty())
02201         center_rect.setRight(rect.right() - docks[RightPos].rect.width() - sep - 1);
02202     if (!docks[BottomPos].isEmpty())
02203         center_rect.setBottom(rect.bottom() - docks[BottomPos].rect.height() - sep - 1);
02204 
02205     QSize left_hint = docks[LeftPos].size();
02206     if (!left_hint.isValid())
02207         left_hint = docks[LeftPos].sizeHint();
02208     QSize left_min = docks[LeftPos].minimumSize();
02209     QSize left_max = docks[LeftPos].maximumSize();
02210     int left_sep = docks[LeftPos].isEmpty() ? 0 : sep;
02211 
02212     QSize right_hint = docks[RightPos].size();
02213     if (!right_hint.isValid())
02214         right_hint = docks[RightPos].sizeHint();
02215     QSize right_min = docks[RightPos].minimumSize();
02216     QSize right_max = docks[RightPos].maximumSize();
02217     int right_sep = docks[RightPos].isEmpty() ? 0 : sep;
02218 
02219     QSize top_hint = docks[TopPos].size();
02220     if (!top_hint.isValid())
02221         top_hint = docks[TopPos].sizeHint();
02222     QSize top_min = docks[TopPos].minimumSize();
02223     QSize top_max = docks[TopPos].maximumSize();
02224     int top_sep = docks[TopPos].isEmpty() ? 0 : sep;
02225 
02226     QSize bottom_hint = docks[BottomPos].size();
02227     if (!bottom_hint.isValid())
02228         bottom_hint = docks[BottomPos].sizeHint();
02229     QSize bottom_min = docks[BottomPos].minimumSize();
02230     QSize bottom_max = docks[BottomPos].maximumSize();
02231     int bottom_sep = docks[BottomPos].isEmpty() ? 0 : sep;
02232 
02233     if (_ver_struct_list != 0) {
02234         QVector<QLayoutStruct> &ver_struct_list = *_ver_struct_list;
02235         ver_struct_list.resize(3);
02236 
02237         // top --------------------------------------------------
02238 
02239         ver_struct_list[0].stretch = 0;
02240         ver_struct_list[0].sizeHint = top_hint.height();
02241         ver_struct_list[0].minimumSize = top_min.height();
02242         ver_struct_list[0].maximumSize = top_max.height();
02243         ver_struct_list[0].expansive = false;
02244         ver_struct_list[0].empty = docks[TopPos].isEmpty();
02245         ver_struct_list[0].pos = docks[TopPos].rect.top();
02246         ver_struct_list[0].size = docks[TopPos].rect.height();
02247 
02248         // center --------------------------------------------------
02249 
02250         ver_struct_list[1].stretch = center_hint.height();
02251         int left = left_hint.height();
02252         if (corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea)
02253             left -= top_hint.height() + top_sep;
02254         if (corners[Qt::BottomLeftCorner] == Qt::LeftDockWidgetArea)
02255             left -= bottom_hint.height() + bottom_sep;
02256         int right = right_hint.height();
02257         if (corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea)
02258             right -= top_hint.height() + top_sep;
02259         if (corners[Qt::BottomRightCorner] == Qt::RightDockWidgetArea)
02260             right -= bottom_hint.height() + bottom_sep;
02261         ver_struct_list[1].sizeHint = qMax(left, center_hint.height(), right);
02262 
02263         left = left_min.height();
02264         if (corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea)
02265             left -= top_min.height() + top_sep;
02266         if (corners[Qt::BottomLeftCorner] == Qt::LeftDockWidgetArea)
02267             left -= bottom_min.height() + bottom_sep;
02268         right = right_min.height();
02269         if (corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea)
02270             right -= top_min.height() + top_sep;
02271         if (corners[Qt::BottomRightCorner] == Qt::RightDockWidgetArea)
02272             right -= bottom_min.height() + bottom_sep;
02273         ver_struct_list[1].minimumSize = qMax(left, center_min.height(), right);
02274         ver_struct_list[1].maximumSize = have_central ? QWIDGETSIZE_MAX : 0;
02275         ver_struct_list[1].expansive = have_central;
02276         ver_struct_list[1].empty = docks[LeftPos].isEmpty()
02277                                         && !have_central
02278                                         && docks[RightPos].isEmpty();
02279         ver_struct_list[1].pos = center_rect.top();
02280         ver_struct_list[1].size = center_rect.height();
02281 
02282         // bottom --------------------------------------------------
02283 
02284         ver_struct_list[2].stretch = 0;
02285         ver_struct_list[2].sizeHint = bottom_hint.height();
02286         ver_struct_list[2].minimumSize = bottom_min.height();
02287         ver_struct_list[2].maximumSize = bottom_max.height();
02288         ver_struct_list[2].expansive = false;
02289         ver_struct_list[2].empty = docks[BottomPos].isEmpty();
02290         ver_struct_list[2].pos = docks[BottomPos].rect.top();
02291         ver_struct_list[2].size = docks[BottomPos].rect.height();
02292 
02293         for (int i = 0; i < 3; ++i) {
02294             ver_struct_list[i].sizeHint
02295                 = qMax(ver_struct_list[i].sizeHint, ver_struct_list[i].minimumSize);
02296         }
02297     }
02298 
02299     if (_hor_struct_list != 0) {
02300         QVector<QLayoutStruct> &hor_struct_list = *_hor_struct_list;
02301         hor_struct_list.resize(3);
02302 
02303         // left --------------------------------------------------
02304 
02305         hor_struct_list[0].stretch = 0;
02306         hor_struct_list[0].sizeHint = left_hint.width();
02307         hor_struct_list[0].minimumSize = left_min.width();
02308         hor_struct_list[0].maximumSize = left_max.width();
02309         hor_struct_list[0].expansive = false;
02310         hor_struct_list[0].empty = docks[LeftPos].isEmpty();
02311         hor_struct_list[0].pos = docks[LeftPos].rect.left();
02312         hor_struct_list[0].size = docks[LeftPos].rect.width();
02313 
02314         // center --------------------------------------------------
02315 
02316         hor_struct_list[1].stretch = center_hint.width();
02317         int top = top_hint.width();
02318         if (corners[Qt::TopLeftCorner] == Qt::TopDockWidgetArea)
02319             top -= left_hint.width() + left_sep;
02320         if (corners[Qt::TopRightCorner] == Qt::TopDockWidgetArea)
02321             top -= right_hint.width() + right_sep;
02322         int bottom = bottom_hint.width();
02323         if (corners[Qt::BottomLeftCorner] == Qt::BottomDockWidgetArea)
02324             bottom -= left_hint.width() + left_sep;
02325         if (corners[Qt::BottomRightCorner] == Qt::BottomDockWidgetArea)
02326             bottom -= right_hint.width() + right_sep;
02327         hor_struct_list[1].sizeHint = qMax(top, center_hint.width(), bottom);
02328 
02329         top = top_min.width();
02330         if (corners[Qt::TopLeftCorner] == Qt::TopDockWidgetArea)
02331             top -= left_min.width() + left_sep;
02332         if (corners[Qt::TopRightCorner] == Qt::TopDockWidgetArea)
02333             top -= right_min.width() + right_sep;
02334         bottom = bottom_min.width();
02335         if (corners[Qt::BottomLeftCorner] == Qt::BottomDockWidgetArea)
02336             bottom -= left_min.width() + left_sep;
02337         if (corners[Qt::BottomRightCorner] == Qt::BottomDockWidgetArea)
02338             bottom -= right_min.width() + right_sep;
02339         hor_struct_list[1].minimumSize = qMax(top, center_min.width(), bottom);
02340         hor_struct_list[1].maximumSize = have_central ? QWIDGETSIZE_MAX : 0;
02341         hor_struct_list[1].expansive = have_central;
02342         hor_struct_list[1].empty = !have_central;
02343         hor_struct_list[1].pos = center_rect.left();
02344         hor_struct_list[1].size = center_rect.width();
02345 
02346         // right --------------------------------------------------
02347 
02348         hor_struct_list[2].stretch = 0;
02349         hor_struct_list[2].sizeHint = right_hint.width();
02350         hor_struct_list[2].minimumSize = right_min.width();
02351         hor_struct_list[2].maximumSize = right_max.width();
02352         hor_struct_list[2].expansive = false;
02353         hor_struct_list[2].empty = docks[RightPos].isEmpty();
02354         hor_struct_list[2].pos = docks[RightPos].rect.left();
02355         hor_struct_list[2].size = docks[RightPos].rect.width();
02356 
02357         for (int i = 0; i < 3; ++i) {
02358             hor_struct_list[i].sizeHint
02359                 = qMax(hor_struct_list[i].sizeHint, hor_struct_list[i].minimumSize);
02360         }
02361     }
02362 }

Here is the call graph for this function:

void QDockWidgetLayout::setGrid ( QVector< QLayoutStruct > *  ver_struct_list,
QVector< QLayoutStruct > *  hor_struct_list 
)

Definition at line 2364 of file qdockwidgetlayout.cpp.

References QVector< T >::at(), QRect::bottom(), Qt::BottomDockWidgetArea, Qt::BottomLeftCorner, BottomPos, Qt::BottomRightCorner, centralWidgetRect, corners, docks, QDockAreaLayoutInfo::fitItems(), isEmpty(), QRect::left(), Qt::LeftDockWidgetArea, LeftPos, QLayoutStruct::pos, QDockAreaLayoutInfo::rect, rect, QRect::right(), Qt::RightDockWidgetArea, RightPos, sep, QRect::setBottom(), QRect::setHeight(), QRect::setLeft(), QRect::setRight(), QRect::setTop(), QRect::setWidth(), QLayoutStruct::size, QRect::top(), Qt::TopDockWidgetArea, Qt::TopLeftCorner, TopPos, and Qt::TopRightCorner.

Referenced by fitLayout(), and separatorMove().

02366 {
02367 
02368     // top ---------------------------------------------------
02369 
02370     QRect r = docks[TopPos].rect;
02371     if (hor_struct_list != 0) {
02372         r.setLeft(corners[Qt::TopLeftCorner] == Qt::TopDockWidgetArea
02373                     || docks[LeftPos].isEmpty()
02374                         ? rect.left() : hor_struct_list->at(1).pos);
02375         r.setRight(corners[Qt::TopRightCorner] == Qt::TopDockWidgetArea
02376                     || docks[RightPos].isEmpty()
02377                         ? rect.right() : hor_struct_list->at(2).pos - sep - 1);
02378     }
02379     if (ver_struct_list != 0) {
02380         r.setTop(rect.top());
02381         r.setBottom(ver_struct_list->at(1).pos - sep - 1);
02382     }
02383     docks[TopPos].rect = r;
02384     docks[TopPos].fitItems();
02385 
02386     // bottom ---------------------------------------------------
02387 
02388     r = docks[BottomPos].rect;
02389     if (hor_struct_list != 0) {
02390         r.setLeft(corners[Qt::BottomLeftCorner] == Qt::BottomDockWidgetArea
02391                     || docks[LeftPos].isEmpty()
02392                         ? rect.left() : hor_struct_list->at(1).pos);
02393         r.setRight(corners[Qt::BottomRightCorner] == Qt::BottomDockWidgetArea
02394                     || docks[RightPos].isEmpty()
02395                         ? rect.right() : hor_struct_list->at(2).pos - sep - 1);
02396     }
02397     if (ver_struct_list != 0) {
02398         r.setTop(ver_struct_list->at(2).pos);
02399         r.setBottom(rect.bottom());
02400     }
02401     docks[BottomPos].rect = r;
02402     docks[BottomPos].fitItems();
02403 
02404     // left ---------------------------------------------------
02405 
02406     r = docks[LeftPos].rect;
02407     if (hor_struct_list != 0) {
02408         r.setLeft(rect.left());
02409         r.setRight(hor_struct_list->at(1).pos - sep - 1);
02410     }
02411     if (ver_struct_list != 0) {
02412         r.setTop(corners[Qt::TopLeftCorner] == Qt::LeftDockWidgetArea
02413                     || docks[TopPos].isEmpty()
02414                         ? rect.top() : ver_struct_list->at(1).pos);
02415         r.setBottom(corners[Qt::BottomLeftCorner] == Qt::LeftDockWidgetArea
02416                     || docks[BottomPos].isEmpty()
02417                         ? rect.bottom() : ver_struct_list->at(2).pos - sep - 1);
02418     }
02419     docks[LeftPos].rect = r;
02420     docks[LeftPos].fitItems();
02421 
02422     // right ---------------------------------------------------
02423 
02424     r = docks[RightPos].rect;
02425     if (hor_struct_list != 0) {
02426         r.setLeft(hor_struct_list->at(2).pos);
02427         r.setRight(rect.right());
02428     }
02429     if (ver_struct_list != 0) {
02430         r.setTop(corners[Qt::TopRightCorner] == Qt::RightDockWidgetArea
02431                     || docks[TopPos].isEmpty()
02432                         ? rect.top() : ver_struct_list->at(1).pos);
02433         r.setBottom(corners[Qt::BottomRightCorner] == Qt::RightDockWidgetArea
02434                     || docks[BottomPos].isEmpty()
02435                         ? rect.bottom() : ver_struct_list->at(2).pos - sep - 1);
02436     }
02437     docks[RightPos].rect = r;
02438     docks[RightPos].fitItems();
02439 
02440     // center ---------------------------------------------------
02441 
02442     if (hor_struct_list != 0) {
02443         centralWidgetRect.setLeft(hor_struct_list->at(1).pos);
02444         centralWidgetRect.setWidth(hor_struct_list->at(1).size);
02445     }
02446     if (ver_struct_list != 0) {
02447         centralWidgetRect.setTop(ver_struct_list->at(1).pos);
02448         centralWidgetRect.setHeight(ver_struct_list->at(1).size);
02449     }
02450 }

Here is the call graph for this function:

QRect QDockWidgetLayout::gapRect ( QList< int >  path  ) 

Definition at line 2773 of file qdockwidgetlayout.cpp.

References QList< T >::at(), QList< T >::count(), QDockAreaLayoutItem::gap, index, info(), item(), QDockAreaLayoutInfo::item_list, QDockAreaLayoutInfo::next(), next, o, QDockAreaLayoutInfo::o, p, path, perp(), QDockAreaLayoutItem::pos, QDockAreaLayoutInfo::prev(), QDockAreaLayoutInfo::rect, rperp(), rpick(), s, sep, QDockAreaLayoutItem::size, QRect::size(), size, QDockAreaLayoutInfo::tabbed, QDockAreaLayoutInfo::tabContentRect(), and QRect::topLeft().

02774 {
02775     const QDockAreaLayoutInfo *info = this->info(path);
02776     if (info == 0)
02777         return QRect();
02778     const QList<QDockAreaLayoutItem> &item_list = info->item_list;
02779     Qt::Orientation o = info->o;
02780     int index = path.last();
02781     if (index < 0 || index >= item_list.count())
02782         return QRect();
02783     const QDockAreaLayoutItem &item = item_list.at(index);
02784     if (!item.gap)
02785         return QRect();
02786 
02787     QRect result;
02788 
02789 #ifndef QT_NO_TABBAR
02790     if (info->tabbed) {
02791         result = info->tabContentRect();
02792     } else
02793 #endif
02794     {
02795         int pos = item.pos;
02796         int size = item.size;
02797 
02798         int prev = info->prev(index);
02799         int next = info->next(index);
02800 
02801         if (prev != -1 && !item_list.at(prev).gap) {
02802             pos += sep;
02803             size -= sep;
02804         }
02805         if (next != -1 && !item_list.at(next).gap)
02806             size -= sep;
02807 
02808         QPoint p;
02809         rpick(o, p) = pos;
02810         rperp(o, p) = perp(o, info->rect.topLeft());
02811         QSize s;
02812         rpick(o, s) = size;
02813         rperp(o, s) = perp(o, info->rect.size());
02814 
02815         result = QRect(p, s);
02816     }
02817 
02818     return result;
02819 }

Here is the call graph for this function:

void QDockWidgetLayout::keepSize ( QDockWidget w  ) 

Definition at line 2821 of file qdockwidgetlayout.cpp.

References indexOf(), IndexOfFindsAll, item(), QDockAreaLayoutItem::keep_size, path, and w.

Referenced by QMainWindowLayout::keepSize().

02822 {
02823     QList<int> path = indexOf(w, IndexOfFindsAll);
02824     if (path.isEmpty())
02825         return;
02826     QDockAreaLayoutItem &item = this->item(path);
02827     item.keep_size = true;
02828 }

Here is the call graph for this function:

QSet< QTabBar * > QDockWidgetLayout::usedTabBars (  )  const

Definition at line 2760 of file qdockwidgetlayout.cpp.

References docks, i, and PosCount.

Referenced by QMainWindowLayout::applyDockWidgetLayout().

02761 {
02762     QSet<QTabBar*> result;
02763     for (int i = 0; i < PosCount; ++i) {
02764         const QDockAreaLayoutInfo &dock = docks[i];
02765         if (dock.isEmpty())
02766             continue;
02767         result += dock.usedTabBars();
02768     }
02769     return result;
02770 }


Member Data Documentation

Qt::DockWidgetArea QDockWidgetLayout::corners[4]

Definition at line 223 of file qdockwidgetlayout_p.h.

Referenced by QMainWindowLayout::corner(), getGrid(), minimumSize(), QDockWidgetLayout(), restoreState(), saveState(), QMainWindowLayout::setCorner(), setGrid(), and sizeHint().

QRect QDockWidgetLayout::rect

Definition at line 224 of file qdockwidgetlayout_p.h.

Referenced by clear(), fitLayout(), gapIndex(), getGrid(), isValid(), and setGrid().

QWidgetItem* QDockWidgetLayout::centralWidgetItem

Definition at line 225 of file qdockwidgetlayout_p.h.

Referenced by apply(), QMainWindowLayout::centralWidget(), getGrid(), itemAt(), minimumSize(), QDockWidgetLayout(), QMainWindowLayout::restoreState(), QMainWindowLayout::setCentralWidget(), sizeHint(), takeAt(), and QMainWindowLayout::~QMainWindowLayout().

QMainWindow* QDockWidgetLayout::mainWindow

Definition at line 226 of file qdockwidgetlayout_p.h.

Referenced by addDockWidget(), apply(), and QDockWidgetLayout().

QRect QDockWidgetLayout::centralWidgetRect

Definition at line 227 of file qdockwidgetlayout_p.h.

Referenced by apply(), clear(), getGrid(), QDockWidgetLayout(), restoreState(), saveState(), and setGrid().

QDockAreaLayoutInfo QDockWidgetLayout::docks[4]

Definition at line 229 of file qdockwidgetlayout_p.h.

Referenced by addDockWidget(), apply(), clear(), convertToGap(), convertToWidget(), deleteAllLayoutItems(), findSeparator(), gapIndex(), getGrid(), indexOf(), info(), insertGap(), item(), itemAt(), itemRect(), minimumSize(), paintSeparators(), QDockWidgetLayout(), remove(), restoreState(), saveState(), separatorRect(), separatorRegion(), setGrid(), sizeHint(), takeAt(), and usedTabBars().

int QDockWidgetLayout::sep

Definition at line 230 of file qdockwidgetlayout_p.h.

Referenced by addDockWidget(), fitLayout(), gapRect(), getGrid(), minimumSize(), QDockWidgetLayout(), separatorMove(), separatorRect(), setGrid(), and sizeHint().


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