int QAccessibleMdiArea::indexOfChild(const QAccessibleInterface *child) const { if (!child || !child->object() || mdiArea()->subWindowList().isEmpty()) return -1; if (QMdiSubWindow *window = qobject_cast<QMdiSubWindow *>(child->object())) { return mdiArea()->subWindowList().indexOf(window); } return -1; }
bool SubWindow::isMaximized() { #ifdef LMMS_BUILD_APPLE // check if subwindow size is identical to the MdiArea size, accounting for scrollbars int hScrollBarHeight = mdiArea()->horizontalScrollBar()->isVisible() ? mdiArea()->horizontalScrollBar()->size().height() : 0; int vScrollBarWidth = mdiArea()->verticalScrollBar()->isVisible() ? mdiArea()->verticalScrollBar()->size().width() : 0; QSize areaSize( this->mdiArea()->size().width() - vScrollBarWidth, this->mdiArea()->size().height() - hScrollBarHeight ); return areaSize == this->size(); #else return QMdiSubWindow::isMaximized(); #endif }
QAccessibleInterface *QAccessibleMdiArea::child(int index) const { QList<QMdiSubWindow *> subWindows = mdiArea()->subWindowList(); QWidget *targetObject = subWindows.value(index); if (!targetObject) return 0; return QAccessible::queryAccessibleInterface(targetObject); }
void DockedMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow) { if (subWindow) { QWidget *widget = subWindow->widget(); if (QDesignerFormWindow *fw = qobject_cast<QDesignerFormWindow*>(widget)) { emit formWindowActivated(fw); mdiArea()->setActiveSubWindow(subWindow); } } }
// Create a MDI subwindow for the form. QMdiSubWindow *DockedMainWindow::createMdiSubWindow(QWidget *fw, Qt::WindowFlags f, const QKeySequence &designerCloseActionShortCut) { QMdiSubWindow *rc = mdiArea()->addSubWindow(fw, f); // Make action shortcuts respond only if focused to avoid conflicts with // designer menu actions if (designerCloseActionShortCut == QKeySequence(QKeySequence::Close)) { const ActionList systemMenuActions = rc->systemMenu()->actions(); if (!systemMenuActions.empty()) { const ActionList::const_iterator cend = systemMenuActions.constEnd(); for (ActionList::const_iterator it = systemMenuActions.constBegin(); it != cend; ++it) { if ( (*it)->shortcut() == designerCloseActionShortCut) { (*it)->setShortcutContext(Qt::WidgetShortcut); break; } } } } return rc; }
void MdiWindow::mouseReleaseEvent(QMouseEvent *event) { QStyleOptionTitleBar option; option.initFrom(this); option.titleBarFlags = windowFlags(); option.titleBarState = windowState(); option.subControls = QStyle::SC_All; option.activeSubControls = QStyle::SC_None; if (!isMinimized()) { option.rect.setHeight(height() - widget()->height()); } if (!isMaximized() && style()->subControlRect(QStyle::CC_TitleBar, &option, QStyle::SC_TitleBarMaxButton, this).contains(event->pos())) { setWindowFlags(Qt::SubWindow | Qt::CustomizeWindowHint | Qt::FramelessWindowHint); showMaximized(); SessionsManager::markSessionModified(); } else if (!isMinimized() && style()->subControlRect(QStyle::CC_TitleBar, &option, QStyle::SC_TitleBarMinButton, this).contains(event->pos())) { const QList<QMdiSubWindow*> subWindows = mdiArea()->subWindowList(); int activeSubWindows = 0; for (int i = 0; i < subWindows.count(); ++i) { if (!subWindows.at(i)->isMinimized()) { ++activeSubWindows; } } storeState(); setWindowFlags(Qt::SubWindow); showMinimized(); if (activeSubWindows == 1) { MainWindow *mainWindow = MainWindow::findMainWindow(mdiArea()); if (mainWindow) { mainWindow->getWindowsManager()->setActiveWindowByIndex(-1); } else { mdiArea()->setActiveSubWindow(NULL); } } else if (activeSubWindows > 1) { ActionsManager::triggerAction(ActionsManager::ActivatePreviouslyUsedTabAction, mdiArea()); } SessionsManager::markSessionModified(); } else if (isMinimized()) { restoreState(); } QMdiSubWindow::mouseReleaseEvent(event); }
int QAccessibleMdiArea::childCount() const { return mdiArea()->subWindowList().count(); }