Commit Graph

51 Commits

Author SHA1 Message Date
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
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
Chris Hennes
b36a21b721 Gui: Eliminate signed-to-unsigned comparison
`std::numeric_limits<int>::max()` can losslessly be cast to an unsigned
int to silence the compiler warning about comparison of signed to
unsigned.
2025-05-15 00:20:35 +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
Alfredo Monclus
2727550e90 Gui: fix Quantity spinbox margin without an icon (#20695)
* Gui: fix Quantity spinbox margin without an icon

* refactor: apply review suggestions

* refactor: reorder operations as suggested

---------

Co-authored-by: alfre <alfre@localhost.localdomain>
2025-04-09 20:28:54 +02: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
2c78997339 Refactor mapToInt/mapToUint 2025-04-01 08:02:42 +02: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
f766f6221c Gui: spinbox use getmargin 2025-03-20 14:23:36 +01:00
Alfredo Monclus
8d2ed0ec0c Gui: spinbox add patch for qt<6.3 2025-03-20 14:23:36 +01:00
Alfredo Monclus
d40d6fafdd Gui: fix spinbox numbers should not go under the icon 2025-03-20 14:23:36 +01:00
Alfredo Monclus
cea9a4002e Gui: correct the size and position of the expression (fx) icon 2025-03-20 14:23:36 +01: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
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
ppphp
8863b9ac4c fix: c++20 deprecate [=] 2024-03-31 10:47:32 +02:00
wmayer
6beace8da6 Gui: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
wmayer
888a33917d Gui: modernize C++: use equals default 2023-08-20 18:12:43 +02: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
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
Uwe
bb2b49fb1f [Gui] remove superfluous nullptr checks 2022-07-18 03:17:42 +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
wmayer
1178df06b4 Gui: modernize C++11
* use nullptr
2022-03-23 18:41:21 +01:00
Uwe
119812ed66 [Gui] SpinBox etc.: remove unused includes 2022-03-05 16:20:40 +01:00
wmayer
8dffd95639 Gui: refactor code to reduce code duplication 2022-01-05 20:13:09 +01:00
wmayer
6cac113ec7 Gui: QuantitySpinBox inherits from ExpressionSpinBox to reduce code duplication 2021-04-02 22:22:16 +02:00
wmayer
d81e6138d1 Gui: add class ExpressionSpinBox to reduce code duplication 2021-04-02 21:36:29 +02: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
b34acb8b31 Add tooltip to f(x) when there is no expression
As suggested by @luzpaz, this adds a tooltip to the f(x) icon of all
of the widgets that use it: QuantitySpinBox, UIntSpinBox, IntSpinBox,
DoubleSpinBox, and ExpLineEdit. These five classes are divided across
three files, and all five classes duplicate the same basic code. In the
existing code, no tooltip is shown if there is no expression. If there
is an expression, it (alone) is used as the tooltip.

This commit modifies that behavior to have explanatory text as the
tooltip when there is no expression, and when there is, to prepend a
short string to the beginning.

To reduce further code duplication, this is implemented by adding a new
function to ExpressionLabel allowing the text of the expression to be set.
It checks that text and if it's empty, uses a preset default string as the
tooltip. If there is expression text, it instead prepends another
bit of text to the front and sets the entire expression+prefix as the
tooltip.

TODO: In the future a lot of the preexisting code duplication could be
removed by making the ExpressionLabel class do more internal management
of the expression.

Thanks to @kisolre for the assistance tracking these down, and
suggesting the default text used.
2021-04-02 16:17:04 +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
f3c697abe7 Gui: [skip ci] workaround for QWindowsStyle to disable spin buttons when it is set read-only 2020-09-11 14:10:45 +02:00
wmayer
fe41dab894 Gui: [skip ci] fix bugs in spin box classes:
+ use correct format string when assigning value to an expression
+ do not round value when setting value of a DoubleSpinBox
2020-09-09 09:49:03 +02:00
Thomas Gimpel
0ba7dcd0f6 Gui: do not drop unhandled key events in *SpinBox::keyPressedEvent() handlers 2020-07-12 11:38:44 +02:00
wmayer
3ab0a20fcd Gui: [skip ci] when changing expression of a widget then set tooltip only for the label child but not for the widget itself
this allows that a custom tooltip can be set
2020-01-09 21:35:13 +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
Eivind Kvedalen
882ccc32ad Spinboxes: Fix for issue #3278. 2017-11-29 21:49:01 +01:00
wmayer
2af6bb6e49 replace deprecated auto_ptr with unique_ptr 2016-09-22 13:01:20 +02:00
Mateusz Skowroński
c275b35d48 QString::fromAscii() is obsolete in Qt5. Replace it with fromLatin1().
This change is Qt4/Qt5 neutral.
2016-01-05 16:07:25 +01:00
Stefan Tröger
08b1c4619e Expressions: port int spinbox for property editor 2015-12-09 14:08:49 +01:00
Stefan Tröger
96a586d04a Expressions: Integrate into the property editor
- basic infrastructure for handling of expressions
- port the unit properties editor to support expressions
- port placement editor to support expressions
- expressions for double spinbox
- expressions in sketch constraints
2015-12-09 14:08:48 +01:00
Eivind Kvedalen
185a0916ef SpinBox: Added expression binding functionality. 2015-09-30 15:54:18 +02:00