- QDockWidget* aPropPanel = new QDockWidget(this);
- aPropPanel->setWindowTitle(tr("Property Panel"));
-
- QWidget* aContent = new QWidget(aPropPanel);
- QVBoxLayout* aMainLay = new QVBoxLayout(aContent);
- aMainLay->setContentsMargins(3, 3, 3, 3);
- aPropPanel->setWidget(aContent);
-
- QWidget* aCustomWidget = new QWidget(aContent);
- aCustomWidget->setObjectName("PropertyPanelWidget");
- aMainLay->addWidget(aCustomWidget);
- aMainLay->addStretch(1);
-
- QFrame* aFrm = new QFrame(aContent);
- aFrm->setFrameStyle(QFrame::Sunken);
- aFrm->setFrameShape(QFrame::Panel);
- QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm);
- aBtnLay->setContentsMargins(0, 0, 0, 0);
- aMainLay->addWidget(aFrm);
-
- QPushButton* aBtn = new QPushButton(QIcon(":pictures/button_help.png"), "", aFrm);
- aBtn->setFlat(true);
- aBtnLay->addWidget(aBtn);
- aBtnLay->addStretch(1);
- aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm);
- aBtn->setFlat(true);
- aBtnLay->addWidget(aBtn);
- aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm);
- aBtn->setFlat(true);
- aBtnLay->addWidget(aBtn);
-
- return aPropPanel;
+ 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();