Commit Graph

124 Commits

Author SHA1 Message Date
wmayer
a1194f5f57 Gui: fix crash in PythonCommand::isChecked()
This very likely fixes the crash reported at https://forum.freecad.org/viewtopic.php?t=86874
2024-04-13 14:58:21 +02:00
David Carter
ba20441935 Material: Material appearance
Uses new material system for appearance

Each feature object now has a property called ShapeMaterial that
describes its physical properties. If it has a shape, it has a
material.

The ShapeColor attribute is replaced by a ShapeAppearance attribute.
This is a material list that describes all appearance properties, not
just diffuse color. As a list in can be used for all elements of a
shape, such as edges and faces.

A new widget is provided to allow the user to select materials in a
consistent fashion. It can also launch the material editor with its
more advanced capabilities.
2024-04-04 07:39:58 -05:00
Kacper Donat
34c85e26da Gui: Allow ActionGroups to not remember choice
This is fix to issue mentioned in the #11717, on discord and forum that
for smart dimension tool the chosen tool should not be remembered. This
will ensure that the "smart" tool is always visible on the toolbar and
other tools are accessible in case that such explicit choice is needed.
2023-12-18 17:51:48 +01:00
André Caldas
89dbab9b0e Avoids using getNameInDocument() to test if DocumentObject is attached to a Document.
This patch substitutes by isAttachedToDocument() (almost) everywhere where
getNameInDocument() is used for this purpose.

The very few places not touched by this patch demand a (just a little) less trivial change.
When we change the returning type of getNameInDocument() to std::string,
those places will be easily found, because they shall generate a compiler error
(converting std::string to bool).

Rationale:
The fact that getNameInDocument() return nullptr to indicate
that the object is not attached to a document is responsible for lots of bugs
where the developer does not check for "nullptr".

The idea is to eliminate all those uses of getNameInDocument() and, in the near future,
make getNameInDocument() return always a valid std::string.
2023-12-11 17:37:58 +01:00
wmayer
531d7de201 Gui: make GroupCommand more flexible
Currently the GroupCommand by default sets the action group as non-exclusive, checkable and having a drop-down menu which isn't always the desired behaviour in sub-classes.
Thus, some new methods are added to let a sub-class in its constructor decide how it should behave.
2023-09-01 13:28:19 +02: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
948cbfccd9 modernize C++: avoid bind
In many cases std::bind() is kept because the code is much simpler
2023-08-08 21:10:16 +02:00
wmayer
52e1c7c33b modernize C++: move from boost::bind to std::bind 2023-08-08 17:36:13 +02:00
wmayer
ec73caa40e modernize C++: make unique 2023-08-07 19:51:30 -06:00
marioalexis
ae480d70cd Gui: Add CommandAction descriptor object to access commands action 2023-04-10 16:53:51 +02:00
wmayer
991a7c1a4b Gui: refactor MacroManager 2023-03-26 18:41:56 +02:00
luzpaz
2e1ad2c2ad Gui: [skip ci] fix typo 2023-02-06 06:23:27 +01:00
Zheng, Lei
7942ed61c5 Gui: fix Customize -> Keyboard shortcut priroity list
Add API Command::initAction() to force create action for all commands
with shortcut in order to register with ShortcutManager to obtain a
complete list of actions with the same shortcut.
2022-11-10 23:20:18 +01:00
Zheng, Lei
2cb2fa5626 Gui: fix GroupCommand icon setup 2022-11-10 23:20:18 +01:00
Zheng, Lei
775452cbc0 Gui: add ShortcutManager to unify shortcut handling
Support longest key sequence match with user defined delay (configurable
through 'Customize -> Keyboard -> Key sequence delay').

Support user defined priority to resolve shortcut conflict through
'Customize -> Keyboard')

Add 'All' category in 'Customize -> Keyboard' to list all command and
showing their shortcuts

Unify macro command shortcut setting (BaseApp/Preferences/Shortcut).
2022-11-10 23:20:18 +01:00
marioalexis
ff1b4eff05 Gui: Replace C cast 2022-09-18 11:06:51 -05: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
wmayer
23961706be Gui: modernize C++: replace 'typedef' with 'using' 2022-08-29 14:09:18 +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
wmayer
85bd6b5c6b Fix several clazy issues:
* C++11 range-loop might detach Qt container [-Wclazy-range-loop-detach]
2022-07-24 23:48:37 +02:00
andrea
7886d3cbf4 Remove unused code into GUI 2022-07-17 03:53:11 +02:00
wmayer
ab6c75fad9 Core: replace PyObject_IsTrue with Base::asBoolean 2022-07-16 14:04:05 +02:00
wmayer
55828c22c0 Py: make FreeCAD to compile with Py3.11 2022-07-01 17:54:50 +02:00
Chris Hennes
cc1315dae1 Gui: Fix display of tooltips for GroupCommand
Fixes https://github.com/FreeCAD/FreeCAD-translations/issues/88 and https://github.com/FreeCAD/FreeCAD-translations/issues/72
2022-06-01 14:21:17 -05:00
marioalexis
88fb277481 Gui: Fix crash when invoke command with sMenuText equal to nullptr 2022-05-16 13:47:29 +02:00
Zheng, Lei
8bec44934b Fix mixed line endings 2022-04-26 12:52:55 -05:00
Chris Hennes
5df3dbae6f Gui: PR6497 move return statement to new line 2022-03-29 12:33:50 -05:00
wmayer
1178df06b4 Gui: modernize C++11
* use nullptr
2022-03-23 18:41:21 +01:00
Uwe
4f5c29edd6 [Gui] Quarter: remove unused includes 2022-03-09 01:12:15 +01:00
wmayer
8f786ea6ef Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
Uwe
c104c83f37 [Gui] remove some more unused headers 2022-02-19 04:31:27 +01:00
Uwe
36b3ac81d2 [Gui] remove more unused headers 2022-02-19 04:04:14 +01:00
Chris Hennes
019d1588a6 Gui: Correct generation of macro pref name 2022-02-17 10:23:32 -06:00
Chris Hennes
93836b89a5 GUI: Add Python interface to create custom command 2022-02-14 09:56:24 -06:00
wmayer
f36126770c App: harmonize API of App::Application
* make getHomePath() static and return a std::string
* make getExecutableName() static and return a std::string
2021-11-04 10:50:09 +01:00
wmayer
6f20e3e4d8 Gui: remove QT_TR_NOOP from command group names and use "CommandGroup" as context string 2021-09-29 16:31:55 +02:00
wmayer
f1431f06c9 Gui: [skip ci] support different context in Command::translatedGroupName 2021-09-29 15:44:44 +02:00
wmayer
76da77f80e Gui: add convenience function Command::translatedGroupName() 2021-09-29 15:25:46 +02:00
Yorik van Havre
4cab702b00 Merge pull request #5000 from chennes/checkForConflictingAccelerators
[Core] Add checks for conflicting accelerators
2021-08-30 11:46:38 +02:00
carlopav
e36b8f458f Gui: Improved tooltips for grouped commands
Following previous improvements, this fix allows also Grouped Actions to have the new tooltip.
2021-08-29 23:30:58 +02:00
Chris Hennes
767bc22948 [Core] Add checks for conflicting accelerators
When compiled in debug mode, this PR adds code to check for conflicting
accelerator keys when a command is created. This can help developers
ensure that their default accelerator key selections don't conflict.

Replace partial match algorithm

Co-authored-by: 0penBrain <48731257+0penBrain@users.noreply.github.com>
2021-08-29 16:13:59 -05:00
Chris Hennes
f194ca7425 [GUI] Refactor tooltip code to rebuild shortcut
When the shortcut/accelerator key is changed, the tooltip should be
recalculated using the same code that calculated the original. Also
ensure this happens when the accelerator preferences are loaded.

Fixes #4664.
2021-08-25 14:24:17 -05:00
carlopav
072fc9f0fe Gui: Improved tooltips
Improved tooltips showing:
- the command name as an <h3> title,
- the tooltip text,
- the (What's this).

the title is build from translated getMenuText() and can contain a "&" character. This commit search and remove the "&" characters. It should be better not to use the "&" character in the command name, but if it is necessary it has to be done with "&&".

ref forum discussion: https://forum.freecadweb.org/viewtopic.php?f=34&t=58747
.
2021-08-19 10:24:00 +02:00
luz paz
17ffa8255b Gui: remove py2 code 2021-04-25 11:27:48 +02:00
wmayer
3fd643d3ee fixes #0003844: PVS: The pointer was not released in destructor. A memory leak is possible. 2021-04-21 21:46:14 +02:00
wmayer
7babbb9825 Gui: fix Command::_invoke to avoid build failure 2021-03-29 11:06:16 +02:00
wmayer
ca83354bf9 Gui: [skip ci] refactor Command::invoke 2021-03-28 20:04:31 +02:00
wmayer
44c444bf2f Gui: Running a command with Gui.runCommand() must always be considered as Gui command 2021-03-28 18:40:16 +02:00