Commit Graph

134 Commits

Author SHA1 Message Date
Kacper Donat
1918d2b22c Gui: Ensure that QuantitySpiBox handles expression properly 2025-12-22 11:00:07 -06:00
pre-commit-ci[bot]
9fe130cd73 All: Reformat according to new standard 2025-11-11 13:49:01 +01:00
Billy Huddleston
db40eb1478 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
a72a0d6405 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
c00bf075e5 Merge pull request #23384 from 3x380V/units
Base: Units update
2025-09-07 20:22:54 -05:00
Ladislav Michl
a5f039dd6a 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
05517d2ff4 Core: Fix 'Result' message text not wrapped in Expression editor 2025-09-02 00:36:16 +02:00
Krzysztof
f5a5fb6411 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
c8d2ae494b 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
f5e26f2fda 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
2933eaf819 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
0c9584ab2d 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
cf4357ed38 Gui: Fix handling - character in OVP 2025-05-12 08:55:09 -05:00
bofdahof
353acbb27b 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
77e40b9747 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
9d97d1c895 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
b6d6c8837f Gui: Add #include <limits> where used 2025-03-31 23:50:37 +02:00
Benjamin Nauck
b625e81a3e Gui: Use std::numeric_limits and std::numbers instead of defines 2025-03-29 13:32:38 +01:00
Alfredo Monclus
d40d6fafdd Gui: fix spinbox numbers should not go under the icon 2025-03-20 14:23:36 +01:00
Chris Hennes
1d6e2b8675 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
c7e764193c 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
8d2d0a47f4 Gui: Use QStringLiteral 2025-02-10 18:34:57 +01:00
tritao
4c93a14fea Gui: Reorganize the dialog files into a top Dialogs folder. 2025-01-24 16:28:02 -06:00
Kacper Donat
f1ae9ac435 Gui: Fix crash on qBounds for imperial units 2025-01-04 16:32:52 +01:00
Kacper Donat
72b92ce160 Gui: Add QuantitySpinBox normalization 2025-01-04 16:32:52 +01:00
Ladislav Michl
3bddb723d5 Base: UnitsSchema: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
0b3adee2ab Base: Quantity: return std::string 2024-12-23 17:48:42 +01:00
PaddleStroke
902f9072db Core: QuantitySpinbox: Change truncate value from 18 to 12. Ensuring a more reasonable width. 2024-11-11 18:31:17 +01:00
ppphp
8863b9ac4c fix: c++20 deprecate [=] 2024-03-31 10:47:32 +02:00
Abdullah Tahiri
900d3e878e 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
888a33917d Gui: modernize C++: use equals default 2023-08-20 18:12:43 +02:00
wmayer
fa8978ce99 Gui: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
Connor Worrell
b4787c1ee1 [GUI] QuantitySpinBox Regex Optimization #10067 Ammendum 2023-08-17 15:57:43 -05:00
Connor Worrell
3ed8e884be [GUI] QuantitySpinBox: Regex optimization. 2023-08-05 11:23:46 -06:00
luzpaz
38a01939e0 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
7bf4452b1d [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
64f421d815 Gui: enable range check in QuantitySpinBox when opening expression editor 2022-12-19 14:46:31 +01:00
wmayer
ae54a88cc7 Gui: enable range check in QuantitySpinBox when opening expression editor 2022-12-19 13:48:26 +01:00
Uwe
2b9a28e0ec remove some unnecessary Boolean checks
- checks for true/false and nullptr
2022-12-12 21:17:49 -06:00
wmayer
a2a285b7c9 Gui: improve usability of QuantitySpinBox when used as menu item 2022-11-12 18:24:27 +01:00
wmayer
abc4e6bf39 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
fac648fff5 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
f0c61364f3 Gui: [skip ci] refactor QuantitySpinBox::apply 2022-10-28 00:46:37 +02:00
Connor Worrell
0551d0ab53 Gui: Quantity Spin Box changed to use the expression parser (PR #7124) 2022-10-27 23:17:02 +02:00
wmayer
13b3abc063 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
c3b0988219 Gui: don't make QuantitySpinBox dependent on implementation details of its base class 2022-10-26 10:54:07 +02:00
wmayer
121e4ed03c Gui: don't make QuantitySpinBox dependent on implementation details of its base class 2022-10-26 00:43:33 +02:00
berniev
ae53c9b0a4 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
3d1f70765a Gui: redundant void 2 2022-08-08 10:21:44 +02:00
wmayer
08d9d73e18 Gui: [skip ci] modernize QuantitySpinBox class 2022-07-31 13:59:28 +02:00