Commit Graph

106 Commits

Author SHA1 Message Date
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
wmayer
916c814219 Fix several clazy issue:
* Use multi-arg instead [-Wclazy-qstring-arg]
* Use an empty QLatin1String instead of an empty QStringLiteral [-Wclazy-empty-qstringliteral]
* getter Gui::ProgressBar::canAbort possibly mismarked as a slot [-Wclazy-const-signal-or-slot]
* Missing emit keyword on signal call [-Wclazy-incorrect-emit]
2022-07-24 20:07:04 +02:00
andrea
7886d3cbf4 Remove unused code into GUI 2022-07-17 03:53:11 +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
5bad428702 Gui: add function to determine size that a quantity spin box would need to display a certain text 2022-06-12 20:01:41 +02:00
0penBrain
29c3417285 Revert "Gui: [skip ci] fix a small regression caused by PR #5232 (or commit 7d649fe55)"
This reverts commit 350de2e367ed955b466ad7779b464b0fba79fe55.
2022-04-02 18:09:35 +02:00
0penBrain
eb38017828 Gui: fix locale number formatting propagation 2022-03-29 10:26:49 +02:00
wmayer
cb4363330f Gui: [skip ci] fix a small regression caused by PR #5232 (or commit 7d649fe55)
See also forum posting: https://forum.freecadweb.org/viewtopic.php?p=583303#p583303
2022-03-26 18:27:04 +01:00
0penBrain
4235db97d0 Gui: fix hot change of locale for QuantitySpinBox 2022-03-17 16:46:01 +01:00
Uwe
c2c6443a06 [Gui] QuantitySpinBox: remove unused includes 2022-03-05 03:17:58 +01:00
0penBrain
f2942093e0 [Core] Fix unit management in QuantitySpinBox 2022-01-23 22:04:06 +01:00
wmayer
3945dc0f74 Base: only handle Base::ParserError exceptions for quantity expressions 2022-01-22 01:15:12 +01:00
wmayer
25748e1505 Gui: [skip ci] improve comment 2022-01-18 10:55:34 +01:00
wmayer
b4f2d3a61c Gui: fix handling of dimensionless expressions 2022-01-18 10:52:45 +01:00
wmayer
396f1bf8b8 Gui: override QuantitySpinBox::setExpression and validate expression to update internal representation 2022-01-05 20:15:03 +01:00
wmayer
6cac113ec7 Gui: QuantitySpinBox inherits from ExpressionSpinBox to reduce code duplication 2021-04-02 22:22:16 +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
wmayer
30ccf14117 Gui: [skip ci] fixes #0004104: Void property value defaults to 1 2021-02-23 17:32:02 +01:00
luz paz
38815b9550 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
wmayer
c24516ae71 Gui: [skip ci] try to avoid to truncate QuantitySpinBox at bottom margin on macOS 2020-11-14 13:18:45 +01:00
wmayer
8e6bb060a7 Gui: [skip ci] try to avoid to truncate QuantitySpinBox at bottom margin on macOS 2020-11-08 16:07:10 +01:00
wmayer
9a951a96a9 Gui: [skip ci] fixes #0004422: PartDesign value input does not accept trailing slash 2020-09-14 10:37:46 +02: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
22bfd76efd plugin: [skip ci] add new signal textChanged() to QuantitySpinBox 2020-08-09 11:22:47 +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
8dbe26a95f Qt5: 'int QFontMetrics::width' is deprecated since Qt 5.11: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
wmayer
74bdc701a9 Gui: [skip ci] fix bug when keyboard tracking for QuantitySpinBox is disabled and value is changed by mouse wheel or the spin buttons 2020-06-07 23:38:03 +02:00