Commit 509a05bd authored by Jan Möbius's avatar Jan Möbius

Dennis:

Place-detached-widgets-in-the-center-of-the-main-win

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5545 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 31b87132
......@@ -136,6 +136,16 @@ void SideElement::detachPressed (bool checked_)
dialog_->setWindowTitle (name_);
dialog_->setLayout (new QVBoxLayout);
dialog_->resize (widget_->size ());
if (window ())
{
int x = (window ()->width () - widget_->width ()) / 2;
x += window ()->x ();
x = qMax (0, x);
int y = (window ()->height () - widget_->height ()) / 2;
y += window ()->y ();
y = qMax (0, y);
dialog_->move (x, y);
}
dialog_->layout ()->addWidget (widget_);
dialog_->show ();
widget_->setAttribute(Qt::WA_DeleteOnClose, false);
......
......@@ -286,6 +286,17 @@ void QtSlideWindow::detachPressed ()
dialog_->setLayout (new QVBoxLayout);
dialog_->resize (mainWidget_->size ());
dialog_->layout ()->addWidget (mainWidget_);
if (scene () && scene ()->views ()[0] && scene ()->views ()[0]->window ())
{
QWidget *w = scene ()->views ()[0]->window ();
int x = (w->width () - mainWidget_->width ()) / 2;
x += w->x ();
x = qMax (0, x);
int y = (w->height () - mainWidget_->height ()) / 2;
y += w->y ();
y = qMax (0, y);
dialog_->move (x, y);
}
hide ();
dialog_->show ();
mainWidget_->setAttribute(Qt::WA_DeleteOnClose, false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment