less ugly workaround for disappearing Qt::Popup

still a workaround but slightly less ugly and works on Qt 4.8 too
This commit is contained in:
Marco Martin 2012-07-12 17:49:08 +02:00
parent 796211bbd5
commit 8a04030fdf

View File

@ -197,9 +197,11 @@ bool DialogProxy::isVisible() const
void DialogProxy::setVisible(const bool visible) void DialogProxy::setVisible(const bool visible)
{ {
if (m_dialog->isVisible() != visible) { if (m_dialog->isVisible() != visible) {
//FIXME: workaround to prevent dialogs of Popup type disappearing on the second show
m_dialog->resize(0,0);
m_dialog->syncToGraphicsWidget();
m_dialog->setVisible(visible); m_dialog->setVisible(visible);
if (visible) { if (visible) {
m_dialog->setVisible(visible);
m_dialog->raise(); m_dialog->raise();
} }
} }
@ -359,17 +361,8 @@ qulonglong DialogProxy::windowId() const
void DialogProxy::setWindowFlags(const int flags) void DialogProxy::setWindowFlags(const int flags)
{ {
/*X misbehaviour: the only way to make a window with the Popup flag working, is to create it with that flag from the beginning*/
if (((Qt::WindowFlags)flags & Qt::Popup) != (m_flags & Qt::Popup)) {
delete m_dialog;
m_flags = (Qt::WindowFlags)flags;
m_dialog = new Plasma::Dialog(0, Qt::FramelessWindowHint|m_flags);
m_margins = new DialogMargins(m_dialog, this);
m_dialog->installEventFilter(this);
} else {
m_flags = (Qt::WindowFlags)flags; m_flags = (Qt::WindowFlags)flags;
m_dialog->setWindowFlags(Qt::FramelessWindowHint|m_flags); m_dialog->setWindowFlags(Qt::FramelessWindowHint|m_flags);
}
} }
int DialogProxy::location() const int DialogProxy::location() const