173 #ifndef QT_NO_MDIAREA 175 #include <QApplication> 177 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) 180 #include <QChildEvent> 181 #include <QResizeEvent> 182 #include <QScrollBar> 183 #include <QtAlgorithms> 184 #include <QMutableListIterator> 186 #include <QFontMetrics> 187 #include <QStyleOption> 188 #include <QDesktopWidget> 191 #include <private/qlayoutengine_p.h> 195 using namespace QMdi;
201 const char error[] =
"null pointer";
211 if (index < 0 || index >= widgets.
size()) {
212 const char error[] =
"index out of range";
217 if (!widgets.
at(index)) {
218 const char error[] =
"null pointer";
226 static void setIndex(
int *
index,
int candidate,
int min,
int max,
bool isIncreasing)
235 *index =
qMax(candidate, min);
240 *index =
qMin(candidate, max);
242 Q_ASSERT(*index >= min && *index <= max);
249 return childrenRect.
width() > maxViewportSize.
width()
250 || childrenRect.
left() < 0
251 || childrenRect.
right() >= maxViewportSize.
width();
254 || childrenRect.
top() < 0
273 #ifndef QT_NO_TABWIDGET 287 #endif // QT_NO_TABWIDGET 313 const int n = widgets.
size();
315 const int nrows =
qMax((n % ncols) ? (n / ncols + 1) : (n / ncols), 1);
316 const int nspecial = (n % ncols) ? (ncols - n % ncols) : 0;
317 const int dx = domain.
width() / ncols;
318 const int dy = domain.
height() / nrows;
321 for (
int row = 0; row < nrows; ++row) {
322 const int y1 = int(row * (dy + 1));
323 for (
int col = 0; col < ncols; ++col) {
324 if (row == 1 && col < nspecial)
326 const int x1 = int(col * (dx + 1));
327 int x2 = int(x1 + dx);
328 int y2 = int(y1 + dy);
329 if (row == 0 && col < nspecial) {
336 if (col == ncols - 1 && x2 != domain.
right())
338 if (row == nrows - 1 && y2 != domain.
bottom())
358 const int topOffset = 0;
359 const int bottomOffset = 50;
360 const int leftOffset = 0;
361 const int rightOffset = 100;
367 #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) 369 if (qobject_cast<QMacStyle *>(widgets.
at(0)->
style()))
373 const int dy =
qMax(titleBarHeight - (titleBarHeight - fontMetrics.
height()) / 2, 1);
375 const int n = widgets.
size();
376 const int nrows =
qMax((domain.
height() - (topOffset + bottomOffset)) / dy, 1);
377 const int ncols =
qMax(n / nrows + ((n % nrows) ? 1 : 0), 1);
378 const int dcol = (domain.
width() - (leftOffset + rightOffset)) / ncols;
381 for (
int row = 0; row < nrows; ++row) {
382 for (
int col = 0; col < ncols; ++col) {
383 const int x = leftOffset + row * dx + col * dcol;
384 const int y = topOffset + row * dy;
404 const int n = widgets.
size();
405 const int width = widgets.
at(0)->
width();
406 const int height = widgets.
at(0)->
height();
407 const int ncols =
qMax(domain.
width() / width, 1);
408 const int nrows = n / ncols + ((n % ncols) ? 1 : 0);
411 for (
int row = 0; row < nrows; ++row) {
412 for (
int col = 0; col < ncols; ++col) {
413 const int x = col * width;
414 const int y = domain.
height() - height - row * height;
437 foreach (
const QRect &rect, rects) {
439 accOverlap += intersection.
width() * intersection.
height();
455 int minAccOverlap = -1;
456 QRect minAccOverlapRect;
457 foreach (
const QRect &srcRect, source) {
458 const int accOverlap = accumulatedOverlap(srcRect, rects);
459 if (accOverlap < minAccOverlap || minAccOverlap == -1) {
460 minAccOverlap = accOverlap;
461 minAccOverlapRect = srcRect;
464 return minAccOverlapRect;
480 yset << domain.
top();
483 foreach (
const QRect &rect, rects) {
484 xset << rect.
right() + 1;
485 yset << rect.
bottom() + 1;
491 qSort(ylist.begin(), ylist.end());
493 foreach (
int y, ylist)
494 foreach (
int x, xlist)
509 QMutableListIterator<QRect>
it(source);
510 while (it.hasNext()) {
511 const QRect srcRect = it.next();
531 foreach (
const QRect &srcRect, source) {
533 const int overlap = intersection.
width() * intersection.
height();
534 if (overlap >= maxOverlap || maxOverlap == -1) {
535 if (overlap > maxOverlap) {
536 maxOverlap = overlap;
557 findNonInsiders(domain, source, nonInsiders);
560 return findMinOverlapRect(source, rects).topLeft();
563 findMaxOverlappers(domain, nonInsiders, maxOverlappers);
564 return findMinOverlapRect(maxOverlappers, rects).topLeft();
578 const QRect &domain)
const 582 foreach (
const QRect &rect, rects) {
588 getCandidatePlacements(size, rects, domain, candidates);
589 return findBestPlacement(domain, rects, candidates);
600 #ifndef QT_NO_CONTEXTMENU 627 #ifndef QT_NO_CONTEXTMENU 634 if (!subWindow || subWindow->
isHidden()) {
646 QMdiSubWindow *currentSubWindow = subWindowFromIndex(currentIndex());
669 #endif // QT_NO_CONTEXTMENU 676 if (index < 0 || index >= count())
690 #endif // QT_NO_TABBAR 706 activationOrder(
QMdiArea::CreationOrder),
717 ignoreGeometryChange(false),
718 ignoreWindowStateChange(false),
720 isSubWindowsTiled(false),
721 showActiveWindowMaximized(false),
722 tileCalledFromResizeEvent(false),
723 updatesDisabledByUs(false),
724 inViewModeChange(false),
725 indexToNextWindow(-1),
726 indexToPreviousWindow(-1),
727 indexToHighlighted(-1),
728 indexToLastActiveTab(-1),
730 tabToPreviousTimerId(-1)
743 if (!aboutToActivate)
750 if (!
sanityCheck(child,
"QMdiArea::deactivateAllWindows") || aboutToBecomeActive == child)
757 if (q->updatesEnabled()) {
759 q->setUpdatesEnabled(
false);
766 child->d_func()->setActive(
false);
774 Qt::WindowStates newState)
788 else if ((oldState & Qt::WindowActive) && !(newState & Qt::WindowActive))
799 }
else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized))) {
801 if (oldState & Qt::WindowMinimized)
818 if (lastActive && lastActive->
isHidden())
827 #endif // QT_NO_TABBAR 838 #endif // QT_NO_TABBAR 848 #endif // QT_NO_TABBAR 909 if (!placer || !child)
913 if (!q->isVisible()) {
922 QRect parentRect = q->rect();
928 QRect occupiedGeometry;
930 occupiedGeometry =
QRect(window->d_func()->oldGeometry.topLeft(),
931 window->d_func()->restoreSize);
933 occupiedGeometry = window->
geometry();
951 if (!q->isVisible()) {
962 const bool reverseList = rearranger->
type() == Rearranger::RegularTiler;
964 QSize minSubWindowSize;
968 if (rearranger->
type() == Rearranger::IconTiler) {
977 .expandedTo(child->d_func()->internalMinimumSize);
982 if (
active && rearranger->
type() == Rearranger::RegularTiler) {
986 if (indexToActive > 0)
987 widgets.
move(indexToActive, 0);
991 if (rearranger->
type() == Rearranger::RegularTiler && !widgets.
isEmpty())
996 if (rearranger->
type() == Rearranger::RegularTiler && !widgets.
isEmpty()) {
999 }
else if (rearranger->
type() == Rearranger::SimpleCascader) {
1033 active->d_func()->setActive(
false);
1041 child->d_func()->setActive(
true);
1051 current->d_func()->activationEnabled =
true;
1052 current->d_func()->setActive(
true,
false);
1066 #ifndef QT_NO_RUBBERBAND 1078 if (activeWindow ==
active)
1080 Q_ASSERT(activeWindow->d_func()->isActive);
1096 Q_ASSERT(indexToActiveWindow != -1);
1103 q->setUpdatesEnabled(
true);
1112 #ifndef QT_NO_TABBAR 1129 if (deactivatedWindow) {
1130 if (deactivatedWindow !=
active)
1137 emit q->subWindowActivated(0);
1145 emit q->subWindowActivated(0);
1155 #ifndef QT_NO_TABBAR 1156 if (
tabBar && removedIndex >= 0) {
1171 #ifndef QT_NO_RUBBERBAND 1185 if (*index > removedIndex)
1207 QSize maxSize = q->maximumViewportSize();
1214 maxSize.
rheight() -= doubleFrameWidth;
1216 maxSize.
rwidth() -= doubleFrameWidth;
1217 hbarExtent.
rheight() += doubleFrameWidth;
1218 vbarExtent.
rwidth() += doubleFrameWidth;
1226 if (useHorizontalScrollBar && !useVerticalScrollBar) {
1231 if (useVerticalScrollBar && !useHorizontalScrollBar) {
1242 const int startX = q->isLeftToRight() ? childrenRect.
left() : viewportRect.
right()
1243 - childrenRect.
right();
1248 const int xOffset = startX +
hbar->
value();
1257 const int yOffset = childrenRect.
top() +
vbar->
value();
1279 if (stackUnderChild)
1283 stackUnderChild = child;
1288 if (stackUnderChild)
1297 if (!minSubWindowSize.
isValid() || subWindowCount <= 0)
1302 const int rows =
qMax((subWindowCount % columns) ? (subWindowCount / columns + 1)
1303 : (subWindowCount / columns), 1);
1304 const int minWidth = minSubWindowSize.
width() * columns;
1305 const int minHeight = minSubWindowSize.
height() * rows;
1315 int minAreaWidth = minWidth +
left +
right + 2;
1316 int minAreaHeight = minHeight +
top +
bottom + 2;
1323 minAreaWidth += 2 * frame;
1324 minAreaHeight += 2 * frame;
1333 if (domain.
width() < minWidth) {
1341 if (domain.
height() < minHeight) {
1374 return last->d_func()->data.is_closing;
1383 if (!subWindow || !subWindow->
isVisible())
1385 if (onlyNextActivationEvent)
1386 subWindow->d_func()->ignoreNextActivationEvent = !enable;
1388 subWindow->d_func()->activationEnabled = enable;
1405 if (!
sanityCheck(child,
"QMdiArea::scrollBarPolicyChanged"))
1470 int removedIndex,
int fromIndex)
const 1479 if (removedIndex < 0) {
1480 if (fromIndex >= 0 && fromIndex < subWindows.
size())
1483 current = q->currentSubWindow();
1490 int candidateIndex = -1;
1491 setIndex(&candidateIndex, removedIndex, 0, subWindows.
size() - 1,
true);
1494 current = subWindows.
back();
1500 const int indexToCurrent = subWindows.
indexOf(current);
1501 const bool increasing = increaseFactor > 0 ? true :
false;
1505 setIndex(&index, indexToCurrent + increaseFactor, 0, subWindows.
size() - 1, increasing);
1510 setIndex(&index, index + increaseFactor, 0, subWindows.
size() - 1, increasing);
1511 if (index == indexToCurrent)
1516 return subWindows.
at(index);
1544 #ifndef QT_NO_RUBBERBAND 1554 #ifndef QT_NO_RUBBERBAND 1576 #ifndef QT_NO_TABBAR 1583 #ifndef QT_NO_TABWIDGET 1617 #endif // QT_NO_TABBAR 1619 #ifndef QT_NO_TABBAR 1622 #endif // QT_NO_TABBAR 1625 q->setViewportMargins(0, 0, 0, 0);
1637 #ifndef QT_NO_TABBAR 1647 #ifndef QT_NO_TABWIDGET 1652 int areaHeight = q->
height();
1656 int areaWidth = q->width();
1661 #ifndef QT_NO_TABWIDGET 1664 q->setViewportMargins(0, tabBarSizeHint.height(), 0, 0);
1665 tabBarRect =
QRect(0, 0, areaWidth, tabBarSizeHint.height());
1668 q->setViewportMargins(0, 0, 0, tabBarSizeHint.height());
1669 tabBarRect =
QRect(0, areaHeight - tabBarSizeHint.height(), areaWidth, tabBarSizeHint.height());
1673 q->setViewportMargins(0, 0, tabBarSizeHint.width(), 0);
1675 q->setViewportMargins(tabBarSizeHint.width(), 0, 0, 0);
1676 tabBarRect =
QRect(areaWidth - tabBarSizeHint.width(), 0, tabBarSizeHint.width(), areaHeight);
1680 q->setViewportMargins(tabBarSizeHint.width(), 0, 0, 0);
1682 q->setViewportMargins(0, 0, tabBarSizeHint.width(), 0);
1683 tabBarRect =
QRect(0, 0, tabBarSizeHint.width(), areaHeight);
1688 #endif // QT_NO_TABWIDGET 1704 #ifndef QT_NO_TABWIDGET 1709 #endif // QT_NO_TABBAR 1736 delete d->regularTiler;
1737 d->regularTiler = 0;
1739 delete d->iconTiler;
1753 int nestedCount = 0;
1756 if (qobject_cast<QMdiArea *>(widget))
1760 const int scaleFactor = 3 * (nestedCount + 1);
1781 if (!
d->scrollBarsEnabled()) {
1803 if (
d->childWindows.isEmpty())
1812 Q_ASSERT(
d->indicesToActivatedChildren.count() > 0);
1813 int index =
d->indicesToActivatedChildren.at(0);
1814 Q_ASSERT(index >= 0 && index < d->childWindows.size());
1848 d->activateWindow(0);
1852 if (
d->childWindows.isEmpty()) {
1853 qWarning(
"QMdiArea::setActiveSubWindow: workspace is empty");
1857 if (
d->childWindows.indexOf(window) == -1) {
1858 qWarning(
"QMdiArea::setActiveSubWindow: window is not inside workspace");
1862 d->activateWindow(window);
1891 return d->subWindowList(order,
false);
1907 if (
d->childWindows.isEmpty())
1910 d->isSubWindowsTiled =
false;
1912 if (!
sanityCheck(child,
"QMdiArea::closeAllSubWindows"))
1917 d->updateScrollBars();
1930 if (
d->childWindows.isEmpty())
1935 d->activateWindow(next);
1948 if (
d->childWindows.isEmpty())
1951 QMdiSubWindow *previous =
d->nextVisibleSubWindow(-1,
d->activationOrder);
1953 d->activateWindow(previous);
1982 qWarning(
"QMdiArea::addSubWindow: null pointer to widget");
1993 if (
d->childWindows.indexOf(child) != -1) {
1994 qWarning(
"QMdiArea::addSubWindow: window is already added");
2008 d->appendChild(child);
2025 qWarning(
"QMdiArea::removeSubWindow: null pointer to widget");
2030 if (
d->childWindows.isEmpty())
2033 if (
QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(widget)) {
2034 int index =
d->childWindows.indexOf(child);
2036 qWarning(
"QMdiArea::removeSubWindow: window is not inside workspace");
2039 d->disconnectSubWindow(child);
2040 d->childWindows.removeAll(child);
2041 d->indicesToActivatedChildren.removeAll(index);
2042 d->updateActiveWindow(index,
d->active == child);
2043 child->setParent(0);
2049 if (!
sanityCheck(child,
"QMdiArea::removeSubWindow"))
2060 qWarning(
"QMdiArea::removeSubWindow: widget is not child of any window inside QMdiArea");
2076 return d_func()->background;
2082 if (
d->background != brush) {
2083 d->background = brush;
2107 return d->activationOrder;
2113 if (order !=
d->activationOrder)
2114 d->activationOrder = order;
2126 if (on && !(
d->options & option))
2127 d->options |= option;
2128 else if (!on && (
d->options & option))
2129 d->options &= ~option;
2139 return d_func()->options & option;
2163 d->setViewMode(mode);
2166 #ifndef QT_NO_TABBAR 2182 return d->documentMode;
2188 if (
d->documentMode == enabled)
2210 return d->tabsClosable;
2216 if (
d->tabsClosable == closable)
2219 d->tabsClosable = closable;
2238 return d->tabsMovable;
2244 if (
d->tabsMovable == movable)
2247 d->tabsMovable = movable;
2250 #endif // QT_NO_TABBAR 2252 #ifndef QT_NO_TABWIDGET 2275 if (
d->tabShape == shape)
2278 d->tabShape = shape;
2298 return d->tabPosition;
2304 if (
d->tabPosition == position)
2310 #endif // QT_NO_TABWIDGET 2320 if (
d->childWindows.indexOf(mdiChild) == -1)
2321 d->appendChild(mdiChild);
2332 if (
d->childWindows.isEmpty()) {
2337 #ifndef QT_NO_TABBAR 2338 d->updateTabBarGeometry();
2344 if (
d->isSubWindowsTiled) {
2345 d->tileCalledFromResizeEvent =
true;
2347 d->tileCalledFromResizeEvent =
false;
2348 d->isSubWindowsTiled =
true;
2349 d->startResizeTimer();
2355 bool hasMaximizedSubWindow =
false;
2358 && child->
size() != resizeEvent->
size()) {
2360 if (!hasMaximizedSubWindow)
2361 hasMaximizedSubWindow =
true;
2365 d->updateScrollBars();
2370 if (hasMaximizedSubWindow)
2371 d->startResizeTimer();
2373 d->arrangeMinimizedSubWindows();
2382 if (timerEvent->
timerId() ==
d->resizeTimerId) {
2384 d->resizeTimerId = -1;
2385 d->arrangeMinimizedSubWindows();
2386 }
else if (timerEvent->
timerId() ==
d->tabToPreviousTimerId) {
2388 d->tabToPreviousTimerId = -1;
2389 if (
d->indexToHighlighted < 0)
2391 #ifndef QT_NO_RUBBERBAND 2393 Q_ASSERT(
d->indexToHighlighted <
d->childWindows.size());
2395 d->showRubberBandFor(
d->childWindows.at(
d->indexToHighlighted));
2406 if (!
d->pendingRearrangements.isEmpty()) {
2407 bool skipPlacement =
false;
2408 foreach (
Rearranger *rearranger,
d->pendingRearrangements) {
2411 if (rearranger->
type() != Rearranger::IconTiler && !skipPlacement)
2412 skipPlacement =
true;
2413 d->rearrange(rearranger);
2415 d->pendingRearrangements.clear();
2417 if (skipPlacement && !
d->pendingPlacements.isEmpty())
2418 d->pendingPlacements.clear();
2421 if (!
d->pendingPlacements.isEmpty()) {
2431 d->place(
d->placer, window);
2434 d->pendingPlacements.clear();
2437 d->setChildActivationEnabled(
true);
2438 d->activateCurrentWindow();
2449 switch (event->
type()) {
2451 d->isSubWindowsTiled =
false;
2453 for (
int i = 0; i <
d->childWindows.size(); ++i) {
2454 QObject *child =
d->childWindows.at(i);
2455 if (!child || child == removedChild || !child->
parent()
2462 d->showActiveWindowMaximized =
true;
2464 d->disconnectSubWindow(child);
2465 const bool activeRemoved = i ==
d->indicesToActivatedChildren.at(0);
2466 d->childWindows.removeAt(i);
2467 d->indicesToActivatedChildren.removeAll(i);
2468 d->updateActiveWindow(i, activeRemoved);
2469 d->arrangeMinimizedSubWindows();
2473 d->updateScrollBars();
2477 d->isSubWindowsTiled =
false;
2478 d->resetActiveWindow();
2479 d->childWindows.clear();
2480 qWarning(
"QMdiArea: Deleting the view port is undefined, use setViewport instead.");
2494 const bool wasSubWindowsTiled =
d->isSubWindowsTiled;
2495 d->ignoreGeometryChange =
true;
2497 d->arrangeMinimizedSubWindows();
2498 d->ignoreGeometryChange =
false;
2499 if (wasSubWindowsTiled)
2500 d->isSubWindowsTiled =
true;
2511 if (!
d->regularTiler)
2513 d->rearrange(
d->regularTiler);
2526 d->rearrange(
d->cascader);
2535 switch (event->
type()) {
2540 d->activateCurrentWindow();
2544 d->isActivated =
true;
2545 if (
d->childWindows.isEmpty())
2548 d->activateCurrentWindow();
2549 d->setChildActivationEnabled(
false,
true);
2553 d->isActivated =
false;
2554 d->setChildActivationEnabled(
false,
true);
2560 if (
d->isSubWindowsTiled) {
2562 d->isSubWindowsTiled =
true;
2567 if (
sanityCheck(window,
"QMdiArea::WindowIconChange"))
2572 d->setActive(
d->active,
false,
false);
2573 d->setChildActivationEnabled(
false);
2575 #ifndef QT_NO_TABBAR 2577 d->updateTabBarGeometry();
2618 switch (keyEvent->
key()) {
2625 area->d_func()->startTabToPreviousTimer();
2627 area->d_func()->activateHighlightedWindow();
2632 area->d_func()->highlightNextSubWindow(keyEvent->
key() ==
Qt::Key_Tab ? 1 : -1);
2634 #ifndef QT_NO_RUBBERBAND 2636 area->d_func()->hideRubberBand();
2651 d->activateCurrentWindow();
2653 d->setActive(
d->active,
false,
false);
2659 switch (event->
type()) {
2662 if (
d->tileCalledFromResizeEvent)
2664 d->updateScrollBars();
2666 d->isSubWindowsTiled =
false;
2671 const int tabIndex =
d->childWindows.indexOf(subWindow);
2672 if (!
d->tabBar->isTabEnabled(tabIndex))
2673 d->tabBar->setTabEnabled(tabIndex,
true);
2675 #endif // QT_NO_TABBAR 2678 d->isSubWindowsTiled =
false;
2680 #ifndef QT_NO_RUBBERBAND 2682 if (
d->childWindows.indexOf(subWindow) ==
d->indexToHighlighted)
2683 d->hideRubberBand();
2686 #ifndef QT_NO_TABBAR 2690 d->tabBar->setTabText(
d->childWindows.indexOf(subWindow),
tabTextFor(subWindow));
2694 d->tabBar->setTabIcon(
d->childWindows.indexOf(subWindow), subWindow->
windowIcon());
2696 #endif // QT_NO_TABBAR 2711 for (
int i = 0; i < exposedRects.
size(); ++i)
2712 painter.
fillRect(exposedRects.
at(i),
d->background);
2728 if (!
sanityCheck(child,
"QMdiArea::setupViewport"))
2736 #include "moc_qmdiarea.cpp" 2738 #endif // QT_NO_MDIAREA
QSize minimumSizeHint() const
Reimplemented Function
T qobject_cast(QObject *object)
The QPainter class performs low-level painting on widgets and other paint devices.
void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy)
void setViewMode(QMdiArea::ViewMode mode)
void activateWindow(QMdiSubWindow *child)
bool blockSignals(bool b)
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke...
QTabWidget::TabShape tabShape() const
void _q_closeTab(int index)
The QKeyEvent class describes a key event.
void setHeight(int h)
Sets the height of the rectangle to the given height.
QList< QMdi::Rearranger * > pendingRearrangements
void mousePressEvent(QMouseEvent *event)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QFontMetrics class provides font metrics information.
bool viewportEvent(QEvent *event)
Reimplemented Function
#define QT_END_NAMESPACE
This macro expands to.
void rearrange(QMdi::Rearranger *rearranger)
QPointer< QMdiSubWindow > aboutToBecomeActive
Q_GUI_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy)
QPointer< QWidget > widget
QMdiSubWindow * subWindowFromIndex(int index) const
bool showActiveWindowMaximized
static void keyEvent(KeyAction action, QWidget *widget, char ascii, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1)
#define it(className, varName)
QMdiArea::AreaOptions options
void closeActiveSubWindow()
Closes the active subwindow.
static QSize globalStrut()
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
QString & replace(int i, int len, QChar after)
QSize sizeHint() const
Reimplemented Function
bool ignoreWindowStateChange
bool empty() const
This function is provided for STL compatibility.
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
virtual void rearrange(QList< QWidget *> &widgets, const QRect &domain) const =0
void setTabShape(QTabWidget::TabShape shape)
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
bool lastWindowAboutToBeDestroyed() const
void setOption(AreaOption option, bool on=true)
If on is true, option is enabled on the MDI area; otherwise it is disabled.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
void setCurrentIndex(int index)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
void showRubberBandFor(QMdiSubWindow *subWindow)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
ViewMode
This enum describes the view mode of the area; i.
static QMdiArea * mdiAreaParent(QWidget *widget)
QTabWidget::TabPosition tabPosition() const
int count(const T &t) const
Returns the number of occurrences of value in the list.
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
QList< QPointer< QMdiSubWindow > > pendingPlacements
The QTabBar class provides a tab bar, e.g.
void setOption(SubWindowOption option, bool on=true)
If on is true, option is enabled on the subwindow; otherwise it is disabled.
int height() const
Returns the height of the rectangle.
void disconnectSubWindow(QObject *subWindow)
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
void mousePressEvent(QMouseEvent *)
em>Reimplemented Function
T * qobject_cast(QObject *object)
The QObject class is the base class of all Qt objects.
QSize sizeHint() const
em>Reimplemented Function
void removeTab(int index)
Removes the tab at position index.
ViewMode viewMode() const
void internalRaise(QMdiSubWindow *child) const
QSize boundedTo(const QSize &) const
Returns a size holding the minimum width and height of this size and the given otherSize.
void rearrange(QList< QWidget *> &widgets, const QRect &domain) const
void appendChild(QMdiSubWindow *child)
QMdiSubWindow * currentSubWindow() const
Returns a pointer to the current subwindow, or 0 if there is no current subwindow.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setRange(int min, int max)
Sets the slider's minimum to min and its maximum to max.
QMdiArea::ViewMode viewMode
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
void setObjectName(const QString &name)
bool eventFilter(QObject *object, QEvent *event)
Reimplemented Function
static QFont font()
Returns the default application font.
void setVisible(WindowStateAction, bool visible=true)
virtual QPoint place(const QSize &size, const QList< QRect > &rects, const QRect &domain) const =0
void move(int from, int to)
Moves the item at index position from to index position to.
QList< QPointer< QMdiSubWindow > > childWindows
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
QBrush background() const
int width() const
Returns the width.
void append(const T &t)
Inserts value at the end of the list.
void _q_currentTabChanged(int index)
void removeSubWindow(QWidget *widget)
Removes widget from the MDI area.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool sanityCheck(const QMdiSubWindow *const child, const char *where)
void resizeEvent(QResizeEvent *resizeEvent)
Reimplemented Function
Shape
This enum type lists the built-in shapes supported by QTabBar.
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
bool scrollBarsEnabled() const
bool tileCalledFromResizeEvent
void setTabsClosable(bool closable)
QWidget * widget() const
Returns the current internal widget.
void activateCurrentWindow()
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void contextMenuEvent(QContextMenuEvent *event)
T & back()
This function is provided for STL compatibility.
void initFrom(const QWidget *w)
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
void prepend(const T &t)
Inserts value at the beginning of the list.
The QMdiArea widget provides an area in which MDI windows are displayed.
const T & at(int i) const
Returns the item at index position i in the list.
void scrollContentsBy(int dx, int dy)
Reimplemented Function
void closeAllSubWindows()
Closes all subwindows by sending a QCloseEvent to each window.
void setDocumentMode(bool set)
QList< QMdiSubWindow * > subWindowList(WindowOrder order=CreationOrder) const
Returns a list of all subwindows in the MDI area.
void setShape(Shape shape)
The QResizeEvent class contains event parameters for resize events.
const QRegion & region() const
Returns the region that needs to be updated.
Q_CORE_EXPORT void qWarning(const char *,...)
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
void paintEvent(QPaintEvent *paintEvent)
Reimplemented Function
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
bool isShaded() const
Returns true if this window is shaded; otherwise returns false.
QPointer< QMdiSubWindow > active
void activatePreviousSubWindow()
Gives the keyboard focus to another window in the list of child windows.
void updateActiveWindow(int removedIndex, bool activeRemoved)
virtual Type type() const =0
void clear()
Removes all items from the list.
bool windowStaysOnTop(QMdiSubWindow *subWindow) const
bool ignoreGeometryChange
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
The QShowEvent class provides an event that is sent when a widget is shown.
void setTabEnabled(int index, bool)
If enabled is true then the tab at position index is enabled; otherwise the item at position index is...
Qt::MouseButton button() const
Returns the button that caused the event.
void setupViewport(QWidget *viewport)
This slot is called by QAbstractScrollArea after setViewport() has been called.
void activateHighlightedWindow()
void qSort(RandomAccessIterator start, RandomAccessIterator end)
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
void setMovable(bool movable)
QTabWidget::TabShape tabShape
const T & at(int i) const
Returns the item at index position i in the vector.
static bool useScrollBar(const QRect &childrenRect, const QSize &maxViewportSize, Qt::Orientation orientation)
static QWidget * parentWidget(const QWidget *w)
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
QMdiSubWindow * nextVisibleSubWindow(int increaseFactor, QMdiArea::WindowOrder, int removed=-1, int fromIndex=-1) const
The QMouseEvent class contains parameters that describe a mouse event.
void setTabsMovable(bool movable)
void setDocumentMode(bool enabled)
static void getCandidatePlacements(const QSize &size, const QList< QRect > &rects, const QRect &domain, QList< QRect > &candidates)
Gets candidates for the final placement.
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
The QChildEvent class contains event parameters for child object events.
static void keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1)
The QBrush class defines the fill pattern of shapes drawn by QPainter.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
QList< QMdiSubWindow * > subWindowList(QMdiArea::WindowOrder, bool reversed=false) const
QMdiSubWindow * activeSubWindow() const
Returns a pointer to the current active subwindow.
void setViewMode(ViewMode mode)
~QMdiArea()
Destroys the MDI area.
void activateNextSubWindow()
Gives the keyboard focus to another window in the list of child windows.
#define Q_ASSERT_X(cond, where, what)
void setActiveSubWindow(QMdiSubWindow *window)
Activates the subwindow window.
int top() const
Returns the y-coordinate of the rectangle's top edge.
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction...
void place(QMdi::Placer *placer, QMdiSubWindow *child)
int right() const
Returns the x-coordinate of the rectangle's right edge.
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
static void findNonInsiders(const QRect &domain, QList< QRect > &source, QList< QRect > &result)
Finds all rectangles in 'source' not completely inside 'domain'.
void rearrange(QList< QWidget *> &widgets, const QRect &domain) const
The QTimerEvent class contains parameters that describe a timer event.
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
const QSize & size() const
Returns the new size of the widget.
void timerEvent(QTimerEvent *timerEvent)
Reimplemented Function
QList< int > indicesToActivatedChildren
void setWidget(QWidget *widget)
Sets widget as the internal widget of this subwindow.
void childEvent(QChildEvent *childEvent)
Reimplemented Function
QObject * parent() const
Returns a pointer to the parent object.
void showEvent(QShowEvent *showEvent)
Reimplemented Function
The QPoint class defines a point in the plane using integer precision.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
void setFrameStyle(int)
Sets the frame style to style.
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
QPointer< QMenu > systemMenu
bool event(QEvent *event)
Reimplemented Function
int size() const
Returns the number of items in the list.
void _q_deactivateAllWindows(QMdiSubWindow *aboutToActivate=0)
WindowOrder
Specifies the criteria to use for ordering the list of child windows returned by subWindowList().
static QRect findMinOverlapRect(const QList< QRect > &source, const QList< QRect > &rects)
Finds among 'source' the rectangle with the minimum accumulated overlap with the rectangles in 'rects...
void setWidth(int w)
Sets the width of the rectangle to the given width.
int & rheight()
Returns a reference to the height.
void resetActiveWindow(QMdiSubWindow *child=0)
int height() const
Returns the height.
static int accumulatedOverlap(const QRect &source, const QList< QRect > &rects)
Calculates the accumulated overlap (intersection area) between 'source' and 'rects'.
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
bool isExplicitlyDeactivated(QMdiSubWindow *subWindow) const
void setTabPosition(QTabWidget::TabPosition position)
const QObjectList & children() const
Returns a list of child objects.
static QTabBar::Shape tabBarShapeFrom(QTabWidget::TabShape shape, QTabWidget::TabPosition position)
QSize sizeHint() const
Reimplemented Function
static void setIndex(int *index, int candidate, int min, int max, bool isIncreasing)
bool testOption(AreaOption opton) const
Returns true if option is enabled; otherwise returns false.
int y() const
Returns the y coordinate of this point.
void _q_processWindowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState)
void _q_moveTab(int from, int to)
bool documentMode() const
QPoint place(const QSize &size, const QList< QRect > &rects, const QRect &domain) const
Places the rectangle defined by 'size' relative to 'rects' and 'domain' so that it overlaps 'rects' a...
void setTabsClosable(bool closable)
void tileSubWindows()
Arranges all child windows in a tile pattern.
AreaOption
This enum describes options that customize the behavior of the QMdiArea.
void highlightNextSubWindow(int increaseFactor)
QMdiSubWindow * addSubWindow(QWidget *widget, Qt::WindowFlags flags=0)
Adds widget as a new subwindow to the MDI area.
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
QMdiAreaTabBar(QWidget *parent)
The QSize class defines the size of a two-dimensional object using integer point precision.
void rearrange(QList< QWidget *> &widgets, const QRect &domain) const
int x() const
Returns the x coordinate of this point.
QMdi::Rearranger * iconTiler
void arrangeMinimizedSubWindows()
Arranges all minimized windows at the bottom of the workspace.
QList< T > values() const
void updateTabBarGeometry()
QRect resizeToMinimumTileSize(const QSize &minSubWindowSize, int subWindowCount)
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
void setChildActivationEnabled(bool enable=true, bool onlyNextActivationEvent=false) const
bool tabsClosable() const
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
int height() const
Returns the height of the font.
The QPaintEvent class contains event parameters for paint events.
WindowOrder activationOrder() const
void setBackground(const QBrush &background)
The QEvent class is the base class of all event classes.
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary...
static QString tabTextFor(QMdiSubWindow *subWindow)
Type type() const
Returns the event type.
QTabWidget::TabPosition tabPosition
int addTab(const QString &text)
Adds a new tab with text text.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void cascadeSubWindows()
Arranges all the child windows in a cascade pattern.
SubWindowOption
This enum describes options that customize the behavior of QMdiSubWindow.
int size() const
Returns the number of items in the vector.
QMdiArea::WindowOrder activationOrder
static void findMaxOverlappers(const QRect &domain, const QList< QRect > &source, QList< QRect > &result)
Finds all rectangles in 'source' that overlaps 'domain' by the maximum overlap area between 'domain' ...
void emitWindowActivated(QMdiSubWindow *child)
QMdiArea(QWidget *parent=0)
Constructs an empty mdi area.
QSize minimumSizeHint() const
Reimplemented Function
The QMdiSubWindow class provides a subwindow class for QMdiArea.
QObject * child() const
Returns the child object that was added or removed.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
int & rwidth()
Returns a reference to the width.
static QPoint findBestPlacement(const QRect &domain, const QList< QRect > &rects, QList< QRect > &source)
Finds among the rectangles in 'source' the best placement.
void setActivationOrder(WindowOrder order)
static int area(const QSize &s)
void killTimer(int id)
Kills the timer with timer identifier, id.