From 642ea59de7133f7d4847aab74e0d68c50e0354bf Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 1 Dec 2023 10:21:57 +0100 Subject: [PATCH 1/3] add tooltip for bounds of approximation value --- Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp index b75f648be33e..6056951eba95 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -610,6 +610,8 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, ui.approx->setRange(diag * 10e-7, // min diag); // max ui.approx->setValue(approx); + ui.approx->setToolTip(tr("Approximation error: in [%1; %2]") + .arg(diag * 10e-7).arg(diag)); ui.protect->setEnabled(features_protection_available); ui.protect->setChecked(features_protection_available); From 1ca77d32afa89ef18c065dce44dc95e39d662f10 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 1 Dec 2023 10:23:44 +0100 Subject: [PATCH 2/3] fix DoubleEdit with Qt6 - let the user add as many digits as wanted (using -1 in setRange) - use standard notation, not scientific (which was the default) - comment QDoubleValidator::fixup that for some reason blocks the edition of the field --- Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp b/Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp index a50aef4180b2..c452186e1fa5 100644 --- a/Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp +++ b/Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp @@ -9,13 +9,14 @@ class DoubleValidator : public QDoubleValidator : QDoubleValidator(parent) { setLocale(QLocale::C); + setNotation(QDoubleValidator::StandardNotation); } void fixup ( QString & input ) const { input.replace(".", locale().decimalPoint()); input.replace(",", locale().decimalPoint()); - QDoubleValidator::fixup(input); +// QDoubleValidator::fixup(input); } QValidator::State validate ( QString & input, int & pos ) const { @@ -59,7 +60,7 @@ class DoubleValidator : public QDoubleValidator void DoubleEdit::setRange(double rmin, double rmax) { - this->validator->setRange(rmin, rmax, this->validator->decimals()); + this->validator->setRange(rmin, rmax, -1); } double DoubleEdit::getValue() From 3fc14d8d56e4fb2649fc63a5173e8c2042276d54 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 1 Dec 2023 11:22:39 +0100 Subject: [PATCH 3/3] use QDoubleValidator::fixup() in DoubleEdit::fixup() with this version the user can write with scientific notation or standard notation, using . or , Note that when input is invalid, value() returns 0 --- Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp b/Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp index c452186e1fa5..9f6f4c9b5a27 100644 --- a/Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp +++ b/Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp @@ -9,18 +9,16 @@ class DoubleValidator : public QDoubleValidator : QDoubleValidator(parent) { setLocale(QLocale::C); - setNotation(QDoubleValidator::StandardNotation); } void fixup ( QString & input ) const { input.replace(".", locale().decimalPoint()); input.replace(",", locale().decimalPoint()); -// QDoubleValidator::fixup(input); + QDoubleValidator::fixup(input); } QValidator::State validate ( QString & input, int & pos ) const { - fixup(input); return QDoubleValidator::validate(input, pos); } };