#include <qlayoutitem.h>
Inheritance diagram for QWidgetItem:
Normally, you don't need to use this class directly. Qt's built-in layout managers provide the following functions for manipulating widgets in layouts:
Class Functions QBoxLayout {QBoxLayout::addWidget()}{addWidget()}, {QBoxLayout::insertWidget()}{insertWidget()}, {QBoxLayout::setStretchFactor()}{setStretchFactor()} QGridLayout {QGridLayout::addWidget()}{addWidget()} QStackedLayout {QStackedLayout::addWidget()}{addWidget()}, {QStackedLayout::insertWidget()}{insertWidget()}, {QStackedLayout::currentWidget()}{currentWidget()}, {QStackedLayout::setCurrentWidget()}{setCurrentWidget()}, {QStackedLayout::widget()}{widget()}
Definition at line 101 of file qlayoutitem.h.
Public Member Functions | |
QWidgetItem (QWidget *w) | |
QSize | sizeHint () const |
QSize | minimumSize () const |
QSize | maximumSize () const |
Qt::Orientations | expandingDirections () const |
bool | isEmpty () const |
void | setGeometry (const QRect &) |
QRect | geometry () const |
virtual QWidget * | widget () |
bool | hasHeightForWidth () const |
int | heightForWidth (int) const |
Private Attributes | |
QWidget * | wid |
QWidgetItem::QWidgetItem | ( | QWidget * | widget | ) | [inline, explicit] |
QSize QWidgetItem::sizeHint | ( | ) | const [virtual] |
Implements QLayoutItem.
Definition at line 552 of file qlayoutitem.cpp.
References QSize::expandedTo(), QSizePolicy::horizontalPolicy(), QSizePolicy::Ignored, isEmpty(), QWidget::maximumSize(), QWidget::minimumSize(), QWidget::minimumSizeHint(), s, QWidget::sizeHint(), QWidget::sizePolicy(), QSizePolicy::verticalPolicy(), and wid.
Referenced by QDockWidgetLayout::getGrid(), QLayoutWidgetItem::sizeHint(), and QDockWidgetLayout::sizeHint().
00553 { 00554 QSize s; 00555 if (isEmpty()) { 00556 s = QSize(0, 0); 00557 } else { 00558 s = wid->sizeHint().expandedTo(wid->minimumSizeHint()); 00559 if (wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored) 00560 s.setWidth(0); 00561 if (wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored) 00562 s.setHeight(0); 00563 s = s.boundedTo(wid->maximumSize()) 00564 .expandedTo(wid->minimumSize()); 00565 } 00566 return s; 00567 }
Here is the call graph for this function:
QSize QWidgetItem::minimumSize | ( | ) | const [virtual] |
Implements QLayoutItem.
Definition at line 513 of file qlayoutitem.cpp.
References isEmpty(), and qSmartMinSize().
Referenced by QDockWidgetLayout::getGrid(), QDockWidgetLayout::minimumSize(), and QLayoutWidgetItem::minimumSize().
00514 { 00515 if (isEmpty()) 00516 return QSize(0, 0); 00517 return qSmartMinSize(this); 00518 }
Here is the call graph for this function:
QSize QWidgetItem::maximumSize | ( | ) | const [virtual] |
Implements QLayoutItem.
Definition at line 532 of file qlayoutitem.cpp.
References QLayoutItem::align, isEmpty(), and qSmartMaxSize().
Referenced by QLayoutWidgetItem::maximumSize().
00533 { 00534 if (isEmpty()) { 00535 return QSize(0, 0); 00536 } else { 00537 return qSmartMaxSize(this, align); 00538 } 00539 }
Here is the call graph for this function:
Qt::Orientations QWidgetItem::expandingDirections | ( | ) | const [virtual] |
Implements QLayoutItem.
Definition at line 474 of file qlayoutitem.cpp.
References QLayoutItem::align, Qt::AlignHorizontal_Mask, Qt::AlignVertical_Mask, QLayout::expandingDirections(), QSizePolicy::expandingDirections(), QSizePolicy::GrowFlag, Qt::Horizontal, QSizePolicy::horizontalPolicy(), isEmpty(), QWidget::layout(), QWidget::sizePolicy(), Qt::Vertical, QSizePolicy::verticalPolicy(), and wid.
Referenced by QLayoutWidgetItem::expandingDirections(), and QDockAreaLayoutItem::expansive().
00475 { 00476 if (isEmpty()) 00477 return Qt::Orientations(0); 00478 00479 Qt::Orientations e = wid->sizePolicy().expandingDirections(); 00480 /* 00481 If the layout is expanding, we make the widget expanding, even if 00482 its own size policy isn't expanding. This behavior should be 00483 reconsidered in Qt 4.0. (###) 00484 */ 00485 if (wid->layout()) { 00486 if (wid->sizePolicy().horizontalPolicy() & QSizePolicy::GrowFlag 00487 && (wid->layout()->expandingDirections() & Qt::Horizontal)) 00488 e |= Qt::Horizontal; 00489 if (wid->sizePolicy().verticalPolicy() & QSizePolicy::GrowFlag 00490 && (wid->layout()->expandingDirections() & Qt::Vertical)) 00491 e |= Qt::Vertical; 00492 } 00493 00494 if (align & Qt::AlignHorizontal_Mask) 00495 e &= ~Qt::Horizontal; 00496 if (align & Qt::AlignVertical_Mask) 00497 e &= ~Qt::Vertical; 00498 return e; 00499 }
Here is the call graph for this function:
bool QWidgetItem::isEmpty | ( | ) | const [virtual] |
Returns true if the widget is hidden; otherwise returns false.
Implements QLayoutItem.
Definition at line 582 of file qlayoutitem.cpp.
References QWidget::isHidden(), QWidget::isWindow(), and wid.
Referenced by QDockWidgetLayout::apply(), expandingDirections(), QDockWidgetLayout::getGrid(), hasHeightForWidth(), heightForWidth(), maximumSize(), minimumSize(), setGeometry(), and sizeHint().
Here is the call graph for this function:
void QWidgetItem::setGeometry | ( | const QRect & | r | ) | [virtual] |
Implements QLayoutItem.
Definition at line 380 of file qlayoutitem.cpp.
References QLayoutItem::align, Qt::AlignBottom, Qt::AlignHorizontal_Mask, Qt::AlignLeft, Qt::AlignRight, Qt::AlignTop, Qt::AlignVertical_Mask, QSize::boundedTo(), QSize::expandedTo(), hasHeightForWidth(), QRect::height(), QSize::height(), heightForWidth(), isEmpty(), QWidget::layoutDirection(), QWidget::minimumSize(), qMin(), qSmartMaxSize(), s, QWidget::setGeometry(), QRect::size(), QWidget::sizeHint(), QStyle::visualAlignment(), wid, QRect::width(), QSize::width(), QRect::x(), x, QRect::y(), and y.
00381 { 00382 if (isEmpty()) 00383 return; 00384 QSize s = r.size().boundedTo(qSmartMaxSize(this)); 00385 int x = r.x(); 00386 int y = r.y(); 00387 if (align & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask)) { 00388 QSize pref = wid->sizeHint().expandedTo(wid->minimumSize()); //### 00389 if (align & Qt::AlignHorizontal_Mask) 00390 s.setWidth(qMin(s.width(), pref.width())); 00391 if (align & Qt::AlignVertical_Mask) { 00392 if (hasHeightForWidth()) 00393 s.setHeight(qMin(s.height(), heightForWidth(s.width()))); 00394 else 00395 s.setHeight(qMin(s.height(), pref.height())); 00396 } 00397 } 00398 Qt::Alignment alignHoriz = QStyle::visualAlignment(wid->layoutDirection(), align); 00399 if (alignHoriz & Qt::AlignRight) 00400 x = x + (r.width() - s.width()); 00401 else if (!(alignHoriz & Qt::AlignLeft)) 00402 x = x + (r.width() - s.width()) / 2; 00403 00404 if (align & Qt::AlignBottom) 00405 y = y + (r.height() - s.height()); 00406 else if (!(align & Qt::AlignTop)) 00407 y = y + (r.height() - s.height()) / 2; 00408 00409 wid->setGeometry(x, y, s.width(), s.height()); 00410 }
Here is the call graph for this function:
QRect QWidgetItem::geometry | ( | ) | const [virtual] |
Implements QLayoutItem.
Definition at line 423 of file qlayoutitem.cpp.
References QWidget::geometry(), and wid.
Referenced by QDockAreaLayoutInfo::insertGap().
Here is the call graph for this function:
QWidget * QWidgetItem::widget | ( | ) | [virtual] |
Returns the widget managed by this item.
Reimplemented from QLayoutItem.
Definition at line 303 of file qlayoutitem.cpp.
References wid.
Referenced by QLayoutWidgetItem::addTo(), QDockWidgetLayout::apply(), QDockAreaLayoutInfo::apply(), QMainWindowLayout::hover(), QDockAreaLayoutInfo::indexOf(), QDockAreaLayoutInfo::info(), QDockAreaLayoutItem::minimumSize(), QMainWindowLayout::plug(), QDockAreaLayoutInfo::saveState(), QLayoutWidgetItem::setGeometry(), QDockAreaLayoutItem::sizeHint(), QDockAreaLayoutItem::skip(), tabId(), QLayoutWidgetItem::theLayout(), and QDockAreaLayoutInfo::updateTabBar().
00304 { 00305 return wid; 00306 }
bool QWidgetItem::hasHeightForWidth | ( | ) | const [virtual] |
Reimplemented from QLayoutItem.
Definition at line 432 of file qlayoutitem.cpp.
References QLayoutItem::hasHeightForWidth(), QSizePolicy::hasHeightForWidth(), isEmpty(), QWidget::layout(), QWidget::sizePolicy(), and wid.
Referenced by QLayoutWidgetItem::hasHeightForWidth(), and setGeometry().
00433 { 00434 if (isEmpty()) 00435 return false; 00436 if (wid->layout()) 00437 return wid->layout()->hasHeightForWidth(); 00438 return wid->sizePolicy().hasHeightForWidth(); 00439 }
Here is the call graph for this function:
int QWidgetItem::heightForWidth | ( | int | w | ) | const [virtual] |
Reimplemented from QLayoutItem.
Definition at line 444 of file qlayoutitem.cpp.
References QWidget::heightForWidth(), isEmpty(), QWidget::layout(), QWidget::maximumHeight(), QWidget::minimumHeight(), QLayout::totalHeightForWidth(), and wid.
Referenced by QLayoutWidgetItem::heightForWidth(), and setGeometry().
00445 { 00446 if (isEmpty()) 00447 return -1; 00448 int hfw; 00449 if (wid->layout()) 00450 hfw = wid->layout()->totalHeightForWidth(w); 00451 else 00452 hfw = wid->heightForWidth(w); 00453 00454 if (hfw > wid->maximumHeight()) 00455 hfw = wid->maximumHeight(); 00456 if (hfw < wid->minimumHeight()) 00457 hfw = wid->minimumHeight(); 00458 if (hfw < 0) 00459 hfw = 0; 00460 return hfw; 00461 }
Here is the call graph for this function:
QWidget* QWidgetItem::wid [private] |
Definition at line 118 of file qlayoutitem.h.
Referenced by expandingDirections(), geometry(), hasHeightForWidth(), heightForWidth(), isEmpty(), setGeometry(), sizeHint(), and widget().