Commit Graph

134 Commits

Author SHA1 Message Date
Kacper Donat
febfd65e59 Gui: Ensure that QuantitySpiBox handles expression properly 2025-12-22 11:00:07 -06:00
pre-commit-ci[bot]
25c3ba7338 All: Reformat according to new standard 2025-11-11 13:49:01 +01:00
Billy Huddleston
5b2987bd07 CAM: Fix expression editor so that widgets refresh after closing
src/Gui/QuantitySpinBox.cpp:
- Call updateExpression() after setExpression() in QuantitySpinBox

src/Gui/SpinBox.cpp:
- Call updateExpression() after setExpression() in ExpressionSpinBox

src/Gui/Widgets.cpp:
- Call onChange() after setExpression() in ExpLineEdit

src/Mod/CAM/Path/Base/Gui/Util.py:
- Connect to showFormulaDialog signal and refresh CAM QuantitySpinBox Python wrapper when dialog closes
2025-10-28 15:29:01 -05:00
Markus Reitböck
6ef07bb358 Gui: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
should be considered an optimization, not a requirement. In particular, do not explicitly include a
precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
generated precompile header on the compiler command line instead. This is more portable across
the major compilers and is likely to be easier to maintain. It will also avoid warnings being
generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-14 09:47:03 +02:00
Chris Hennes
325730dd9c Merge pull request #23384 from 3x380V/units
Base: Units update
2025-09-07 20:22:54 -05:00
Ladislav Michl
01b547912f Base: QuantityFormat: avoid storing formatting defaults
User defined precision and fractional inch are stored on QuantityFormat
construction making changes persistent to object life time.
Change that so until not explicitely overriden, user defined values
are always returned.

Co-authored-by: Matthias Danner <28687794+matthiasdanner@users.noreply.github.com>
2025-09-05 17:31:54 +02:00
B0cho
2ab3eaba21 Core: Fix 'Result' message text not wrapped in Expression editor 2025-09-02 00:36:16 +02:00
Krzysztof
ec2bf69135 Core: Fix 'Expression' and 'Vector' editor outhanging the screen (#22426)
* Core: Fix Expression dialog outhanging main window

Expression dialog is now fully shown inside main window, even if opened from model panel positioned on right side. If Model panel is outside main window, dialog is opened over this panel.

* Core: Fix Vectors dialog outhanging main window

Vectors dialog is now fully shown inside main window, even if opened from model panel positioned on right side. If Model panel is outside main window, dialog is opened over this panel.

* Core: Simplify 'adjustDialogPosition()'

Change suggested and authored by @hyarion
2025-08-07 19:22:28 +02:00
tetektoza
deff562dee Sketcher: Handle additional characters for OVP in regexp
Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
2025-06-20 00:33:48 +02:00
tetektoza
4b4475ea3f Gui: Emit signal to EditableDatumLabel only if there's no digits
Small regression of mine, basically this signal to remove set/locked
state of EditableDatumLabel should be only sent out if current text in
the label is empty or it doesn't contain digits.

Previously it was emitted every intermediate wrong state, so stuff like
"71." was also being matched, and it resulted in resetting the locked
state of the label, which in turn resulted in keeping user from entering
float values.
2025-06-17 00:34:21 +02:00
tetektoza
6664907bd5 Sketcher: Allow user to reset OVP state using backspace key
Currently if user tries to reset OVP, they can only do that by entering
"0" for example, and then the parameters will get unset in
unsetOnViewParameter. But that will only happen if user types a value
that's under confusion point (typically 1e^-7). In my opinion, it would
be cool to reset that state if user deletes all content in the label, to
allow them to specify coordinates with mouse once again.

Also, this patch fixes a regression with backspace, where deleting stuff
from OVP was working on unix systems, but seems like on Windows it
doesn't pass the check.
2025-06-08 15:00:58 +02:00
Ladislav Michl
913c30429c Base: Quantity: use isDimensionless whenever feasible
Quantity is often queried for Unit just to see if it has a dimension.
Ask Quantity directly using isDimensionless() method and modify that
method not to care about Quantity value validity; no user was ever
asking for value validity.
2025-06-03 09:31:38 +02:00
Kacper Donat
f71e84cad9 Gui: Fix handling - character in OVP 2025-05-12 08:55:09 -05:00
bofdahof
1155f0d752 Base: simplify UnitsSchemas management
Fixes: Maintaining schemas is difficult and error-prone

- Facilitate easy schemas add, remove, change, etc.
- Remove 14 files containing approx 2,190 lines of if/else code and data
- Place data in one file (UnitsSchemasData.h) using a normalized structure (including special functions)
- Isolate and simplify data operations (code)
- Remove schemas enum to keep data independent of code
- Separate responsibilities: Specifications, data, schemas, schema
- Add schema data 'isDefault'
- Add schema data name
- Prefer algorithms to raw loops
- Add schemas unit tests
- Tweak quantity unit tests
2025-04-27 00:45:54 +02:00
Kacper Donat
b300c80b90 Base: Use explicit pointer syntax for freecad_cast (#20694)
* Base: Use explicit pointer syntax for freecad_cast

This aligns our custom cast with other casts

* All: Use explicit pointer syntax for freecad_cast
2025-04-11 14:11:33 +00:00
Kacper Donat
35a9673a75 Base: Rename Base::freecad_dynamic_cast into freecad_cast
This is to make it shorter and easier to use. QT does the same thing
with their qobject_cast.
2025-04-07 10:32:28 -05:00
Benjamin Nauck
17dc7fce06 Gui: Add #include <limits> where used 2025-03-31 23:50:37 +02:00
Benjamin Nauck
34bc1d45ea Gui: Use std::numeric_limits and std::numbers instead of defines 2025-03-29 13:32:38 +01:00
Alfredo Monclus
1012b66f4f Gui: fix spinbox numbers should not go under the icon 2025-03-20 14:23:36 +01:00
Chris Hennes
c962dbbeb6 Merge pull request #19167 from alfrix/hole_new_taskpanel
feat(PD): hole taskpanel: new image based cut panel
2025-02-11 17:22:16 -06:00
Alfredo Monclus
be3ce13a7c PD(hole taskpanel): Add image-based hole cut panel
* feat(PD): hole taskpanel: new image based cut panel
* fix(PD): hole taskpanel fix dynamic cut types
* refactor(PD): hole taskpanel: renames and vlayouts to keep labels closer
* fix(PD): hole diagram tweaks
2025-02-11 11:31:17 -06:00
Benjamin Bræstrup Sayoc
f647d4a1eb Gui: Use QStringLiteral 2025-02-10 18:34:57 +01:00
tritao
8aa50c4380 Gui: Reorganize the dialog files into a top Dialogs folder. 2025-01-24 16:28:02 -06:00
Kacper Donat
df2e0ba895 Gui: Fix crash on qBounds for imperial units 2025-01-04 16:32:52 +01:00
Kacper Donat
b470f74398 Gui: Add QuantitySpinBox normalization 2025-01-04 16:32:52 +01:00
Ladislav Michl
4d6ed9d531 Base: UnitsSchema: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
2ea8a633ac Base: Quantity: return std::string 2024-12-23 17:48:42 +01:00
PaddleStroke
4649b678f2 Core: QuantitySpinbox: Change truncate value from 18 to 12. Ensuring a more reasonable width. 2024-11-11 18:31:17 +01:00
ppphp
da7ee06d67 fix: c++20 deprecate [=] 2024-03-31 10:47:32 +02:00
Abdullah Tahiri
6a9fa8da68 Gui: QuantitySpinBox - keep format on setValue
==============================================

Problem:
When the value set is a double, a new Quantity is created, which does not follow
the previously configured format (setDecimals).

Solution:
To copy the old format to the newly created quantity.
2023-11-16 19:29:46 +01:00
wmayer
c016f1c1fb Gui: modernize C++: use equals default 2023-08-20 18:12:43 +02:00
wmayer
54bb9c9c62 Gui: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
Connor Worrell
2636e164f3 [GUI] QuantitySpinBox Regex Optimization #10067 Ammendum 2023-08-17 15:57:43 -05:00
Connor Worrell
8cad3940a1 [GUI] QuantitySpinBox: Regex optimization. 2023-08-05 11:23:46 -06:00
luzpaz
129d5882a7 Migrate domain name from freecadweb to freecad (#9352)
* Migrate domain name from freecadweb to freecad
* Migrate src/Mod/Material files
* Migrate Stylesheet related files
* Migrate *.svg files
* Migrate miscellaneous files
* Migrate some build files
* Migrate recently added TD AR_IRAM template files

Closes #6415
2023-04-24 15:19:20 -05:00
Connor Worrell
98b1cbe3e5 [GUI] QuantitySpinBox: more intuitive parsing before handoff to expression parser.
More robust parentheses, multiplication, division, exponent handling.
2023-03-27 21:47:00 -06:00
wmayer
e171a1f6e1 Gui: enable range check in QuantitySpinBox when opening expression editor 2022-12-19 14:46:31 +01:00
wmayer
d7957531f2 Gui: enable range check in QuantitySpinBox when opening expression editor 2022-12-19 13:48:26 +01:00
Uwe
0533550f95 remove some unnecessary Boolean checks
- checks for true/false and nullptr
2022-12-12 21:17:49 -06:00
wmayer
ad8974e9d8 Gui: improve usability of QuantitySpinBox when used as menu item 2022-11-12 18:24:27 +01:00
wmayer
09550656c2 Qt6 port:
* Constructor of QFontDatabase is deprecated, use static functions instead
* Fix QuantitySpinBox::selectNumber()
* Fix InputField::selectNumber()
* Make InputField::fixup() compatible with Qt6
* QFont::setWeight requires an enum now
* QInputEvent reuires a pointing device now
* QAbstractItemView::viewOptions() has been renamed to QAbstractItemView::initViewItemOption()
2022-11-03 12:38:11 +01:00
wmayer
ec553a9292 Qt6 port:
* Explicitly include some missing headers
* Use 'static const char*' for XPM icon
* Skip template parameters for qMakePair
* Constructor of QFileInfo is marked as 'explicit' now
* QString::fromLatin1() also accepts a QByteArray
* QDateTime::fromTime_t() is deprecated in Qt5 and has been removed in Qt6. Use QDateTime::fromSecsSinceEpoch()
* QDateTime::toTime_t() is deprecated in Qt5 and has been removed in Qt6. Use QDateTime::toSecsSinceEpoch()
* QApplication::globalStrut() is deprecated. Don't use it any more.
* QWidget::isTopLevel() is deprecated, use QWidget::isWindow()
2022-11-02 15:16:41 +01:00
wmayer
9d32c892f0 Gui: [skip ci] refactor QuantitySpinBox::apply 2022-10-28 00:46:37 +02:00
Connor Worrell
7cd01505fc Gui: Quantity Spin Box changed to use the expression parser (PR #7124) 2022-10-27 23:17:02 +02:00
wmayer
4d8e61549d Gui: if an expression is set for Euler angles in the placement dialog then evaluate the expression instead of determining the angles from the rotation
See forum thread: https://forum.freecadweb.org/viewtopic.php?f=3&t=72522
2022-10-26 11:27:46 +02:00
wmayer
bcc9c6654c Gui: don't make QuantitySpinBox dependent on implementation details of its base class 2022-10-26 10:54:07 +02:00
wmayer
71d0490dab Gui: don't make QuantitySpinBox dependent on implementation details of its base class 2022-10-26 00:43:33 +02:00
berniev
75acacd1b7 Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. 
* When possible use a ranged for loop instead of begin() and end() iterators
2022-09-14 13:25:13 -05:00
berniev
656ef8961f Gui: redundant void 2 2022-08-08 10:21:44 +02:00
wmayer
60c2157e54 Gui: [skip ci] modernize QuantitySpinBox class 2022-07-31 13:59:28 +02:00