Sure.
When I need to move the MDIsubWindow to desktop:
QMdiArea *area = new QMdiArea();
QMdiSubWindow *subWin = this->mdiArea->activeSubWindow();
// I did try to remove this subwin from mdiArea first but not difference
area->addSubWindow(subWin);
XSubWindow *win = new XSubWindow();
win->setMdiArea(area);
win->show();
connect(win, SIGNAL(returnSubWindow(QMdiSubWindow*)), this, SLOT(getReturnedSubWindow(QMdiSubWindow*)));
QMdiArea *area = new QMdiArea();
QMdiSubWindow *subWin = this->mdiArea->activeSubWindow();
// I did try to remove this subwin from mdiArea first but not difference
area->addSubWindow(subWin);
XSubWindow *win = new XSubWindow();
win->setMdiArea(area);
win->show();
connect(win, SIGNAL(returnSubWindow(QMdiSubWindow*)), this, SLOT(getReturnedSubWindow(QMdiSubWindow*)));
To copy to clipboard, switch view to plain text mode
XSubWindow is just a QMainWindow with
closeEvent like
{
emit returnSubWindow(this->mdiArea->activeSubWindow());
event->accept();
}
void XSubWindow::closeEvent(QCloseEvent *event)
{
emit returnSubWindow(this->mdiArea->activeSubWindow());
event->accept();
}
To copy to clipboard, switch view to plain text mode
to handle the returnSubWindow in main MDI window:
void MainWindow::getReturnedSubWindow(QMdiSubWindow *rwin)
{
this->mdiArea->addSubWindow(rwin);
}
void MainWindow::getReturnedSubWindow(QMdiSubWindow *rwin)
{
this->mdiArea->addSubWindow(rwin);
}
To copy to clipboard, switch view to plain text mode
The content of MDIsubWindow is ether a WEBkit window:
XWebWidget *child = new XWebWidget;
child->setWindowTitle("Demo");
mdiArea->addSubWindow(child);
XWebWidget *child = new XWebWidget;
child->setWindowTitle("Demo");
mdiArea->addSubWindow(child);
To copy to clipboard, switch view to plain text mode
or
QGraphicsScene only contains a picture.
scene.setSceneRect(-300, -300, 600, 600);
view->setWindowTitle("Demo Bid Page");
view
->setRenderHint
(QPainter::Antialiasing);
view
->setBackgroundBrush
(QPixmap(":/images/demo.jpg"));
mdiArea->addSubWindow(view);
QGraphicsScene scene;
scene.setSceneRect(-300, -300, 600, 600);
scene.setItemIndexMethod(QGraphicsScene::NoIndex);
QGraphicsView *view = new QGraphicsView;
view->setWindowTitle("Demo Bid Page");
view->setRenderHint(QPainter::Antialiasing);
view->setBackgroundBrush(QPixmap(":/images/demo.jpg"));
mdiArea->addSubWindow(view);
To copy to clipboard, switch view to plain text mode
Bookmarks