Commit Graph

105 Commits

Author SHA1 Message Date
Roy-043
b511cd59ff Core: workaround for Building US unit system bug (#25288)
* Core: workaround for Building US unit system bug

Fixes #11345

This workaround should hopefully fix the Building US unit system bug at the level of the InputField code. This is the most feasible solution given that we are currently in the v1.1 feature freeze.

I use the word "hopefully" because I have not compiled and tested the code. But replacing `+` with `--` works in Python examples.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix typo in comment

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-14 12:58:24 -06:00
pre-commit-ci[bot]
9fe130cd73 All: Reformat according to new standard 2025-11-11 13:49:01 +01: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
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
Max Wilfinger
6692dacc0a Gui: Update UI strings for consistency
Closes: #22135
2025-08-04 20:14:45 +02:00
Ladislav Michl
a0917bcc7c Base: Units: introduce unit one
Dimensionless quantities have all exponents equal to zero.
Such quantities are simply numbers. The associated unit is
the unit one, symbol 1, although this is rarely explicitly
written.

See chapter 2.3.3 Dimensions of quantities, The International
System of Units, 9th edition.
2025-06-03 09:31:38 +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
Syres916
dbcc11d24e [Gui] InputField correct icon visibility logic on opening a pre-completed task panel 2025-05-26 17:54:39 +02:00
Alfredo Monclus
a7dce4e4b3 Gui: inputfield only show invalid states 2025-04-15 13:52:33 +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
Alfredo Monclus
f09e5e03a9 Gui: fix Inputfield valid/invalid icon placement and size (#20466)
* Gui: fix inputfield icon size placement

* chore:Update inputfield comment to be more clear

Co-authored-by: Benjamin Bræstrup Sayoc <benj5378@outlook.com>

---------

Co-authored-by: Benjamin Bræstrup Sayoc <benj5378@outlook.com>
2025-03-31 00:14:19 +02:00
Benjamin Nauck
b625e81a3e Gui: Use std::numeric_limits and std::numbers instead of defines 2025-03-29 13:32:38 +01:00
Benjamin Bræstrup Sayoc
8d2d0a47f4 Gui: Use QStringLiteral 2025-02-10 18:34:57 +01:00
Tobias Frost
460da406f8 spelling fixes (#18688)
* Fixes spelling of "Allow to" to "Allow one to"

and those variants:
Allows to -> Allows one to
allow to -> allow one to
allows to -> allows one to

* Fix "Let's -> Lets"

(and lower case variant.)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update src/3rdParty/salomesmesh/inc/MED_Wrapper.hxx

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* Update src/Base/PyObjectBase.cpp
Update src/App/ExtensionContainer.h
Update src/App/PropertyContainer.h

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* Use gerund in user-facing texts.

* Use gerund for two more user-facing strings.

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* Update src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* Update src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* Update src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

---------

Co-authored-by: Tobias Frost <tobi@debian.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2025-01-13 11:22:20 -06:00
Ladislav Michl
0b3adee2ab Base: Quantity: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
e62b91ada4 Base: Drop QString-std::string conversion functions from Tools
Convenience helpers function Tools::toStdString and Tools::fromStdString
were implemented for Qt4 or older to perform utf8 aware conversion as
QString::toStdString/QString::fromStdString were using toAscii/fromAscii
internally (see https://dreamswork.github.io/qt4/classQString.html).

Since Qt5 QString uses toUtf8/fromUTf8, which makes the helper functions
obsolete (see https://doc.qt.io/qt-5/qstring.html#fromStdString).
2024-12-02 23:30:53 -05:00
Benjamin Bræstrup Sayoc
18c463bcbb [Gui] Center expression icon 2024-11-11 18:32:34 +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
wmayer
296683e113 Gui: split icon handling from ExpressionBinding 2023-03-09 12:43:44 +01:00
wmayer
3f615bbe05 Gui: fix possible problems with new style connect
* In UIntSpinBox rename the signal to not overwrite the signal of the base class
* In UIntSpinBox use the (ambiguous) signal 'valueChanged' of the base class QSpinBox
* To avoid that connect() fails use the function pointer of the Qt class where the signal is defined
2023-01-12 17:02:59 +01:00
Uwe
5ad737ccdc [Gui] modernize some connect() settings
- addresses #6166
2023-01-12 15:13:16 +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
0penBrain
81b67e0b67 Gui: optionally disable wheel event when Gui::InputField doesn't have focus
Reuse "ComboBoxWheelEventFilter" switch that already acts on combo and spin boxes
2022-10-07 10:40:57 -07: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
3877fc62c3 Gui: Single arg ctors must be explicit (PR #7369) 2022-08-24 15:06:03 +02:00
berniev
75fa455c5d Gui: Use override etc 2 2022-08-09 12:43:23 +02:00
berniev
3d1f70765a Gui: redundant void 2 2022-08-08 10:21:44 +02:00
berniev
2db561561e Gui: use empty 2022-08-06 16:35:45 +02:00
Uwe
32041689c4 [Gui] fix unreferenced local variable warning
- fixes: warning C4101: 'e': unreferenced local variable
2022-07-27 01:35:08 +02:00
0penBrain
b3cbedcc4e Make image scaling command aware of user units (#7222)
* Image: image scaling command is user unit aware ; fixes #6118

- if unitless value entered, InputField uses user choosen base unit
 Before change, always used FC core base unit
 Only applies to GUI user entered values, value changed programmatically still ...
 ... considered in core base unit if applied unitless
2022-07-25 21:17:02 +02:00
wmayer
82a6241fc5 fix (Qt) issues found by clang's clazy tool:
+ -Wclazy-incorrect-emit
+ -Wclazy-strict-iterators
+ -Wclazy-overloaded-signal
+ -Wclazy-qstring-arg
+ -Wclazy-unused-non-trivial-variable
+ -Wclazy-container-anti-pattern
+ -Wclazy-range-loop-reference
+ -Wclazy-const-signal-or-slot
+ -Wclazy-detaching-temporary
+ -Wclazy-qfileinfo-exists
2022-06-29 21:00:54 +02:00
0penBrain
eb38017828 Gui: fix locale number formatting propagation 2022-03-29 10:26:49 +02:00
Uwe
04f693048f [Gui] a Win compile fix 2022-03-27 15:30:48 +02:00
wmayer
ae61d8df53 Gui: [skip ci] fix locale issue for InputField on Windows 2022-03-27 11:35:46 +02:00
wmayer
8befdb2459 Gui: [skip ci] fix locale issue with InputField
The change of 746a2ae40ade added a regression as shown here: https://github.com/FreeCAD/FreeCAD/pull/6640#issuecomment-1079727756
Thus reverting it.
2022-03-26 17:44:05 +01:00
Uwe
e9d8a5da37 [Gui] fix locale issue with InputField
fixes the issue first reported here: https://github.com/FreeCAD/FreeCAD/pull/6364#issuecomment-1072886169

Now, since PR #6364 was merged, we must no longer remove the group separator.

(The issue broke for example the FEM results: https://forum.freecadweb.org/viewtopic.php?p=582524#p582524.)
2022-03-25 22:09:43 +01:00
Uwe
10436cb7f4 [Gui] Manual alignment etc.: remove unused includes 2022-03-02 04:22:48 +01:00
wmayer
f5063af183 Gui: Change label type to ExpressionLabel in ExpressionBinding
* Add function ExpressionBinding::makeLabel() and use it in subclasses to reduce code duplication
2021-04-02 17:46:42 +02:00
Chris Hennes
098d7b9aee [GUI] Remove code for Qt < 5.9 2021-04-02 10:10:37 +02:00
Benjamin Nauck
d69bbaa51b [Gui] Use std::shared_ptr instead of boost::shared_ptr
There's no need to use boost version when stl has support for shared_ptr
2021-03-06 19:32:03 +01:00
luz paz
38815b9550 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
wmayer
2647987157 Qt5: fix deprecation warnings of QWheelEvent in Qt 5.15 2020-10-18 14:45:31 +02:00
wmayer
9ed9d30338 Qt5: 'static bool QPixmapCache::find(const QString&, QPixmap&)' is deprecated: Use bool find(const QString &, QPixmap *) instead [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
luz.paz
04ba2872f0 src/Gui: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/Gui` files
2019-12-25 11:39:17 +01:00
Zheng, Lei
38c47d6e95 Expression: split Expression.h to ExpressionParser.h
Split Expression details into a separate header to reduce recompilation
time on changes.
2019-09-28 15:30:41 +02:00
wmayer
5c4ad9eeac fixes 0003605: Scrolling on length inputs with Building Euro unit system has max value 2019-02-21 13:30:13 +01:00
wmayer
99355b6fd2 fixes 0003823: FEM, unusable material property changing when using task panel 2019-02-18 23:26:00 +01:00