Silence Qt/Windows setGeometry Warning

Add the optional Qt::MSWindowsFixedSizeDialogHint parameter to all uses of the QInputDialog::getX static functions to silence a Qt/Windows debug mode warning about QWindowsWindow::setGeometry: Unable to set geometry. Increase the size of the unit calculator to eliminate the same warning. Finally, call adjustSize() on the "Unsaved Changes" dialog to silence the warning.
This commit is contained in:
Chris Hennes
2020-12-10 13:00:55 -06:00
committed by wwmayer
parent 9add3ba199
commit ea3ecf4054
14 changed files with 41 additions and 36 deletions

View File

@@ -573,7 +573,7 @@ void CmdMeshFromGeometry::activated(int)
{
bool ok;
double tol = QInputDialog::getDouble(Gui::getMainWindow(), QObject::tr("Meshing Tolerance"),
QObject::tr("Enter tolerance for meshing geometry:"), 0.1, 0.01,10.0,2,&ok);
QObject::tr("Enter tolerance for meshing geometry:"), 0.1, 0.01, 10.0, 2, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok)
return;
@@ -1645,7 +1645,7 @@ void CmdMeshFillupHoles::activated(int)
std::vector<App::DocumentObject*> meshes = getSelection().getObjectsOfType(Mesh::Feature::getClassTypeId());
bool ok;
int FillupHolesOfLength = QInputDialog::getInt(Gui::getMainWindow(), QObject::tr("Fill holes"),
QObject::tr("Fill holes with maximum number of edges:"), 3, 3, 10000, 1, &ok);
QObject::tr("Fill holes with maximum number of edges:"), 3, 3, 10000, 1, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok) return;
openCommand(QT_TRANSLATE_NOOP("Command", "Fill up holes"));
for (std::vector<App::DocumentObject*>::const_iterator it = meshes.begin(); it != meshes.end(); ++it) {
@@ -1889,7 +1889,7 @@ void CmdMeshScale::activated(int)
bool ok;
double factor = QInputDialog::getDouble(Gui::getMainWindow(), QObject::tr("Scaling"),
QObject::tr("Enter scaling factor:"), 1, 0, DBL_MAX, 5, &ok);
QObject::tr("Enter scaling factor:"), 1, 0, DBL_MAX, 5, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok || factor == 0)
return;

View File

@@ -126,7 +126,7 @@ void CmdPartShapeFromMesh::activated(int iMsg)
bool ok;
double tol = QInputDialog::getDouble(Gui::getMainWindow(), QObject::tr("Sewing Tolerance"),
QObject::tr("Enter tolerance for sewing shape:"), 0.1, minimal_tolerance, 10.0, decimals, &ok);
QObject::tr("Enter tolerance for sewing shape:"), 0.1, minimal_tolerance, 10.0, decimals, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok)
return;
Base::Type meshid = Base::Type::fromName("Mesh::Feature");

View File

@@ -729,7 +729,7 @@ void CmdPartDesignMoveFeature::activated(int iMsg)
QString text = QInputDialog::getItem(Gui::getMainWindow(),
qApp->translate("PartDesign_MoveFeature", "Select body"),
qApp->translate("PartDesign_MoveFeature", "Select a body from the list"),
items, 0, false, &ok);
items, 0, false, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok) return;
int index = items.indexOf(text);
if (index < 0) return;
@@ -879,7 +879,7 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg)
QString text = QInputDialog::getItem(Gui::getMainWindow(),
qApp->translate("PartDesign_MoveFeatureInTree", "Select feature"),
qApp->translate("PartDesign_MoveFeatureInTree", "Select a feature from the list"),
items, 0, false, &ok);
items, 0, false, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok) return;
int index = items.indexOf(text);
// first object is the beginning of the body

View File

@@ -200,7 +200,7 @@ void CmdPointsConvert::activated(int iMsg)
bool ok;
double tol = QInputDialog::getDouble(Gui::getMainWindow(), QObject::tr("Distance"),
QObject::tr("Enter maximum distance:"), 0.1, 0.05, 10.0, 2, &ok);
QObject::tr("Enter maximum distance:"), 0.1, 0.05, 10.0, 2, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok)
return;

View File

@@ -96,7 +96,7 @@ bool ViewProviderLux::setEdit(int ModNum)
int current = items.indexOf(cfi.absoluteFilePath());
bool ok;
QString file = QInputDialog::getItem(Gui::getMainWindow(), tr("LuxRender template"), tr("Select a LuxRender template"), items, current, false, &ok);
QString file = QInputDialog::getItem(Gui::getMainWindow(), tr("LuxRender template"), tr("Select a LuxRender template"), items, current, false, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (ok) {
App::Document* doc = getObject()->getDocument();
doc->openTransaction("Edit LuxRender project");
@@ -175,7 +175,7 @@ bool ViewProviderPovray::setEdit(int ModNum)
int current = items.indexOf(cfi.absoluteFilePath());
bool ok;
QString file = QInputDialog::getItem(Gui::getMainWindow(), tr("Povray template"), tr("Select a Povray template"), items, current, false, &ok);
QString file = QInputDialog::getItem(Gui::getMainWindow(), tr("Povray template"), tr("Select a Povray template"), items, current, false, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (ok) {
App::Document* doc = getObject()->getDocument();
doc->openTransaction("Edit Povray project");

View File

@@ -267,7 +267,7 @@ void CmdRobotSetDefaultValues::activated(int)
bool ok;
QString text = QInputDialog::getText(0, QObject::tr("Set default speed"),
QObject::tr("speed: (e.g. 1 m/s or 3 cm/s)"), QLineEdit::Normal,
QString::fromLatin1("1 m/s"), &ok);
QString::fromLatin1("1 m/s"), &ok, Qt::MSWindowsFixedSizeDialogHint);
if ( ok && !text.isEmpty() ) {
doCommand(Doc,"_DefSpeed = '%s'",text.toLatin1().constData());
}
@@ -276,7 +276,7 @@ void CmdRobotSetDefaultValues::activated(int)
items << QString::fromLatin1("False") << QString::fromLatin1("True");
QString item = QInputDialog::getItem(0, QObject::tr("Set default continuity"),
QObject::tr("continuous ?"), items, 0, false, &ok);
QObject::tr("continuous ?"), items, 0, false, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (ok && !item.isEmpty())
doCommand(Doc,"_DefCont = %s",item.toLatin1().constData());
@@ -284,7 +284,7 @@ void CmdRobotSetDefaultValues::activated(int)
text = QInputDialog::getText(0, QObject::tr("Set default acceleration"),
QObject::tr("acceleration: (e.g. 1 m/s^2 or 3 cm/s^2)"), QLineEdit::Normal,
QString::fromLatin1("1 m/s^2"), &ok);
QString::fromLatin1("1 m/s^2"), &ok, Qt::MSWindowsFixedSizeDialogHint);
if ( ok && !text.isEmpty() ) {
doCommand(Doc,"_DefAccelaration = '%s'",text.toLatin1().constData());
}

View File

@@ -179,7 +179,7 @@ void CmdSketcherNewSketch::activated(int iMsg)
QString text = QInputDialog::getItem(Gui::getMainWindow(),
qApp->translate("Sketcher_NewSketch", "Sketch attachment"),
qApp->translate("Sketcher_NewSketch", "Select the method to attach this sketch to selected object"),
items, iSugg, false, &ok);
items, iSugg, false, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok) return;
int index = items.indexOf(text);
if (index == 0){
@@ -541,7 +541,7 @@ void CmdSketcherMapSketch::activated(int iMsg)
QString text = QInputDialog::getItem(Gui::getMainWindow(),
qApp->translate("Sketcher_MapSketch", "Select sketch"),
qApp->translate("Sketcher_MapSketch", "Select a sketch from the list"),
items, 0, false, &ok);
items, 0, false, &ok, Qt::MSWindowsFixedSizeDialogHint);
if (!ok)
return;
int index = items.indexOf(text);
@@ -620,7 +620,8 @@ void CmdSketcherMapSketch::activated(int iMsg)
items,
bCurIncompatible ? iSugg : iCurr,
false,
&ok);
&ok,
Qt::MSWindowsFixedSizeDialogHint);
// * collect dialog result
if (!ok)
return;

View File

@@ -355,7 +355,8 @@ void MRichTextEdit::textLink(bool checked) {
QString newUrl = QInputDialog::getText(this, tr("Create a link"),
tr("Link URL:"), QLineEdit::Normal,
url,
&ok);
&ok,
Qt::MSWindowsFixedSizeDialogHint);
if (ok) {
fmt.setAnchor(true);
fmt.setAnchorHref(newUrl);