#include <qdockwidgetlayout_p.h>
Collaboration diagram for QDockAreaLayoutInfo:
Definition at line 85 of file qdockwidgetlayout_p.h.
anonymous enum |
Definition at line 108 of file qdockwidgetlayout_p.h.
00108 { // sentinel values used to validate state data 00109 SequenceMarker = 0xfc, 00110 TabMarker = 0xfa, 00111 WidgetMarker = 0xfb 00112 };
QDockAreaLayoutInfo::QDockAreaLayoutInfo | ( | ) |
Definition at line 265 of file qdockwidgetlayout.cpp.
Referenced by insertGap(), restoreState(), split(), and tab().
00266 : sep(0), o(Qt::Horizontal), rect(0, 0, -1, -1), mainWindow(0) 00267 #ifndef QT_NO_TABBAR 00268 , tabbed(false), tabBar(0), tabBarShape(-1) 00269 #endif 00270 { 00271 }
QDockAreaLayoutInfo::QDockAreaLayoutInfo | ( | int | _sep, | |
Qt::Orientation | _o, | |||
int | tbhape, | |||
QMainWindow * | window | |||
) |
Definition at line 273 of file qdockwidgetlayout.cpp.
00275 : sep(_sep), o(_o), rect(0, 0, -1, -1), mainWindow(window) 00276 #ifndef QT_NO_TABBAR 00277 , tabbed(false), tabBar(0), tabBarShape(tbshape) 00278 #endif 00279 { 00280 #ifdef QT_NO_TABBAR 00281 Q_UNUSED(tbshape); 00282 #endif 00283 }
QSize QDockAreaLayoutInfo::minimumSize | ( | ) | const |
Definition at line 305 of file qdockwidgetlayout.cpp.
References a, QList< T >::at(), b, QSize::height(), i, isEmpty(), item(), item_list, QDockAreaLayoutItem::minimumSize(), o, perp(), pick(), qMax(), QSize::rheight(), QTabBar::RoundedEast, QTabBar::RoundedNorth, QTabBar::RoundedSouth, QTabBar::RoundedWest, rperp(), rpick(), QSize::rwidth(), sep, QList< T >::size(), QDockAreaLayoutItem::skip(), tabBarMinimumSize(), tabBarShape, tabbed, and QSize::width().
Referenced by fitItems(), QDockWidgetLayout::getGrid(), QDockWidgetLayout::minimumSize(), and QDockAreaLayoutItem::minimumSize().
00306 { 00307 if (isEmpty()) 00308 return QSize(0, 0); 00309 00310 int a = 0, b = 0; 00311 bool first = true; 00312 for (int i = 0; i < item_list.size(); ++i) { 00313 const QDockAreaLayoutItem &item = item_list.at(i); 00314 if (item.skip()) 00315 continue; 00316 00317 QSize min_size = item.minimumSize(); 00318 #ifndef QT_NO_TABBAR 00319 if (tabbed) { 00320 a = qMax(a, pick(o, min_size)); 00321 } else 00322 #endif 00323 { 00324 if (!first) 00325 a += sep; 00326 a += pick(o, min_size); 00327 } 00328 b = qMax(b, perp(o, min_size)); 00329 00330 first = false; 00331 } 00332 00333 QSize result; 00334 rpick(o, result) = a; 00335 rperp(o, result) = b; 00336 00337 #ifndef QT_NO_TABBAR 00338 if (tabbed) { 00339 QSize tbm = tabBarMinimumSize(); 00340 switch (tabBarShape) { 00341 case QTabBar::RoundedNorth: 00342 case QTabBar::RoundedSouth: 00343 result.rheight() += tbm.height(); 00344 result.rwidth() = qMax(tbm.width(), result.width()); 00345 break; 00346 case QTabBar::RoundedEast: 00347 case QTabBar::RoundedWest: 00348 result.rheight() = qMax(tbm.height(), result.height()); 00349 result.rwidth() += tbm.width(); 00350 break; 00351 default: 00352 break; 00353 } 00354 } 00355 #endif // QT_NO_TABBAR 00356 00357 return result; 00358 }
Here is the call graph for this function:
QSize QDockAreaLayoutInfo::maximumSize | ( | ) | const |
Definition at line 360 of file qdockwidgetlayout.cpp.
References a, QList< T >::at(), b, QSize::height(), i, isEmpty(), item(), item_list, QDockAreaLayoutItem::maximumSize(), o, perp(), pick(), qMin(), QWIDGETSIZE_MAX, QSize::rheight(), QTabBar::RoundedEast, QTabBar::RoundedNorth, QTabBar::RoundedSouth, QTabBar::RoundedWest, rperp(), rpick(), QSize::rwidth(), sep, QList< T >::size(), QDockAreaLayoutItem::skip(), tabBarShape, tabBarSizeHint(), tabbed, and QSize::width().
Referenced by QDockWidgetLayout::getGrid(), and QDockAreaLayoutItem::maximumSize().
00361 { 00362 if (isEmpty()) 00363 return QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); 00364 00365 int a = 0, b = QWIDGETSIZE_MAX; 00366 #ifndef QT_NO_TABBAR 00367 if (tabbed) 00368 a = QWIDGETSIZE_MAX; 00369 #endif 00370 00371 bool first = true; 00372 for (int i = 0; i < item_list.size(); ++i) { 00373 const QDockAreaLayoutItem &item = item_list.at(i); 00374 if (item.skip()) 00375 continue; 00376 00377 00378 QSize max_size = item.maximumSize(); 00379 00380 #ifndef QT_NO_TABBAR 00381 if (tabbed) { 00382 a = qMin(a, pick(o, max_size)); 00383 } else 00384 #endif 00385 { 00386 if (!first) 00387 a += sep; 00388 a += pick(o, max_size); 00389 } 00390 b = qMin(b, perp(o, max_size)); 00391 00392 a = qMin(a, int(QWIDGETSIZE_MAX)); 00393 b = qMin(b, int(QWIDGETSIZE_MAX)); 00394 00395 first = false; 00396 } 00397 00398 QSize result; 00399 rpick(o, result) = a; 00400 rperp(o, result) = b; 00401 00402 #ifndef QT_NO_TABBAR 00403 if (tabbed) { 00404 QSize tbh = tabBarSizeHint(); 00405 switch (tabBarShape) { 00406 case QTabBar::RoundedNorth: 00407 case QTabBar::RoundedSouth: 00408 result.rheight() += tbh.height(); 00409 break; 00410 case QTabBar::RoundedEast: 00411 case QTabBar::RoundedWest: 00412 result.rwidth() += tbh.width(); 00413 break; 00414 default: 00415 break; 00416 } 00417 } 00418 #endif // QT_NO_TABBAR 00419 00420 return result; 00421 }
Here is the call graph for this function:
QSize QDockAreaLayoutInfo::sizeHint | ( | ) | const |
Definition at line 423 of file qdockwidgetlayout.cpp.
References a, QList< T >::at(), b, QDockAreaLayoutItem::gap, QSize::height(), i, isEmpty(), item(), item_list, o, perp(), pick(), qMax(), QSize::rheight(), QTabBar::RoundedEast, QTabBar::RoundedNorth, QTabBar::RoundedSouth, QTabBar::RoundedWest, rperp(), rpick(), QSize::rwidth(), sep, QDockAreaLayoutItem::size, QList< T >::size(), QDockAreaLayoutItem::sizeHint(), QDockAreaLayoutItem::skip(), tabBarShape, tabBarSizeHint(), tabbed, and QSize::width().
Referenced by QDockAreaLayoutItem::sizeHint(), and QDockWidgetLayout::sizeHint().
00424 { 00425 if (isEmpty()) 00426 return QSize(0, 0); 00427 00428 int a = 0, b = 0; 00429 bool prev_gap = false; 00430 bool first = true; 00431 for (int i = 0; i < item_list.size(); ++i) { 00432 const QDockAreaLayoutItem &item = item_list.at(i); 00433 if (item.skip()) 00434 continue; 00435 00436 bool gap = item.gap; 00437 00438 QSize size_hint = item.sizeHint(); 00439 00440 #ifndef QT_NO_TABBAR 00441 if (tabbed) { 00442 a = qMax(a, gap ? item.size : pick(o, size_hint)); 00443 } else 00444 #endif 00445 { 00446 if (!first && !gap && !prev_gap) 00447 a += sep; 00448 a += gap ? item.size : pick(o, size_hint); 00449 } 00450 b = qMax(b, perp(o, size_hint)); 00451 00452 prev_gap = gap; 00453 first = false; 00454 } 00455 00456 QSize result; 00457 rpick(o, result) = a; 00458 rperp(o, result) = b; 00459 00460 #ifndef QT_NO_TABBAR 00461 if (tabbed) { 00462 QSize tbh = tabBarSizeHint(); 00463 switch (tabBarShape) { 00464 case QTabBar::RoundedNorth: 00465 case QTabBar::RoundedSouth: 00466 result.rheight() += tbh.height(); 00467 result.rwidth() = qMax(tbh.width(), result.width()); 00468 break; 00469 case QTabBar::RoundedEast: 00470 case QTabBar::RoundedWest: 00471 result.rheight() = qMax(tbh.height(), result.height()); 00472 result.rwidth() += tbh.width(); 00473 break; 00474 default: 00475 break; 00476 } 00477 } 00478 #endif // QT_NO_TABBAR 00479 00480 return result; 00481 }
Here is the call graph for this function:
QSize QDockAreaLayoutInfo::size | ( | ) | const |
Definition at line 285 of file qdockwidgetlayout.cpp.
References isEmpty(), rect, and QRect::size().
Referenced by fitItems(), and QDockWidgetLayout::getGrid().
Here is the call graph for this function:
bool QDockAreaLayoutInfo::insertGap | ( | QList< int > | path, | |
QWidgetItem * | dockWidgetItem | |||
) |
Definition at line 1071 of file qdockwidgetlayout.cpp.
References QList< T >::append(), QList< T >::at(), QList< T >::count(), QDockAreaLayoutItem::gap, QWidgetItem::geometry(), Qt::Horizontal, i, index, QList< T >::insert(), insertGap(), isEmpty(), item(), item_list, mainWindow, QDockAreaLayoutItem::minimumSize(), next(), o, path, pick(), QDockAreaLayoutItem::pos, prev(), QDockAreaLayoutInfo(), rect, sep, QDockAreaLayoutItem::size, QRect::size(), QDockAreaLayoutItem::skip(), QDockAreaLayoutItem::subinfo, tabBarShape, tabbed, QRect::topLeft(), Qt::Vertical, and QDockAreaLayoutItem::widgetItem.
Referenced by insertGap(), and QDockWidgetLayout::insertGap().
01072 { 01073 Q_ASSERT(!path.isEmpty()); 01074 01075 bool insert_tabbed = false; 01076 int index = path.takeFirst(); 01077 if (index < 0) { 01078 insert_tabbed = true; 01079 index = -index - 1; 01080 } 01081 01082 // dump(qDebug() << "insertGap() before:" << index << tabIndex, *this, QString()); 01083 01084 if (!path.isEmpty()) { 01085 QDockAreaLayoutItem &item = item_list[index]; 01086 01087 if (item.subinfo == 0 01088 #ifndef QT_NO_TABBAR 01089 || item.subinfo->tabbed && !insert_tabbed 01090 #endif 01091 ) { 01092 // this is not yet a nested layout - make it 01093 01094 QDockAreaLayoutInfo *subinfo = item.subinfo; 01095 QWidgetItem *widgetItem = item.widgetItem; 01096 QRect r = subinfo == 0 ? widgetItem->geometry() : subinfo->rect; 01097 01098 Qt::Orientation opposite = o == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal; 01099 #ifdef QT_NO_TABBAR 01100 const int tabBarShape = 0; 01101 #endif 01102 QDockAreaLayoutInfo *new_info 01103 = new QDockAreaLayoutInfo(sep, opposite, tabBarShape, mainWindow); 01104 01105 item.subinfo = new_info; 01106 item.widgetItem = 0; 01107 01108 QDockAreaLayoutItem new_item 01109 = widgetItem == 0 01110 ? QDockAreaLayoutItem(subinfo) 01111 : QDockAreaLayoutItem(widgetItem); 01112 new_item.size = pick(opposite, r.size()); 01113 new_item.pos = pick(opposite, r.topLeft()); 01114 new_info->item_list.append(new_item); 01115 #ifndef QT_NO_TABBAR 01116 if (insert_tabbed) { 01117 new_info->tabbed = true; 01118 } 01119 #endif 01120 } 01121 01122 bool result = item.subinfo->insertGap(path, dockWidgetItem); 01123 return result; 01124 } 01125 01126 // create the gap item 01127 QDockAreaLayoutItem gap_item; 01128 gap_item.gap = true; 01129 gap_item.widgetItem = dockWidgetItem; // so minimumSize(), maximumSize() and 01130 // sizeHint() will work 01131 #ifndef QT_NO_TABBAR 01132 if (!tabbed) 01133 #endif 01134 { 01135 int prev = this->prev(index); 01136 int next = this->next(index - 1); 01137 // find out how much space we have in the layout 01138 int space = 0; 01139 if (isEmpty()) { 01140 space = pick(o, rect.size()); 01141 } else { 01142 for (int i = 0; i < item_list.count(); ++i) { 01143 const QDockAreaLayoutItem &item = item_list.at(i); 01144 if (item.skip()) 01145 continue; 01146 Q_ASSERT(!item.gap); 01147 space += item.size - pick(o, item.minimumSize()); 01148 } 01149 } 01150 01151 // find the actual size of the gap 01152 int gap_size = 0; 01153 int sep_size = 0; 01154 if (isEmpty()) { 01155 gap_size = space; 01156 sep_size = 0; 01157 } else { 01158 gap_size = pick(o, dockWidgetItem->geometry().size()); 01159 if (prev != -1 && !item_list.at(prev).gap) 01160 sep_size += sep; 01161 if (next != -1 && !item_list.at(next).gap) 01162 sep_size += sep; 01163 } 01164 if (gap_size + sep_size > space) 01165 gap_size = pick(o, gap_item.minimumSize()); 01166 gap_item.size = gap_size + sep_size; 01167 } 01168 01169 // finally, insert the gap 01170 item_list.insert(index, gap_item); 01171 01172 // dump(qDebug() << "insertGap() after:" << index << tabIndex, *this, QString()); 01173 01174 return true; 01175 }
Here is the call graph for this function:
QWidgetItem * QDockAreaLayoutInfo::convertToGap | ( | QList< int > | path | ) |
Definition at line 999 of file qdockwidgetlayout.cpp.
References QList< T >::at(), convertToGap(), QDockAreaLayoutItem::gap, index, item(), item_list, next(), path, QDockAreaLayoutItem::pos, prev(), sep, QDockAreaLayoutItem::size, QDockAreaLayoutItem::subinfo, tabbed, and QDockAreaLayoutItem::widgetItem.
Referenced by QDockWidgetLayout::convertToGap(), and convertToGap().
01000 { 01001 Q_ASSERT(!path.isEmpty()); 01002 01003 if (path.count() > 1) { 01004 int index = path.takeFirst(); 01005 const QDockAreaLayoutItem &item = item_list.at(index); 01006 Q_ASSERT(item.subinfo != 0); 01007 QWidgetItem *result = item.subinfo->convertToGap(path); 01008 return result; 01009 } 01010 01011 int index = path.first(); 01012 QDockAreaLayoutItem &item = item_list[index]; 01013 int prev = this->prev(index); 01014 int next = this->next(index); 01015 01016 Q_ASSERT(!item.gap); 01017 item.gap = true; 01018 01019 #ifndef QT_NO_TABBAR 01020 if (tabbed) { 01021 } else 01022 #endif 01023 { 01024 if (prev != -1 && !item_list.at(prev).gap) { 01025 item.pos -= sep; 01026 item.size += sep; 01027 } 01028 if (next != -1 && !item_list.at(next).gap) 01029 item.size += sep; 01030 } 01031 01032 return item.widgetItem; 01033 }
Here is the call graph for this function:
QRect QDockAreaLayoutInfo::convertToWidget | ( | QList< int > | path, | |
QWidgetItem * | dockWidget | |||
) |
Definition at line 949 of file qdockwidgetlayout.cpp.
References QList< T >::at(), convertToWidget(), QDockAreaLayoutItem::gap, index, item(), item_list, next(), o, path, perp(), QDockAreaLayoutItem::pos, prev(), rect, rperp(), rpick(), s, sep, QDockAreaLayoutItem::size, QRect::size(), QDockAreaLayoutItem::subinfo, tabbed, tabContentRect(), QRect::topLeft(), and QDockAreaLayoutItem::widgetItem.
Referenced by convertToWidget(), and QDockWidgetLayout::convertToWidget().
00950 { 00951 Q_ASSERT(!path.isEmpty()); 00952 00953 int index = path.takeFirst(); 00954 if (index < 0) 00955 index = -index - 1; 00956 00957 if (!path.isEmpty()) { 00958 const QDockAreaLayoutItem &item = item_list.at(index); 00959 Q_ASSERT(item.subinfo != 0); 00960 return item.subinfo->convertToWidget(path, dockWidgetItem); 00961 } 00962 00963 QDockAreaLayoutItem &item = item_list[index]; 00964 00965 Q_ASSERT(item.gap); 00966 item.gap = false; 00967 Q_ASSERT(item.widgetItem == dockWidgetItem); 00968 00969 QRect result; 00970 00971 #ifndef QT_NO_TABBAR 00972 if (tabbed) { 00973 result = tabContentRect(); 00974 } else 00975 #endif 00976 { 00977 int prev = this->prev(index); 00978 int next = this->next(index); 00979 00980 if (prev != -1 && !item_list.at(prev).gap) { 00981 item.pos += sep; 00982 item.size -= sep; 00983 } 00984 if (next != -1 && !item_list.at(next).gap) 00985 item.size -= sep; 00986 00987 QPoint pos; 00988 rpick(o, pos) = item.pos; 00989 rperp(o, pos) = perp(o, rect.topLeft()); 00990 QSize s; 00991 rpick(o, s) = item.size; 00992 rperp(o, s) = perp(o, rect.size()); 00993 result = QRect(pos, s); 00994 } 00995 00996 return result; 00997 }
Here is the call graph for this function:
Definition at line 681 of file qdockwidgetlayout.cpp.
References QList< T >::append(), QList< T >::at(), QDockWidgetLayout::BottomPos, QDockWidgetLayout::CenterPos, dockPos(), gapIndex(), Qt::Horizontal, i, QRect::isNull(), item(), item_list, itemRect(), QDockWidgetLayout::LeftPos, o, pick(), QDockAreaLayoutItem::pos, QList< T >::prepend(), QDockWidgetLayout::RightPos, QDockAreaLayoutItem::size, QList< T >::size(), QDockAreaLayoutItem::skip(), QDockAreaLayoutItem::subinfo, tabbed, tabContentRect(), and QDockWidgetLayout::TopPos.
Referenced by gapIndex().
00682 { 00683 QList<int> result; 00684 QRect item_rect; 00685 int item_index = 0; 00686 00687 #ifndef QT_NO_TABBAR 00688 if (tabbed) { 00689 item_rect = tabContentRect(); 00690 } else 00691 #endif 00692 { 00693 int pos = pick(o, _pos); 00694 00695 int last = -1; 00696 for (int i = 0; i < item_list.size(); ++i) { 00697 const QDockAreaLayoutItem &item = item_list.at(i); 00698 if (item.skip()) 00699 continue; 00700 00701 last = i; 00702 00703 if (item.pos + item.size < pos) 00704 continue; 00705 00706 if (item.subinfo != 0 00707 #ifndef QT_NO_TABBAR 00708 && !item.subinfo->tabbed 00709 #endif 00710 ) { 00711 result = item.subinfo->gapIndex(_pos, nestingEnabled); 00712 result.prepend(i); 00713 return result; 00714 } 00715 00716 item_rect = itemRect(i); 00717 item_index = i; 00718 break; 00719 } 00720 00721 if (item_rect.isNull()) { 00722 result.append(last + 1); 00723 return result; 00724 } 00725 } 00726 00727 Q_ASSERT(!item_rect.isNull()); 00728 00729 QDockWidgetLayout::DockPos dock_pos 00730 = dockPos(item_rect, _pos, o, nestingEnabled); 00731 00732 switch (dock_pos) { 00733 case QDockWidgetLayout::LeftPos: 00734 if (o == Qt::Horizontal) 00735 result << item_index; 00736 else 00737 result << item_index << 0; // this subinfo doesn't exist yet, but insertGap() 00738 // handles this by inserting it 00739 break; 00740 case QDockWidgetLayout::RightPos: 00741 if (o == Qt::Horizontal) 00742 result << item_index + 1; 00743 else 00744 result << item_index << 1; 00745 break; 00746 case QDockWidgetLayout::TopPos: 00747 if (o == Qt::Horizontal) 00748 result << item_index << 0; 00749 else 00750 result << item_index; 00751 break; 00752 case QDockWidgetLayout::BottomPos: 00753 if (o == Qt::Horizontal) 00754 result << item_index << 1; 00755 else 00756 result << item_index + 1; 00757 break; 00758 case QDockWidgetLayout::CenterPos: 00759 result << (-item_index - 1) << 0; // negative item_index means "on top of" 00760 // -item_index - 1, insertGap() 00761 // will insert a tabbed subinfo 00762 break; 00763 default: 00764 break; 00765 } 00766 00767 return result; 00768 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::remove | ( | QList< int > | path | ) |
Definition at line 933 of file qdockwidgetlayout.cpp.
References index, item(), item_list, path, remove(), QList< T >::removeAt(), QDockAreaLayoutItem::subinfo, and unnest().
Referenced by remove(), and QDockWidgetLayout::remove().
00934 { 00935 Q_ASSERT(!path.isEmpty()); 00936 00937 if (path.count() > 1) { 00938 int index = path.takeFirst(); 00939 QDockAreaLayoutItem &item = item_list[index]; 00940 Q_ASSERT(item.subinfo != 0); 00941 item.subinfo->remove(path); 00942 unnest(index); 00943 } else { 00944 int index = path.first(); 00945 item_list.removeAt(index); 00946 } 00947 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::unnest | ( | int | index | ) |
Definition at line 908 of file qdockwidgetlayout.cpp.
References QList< T >::clear(), QList< T >::count(), QList< T >::first(), item(), item_list, QDockAreaLayoutItem::subinfo, and QDockAreaLayoutItem::widgetItem.
Referenced by remove(), and takeAt().
00909 { 00910 QDockAreaLayoutItem &item = item_list[index]; 00911 if (item.subinfo == 0) 00912 return; 00913 if (item.subinfo->item_list.count() > 1) 00914 return; 00915 Q_ASSERT(item.subinfo->item_list.count() != 0); 00916 00917 if (item.subinfo->item_list.count() == 1) { 00918 QDockAreaLayoutItem &child = item.subinfo->item_list.first(); 00919 if (child.widgetItem != 0) { 00920 item.widgetItem = child.widgetItem; 00921 delete item.subinfo; 00922 item.subinfo = 0; 00923 } else if (child.subinfo != 0) { 00924 QDockAreaLayoutInfo *tmp = item.subinfo; 00925 item.subinfo = child.subinfo; 00926 child.subinfo = 0; 00927 tmp->item_list.clear(); 00928 delete tmp; 00929 } 00930 } 00931 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::split | ( | int | index, | |
Qt::Orientation | orientation, | |||
QWidgetItem * | dockWidgetItem | |||
) |
Definition at line 1528 of file qdockwidgetlayout.cpp.
References QList< T >::append(), QList< T >::at(), QList< T >::insert(), item_list, mainWindow, o, QDockAreaLayoutInfo(), sep, tabBarShape, and QDockAreaLayoutItem::widgetItem.
Referenced by QDockWidgetLayout::splitDockWidget().
01530 { 01531 if (orientation == o) { 01532 item_list.insert(index + 1, QDockAreaLayoutItem(dockWidgetItem)); 01533 } else { 01534 #ifdef QT_NO_TABBAR 01535 const int tabBarShape = 0; 01536 #endif 01537 QDockAreaLayoutInfo *new_info 01538 = new QDockAreaLayoutInfo(sep, orientation, tabBarShape, mainWindow); 01539 item_list[index].subinfo = new_info; 01540 new_info->item_list.append(item_list.at(index).widgetItem); 01541 item_list[index].widgetItem = 0; 01542 new_info->item_list.append(dockWidgetItem); 01543 } 01544 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::tab | ( | int | index, | |
QWidgetItem * | dockWidgetItem | |||
) |
Definition at line 1511 of file qdockwidgetlayout.cpp.
References QList< T >::append(), QList< T >::at(), item_list, mainWindow, o, QDockAreaLayoutInfo(), sep, tabBarShape, tabbed, and QDockAreaLayoutItem::widgetItem.
Referenced by QDockWidgetLayout::tabifyDockWidget().
01512 { 01513 #ifndef QT_NO_TABBAR 01514 if (tabbed) { 01515 item_list.append(QDockAreaLayoutItem(dockWidgetItem)); 01516 } else { 01517 QDockAreaLayoutInfo *new_info 01518 = new QDockAreaLayoutInfo(sep, o, tabBarShape, mainWindow); 01519 item_list[index].subinfo = new_info; 01520 new_info->item_list.append(item_list.at(index).widgetItem); 01521 item_list[index].widgetItem = 0; 01522 new_info->item_list.append(dockWidgetItem); 01523 new_info->tabbed = true; 01524 } 01525 #endif // QT_NO_TABBAR 01526 }
Here is the call graph for this function:
QDockAreaLayoutItem & QDockAreaLayoutInfo::item | ( | QList< int > | path | ) |
Definition at line 1546 of file qdockwidgetlayout.cpp.
References item(), item_list, path, and QDockAreaLayoutItem::subinfo.
Referenced by apply(), convertToGap(), convertToWidget(), deleteAllLayoutItems(), findSeparator(), fitItems(), gapIndex(), indexOf(), info(), insertGap(), item(), QDockWidgetLayout::item(), itemAt(), itemRect(), maximumSize(), minimumSize(), paintSeparators(), remove(), restoreState(), saveState(), separatorMove(), separatorRect(), separatorRegion(), sizeHint(), takeAt(), unnest(), updateTabBar(), and usedTabBars().
01547 { 01548 Q_ASSERT(!path.isEmpty()); 01549 if (path.count() > 1) { 01550 QDockAreaLayoutItem &item = item_list[path.takeFirst()]; 01551 Q_ASSERT(item.subinfo != 0); 01552 return item.subinfo->item(path); 01553 } 01554 return item_list[path.first()]; 01555 }
Here is the call graph for this function:
QDockAreaLayoutInfo * QDockAreaLayoutInfo::info | ( | QList< int > | path | ) |
Definition at line 1201 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QList< T >::count(), index, info(), item_list, path, and QDockAreaLayoutItem::subinfo.
Referenced by QDockWidgetLayout::info(), info(), restoreState(), and QDockWidgetLayout::separatorMove().
01202 { 01203 int index = path.takeFirst(); 01204 if (index < 0) 01205 index = -index - 1; 01206 if (index >= item_list.count()) 01207 return this; 01208 if (path.isEmpty() || item_list.at(index).subinfo == 0) 01209 return this; 01210 return item_list.at(index).subinfo->info(path); 01211 }
Here is the call graph for this function:
QDockAreaLayoutInfo * QDockAreaLayoutInfo::info | ( | QWidget * | widget | ) |
Definition at line 1177 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QList< T >::count(), i, info(), item(), item_list, QDockAreaLayoutItem::skip(), QDockAreaLayoutItem::subinfo, tabBar, tabbed, QWidgetItem::widget(), and QDockAreaLayoutItem::widgetItem.
01178 { 01179 for (int i = 0; i < item_list.count(); ++i) { 01180 const QDockAreaLayoutItem &item = item_list.at(i); 01181 if (item.skip()) 01182 continue; 01183 01184 #ifndef QT_NO_TABBAR 01185 if (tabbed && widget == tabBar) 01186 return this; 01187 #endif 01188 01189 if (item.widgetItem != 0 && item.widgetItem->widget() == widget) 01190 return this; 01191 01192 if (item.subinfo != 0) { 01193 if (QDockAreaLayoutInfo *result = item.subinfo->info(widget)) 01194 return result; 01195 } 01196 } 01197 01198 return 0; 01199 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::saveState | ( | QDataStream & | stream | ) | const |
Definition at line 1605 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QList< T >::count(), currentTabId(), flags, i, index, item(), item_list, QDockAreaLayoutItem::maximumSize(), QDockAreaLayoutItem::minimumSize(), name, o, pick(), QDockAreaLayoutItem::pos, qWarning(), saveState(), SequenceMarker, QDockAreaLayoutItem::size, StateFlagFloating, StateFlagVisible, QTest::stream, QDockAreaLayoutItem::subinfo, tabbed, tabId(), TabMarker, w, QWidgetItem::widget(), QDockAreaLayoutItem::widgetItem, and WidgetMarker.
Referenced by QDockWidgetLayout::saveState(), and saveState().
01606 { 01607 #ifndef QT_NO_TABBAR 01608 if (tabbed) { 01609 stream << (uchar) TabMarker; 01610 01611 // write the index in item_list of the widget that's currently on top. 01612 quintptr id = currentTabId(); 01613 int index = -1; 01614 for (int i = 0; i < item_list.count(); ++i) { 01615 if (tabId(item_list.at(i)) == id) { 01616 index = i; 01617 break; 01618 } 01619 } 01620 stream << index; 01621 } else 01622 #endif // QT_NO_TABBAR 01623 { 01624 stream << (uchar) SequenceMarker; 01625 } 01626 01627 stream << (uchar) o << item_list.count(); 01628 01629 for (int i = 0; i < item_list.count(); ++i) { 01630 const QDockAreaLayoutItem &item = item_list.at(i); 01631 if (item.widgetItem != 0) { 01632 stream << (uchar) WidgetMarker; 01633 QWidget *w = item.widgetItem->widget(); 01634 QString name = w->objectName(); 01635 if (name.isEmpty()) { 01636 qWarning("QMainWindow::saveState(): 'objectName' not set for QDockWidget %p '%s;", 01637 w, qPrintable(w->windowTitle())); 01638 } 01639 stream << name; 01640 01641 uchar flags = 0; 01642 if (!w->isHidden()) 01643 flags |= StateFlagVisible; 01644 if (w->isWindow()) 01645 flags |= StateFlagFloating; 01646 stream << flags; 01647 01648 if (w->isWindow()) { 01649 stream << w->x() << w->y() << w->width() << w->height(); 01650 } else { 01651 stream << item.pos << item.size << pick(o, item.minimumSize()) 01652 << pick(o, item.maximumSize()); 01653 } 01654 } else if (item.subinfo != 0) { 01655 stream << (uchar) SequenceMarker << item.pos << item.size << pick(o, item.minimumSize()) << pick(o, item.maximumSize()); 01656 item.subinfo->saveState(stream); 01657 } 01658 } 01659 }
Here is the call graph for this function:
bool QDockAreaLayoutInfo::restoreState | ( | QDataStream & | stream, | |
const QList< QDockWidget * > & | widgets | |||
) |
Definition at line 1661 of file qdockwidgetlayout.cpp.
References QList< T >::append(), QList< T >::at(), QList< T >::count(), flags, h, i, index, info(), item(), item_list, j, mainWindow, marker, name, o, QObject::objectName(), QDockAreaLayoutItem::pos, QDockAreaLayoutInfo(), qWarning(), restoreState(), sep, SequenceMarker, setCurrentTabId(), QDockAreaLayoutItem::size, StateFlagFloating, StateFlagVisible, QTest::stream, tabBarShape, tabbed, tabId(), TabMarker, updateTabBar(), w, WidgetMarker, x, and y.
Referenced by restoreState().
01662 { 01663 uchar marker; 01664 stream >> marker; 01665 if (marker != TabMarker && marker != SequenceMarker) 01666 return false; 01667 01668 #ifndef QT_NO_TABBAR 01669 tabbed = marker == TabMarker; 01670 01671 int index = -1; 01672 if (tabbed) 01673 stream >> index; 01674 #endif 01675 01676 uchar orientation; 01677 stream >> orientation; 01678 o = static_cast<Qt::Orientation>(orientation); 01679 01680 int cnt; 01681 stream >> cnt; 01682 01683 for (int i = 0; i < cnt; ++i) { 01684 uchar nextMarker; 01685 stream >> nextMarker; 01686 if (nextMarker == WidgetMarker) { 01687 QString name; 01688 uchar flags; 01689 stream >> name >> flags; 01690 if (name.isEmpty()) { 01691 qWarning("QMainWindow::restoreState: Cannot restore " 01692 "a QDockWidget with an empty 'objectName'"); 01693 int dummy; 01694 stream >> dummy >> dummy >> dummy >> dummy; 01695 continue; 01696 } 01697 01698 QDockWidget *widget = 0; 01699 for (int j = 0; j < widgets.count(); ++j) { 01700 if (widgets.at(j)->objectName() == name) { 01701 widget = widgets.at(j); 01702 break; 01703 } 01704 } 01705 if (widget == 0) { 01706 qWarning("QMainWindow::restoreState(): cannot find a QDockWidget with " 01707 "matching 'objectName' (looking for \"%s\").", 01708 qPrintable(name)); 01709 int dummy; 01710 stream >> dummy >> dummy >> dummy >> dummy; 01711 continue; 01712 } 01713 01714 QDockAreaLayoutItem item(new QWidgetItem(widget)); 01715 if (flags & StateFlagFloating) { 01716 widget->hide(); 01717 widget->setFloating(true); 01718 int x, y, w, h; 01719 stream >> x >> y >> w >> h; 01720 widget->move(x, y); 01721 widget->resize(w, h); 01722 widget->setVisible(flags & StateFlagVisible); 01723 } else { 01724 int dummy; 01725 stream >> item.pos >> item.size >> dummy >> dummy; 01726 widget->setFloating(false); 01727 widget->setVisible(flags & StateFlagVisible); 01728 } 01729 01730 item_list.append(item); 01731 } else if (nextMarker == SequenceMarker) { 01732 int dummy; 01733 #ifdef QT_NO_TABBAR 01734 const int tabBarShape = 0; 01735 #endif 01736 QDockAreaLayoutInfo *info = new QDockAreaLayoutInfo(sep, o, 01737 tabBarShape, mainWindow); 01738 QDockAreaLayoutItem item(info); 01739 stream >> item.pos >> item.size >> dummy >> dummy; 01740 if (!info->restoreState(stream, widgets)) 01741 return false; 01742 01743 item_list.append(item); 01744 } else { 01745 return false; 01746 } 01747 } 01748 01749 #ifndef QT_NO_TABBAR 01750 if (tabbed && index >= 0 && index < item_list.count()) { 01751 updateTabBar(); 01752 setCurrentTabId(tabId(item_list.at(index))); 01753 } 01754 #endif 01755 01756 return true; 01757 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::fitItems | ( | ) |
Definition at line 492 of file qdockwidgetlayout.cpp.
References checkLayoutInfo(), d, QLayoutStruct::empty, QLayoutStruct::expansive, QDockAreaLayoutItem::expansive(), fitItems(), QDockAreaLayoutItem::gap, i, QLayoutStruct::init(), item(), item_list, itemRect(), j, QDockAreaLayoutItem::keep_size, QLayoutStruct::maximumSize, QDockAreaLayoutItem::maximumSize(), QLayoutStruct::minimumSize, minimumSize(), QDockAreaLayoutItem::minimumSize(), o, pick(), QDockAreaLayoutItem::pos, QLayoutStruct::pos, qGeomCalc(), rect, sep, size(), QRect::size(), QDockAreaLayoutItem::size, QList< T >::size(), QLayoutStruct::size, QDockAreaLayoutItem::sizeHint(), QLayoutStruct::sizeHint, QDockAreaLayoutItem::skip(), QLayoutStruct::stretch, QDockAreaLayoutItem::subinfo, tabbed, and QRect::topLeft().
Referenced by fitItems(), separatorMove(), and QDockWidgetLayout::setGrid().
00493 { 00494 #ifndef QT_NO_TABBAR 00495 if (tabbed) { 00496 return; 00497 } 00498 #endif 00499 00500 QVector<QLayoutStruct> layout_struct_list(item_list.size()*2); 00501 int j = 0; 00502 00503 int size = pick(o, rect.size()); 00504 int min_size = pick(o, minimumSize()); 00505 00506 bool prev_gap = false; 00507 bool first = true; 00508 for (int i = 0; i < item_list.size(); ++i) { 00509 QDockAreaLayoutItem &item = item_list[i]; 00510 if (item.skip()) 00511 continue; 00512 00513 bool gap = item.gap; 00514 if (!first && !gap && !prev_gap) { 00515 QLayoutStruct &ls = layout_struct_list[j++]; 00516 ls.empty = false; 00517 ls.init(); 00518 ls.minimumSize = sep; 00519 ls.maximumSize = sep; 00520 ls.sizeHint = sep; 00521 } 00522 00523 if (item.keep_size) { 00524 int d = item.size - pick(o, item.minimumSize()); 00525 if (min_size + d <= size) 00526 min_size -= d; 00527 else 00528 item.keep_size = false; // sorry, not enough space 00529 } 00530 00531 QLayoutStruct &ls = layout_struct_list[j++]; 00532 ls.init(); 00533 ls.empty = false; 00534 if (gap || item.keep_size) { 00535 ls.minimumSize = ls.maximumSize = ls.sizeHint = item.size; 00536 ls.expansive = false; 00537 ls.stretch = 0; 00538 } else { 00539 ls.minimumSize = pick(o, item.minimumSize()); 00540 ls.maximumSize = pick(o, item.maximumSize()); 00541 ls.expansive = item.expansive(o); 00542 if (ls.expansive) { 00543 ls.sizeHint = ls.minimumSize; 00544 ls.stretch = item.size == -1 ? pick(o, item.sizeHint()) : item.size; 00545 } else { 00546 ls.sizeHint = item.size == -1 ? pick(o, item.sizeHint()) : item.size; 00547 } 00548 } 00549 00550 item.keep_size = false; 00551 prev_gap = gap; 00552 first = false; 00553 } 00554 layout_struct_list.resize(j); 00555 00556 qGeomCalc(layout_struct_list, 0, j, pick(o, rect.topLeft()), size, 0); 00557 00558 j = 0; 00559 prev_gap = false; 00560 first = true; 00561 for (int i = 0; i < item_list.size(); ++i) { 00562 QDockAreaLayoutItem &item = item_list[i]; 00563 if (item.skip()) 00564 continue; 00565 00566 bool gap = item.gap; 00567 if (!first && !gap && !prev_gap) 00568 ++j; 00569 00570 const QLayoutStruct &ls = layout_struct_list.at(j++); 00571 item.size = ls.size; 00572 item.pos = ls.pos; 00573 00574 if (item.subinfo != 0) { 00575 item.subinfo->rect = itemRect(i); 00576 item.subinfo->fitItems(); 00577 } 00578 00579 prev_gap = gap; 00580 first = false; 00581 } 00582 00583 checkLayoutInfo(*this); 00584 }
Here is the call graph for this function:
bool QDockAreaLayoutInfo::expansive | ( | Qt::Orientation | o | ) | const |
Definition at line 483 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QDockAreaLayoutItem::expansive(), i, item_list, and QList< T >::size().
Referenced by QDockAreaLayoutItem::expansive().
00484 { 00485 for (int i = 0; i < item_list.size(); ++i) { 00486 if (item_list.at(i).expansive(o)) 00487 return true; 00488 } 00489 return false; 00490 }
Here is the call graph for this function:
int QDockAreaLayoutInfo::changeSize | ( | int | index, | |
int | size, | |||
bool | below | |||
) |
QRect QDockAreaLayoutInfo::itemRect | ( | int | index | ) | const |
Definition at line 1213 of file qdockwidgetlayout.cpp.
References QList< T >::at(), currentTabId(), item(), item_list, o, perp(), QDockAreaLayoutItem::pos, rect, rperp(), rpick(), s, QDockAreaLayoutItem::size, QRect::size(), QDockAreaLayoutItem::skip(), tabbed, tabContentRect(), tabId(), and QRect::topLeft().
Referenced by apply(), fitItems(), gapIndex(), itemRect(), QDockWidgetLayout::itemRect(), and separatorMove().
01214 { 01215 const QDockAreaLayoutItem &item = item_list.at(index); 01216 01217 if (item.skip()) 01218 return QRect(); 01219 01220 QRect result; 01221 01222 #ifndef QT_NO_TABBAR 01223 if (tabbed) { 01224 if (tabId(item) == currentTabId()) 01225 result = tabContentRect(); 01226 } else 01227 #endif 01228 { 01229 QPoint pos; 01230 rpick(o, pos) = item.pos; 01231 rperp(o, pos) = perp(o, rect.topLeft()); 01232 QSize s; 01233 rpick(o, s) = item.size; 01234 rperp(o, s) = perp(o, rect.size()); 01235 result = QRect(pos, s); 01236 } 01237 01238 return result; 01239 }
Here is the call graph for this function:
Definition at line 1241 of file qdockwidgetlayout.cpp.
References QList< T >::at(), item(), item_list, itemRect(), path, and QDockAreaLayoutItem::subinfo.
01242 { 01243 Q_ASSERT(!path.isEmpty()); 01244 01245 if (path.count() > 1) { 01246 const QDockAreaLayoutItem &item = item_list.at(path.takeFirst()); 01247 Q_ASSERT(item.subinfo != 0); 01248 return item.subinfo->itemRect(path); 01249 } 01250 01251 return itemRect(path.first()); 01252 }
Here is the call graph for this function:
QRect QDockAreaLayoutInfo::separatorRect | ( | int | index | ) | const |
Definition at line 1254 of file qdockwidgetlayout.cpp.
References QList< T >::at(), item(), item_list, o, QDockAreaLayoutItem::pos, rect, rpick(), s, sep, QRect::size(), QDockAreaLayoutItem::size, QDockAreaLayoutItem::skip(), tabbed, and QRect::topLeft().
Referenced by paintSeparators(), separatorRect(), QDockWidgetLayout::separatorRect(), and separatorRegion().
01255 { 01256 #ifndef QT_NO_TABBAR 01257 if (tabbed) 01258 return QRect(); 01259 #endif 01260 01261 const QDockAreaLayoutItem &item = item_list.at(index); 01262 if (item.skip()) 01263 return QRect(); 01264 01265 QPoint pos = rect.topLeft(); 01266 rpick(o, pos) = item.pos + item.size; 01267 QSize s = rect.size(); 01268 rpick(o, s) = sep; 01269 01270 return QRect(pos, s); 01271 }
Here is the call graph for this function:
Definition at line 1273 of file qdockwidgetlayout.cpp.
References QList< T >::at(), item(), item_list, path, separatorRect(), and QDockAreaLayoutItem::subinfo.
01274 { 01275 Q_ASSERT(!path.isEmpty()); 01276 01277 if (path.count() > 1) { 01278 const QDockAreaLayoutItem &item = item_list.at(path.takeFirst()); 01279 Q_ASSERT(item.subinfo != 0); 01280 return item.subinfo->separatorRect(path); 01281 } 01282 return separatorRect(path.first()); 01283 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::clear | ( | ) |
Definition at line 290 of file qdockwidgetlayout.cpp.
References QList< T >::clear(), item_list, rect, tabBar, and tabbed.
00291 { 00292 item_list.clear(); 00293 rect = QRect(0, 0, -1, -1); 00294 #ifndef QT_NO_TABBAR 00295 tabbed = false; 00296 tabBar = 0; 00297 #endif 00298 }
Here is the call graph for this function:
bool QDockAreaLayoutInfo::isEmpty | ( | ) | const |
Definition at line 300 of file qdockwidgetlayout.cpp.
References next().
Referenced by QDockWidgetLayout::addDockWidget(), QDockWidgetLayout::findSeparator(), QDockWidgetLayout::gapIndex(), QDockWidgetLayout::getGrid(), insertGap(), maximumSize(), QDockWidgetLayout::minimumSize(), minimumSize(), paintSeparators(), QDockWidgetLayout::saveState(), separatorRegion(), size(), sizeHint(), and QDockWidgetLayout::sizeHint().
00301 { 00302 return next(-1) == -1; 00303 }
Here is the call graph for this function:
Definition at line 1285 of file qdockwidgetlayout.cpp.
References QList< T >::append(), QList< T >::at(), findSeparator(), QDockAreaLayoutItem::gap, i, QList< T >::isEmpty(), item(), item_list, next(), o, pick(), QDockAreaLayoutItem::pos, QList< T >::prepend(), sep, QDockAreaLayoutItem::size, QList< T >::size(), QDockAreaLayoutItem::skip(), QDockAreaLayoutItem::subinfo, and tabbed.
Referenced by findSeparator().
01286 { 01287 #ifndef QT_NO_TABBAR 01288 if (tabbed) 01289 return QList<int>(); 01290 #endif 01291 01292 int pos = pick(o, _pos); 01293 01294 for (int i = 0; i < item_list.size(); ++i) { 01295 const QDockAreaLayoutItem &item = item_list.at(i); 01296 if (item.skip() || item.gap) 01297 continue; 01298 01299 if (item.pos + item.size > pos) { 01300 if (item.subinfo != 0) { 01301 QList<int> result = item.subinfo->findSeparator(_pos); 01302 if (!result.isEmpty()) { 01303 result.prepend(i); 01304 return result; 01305 } else { 01306 return QList<int>(); 01307 } 01308 } 01309 } 01310 01311 int next = this->next(i); 01312 if (next == -1 || item_list.at(next).gap) 01313 continue; 01314 01315 if (pos > item.pos + item.size && item.pos + item.size + sep > pos) { 01316 QList<int> result; 01317 result.append(i); 01318 return result; 01319 } 01320 } 01321 01322 return QList<int>(); 01323 }
Here is the call graph for this function:
int QDockAreaLayoutInfo::next | ( | int | idx | ) | const |
Definition at line 1493 of file qdockwidgetlayout.cpp.
References QList< T >::at(), i, item_list, QList< T >::size(), and QDockAreaLayoutItem::skip().
Referenced by convertToGap(), convertToWidget(), findSeparator(), QDockWidgetLayout::gapRect(), insertGap(), isEmpty(), paintSeparators(), and separatorRegion().
01494 { 01495 for (int i = index + 1; i < item_list.size(); ++i) { 01496 if (!item_list.at(i).skip()) 01497 return i; 01498 } 01499 return -1; 01500 }
Here is the call graph for this function:
int QDockAreaLayoutInfo::prev | ( | int | idx | ) | const |
Definition at line 1502 of file qdockwidgetlayout.cpp.
References QList< T >::at(), i, item_list, and QDockAreaLayoutItem::skip().
Referenced by convertToGap(), convertToWidget(), QDockWidgetLayout::gapRect(), and insertGap().
01503 { 01504 for (int i = index - 1; i >= 0; --i) { 01505 if (!item_list.at(i).skip()) 01506 return i; 01507 } 01508 return -1; 01509 }
Here is the call graph for this function:
QList< int > QDockAreaLayoutInfo::indexOf | ( | QWidget * | widget, | |
IndexOfFlag | flag = IndexOfFindsVisible | |||
) | const |
Definition at line 1325 of file qdockwidgetlayout.cpp.
References QList< T >::at(), i, indexOf(), IndexOfFindsAll, IndexOfFindsVisible, QList< T >::isEmpty(), item(), item_list, QList< T >::prepend(), QList< T >::size(), QDockAreaLayoutItem::skip(), QDockAreaLayoutItem::subinfo, QWidgetItem::widget(), and QDockAreaLayoutItem::widgetItem.
Referenced by indexOf().
01326 { 01327 for (int i = 0; i < item_list.size(); ++i) { 01328 const QDockAreaLayoutItem &item = item_list.at(i); 01329 01330 if (item.subinfo != 0) { 01331 QList<int> result = item.subinfo->indexOf(widget, flag); 01332 if (!result.isEmpty()) { 01333 result.prepend(i); 01334 return result; 01335 } 01336 continue; 01337 } 01338 01339 if (flag != IndexOfFindsAll) { 01340 if ((flag == IndexOfFindsVisible) == item.skip()) 01341 continue; 01342 } 01343 01344 if (item.widgetItem->widget() == widget) { 01345 QList<int> result; 01346 result << i; 01347 return result; 01348 } 01349 } 01350 01351 return QList<int>(); 01352 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::apply | ( | bool | animate | ) |
Definition at line 1361 of file qdockwidgetlayout.cpp.
References QWidgetAnimator::animate(), apply(), QRect::bottom(), QDockAreaLayoutItem::gap, QWidget::geometry(), QRect::height(), QSize::height(), i, item(), item_list, itemRect(), QRect::left(), mainWindowLayout(), rect, QRect::right(), QTabBar::RoundedEast, QTabBar::RoundedNorth, QTabBar::RoundedSouth, QTabBar::RoundedWest, QList< T >::size(), QDockAreaLayoutItem::skip(), QDockAreaLayoutItem::subinfo, tabBar, tabBarShape, tabBarSizeHint(), tabBarVisible, tabbed, QRect::top(), w, QWidgetItem::widget(), QMainWindowLayout::widgetAnimator, QDockAreaLayoutItem::widgetItem, QRect::width(), and QSize::width().
Referenced by apply(), and QDockWidgetLayout::separatorMove().
01362 { 01363 QWidgetAnimator *widgetAnimator = mainWindowLayout()->widgetAnimator; 01364 01365 #ifndef QT_NO_TABBAR 01366 if (tabbed) { 01367 QRect tab_rect; 01368 QSize tbh = tabBarSizeHint(); 01369 01370 if (tabBarVisible) { 01371 switch (tabBarShape) { 01372 case QTabBar::RoundedNorth: 01373 tab_rect = QRect(rect.left(), rect.top(), rect.width(), tbh.height()); 01374 break; 01375 case QTabBar::RoundedSouth: 01376 tab_rect = QRect(rect.left(), rect.bottom() - tbh.height() + 1, 01377 rect.width(), tbh.height()); 01378 break; 01379 case QTabBar::RoundedEast: 01380 tab_rect = QRect(rect.right() - tbh.width() + 1, rect.top(), 01381 tbh.width(), rect.height()); 01382 break; 01383 case QTabBar::RoundedWest: 01384 tab_rect = QRect(rect.left(), rect.top(), 01385 tbh.width(), rect.height()); 01386 break; 01387 default: 01388 break; 01389 } 01390 } 01391 01392 if (tab_rect != tabBar->geometry()) 01393 widgetAnimator->animate(tabBar, tab_rect, animate); 01394 // dump(qDebug() << "QDockAreaLayoutInfo::apply():" << tabIndex, *this, QString()); 01395 } 01396 #endif // QT_NO_TABBAR 01397 01398 for (int i = 0; i < item_list.size(); ++i) { 01399 QDockAreaLayoutItem &item = item_list[i]; 01400 if (item.gap || item.skip()) 01401 continue; 01402 if (item.subinfo) { 01403 item.subinfo->apply(animate); 01404 } else { 01405 Q_ASSERT(item.widgetItem); 01406 QRect r = itemRect(i); 01407 QWidget *w = item.widgetItem->widget(); 01408 widgetAnimator->animate(w, r, animate); 01409 } 01410 } 01411 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::paintSeparators | ( | QPainter * | p, | |
QWidget * | widget, | |||
const QRegion & | clip, | |||
const QPoint & | mouse | |||
) | const |
Definition at line 1459 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QRegion::contains(), QRect::contains(), QList< T >::count(), QDockAreaLayoutItem::gap, i, isEmpty(), item(), item_list, next(), o, p, paintSep(), paintSeparators(), rect, separatorRect(), QDockAreaLayoutItem::skip(), QDockAreaLayoutItem::subinfo, and tabbed.
Referenced by paintSeparators().
01462 { 01463 if (isEmpty()) 01464 return; 01465 #ifndef QT_NO_TABBAR 01466 if (tabbed) 01467 return; 01468 #endif 01469 01470 for (int i = 0; i < item_list.count(); ++i) { 01471 const QDockAreaLayoutItem &item = item_list.at(i); 01472 01473 if (item.skip()) 01474 continue; 01475 01476 int next = this->next(i); 01477 if (item.gap || next != -1 && item_list.at(next).gap) 01478 continue; 01479 01480 if (item.subinfo) { 01481 if (clip.contains(item.subinfo->rect)) 01482 item.subinfo->paintSeparators(p, widget, clip, mouse); 01483 } 01484 01485 if (next == -1) 01486 break; 01487 QRect r = separatorRect(i); 01488 if (clip.contains(r)) 01489 paintSep(p, widget, r, o, r.contains(mouse)); 01490 } 01491 }
Here is the call graph for this function:
QRegion QDockAreaLayoutInfo::separatorRegion | ( | ) | const |
Definition at line 1429 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QList< T >::count(), i, isEmpty(), item(), item_list, next(), separatorRect(), separatorRegion(), QDockAreaLayoutItem::skip(), QDockAreaLayoutItem::subinfo, and tabbed.
Referenced by separatorRegion().
01430 { 01431 QRegion result; 01432 01433 if (isEmpty()) 01434 return result; 01435 #ifndef QT_NO_TABBAR 01436 if (tabbed) 01437 return result; 01438 #endif 01439 01440 for (int i = 0; i < item_list.count(); ++i) { 01441 const QDockAreaLayoutItem &item = item_list.at(i); 01442 01443 if (item.skip()) 01444 continue; 01445 01446 int next = this->next(i); 01447 01448 if (item.subinfo) 01449 result |= item.subinfo->separatorRegion(); 01450 01451 if (next == -1) 01452 break; 01453 result |= separatorRect(i); 01454 } 01455 01456 return result; 01457 }
Here is the call graph for this function:
int QDockAreaLayoutInfo::separatorMove | ( | int | index, | |
int | delta, | |||
QVector< QLayoutStruct > * | cache | |||
) |
Definition at line 864 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QLayoutStruct::empty, fitItems(), QDockAreaLayoutItem::gap, i, QVector< T >::isEmpty(), item(), item_list, itemRect(), QLayoutStruct::maximumSize, QDockAreaLayoutItem::maximumSize(), QLayoutStruct::minimumSize, QDockAreaLayoutItem::minimumSize(), o, pick(), QDockAreaLayoutItem::pos, QLayoutStruct::pos, rect, QVector< T >::resize(), sep, QDockAreaLayoutItem::size, QList< T >::size(), QLayoutStruct::size, QDockAreaLayoutItem::skip(), QDockAreaLayoutItem::subinfo, and tabbed.
Referenced by QDockWidgetLayout::separatorMove().
00865 { 00866 Q_ASSERT(!tabbed); 00867 00868 if (cache->isEmpty()) { 00869 QVector<QLayoutStruct> &list = *cache; 00870 list.resize(item_list.size()); 00871 for (int i = 0; i < item_list.size(); ++i) { 00872 const QDockAreaLayoutItem &item = item_list.at(i); 00873 QLayoutStruct &ls = list[i]; 00874 Q_ASSERT(!item.gap); 00875 if (item.skip()) { 00876 ls.empty = true; 00877 } else { 00878 ls.empty = false; 00879 ls.pos = item.pos; 00880 ls.size = item.size; 00881 ls.minimumSize = pick(o, item.minimumSize()); 00882 ls.maximumSize = pick(o, item.maximumSize()); 00883 } 00884 } 00885 } 00886 00887 QVector<QLayoutStruct> list = *cache; 00888 00889 delta = ::separatorMove(list, index, delta, sep); 00890 00891 for (int i = 0; i < item_list.size(); ++i) { 00892 QDockAreaLayoutItem &item = item_list[i]; 00893 if (item.skip()) 00894 continue; 00895 QLayoutStruct &ls = list[i]; 00896 item.size = ls.size; 00897 item.pos = ls.pos; 00898 00899 if (item.subinfo != 0) { 00900 item.subinfo->rect = itemRect(i); 00901 item.subinfo->fitItems(); 00902 } 00903 } 00904 00905 return delta; 00906 }
Here is the call graph for this function:
QLayoutItem * QDockAreaLayoutInfo::itemAt | ( | int * | x, | |
int | index | |||
) | const |
Definition at line 1557 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QList< T >::count(), i, item(), item_list, itemAt(), QDockAreaLayoutItem::subinfo, and QDockAreaLayoutItem::widgetItem.
Referenced by itemAt().
01558 { 01559 for (int i = 0; i < item_list.count(); ++i) { 01560 const QDockAreaLayoutItem &item = item_list.at(i); 01561 if (item.subinfo) { 01562 if (QLayoutItem *ret = item.subinfo->itemAt(x, index)) 01563 return ret; 01564 } else if (item.widgetItem) { 01565 if ((*x)++ == index) 01566 return item.widgetItem; 01567 } 01568 } 01569 return 0; 01570 }
Here is the call graph for this function:
QLayoutItem * QDockAreaLayoutInfo::takeAt | ( | int * | x, | |
int | index | |||
) |
Definition at line 1572 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QList< T >::count(), i, item(), item_list, QList< T >::removeAt(), QDockAreaLayoutItem::subinfo, takeAt(), unnest(), and QDockAreaLayoutItem::widgetItem.
Referenced by takeAt().
01573 { 01574 for (int i = 0; i < item_list.count(); ++i) { 01575 const QDockAreaLayoutItem &item = item_list.at(i); 01576 if (item.subinfo) { 01577 if (QLayoutItem *ret = item.subinfo->takeAt(x, index)) { 01578 unnest(i); 01579 return ret; 01580 } 01581 } else if (item.widgetItem) { 01582 if ((*x)++ == index) { 01583 QLayoutItem *ret = item.widgetItem; 01584 item_list.removeAt(i); 01585 return ret; 01586 } 01587 } 01588 } 01589 return 0; 01590 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::deleteAllLayoutItems | ( | ) |
Definition at line 1592 of file qdockwidgetlayout.cpp.
References QList< T >::count(), deleteAllLayoutItems(), i, item(), item_list, QDockAreaLayoutItem::subinfo, and QDockAreaLayoutItem::widgetItem.
Referenced by deleteAllLayoutItems().
01593 { 01594 for (int i = 0; i < item_list.count(); ++i) { 01595 QDockAreaLayoutItem &item= item_list[i]; 01596 if (item.subinfo) { 01597 item.subinfo->deleteAllLayoutItems(); 01598 } else { 01599 delete item.widgetItem; 01600 item.widgetItem = 0; 01601 } 01602 } 01603 }
Here is the call graph for this function:
QMainWindowLayout * QDockAreaLayoutInfo::mainWindowLayout | ( | ) | const |
Definition at line 1354 of file qdockwidgetlayout.cpp.
References QWidget::layout(), and mainWindow.
Referenced by apply(), and updateTabBar().
01355 { 01356 QMainWindowLayout *result = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); 01357 Q_ASSERT(result != 0); 01358 return result; 01359 }
Here is the call graph for this function:
quintptr QDockAreaLayoutInfo::currentTabId | ( | ) | const |
Definition at line 1037 of file qdockwidgetlayout.cpp.
References QTabBar::currentIndex(), index, tabBar, tabbed, and QTabBar::tabData().
Referenced by itemRect(), and saveState().
01038 { 01039 if (!tabbed || tabBar == 0) 01040 return 0; 01041 01042 int index = tabBar->currentIndex(); 01043 if (index == -1) 01044 return 0; 01045 01046 return qvariant_cast<quintptr>(tabBar->tabData(index)); 01047 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::setCurrentTab | ( | QWidget * | widget | ) |
Definition at line 1049 of file qdockwidgetlayout.cpp.
References setCurrentTabId().
01050 { 01051 setCurrentTabId(reinterpret_cast<quintptr>(widget)); 01052 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::setCurrentTabId | ( | quintptr | id | ) |
Definition at line 1054 of file qdockwidgetlayout.cpp.
References QTabBar::count(), i, qDebug(), QTabBar::setCurrentIndex(), tabBar, tabbed, and QTabBar::tabData().
Referenced by QDockWidgetLayout::addDockWidget(), restoreState(), and setCurrentTab().
01055 { 01056 if (!tabbed || tabBar == 0) 01057 return; 01058 01059 for (int i = 0; i < tabBar->count(); ++i) { 01060 if (qvariant_cast<quintptr>(tabBar->tabData(i)) == id) { 01061 tabBar->setCurrentIndex(i); 01062 return; 01063 } 01064 } 01065 01066 qDebug("QDockAreaLayoutInfo::setCurrentTabId(): not found!"); 01067 }
Here is the call graph for this function:
QRect QDockAreaLayoutInfo::tabContentRect | ( | ) | const |
Definition at line 1877 of file qdockwidgetlayout.cpp.
References QRect::adjust(), QSize::height(), rect, QTabBar::RoundedEast, QTabBar::RoundedNorth, QTabBar::RoundedSouth, QTabBar::RoundedWest, tabBarShape, tabBarSizeHint(), tabBarVisible, tabbed, and QSize::width().
Referenced by convertToWidget(), gapIndex(), QDockWidgetLayout::gapRect(), and itemRect().
01878 { 01879 if (!tabbed) 01880 return QRect(); 01881 01882 QRect result = rect; 01883 QSize tbh = tabBarSizeHint(); 01884 01885 if (tabBarVisible) { 01886 switch (tabBarShape) { 01887 case QTabBar::RoundedNorth: 01888 result.adjust(0, tbh.height(), 0, 0); 01889 break; 01890 case QTabBar::RoundedSouth: 01891 result.adjust(0, 0, 0, -tbh.height()); 01892 break; 01893 case QTabBar::RoundedEast: 01894 result.adjust(0, 0, -tbh.width(), 0); 01895 break; 01896 case QTabBar::RoundedWest: 01897 result.adjust(tbh.width(), 0, 0, 0); 01898 break; 01899 default: 01900 break; 01901 } 01902 } 01903 01904 return result; 01905 }
Here is the call graph for this function:
void QDockAreaLayoutInfo::updateTabBar | ( | ) | const |
Definition at line 1760 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QObject::blockSignals(), QList< T >::count(), QTabBar::count(), QDockAreaLayoutItem::gap, QMainWindowLayout::getTabBar(), i, QTabBar::insertTab(), item(), item_list, mainWindowLayout(), QTabBar::minimumSizeHint(), QTabBar::removeTab(), QTabBar::setShape(), QTabBar::setTabData(), QTabBar::setTabText(), QTabBar::setTabToolTip(), QTabBar::sizeHint(), QDockAreaLayoutItem::skip(), tabBar, tabBarHint, tabBarMin, tabBarShape, tabBarVisible, tabbed, QTabBar::tabData(), tabId(), QTabBar::tabText(), QWidgetItem::widget(), QDockAreaLayoutItem::widgetItem, and QWidget::windowTitle().
Referenced by QDockWidgetLayout::addDockWidget(), restoreState(), tabBarMinimumSize(), tabBarSizeHint(), and usedTabBars().
01761 { 01762 if (!tabbed) 01763 return; 01764 01765 QDockAreaLayoutInfo *that = const_cast<QDockAreaLayoutInfo*>(this); 01766 01767 if (tabBar == 0) { 01768 that->tabBar = mainWindowLayout()->getTabBar(); 01769 that->tabBar->setShape(static_cast<QTabBar::Shape>(tabBarShape)); 01770 } 01771 01772 bool blocked = tabBar->blockSignals(true); 01773 bool gap = false; 01774 01775 int tab_idx = 0; 01776 bool changed = false; 01777 for (int i = 0; i < item_list.count(); ++i) { 01778 const QDockAreaLayoutItem &item = item_list.at(i); 01779 if (item.skip()) 01780 continue; 01781 if (item.gap) { 01782 gap = true; 01783 continue; 01784 } 01785 if (item.widgetItem == 0) 01786 continue; 01787 01788 QString title = item.widgetItem->widget()->windowTitle(); 01789 quintptr id = tabId(item); 01790 if (tab_idx == tabBar->count()) { 01791 tabBar->insertTab(tab_idx, title); 01792 #ifndef QT_NO_TOOLTIP 01793 tabBar->setTabToolTip(tab_idx, title); 01794 #endif 01795 tabBar->setTabData(tab_idx, id); 01796 changed = true; 01797 } else if (qvariant_cast<quintptr>(tabBar->tabData(tab_idx)) != id) { 01798 if (tab_idx + 1 < tabBar->count() 01799 && qvariant_cast<quintptr>(tabBar->tabText(tab_idx + 1)) == id) 01800 tabBar->removeTab(tab_idx); 01801 else { 01802 tabBar->insertTab(tab_idx, title); 01803 #ifndef QT_NO_TOOLTIP 01804 tabBar->setTabToolTip(tab_idx, title); 01805 #endif 01806 tabBar->setTabData(tab_idx, id); 01807 } 01808 changed = true; 01809 } 01810 01811 if (title != tabBar->tabText(tab_idx)) { 01812 tabBar->setTabText(tab_idx, title); 01813 #ifndef QT_NO_TOOLTIP 01814 tabBar->setTabToolTip(tab_idx, title); 01815 #endif 01816 changed = true; 01817 } 01818 01819 ++tab_idx; 01820 } 01821 01822 while (tab_idx < tabBar->count()) { 01823 tabBar->removeTab(tab_idx); 01824 changed = true; 01825 } 01826 01827 tabBar->blockSignals(blocked); 01828 01829 that->tabBarVisible = gap || tabBar->count() > 1; 01830 01831 if (changed) { 01832 that->tabBarMin = tabBar->minimumSizeHint(); 01833 that->tabBarHint = tabBar->sizeHint(); 01834 } 01835 }
Here is the call graph for this function:
QSize QDockAreaLayoutInfo::tabBarMinimumSize | ( | ) | const |
Definition at line 1837 of file qdockwidgetlayout.cpp.
References tabBarMin, tabbed, and updateTabBar().
Referenced by minimumSize().
01838 { 01839 if (!tabbed) 01840 return QSize(0, 0); 01841 01842 updateTabBar(); 01843 01844 return tabBarMin; 01845 }
Here is the call graph for this function:
QSize QDockAreaLayoutInfo::tabBarSizeHint | ( | ) | const |
Definition at line 1847 of file qdockwidgetlayout.cpp.
References tabBarHint, tabbed, and updateTabBar().
Referenced by apply(), maximumSize(), sizeHint(), and tabContentRect().
01848 { 01849 if (!tabbed) 01850 return QSize(0, 0); 01851 01852 updateTabBar(); 01853 01854 return tabBarHint; 01855 }
Here is the call graph for this function:
Definition at line 1857 of file qdockwidgetlayout.cpp.
References QList< T >::at(), QList< T >::count(), i, QSet< T >::insert(), item(), item_list, QDockAreaLayoutItem::skip(), QDockAreaLayoutItem::subinfo, tabBar, tabbed, updateTabBar(), and usedTabBars().
Referenced by usedTabBars().
01858 { 01859 QSet<QTabBar*> result; 01860 01861 if (tabbed) { 01862 updateTabBar(); 01863 result.insert(tabBar); 01864 } 01865 01866 for (int i = 0; i < item_list.count(); ++i) { 01867 const QDockAreaLayoutItem &item = item_list.at(i); 01868 if (item.skip()) 01869 continue; 01870 if (item.subinfo != 0) 01871 result += item.subinfo->usedTabBars(); 01872 } 01873 01874 return result; 01875 }
Here is the call graph for this function:
Definition at line 145 of file qdockwidgetlayout_p.h.
Referenced by convertToGap(), convertToWidget(), findSeparator(), fitItems(), insertGap(), maximumSize(), minimumSize(), restoreState(), separatorMove(), separatorRect(), sizeHint(), split(), and tab().
Definition at line 146 of file qdockwidgetlayout_p.h.
Referenced by QDockWidgetLayout::addDockWidget(), convertToWidget(), findSeparator(), fitItems(), gapIndex(), QDockWidgetLayout::gapRect(), insertGap(), itemRect(), maximumSize(), minimumSize(), paintSeparators(), restoreState(), saveState(), separatorMove(), QDockWidgetLayout::separatorMove(), separatorRect(), sizeHint(), split(), and tab().
Definition at line 147 of file qdockwidgetlayout_p.h.
Referenced by apply(), clear(), convertToWidget(), QDockWidgetLayout::findSeparator(), fitItems(), QDockWidgetLayout::gapIndex(), QDockWidgetLayout::gapRect(), QDockWidgetLayout::getGrid(), insertGap(), itemRect(), paintSeparators(), QDockWidgetLayout::restoreState(), QDockWidgetLayout::saveState(), separatorMove(), separatorRect(), QDockWidgetLayout::separatorRect(), QDockWidgetLayout::setGrid(), size(), and tabContentRect().
Definition at line 148 of file qdockwidgetlayout_p.h.
Referenced by insertGap(), mainWindowLayout(), restoreState(), split(), and tab().
Definition at line 149 of file qdockwidgetlayout_p.h.
Referenced by QDockWidgetLayout::addDockWidget(), apply(), clear(), convertToGap(), convertToWidget(), deleteAllLayoutItems(), expansive(), findSeparator(), fitItems(), gapIndex(), QDockWidgetLayout::gapRect(), indexOf(), info(), insertGap(), item(), itemAt(), itemRect(), maximumSize(), minimumSize(), next(), paintSeparators(), prev(), remove(), restoreState(), saveState(), separatorMove(), separatorRect(), separatorRegion(), sizeHint(), QDockAreaLayoutItem::skip(), split(), tab(), takeAt(), unnest(), updateTabBar(), and usedTabBars().
Definition at line 156 of file qdockwidgetlayout_p.h.
Referenced by QDockWidgetLayout::addDockWidget(), apply(), clear(), convertToGap(), convertToWidget(), currentTabId(), findSeparator(), fitItems(), gapIndex(), QDockWidgetLayout::gapRect(), info(), insertGap(), itemRect(), maximumSize(), minimumSize(), paintSeparators(), restoreState(), saveState(), separatorMove(), separatorRect(), separatorRegion(), setCurrentTabId(), sizeHint(), tab(), tabBarMinimumSize(), tabBarSizeHint(), tabContentRect(), updateTabBar(), and usedTabBars().
Definition at line 157 of file qdockwidgetlayout_p.h.
Referenced by apply(), clear(), currentTabId(), info(), setCurrentTabId(), updateTabBar(), and usedTabBars().
Definition at line 158 of file qdockwidgetlayout_p.h.
Referenced by tabBarMinimumSize(), and updateTabBar().
Definition at line 158 of file qdockwidgetlayout_p.h.
Referenced by tabBarSizeHint(), and updateTabBar().
Definition at line 159 of file qdockwidgetlayout_p.h.
Referenced by apply(), insertGap(), maximumSize(), minimumSize(), restoreState(), sizeHint(), split(), tab(), tabContentRect(), and updateTabBar().
Definition at line 160 of file qdockwidgetlayout_p.h.
Referenced by apply(), tabContentRect(), and updateTabBar().