diff --git a/src/Gui/CommandStd.cpp b/src/Gui/CommandStd.cpp index d48a784e63..e8089ff289 100644 --- a/src/Gui/CommandStd.cpp +++ b/src/Gui/CommandStd.cpp @@ -343,7 +343,7 @@ void StdCmdRestartInSafeMode::activated(int iMsg) { Q_UNUSED(iMsg); - QMessageBox restartBox; + QMessageBox restartBox(Gui::getMainWindow()); restartBox.setIcon(QMessageBox::Warning); restartBox.setWindowTitle(QObject::tr("Restart in safe mode")); restartBox.setText(QObject::tr("Are you sure you want to restart FreeCAD and enter safe mode?")); diff --git a/src/Gui/Dialogs/DlgMacroExecuteImp.cpp b/src/Gui/Dialogs/DlgMacroExecuteImp.cpp index eaa10d2270..24f793d5b8 100644 --- a/src/Gui/Dialogs/DlgMacroExecuteImp.cpp +++ b/src/Gui/Dialogs/DlgMacroExecuteImp.cpp @@ -565,7 +565,7 @@ void DlgMacroExecuteImp::onToolbarButtonClicked() .GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") ->GetBool("ShowWalkthroughMessage", true); if (showAgain) { - QMessageBox msgBox; + QMessageBox msgBox(this); QAbstractButton* doNotShowAgainButton = msgBox.addButton(tr("Do not show again"), QMessageBox::YesRole); msgBox.setText(tr("Guided Walkthrough")); diff --git a/src/Gui/Dialogs/DlgPreferencesImp.cpp b/src/Gui/Dialogs/DlgPreferencesImp.cpp index 23d968e365..45b6656b94 100644 --- a/src/Gui/Dialogs/DlgPreferencesImp.cpp +++ b/src/Gui/Dialogs/DlgPreferencesImp.cpp @@ -759,7 +759,7 @@ void DlgPreferencesImp::applyChanges() void DlgPreferencesImp::restartIfRequired() { if (restartRequired) { - QMessageBox restartBox; + QMessageBox restartBox(parentWidget()); // current window likely already closed, cant parent to it restartBox.setIcon(QMessageBox::Warning); restartBox.setWindowTitle(tr("Restart required")); diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index 105d5e4174..0a2e1a7a01 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -708,7 +708,7 @@ void Placement::onSelectedVertexClicked() if (!success) { Base::Console().Warning("Placement selection error. Select either 1 or 2 points.\n"); - QMessageBox msgBox; + QMessageBox msgBox(this); msgBox.setText(tr("Please select 1, 2, or 3 points before clicking this button. A point may be on a vertex, \ face, or edge. If on a face or edge the point used will be the point at the mouse position along \ face or edge. If 1 point is selected it will be used as the center of rotation. If 2 points are \ diff --git a/src/Gui/TaskView/TaskDialog.cpp b/src/Gui/TaskView/TaskDialog.cpp index 9c9e304f8c..5c5bceb088 100644 --- a/src/Gui/TaskView/TaskDialog.cpp +++ b/src/Gui/TaskView/TaskDialog.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -96,7 +97,7 @@ const std::vector &TaskDialog::getDialogContent() const bool TaskDialog::canClose() const { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp b/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp index b9a59e29a0..605bd6bfba 100644 --- a/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp +++ b/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -191,7 +192,7 @@ bool ViewProviderAssembly::canDragObjectToTarget(App::DocumentObject* obj, if (obj == obj1 || obj == obj2 || obj == part1 || obj == part2 || obj == obj3) { if (!prompted) { prompted = true; - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(tr("The object is associated to one or more joints.")); msgBox.setInformativeText( tr("Do you want to move the object and delete associated joints?")); diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp index 15b3832b7a..866a64d3dc 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp @@ -333,7 +333,7 @@ bool ViewProviderFemPostFunction::setEdit(int ModNum) postDlg = nullptr; // another pad left open its task panel } if (dlg && !postDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp index 32b68bf036..a943d1c0ed 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp @@ -964,7 +964,7 @@ bool ViewProviderFemPostObject::setEdit(int ModNum) postDlg = nullptr; // another pad left open its task panel } if (dlg && !postDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 3aa89d77c6..9ccbebe3f9 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -890,7 +890,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons (which.compare("Pocket") == 0)) { if (!pcActiveBody->isSolid()) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("Cannot use this command as there is no solid to subtract from.")); msgBox.setInformativeText(QObject::tr("Ensure that the body contains a feature before attempting a subtractive command.")); msgBox.setStandardButtons(QMessageBox::Ok); @@ -912,7 +912,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons } } if (!onlyAllowed) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("Cannot use selected object. Selected object must belong to the active body")); msgBox.setInformativeText(QObject::tr("Consider using a ShapeBinder or a BaseFeature to reference external geometry in a body.")); msgBox.setStandardButtons(QMessageBox::Ok); @@ -1010,7 +1010,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); PartDesignGui::TaskDlgFeaturePick *pickDlg = qobject_cast(dlg); if (dlg && !pickDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/PartDesign/Gui/SketchWorkflow.cpp b/src/Mod/PartDesign/Gui/SketchWorkflow.cpp index 7cff72aa52..945bdc5126 100644 --- a/src/Mod/PartDesign/Gui/SketchWorkflow.cpp +++ b/src/Mod/PartDesign/Gui/SketchWorkflow.cpp @@ -651,7 +651,7 @@ private: Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); PartDesignGui::TaskDlgFeaturePick *pickDlg = qobject_cast(dlg); if (dlg && !pickDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp index be800cd17d..47839dc795 100644 --- a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp @@ -97,7 +97,7 @@ bool TaskDlgDatumParameters::accept() { //see if we are able to assign a mode if (parameter->getActiveMapMode() == mmDeactivated) { - QMessageBox msg; + QMessageBox msg(Gui::getMainWindow()); msg.setWindowTitle(tr("Incompatible reference set")); msg.setText(tr("There is no attachment mode that fits the current set" " of references. If you choose to continue, the feature will remain where" diff --git a/src/Mod/PartDesign/Gui/ViewProvider.cpp b/src/Mod/PartDesign/Gui/ViewProvider.cpp index fe48ac3787..512b87c62a 100644 --- a/src/Mod/PartDesign/Gui/ViewProvider.cpp +++ b/src/Mod/PartDesign/Gui/ViewProvider.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -101,7 +102,7 @@ bool ViewProvider::setEdit(int ModNum) featureDlg = nullptr; // another feature left open its task panel } if (dlg && !featureDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/PartDesign/Gui/ViewProviderBoolean.cpp b/src/Mod/PartDesign/Gui/ViewProviderBoolean.cpp index 7751e4c438..0bafeccfec 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderBoolean.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderBoolean.cpp @@ -36,6 +36,7 @@ #include #include #include +#include using namespace PartDesignGui; @@ -74,7 +75,7 @@ bool ViewProviderBoolean::setEdit(int ModNum) if (booleanDlg && booleanDlg->getBooleanView() != this) booleanDlg = nullptr; // another pad left open its task panel if (dlg && !booleanDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp index 433935a5a5..474dc3b9d0 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -245,7 +246,7 @@ bool ViewProviderDatum::setEdit(int ModNum) if (datumDlg && datumDlg->getViewProvider() != this) datumDlg = nullptr; // another datum feature left open its task panel if (dlg && !datumDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/PartDesign/Gui/ViewProviderHole.cpp b/src/Mod/PartDesign/Gui/ViewProviderHole.cpp index 0b8d1bd9fc..9a1d48418e 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderHole.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderHole.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -73,7 +74,7 @@ bool ViewProviderHole::setEdit(int ModNum) if (holeDlg && holeDlg->getViewObject() != this) holeDlg = nullptr; // another hole left open its task panel if (dlg && !holeDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/PartDesign/Gui/ViewProviderPrimitive.cpp b/src/Mod/PartDesign/Gui/ViewProviderPrimitive.cpp index 5c40f56676..2549e299b8 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderPrimitive.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderPrimitive.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -64,7 +65,7 @@ bool ViewProviderPrimitive::setEdit(int ModNum) Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); TaskPrimitiveParameters *primitiveDlg = qobject_cast(dlg); if (dlg && !primitiveDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp index ee07d3b742..7c54e1003b 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -91,7 +92,7 @@ bool ViewProviderShapeBinder::setEdit(int ModNum) { Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog(); TaskDlgShapeBinder* sbDlg = qobject_cast(dlg); if (dlg && !sbDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(QObject::tr("A dialog is already open in the task panel")); msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/Points/Gui/Command.cpp b/src/Mod/Points/Gui/Command.cpp index b08d6ea61b..b0f76cb089 100644 --- a/src/Mod/Points/Gui/Command.cpp +++ b/src/Mod/Points/Gui/Command.cpp @@ -112,7 +112,7 @@ void CmdPointsImport::activated(int iMsg) auto center = bbox.GetCenter(); if (!bbox.IsInBox(Base::Vector3d(0, 0, 0))) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setIcon(QMessageBox::Question); msgBox.setWindowTitle(QObject::tr("Points not at Origin")); msgBox.setText(QObject::tr( diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 781a939522..613b045447 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -2980,7 +2980,7 @@ bool ViewProviderSketch::setEdit(int ModNum) if (sketchDlg && sketchDlg->getSketchView() != this) sketchDlg = nullptr;// another sketch left open its task panel if (dlg && !sketchDlg) { - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(tr("A dialog is already open in the task panel")); msgBox.setInformativeText(tr("Do you want to close this dialog?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp index 3dc13cbcb7..321788f54d 100644 --- a/src/Mod/TechDraw/Gui/Command.cpp +++ b/src/Mod/TechDraw/Gui/Command.cpp @@ -424,7 +424,7 @@ void CmdTechDrawView::activated(int iMsg) bool dontShowAgain = hGrp->GetBool("DontShowInsertFileMessage", false); if (!dontShowAgain) { auto msgText = QObject::tr("If you want to insert a view from existing objects, please select them before invoking this tool. Without a selection, a file browser will open, to insert a SVG or image file."); - QMessageBox msgBox; + QMessageBox msgBox(Gui::getMainWindow()); msgBox.setText(msgText); auto dontShowMsg = QObject::tr("Do not show this message again"); QCheckBox dontShowCheckBox(dontShowMsg, &msgBox); diff --git a/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp b/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp index 42bc104862..64d16ae320 100644 --- a/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp +++ b/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp @@ -113,7 +113,7 @@ void execInsertPrefixChar(Gui::Command* cmd, std::string prefixFormat, const QAc std::string prefixText(prefixFormat); if (prefixFormat.find("%s") != std::string::npos) { - DlgTemplateField ui; + DlgTemplateField ui(Gui::getMainWindow()); const int MAX_PREFIX_LENGTH = 31; if (action) { diff --git a/src/Mod/TechDraw/Gui/TemplateTextField.cpp b/src/Mod/TechDraw/Gui/TemplateTextField.cpp index dd22a49863..f8afce0f33 100644 --- a/src/Mod/TechDraw/Gui/TemplateTextField.cpp +++ b/src/Mod/TechDraw/Gui/TemplateTextField.cpp @@ -30,6 +30,7 @@ #endif // #ifndef _PreCmp_ #include +#include #include #include @@ -73,7 +74,7 @@ void TemplateTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) if ( tmplte && m_rect->rect().contains(event->pos()) ) { event->accept(); - DlgTemplateField ui; + DlgTemplateField ui(Gui::getMainWindow()); ui.setFieldName(fieldNameStr); ui.setFieldContent(tmplte->EditableTexts[fieldNameStr]);