Fixed dialog modality

This commit is contained in:
Emil Sawicki 2022-03-14 15:35:52 +01:00
parent b08fc0a044
commit b1f321d637

View File

@ -1304,21 +1304,22 @@ void BaseDesignIntf::showDialog(QWidget *widget)
return; return;
} }
widget->setStyleSheet(findRootWidget(scene()->views().at(0))->styleSheet()); widget->setStyleSheet(findRootWidget(scene()->views().at(0))->styleSheet());
QDialog dialog; QDialog *dialog = new QDialog(QApplication::activeWindow());
widget->setParent(&dialog); widget->setParent(dialog);
widget->setAttribute(Qt::WA_DeleteOnClose); widget->setAttribute(Qt::WA_DeleteOnClose);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
dialog.setWindowModality(Qt::WindowModal); dialog->setWindowModality(Qt::WindowModal);
#else #else
dialog.setWindowModality(Qt::ApplicationModal); dialog->setWindowModality(Qt::ApplicationModal);
#endif #endif
dialog.setLayout(new QVBoxLayout()); dialog->setLayout(new QVBoxLayout());
dialog.resize(widget->size()); dialog->resize(widget->size());
dialog.layout()->setContentsMargins(2,2,2,2); dialog->layout()->setContentsMargins(2,2,2,2);
dialog.layout()->addWidget(widget); dialog->layout()->addWidget(widget);
connect(widget,SIGNAL(destroyed()),&dialog,SLOT(close())); connect(widget,SIGNAL(destroyed()),dialog,SLOT(close()));
dialog.setWindowTitle(widget->windowTitle()); dialog->setWindowTitle(widget->windowTitle());
dialog.exec(); dialog->exec();
dialog->deleteLater();
} }
void BaseDesignIntf::showEditorDialog() void BaseDesignIntf::showEditorDialog()