+ viewer()->createView();
+}
+
+//******************************************************
+void XGUI_MainWindow::cascadeWindows()
+{
+ QMdiArea* aMdiArea = static_cast<QMdiArea*>(centralWidget());
+ QList<QMdiSubWindow*> aWindows = aMdiArea->subWindowList();
+
+ QSize aSize = aMdiArea->size();
+ QRect aRect = aMdiArea->geometry();
+ const int aOffset = 30;
+ int i = 0, j = 0;
+ int x, y;
+ int w = aSize.width() / 2;
+ int h = aSize.height() / 2;
+ QMdiSubWindow* aLastWnd;
+ foreach(QMdiSubWindow* aWnd, aWindows)
+ {
+ aWnd->showNormal();
+ aWnd->raise();
+ x = aOffset * i;
+ if ((x + w) > aSize.width()) {
+ x = 0;
+ i = 0;
+ }
+ y = aOffset * j;
+ if ((y + h) > aSize.height()) {
+ y = 0;
+ j = 0;
+ }
+ aWnd->setGeometry(QStyle::visualRect(aWnd->layoutDirection(), aRect, QRect(x, y, w, h)));
+ i++;
+ j++;
+ viewer()->onWindowActivated(aWnd);
+ aLastWnd = aWnd;
+ QApplication::processEvents();
+ }
+ aLastWnd->setFocus();