void Q3DockArea::setFixedExtent(int d, Q3DockWindow *dw) { QList<Q3DockWindow *> lst; for (int i = 0; i < dockWindows.size(); ++i) { Q3DockWindow *w = dockWindows.at(i); if (w->isHidden()) continue; if (orientation() == Qt::Horizontal) { if (dw->y() != w->y()) continue; } else { if (dw->x() != w->x()) continue; } if (orientation() == Qt::Horizontal) d = qMax(d, w->minimumHeight()); else d = qMax(d, w->minimumWidth()); if (w->isResizeEnabled()) lst.append(w); } for (int i = 0; i < lst.size(); ++i) { Q3DockWindow *w = lst.at(i); if (orientation() == Qt::Horizontal) w->setFixedExtentHeight(d); else w->setFixedExtentWidth(d); } }
QSize Q3DockAreaLayout::sizeHint() const { if (dockWindows->isEmpty()) return QSize(0, 0); if (dirty) { Q3DockAreaLayout *that = (Q3DockAreaLayout *) this; that->layoutItems(geometry()); } int w = 0; int h = 0; int y = -1; int x = -1; int ph = 0; int pw = 0; for (int i = 0; i < dockWindows->size(); ++i) { Q3DockWindow *dw = dockWindows->at(i); int plush = 0, plusw = 0; if (dw->isHidden()) continue; if (hasHeightForWidth()) { if (y != dw->y()) plush = ph; y = dw->y(); ph = dw->height(); } else { if (x != dw->x()) plusw = pw; x = dw->x(); pw = dw->width(); } h = qMax(h, dw->height() + plush); w = qMax(w, dw->width() + plusw); } if (hasHeightForWidth()) return QSize(0, h); return QSize(w, 0); }
bool Q3DockArea::isLastDockWindow(Q3DockWindow *dw) { int i = dockWindows.indexOf(dw); if (i == -1 || i >= (int)dockWindows.count() - 1) return true; Q3DockWindow *w = 0; if ((w = dockWindows.at(++i))) { if (orientation() == Qt::Horizontal && dw->y() < w->y()) return true; if (orientation() == Qt::Vertical && dw->x() < w->x()) return true; } else { return true; } return false; }