Commit Graph

66 Commits

Author SHA1 Message Date
wmayer
b711c586c8 PD: replace static_cast with dynamic_cast
The use of static_cast here could cause undefined behaviour because at this point it's not guaranteed that findBodyOf()
really returns a PartDesign::Body
2024-04-02 08:17:45 +02:00
André
48f0e5043a Allow adding subfeatures to MultiTransform if there is no active Body (#12538)
* Allow adding subfeatures to MultiTransform if there is no active Body

Previously the active Body would be checked and used to add new
subfeatures.
This would either do nothing, when no Body was active,
causing confusion for users becaues than can edit other features without
an active Body.
Or it would add the subfeature to the wrong Body if another Body than the
one of the MultiTransform was active.

Now the Body of the MultiTransform is checked and used.

# Conflicts:
#	src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp

* Change getTopTransformedObject() to protected

This needs to be called from the MultiTransform.

* Fix typo
2024-04-01 10:40:17 -05:00
André Althaus
3936f49ee2 Fix linter hints 2024-02-28 17:29:59 +01:00
André Althaus
0c70b0bd1e Refactor the apply function to be virtual public 2024-02-21 15:04:38 +01:00
André Althaus
a89d450a93 Fix crash when canceling the MultiTransform panel while a newly cretated subfeature is edited
Before calling the closeSubTask() function from the dialog reject()
function, the slotDeletedObject() is called from the transaction being
aborted. This causes the subFeature pointer to be nullptr and subsequent
apply() functions from the SpinBox widgets to crash.

Before calling apply check if the subFeature is still there.
2024-02-21 14:56:23 +01:00
André Althaus
30f5595e2a Reformat files with clang-format 2024-02-17 17:13:14 +01:00
André Althaus
cf627f5ce4 Fix apply() method not called consistently
The python console commands where not consistenly reported because
the apply function was not called or not implemented.

The function is now called from the base class and also when
a subfeature is closed in MultiTransform.

Some missing properties are also added.
2024-02-17 17:13:14 +01:00
André Althaus
8694874080 Refactor: remove unused functions 2024-02-17 17:12:59 +01:00
André Althaus
f82663cfb0 Refactor: add default member initializers 2024-02-17 17:12:59 +01:00
André Althaus
0b3eb1ae08 Move duplicated code to the base class
All pattern sublcasses contain the same code for handling the
feature list. This code is now moved into the base class that handles
the common ui.

The subclasses now only need to call the setupUI/setupParameterUI function
in their constructors and implement the setupParameterUI function
to create their parameter ui into the specified widget.

The MultiTransform also handles it's common ui and the subclasses
can reuse setupParameterUI without code duplication.
2024-02-17 17:12:32 +01:00
bgbsww
5165127dfa Provide a default axis for polar patterns in multitransformation 2024-01-05 11:28:45 -06:00
bgbsww
8cd29179f8 Add missing initialization of MirrorPlane on non sketch objects (#11638) 2023-12-11 11:07:03 -06:00
Florian Foinant-Willig
24934d7843 PartDesign: modernize type checking 2023-10-23 18:08:16 +02:00
wmayer
3e09b8ee2d PD: modernize C++: use range-based for loop 2023-08-16 21:54:56 -05:00
wmayer
a122aa01a7 PD: move to new style connect() 2023-01-15 14:27:33 +01:00
berniev
f4ffd15864 Mod: redundant void 2 2022-08-08 10:27:50 +02:00
berniev
53ba98d636 Mod: use empty 2022-08-06 19:30:13 +02:00
marioalexis
2e5a9604c5 PartDesign: Remove redundant comparision with null pointer 2022-05-26 02:14:30 +02:00
Zheng, Lei
8bec44934b Fix mixed line endings 2022-04-26 12:52:55 -05:00
Chris Hennes
65aa374083 PD: PR6497 move return statement to new line 2022-03-29 12:37:21 -05:00
wmayer
d1d4b996e7 PD: modernize C++11
* use nullptr
2022-03-23 19:26:14 +01:00
wmayer
8f786ea6ef Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
0penBrain
aadb243caa PartDesign: fix crash in MultiTransform if moving on empty list 2022-03-02 13:01:17 +01:00
Uwe
17e6ebf120 [PD] remove more unused includes 2022-02-22 01:19:32 +01:00
wmayer
b7237f6876 PD: 0004582: Mulit-transformation dialog cannot be cancelled 2021-12-09 06:13:25 +01:00
donovaly
88c6ed3d2d [PD] fix multi-transform View
- fixes bug 4581
  See the first issue reported here:
  https://forum.freecadweb.org/viewtopic.php?f=3&t=56093#p482553

- also fix issue that one could set 1 occurrence for polar patterns despite 2 are required at least

- also fix potential dereferencing null pointer (reported by MSVC)
2021-03-01 13:11:15 +01:00
Chris Hennes
40c99417bd [PD] Catch Python exceptions in dtors (Coverity)
In some PartDesign task dialogs, the destructors call functions that may
throw exceptions. If that occurs and the exception is uncaught, this
will ususally end up terminating the program. This commit adds try-catch
blocks around each instance of that (identified by Coverity) and handles
the Python exception in the normal reporting workflow.
2021-02-08 21:30:22 +01:00
donovaly
b483fc0518 [PD] make pointers to the UI std::unique_ptr
Same as PR #4293, just for PartDesign

as noted in https://github.com/FreeCAD/FreeCAD/pull/4271#discussion_r554673632
the pointer to the UI should be a unique pointer.

This PR does this for all PartDesign dialogs that don't already use a unique_ptr.
2021-02-05 18:01:57 +01:00
luz paz
a65b3788c6 PartDesign: Issue #0004473: Expose openCommand() to translation
Continuing the work to expose the undo/redo functionality to translation. This commit does so for the PartDesign Wb.  
Ticket: https://tracker.freecadweb.org/view.php?id=4473
2020-12-01 14:53:35 +01:00
mwganson
4c85faa0a4 [PartDesign Multitransform] prevent crash when pressing delete key without feature selected to remove in multitransform dialog 2020-10-12 16:36:11 +02:00
wmayer
87e7a3762b PartDesign: [skip ci] move indexesMoved() to base class TaskTransformedParameters to avoid code duplication 2020-07-31 13:16:44 +02:00
donovaly
ccd0f58e60 [PD] allow to change feature order in patterns
As discussed here: https://forum.freecadweb.org/viewtopic.php?f=27&t=48998#p420352
The pattern dialogs need a feature to change the order of the features to be patterned
2020-07-31 11:47:31 +02:00
donovaly
ba5fbc5778 [PD] spread the fix from commit 319f38cafc to 3 other affected dialogs 2020-02-15 17:00:26 +01:00
wmayer
60d9607112 PartDesign: use QKeySequence::Delete instead of a QString 2020-02-14 10:11:09 +01:00
donovaly
0310a99f4e [PD] add shortcut to context menus
- people should be informed that there is a shortcut available (that was recently added)
- make the shortcut also translatable since "Del" means nothing in e.g. German
- minor code style fix in TaskDressUpParameters.h
2020-02-14 09:59:46 +01:00
luz.paz
dc8bf3dc39 PartDesign: [skip ci] fix header uniformity
This PR fixes header uniformity across all PartDesign WB files
2019-12-22 00:58:38 +01:00
Zheng, Lei
cd2b7e297c PartDesign changes
* Mostly for supporting in-place editing

* Add new SubShapeBinder that support cross coordinate system,
  external, and sub-object binding
2019-08-17 15:15:47 +02:00
wmayer
1e6cfd430c support Del shortcut in several PD task dialogs 2019-02-27 13:36:45 +01:00
sL1pKn07
6674467254 [For v018] Fix build with Qt5 beta
Seems need add some headers for build with incoming Qt 5.11 (Tested with 5.11.0beta2)
2018-04-10 12:59:41 +02:00
wmayer
6f6ff3bab1 harmonize creation of linear pattern inside a multi transform to direction creation of linear pattern 2017-09-29 23:57:31 +02:00
wmayer
20072a303d fix dangling pointer when cancelling multi-transform task panel 2017-09-29 19:18:34 +02:00
Itai Nahshon
ab2a01c92f PartDesign: Multi Transform Linear Pattern fix. 2017-09-16 01:25:14 +03:00
wmayer
712966ff50 rename method from remObject to removeObject to be more readable 2017-09-13 18:57:38 +02:00
Stefan Tröger
3e12f4b8c0 PartDesign: Prevent problems with link scopes during feature creation 2017-09-09 16:55:55 +02:00
wmayer
a8ba2da041 issue #0001649: Changing names on Pads does not change them everywere 2016-10-21 15:45:50 +02:00
wmayer
70ba1b994b replace const char* with QString in removeItemFromListWidget 2016-10-21 13:48:45 +02:00
wmayer
dd7c91ddcf fix -Wextra in PartDesign 2016-09-22 18:34:56 +02:00
wmayer
17de4e2efa fix Coverity issues 2016-08-22 15:02:18 +02:00
Alexander Golubev
82db88b6db PartDesign/TaskMultiTransformParameters: fix a segfault
The segfault was caused by premature delete of object
TaskMultiTransformParameter::subFeature refered to.
Steps to reproduce:
1. Create a multitransform
2. Add a sub transfurmation to it
3. Press cancel
2016-04-12 18:12:16 +02:00
Alexander Golubev
f6ed16438f PartDesign: make transform parameter dialogs use common base code with other dialogs
subj;
Make PasrtDesign::Transformed provide common for all features
classes interface getBaseObject() instead of specific getSupportObject ();
Refactor some TransformedParameters methods.
2016-04-12 18:12:16 +02:00